use of com.opensimulationplatform.core.model.modeldescription.variablegroup.current.Current in project osp-validator by open-simulation-platform.
the class VE_Current_2 method getInvalidObjects.
@Override
protected List<Current> getInvalidObjects() {
OWLClass validationErrorClass = context.owl.dataFactory.getOWLClass(VE_Current_2, context.owl.prefixManager);
Set<OWLNamedIndividual> invalidIndividuals = context.invalidIndividuals.get(validationErrorClass);
return invalidIndividuals.stream().map(individual -> (Current) context.variableGroups.get(individual)).collect(Collectors.toList());
}
use of com.opensimulationplatform.core.model.modeldescription.variablegroup.current.Current in project osp-validator by open-simulation-platform.
the class VE_Current_3 method getInvalidObjects.
@Override
protected List<Current> getInvalidObjects() {
OWLClass validationErrorClass = context.owl.dataFactory.getOWLClass(VE_Current_3, context.owl.prefixManager);
Set<OWLNamedIndividual> invalidIndividuals = context.invalidIndividuals.get(validationErrorClass);
return invalidIndividuals.stream().map(individual -> (Current) context.variableGroups.get(individual)).collect(Collectors.toList());
}
use of com.opensimulationplatform.core.model.modeldescription.variablegroup.current.Current in project osp-validator by open-simulation-platform.
the class ElectromagneticPortValidatorTest method valid.
@Test
public void valid() {
ModelDescription modelDescription = new ModelDescription();
Variable v1 = new Variable();
v1.setCausality(Variable.Causality.OUTPUT);
Voltage voltage = new Voltage();
voltage.setVariables(Arrays.asList(v1));
Variable v2 = new Variable();
v2.setCausality(Variable.Causality.INPUT);
Current current = new Current();
current.setVariables(Arrays.asList(v2));
ElectromagneticPort electromagneticPort = new ElectromagneticPort();
electromagneticPort.setVoltage(voltage);
electromagneticPort.setCurrent(current);
modelDescription.getElectromagneticPorts().add(electromagneticPort);
ElectromagneticPortValidator electromagneticPortValidator = new ElectromagneticPortValidator();
List<ValidationDiagnostic<ElectromagneticPort>> diagnostics = electromagneticPortValidator.validate(modelDescription);
assertTrue(diagnostics.isEmpty());
}
use of com.opensimulationplatform.core.model.modeldescription.variablegroup.current.Current in project osp-validator by open-simulation-platform.
the class ElectromagneticPortValidatorTest method invalid.
@Test
public void invalid() {
ModelDescription modelDescription = new ModelDescription();
Variable v1 = new Variable();
v1.setCausality(Variable.Causality.OUTPUT);
Voltage voltage = new Voltage();
voltage.setVariables(Arrays.asList(v1));
Variable v2 = new Variable();
v2.setCausality(Variable.Causality.OUTPUT);
Current current = new Current();
current.setVariables(Arrays.asList(v2));
ElectromagneticPort electromagneticPort = new ElectromagneticPort();
electromagneticPort.setVoltage(voltage);
electromagneticPort.setCurrent(current);
modelDescription.getElectromagneticPorts().add(electromagneticPort);
ElectromagneticPortValidator electromagneticPortValidator = new ElectromagneticPortValidator();
List<ValidationDiagnostic<ElectromagneticPort>> diagnostics = electromagneticPortValidator.validate(modelDescription);
assertEquals(1, diagnostics.size());
assertEquals(electromagneticPort, diagnostics.get(0).getValidatedObject());
}
use of com.opensimulationplatform.core.model.modeldescription.variablegroup.current.Current in project osp-validator by open-simulation-platform.
the class VE_ElectromagneticPort_1_Test method invalid.
@Test
public void invalid() {
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.OUTPUT);
v3.setUnit(new Unit());
v3.setType(Variable.Type.REAL);
Variable v4 = new Variable();
v4.setCausality(Variable.Causality.OUTPUT);
v4.setUnit(new Unit());
v4.setType(Variable.Type.REAL);
Voltage voltage = new Voltage();
voltage.setVariables(Arrays.asList(v1, v2));
Current current = new Current();
current.setVariables(Arrays.asList(v3, v4));
ElectromagneticPort electromagneticPort = new ElectromagneticPort();
electromagneticPort.setVoltage(voltage);
electromagneticPort.setCurrent(current);
builder.build(electromagneticPort);
builder.complete();
List<ValidationDiagnostic<ElectromagneticPort>> diagnostics = validationError.validate();
assertEquals(1, diagnostics.size());
ElectromagneticPort invalidElectromagneticPort = diagnostics.get(0).getValidatedObject();
assertEquals(electromagneticPort, invalidElectromagneticPort);
}
Aggregations