use of com.opensimulationplatform.core.model.modeldescription.variablegroup.pressure.Pressure in project osp-validator by open-simulation-platform.
the class VE_Pressure_2 method getInvalidObjects.
@Override
protected List<Pressure> getInvalidObjects() {
OWLClass validationErrorClass = context.owl.dataFactory.getOWLClass(VE_Pressure_2, context.owl.prefixManager);
Set<OWLNamedIndividual> invalidIndividuals = context.invalidIndividuals.get(validationErrorClass);
return invalidIndividuals.stream().map(individual -> (Pressure) context.variableGroups.get(individual)).collect(Collectors.toList());
}
use of com.opensimulationplatform.core.model.modeldescription.variablegroup.pressure.Pressure in project osp-validator by open-simulation-platform.
the class VE_Pressure_3 method getInvalidObjects.
@Override
protected List<Pressure> getInvalidObjects() {
OWLClass validationErrorClass = context.owl.dataFactory.getOWLClass(VE_Pressure_3, context.owl.prefixManager);
Set<OWLNamedIndividual> invalidIndividuals = context.invalidIndividuals.get(validationErrorClass);
return invalidIndividuals.stream().map(individual -> (Pressure) context.variableGroups.get(individual)).collect(Collectors.toList());
}
use of com.opensimulationplatform.core.model.modeldescription.variablegroup.pressure.Pressure in project osp-validator by open-simulation-platform.
the class HydraulicPortValidatorTest method invalid.
@Test
public void invalid() {
ModelDescription modelDescription = new ModelDescription();
Variable v1 = new Variable();
v1.setCausality(Variable.Causality.OUTPUT);
Pressure pressure = new Pressure();
pressure.setVariables(Arrays.asList(v1));
Variable v2 = new Variable();
v2.setCausality(Variable.Causality.OUTPUT);
VolumeFlowRate volumeFlowRate = new VolumeFlowRate();
volumeFlowRate.setVariables(Arrays.asList(v2));
HydraulicPort hydraulicPort = new HydraulicPort();
hydraulicPort.setPressure(pressure);
hydraulicPort.setVolumeFlowRate(volumeFlowRate);
modelDescription.getHydraulicPorts().add(hydraulicPort);
HydraulicPortValidator hydraulicPortValidator = new HydraulicPortValidator();
List<ValidationDiagnostic<HydraulicPort>> diagnostics = hydraulicPortValidator.validate(modelDescription);
assertEquals(1, diagnostics.size());
assertEquals(hydraulicPort, diagnostics.get(0).getValidatedObject());
}
use of com.opensimulationplatform.core.model.modeldescription.variablegroup.pressure.Pressure in project osp-validator by open-simulation-platform.
the class HydraulicPortValidatorTest method valid.
@Test
public void valid() {
ModelDescription modelDescription = new ModelDescription();
Variable v1 = new Variable();
v1.setCausality(Variable.Causality.OUTPUT);
Pressure pressure = new Pressure();
pressure.setVariables(Arrays.asList(v1));
Variable v2 = new Variable();
v2.setCausality(Variable.Causality.INPUT);
VolumeFlowRate volumeFlowRate = new VolumeFlowRate();
volumeFlowRate.setVariables(Arrays.asList(v2));
HydraulicPort hydraulicPort = new HydraulicPort();
hydraulicPort.setPressure(pressure);
hydraulicPort.setVolumeFlowRate(volumeFlowRate);
modelDescription.getHydraulicPorts().add(hydraulicPort);
HydraulicPortValidator hydraulicPortValidator = new HydraulicPortValidator();
List<ValidationDiagnostic<HydraulicPort>> diagnostics = hydraulicPortValidator.validate(modelDescription);
assertTrue(diagnostics.isEmpty());
}
use of com.opensimulationplatform.core.model.modeldescription.variablegroup.pressure.Pressure in project osp-validator by open-simulation-platform.
the class VE_HydraulicPort_1_Test method valid.
@Test
public void valid() {
Variable v1 = new Variable();
v1.setCausality(Variable.Causality.OUTPUT);
v1.setUnit(new Unit());
v1.setType(Variable.Type.REAL);
Variable v2 = new Variable();
v2.setCausality(Variable.Causality.OUTPUT);
v2.setUnit(new Unit());
v2.setType(Variable.Type.REAL);
Variable v3 = new Variable();
v3.setCausality(Variable.Causality.INPUT);
v3.setUnit(new Unit());
v3.setType(Variable.Type.REAL);
Variable v4 = new Variable();
v4.setCausality(Variable.Causality.INPUT);
v4.setUnit(new Unit());
v4.setType(Variable.Type.REAL);
Pressure pressure = new Pressure();
pressure.setVariables(Arrays.asList(v1, v2));
VolumeFlowRate volumeFlowRate = new VolumeFlowRate();
volumeFlowRate.setVariables(Arrays.asList(v3, v4));
HydraulicPort hydraulicPort = new HydraulicPort();
hydraulicPort.setPressure(pressure);
hydraulicPort.setVolumeFlowRate(volumeFlowRate);
builder.build(hydraulicPort);
builder.complete();
List<ValidationDiagnostic<HydraulicPort>> diagnostics = validationError.validate();
assertTrue(diagnostics.isEmpty());
}
Aggregations