use of com.opensimulationplatform.core.validation.systemstructure.SystemStructureValidator in project osp-validator by open-simulation-platform.
the class UseCase1Test method works.
@Test
public void works() {
SystemStructureFactory factory = new SystemStructureFactory();
SystemStructure systemStructure = factory.create(TestResources.OSP_SYSTEM_STRUCTURE_USE_CASE_1);
SystemStructureValidator validator = new SystemStructureValidator();
List<ValidationDiagnostic<Object>> diagnostics = validator.validate(systemStructure);
for (ValidationDiagnostic<Object> diagnostic : diagnostics) {
System.out.println(diagnostic.getValidatedObject());
System.out.println(diagnostic.getErrorMessage());
}
assertTrue(diagnostics.isEmpty());
}
use of com.opensimulationplatform.core.validation.systemstructure.SystemStructureValidator in project osp-validator by open-simulation-platform.
the class UseCase3Test method works.
@Test
public void works() {
SystemStructureFactory factory = new SystemStructureFactory();
SystemStructure systemStructure = factory.create(TestResources.OSP_SYSTEM_STRUCTURE_USE_CASE_3);
SystemStructureValidator validator = new SystemStructureValidator();
List<ValidationDiagnostic<Object>> diagnostics = validator.validate(systemStructure);
for (ValidationDiagnostic<Object> diagnostic : diagnostics) {
System.out.println(diagnostic.getValidatedObject());
System.out.println(diagnostic.getErrorMessage());
}
assertTrue(diagnostics.isEmpty());
}
use of com.opensimulationplatform.core.validation.systemstructure.SystemStructureValidator in project osp-validator by open-simulation-platform.
the class UseCase4Test method works.
@Test
public void works() {
SystemStructureFactory factory = new SystemStructureFactory();
SystemStructure systemStructure = factory.create(TestResources.OSP_SYSTEM_STRUCTURE_USE_CASE_4);
SystemStructureValidator validator = new SystemStructureValidator();
List<ValidationDiagnostic<Object>> diagnostics = validator.validate(systemStructure);
for (ValidationDiagnostic<Object> diagnostic : diagnostics) {
System.out.println(diagnostic.getValidatedObject());
System.out.println(diagnostic.getErrorMessage());
}
assertTrue(diagnostics.isEmpty());
}
use of com.opensimulationplatform.core.validation.systemstructure.SystemStructureValidator in project osp-validator by open-simulation-platform.
the class Validator method getSystemStructureErrorMessages.
private List<String> getSystemStructureErrorMessages(File ospSystemStructureFile, OspSystemStructure ospSystemStructureElement, Map<Object, Location> locations) {
SystemStructureFactory factory = new SystemStructureFactory();
SystemStructure systemStructure = factory.create(ospSystemStructureFile);
SystemStructureValidator validator = new SystemStructureValidator();
List<ValidationDiagnostic<Object>> diagnostics = validator.validate(systemStructure);
Map<Object, Object> coreToJaxb = createSystemStructureMap(systemStructure, ospSystemStructureElement);
return getErrorMessages(ospSystemStructureFile, locations, diagnostics, coreToJaxb);
}
use of com.opensimulationplatform.core.validation.systemstructure.SystemStructureValidator in project osp-validator by open-simulation-platform.
the class ValidateOspSystemStructureFile method main.
public static void main(String[] args) {
File ospSystemStructureFile = new File("/path/to/OspSystemStructure.xml");
SystemStructureFactory factory = new SystemStructureFactory();
SystemStructure modelDescription = factory.create(ospSystemStructureFile);
SystemStructureValidator validator = new SystemStructureValidator();
List<ValidationDiagnostic<Object>> diagnostics = validator.validate(modelDescription);
for (ValidationDiagnostic<Object> diagnostic : diagnostics) {
System.out.println("Message: " + diagnostic.getErrorMessage());
System.out.println("Object: " + diagnostic.getValidatedObject());
}
}
Aggregations