Search in sources :

Example 31 with ActionCol52

use of org.drools.workbench.models.guided.dtable.shared.model.ActionCol52 in project drools-wb by kiegroup.

the class ActionWorkItemSetFieldPluginTest method testGenerateColumnWhenColumnIsNew.

@Test
public void testGenerateColumnWhenColumnIsNew() throws Exception {
    final ActionCol52 actionCol52 = mock(ActionCol52.class);
    final String header = "header";
    doReturn(true).when(plugin).isNewColumn();
    doReturn(header).when(editingWrapper).getHeader();
    doReturn("factField").when(editingWrapper).getFactField();
    doReturn("factType").when(editingWrapper).getFactType();
    doReturn(editingWrapper).when(plugin).editingWrapper();
    doReturn(actionCol52).when(editingWrapper).getActionCol52();
    final Boolean success = plugin.generateColumn();
    assertTrue(success);
    verify(presenter).appendColumn(actionCol52);
    verify(translationService, never()).format(any());
}
Also used : ActionCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionCol52) Mockito.anyString(org.mockito.Mockito.anyString) Test(org.junit.Test)

Example 32 with ActionCol52

use of org.drools.workbench.models.guided.dtable.shared.model.ActionCol52 in project drools-wb by kiegroup.

the class ActionWorkItemSetFieldPluginTest method testEditingCol.

@Test
public void testEditingCol() throws Exception {
    final ActionCol52 expectedAction = mock(ActionCol52.class);
    doReturn(expectedAction).when(editingWrapper).getActionCol52();
    final ActionCol52 actualAction = plugin.editingCol();
    assertEquals(expectedAction, actualAction);
}
Also used : ActionCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionCol52) Test(org.junit.Test)

Example 33 with ActionCol52

use of org.drools.workbench.models.guided.dtable.shared.model.ActionCol52 in project drools-wb by kiegroup.

the class BRLActionColumnPluginTest method testGetAlreadyUsedColumnNames.

@Test
public void testGetAlreadyUsedColumnNames() throws Exception {
    final GuidedDecisionTable52 model = new GuidedDecisionTable52();
    model.getActionCols().add(new ActionCol52() {

        {
            setHeader("a");
        }
    });
    model.getActionCols().add(new ActionCol52() {

        {
            setHeader("b");
        }
    });
    when(presenter.getModel()).thenReturn(model);
    assertEquals(2, plugin.getAlreadyUsedColumnHeaders().size());
    assertTrue(plugin.getAlreadyUsedColumnHeaders().contains("a"));
    assertTrue(plugin.getAlreadyUsedColumnHeaders().contains("b"));
}
Also used : GuidedDecisionTable52(org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52) ActionCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionCol52) Test(org.junit.Test)

Example 34 with ActionCol52

use of org.drools.workbench.models.guided.dtable.shared.model.ActionCol52 in project drools-wb by kiegroup.

the class ActionSetFactPluginTest method testGetAlreadyUsedColumnNames.

@Test
public void testGetAlreadyUsedColumnNames() throws Exception {
    final GuidedDecisionTable52 model = new GuidedDecisionTable52();
    model.getActionCols().add(new ActionCol52() {

        {
            setHeader("a");
        }
    });
    model.getActionCols().add(new ActionCol52() {

        {
            setHeader("b");
        }
    });
    when(presenter.getModel()).thenReturn(model);
    assertEquals(2, plugin.getAlreadyUsedColumnHeaders().size());
    assertTrue(plugin.getAlreadyUsedColumnHeaders().contains("a"));
    assertTrue(plugin.getAlreadyUsedColumnHeaders().contains("b"));
}
Also used : GuidedDecisionTable52(org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52) ActionCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionCol52) Test(org.junit.Test)

Example 35 with ActionCol52

use of org.drools.workbench.models.guided.dtable.shared.model.ActionCol52 in project drools-wb by kiegroup.

the class ActionSetFactPluginTest method testGenerateColumnWhenColumnIsNotNew.

@Test
public void testGenerateColumnWhenColumnIsNotNew() throws Exception {
    final ActionCol52 editingCol = mock(ActionCol52.class);
    final ActionCol52 originalCol = mock(ActionCol52.class);
    doReturn(editingCol).when(plugin).editingCol();
    doReturn(originalCol).when(plugin).originalCol();
    doReturn(false).when(plugin).isNewColumn();
    assertTrue(plugin.generateColumn());
    verify(presenter).updateColumn(originalCol, editingCol);
}
Also used : ActionCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionCol52) Test(org.junit.Test)

Aggregations

ActionCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionCol52)60 Test (org.junit.Test)31 BaseColumn (org.drools.workbench.models.guided.dtable.shared.model.BaseColumn)27 ArrayList (java.util.ArrayList)17 ConditionCol52 (org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52)16 ActionInsertFactCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionInsertFactCol52)13 Pattern52 (org.drools.workbench.models.guided.dtable.shared.model.Pattern52)13 DTCellValue52 (org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52)12 DescriptionCol52 (org.drools.workbench.models.guided.dtable.shared.model.DescriptionCol52)12 RowNumberCol52 (org.drools.workbench.models.guided.dtable.shared.model.RowNumberCol52)12 ActionSetFieldCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionSetFieldCol52)11 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)11 RuleModel (org.drools.workbench.models.datamodel.rule.RuleModel)10 ActionWorkItemCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionWorkItemCol52)9 GuidedDTTemplateDataProvider (org.drools.workbench.models.guided.dtable.backend.util.GuidedDTTemplateDataProvider)8 TemplateDataProvider (org.drools.workbench.models.guided.dtable.backend.util.TemplateDataProvider)8 List (java.util.List)6 ActionExecuteWorkItem (org.drools.workbench.models.datamodel.rule.ActionExecuteWorkItem)6 PortableBooleanParameterDefinition (org.drools.workbench.models.datamodel.workitems.PortableBooleanParameterDefinition)6 PortableFloatParameterDefinition (org.drools.workbench.models.datamodel.workitems.PortableFloatParameterDefinition)6