Search in sources :

Example 16 with ActionWorkItemCol52

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

the class ActionWorkItemPluginTest method testForEachWorkItemWhenOneHasBeenExecutedNewColumn.

@Test
public void testForEachWorkItemWhenOneHasBeenExecutedNewColumn() {
    final PortableWorkDefinition workItem1 = getMock("workItem1");
    final PortableWorkDefinition workItem2 = getMock("workItem2");
    final HashMap<String, String> actualWorkItems = new HashMap<>();
    final HashMap<String, String> expectedWorkItems = new HashMap<String, String>() {

        {
            put("workItem2", "workItem2");
        }
    };
    final HashSet<PortableWorkDefinition> fakeDefinitions = new HashSet<PortableWorkDefinition>() {

        {
            add(workItem1);
            add(workItem2);
        }
    };
    when(presenter.getWorkItemDefinitions()).thenReturn(fakeDefinitions);
    when(presenter.getModel()).thenReturn(model);
    when(model.getActionCols()).thenReturn(Collections.singletonList(new ActionWorkItemCol52() {

        {
            setWorkItemDefinition(workItem1);
        }
    }));
    when(plugin.isNewColumn()).thenReturn(true);
    plugin.forEachWorkItem(actualWorkItems::put);
    assertEquals(expectedWorkItems, actualWorkItems);
}
Also used : ActionWorkItemCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionWorkItemCol52) HashMap(java.util.HashMap) PortableWorkDefinition(org.drools.workbench.models.datamodel.workitems.PortableWorkDefinition) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 17 with ActionWorkItemCol52

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

the class ActionWorkItemPluginTest method testGetHeader.

@Test
public void testGetHeader() {
    final ActionWorkItemCol52 actionCol52 = mock(ActionWorkItemCol52.class);
    doReturn(actionCol52).when(plugin).editingCol();
    plugin.getHeader();
    verify(actionCol52).getHeader();
}
Also used : ActionWorkItemCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionWorkItemCol52) Test(org.junit.Test)

Example 18 with ActionWorkItemCol52

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

the class ActionWorkItemPluginTest method testForEachWorkItemWhenOneHasBeenExecutedUpdatedColumn.

@Test
public void testForEachWorkItemWhenOneHasBeenExecutedUpdatedColumn() {
    final PortableWorkDefinition workItem1 = getMock("workItem1");
    final PortableWorkDefinition workItem2 = getMock("workItem2");
    final HashMap<String, String> actualWorkItems = new HashMap<>();
    final HashMap<String, String> expectedWorkItems = new HashMap<String, String>() {

        {
            put("workItem1", "workItem1");
            put("workItem2", "workItem2");
        }
    };
    final HashSet<PortableWorkDefinition> fakeDefinitions = new HashSet<PortableWorkDefinition>() {

        {
            add(workItem1);
            add(workItem2);
        }
    };
    when(presenter.getWorkItemDefinitions()).thenReturn(fakeDefinitions);
    when(presenter.getModel()).thenReturn(model);
    when(model.getActionCols()).thenReturn(Collections.singletonList(new ActionWorkItemCol52() {

        {
            setWorkItemDefinition(workItem1);
        }
    }));
    when(plugin.isNewColumn()).thenReturn(false);
    when(plugin.getWorkItemDefinition()).thenReturn(workItem1);
    plugin.forEachWorkItem(actualWorkItems::put);
    assertEquals(expectedWorkItems, actualWorkItems);
}
Also used : ActionWorkItemCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionWorkItemCol52) HashMap(java.util.HashMap) PortableWorkDefinition(org.drools.workbench.models.datamodel.workitems.PortableWorkDefinition) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 19 with ActionWorkItemCol52

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

the class ActionWorkItemPluginTest method testIsHideColumn.

@Test
public void testIsHideColumn() {
    final ActionWorkItemCol52 actionCol52 = mock(ActionWorkItemCol52.class);
    doReturn(actionCol52).when(plugin).editingCol();
    plugin.isHideColumn();
    verify(actionCol52).isHideColumn();
}
Also used : ActionWorkItemCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionWorkItemCol52) Test(org.junit.Test)

Example 20 with ActionWorkItemCol52

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

the class ActionWorkItemPluginTest method testGenerateColumnWhenColumnIsNotNew.

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

Aggregations

ActionWorkItemCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionWorkItemCol52)38 Test (org.junit.Test)25 PortableWorkDefinition (org.drools.workbench.models.datamodel.workitems.PortableWorkDefinition)17 ArrayList (java.util.ArrayList)8 BaseColumn (org.drools.workbench.models.guided.dtable.shared.model.BaseColumn)8 PortableFloatParameterDefinition (org.drools.workbench.models.datamodel.workitems.PortableFloatParameterDefinition)7 PortableStringParameterDefinition (org.drools.workbench.models.datamodel.workitems.PortableStringParameterDefinition)7 ActionCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionCol52)7 DTCellValue52 (org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52)7 ActionExecuteWorkItem (org.drools.workbench.models.datamodel.rule.ActionExecuteWorkItem)6 RuleModel (org.drools.workbench.models.datamodel.rule.RuleModel)6 PortableBooleanParameterDefinition (org.drools.workbench.models.datamodel.workitems.PortableBooleanParameterDefinition)6 GuidedDTTemplateDataProvider (org.drools.workbench.models.guided.dtable.backend.util.GuidedDTTemplateDataProvider)6 TemplateDataProvider (org.drools.workbench.models.guided.dtable.backend.util.TemplateDataProvider)6 BaseColumnFieldDiff (org.drools.workbench.models.guided.dtable.shared.model.BaseColumnFieldDiff)6 DescriptionCol52 (org.drools.workbench.models.guided.dtable.shared.model.DescriptionCol52)6 RowNumberCol52 (org.drools.workbench.models.guided.dtable.shared.model.RowNumberCol52)6 ActionWorkItemInsertFactCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionWorkItemInsertFactCol52)5 ActionWorkItemSetFieldCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionWorkItemSetFieldCol52)5 BooleanUiColumn (org.drools.workbench.screens.guided.dtable.client.widget.table.columns.BooleanUiColumn)5