Search in sources :

Example 6 with PatternWrapper

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

the class ActionWorkItemSetFieldPluginTest method mockPatternWrapper.

private PatternWrapper mockPatternWrapper(final String boundName) {
    final PatternWrapper wrapper = mock(PatternWrapper.class);
    when(wrapper.getBoundName()).thenReturn(boundName);
    return wrapper;
}
Also used : PatternWrapper(org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.PatternWrapper)

Example 7 with PatternWrapper

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

the class ActionWorkItemSetFieldPluginTest method testSetupValuesWhenColumnIsNotNew.

@Test
public void testSetupValuesWhenColumnIsNotNew() throws Exception {
    final DTColumnConfig52 column = mock(DTColumnConfig52.class);
    final ActionWorkItemWrapper actionWrapper = mock(ActionWorkItemWrapper.class);
    final PatternWrapper patternWrapper = mock(PatternWrapper.class);
    doReturn(model).when(presenter).getModel();
    doReturn(column).when(plugin).getOriginalColumnConfig52();
    doReturn(actionWrapper).when(plugin).newActionWorkItemWrapper(column);
    doReturn(patternWrapper).when(plugin).newPatternWrapper(actionWrapper);
    doReturn("WorkItemName").when(actionWrapper).getWorkItemName();
    doReturn("WorkItemResultParameterName").when(actionWrapper).getWorkItemResultParameterName();
    doReturn(new ArrayList<ActionCol52>()).when(model).getActionCols();
    doReturn(false).when(plugin).isNewColumn();
    plugin.setupValues();
    verify(plugin).setupWorkItems();
    verify(plugin).setWorkItem("WorkItemName:WorkItemResultParameterName");
    verify(plugin).setWorkItemPageAsCompleted();
    verify(plugin).fireChangeEvent(patternPage);
    verify(plugin).fireChangeEvent(fieldPage);
    verify(plugin).fireChangeEvent(additionalInfoPage);
}
Also used : ActionCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionCol52) DTColumnConfig52(org.drools.workbench.models.guided.dtable.shared.model.DTColumnConfig52) ActionWorkItemWrapper(org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.ActionWorkItemWrapper) PatternWrapper(org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.PatternWrapper) Test(org.junit.Test)

Example 8 with PatternWrapper

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

the class ActionWorkItemSetFieldPluginTest method testSetEditingPattern.

@Test
public void testSetEditingPattern() throws Exception {
    final PatternWrapper patternWrapper = mock(PatternWrapper.class);
    plugin.setEditingPattern(patternWrapper);
    verify(editingWrapper).setFactField(null);
    verify(editingWrapper).setFactType(null);
    verify(editingWrapper).setBoundName(null);
    verify(editingWrapper).setType(null);
    verify(plugin).fireChangeEvent(patternPage);
    verify(plugin).fireChangeEvent(fieldPage);
    verify(plugin).fireChangeEvent(additionalInfoPage);
    assertEquals(patternWrapper, plugin.patternWrapper());
}
Also used : PatternWrapper(org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.PatternWrapper) Test(org.junit.Test)

Example 9 with PatternWrapper

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

the class ActionWorkItemSetFieldPluginTest 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 10 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 testGetEditingPattern.

@Test
public void testGetEditingPattern() throws Exception {
    final PatternWrapper patternWrapper = mock(PatternWrapper.class);
    final InOrder inOrder = inOrder(plugin);
    plugin.setEditingPattern(patternWrapper);
    inOrder.verify(plugin).setupDefaultValues();
    inOrder.verify(plugin).setPatternWrapper(patternWrapper);
    verify(plugin).setupDefaultValues();
    verify(plugin).fireChangeEvent(patternPage);
    verify(plugin).fireChangeEvent(calculationTypePage);
    verify(plugin).fireChangeEvent(fieldPage);
    verify(plugin).fireChangeEvent(operatorPage);
    verify(plugin).fireChangeEvent(valueOptionsPage);
    verify(plugin).fireChangeEvent(additionalInfoPage);
}
Also used : InOrder(org.mockito.InOrder) 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