@Test public void testCheckRmModelConformance() throws Exception { Archetype sourceArchetype = parseArchetype("adl15/validation/adl-test-ENTRY.bad_rm_model.v1.adls"); Archetype useNodeArchetype = new ArchetypeFlattener().flatten(null, sourceArchetype); ArchetypeValidator validator = new ArchetypeValidator(rmModel, useNodeArchetype); validator.validate(); List<AqlValidationError> expected = new ArrayList<>(); expected.add(new AqlValidationError(AqlValidationError.Level.ERROR, "No attribute [items] on rm type [ENTRY]")); expected.add(new AqlValidationError(AqlValidationError.Level.ERROR, "Unknown RM type: ELEMENT_X")); expected.add(new AqlValidationError(AqlValidationError.Level.ERROR, "Existence of attribute at /items[at10001]/value/value does not conform to RM model: 1..2 is not contained in 0..1")); assertThat(validator.getErrors()).containsOnly(expected.toArray()); }
void checkRmModelConformance() { final AmVisitor<AmObject, AmConstraintContext> visitor = AmVisitors.preorder(new ConformanceVisitor()); ArchetypeWalker.walkConstraints(visitor, archetype, new AmConstraintContext()); }
ArchetypeValidator { void checkRmModelConformance() { final AmVisitor<AmObject, AmConstraintContext> visitor = AmVisitors.preorder(new ConformanceVisitor()); ArchetypeWalker.walkConstraints(visitor, archetype, new AmConstraintContext()); } }
ArchetypeValidator { void checkRmModelConformance() { final AmVisitor<AmObject, AmConstraintContext> visitor = AmVisitors.preorder(new ConformanceVisitor()); ArchetypeWalker.walkConstraints(visitor, archetype, new AmConstraintContext()); } ArchetypeValidator(RmModel rmModel, Archetype archetype); }
ArchetypeValidator { void checkRmModelConformance() { final AmVisitor<AmObject, AmConstraintContext> visitor = AmVisitors.preorder(new ConformanceVisitor()); ArchetypeWalker.walkConstraints(visitor, archetype, new AmConstraintContext()); } ArchetypeValidator(RmModel rmModel, Archetype archetype); void validate(); List<AqlValidationError> getErrors(); }
ArchetypeValidator { void checkRmModelConformance() { final AmVisitor<AmObject, AmConstraintContext> visitor = AmVisitors.preorder(new ConformanceVisitor()); ArchetypeWalker.walkConstraints(visitor, archetype, new AmConstraintContext()); } ArchetypeValidator(RmModel rmModel, Archetype archetype); void validate(); List<AqlValidationError> getErrors();  }