Search in sources :

Example 1 with ActionInsertFactWrapper

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

the class ActionSetFactPluginTest method testSetFactFieldWhenColumnIsNotNew.

@Test
public void testSetFactFieldWhenColumnIsNotNew() {
    final ActionInsertFactWrapper actionWrapper = mock(ActionInsertFactWrapper.class);
    final PatternWrapper patternWrapperMock = patternWrapperMock("factType", "boundName");
    doReturn(false).when(plugin).isNewColumn();
    doReturn(true).when(plugin).isNewFactPattern();
    doReturn(actionWrapper).when(plugin).editingWrapper();
    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);
    verify(plugin, never()).newActionInsertFactWrapper();
}
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 2 with ActionInsertFactWrapper

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

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

the class ActionSetFactPluginTest method testNewActionWrapperWhenColumnIsAnActionInsertFactCol52.

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

Aggregations

ActionInsertFactWrapper (org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.ActionInsertFactWrapper)3 Test (org.junit.Test)3 PatternWrapper (org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.PatternWrapper)2 ActionInsertFactCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionInsertFactCol52)1 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)1 ActionWrapper (org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.ActionWrapper)1