Search in sources :

Example 21 with ActionCol52

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

the class ColumnsPagePresenterTest method testRefresh.

@Test
public void testRefresh() {
    final GuidedDecisionTable52 guidedDecisionTable52 = mock(GuidedDecisionTable52.class);
    doReturn(Optional.of(guidedDecisionTable52)).when(presenter).getGuidedDecisionTable52();
    doNothing().when(presenter).refreshAttributeWidget(any());
    doNothing().when(presenter).refreshMetaDataWidget(any());
    doNothing().when(presenter).refreshConditionsWidget(any());
    doNothing().when(presenter).refreshActionsWidget(any());
    final List<AttributeCol52> attributeCol52s = new ArrayList<>();
    final List<MetadataCol52> metadataCol52s = new ArrayList<>();
    final List<CompositeColumn<? extends BaseColumn>> compositeColumns = new ArrayList<>();
    final List<ActionCol52> actionCol52s = new ArrayList<>();
    doReturn(attributeCol52s).when(guidedDecisionTable52).getAttributeCols();
    doReturn(metadataCol52s).when(guidedDecisionTable52).getAttributeCols();
    doReturn(compositeColumns).when(guidedDecisionTable52).getAttributeCols();
    doReturn(actionCol52s).when(guidedDecisionTable52).getAttributeCols();
    presenter.refresh();
    verify(presenter).refreshAttributeWidget(attributeCol52s);
    verify(presenter).refreshMetaDataWidget(metadataCol52s);
    verify(presenter).refreshConditionsWidget(compositeColumns);
    verify(presenter).refreshActionsWidget(actionCol52s);
}
Also used : AttributeCol52(org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52) MetadataCol52(org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52) GuidedDecisionTable52(org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52) ActionCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionCol52) ArrayList(java.util.ArrayList) BaseColumn(org.drools.workbench.models.guided.dtable.shared.model.BaseColumn) CompositeColumn(org.drools.workbench.models.guided.dtable.shared.model.CompositeColumn) Test(org.junit.Test)

Example 22 with ActionCol52

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

the class ColumnsPagePresenterTest method testRefreshActionsWidgetWhenActionColumnsIsEmpty.

@Test
public void testRefreshActionsWidgetWhenActionColumnsIsEmpty() {
    final List<ActionCol52> actionColumns = new ArrayList<>();
    final ColumnManagementView columnManagementView = mock(ColumnManagementView.class);
    final GuidedDecisionTableAccordionItem item = mock(GuidedDecisionTableAccordionItem.class);
    final Label blankSlate = mock(Label.class);
    doReturn(verticalPanel).when(presenter).getActionsWidget();
    doReturn(columnManagementView).when(presenter).getActionsPanel();
    doReturn(blankSlate).when(presenter).blankSlate();
    doReturn(item).when(accordion).getItem(ACTION);
    presenter.refreshActionsWidget(actionColumns);
    verify(item).setOpen(false);
    verify(verticalPanel).add(blankSlate);
    verify(verticalPanel, never()).add(columnManagementView);
    verify(columnManagementView, never()).renderColumns(any());
}
Also used : ActionCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionCol52) ArrayList(java.util.ArrayList) ColumnManagementView(org.drools.workbench.screens.guided.dtable.client.widget.table.columns.control.ColumnManagementView) Label(com.google.gwt.user.client.ui.Label) GuidedDecisionTableAccordionItem(org.drools.workbench.screens.guided.dtable.client.editor.page.accordion.GuidedDecisionTableAccordionItem) Test(org.junit.Test)

Example 23 with ActionCol52

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

the class DecisionTableAnalyzerTest method testInsertActionColumn.

@Test
public void testInsertActionColumn() throws Exception {
    ActionCol52 a = new ActionCol52();
    ActionCol52 b = new ActionCol52();
    actionColumns.add(a);
    actionColumns.add(b);
    model.setActionCols(actionColumns);
    decisionTableAnalyzer.insertColumn(b);
    verify(updateManager).newColumn(model, 3);
}
Also used : ActionCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionCol52) Test(org.junit.Test)

Example 24 with ActionCol52

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

the class GuidedDecisionTablePresenter_AuditLogTest method updateColumnAddsToLog.

@Test
public void updateColumnAddsToLog() throws VetoException {
    dtPresenter.updateColumn(new ActionCol52(), new ActionCol52());
    dtPresenter.updateColumn(new AttributeCol52(), new AttributeCol52());
    dtPresenter.updateColumn(new ConditionCol52(), new ConditionCol52());
    dtPresenter.updateColumn(new MetadataCol52(), new MetadataCol52());
    dtPresenter.updateColumn(new Pattern52(), new ConditionCol52(), new Pattern52(), new ConditionCol52());
    verify(synchronizer, times(4)).updateColumn(any(BaseColumn.class), any(BaseColumn.class));
    verify(synchronizer).updateColumn(any(Pattern52.class), any(ConditionCol52.class), any(Pattern52.class), any(ConditionCol52.class));
    verify(model, times(5)).getAuditLog();
    assertEquals(5, model.getAuditLog().size());
    for (UpdateColumnAuditLogEntry entry : model.getAuditLog().toArray(new UpdateColumnAuditLogEntry[0])) {
        assertEquals(diffs, entry.getDiffs());
    }
}
Also used : AttributeCol52(org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52) MetadataCol52(org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52) ConditionCol52(org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52) Pattern52(org.drools.workbench.models.guided.dtable.shared.model.Pattern52) ActionCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionCol52) UpdateColumnAuditLogEntry(org.drools.workbench.models.guided.dtable.shared.auditlog.UpdateColumnAuditLogEntry) BaseColumn(org.drools.workbench.models.guided.dtable.shared.model.BaseColumn) Test(org.junit.Test)

Example 25 with ActionCol52

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

the class BaseActionWorkItemConverterTest method checkConvertColumn.

@Test
public void checkConvertColumn() {
    final BaseColumn column = getColumn();
    final GridColumn<?> uiColumn = converter.convertColumn(column, access, gridWidget);
    assertTrue(uiColumn.isResizable());
    assertTrue(uiColumn.isVisible());
    assertEquals(WIDTH, uiColumn.getWidth(), 0.0);
    assertEquals(2, uiColumn.getHeaderMetaData().size());
    final GridColumn.HeaderMetaData row0 = uiColumn.getHeaderMetaData().get(0);
    assertEquals(WID_NAME, row0.getTitle());
    assertEquals(ActionCol52.class.getName(), row0.getColumnGroup());
    final GridColumn.HeaderMetaData row1 = uiColumn.getHeaderMetaData().get(1);
    assertEquals(HEADER, row1.getTitle());
    assertEquals(getExpectedColumnGroup(), row1.getColumnGroup());
}
Also used : ActionCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionCol52) BaseColumn(org.drools.workbench.models.guided.dtable.shared.model.BaseColumn) GridColumn(org.uberfire.ext.wires.core.grids.client.model.GridColumn) 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