Search in sources :

Example 1 with ConditionColumnPlugin

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);
}
Also used : BRLConditionColumnPlugin(org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.BRLConditionColumnPlugin) ConditionColumnPlugin(org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.ConditionColumnPlugin)

Example 2 with ConditionColumnPlugin

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);
}
Also used : ConditionColumnPlugin(org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.ConditionColumnPlugin) BRLConditionColumnPlugin(org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.BRLConditionColumnPlugin) ConditionCol52(org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52) Pattern52(org.drools.workbench.models.guided.dtable.shared.model.Pattern52) Test(org.junit.Test)

Example 3 with ConditionColumnPlugin

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);
}
Also used : ConditionColumnPlugin(org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.ConditionColumnPlugin) ModelField(org.kie.soup.project.datamodel.oracle.ModelField) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Aggregations

ConditionColumnPlugin (org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.ConditionColumnPlugin)3 BRLConditionColumnPlugin (org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.BRLConditionColumnPlugin)2 Test (org.junit.Test)2 ArrayList (java.util.ArrayList)1 ConditionCol52 (org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52)1 Pattern52 (org.drools.workbench.models.guided.dtable.shared.model.Pattern52)1 ModelField (org.kie.soup.project.datamodel.oracle.ModelField)1