Search in sources :

Example 66 with Pattern52

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

the class GuidedDecisionTablePresenterTest method updateConditionColumn.

@Test
public void updateConditionColumn() 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);
    final ConditionCol52 updateCondition = new ConditionCol52();
    updateCondition.setFactField("newField");
    updateCondition.setHeader("newHeader");
    dtPresenter.updateColumn(condition, updateCondition);
    verify(synchronizer, times(1)).updateColumn(eq(condition), eq(updateCondition));
    verify(modellerPresenter, times(1)).updateLinks();
}
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 Pattern52

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

the class GuidedDecisionTablePresenterTest method getBindingsWithSimpleClassName.

@Test
public void getBindingsWithSimpleClassName() {
    final Pattern52 pattern1 = new Pattern52();
    pattern1.setFactType("FactType1");
    pattern1.setBoundName("$fact1");
    final ConditionCol52 condition1 = new ConditionCol52();
    condition1.setFactField("field");
    condition1.setBinding("$field1");
    pattern1.getChildColumns().add(condition1);
    final Pattern52 pattern2 = new Pattern52();
    pattern2.setFactType("FactType1");
    final ConditionCol52 condition2 = new ConditionCol52();
    condition2.setFactField("field");
    pattern2.getChildColumns().add(condition2);
    when(oracle.getFieldClassName(eq("FactType1"), eq("field"))).thenReturn("FactType1");
    dtPresenter.getModel().getConditions().add(pattern1);
    dtPresenter.getModel().getConditions().add(pattern2);
    final Set<String> bindings = dtPresenter.getBindings("FactType1");
    assertNotNull(bindings);
    assertEquals(2, bindings.size());
    assertTrue(bindings.contains("$fact1"));
    assertTrue(bindings.contains("$field1"));
}
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 68 with Pattern52

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

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

use of org.drools.workbench.models.guided.dtable.shared.model.Pattern52 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)

Aggregations

Pattern52 (org.drools.workbench.models.guided.dtable.shared.model.Pattern52)243 ConditionCol52 (org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52)184 Test (org.junit.Test)180 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)92 LimitedEntryConditionCol52 (org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryConditionCol52)66 DTCellValue52 (org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52)45 ActionSetFieldCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionSetFieldCol52)39 BaseSingleFieldConstraint (org.drools.workbench.models.datamodel.rule.BaseSingleFieldConstraint)34 ArrayList (java.util.ArrayList)31 ActionInsertFactCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionInsertFactCol52)31 SingleFieldConstraint (org.drools.workbench.models.datamodel.rule.SingleFieldConstraint)28 BaseColumn (org.drools.workbench.models.guided.dtable.shared.model.BaseColumn)27 Path (org.uberfire.backend.vfs.Path)27 RawMVELEvaluator (org.kie.soup.project.datamodel.commons.util.RawMVELEvaluator)26 PackageDataModelOracleBaselinePayload (org.kie.workbench.common.services.datamodel.model.PackageDataModelOracleBaselinePayload)26 AsyncPackageDataModelOracle (org.kie.workbench.common.widgets.client.datamodel.AsyncPackageDataModelOracle)26 StringUiColumn (org.drools.workbench.screens.guided.dtable.client.widget.table.columns.StringUiColumn)25 IntegerUiColumn (org.drools.workbench.screens.guided.dtable.client.widget.table.columns.IntegerUiColumn)24 ModelField (org.kie.soup.project.datamodel.oracle.ModelField)24 ModuleDataModelOracle (org.kie.soup.project.datamodel.oracle.ModuleDataModelOracle)24