Search in sources :

Example 11 with PatternWrapper

use of org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.PatternWrapper in project drools-wb by kiegroup.

the class ConditionColumnPluginTest method testSetEntryPointName.

@Test
public void testSetEntryPointName() throws Exception {
    final PatternWrapper pattern = mock(PatternWrapper.class);
    doReturn(pattern).when(plugin).patternWrapper();
    plugin.setEntryPointName("EntryPointName");
    verify(pattern).setEntryPointName("EntryPointName");
}
Also used : PatternWrapper(org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.PatternWrapper) Test(org.junit.Test)

Example 12 with PatternWrapper

use of org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.PatternWrapper in project drools-wb by kiegroup.

the class ConditionColumnPluginTest method testSetFactField.

@Test
public void testSetFactField() throws Exception {
    final PatternWrapper pattern = mock(PatternWrapper.class);
    doReturn("FactField").when(editingCol).getFactField();
    doReturn(editingCol).when(plugin).editingCol();
    doReturn("FactType").when(pattern).getFactType();
    doReturn(pattern).when(plugin).patternWrapper();
    doReturn(oracle).when(presenter).getDataModelOracle();
    plugin.setFactField("FactField");
    verify(editingCol).setFactField("FactField");
    verify(editingCol).setFieldType(oracle.getFieldType("FactField", "FactType"));
    verify(plugin).fireChangeEvent(fieldPage);
    verify(plugin).fireChangeEvent(operatorPage);
    verify(plugin).fireChangeEvent(additionalInfoPage);
    verify(plugin).fireChangeEvent(valueOptionsPage);
}
Also used : PatternWrapper(org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.PatternWrapper) Test(org.junit.Test)

Example 13 with PatternWrapper

use of org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.PatternWrapper in project drools-wb by kiegroup.

the class ConditionColumnPluginTest method testGetEntryPointNameWheeunEditingPatternIsNotPresent.

@Test
public void testGetEntryPointNameWheeunEditingPatternIsNotPresent() throws Exception {
    final PatternWrapper patternWrapper = new PatternWrapper();
    doReturn(patternWrapper).when(plugin).patternWrapper();
    final String entryPointName = plugin.getEntryPointName();
    assertEquals("", entryPointName);
}
Also used : PatternWrapper(org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.PatternWrapper) Mockito.anyString(org.mockito.Mockito.anyString) Test(org.junit.Test)

Example 14 with PatternWrapper

use of org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.PatternWrapper in project drools-wb by kiegroup.

the class ConditionColumnPluginTest method testGetPatternsWithBRLCondition.

@Test
public void testGetPatternsWithBRLCondition() throws Exception {
    final Pattern52 pattern = new Pattern52() {

        {
            setFactType("FactType");
            setBoundName("$fact");
        }
    };
    final BRLConditionColumn brlColumn = new BRLConditionColumn();
    final FactPattern fp = new FactPattern("AnotherFact") {

        {
            setBoundName("$another");
        }
    };
    brlColumn.setDefinition(Collections.singletonList(fp));
    doReturn(Arrays.asList(pattern, brlColumn)).when(model).getConditions();
    doReturn(pattern).when(model).getConditionPattern(eq("$fact"));
    doReturn(new FactPatternPattern52Adaptor(fp)).when(model).getConditionPattern(eq("$another"));
    final Set<PatternWrapper> patterns = plugin.getPatterns();
    assertEquals(1, patterns.size());
    assertTrue(patterns.contains(new PatternWrapper("FactType", "$fact", false)));
}
Also used : BRLConditionColumn(org.drools.workbench.models.guided.dtable.shared.model.BRLConditionColumn) Pattern52(org.drools.workbench.models.guided.dtable.shared.model.Pattern52) FactPattern(org.drools.workbench.models.datamodel.rule.FactPattern) PatternWrapper(org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.PatternWrapper) FactPatternPattern52Adaptor(org.drools.workbench.models.guided.dtable.shared.model.adaptors.FactPatternPattern52Adaptor) Test(org.junit.Test)

Example 15 with PatternWrapper

use of org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.PatternWrapper in project drools-wb by kiegroup.

the class ConditionColumnPluginTest method testEditingColWhenEditingPatternIsNull.

@Test
public void testEditingColWhenEditingPatternIsNull() throws Exception {
    final PatternWrapper pattern = mock(PatternWrapper.class);
    doReturn("").when(pattern).getFactType();
    doReturn(pattern).when(plugin).patternWrapper();
    plugin.editingCol();
    verify(plugin).resetFieldAndOperator();
}
Also used : PatternWrapper(org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.PatternWrapper) Test(org.junit.Test)

Aggregations

PatternWrapper (org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.PatternWrapper)52 Test (org.junit.Test)41 HashSet (java.util.HashSet)11 Pattern52 (org.drools.workbench.models.guided.dtable.shared.model.Pattern52)9 BRLRuleModel (org.drools.workbench.models.guided.dtable.shared.model.BRLRuleModel)6 Mockito.anyString (org.mockito.Mockito.anyString)6 DTColumnConfig52 (org.drools.workbench.models.guided.dtable.shared.model.DTColumnConfig52)4 ActionWrapper (org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.ActionWrapper)4 FactPattern (org.drools.workbench.models.datamodel.rule.FactPattern)3 ActionCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionCol52)3 ActionWorkItemWrapper (org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.ActionWorkItemWrapper)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Optional (java.util.Optional)2 Set (java.util.Set)2 Collectors (java.util.stream.Collectors)2 Dependent (javax.enterprise.context.Dependent)2 Event (javax.enterprise.event.Event)2 Inject (javax.inject.Inject)2 BaseSingleFieldConstraint (org.drools.workbench.models.datamodel.rule.BaseSingleFieldConstraint)2