use of org.eclipse.vorto.core.api.model.mapping.MappingModel in project vorto by eclipse.
the class ModelReaderTest method testMappingFromZipFile.
@Test
public void testMappingFromZipFile() {
IModelWorkspace workspace = IModelWorkspace.newReader().addZip(new ZipInputStream(getClass().getClassLoader().getResourceAsStream("mappings.zip"))).read();
Model model = workspace.get().stream().filter(p -> p instanceof MappingModel).findAny().get();
assertNotNull(model);
assertTrue(model instanceof MappingModel);
assertEquals("Accelerometer_Mapping", model.getName());
}
use of org.eclipse.vorto.core.api.model.mapping.MappingModel in project vorto by eclipse.
the class LWM2MMappingParseTest method parseFunctionBlockMapping.
@Test
public void parseFunctionBlockMapping() throws IOException {
MappingModel mappingModel = createMappingModel("LWM2MResourceComplete.mapping");
EList<MappingRule> rules = mappingModel.getRules();
assertEquals(3, rules.size());
}
use of org.eclipse.vorto.core.api.model.mapping.MappingModel in project vorto by eclipse.
the class LWM2MMappingParseTest method createMappingModel.
private MappingModel createMappingModel(String mappingFileName) throws IOException {
ResourceSet rset = new ResourceSetImpl();
rset.getPackageRegistry().put(MappingPackage.eNS_URI, MappingPackage.eINSTANCE);
rset.getResourceFactoryRegistry().getExtensionToFactoryMap().put("xmi", new XMIResourceFactoryImpl());
Resource resource = rset.getResource(URI.createFileURI(EXAMPLES_DIRECTORY + mappingFileName), true);
resource.load(null);
MappingModel mappingModel = (MappingModel) resource.getContents().get(0);
return mappingModel;
}
use of org.eclipse.vorto.core.api.model.mapping.MappingModel in project vorto by eclipse.
the class LWM2MMappingParseTest method parseEntityMapping.
@Test
public void parseEntityMapping() throws IOException {
MappingModel mappingModel = this.createMappingModel("LWM2MResourceEntity.mapping");
EList<MappingRule> rules = mappingModel.getRules();
assertEquals(4, rules.size());
}
use of org.eclipse.vorto.core.api.model.mapping.MappingModel in project vorto by eclipse.
the class MappingModelSyntaxTest method parseMappingWithEntityReference.
@Test
public void parseMappingWithEntityReference() throws IOException {
MappingModel mappingModel = createMappingModel("type/Entity_Ref.mapping");
EList<MappingRule> rules = mappingModel.getRules();
assertEquals(1, rules.size());
}
Aggregations