Skip to content
Snippets Groups Projects
Commit 6ec7efd5 authored by Johannes Mey's avatar Johannes Mey
Browse files

add another test (ecore.ecore)

parent 914d9048
No related branches found
No related tags found
No related merge requests found
......@@ -5,13 +5,15 @@ import de.tudresden.inf.st.e2j.jastadd.model.EPackage;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
class ParserTest {
@Test
void parsePackage() {
void parseBigraph() {
EObject ePackage = null;
......@@ -36,6 +38,47 @@ class ParserTest {
p.writeXMI(b);
try (PrintWriter out = new PrintWriter("bigraph_out.ecore")) {
out.println(b.toString());
} catch (FileNotFoundException e) {
Assertions.fail("unable to write output file", e);
}
System.out.println(b.toString());
}
@Test
void parseEcore() {
EObject ePackage = null;
final String fileName = "/ecore/ecore.ecore";
EcoreParser parser = new EcoreParser();
try (InputStream stream = this.getClass().getResourceAsStream(fileName)) {
Assertions.assertNotNull(stream, "unable to load resource '" + fileName + "'");
ePackage = parser.parse(stream);
} catch (IOException | XMIParseException e) {
Assertions.fail(e);
}
Assertions.assertNotNull(ePackage);
Assertions.assertTrue(ePackage instanceof EPackage);
EPackage p = (EPackage) ePackage;
StringBuilder b = new StringBuilder();
p.writeXMI(b);
try (PrintWriter out = new PrintWriter("ecore_out.ecore")) {
out.println(b.toString());
} catch (FileNotFoundException e) {
Assertions.fail("unable to write output file", e);
}
System.out.println(b.toString());
}
......
......@@ -2,13 +2,11 @@
<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="bigraphBaseModel"
nsURI="http://de.tudresden.inf.st.bigraphs.models"
nsPrefix="bigraphBaseModel">
nsURI="http://de.tudresden.inf.st.bigraphs.models" nsPrefix="bigraphBaseModel">
<eClassifiers xsi:type="ecore:EClass" name="BPlace" abstract="true">
<eStructuralFeatures xsi:type="ecore:EReference" name="bChild" upperBound="-1"
eType="#//BPlace" containment="true" eOpposite="#//BPlace/bPrnt"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="bPrnt" eType="#//BPlace"
eOpposite="#//BPlace/bChild"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="bPrnt" eType="#//BPlace" eOpposite="#//BPlace/bChild"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="BRoot" eSuperTypes="#//BPlace">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="index"
......@@ -27,8 +25,8 @@
eOpposite="#//BLink/bPoints"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="BLink" abstract="true" eSuperTypes="#//NameableType">
<eStructuralFeatures xsi:type="ecore:EReference" name="bPoints" lowerBound="1"
upperBound="-1" eType="#//BPoint" eOpposite="#//BPoint/bLink"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="bPoints" lowerBound="1" upperBound="-1" eType="#//BPoint"
eOpposite="#//BPoint/bLink"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="BPort" eSuperTypes="#//BPoint">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="index"
......@@ -41,7 +39,6 @@
<eClassifiers xsi:type="ecore:EClass" name="BOuterName" eSuperTypes="#//BLink"/>
<eClassifiers xsi:type="ecore:EClass" name="NameableType" abstract="true" interface="true">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
iD="true"/>
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString" iD="true"/>
</eClassifiers>
</ecore:EPackage>
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment