use of org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52 in project drools-wb by kiegroup.
the class GuidedDecisionTablePresenterTest method deleteConditionColumn.
@Test
public void deleteConditionColumn() throws VetoException {
final Pattern52 pattern = new Pattern52();
pattern.setFactType("FactType");
final ConditionCol52 condition = new ConditionCol52();
condition.setFactField("field");
condition.setHeader("header");
dtPresenter.appendColumn(pattern, condition);
reset(modellerPresenter);
dtPresenter.deleteColumn(condition);
verify(synchronizer, times(1)).deleteColumn(eq(condition));
verify(modellerPresenter, times(1)).updateLinks();
checkDTSelectionsChangedEventFired(1);
}
use of org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52 in project drools-wb by kiegroup.
the class GuidedDecisionTablePresenter_AuditLogTest method updateColumnAddsToLog.
@Test
public void updateColumnAddsToLog() throws VetoException {
dtPresenter.updateColumn(new ActionCol52(), new ActionCol52());
dtPresenter.updateColumn(new AttributeCol52(), new AttributeCol52());
dtPresenter.updateColumn(new ConditionCol52(), new ConditionCol52());
dtPresenter.updateColumn(new MetadataCol52(), new MetadataCol52());
dtPresenter.updateColumn(new Pattern52(), new ConditionCol52(), new Pattern52(), new ConditionCol52());
verify(synchronizer, times(4)).updateColumn(any(BaseColumn.class), any(BaseColumn.class));
verify(synchronizer).updateColumn(any(Pattern52.class), any(ConditionCol52.class), any(Pattern52.class), any(ConditionCol52.class));
verify(model, times(5)).getAuditLog();
assertEquals(5, model.getAuditLog().size());
for (UpdateColumnAuditLogEntry entry : model.getAuditLog().toArray(new UpdateColumnAuditLogEntry[0])) {
assertEquals(diffs, entry.getDiffs());
}
}
use of org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52 in project drools-wb by kiegroup.
the class PluginHandlerTest method testEditWhenColumnIsAConditionCol52.
@Test
public void testEditWhenColumnIsAConditionCol52() {
final Pattern52 originalPattern = mock(Pattern52.class);
final ConditionCol52 originalColumn = mock(ConditionCol52.class);
final ConditionColumnPlugin plugin = spy(new ConditionColumnPlugin(patternPage, calculationTypePage, fieldPage, operatorPage, valueOptionsPage, additionalInfoPage, event, translationService));
doReturn(wizard).when(wizardManagedInstance).get();
doReturn(plugin).when(conditionColumnPlugin).get();
doReturn(new Pattern52()).when(plugin).getEditingPattern();
pluginHandler.edit(originalPattern, originalColumn);
verify(plugin).setOriginalPattern52(originalPattern);
verify(plugin).setOriginalColumnConfig52(originalColumn);
verify(pluginHandler).openWizard(plugin);
verify(wizard).start(plugin);
}
use of org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52 in project drools-wb by kiegroup.
the class ColumnManagementViewTest method testRenderColumnPatternEditable.
@Test
public void testRenderColumnPatternEditable() throws Exception {
final Pattern52 pattern = new Pattern52() {
{
setBoundName("p");
setFactType("Person");
getChildColumns().add(new ConditionCol52() {
{
setHeader("one");
}
});
getChildColumns().add(new ConditionCol52() {
{
setHeader("two");
}
});
getChildColumns().add(new ConditionCol52() {
{
setHeader("three");
}
});
}
};
final Map<String, List<BaseColumn>> columnGroups = new HashMap<String, List<BaseColumn>>() {
{
put("Person [p]", Collections.singletonList(pattern));
}
};
final ColumnLabelWidget columnLabel = mockColumnLabelWidget();
doReturn(columnLabel).when(view).newColumnLabelWidget(anyString());
doReturn(true).when(modellerPresenter).isActiveDecisionTableEditable();
view.renderColumns(columnGroups);
verify(view).renderColumn(pattern);
// Pattern has three child columns
verify(horizontalPanel, times(3)).add(columnLabel);
verify(view, times(3)).editAnchor(clickHandlerCaptor.capture());
verify(view).deleteAnchor(eq("one"), any(Command.class));
verify(view).deleteAnchor(eq("two"), any(Command.class));
verify(view).deleteAnchor(eq("three"), any(Command.class));
clickHandlerCaptor.getAllValues().get(0).onClick(mock(ClickEvent.class));
verify(decisionTablePresenter).editCondition(eq(pattern), eq(pattern.getChildColumns().get(0)));
clickHandlerCaptor.getAllValues().get(1).onClick(mock(ClickEvent.class));
verify(decisionTablePresenter).editCondition(eq(pattern), eq(pattern.getChildColumns().get(1)));
clickHandlerCaptor.getAllValues().get(2).onClick(mock(ClickEvent.class));
verify(decisionTablePresenter).editCondition(eq(pattern), eq(pattern.getChildColumns().get(2)));
}
use of org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52 in project drools-wb by kiegroup.
the class ConditionColumnPlugin method clone.
ConditionCol52 clone(final ConditionCol52 column) {
final ConditionCol52 clone;
if (tableFormat() == LIMITED_ENTRY) {
clone = new LimitedEntryConditionCol52() {
{
setValue(cloneDTCellValue(((LimitedEntryCol) column).getValue()));
}
};
} else {
clone = new ConditionCol52();
}
clone.setConstraintValueType(column.getConstraintValueType());
clone.setFactField(column.getFactField());
clone.setFieldType(column.getFieldType());
clone.setHeader(column.getHeader());
clone.setOperator(column.getOperator());
clone.setValueList(column.getValueList());
clone.setDefaultValue(cloneDTCellValue(column.getDefaultValue()));
clone.setHideColumn(column.isHideColumn());
clone.setParameters(column.getParameters());
clone.setWidth(column.getWidth());
clone.setBinding(column.getBinding());
return clone;
}
Aggregations