Search in sources :

Example 6 with AttributeCol52

use of org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52 in project drools by kiegroup.

the class GuidedDTDRLPersistenceUniqueHitPolicyTest method blockUseOfActivationGroup.

@Test(expected = IllegalArgumentException.class)
public void blockUseOfActivationGroup() {
    final AttributeCol52 attributeCol52 = new AttributeCol52();
    attributeCol52.setAttribute("activation-group");
    attributeCol52.setDefaultValue(new DTCellValue52("test"));
    dtable.getAttributeCols().add(attributeCol52);
    GuidedDTDRLPersistence.getInstance().marshal(dtable);
}
Also used : AttributeCol52(org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52) DTCellValue52(org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52) Test(org.junit.Test)

Example 7 with AttributeCol52

use of org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52 in project drools by kiegroup.

the class GuidedDTXMLPersistenceTest method testRoundTrip.

@Test
public void testRoundTrip() {
    GuidedDecisionTable52 dt = new GuidedDecisionTable52();
    dt.getActionCols().add(new ActionInsertFactCol52());
    ActionSetFieldCol52 set = new ActionSetFieldCol52();
    set.setFactField("foo");
    dt.getActionCols().add(set);
    dt.getMetadataCols().add(new MetadataCol52());
    dt.getAttributeCols().add(new AttributeCol52());
    Pattern52 p = new Pattern52();
    ConditionCol52 c = new ConditionCol52();
    p.getChildColumns().add(c);
    dt.getConditions().add(p);
    dt.setData(upgrader.makeDataLists(new String[][] { new String[] { "1", "hola" } }));
    dt.setTableName("blah");
    String xml = GuidedDTXMLPersistence.getInstance().marshal(dt);
    System.out.println(xml);
    assertNotNull(xml);
    assertEquals(-1, xml.indexOf("ActionSetField"));
    assertEquals(-1, xml.indexOf("ConditionCol"));
    assertEquals(-1, xml.indexOf("GuidedDecisionTable"));
    GuidedDecisionTable52 dt_ = GuidedDTXMLPersistence.getInstance().unmarshal(xml);
    assertNotNull(dt_);
    assertEquals("blah", dt_.getTableName());
    assertEquals(1, dt_.getMetadataCols().size());
    assertEquals(1, dt_.getAttributeCols().size());
    assertEquals(2, dt_.getActionCols().size());
    assertEquals(1, dt_.getConditions().size());
    assertEquals(1, dt_.getConditions().get(0).getChildColumns().size());
}
Also used : MetadataCol52(org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52) AttributeCol52(org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52) ConditionCol52(org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52) GuidedDecisionTable52(org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52) ActionInsertFactCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionInsertFactCol52) Pattern52(org.drools.workbench.models.guided.dtable.shared.model.Pattern52) ActionSetFieldCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionSetFieldCol52) Test(org.junit.Test)

Example 8 with AttributeCol52

use of org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52 in project drools by kiegroup.

the class GuidedDTDRLPersistenceFirstHitPolicyTest method blockUseOfSalience.

@Test(expected = IllegalArgumentException.class)
public void blockUseOfSalience() {
    final AttributeCol52 attributeCol52 = new AttributeCol52();
    attributeCol52.setAttribute("salience");
    attributeCol52.setDefaultValue(new DTCellValue52("123"));
    dtable.getAttributeCols().add(attributeCol52);
    GuidedDTDRLPersistence.getInstance().marshal(dtable);
}
Also used : AttributeCol52(org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52) DTCellValue52(org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52) Test(org.junit.Test)

Example 9 with AttributeCol52

use of org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52 in project drools by kiegroup.

the class GuidedDTDRLPersistenceResolvedHitPolicyTest method blockUseOfSalience.

@Test(expected = IllegalArgumentException.class)
public void blockUseOfSalience() {
    final AttributeCol52 attributeCol52 = new AttributeCol52();
    attributeCol52.setAttribute("salience");
    attributeCol52.setDefaultValue(new DTCellValue52("123"));
    dtable.getAttributeCols().add(attributeCol52);
    GuidedDTDRLPersistence.getInstance().marshal(dtable);
}
Also used : AttributeCol52(org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52) DTCellValue52(org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52) Test(org.junit.Test)

Example 10 with AttributeCol52

use of org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52 in project drools by kiegroup.

the class DecisionTableValidatorHitPolicyAttributeLimitationsTest method addAttributeColumn.

@Test
public void addAttributeColumn() throws Exception {
    final GuidedDecisionTable52 table = mock(GuidedDecisionTable52.class);
    when(table.getHitPolicy()).thenReturn(hitPolicy);
    final DecisionTableValidator validator = new DecisionTableValidator(table);
    final AttributeCol52 attributeCol52 = new AttributeCol52();
    attributeCol52.setAttribute(attributeName);
    boolean wasAllowed = true;
    try {
        validator.isValidToAdd(attributeCol52);
    } catch (final Exception e) {
        wasAllowed = false;
    }
    assertEquals(wasAllowed, isAllowed);
}
Also used : AttributeCol52(org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52) GuidedDecisionTable52(org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52) Test(org.junit.Test)

Aggregations

AttributeCol52 (org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52)86 Test (org.junit.Test)55 DTCellValue52 (org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52)30 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)20 BaseColumn (org.drools.workbench.models.guided.dtable.shared.model.BaseColumn)14 ArrayList (java.util.ArrayList)12 ConditionCol52 (org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52)12 DescriptionCol52 (org.drools.workbench.models.guided.dtable.shared.model.DescriptionCol52)10 RowNumberCol52 (org.drools.workbench.models.guided.dtable.shared.model.RowNumberCol52)10 Pattern52 (org.drools.workbench.models.guided.dtable.shared.model.Pattern52)9 ActionInsertFactCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionInsertFactCol52)8 ActionSetFieldCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionSetFieldCol52)8 MetadataCol52 (org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52)7 IOException (java.io.IOException)6 InputStream (java.io.InputStream)6 ExcelParser (org.drools.decisiontable.parser.xls.ExcelParser)6 DataListener (org.drools.template.parser.DataListener)6 ConversionResult (org.drools.workbench.models.guided.dtable.shared.conversion.ConversionResult)6 ActionCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionCol52)5 IntegerUiColumn (org.drools.workbench.screens.guided.dtable.client.widget.table.columns.IntegerUiColumn)5