Search in sources :

Example 1 with ActionWorkItemWrapper

use of org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.ActionWorkItemWrapper 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 2 with ActionWorkItemWrapper

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

the class ActionWorkItemSetFieldPluginTest method testNewActionWrapperWhenColumnIsAnActionSetFactWrapper.

@Test
public void testNewActionWrapperWhenColumnIsAnActionSetFactWrapper() throws Exception {
    when(model.getTableFormat()).thenReturn(GuidedDecisionTable52.TableFormat.EXTENDED_ENTRY);
    when(presenter.getModel()).thenReturn(model);
    final ActionWorkItemWrapper wrapper = plugin.newActionWorkItemWrapper(mock(ActionWorkItemSetFieldCol52.class));
    assertTrue(wrapper instanceof ActionWorkItemSetWrapper);
}
Also used : ActionWorkItemWrapper(org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.ActionWorkItemWrapper) ActionWorkItemSetWrapper(org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.ActionWorkItemSetWrapper) ActionWorkItemSetFieldCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionWorkItemSetFieldCol52) Test(org.junit.Test)

Example 3 with ActionWorkItemWrapper

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

the class ActionWorkItemSetFieldPluginTest method testNewActionWrapperWhenColumnIsAnActionWorkItemInsertFactCol52.

@Test
public void testNewActionWrapperWhenColumnIsAnActionWorkItemInsertFactCol52() throws Exception {
    when(model.getTableFormat()).thenReturn(GuidedDecisionTable52.TableFormat.EXTENDED_ENTRY);
    when(presenter.getModel()).thenReturn(model);
    final ActionWorkItemWrapper wrapper = plugin.newActionWorkItemWrapper(mock(ActionWorkItemInsertFactCol52.class));
    assertTrue(wrapper instanceof ActionWorkItemInsertWrapper);
}
Also used : ActionWorkItemInsertWrapper(org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.ActionWorkItemInsertWrapper) ActionWorkItemInsertFactCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionWorkItemInsertFactCol52) ActionWorkItemWrapper(org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.ActionWorkItemWrapper) Test(org.junit.Test)

Example 4 with ActionWorkItemWrapper

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

the class ActionWorkItemSetFieldPluginTest method testNewPatternWrapperWhenPatternIsNotFound.

@Test
public void testNewPatternWrapperWhenPatternIsNotFound() throws Exception {
    final Set<PatternWrapper> actionWrappers = new HashSet<>();
    final ActionWorkItemWrapper actionWrapper = mockActionWrapper("BoundName", "FactType");
    doReturn(actionWrappers).when(plugin).getPatterns();
    final PatternWrapper patternWrapper = plugin.newPatternWrapper(actionWrapper);
    assertEquals(actionWrapper.getBoundName(), patternWrapper.getBoundName());
    assertEquals(actionWrapper.getFactType(), patternWrapper.getFactType());
}
Also used : 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) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 5 with ActionWorkItemWrapper

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

the class ActionWorkItemSetFieldPluginTest method mockActionWrapper.

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

Aggregations

ActionWorkItemWrapper (org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.ActionWorkItemWrapper)5 Test (org.junit.Test)4 PatternWrapper (org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.PatternWrapper)2 HashSet (java.util.HashSet)1 ActionCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionCol52)1 ActionWorkItemInsertFactCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionWorkItemInsertFactCol52)1 ActionWorkItemSetFieldCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionWorkItemSetFieldCol52)1 DTColumnConfig52 (org.drools.workbench.models.guided.dtable.shared.model.DTColumnConfig52)1 ActionWorkItemInsertWrapper (org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.ActionWorkItemInsertWrapper)1 ActionWorkItemSetWrapper (org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.ActionWorkItemSetWrapper)1