use of org.eclipse.vorto.utilities.reader.IModelWorkspace in project vorto by eclipse.
the class ModelReaderTest method testFlatInheritanceIM.
@Test
public void testFlatInheritanceIM() {
IModelWorkspace workspace = IModelWorkspace.newReader().addFile(getClass().getClassLoader().getResourceAsStream("dsls/TestModel.infomodel"), ModelType.InformationModel).addFile(getClass().getClassLoader().getResourceAsStream("dsls/SomeFb.fbmodel"), ModelType.Functionblock).addFile(getClass().getClassLoader().getResourceAsStream("dsls/SuperFb.fbmodel"), ModelType.Functionblock).addFile(getClass().getClassLoader().getResourceAsStream("dsls/SuperSuperFb.fbmodel"), ModelType.Functionblock).read();
InformationModel infomodel = ModelConversionUtils.convertToFlatHierarchy((InformationModel) workspace.get().get(0));
assertEquals("TestModel", infomodel.getName());
assertEquals(4, infomodel.getProperties().get(0).getType().getFunctionblock().getStatus().getProperties().size());
assertEquals(3, infomodel.getProperties().get(0).getType().getFunctionblock().getConfiguration().getProperties().size());
assertEquals(2, infomodel.getProperties().get(0).getType().getFunctionblock().getOperations().size());
Property statusProperty = infomodel.getProperties().get(0).getType().getFunctionblock().getStatus().getProperties().stream().filter(p -> p.getName().equals("statusProp")).findFirst().get();
assertEquals(2, statusProperty.getConstraintRule().getConstraints().size());
}
use of org.eclipse.vorto.utilities.reader.IModelWorkspace in project vorto by eclipse.
the class ModelReaderTest method testReadFunctionblockModelsFromZipFile.
@Test
public void testReadFunctionblockModelsFromZipFile() {
IModelWorkspace workspace = IModelWorkspace.newReader().addZip(new ZipInputStream(getClass().getClassLoader().getResourceAsStream("models.zip"))).read();
assertEquals(2, workspace.get().stream().filter(p -> p instanceof FunctionblockModel).collect(Collectors.toList()).size());
}
Aggregations