Search in sources :

Example 66 with ConditionCol52

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

the class GuidedDecisionTablePresenterTest method deleteConditionColumn.

@Test
public void deleteConditionColumn() throws VetoException {
    final Pattern52 pattern = new Pattern52();
    pattern.setFactType("FactType");
    final ConditionCol52 condition = new ConditionCol52();
    condition.setFactField("field");
    condition.setHeader("header");
    dtPresenter.appendColumn(pattern, condition);
    reset(modellerPresenter);
    dtPresenter.deleteColumn(condition);
    verify(synchronizer, times(1)).deleteColumn(eq(condition));
    verify(modellerPresenter, times(1)).updateLinks();
    checkDTSelectionsChangedEventFired(1);
}
Also used : ConditionCol52(org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52) Pattern52(org.drools.workbench.models.guided.dtable.shared.model.Pattern52) Test(org.junit.Test)

Example 67 with ConditionCol52

use of org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52 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 68 with ConditionCol52

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

the class PluginHandlerTest method testEditWhenColumnIsAConditionCol52.

@Test
public void testEditWhenColumnIsAConditionCol52() {
    final Pattern52 originalPattern = mock(Pattern52.class);
    final ConditionCol52 originalColumn = mock(ConditionCol52.class);
    final ConditionColumnPlugin plugin = spy(new ConditionColumnPlugin(patternPage, calculationTypePage, fieldPage, operatorPage, valueOptionsPage, additionalInfoPage, event, translationService));
    doReturn(wizard).when(wizardManagedInstance).get();
    doReturn(plugin).when(conditionColumnPlugin).get();
    doReturn(new Pattern52()).when(plugin).getEditingPattern();
    pluginHandler.edit(originalPattern, originalColumn);
    verify(plugin).setOriginalPattern52(originalPattern);
    verify(plugin).setOriginalColumnConfig52(originalColumn);
    verify(pluginHandler).openWizard(plugin);
    verify(wizard).start(plugin);
}
Also used : ConditionColumnPlugin(org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.ConditionColumnPlugin) BRLConditionColumnPlugin(org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.BRLConditionColumnPlugin) ConditionCol52(org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52) Pattern52(org.drools.workbench.models.guided.dtable.shared.model.Pattern52) Test(org.junit.Test)

Example 69 with ConditionCol52

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

the class ColumnManagementViewTest method testRenderColumnPatternEditable.

@Test
public void testRenderColumnPatternEditable() throws Exception {
    final Pattern52 pattern = new Pattern52() {

        {
            setBoundName("p");
            setFactType("Person");
            getChildColumns().add(new ConditionCol52() {

                {
                    setHeader("one");
                }
            });
            getChildColumns().add(new ConditionCol52() {

                {
                    setHeader("two");
                }
            });
            getChildColumns().add(new ConditionCol52() {

                {
                    setHeader("three");
                }
            });
        }
    };
    final Map<String, List<BaseColumn>> columnGroups = new HashMap<String, List<BaseColumn>>() {

        {
            put("Person [p]", Collections.singletonList(pattern));
        }
    };
    final ColumnLabelWidget columnLabel = mockColumnLabelWidget();
    doReturn(columnLabel).when(view).newColumnLabelWidget(anyString());
    doReturn(true).when(modellerPresenter).isActiveDecisionTableEditable();
    view.renderColumns(columnGroups);
    verify(view).renderColumn(pattern);
    // Pattern has three child columns
    verify(horizontalPanel, times(3)).add(columnLabel);
    verify(view, times(3)).editAnchor(clickHandlerCaptor.capture());
    verify(view).deleteAnchor(eq("one"), any(Command.class));
    verify(view).deleteAnchor(eq("two"), any(Command.class));
    verify(view).deleteAnchor(eq("three"), any(Command.class));
    clickHandlerCaptor.getAllValues().get(0).onClick(mock(ClickEvent.class));
    verify(decisionTablePresenter).editCondition(eq(pattern), eq(pattern.getChildColumns().get(0)));
    clickHandlerCaptor.getAllValues().get(1).onClick(mock(ClickEvent.class));
    verify(decisionTablePresenter).editCondition(eq(pattern), eq(pattern.getChildColumns().get(1)));
    clickHandlerCaptor.getAllValues().get(2).onClick(mock(ClickEvent.class));
    verify(decisionTablePresenter).editCondition(eq(pattern), eq(pattern.getChildColumns().get(2)));
}
Also used : ConditionCol52(org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52) Pattern52(org.drools.workbench.models.guided.dtable.shared.model.Pattern52) HashMap(java.util.HashMap) Command(com.google.gwt.user.client.Command) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) List(java.util.List) BaseColumn(org.drools.workbench.models.guided.dtable.shared.model.BaseColumn) Matchers.anyString(org.mockito.Matchers.anyString) Test(org.junit.Test)

Example 70 with ConditionCol52

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

the class ConditionColumnPlugin method clone.

ConditionCol52 clone(final ConditionCol52 column) {
    final ConditionCol52 clone;
    if (tableFormat() == LIMITED_ENTRY) {
        clone = new LimitedEntryConditionCol52() {

            {
                setValue(cloneDTCellValue(((LimitedEntryCol) column).getValue()));
            }
        };
    } else {
        clone = new ConditionCol52();
    }
    clone.setConstraintValueType(column.getConstraintValueType());
    clone.setFactField(column.getFactField());
    clone.setFieldType(column.getFieldType());
    clone.setHeader(column.getHeader());
    clone.setOperator(column.getOperator());
    clone.setValueList(column.getValueList());
    clone.setDefaultValue(cloneDTCellValue(column.getDefaultValue()));
    clone.setHideColumn(column.isHideColumn());
    clone.setParameters(column.getParameters());
    clone.setWidth(column.getWidth());
    clone.setBinding(column.getBinding());
    return clone;
}
Also used : LimitedEntryConditionCol52(org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryConditionCol52) ConditionCol52(org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52) LimitedEntryConditionCol52(org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryConditionCol52)

Aggregations

ConditionCol52 (org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52)229 Pattern52 (org.drools.workbench.models.guided.dtable.shared.model.Pattern52)184 Test (org.junit.Test)170 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)74 LimitedEntryConditionCol52 (org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryConditionCol52)59 ActionSetFieldCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionSetFieldCol52)38 DTCellValue52 (org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52)38 BaseColumn (org.drools.workbench.models.guided.dtable.shared.model.BaseColumn)34 ActionInsertFactCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionInsertFactCol52)31 ArrayList (java.util.ArrayList)27 Path (org.uberfire.backend.vfs.Path)27 StringUiColumn (org.drools.workbench.screens.guided.dtable.client.widget.table.columns.StringUiColumn)25 RawMVELEvaluator (org.kie.soup.project.datamodel.commons.util.RawMVELEvaluator)25 PackageDataModelOracleBaselinePayload (org.kie.workbench.common.services.datamodel.model.PackageDataModelOracleBaselinePayload)25 AsyncPackageDataModelOracle (org.kie.workbench.common.widgets.client.datamodel.AsyncPackageDataModelOracle)25 BaseSingleFieldConstraint (org.drools.workbench.models.datamodel.rule.BaseSingleFieldConstraint)24 IntegerUiColumn (org.drools.workbench.screens.guided.dtable.client.widget.table.columns.IntegerUiColumn)24 DescriptionCol52 (org.drools.workbench.models.guided.dtable.shared.model.DescriptionCol52)23 RowNumberCol52 (org.drools.workbench.models.guided.dtable.shared.model.RowNumberCol52)23 ModelField (org.kie.soup.project.datamodel.oracle.ModelField)23