@Test public void testInitDefaultValue() throws Exception { when(event.getEditedDefaultValue()).thenReturn(defaultValue); columnConfigRow.init(attributeColumn, presenter); verify(view).addDefaultValue(eq(attributeColumn), eq(true), defaultValueCaptor.capture()); //Simulates that checkbox was clicked defaultValueCaptor.getValue().onDefaultValueChanged(event); verify(editedAttributeColumn).setDefaultValue(defaultValue); verify(decisionTable).updateColumn(attributeColumn, editedAttributeColumn); }
private AttributeCol52 makeNewColumn(AttributeCol c) { AttributeCol52 nc = new AttributeCol52(); nc.setAttribute(c.attr); nc.setDefaultValue(new DTCellValue52(c.defaultValue)); nc.setHideColumn(c.hideColumn); nc.setReverseOrder(c.reverseOrder); nc.setUseRowNumber(c.useRowNumber); nc.setWidth(c.width); return nc; }
@Test(expected = IllegalArgumentException.class) public void blockUseOfActivationGroup() { final AttributeCol52 attributeCol52 = new AttributeCol52(); attributeCol52.setAttribute( "activation-group" ); attributeCol52.setDefaultValue( new DTCellValue52( "test" ) ); dtable.getAttributeCols() .add( attributeCol52 ); GuidedDTDRLPersistence.getInstance() .marshal( dtable ); }
@Test(expected = IllegalArgumentException.class) public void blockUseOfSalience() { final AttributeCol52 attributeCol52 = new AttributeCol52(); attributeCol52.setAttribute( "salience" ); attributeCol52.setDefaultValue( new DTCellValue52( "123" ) ); dtable.getAttributeCols() .add( attributeCol52 ); GuidedDTDRLPersistence.getInstance() .marshal( dtable ); }
private void update(final AttributeCol52 originalColumn, final AttributeCol52 editedColumn) { originalColumn.setAttribute(editedColumn.getAttribute()); originalColumn.setReverseOrder(editedColumn.isReverseOrder()); originalColumn.setUseRowNumber(editedColumn.isUseRowNumber()); originalColumn.setHideColumn(editedColumn.isHideColumn()); originalColumn.setHeader(editedColumn.getHeader()); originalColumn.setDefaultValue(editedColumn.getDefaultValue()); }
@Test(expected = IllegalArgumentException.class) public void blockUseOfSalience() { final AttributeCol52 attributeCol52 = new AttributeCol52(); attributeCol52.setAttribute( "salience" ); attributeCol52.setDefaultValue( new DTCellValue52( "123" ) ); dtable.getAttributeCols() .add( attributeCol52 ); GuidedDTDRLPersistence.getInstance() .marshal( dtable ); }
@Test(expected = IllegalArgumentException.class) public void blockUseOfSalience() { final AttributeCol52 attributeCol52 = new AttributeCol52(); attributeCol52.setAttribute( "salience" ); attributeCol52.setDefaultValue( new DTCellValue52( "123" ) ); dtable.getAttributeCols() .add( attributeCol52 ); GuidedDTDRLPersistence.getInstance() .marshal( dtable ); }
@Test(expected = IllegalArgumentException.class) public void blockUseOfActivationGroup() { final AttributeCol52 attributeCol52 = new AttributeCol52(); attributeCol52.setAttribute( "activation-group" ); attributeCol52.setDefaultValue( new DTCellValue52( "test" ) ); dtable.getAttributeCols() .add( attributeCol52 ); GuidedDTDRLPersistence.getInstance() .marshal( dtable ); }
@Test(expected = IllegalArgumentException.class) public void blockUseOfActivationGroup() { final AttributeCol52 attributeCol52 = new AttributeCol52(); attributeCol52.setAttribute( "activation-group" ); attributeCol52.setDefaultValue( new DTCellValue52( "test" ) ); dtable.getAttributeCols() .add( attributeCol52 ); GuidedDTDRLPersistence.getInstance() .marshal( dtable ); }
private void update(final AttributeCol52 originalColumn, final AttributeCol52 editedColumn) { originalColumn.setAttribute(editedColumn.getAttribute()); originalColumn.setReverseOrder(editedColumn.isReverseOrder()); originalColumn.setUseRowNumber(editedColumn.isUseRowNumber()); originalColumn.setHideColumn(editedColumn.isHideColumn()); originalColumn.setHeader(editedColumn.getHeader()); originalColumn.setDefaultValue(editedColumn.getDefaultValue()); }
@Test public void testInitialisationOfBooleanCellsWithDefaultValue() throws VetoException { setupBooleanColumn((c) -> c.setDefaultValue(new DTCellValue52(true))); modelSynchronizer.appendRow(); assertTrue(model.getData().get(0).get(2).getBooleanValue()); assertTrue((Boolean) uiModel.getCell(0, 2).getValue().getValue()); }
@Test public void testInitialisationOfBooleanCellsWithNullDefaultValue() throws VetoException { setupBooleanColumn((c) -> c.setDefaultValue(new DTCellValue52((Boolean) null))); modelSynchronizer.appendRow(); assertFalse(model.getData().get(0).get(2).getBooleanValue()); assertFalse((Boolean) uiModel.getCell(0, 2).getValue().getValue()); }
@Test public void checkBooleanDefaultValueTrue() throws VetoException { final AttributeCol52 column = new AttributeCol52(); column.setAttribute(RuleAttributeWidget.ENABLED_ATTR); column.setDefaultValue(new DTCellValue52(true)); modelSynchronizer.appendColumn(column); modelSynchronizer.appendRow(); assertTrue((Boolean) uiModel.getRow(0).getCells().get(2).getValue().getValue()); assertTrue(model.getData().get(0).get(2).getBooleanValue()); }
@Test public void checkBooleanDefaultValueFalse() throws VetoException { final AttributeCol52 column = new AttributeCol52(); column.setAttribute(RuleAttributeWidget.ENABLED_ATTR); column.setDefaultValue(new DTCellValue52(false)); modelSynchronizer.appendColumn(column); modelSynchronizer.appendRow(); assertFalse((Boolean) uiModel.getRow(0).getCells().get(2).getValue().getValue()); assertFalse(model.getData().get(0).get(2).getBooleanValue()); }
column1.setHeader("header1"); column1.setHideColumn(false); column1.setDefaultValue(new DTCellValue52("default1")); column2.setAttribute("attr2"); column2.setReverseOrder(true); column2.setHeader("header2"); column2.setHideColumn(true); column2.setDefaultValue(new DTCellValue52("default2"));
@Before public void setup() { column1 = new AttributeCol52(); column1.setAttribute("attr"); column1.setReverseOrder(false); column1.setUseRowNumber(false); column1.setHeader("header"); column1.setHideColumn(false); column1.setDefaultValue(new DTCellValue52("default")); column2 = new AttributeCol52(); column2.setAttribute("attr"); column2.setReverseOrder(false); column2.setUseRowNumber(false); column2.setHeader("header"); column2.setHideColumn(false); column2.setDefaultValue(new DTCellValue52("default")); }
attr.setDefaultValue(new DTCellValue52("66")); dt.getAttributeCols().add(attr);
attr.setDefaultValue(new DTCellValue52("66")); dt.getAttributeCols().add(attr);
@Test public void getSafeHtml_Attribute() { AttributeCol52 originalColumn = new AttributeCol52(); originalColumn.setReverseOrder(false); originalColumn.setUseRowNumber(false); originalColumn.setHideColumn(false); originalColumn.setDefaultValue(new DTCellValue52("def1")); // header & attribute name of an attribute column cannot be updated in the ui originalColumn.setAttribute("attr"); originalColumn.setHeader("attr"); AttributeCol52 newColumn = new AttributeCol52(); newColumn.setReverseOrder(true); newColumn.setUseRowNumber(true); newColumn.setHideColumn(true); newColumn.setDefaultValue(new DTCellValue52("def2")); // header & attribute name of an attribute column cannot be updated in the ui newColumn.setAttribute("attr"); newColumn.setHeader("attr"); List<BaseColumnFieldDiff> diffs = originalColumn.diff(newColumn); SafeHtml result = helper.getSafeHtml(new UpdateColumnAuditLogEntry("mock user", originalColumn, newColumn, diffs)); assertEquals(getAttributeHeaderRepre(newColumn.getAttribute()) + getDiffRepre(diffs), result.asString()); }
attr.setDefaultValue(new DTCellValue52("66")); dt.getAttributeCols().add(attr);