Search in sources :

Example 46 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 testSetupPatternWrapper.

@Test
public void testSetupPatternWrapper() throws Exception {
    final Pattern52 pattern52 = new Pattern52() {

        {
            setFactType("FactType");
            setBoundName("BoundName");
            setEntryPointName("EntryPointName");
            setNegated(true);
        }
    };
    when(plugin.getEditingPattern()).thenReturn(pattern52);
    plugin.setupPatternWrapper();
    final PatternWrapper patternWrapper = plugin.patternWrapper();
    assertEquals(patternWrapper.getFactType(), "FactType");
    assertEquals(patternWrapper.getBoundName(), "BoundName");
    assertEquals(patternWrapper.getEntryPointName(), "EntryPointName");
    assertEquals(patternWrapper.isNegated(), true);
}
Also used : Pattern52(org.drools.workbench.models.guided.dtable.shared.model.Pattern52) PatternWrapper(org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.PatternWrapper) Test(org.junit.Test)

Example 47 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 testGetFactType.

@Test
public void testGetFactType() throws Exception {
    final PatternWrapper pattern = mock(PatternWrapper.class);
    final String expectedFactType = "FactType";
    doReturn(expectedFactType).when(pattern).getFactType();
    doReturn(pattern).when(plugin).patternWrapper();
    final String factType = plugin.getFactType();
    assertEquals(expectedFactType, factType);
}
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 48 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 testEditingColWhenEditingPatternIsNotNull.

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

Example 49 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 testGetPatterns.

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

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

Example 50 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 testAppendColumnWhenColumnIsNew.

@Test
public void testAppendColumnWhenColumnIsNew() throws Exception {
    final PatternWrapper patternWrapper = mock(PatternWrapper.class);
    final Pattern52 pattern52 = mock(Pattern52.class);
    doReturn(true).when(plugin).isNewColumn();
    doReturn(editingCol).when(plugin).editingCol();
    doReturn(patternWrapper).when(plugin).patternWrapper();
    doReturn(pattern52).when(plugin).editingPattern();
    plugin.appendColumn();
    verify(presenter).appendColumn(pattern52, editingCol);
}
Also used : Pattern52(org.drools.workbench.models.guided.dtable.shared.model.Pattern52) 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