use of org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.ConditionColumnPlugin in project drools-wb by kiegroup.
the class PluginHandler method edit.
public void edit(final Pattern52 pattern, final ConditionCol52 column) {
final ConditionColumnPlugin plugin = conditionColumnPlugin.get();
plugin.setOriginalPattern52(pattern);
plugin.setOriginalColumnConfig52(column);
openWizard(plugin);
}
use of org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.ConditionColumnPlugin 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.screens.guided.dtable.client.wizard.column.plugins.ConditionColumnPlugin in project drools-wb by kiegroup.
the class FieldPageTest method testFieldsCallbackWhenConstraintIsRetValue.
@Test
public void testFieldsCallbackWhenConstraintIsRetValue() throws Exception {
final ConditionColumnPlugin plugin = spy(new ConditionColumnPlugin(patternPage, calculationTypePage, fieldPage, operatorPage, valueOptionsPage, additionalInfoPage, changeEvent, translationService));
doReturn(BaseSingleFieldConstraint.TYPE_RET_VALUE).when(plugin).constraintValue();
when(page.plugin()).thenReturn(plugin);
when(pattern52.getFactType()).thenReturn("factType");
when(plugin.patternWrapper()).thenReturn(pattern52);
when(presenter.getDataModelOracle()).thenReturn(oracle);
when(oracle.hasEnums("factType", "modelField2")).thenReturn(true);
final List<String> expected = new ArrayList<String>() {
{
add("modelField1");
add("modelField3");
}
};
final List<String> result = new ArrayList<>();
final ModelField[] modelFields = new ModelField[] { modelField("modelField1", DataType.TYPE_OBJECT), modelField("modelField2", DataType.TYPE_OBJECT), modelField("modelField3", DataType.TYPE_OBJECT) };
final Callback<ModelField[]> fieldsCallback = page.fieldsCallback(result::add);
fieldsCallback.callback(modelFields);
assertEquals(expected, result);
}
Aggregations