use of com.opensimulationplatform.core.validation.ValidationDiagnostic 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.ValidationDiagnostic in project osp-validator by open-simulation-platform.
the class VE_Name_1_Test method valid.
@Test
public void valid() {
Variable v1 = new Variable();
v1.setName("v1-unique-name");
Variable v2 = new Variable();
v2.setName("v2-unique-name");
builder.build(v1);
builder.build(v2);
builder.complete();
List<ValidationDiagnostic<Name>> diagnostics = validationError.validate();
assertTrue(diagnostics.isEmpty());
}
use of com.opensimulationplatform.core.validation.ValidationDiagnostic in project osp-validator by open-simulation-platform.
the class VE_Name_1_Test method invalid.
@Test
public void invalid() {
Variable v1 = new Variable();
v1.setName("not-a-unique-name");
Variable v2 = new Variable();
v2.setName("not-a-unique-name");
builder.build(v1);
builder.build(v2);
builder.complete();
List<ValidationDiagnostic<Name>> diagnostics = validationError.validate();
assertEquals(1, diagnostics.size());
Name invalidName = diagnostics.get(0).getValidatedObject();
assertEquals(invalidName.get(), v1.getName().get());
assertEquals(invalidName.get(), v2.getName().get());
}
use of com.opensimulationplatform.core.validation.ValidationDiagnostic in project osp-validator by open-simulation-platform.
the class VE_Name_2_Test method valid.
@Test
public void valid() {
Simulator s1 = new Simulator();
s1.setName("s1-unique-name");
Simulator s2 = new Simulator();
s2.setName("s2-unique-name");
builder.build(s1);
builder.build(s2);
builder.complete();
List<ValidationDiagnostic<Name>> diagnostics = validationError.validate();
assertTrue(diagnostics.isEmpty());
}
use of com.opensimulationplatform.core.validation.ValidationDiagnostic in project osp-validator by open-simulation-platform.
the class VE_Name_2_Test method invalid.
@Test
public void invalid() {
Simulator s1 = new Simulator();
s1.setName("not-a-unique-name");
Simulator s2 = new Simulator();
s2.setName("not-a-unique-name");
builder.build(s1);
builder.build(s2);
builder.complete();
List<ValidationDiagnostic<Name>> diagnostics = validationError.validate();
assertEquals(1, diagnostics.size());
Name invalidName = diagnostics.get(0).getValidatedObject();
assertEquals(invalidName.get(), s1.getName().get());
assertEquals(invalidName.get(), s2.getName().get());
}
Aggregations