Skip to content

Commit

Permalink
Fixed issue with EGL templates in Flexmi models
Browse files Browse the repository at this point in the history
  • Loading branch information
kolovos committed Jan 24, 2025
1 parent 90904ff commit ac35230
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ public InMemoryEmfModel getInMemoryFlexmiModel(String flexmi, String emfatic) th
EPackage ePackage = getEPackage(emfatic);
resourceSet.getPackageRegistry().put(ePackage.getNsURI(), ePackage);
resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("*", new FlexmiResourceFactory());
Resource resource = resourceSet.createResource(URI.createURI("flexmi.flexmi"));
// For Flexmi we need to call URI.createFileURI instead of URI.createURI
// as absolute URIs are required for Flexmi resources that involve EGL templates
Resource resource = resourceSet.createResource(URI.createFileURI("/flexmi.flexmi"));
resource.load(new ByteArrayInputStream(flexmi.getBytes()), null);

InMemoryEmfModel model = new InMemoryEmfModel(resource);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,16 @@ public void singlePackage() {
assertNotNull(result.getModelDiagram());
}

@Test
public void eglTemplate() {
var req = new Flexmi2PlantUMLRequest();
req.setFlexmi("<_><foo/><:template name=\"foo\"><content language=\"EGL\"></content></:template></_>");
req.setEmfatic("");

ModelDiagramResponse result = client.convert(req);
assertNull(result.getError());
assertNull(result.getOutput());
assertNotNull(result.getModelDiagram());
}

}

0 comments on commit ac35230

Please sign in to comment.