Search in sources :

Example 36 with PatternWrapper

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

the class ActionSetFactPluginTest method testSetFactFieldWhenFactPatternIsNew.

@Test
public void testSetFactFieldWhenFactPatternIsNew() {
    final ActionInsertFactWrapper actionWrapper = mock(ActionInsertFactWrapper.class);
    final PatternWrapper patternWrapperMock = patternWrapperMock("factType", "boundName");
    doReturn(true).when(plugin).isNewFactPattern();
    doReturn(actionWrapper).when(plugin).newActionInsertFactWrapper();
    doReturn(patternWrapperMock).when(plugin).patternWrapper();
    doReturn("type").when(oracle).getFieldType(any(), any());
    plugin.setFactField("selectedValue");
    verify(actionWrapper).setFactField(eq("selectedValue"));
    verify(actionWrapper).setFactType(eq("factType"));
    verify(actionWrapper).setBoundName(eq("boundName"));
    verify(actionWrapper).setType(eq("type"));
    verify(plugin).fireChangeEvent(fieldPage);
}
Also used : PatternWrapper(org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.PatternWrapper) ActionInsertFactWrapper(org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.ActionInsertFactWrapper) Test(org.junit.Test)

Example 37 with PatternWrapper

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

the class ActionSetFactPluginTest method testEditingPattern.

@Test
public void testEditingPattern() {
    final PatternWrapper patternWrapper = mock(PatternWrapper.class);
    doReturn(patternWrapper).when(plugin).patternWrapper();
    when(patternWrapper.getFactType()).thenReturn("factType");
    when(patternWrapper.getBoundName()).thenReturn("boundName");
    when(patternWrapper.isNegated()).thenReturn(false);
    when(patternWrapper.getEntryPointName()).thenReturn("entryPoint");
    final Pattern52 pattern52 = plugin.editingPattern();
    assertEquals("factType", pattern52.getFactType());
    assertEquals("boundName", pattern52.getBoundName());
    assertEquals(false, pattern52.isNegated());
    assertEquals("entryPoint", pattern52.getEntryPointName());
}
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 38 with PatternWrapper

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

the class ActionSetFactPluginTest method testIsNewFactPatternWhenIsExisting.

@Test
public void testIsNewFactPatternWhenIsExisting() throws Exception {
    mockPatterns();
    plugin.setEditingPattern(new PatternWrapper("factType", "boundName"));
    assertFalse(plugin.isNewFactPattern());
}
Also used : PatternWrapper(org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.PatternWrapper) Test(org.junit.Test)

Example 39 with PatternWrapper

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

the class ActionSetFactPluginTest method testSetEditingPattern.

@Test
public void testSetEditingPattern() {
    final ActionWrapper actionWrapper = mock(ActionWrapper.class);
    final PatternWrapper patternWrapper = mock(PatternWrapper.class);
    when(plugin.editingWrapper()).thenReturn(actionWrapper);
    when(patternWrapper.getFactType()).thenReturn("factType");
    when(patternWrapper.getBoundName()).thenReturn("boundName");
    plugin.setEditingPattern(patternWrapper);
    verify(actionWrapper).setFactField("");
    verify(actionWrapper).setFactType("factType");
    verify(actionWrapper).setBoundName("boundName");
    verify(actionWrapper).setType("");
    verify(plugin).fireChangeEvent(patternPage);
    verify(plugin).fireChangeEvent(fieldPage);
    verify(plugin).fireChangeEvent(additionalInfoPage);
}
Also used : PatternWrapper(org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.PatternWrapper) ActionWrapper(org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.ActionWrapper) Test(org.junit.Test)

Example 40 with PatternWrapper

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

the class ActionSetFactPluginTest method testSetupValuesWhenColumnIsNotNew.

@Test
public void testSetupValuesWhenColumnIsNotNew() throws Exception {
    final DTColumnConfig52 column = mock(DTColumnConfig52.class);
    final ActionWrapper actionWrapper = mock(ActionWrapper.class);
    final PatternWrapper patternWrapper = mock(PatternWrapper.class);
    doReturn(column).when(plugin).getOriginalColumnConfig52();
    doReturn(actionWrapper).when(plugin).newActionWrapper(column);
    doReturn(patternWrapper).when(plugin).newPatternWrapper(actionWrapper);
    doReturn(false).when(plugin).isNewColumn();
    plugin.setupValues();
    verify(plugin).setValueOptionsPageAsCompleted();
    verify(plugin).fireChangeEvent(patternPage);
    verify(plugin).fireChangeEvent(fieldPage);
    verify(plugin).fireChangeEvent(additionalInfoPage);
}
Also used : DTColumnConfig52(org.drools.workbench.models.guided.dtable.shared.model.DTColumnConfig52) PatternWrapper(org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.PatternWrapper) ActionWrapper(org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.ActionWrapper) 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