use of org.drools.workbench.models.guided.dtable.shared.model.Pattern52 in project drools-wb by kiegroup.
the class GuidedDecisionTablePresenterTest method updateConditionColumn.
@Test
public void updateConditionColumn() 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);
final ConditionCol52 updateCondition = new ConditionCol52();
updateCondition.setFactField("newField");
updateCondition.setHeader("newHeader");
dtPresenter.updateColumn(condition, updateCondition);
verify(synchronizer, times(1)).updateColumn(eq(condition), eq(updateCondition));
verify(modellerPresenter, times(1)).updateLinks();
}
use of org.drools.workbench.models.guided.dtable.shared.model.Pattern52 in project drools-wb by kiegroup.
the class GuidedDecisionTablePresenterTest method getBindingsWithSimpleClassName.
@Test
public void getBindingsWithSimpleClassName() {
final Pattern52 pattern1 = new Pattern52();
pattern1.setFactType("FactType1");
pattern1.setBoundName("$fact1");
final ConditionCol52 condition1 = new ConditionCol52();
condition1.setFactField("field");
condition1.setBinding("$field1");
pattern1.getChildColumns().add(condition1);
final Pattern52 pattern2 = new Pattern52();
pattern2.setFactType("FactType1");
final ConditionCol52 condition2 = new ConditionCol52();
condition2.setFactField("field");
pattern2.getChildColumns().add(condition2);
when(oracle.getFieldClassName(eq("FactType1"), eq("field"))).thenReturn("FactType1");
dtPresenter.getModel().getConditions().add(pattern1);
dtPresenter.getModel().getConditions().add(pattern2);
final Set<String> bindings = dtPresenter.getBindings("FactType1");
assertNotNull(bindings);
assertEquals(2, bindings.size());
assertTrue(bindings.contains("$fact1"));
assertTrue(bindings.contains("$field1"));
}
use of org.drools.workbench.models.guided.dtable.shared.model.Pattern52 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.Pattern52 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.Pattern52 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);
}
Aggregations