[517072] Add JUnit test for QVTc example
diff --git a/examples/org.eclipse.qvtd.examples.qvtcore.uml2rdbms/.gitignore b/examples/org.eclipse.qvtd.examples.qvtcore.uml2rdbms/.gitignore
index 7dcc6d1..4310032 100644
--- a/examples/org.eclipse.qvtd.examples.qvtcore.uml2rdbms/.gitignore
+++ b/examples/org.eclipse.qvtd.examples.qvtcore.uml2rdbms/.gitignore
@@ -1,3 +1,3 @@
/qvtrbin
/bin
-
+/test-gen/
diff --git a/examples/org.eclipse.qvtd.examples.qvtcore.uml2rdbms/build.properties b/examples/org.eclipse.qvtd.examples.qvtcore.uml2rdbms/build.properties
index ea87885..f6a4d25 100644
--- a/examples/org.eclipse.qvtd.examples.qvtcore.uml2rdbms/build.properties
+++ b/examples/org.eclipse.qvtd.examples.qvtcore.uml2rdbms/build.properties
@@ -15,5 +15,6 @@
.,\
plugin.properties,\
about.html,\
- .settings/
+ .settings/,\
+ plugin.xml
src.includes = about.html
diff --git a/examples/org.eclipse.qvtd.examples.qvtcore.uml2rdbms/plugin.xml b/examples/org.eclipse.qvtd.examples.qvtcore.uml2rdbms/plugin.xml
new file mode 100644
index 0000000..c34c55f
--- /dev/null
+++ b/examples/org.eclipse.qvtd.examples.qvtcore.uml2rdbms/plugin.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+
+<!--
+ Copyright (c) 2017 Willink Transformations and others.
+ ;All rights reserved. This program and the accompanying materials
+ ;are made available under the terms of the Eclipse Public License v1.0
+ ;which accompanies this distribution, and is available at
+ ;http://www.eclipse.org/legal/epl-v10.html
+ ;
+ ;Contributors:
+ ; E.D.Willink - Initial API and implementation
+-->
+
+<plugin>
+ <extension
+ point="org.eclipse.core.contenttype.contentTypes">
+ </extension>
+
+</plugin>
diff --git a/tests/org.eclipse.qvtd.xtext.qvtcore.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.qvtd.xtext.qvtcore.tests/META-INF/MANIFEST.MF
index f38a94c..853ca09 100644
--- a/tests/org.eclipse.qvtd.xtext.qvtcore.tests/META-INF/MANIFEST.MF
+++ b/tests/org.eclipse.qvtd.xtext.qvtcore.tests/META-INF/MANIFEST.MF
@@ -10,7 +10,8 @@
org.eclipse.qvtd.codegen;bundle-version="[0.14.0,1.0.0)",
org.eclipse.qvtd.compiler;bundle-version="[0.14.0,1.0.0)",
org.eclipse.qvtd.xtext.qvtimperative.tests;bundle-version="[0.14.0,1.0.0)";visibility:=reexport,
- org.eclipse.qvtd.xtext.qvtcore.ui;bundle-version="[0.14.0,1.0.0)";visibility:=reexport
+ org.eclipse.qvtd.xtext.qvtcore.ui;bundle-version="[0.14.0,1.0.0)";visibility:=reexport,
+ org.eclipse.qvtd.examples.qvtcore.uml2rdbms;bundle-version="[0.14.0,1.0.0)"
Bundle-ActivationPolicy: lazy
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/tests/org.eclipse.qvtd.xtext.qvtcore.tests/src/org/eclipse/qvtd/xtext/qvtcore/tests/QVTcCompilerTests.java b/tests/org.eclipse.qvtd.xtext.qvtcore.tests/src/org/eclipse/qvtd/xtext/qvtcore/tests/QVTcCompilerTests.java
index 46c3dcc..5bee7fb 100644
--- a/tests/org.eclipse.qvtd.xtext.qvtcore.tests/src/org/eclipse/qvtd/xtext/qvtcore/tests/QVTcCompilerTests.java
+++ b/tests/org.eclipse.qvtd.xtext.qvtcore.tests/src/org/eclipse/qvtd/xtext/qvtcore/tests/QVTcCompilerTests.java
@@ -104,7 +104,19 @@
private final @NonNull Map<@NonNull Class<? extends Region>, @NonNull Integer> regionClass2count = new HashMap<>();
public MyQVT(@NonNull String testFolderName) {
- super(TESTS_BASE_URI, PROJECT_NAME, testFolderName);
+ this(TESTS_BASE_URI, PROJECT_NAME, testFolderName, "samples");
+ }
+
+ public MyQVT(@NonNull URI testsBaseURI, @NonNull String projectName, @Nullable String testFolderName, @Nullable String samplesFolderName) {
+ super(testsBaseURI, projectName, testFolderName, samplesFolderName);
+ /* //
+ // http://www.eclipse.org/emf/2002/Ecore is referenced by just about any model load
+ // Ecore.core is referenced from Ecore.genmodel that is used by the CG to coordinate Ecore objects with their Java classes
+ // therefore suppress diagnostics about confusing usage.
+ //
+ URI ecoreURI = URI.createURI(EcorePackage.eNS_URI);
+ getProjectManager().getPackageDescriptor(ecoreURI).configure(getResourceSet(), StandaloneProjectMap.LoadFirstStrategy.INSTANCE,
+ StandaloneProjectMap.MapToFirstConflictHandler.INSTANCE); */
}
public void assertRegionCount(@NonNull Class<? extends Region> regionClass, @NonNull Integer count) {
@@ -501,6 +513,45 @@
}
@Test
+ public void testQVTcCompiler_SimpleUML2RDBMS_example_CG() throws Exception {
+ // OperationDependencyAnalysis.CALL.setState(true);
+ // OperationDependencyAnalysis.CREATE.setState(true);
+ // OperationDependencyAnalysis.FINISH.setState(true);
+ // OperationDependencyAnalysis.PENDING.setState(true);
+ // OperationDependencyAnalysis.REFINING.setState(true);
+ // OperationDependencyAnalysis.RETURN.setState(true);
+ // OperationDependencyAnalysis.START.setState(true);
+ // AbstractTransformer.EXCEPTIONS.setState(true);
+ // AbstractTransformer.INVOCATIONS.setState(true);
+ // Scheduler.CONNECTION_ROUTING.setState(true);
+ // Scheduler.DEBUG_GRAPHS.setState(true);
+ // Scheduler.REGION_CYCLES.setState(true);
+ // Scheduler.REGION_DEPTH.setState(true);
+ // Scheduler.REGION_ORDER.setState(true);
+ // Scheduler.REGION_TRAVERSAL.setState(true);
+ Splitter.RESULT.setState(true);
+ Splitter.STAGES.setState(true);
+ Splitter.RESULT.setState(true);
+ URI testsBaseURI = URI.createPlatformResourceURI("/org.eclipse.qvtd.examples.qvtcore.uml2rdbms/bin/org/eclipse/qvtd/examples/qvtcore/uml2rdbms/", true);
+ String projectName = "org.eclipse.qvtd.examples.qvtcore.uml2rdbms";
+ MyQVT myQVT = new MyQVT(testsBaseURI, projectName, null, null);
+ try {
+ Class<? extends Transformer> txClass = myQVT.buildTransformation("SimpleUML2RDBMS.qvtc", "rdbms", "SimpleUML2RDBMS.genmodel");
+ myQVT.assertRegionCount(BasicMappingRegionImpl.class, 2);
+ myQVT.assertRegionCount(EarlyMerger.EarlyMergedMappingRegion.class, 0);
+ myQVT.assertRegionCount(LateConsumerMerger.LateMergedMappingRegion.class, 0);
+ myQVT.assertRegionCount(MicroMappingRegionImpl.class, 20);
+ myQVT.createGeneratedExecutor(txClass);
+ myQVT.loadInput("uml", "in/SimpleUMLPeople.xmi");
+ myQVT.executeTransformation();
+ myQVT.saveOutput("rdbms", "out/SimpleRDBMSPeople_CG.xmi", "out/SimpleRDBMSPeople_expected.xmi", SimpleRDBMSNormalizer.INSTANCE);
+ }
+ finally {
+ myQVT.dispose();
+ }
+ }
+
+ @Test
public void testQVTcCompiler_Upper2Lower() throws Exception {
// QVTs2QVTiVisitor.POLLED_PROPERTIES.setState(true);
String testFolderName = "upper2lower";