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);
}
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());
}
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);
}
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);
}
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);
}
Aggregations