Search in sources :

Example 66 with RowNumberCol52

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

the class ConditionColumnSynchronizerTest method checkConditionCannotBeDeletedWithSingleChildColumnWithAction.

@Test
public void checkConditionCannotBeDeletedWithSingleChildColumnWithAction() throws VetoException {
    final Pattern52 pattern = boundApplicantPattern("$a");
    final ConditionCol52 condition = ageEqualsCondition();
    final ActionCol52 action = actionUpdatePattern("$a");
    modelSynchronizer.appendColumn(pattern, condition);
    modelSynchronizer.appendColumn(action);
    try {
        modelSynchronizer.deleteColumn(condition);
        fail("Deletion of the column should have been vetoed.");
    } catch (VetoDeletePatternInUseException veto) {
    // This is expected
    } catch (VetoException veto) {
        fail("VetoDeletePatternInUseException was expected.");
    }
    assertEquals(4, model.getExpandedColumns().size());
    assertTrue(model.getExpandedColumns().get(0) instanceof RowNumberCol52);
    assertTrue(model.getExpandedColumns().get(1) instanceof DescriptionCol52);
    assertEquals(condition, model.getExpandedColumns().get(2));
    assertEquals(action, model.getExpandedColumns().get(3));
}
Also used : VetoException(org.drools.workbench.screens.guided.dtable.client.widget.table.model.synchronizers.ModelSynchronizer.VetoException) ConditionCol52(org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52) Pattern52(org.drools.workbench.models.guided.dtable.shared.model.Pattern52) DescriptionCol52(org.drools.workbench.models.guided.dtable.shared.model.DescriptionCol52) ActionCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionCol52) VetoDeletePatternInUseException(org.drools.workbench.screens.guided.dtable.client.widget.table.model.synchronizers.ModelSynchronizer.VetoDeletePatternInUseException) RowNumberCol52(org.drools.workbench.models.guided.dtable.shared.model.RowNumberCol52) Test(org.junit.Test)

Example 67 with RowNumberCol52

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

the class ConditionColumnSynchronizerTest method checkConditionCanBeDeletedWithSingleChildColumnWithNoAction.

@Test
public void checkConditionCanBeDeletedWithSingleChildColumnWithNoAction() throws VetoException {
    final Pattern52 pattern = boundApplicantPattern("$a");
    final ConditionCol52 condition = ageEqualsCondition();
    modelSynchronizer.appendColumn(pattern, condition);
    try {
        modelSynchronizer.deleteColumn(condition);
    } catch (VetoException veto) {
        fail("Deletion should have been permitted.");
    }
    assertEquals(2, model.getExpandedColumns().size());
    assertTrue(model.getExpandedColumns().get(0) instanceof RowNumberCol52);
    assertTrue(model.getExpandedColumns().get(1) instanceof DescriptionCol52);
}
Also used : VetoException(org.drools.workbench.screens.guided.dtable.client.widget.table.model.synchronizers.ModelSynchronizer.VetoException) ConditionCol52(org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52) Pattern52(org.drools.workbench.models.guided.dtable.shared.model.Pattern52) DescriptionCol52(org.drools.workbench.models.guided.dtable.shared.model.DescriptionCol52) RowNumberCol52(org.drools.workbench.models.guided.dtable.shared.model.RowNumberCol52) Test(org.junit.Test)

Example 68 with RowNumberCol52

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

the class BRLConditionColumnDefinitionBuilderTest method unknownColumnTypeDoesNotTriggerBuilder.

@Test
public void unknownColumnTypeDoesNotTriggerBuilder() {
    final BaseColumn column = new RowNumberCol52();
    builder.generateDefinition(dtPresenter, column, (String definition) -> {
        fail("RowNumberCol52 should not be handled by ConditionCol52DefinitionBuilder");
    });
}
Also used : BaseColumn(org.drools.workbench.models.guided.dtable.shared.model.BaseColumn) RowNumberCol52(org.drools.workbench.models.guided.dtable.shared.model.RowNumberCol52) Test(org.junit.Test)

Example 69 with RowNumberCol52

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

the class BRLActionColumnDefinitionBuilderTest method unknownColumnTypeDoesNotTriggerBuilder.

@Test
public void unknownColumnTypeDoesNotTriggerBuilder() {
    final BaseColumn column = new RowNumberCol52();
    builder.generateDefinition(dtPresenter, column, (String definition) -> {
        fail("RowNumberCol52 should not be handled by ConditionCol52DefinitionBuilder");
    });
}
Also used : BaseColumn(org.drools.workbench.models.guided.dtable.shared.model.BaseColumn) RowNumberCol52(org.drools.workbench.models.guided.dtable.shared.model.RowNumberCol52) Test(org.junit.Test)

Example 70 with RowNumberCol52

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

the class ColumnDefinitionFactoryTest method unknownColumnTypeDoesNotTriggerBuilder.

@Test
@SuppressWarnings("unchecked")
public void unknownColumnTypeDoesNotTriggerBuilder() {
    final Callback<String> callback = mock(Callback.class);
    columnDefinitionFactory.generateColumnDefinition(dtPresenter, new RowNumberCol52(), callback);
    verify(callback, never()).callback(any(String.class));
}
Also used : RowNumberCol52(org.drools.workbench.models.guided.dtable.shared.model.RowNumberCol52) Test(org.junit.Test)

Aggregations

RowNumberCol52 (org.drools.workbench.models.guided.dtable.shared.model.RowNumberCol52)82 Test (org.junit.Test)70 DescriptionCol52 (org.drools.workbench.models.guided.dtable.shared.model.DescriptionCol52)66 BaseColumn (org.drools.workbench.models.guided.dtable.shared.model.BaseColumn)57 ArrayList (java.util.ArrayList)47 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)33 SingleFieldConstraint (org.drools.workbench.models.datamodel.rule.SingleFieldConstraint)24 BRLConditionVariableColumn (org.drools.workbench.models.guided.dtable.shared.model.BRLConditionVariableColumn)23 ConditionCol52 (org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52)23 DTCellValue52 (org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52)23 FactPattern (org.drools.workbench.models.datamodel.rule.FactPattern)22 BRLConditionColumn (org.drools.workbench.models.guided.dtable.shared.model.BRLConditionColumn)22 RuleModel (org.drools.workbench.models.datamodel.rule.RuleModel)21 Pattern52 (org.drools.workbench.models.guided.dtable.shared.model.Pattern52)21 GuidedDTTemplateDataProvider (org.drools.workbench.models.guided.dtable.backend.util.GuidedDTTemplateDataProvider)19 TemplateDataProvider (org.drools.workbench.models.guided.dtable.backend.util.TemplateDataProvider)19 BRLActionColumn (org.drools.workbench.models.guided.dtable.shared.model.BRLActionColumn)19 BRLActionVariableColumn (org.drools.workbench.models.guided.dtable.shared.model.BRLActionVariableColumn)18 IOException (java.io.IOException)17 InputStream (java.io.InputStream)17