use of org.kie.dmn.model.v1_1.List in project drools by kiegroup.
the class ItemDefinitionDependenciesTest method testGeneric2.
@Test
public void testGeneric2() {
ItemDefinition z = build("z");
ItemDefinition b = build("b");
ItemDefinition a = build("a", z);
List<ItemDefinition> originalList = Arrays.asList(new ItemDefinition[] { z, b, a });
List<ItemDefinition> orderedList = orderingStrategy(originalList);
assertTrue("Index of z < a", orderedList.indexOf(z) < orderedList.indexOf(a));
}
use of org.kie.dmn.model.v1_1.List in project drools by kiegroup.
the class ItemDefinitionDependenciesTest method testOrdering4.
@Test
public void testOrdering4() {
ItemDefinition _TypeDecisionA1 = build("TypeDecisionA1");
ItemDefinition _TypeDecisionA2_x = build("TypeDecisionA2.x", _TypeDecisionA1);
ItemDefinition _TypeDecisionA3 = build("TypeDecisionA3", _TypeDecisionA2_x);
ItemDefinition _TypeDecisionB1 = build("TypeDecisionB1");
ItemDefinition _TypeDecisionB2_x = build("TypeDecisionB2.x", _TypeDecisionB1);
ItemDefinition _TypeDecisionB3 = build("TypeDecisionB3", _TypeDecisionB2_x, _TypeDecisionA3);
ItemDefinition _TypeDecisionC1 = build("TypeDecisionC1", _TypeDecisionA3, _TypeDecisionB3);
ItemDefinition _TypeDecisionC4 = build("TypeDecisionC4");
List<ItemDefinition> originalList = Arrays.asList(new ItemDefinition[] { _TypeDecisionA1, _TypeDecisionA2_x, _TypeDecisionA3, _TypeDecisionB1, _TypeDecisionB2_x, _TypeDecisionB3, _TypeDecisionC1, _TypeDecisionC4 });
List<ItemDefinition> orderedList = orderingStrategy(originalList);
assertTrue("Index of _TypeDecisionA1 < _TypeDecisionA2_x", orderedList.indexOf(_TypeDecisionA1) < orderedList.indexOf(_TypeDecisionA2_x));
assertTrue("Index of _TypeDecisionA2_x < _TypeDecisionA3", orderedList.indexOf(_TypeDecisionA2_x) < orderedList.indexOf(_TypeDecisionA3));
assertTrue("Index of _TypeDecisionA3 < _TypeDecisionB3", orderedList.indexOf(_TypeDecisionA3) < orderedList.indexOf(_TypeDecisionB3));
assertTrue("Index of _TypeDecisionA3 < _TypeDecisionC1", orderedList.indexOf(_TypeDecisionA3) < orderedList.indexOf(_TypeDecisionC1));
assertTrue("Index of _TypeDecisionB1 < _TypeDecisionB2_x", orderedList.indexOf(_TypeDecisionB1) < orderedList.indexOf(_TypeDecisionB2_x));
assertTrue("Index of _TypeDecisionB2_x < _TypeDecisionB3", orderedList.indexOf(_TypeDecisionB2_x) < orderedList.indexOf(_TypeDecisionB3));
assertTrue("Index of _TypeDecisionB3 < _TypeDecisionC1", orderedList.indexOf(_TypeDecisionB3) < orderedList.indexOf(_TypeDecisionC1));
}
use of org.kie.dmn.model.v1_1.List in project drools by kiegroup.
the class ItemDefinitionDependenciesTest method testGeneric.
@Test
public void testGeneric() {
ItemDefinition a = build("a");
ItemDefinition b = build("b");
ItemDefinition c = build("c", a, b);
ItemDefinition d = build("d", c);
List<ItemDefinition> originalList = Arrays.asList(new ItemDefinition[] { d, c, b, a });
List<ItemDefinition> orderedList = orderingStrategy(originalList);
assertThat(orderedList.subList(0, 2), containsInAnyOrder(a, b));
assertThat(orderedList.subList(2, 4), contains(c, d));
}
use of org.kie.dmn.model.v1_1.List in project drools by kiegroup.
the class DMNValidatorImpl method validate.
@Override
public List<DMNMessage> validate(Reader reader, Validation... options) {
DMNMessageManager results = new DefaultDMNMessagesManager();
EnumSet<Validation> flags = EnumSet.copyOf(Arrays.asList(options));
try {
String content = readContent(reader);
if (flags.contains(VALIDATE_SCHEMA)) {
results.addAll(validateSchema(new StringReader(content)));
}
if (flags.contains(VALIDATE_MODEL) || flags.contains(VALIDATE_COMPILATION)) {
Definitions dmndefs = DMNMarshallerFactory.newDefaultMarshaller().unmarshal(new StringReader(content));
Definitions.normalize(dmndefs);
validateModelCompilation(dmndefs, results, flags);
}
} catch (Throwable t) {
MsgUtil.reportMessage(LOG, DMNMessage.Severity.ERROR, null, results, t, null, Msg.FAILED_VALIDATOR);
}
return results.getMessages();
}
use of org.kie.dmn.model.v1_1.List in project kie-wb-common by kiegroup.
the class RelationUIModelMapperTest method setup.
@Before
public void setup() {
this.uiModel = new BaseGridData();
this.uiModel.appendRow(new DMNGridRow());
this.uiModel.appendRow(new DMNGridRow());
this.uiModel.appendColumn(uiRowNumberColumn);
this.uiModel.appendColumn(uiRelationColumn1);
this.uiModel.appendColumn(uiRelationColumn2);
doReturn(0).when(uiRowNumberColumn).getIndex();
doReturn(1).when(uiRelationColumn1).getIndex();
doReturn(2).when(uiRelationColumn2).getIndex();
this.relation = new Relation();
this.relation.getColumn().add(new InformationItem());
this.relation.getColumn().add(new InformationItem());
this.relation.getRow().add(new List() {
{
getExpression().add(new LiteralExpression() {
{
setText("le(1,0)");
}
});
getExpression().add(new LiteralExpression() {
{
setText("le(2,0)");
}
});
}
});
this.relation.getRow().add(new List() {
{
getExpression().add(new LiteralExpression() {
{
setText("le(1,1)");
}
});
getExpression().add(new LiteralExpression() {
{
setText("le(2,1)");
}
});
}
});
this.mapper = new RelationUIModelMapper(() -> uiModel, () -> Optional.of(relation), listSelector);
this.cellValueSupplier = Optional::empty;
}
Aggregations