Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Bouhier2013-12-17 10:16:08 -0500
committerChristophe Bouhier2013-12-17 10:16:08 -0500
commitf302ee64527aa5396d3faff2924679fa26b27bb5 (patch)
treecc11002e4ef02073dd78dd0601ac77cb98da8ce7
parent088484e0b6acb4b1c09ac39805c79681bf21f4cf (diff)
downloadorg.eclipse.emf.edapt-f302ee64527aa5396d3faff2924679fa26b27bb5.tar.gz
org.eclipse.emf.edapt-f302ee64527aa5396d3faff2924679fa26b27bb5.tar.xz
org.eclipse.emf.edapt-f302ee64527aa5396d3faff2924679fa26b27bb5.zip
- Test cases which support a CDO backend.
-rw-r--r--builds/org.eclipse.emf.edapt.releng.target/edapt_with_cdo.target156
-rw-r--r--tests/org.eclipse.emf.edapt.cdo.tests/.classpath7
-rw-r--r--tests/org.eclipse.emf.edapt.cdo.tests/.project28
-rw-r--r--tests/org.eclipse.emf.edapt.cdo.tests/META-INF/MANIFEST.MF17
-rw-r--r--tests/org.eclipse.emf.edapt.cdo.tests/build.properties5
-rw-r--r--tests/org.eclipse.emf.edapt.cdo.tests/data/component/component.ecore15
-rw-r--r--tests/org.eclipse.emf.edapt.cdo.tests/data/component/component.history182
-rw-r--r--tests/org.eclipse.emf.edapt.cdo.tests/data/component/component.test4
-rw-r--r--tests/org.eclipse.emf.edapt.cdo.tests/data/component/component_r0.xmi12
-rw-r--r--tests/org.eclipse.emf.edapt.cdo.tests/data/component/component_r1.xmi12
-rw-r--r--tests/org.eclipse.emf.edapt.cdo.tests/plugin.xml5
-rw-r--r--tests/org.eclipse.emf.edapt.cdo.tests/src/org/eclipse/emf/edapt/cdo/tests/CDOMigrationTestBase.java356
-rw-r--r--tests/org.eclipse.emf.edapt.cdo.tests/src/org/eclipse/emf/edapt/cdo/tests/CDOMigrationTestCase.java68
-rw-r--r--tests/org.eclipse.emf.edapt.cdo.tests/src/org/eclipse/emf/edapt/cdo/tests/CDOMigrationTestSuite.java112
-rw-r--r--tests/org.eclipse.emf.edapt.cdo.tests/src/org/eclipse/emf/edapt/cdo/tests/CDOSingleMigrationTest.java64
-rw-r--r--tests/org.eclipse.emf.edapt.cdo.tests/src/org/eclipse/emf/edapt/cdo/tests/CDOTest.java67
-rw-r--r--tests/org.eclipse.emf.edapt.cdo.tests/src/org/eclipse/emf/edapt/cdo/tests/CDOTestUtil.java73
-rw-r--r--tests/org.eclipse.emf.edapt.cdo.tests/src/org/eclipse/emf/edapt/cdo/tests/EdaptCDOViewProvider.java54
-rw-r--r--tests/org.eclipse.emf.edapt.tests/src/org/eclipse/emf/edapt/tests/migration/SingleMigrationTest.java2
19 files changed, 1238 insertions, 1 deletions
diff --git a/builds/org.eclipse.emf.edapt.releng.target/edapt_with_cdo.target b/builds/org.eclipse.emf.edapt.releng.target/edapt_with_cdo.target
new file mode 100644
index 0000000..dac099d
--- /dev/null
+++ b/builds/org.eclipse.emf.edapt.releng.target/edapt_with_cdo.target
@@ -0,0 +1,156 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?pde version="3.8"?>
+
+<target name="Edapt target" sequenceNumber="69">
+<locations>
+<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="slicer" includeSource="true" type="InstallableUnit">
+<unit id="org.eclipse.emf.compare.ide.ui.source.feature.group" version="2.1.0.201306250935"/>
+<unit id="org.eclipse.emf.compare.ide.ui.feature.group" version="2.1.0.201306250935"/>
+<unit id="org.eclipse.emf.compare.source.feature.group" version="2.1.0.201306250935"/>
+<unit id="org.eclipse.emf.compare.feature.group" version="2.1.0.201306250935"/>
+<unit id="org.eclipse.emf.compare.rcp.ui.source.feature.group" version="2.1.0.201306250935"/>
+<unit id="org.eclipse.emf.compare.rcp.ui.feature.group" version="2.1.0.201306250935"/>
+<repository location="http://download.eclipse.org/modeling/emf/compare/updates/releases/2.1"/>
+</location>
+<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="slicer" includeSource="true" type="InstallableUnit">
+<unit id="org.eclipse.rcp.source.feature.group" version="4.3.0.v20130605-2000"/>
+<unit id="org.eclipse.pde.api.tools.ee.feature.feature.group" version="1.0.0.v20130327-1631"/>
+<unit id="org.eclipse.releng.tools.feature.group" version="3.5.0.v20130523-0845"/>
+<unit id="org.eclipse.equinox.sdk.feature.group" version="3.9.0.v20130604-2047"/>
+<unit id="org.eclipse.sdk.ide" version="4.3.0.I20130605-2000"/>
+<unit id="org.eclipse.platform.sdk" version="4.3.0.I20130605-2000"/>
+<unit id="org.eclipse.test.feature.group" version="3.6.0.v20130424-0442"/>
+<unit id="org.eclipse.sdk.tests.feature.group" version="4.3.0.v20130606-0135"/>
+<unit id="org.eclipse.platform.ide" version="4.3.0.I20130605-2000"/>
+<unit id="org.eclipse.rcp.feature.group" version="4.3.0.v20130605-2000"/>
+<repository location="http://download.eclipse.org/eclipse/updates/4.3"/>
+</location>
+<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="slicer" includeSource="true" type="InstallableUnit">
+<unit id="org.eclipse.ocl.master.feature.group" version="4.0.1.v20120919-0602"/>
+<unit id="org.eclipse.ocl.all.sdk.feature.group" version="4.0.1.v20120919-0602"/>
+<unit id="org.eclipse.ocl.examples.feature.group" version="3.2.1.v20120919-0602"/>
+<repository location="http://download.eclipse.org/modeling/mdt/ocl/updates/releases/4.0.1"/>
+</location>
+<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="slicer" includeSource="true" type="InstallableUnit">
+<unit id="org.eclipse.emf.ecore.xcore.ui.feature.group" version="1.1.0.v20130903-0948"/>
+<unit id="org.eclipse.emf.databinding.feature.group" version="1.3.0.v20130902-0605"/>
+<unit id="org.eclipse.emf.codegen.ecore.feature.group" version="2.9.1.v20130902-0605"/>
+<unit id="org.eclipse.emf.edit.ui.feature.group" version="2.9.0.v20130902-0605"/>
+<unit id="org.eclipse.emf.mapping.ecore.editor.feature.group" version="2.8.0.v20130902-0605"/>
+<unit id="org.eclipse.emf.gwt.sdk.feature.group" version="2.9.0.v20130902-0605"/>
+<unit id="org.eclipse.emf.gwt.feature.group" version="2.9.0.v20130902-0605"/>
+<unit id="org.eclipse.emf.mapping.ecore.feature.group" version="2.7.0.v20130902-0605"/>
+<unit id="org.eclipse.emf.rap.edit.ui.feature.group" version="2.9.0.v20130902-0605"/>
+<unit id="org.eclipse.emf.oda.ecore.feature.group" version="1.2.0.v20130902-0605"/>
+<unit id="org.eclipse.emf.codegen.ecore.ui.feature.group" version="2.9.1.v20130902-0605"/>
+<unit id="org.eclipse.xsd.sdk.feature.group" version="2.9.1.v20130902-0605"/>
+<unit id="org.eclipse.emf.common.feature.group" version="2.9.1.v20130827-0309"/>
+<unit id="org.eclipse.emf.ecore.edit.feature.group" version="2.8.0.v20130902-0605"/>
+<unit id="org.eclipse.xsd.feature.group" version="2.9.1.v20130902-0605"/>
+<unit id="org.eclipse.emf.ecore.xcore.feature.group" version="1.1.1.v20130903-0948"/>
+<unit id="org.eclipse.emf.codegen.feature.group" version="2.9.0.v20130902-0605"/>
+<unit id="org.eclipse.emf.edit.feature.group" version="2.9.0.v20130902-0605"/>
+<unit id="org.eclipse.emf.ecore.xcore.sdk.feature.group" version="1.1.1.v20130903-0948"/>
+<unit id="org.eclipse.xsd.edit.feature.group" version="2.7.0.v20130902-0605"/>
+<unit id="org.eclipse.emf.all.feature.group" version="2.9.1.v20130902-0605"/>
+<unit id="org.eclipse.emf.oda.ecore.ui.feature.group" version="1.1.0.v20130902-0605"/>
+<unit id="org.eclipse.emf.rap.feature.group" version="2.9.0.v20130902-0605"/>
+<unit id="org.eclipse.emf.ecore.editor.feature.group" version="2.9.0.v20130902-0605"/>
+<unit id="org.eclipse.emf.codegen.ui.feature.group" version="2.7.0.v20130902-0605"/>
+<unit id="org.eclipse.xsd.mapping.editor.feature.group" version="2.8.0.v20130902-0605"/>
+<unit id="org.eclipse.emf.mapping.feature.group" version="2.7.0.v20130902-0605"/>
+<unit id="org.eclipse.xsd.doc.feature.group" version="2.8.0.v20130902-0605"/>
+<unit id="org.eclipse.emf.feature.group" version="2.9.1.v20130902-0605"/>
+<unit id="org.eclipse.emf.doc.feature.group" version="2.8.0.v20130902-0605"/>
+<unit id="org.eclipse.emf.examples.feature.group" version="2.9.0.v20130902-0605"/>
+<unit id="org.eclipse.emf.oda.sdk.feature.group" version="1.2.0.v20130902-0605"/>
+<unit id="org.eclipse.emf.gwt.common.feature.group" version="2.9.0.v20130902-0605"/>
+<unit id="org.eclipse.emf.rap.common.ui.feature.group" version="2.8.0.v20130902-0605"/>
+<unit id="org.eclipse.xsd.editor.feature.group" version="2.7.0.v20130902-0605"/>
+<unit id="org.eclipse.emf.oda.feature.group" version="1.2.0.v20130902-0605"/>
+<unit id="org.eclipse.emf.gwt.edit.ui.feature.group" version="2.7.0.v20130902-0605"/>
+<unit id="org.eclipse.emf.common.ui.feature.group" version="2.8.0.v20130902-0605"/>
+<unit id="org.eclipse.emf.rap.sdk.feature.group" version="2.9.0.v20130902-0605"/>
+<unit id="org.eclipse.emf.ecore.feature.group" version="2.9.1.v20130827-0309"/>
+<unit id="org.eclipse.emf.mapping.ui.feature.group" version="2.7.0.v20130902-0605"/>
+<unit id="org.eclipse.xsd.mapping.feature.group" version="2.7.0.v20130902-0605"/>
+<unit id="org.eclipse.emf.converter.feature.group" version="2.9.0.v20130902-0605"/>
+<unit id="org.eclipse.xsd.ecore.converter.feature.group" version="2.8.0.v20130902-0605"/>
+<unit id="org.eclipse.emf.databinding.edit.feature.group" version="1.3.0.v20130902-0605"/>
+<unit id="org.eclipse.emf.gwt.ecore.feature.group" version="2.9.0.v20130902-0605"/>
+<unit id="org.eclipse.emf.gwt.edit.feature.group" version="2.8.0.v20130902-0605"/>
+<unit id="org.eclipse.emf.gwt.ecore.edit.feature.group" version="2.8.0.v20130902-0605"/>
+<unit id="org.eclipse.emf.sdk.feature.group" version="2.9.1.v20130902-0605"/>
+<repository location="http://download.eclipse.org/modeling/emf/emf/updates/releases/"/>
+</location>
+<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="slicer" includeSource="true" type="InstallableUnit">
+<unit id="org.eclipse.acceleo.examples.feature.group" version="3.2.2.v20120807-0831"/>
+<unit id="org.eclipse.acceleo.runtime.feature.group" version="3.2.2.v20120807-0831"/>
+<unit id="org.eclipse.acceleo.ui.capabilities.feature.group" version="3.2.2.v20120807-0831"/>
+<unit id="org.eclipse.acceleo.doc.feature.group" version="3.2.2.v20120807-0831"/>
+<unit id="org.eclipse.acceleo.feature.group" version="3.2.2.v20120807-0831"/>
+<unit id="org.eclipse.acceleo.sdk.feature.group" version="3.2.2.v20120807-0831"/>
+<repository location="http://download.eclipse.org/modeling/m2t/acceleo/updates/releases/3.2"/>
+</location>
+<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="slicer" includeSource="true" type="InstallableUnit">
+<unit id="org.junit" version="4.11.0.v201303080030"/>
+<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/R20130827064939/repository/"/>
+</location>
+<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="slicer" includeSource="true" type="InstallableUnit">
+<unit id="org.eclipse.emf.cdo.migrator.feature.group" version="4.2.0.v20130503-1908"/>
+<unit id="org.eclipse.emf.cdo.doc.feature.group" version="4.2.0.v20130612-0849"/>
+<unit id="org.eclipse.emf.cdo.explorer.product.feature.group" version="4.1.100.v20130503-1908"/>
+<unit id="org.eclipse.emf.cdo.server.db4o.feature.group" version="4.2.0.v20130601-1611"/>
+<unit id="org.gastro.feature.group" version="4.2.0.v20130503-1908"/>
+<unit id="org.eclipse.emf.cdo.compare.feature.group" version="4.2.0.v20130612-0849"/>
+<unit id="org.eclipse.emf.cdo.server.lissome.feature.group" version="4.2.1.v20130810-1101"/>
+<unit id="org.eclipse.emf.cdo.feature.group" version="4.2.1.v20130913-0613"/>
+<unit id="org.eclipse.emf.cdo.server.objectivity.feature.group" version="4.2.0.v20130811-0646"/>
+<unit id="org.eclipse.emf.cdo.examples.feature.group" version="4.2.0.v20130601-0759"/>
+<unit id="org.eclipse.emf.cdo.server.product.feature.group" version="4.1.100.v20130531-1716"/>
+<unit id="org.eclipse.emf.cdo.server.feature.group" version="4.2.1.v20130913-0613"/>
+<unit id="org.eclipse.emf.cdo.server.db.feature.group" version="4.2.1.v20130811-0503"/>
+<unit id="org.eclipse.emf.cdo.defs.feature.group" version="4.2.1.v20130913-0613"/>
+<unit id="org.eclipse.emf.cdo.server.mongodb.feature.group" version="4.2.0.v20130601-1611"/>
+<unit id="org.eclipse.emf.cdo.sdk.feature.group" version="4.2.1.v20130913-0613"/>
+<unit id="org.eclipse.emf.cdo.tests.feature.group" version="4.2.1.v20130913-0613"/>
+<unit id="org.eclipse.emf.cdo.examples.hibernate.feature.group" version="4.2.1.v20130813-1544"/>
+<unit id="org.eclipse.emf.cdo.server.hibernate.feature.group" version="4.2.1.v20130911-1235"/>
+<unit id="org.eclipse.emf.cdo.tests.hibernate.feature.group" version="4.2.1.v20130911-1235"/>
+<unit id="org.eclipse.emf.cdo.releng.projectcopy.feature.group" version="1.1.0.v20130503-1908"/>
+<unit id="org.eclipse.emf.cdo.releng.version.doc.feature.group" version="1.1.0.v20130612-0849"/>
+<unit id="org.eclipse.emf.cdo.releng.version.headless.feature.group" version="1.1.0.v20130601-1611"/>
+<unit id="org.eclipse.emf.cdo.releng.manifests.feature.group" version="1.1.0.v20130503-1908"/>
+<unit id="org.eclipse.emf.cdo.releng.version.feature.group" version="1.1.0.v20130601-1611"/>
+<unit id="org.eclipse.emf.cdo.releng.version.sdk.feature.group" version="1.1.0.v20130612-0849"/>
+<unit id="org.eclipse.emf.cdo.releng.tasks.feature.group" version="1.1.0.v20130504-1740"/>
+<unit id="org.eclipse.emf.cdo.releng.winexplorer.feature.group" version="1.1.0.v20130503-1908"/>
+<unit id="org.eclipse.emf.cdo.releng.gitbash.feature.group" version="1.1.0.v20130529-1207"/>
+<unit id="org.eclipse.emf.cdo.releng.buildstamp.feature.group" version="1.1.0.v20130503-1908"/>
+<unit id="org.eclipse.emf.cdo.releng.help.feature.group" version="4.2.0.v20130612-0849"/>
+<unit id="org.eclipse.emf.cdo.releng.apireports.feature.group" version="1.0.0.v20130503-1908"/>
+<unit id="org.eclipse.emf.cdo.releng.relativepaths.feature.group" version="1.1.0.v20130503-1908"/>
+<unit id="org.eclipse.emf.cdo.releng.version.tests.feature.group" version="1.1.0.v20130503-1908"/>
+<unit id="org.eclipse.emf.cdo.releng.windowtitle.feature.group" version="1.1.0.v20130503-1908"/>
+<unit id="org.eclipse.emf.cdo.releng.workingsets.feature.group" version="1.1.0.v20130503-1908"/>
+<unit id="org.eclipse.emf.cdo.releng.launches.feature.group" version="1.1.0.v20130503-1908"/>
+<unit id="org.eclipse.net4j.db.oracle.feature.group" version="1.0.0.v20130515-0529"/>
+<unit id="org.eclipse.net4j.db.postgresql.feature.group" version="4.2.0.v20130601-1611"/>
+<unit id="org.eclipse.net4j.db.feature.group" version="4.2.1.v20130730-0902"/>
+<unit id="org.eclipse.net4j.db.mysql.feature.group" version="4.2.0.v20130601-1611"/>
+<unit id="org.eclipse.net4j.db.derby.feature.group" version="4.2.0.v20130601-1611"/>
+<unit id="org.eclipse.net4j.db.hsqldb.feature.group" version="4.2.0.v20130601-1611"/>
+<unit id="org.eclipse.net4j.db.h2.feature.group" version="4.2.0.v20130601-1611"/>
+<unit id="org.eclipse.net4j.ui.feature.group" version="4.2.0.v20130601-1611"/>
+<unit id="org.eclipse.net4j.defs.feature.group" version="4.2.1.v20130806-0658"/>
+<unit id="org.eclipse.net4j.examples.feature.group" version="4.2.0.v20130601-0759"/>
+<unit id="org.eclipse.net4j.util.ui.feature.group" version="4.2.0.v20130730-0902"/>
+<unit id="org.eclipse.net4j.doc.feature.group" version="4.2.0.v20130612-0849"/>
+<unit id="org.eclipse.net4j.feature.group" version="4.2.1.v20130806-0658"/>
+<unit id="org.eclipse.net4j.tests.feature.group" version="4.2.0.v20130503-1908"/>
+<unit id="org.eclipse.net4j.util.feature.group" version="4.2.0.v20130601-1611"/>
+<unit id="org.eclipse.net4j.sdk.feature.group" version="4.2.1.v20130806-0658"/>
+<repository location="http://download.eclipse.org/modeling/emf/cdo/updates/releases/4.2"/>
+</location>
+</locations>
+</target>
diff --git a/tests/org.eclipse.emf.edapt.cdo.tests/.classpath b/tests/org.eclipse.emf.edapt.cdo.tests/.classpath
new file mode 100644
index 0000000..64c5e31
--- /dev/null
+++ b/tests/org.eclipse.emf.edapt.cdo.tests/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/tests/org.eclipse.emf.edapt.cdo.tests/.project b/tests/org.eclipse.emf.edapt.cdo.tests/.project
new file mode 100644
index 0000000..b4dc028
--- /dev/null
+++ b/tests/org.eclipse.emf.edapt.cdo.tests/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.emf.edapt.cdo.tests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/tests/org.eclipse.emf.edapt.cdo.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.emf.edapt.cdo.tests/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..4482399
--- /dev/null
+++ b/tests/org.eclipse.emf.edapt.cdo.tests/META-INF/MANIFEST.MF
@@ -0,0 +1,17 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Tests
+Bundle-SymbolicName: org.eclipse.emf.edapt.cdo.tests;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.emf.cdo;bundle-version="4.2.1",
+ org.eclipse.net4j.jvm;bundle-version="4.1.100",
+ org.eclipse.emf.cdo.net4j;bundle-version="4.1.101",
+ org.eclipse.emf.cdo.server.net4j;bundle-version="4.1.1",
+ org.junit;bundle-version="4.11.0",
+ org.eclipse.net4j.tcp;bundle-version="4.1.100",
+ org.eclipse.emf.edapt.common;bundle-version="0.3.0",
+ org.eclipse.emf.edapt.migration.test;bundle-version="0.3.0",
+ org.eclipse.emf.edapt.history.edit;bundle-version="0.3.0",
+ org.eclipse.emf.edapt.tests;bundle-version="0.3.0"
diff --git a/tests/org.eclipse.emf.edapt.cdo.tests/build.properties b/tests/org.eclipse.emf.edapt.cdo.tests/build.properties
new file mode 100644
index 0000000..e9863e2
--- /dev/null
+++ b/tests/org.eclipse.emf.edapt.cdo.tests/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml
diff --git a/tests/org.eclipse.emf.edapt.cdo.tests/data/component/component.ecore b/tests/org.eclipse.emf.edapt.cdo.tests/data/component/component.ecore
new file mode 100644
index 0000000..11adffa
--- /dev/null
+++ b/tests/org.eclipse.emf.edapt.cdo.tests/data/component/component.ecore
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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="component"
+ nsURI="http://component/r1" nsPrefix="component">
+ <eClassifiers xsi:type="ecore:EClass" name="Signature">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="port" upperBound="-1" eType="#//Port"
+ containment="true"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Port" abstract="true">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="InPort" eSuperTypes="#//Port"/>
+ <eClassifiers xsi:type="ecore:EClass" name="OutPort" eSuperTypes="#//Port"/>
+</ecore:EPackage>
diff --git a/tests/org.eclipse.emf.edapt.cdo.tests/data/component/component.history b/tests/org.eclipse.emf.edapt.cdo.tests/data/component/component.history
new file mode 100644
index 0000000..28cf4b0
--- /dev/null
+++ b/tests/org.eclipse.emf.edapt.cdo.tests/data/component/component.history
@@ -0,0 +1,182 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<history:History 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" xmlns:history="http://www.eclipse.org/emf/edapt/history/0.3">
+ <releases date="2008-11-23T22:45:42.562+0100">
+ <changes xsi:type="history:CompositeChange">
+ <changes xsi:type="history:Create" element="component.ecore#/">
+ <changes xsi:type="history:Set" element="component.ecore#/" featureName="name"
+ dataValue="component"/>
+ <changes xsi:type="history:Set" element="component.ecore#/" featureName="nsURI"
+ dataValue="http://component/r0"/>
+ <changes xsi:type="history:Set" element="component.ecore#/" featureName="nsPrefix"
+ dataValue="component"/>
+ </changes>
+ <changes xsi:type="history:Create" target="component.ecore#/" referenceName="eClassifiers"
+ element="component.ecore#//Signature">
+ <changes xsi:type="history:Set" element="component.ecore#//Signature" featureName="name"
+ dataValue="Signature"/>
+ </changes>
+ <changes xsi:type="history:Create" target="component.ecore#/" referenceName="eClassifiers"
+ element="component.ecore#//Port">
+ <changes xsi:type="history:Set" element="component.ecore#//Port" featureName="name"
+ dataValue="Port"/>
+ </changes>
+ <changes xsi:type="history:Create" target="component.ecore#//Signature" referenceName="eStructuralFeatures"
+ element="#//@releases.1/@changes.2/@changes.0/@element">
+ <changes xsi:type="history:Set" element="#//@releases.1/@changes.2/@changes.0/@element"
+ featureName="name" dataValue="inPort"/>
+ <changes xsi:type="history:Set" element="#//@releases.1/@changes.2/@changes.0/@element"
+ featureName="lowerBound" dataValue="0" oldDataValue="0"/>
+ <changes xsi:type="history:Set" element="#//@releases.1/@changes.2/@changes.0/@element"
+ featureName="upperBound" dataValue="-1" oldDataValue="1"/>
+ <changes xsi:type="history:Set" element="#//@releases.1/@changes.2/@changes.0/@element"
+ featureName="containment" dataValue="true" oldDataValue="false"/>
+ <changes xsi:type="history:Set" element="#//@releases.1/@changes.2/@changes.0/@element"
+ featureName="eType" referenceValue="component.ecore#//Port"/>
+ </changes>
+ <changes xsi:type="history:Create" target="component.ecore#//Signature" referenceName="eStructuralFeatures"
+ element="#//@releases.1/@changes.3/@changes.0/@element">
+ <changes xsi:type="history:Set" element="#//@releases.1/@changes.3/@changes.0/@element"
+ featureName="name" dataValue="outPort"/>
+ <changes xsi:type="history:Set" element="#//@releases.1/@changes.3/@changes.0/@element"
+ featureName="lowerBound" dataValue="0" oldDataValue="0"/>
+ <changes xsi:type="history:Set" element="#//@releases.1/@changes.3/@changes.0/@element"
+ featureName="upperBound" dataValue="-1" oldDataValue="1"/>
+ <changes xsi:type="history:Set" element="#//@releases.1/@changes.3/@changes.0/@element"
+ featureName="containment" dataValue="true" oldDataValue="false"/>
+ <changes xsi:type="history:Set" element="#//@releases.1/@changes.3/@changes.0/@element"
+ featureName="eType" referenceValue="component.ecore#//Port"/>
+ </changes>
+ <changes xsi:type="history:Create" target="component.ecore#//Port" referenceName="eStructuralFeatures"
+ element="component.ecore#//Port/name">
+ <changes xsi:type="history:Set" element="component.ecore#//Port/name" featureName="name"
+ dataValue="name"/>
+ <changes xsi:type="history:Set" element="component.ecore#//Port/name" featureName="lowerBound"
+ dataValue="1" oldDataValue="0"/>
+ <changes xsi:type="history:Set" element="component.ecore#//Port/name" featureName="upperBound"
+ dataValue="1" oldDataValue="1"/>
+ <changes xsi:type="history:Set" element="component.ecore#//Port/name" featureName="eType"
+ referenceValue="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </changes>
+ </changes>
+ </releases>
+ <releases date="2008-11-23T22:49:28.078+0100">
+ <changes xsi:type="history:MigrationChange" migration="org.eclipse.emf.edapt.tests.migration.custom.ComponentSignatureCustomMigration"
+ >
+ <changes xsi:type="history:OperationChange">
+ <changes xsi:type="history:Create" target="component.ecore#/" referenceName="eClassifiers"
+ element="component.ecore#//InPort">
+ <changes xsi:type="history:Set" element="component.ecore#//InPort" featureName="name"
+ dataValue="InPort"/>
+ <changes xsi:type="history:Add" element="component.ecore#//InPort" featureName="eSuperTypes"
+ referenceValue="component.ecore#//Port"/>
+ </changes>
+ <operation name="newClass">
+ <parameters name="ePackage">
+ <referenceValue element="component.ecore#/"/>
+ </parameters>
+ <parameters name="name">
+ <dataValue>InPort</dataValue>
+ </parameters>
+ <parameters name="superClasses">
+ <referenceValue element="component.ecore#//Port"/>
+ </parameters>
+ </operation>
+ </changes>
+ <changes xsi:type="history:OperationChange">
+ <changes xsi:type="history:Create" target="component.ecore#/" referenceName="eClassifiers"
+ element="component.ecore#//OutPort">
+ <changes xsi:type="history:Set" element="component.ecore#//OutPort" featureName="name"
+ dataValue="OutPort"/>
+ <changes xsi:type="history:Add" element="component.ecore#//OutPort" featureName="eSuperTypes"
+ referenceValue="component.ecore#//Port"/>
+ </changes>
+ <operation name="newClass">
+ <parameters name="ePackage">
+ <referenceValue element="component.ecore#/"/>
+ </parameters>
+ <parameters name="name">
+ <dataValue>OutPort</dataValue>
+ </parameters>
+ <parameters name="superClasses">
+ <referenceValue element="component.ecore#//Port"/>
+ </parameters>
+ </operation>
+ </changes>
+ <changes xsi:type="history:Set" element="component.ecore#//Port" featureName="abstract"
+ dataValue="true" oldDataValue="false"/>
+ <changes xsi:type="history:Set" element="#//@releases.1/@changes.2/@changes.0/@element"
+ featureName="eType" referenceValue="component.ecore#//InPort" oldReferenceValue="component.ecore#//Port"/>
+ <changes xsi:type="history:Set" element="#//@releases.1/@changes.3/@changes.0/@element"
+ featureName="eType" referenceValue="component.ecore#//OutPort" oldReferenceValue="component.ecore#//Port"/>
+ </changes>
+ <changes xsi:type="history:OperationChange">
+ <changes xsi:type="history:Create" target="component.ecore#//Signature" referenceName="eStructuralFeatures"
+ element="component.ecore#//Signature/port">
+ <changes xsi:type="history:Set" element="component.ecore#//Signature/port"
+ featureName="name" dataValue="port"/>
+ <changes xsi:type="history:Set" element="component.ecore#//Signature/port"
+ featureName="lowerBound" dataValue="0" oldDataValue="0"/>
+ <changes xsi:type="history:Set" element="component.ecore#//Signature/port"
+ featureName="upperBound" dataValue="-1" oldDataValue="1"/>
+ <changes xsi:type="history:Set" element="component.ecore#//Signature/port"
+ featureName="containment" dataValue="true" oldDataValue="false"/>
+ <changes xsi:type="history:Set" element="component.ecore#//Signature/port"
+ featureName="eType" referenceValue="component.ecore#//Port"/>
+ </changes>
+ <operation name="newReference">
+ <parameters name="eClass">
+ <referenceValue element="component.ecore#//Signature"/>
+ </parameters>
+ <parameters name="name">
+ <dataValue>port</dataValue>
+ </parameters>
+ <parameters name="type">
+ <referenceValue element="component.ecore#//Port"/>
+ </parameters>
+ <parameters name="lowerBound">
+ <dataValue>0</dataValue>
+ </parameters>
+ <parameters name="upperBound">
+ <dataValue>-1</dataValue>
+ </parameters>
+ <parameters name="containment">
+ <dataValue>true</dataValue>
+ </parameters>
+ <parameters name="opposite"/>
+ </operation>
+ </changes>
+ <changes xsi:type="history:OperationChange">
+ <changes xsi:type="history:Delete" target="component.ecore#//Signature" referenceName="eStructuralFeatures">
+ <element xsi:type="ecore:EReference" name="inPort" upperBound="-1" eType="ecore:EClass component.ecore#//InPort"
+ containment="true"/>
+ </changes>
+ <operation name="merge">
+ <parameters name="toMerge">
+ <referenceValue element="#//@releases.1/@changes.2/@changes.0/@element"/>
+ </parameters>
+ <parameters name="mergeTo">
+ <referenceValue element="component.ecore#//Signature/port"/>
+ </parameters>
+ </operation>
+ </changes>
+ <changes xsi:type="history:OperationChange">
+ <changes xsi:type="history:Delete" target="component.ecore#//Signature" referenceName="eStructuralFeatures">
+ <element xsi:type="ecore:EReference" name="outPort" upperBound="-1" eType="ecore:EClass component.ecore#//OutPort"
+ containment="true"/>
+ </changes>
+ <operation name="merge">
+ <parameters name="toMerge">
+ <referenceValue element="#//@releases.1/@changes.3/@changes.0/@element"/>
+ </parameters>
+ <parameters name="mergeTo">
+ <referenceValue element="component.ecore#//Signature/port"/>
+ </parameters>
+ </operation>
+ </changes>
+ <changes xsi:type="history:Set" element="component.ecore#/" featureName="nsURI"
+ dataValue="http://component/r1" oldDataValue="http://component/r0"/>
+ </releases>
+ <releases/>
+</history:History>
diff --git a/tests/org.eclipse.emf.edapt.cdo.tests/data/component/component.test b/tests/org.eclipse.emf.edapt.cdo.tests/data/component/component.test
new file mode 100644
index 0000000..c68902f
--- /dev/null
+++ b/tests/org.eclipse.emf.edapt.cdo.tests/data/component/component.test
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<test:TestSuiteDefinition xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:test="http://www.eclipse.org/emf/edapt/migration/test/0.3" name="Component Metamodel" history="component.history">
+ <cases name="Component Model" model="component_r0.xmi" expectedModel="component_r1.xmi"/>
+</test:TestSuiteDefinition>
diff --git a/tests/org.eclipse.emf.edapt.cdo.tests/data/component/component_r0.xmi b/tests/org.eclipse.emf.edapt.cdo.tests/data/component/component_r0.xmi
new file mode 100644
index 0000000..66aae95
--- /dev/null
+++ b/tests/org.eclipse.emf.edapt.cdo.tests/data/component/component_r0.xmi
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="ASCII"?>
+<component:Signature xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:component="http://component/r0" xsi:schemaLocation="http://component/r0 component.ecore">
+ <inPort name="in1"/>
+ <inPort name="in2"/>
+ <inPort name="in3"/>
+ <inPort name="in4"/>
+ <inPort name="in5"/>
+ <inPort name="in6"/>
+ <inPort name="in7"/>
+ <outPort name="out1"/>
+ <outPort name="out2"/>
+</component:Signature>
diff --git a/tests/org.eclipse.emf.edapt.cdo.tests/data/component/component_r1.xmi b/tests/org.eclipse.emf.edapt.cdo.tests/data/component/component_r1.xmi
new file mode 100644
index 0000000..22537c4
--- /dev/null
+++ b/tests/org.eclipse.emf.edapt.cdo.tests/data/component/component_r1.xmi
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="ASCII"?>
+<component:Signature xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:component="http://component/r1">
+ <port xsi:type="component:InPort" name="in1"/>
+ <port xsi:type="component:InPort" name="in2"/>
+ <port xsi:type="component:InPort" name="in3"/>
+ <port xsi:type="component:InPort" name="in4"/>
+ <port xsi:type="component:InPort" name="in5"/>
+ <port xsi:type="component:InPort" name="in6"/>
+ <port xsi:type="component:InPort" name="in7"/>
+ <port xsi:type="component:OutPort" name="out1"/>
+ <port xsi:type="component:OutPort" name="out2"/>
+</component:Signature>
diff --git a/tests/org.eclipse.emf.edapt.cdo.tests/plugin.xml b/tests/org.eclipse.emf.edapt.cdo.tests/plugin.xml
new file mode 100644
index 0000000..5535690
--- /dev/null
+++ b/tests/org.eclipse.emf.edapt.cdo.tests/plugin.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+
+</plugin>
diff --git a/tests/org.eclipse.emf.edapt.cdo.tests/src/org/eclipse/emf/edapt/cdo/tests/CDOMigrationTestBase.java b/tests/org.eclipse.emf.edapt.cdo.tests/src/org/eclipse/emf/edapt/cdo/tests/CDOMigrationTestBase.java
new file mode 100644
index 0000000..7b7bdff
--- /dev/null
+++ b/tests/org.eclipse.emf.edapt.cdo.tests/src/org/eclipse/emf/edapt/cdo/tests/CDOMigrationTestBase.java
@@ -0,0 +1,356 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 BMW Car IT, Technische Universitaet Muenchen, 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:
+ * BMW Car IT - Initial API and implementation
+ * Technische Universitaet Muenchen - Major refactoring and extension
+ *******************************************************************************/
+package org.eclipse.emf.edapt.cdo.tests;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+
+import junit.framework.TestCase;
+
+import org.eclipse.emf.cdo.eresource.CDOResource;
+import org.eclipse.emf.cdo.net4j.CDONet4jSession;
+import org.eclipse.emf.cdo.transaction.CDOTransaction;
+import org.eclipse.emf.cdo.util.CommitException;
+import org.eclipse.emf.cdo.util.ConcurrentAccessException;
+import org.eclipse.emf.cdo.view.CDOViewProvider;
+import org.eclipse.emf.cdo.view.CDOViewProviderRegistry;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.emf.ecore.util.BasicExtendedMetaData;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.ecore.util.ExtendedMetaData;
+import org.eclipse.emf.ecore.xmi.XMLResource;
+import org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl;
+import org.eclipse.emf.edapt.common.ResourceUtils;
+import org.eclipse.emf.edapt.history.Release;
+import org.eclipse.emf.edapt.history.reconstruction.ModelAssert;
+import org.eclipse.emf.edapt.history.util.HistoryUtils;
+import org.eclipse.emf.edapt.migration.BackupUtils;
+import org.eclipse.emf.edapt.migration.Metamodel;
+import org.eclipse.emf.edapt.migration.MigrationException;
+import org.eclipse.emf.edapt.migration.Persistency;
+import org.eclipse.emf.edapt.migration.PrintStreamProgressMonitor;
+import org.eclipse.emf.edapt.migration.ReleaseUtils;
+import org.eclipse.emf.edapt.migration.execution.IClassLoader;
+import org.eclipse.emf.edapt.migration.execution.Migrator;
+import org.eclipse.emf.edapt.migration.execution.MigratorRegistry;
+import org.eclipse.emf.internal.cdo.view.CDOViewProviderRegistryImpl;
+import org.eclipse.net4j.util.lifecycle.Lifecycle;
+
+/**
+ * A class for test cases to validate a model migration.
+ *
+ * @author herrmama
+ * @author $Author$
+ * @version $Rev$
+ * @levd.rating YELLOW Hash: 028BD5369E87644723FF537FB5E55E4D
+ */
+public abstract class CDOMigrationTestBase extends TestCase {
+
+ private CDONet4jSession testSession;
+
+ /**
+ * Test a model migration.
+ *
+ * @param migratorURI
+ * URI of the migrator
+ * @param modelURI
+ * URI of the model to be migrated
+ * @param expectedTargetModelURI
+ * URI of the expected result of the migration
+ * @param expectedTargetMetamodelURI
+ * URI of the target metamodel of the migration
+ */
+ public void testMigration(URI migratorURI, URI modelURI,
+ URI expectedTargetModelURI, URI expectedTargetMetamodelURI,
+ IClassLoader loader) throws MigrationException, IOException {
+
+ Migrator migrator = new Migrator(migratorURI, loader);
+ testMigration(migrator, modelURI, expectedTargetModelURI,
+ expectedTargetMetamodelURI);
+ }
+
+ /**
+ * Test a model migration.
+ *
+ * @param migrator
+ * Migrator
+ * @param modelURI
+ * URI of the model to be migrated
+ * @param expectedTargetModelURI
+ * URI of the expected result of the migration
+ * @param expectedTargetMetamodelURI
+ * URI of the target metamodel of the migration
+ */
+ public void testMigration(Migrator migrator, URI modelURI,
+ URI expectedTargetModelURI, URI expectedTargetMetamodelURI)
+ throws MigrationException, IOException {
+ testMigration(migrator, modelURI, expectedTargetModelURI,
+ expectedTargetMetamodelURI, 0);
+ }
+
+ /**
+ * Test a model migration.
+ *
+ * @param migrator
+ * Migrator
+ * @param modelURI
+ * URI of the model to be migrated
+ * @param expectedTargetModelURI
+ * URI of the expected result of the migration
+ * @param expectedTargetMetamodelURI
+ * URI of the target metamodel of the migration
+ * @param expectedNumber
+ * Expected number of differences
+ */
+ public void testMigration(Migrator migrator, URI modelURI,
+ URI expectedTargetModelURI, URI expectedTargetMetamodelURI,
+ int expectedNumber) throws MigrationException, IOException {
+
+ prepareSession();
+
+// EPackage ePack = loadEPackageFromEcore(expectedTargetMetamodelURI);
+
+// if (ePack != null) {
+
+ CDOTransaction t = testSession.openTransaction();
+
+ Set<Release> releases = migrator.getRelease(modelURI);
+
+ assertTrue(releases.size() >= 1);
+
+ Release release = HistoryUtils.getMinimumRelease(releases);
+
+ // Get a metamodel to construct to load the resource with the
+ // matching EPackage.
+
+ Metamodel metamodel = migrator.getMetamodel(release);
+
+ List<URI> modelURIs = Collections.singletonList(modelURI);
+
+ ResourceSet model = ResourceUtils.loadResourceSet(modelURIs,
+ metamodel.getEPackages());
+
+ // Register the packages with this CDO Session.
+ for(EPackage ePack : metamodel.getEPackages()){
+ EPackage ePackage = testSession.getPackageRegistry().getEPackage(
+ ePack.getNsURI());
+ if (ePackage == null) {
+ testSession.getPackageRegistry().putEPackage(ePack);
+ }
+ }
+
+ // Do we have a resource with this name.
+ CDOResource cdoResource = null;
+
+ for (Resource resource : model.getResources()) {
+
+ if (resource.getURI() == null
+ || resource.getURI().isPlatformPlugin()) {
+ continue;
+ }
+ String fileName = modelURI.lastSegment();
+ String resourceName = fileName.substring(0,
+ fileName.lastIndexOf("."));
+
+
+
+ if (t.hasResource(resourceName)) {
+ cdoResource = t.getResource(resourceName);
+ } else {
+
+ EObject loadElement = resource.getContents().get(0);
+
+ // The resource without the extension.
+ cdoResource = t.createResource(resourceName);
+
+ // Copy will not work, as the EPackage resolved from the
+ // referenced,
+ // .ecore in the serialization, which is already upgraded.
+
+ EObject copy = EcoreUtil.copy(loadElement);
+ cdoResource.getContents().add(copy);
+ }
+ }
+
+ if (commitTransaction(t)) {
+ // Nothing going on in CDO, remove the package and return.
+// clearEPackage(ePack);
+ return;
+ }
+
+ // We need a CDO resource to proceed.
+ if(cdoResource == null){
+ return;
+ }
+ // Change the modelURI to deal with CDO.
+ URI cdoModelURI = cdoResource.getURI();
+ System.out.println(cdoModelURI);
+
+ URI targetModelURI = cdoModelURI;
+
+
+ // Initialize the PluginViewProvider (Which needs a Session factory).
+ CDOViewProviderRegistry vpRegistry = CDOViewProviderRegistry.INSTANCE;
+ vpRegistry.addViewProvider(new EdaptCDOViewProvider("cdo:.*",CDOViewProvider.DEFAULT_PRIORITY));
+
+
+ // Do not rename/backup , as we use the CDO concept to commit the transaction.
+
+ // URI targetModelURI = rename(migrator, modelURI, release);
+
+ migrator.migrateAndSave(Collections.singletonList(targetModelURI),
+ release, null, new PrintStreamProgressMonitor(System.out));
+
+ Metamodel expectedMetamodel = Persistency
+ .loadMetamodel(expectedTargetMetamodelURI);
+
+ EObject actualModel = ResourceUtils
+ .loadResourceSet(targetModelURI,
+ expectedMetamodel.getEPackages()).getResources()
+ .get(0).getContents().get(0);
+ EObject expectedModel = ResourceUtils
+ .loadResourceSet(expectedTargetModelURI,
+ expectedMetamodel.getEPackages()).getResources()
+ .get(0).getContents().get(0);
+
+ ModelAssert.assertDifference(expectedModel, actualModel,
+ expectedNumber);
+
+ // Remove the CDO Resource.
+// t.getResourceSet().getResources().remove(cdoResource);
+
+ commitTransaction(t);
+// clearEPackage(ePack);
+// }
+ closeSession();
+ }
+
+ private void clearEPackage(EPackage ePack) {
+ if (testSession.getPackageRegistry().containsKey(ePack.getNsURI())) {
+ testSession.getPackageRegistry().remove(ePack.getNsURI());
+ }
+ }
+
+ private boolean commitTransaction(CDOTransaction t) {
+ boolean commitFailed = false;
+ try {
+ t.commit();
+ } catch (ConcurrentAccessException e) {
+ e.printStackTrace();
+ commitFailed = true;
+ } catch (CommitException e) {
+ e.printStackTrace();
+ commitFailed = true;
+ }
+ return commitFailed;
+ }
+
+ private void prepareSession() {
+ testSession = CDOTestUtil.self.openSession();
+ }
+
+ private void closeSession() {
+ if (testSession != null && !testSession.isClosed()) {
+ testSession.close();
+ }
+ }
+
+ private EPackage loadEPackageFromEcore(URI expectedTargetMetamodelURI) {
+ // register globally the Ecore Resource Factory to the ".ecore"
+ // extension
+ // weird that we need to do this, but well...
+ Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
+ "ecore", new EcoreResourceFactoryImpl());
+
+ ResourceSet rs = new ResourceSetImpl();
+ // enable extended metadata
+ final ExtendedMetaData extendedMetaData = new BasicExtendedMetaData(
+ rs.getPackageRegistry());
+ rs.getLoadOptions().put(XMLResource.OPTION_EXTENDED_META_DATA,
+ extendedMetaData);
+
+ Resource r = rs.getResource(expectedTargetMetamodelURI, true);
+ EObject eObject = r.getContents().get(0);
+ if (eObject instanceof EPackage) {
+ EPackage p = (EPackage) eObject;
+ rs.getPackageRegistry().put(p.getNsURI(), p);
+ return p;
+ }
+ return null;
+ }
+
+ /**
+ * Rename a model.
+ *
+ * @param migrator
+ * Migrator (required to be able to open the model)
+ * @param modelURI
+ * URI of the model to be renamed
+ * @return URI of the renamed model
+ */
+ @SuppressWarnings("unused")
+ private URI rename(Migrator migrator, URI modelURI, Release release)
+ throws IOException {
+
+ Metamodel metamodel = migrator.getMetamodel(release);
+ List<URI> modelURIs = Collections.singletonList(modelURI);
+ List<URI> backupURIs = rename(modelURIs, metamodel);
+ return backupURIs.get(0);
+ }
+
+ /**
+ * Rename a model.
+ */
+ protected List<URI> rename(List<URI> modelURIs, Metamodel metamodel)
+ throws IOException {
+ List<URI> backupURIs = BackupUtils.copy(modelURIs, metamodel,
+ new BackupUtils.URIMapper() {
+
+ public URI map(URI uri) {
+ String name = uri.lastSegment().replace(".",
+ "_migrated.");
+ return uri.trimSegments(1).appendSegment(name);
+ }
+
+ });
+ return backupURIs;
+ }
+
+ /**
+ * Test a model migration.
+ *
+ * @param modelURI
+ * URI of the model to be migrated
+ * @param expectedTargetModelURI
+ * URI of the expected result of the migration
+ * @param expectedTargetMetamodelURI
+ * URI of the target metamodel of the migration
+ */
+ public void testMigration(URI modelURI, URI expectedTargetModelURI,
+ URI expectedTargetMetamodelURI, int expectedDifferences)
+ throws MigrationException, IOException {
+
+ String nsURI = ReleaseUtils.getNamespaceURI(modelURI);
+
+ Migrator migrator = MigratorRegistry.getInstance().getMigrator(nsURI);
+ assertNotNull(migrator);
+ testMigration(migrator, modelURI, expectedTargetModelURI,
+ expectedTargetMetamodelURI, expectedDifferences);
+ }
+}
diff --git a/tests/org.eclipse.emf.edapt.cdo.tests/src/org/eclipse/emf/edapt/cdo/tests/CDOMigrationTestCase.java b/tests/org.eclipse.emf.edapt.cdo.tests/src/org/eclipse/emf/edapt/cdo/tests/CDOMigrationTestCase.java
new file mode 100644
index 0000000..2672656
--- /dev/null
+++ b/tests/org.eclipse.emf.edapt.cdo.tests/src/org/eclipse/emf/edapt/cdo/tests/CDOMigrationTestCase.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 BMW Car IT, Technische Universitaet Muenchen, 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:
+ * BMW Car IT - Initial API and implementation
+ * Technische Universitaet Muenchen - Major refactoring and extension
+ *******************************************************************************/
+package org.eclipse.emf.edapt.cdo.tests;
+
+import java.io.IOException;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.edapt.common.URIUtils;
+import org.eclipse.emf.edapt.migration.MigrationException;
+import org.eclipse.emf.edapt.migration.test.TestCaseDefinition;
+
+/**
+ * Case to test a migration.
+ *
+ */
+public class CDOMigrationTestCase extends CDOMigrationTestBase {
+
+ /** Parent test suite. */
+ private final CDOMigrationTestSuite suite;
+
+ /** Definition of the test case. */
+ private final TestCaseDefinition caseDefinition;
+
+ /** Constructor. */
+ public CDOMigrationTestCase(CDOMigrationTestSuite suite,
+ TestCaseDefinition caseDefinition) {
+ setName("testMigration");
+
+ this.caseDefinition = caseDefinition;
+ this.suite = suite;
+ }
+
+ /** Resolve the {@link URI} relative to the location of the definition. */
+ private URI getURI(String uri) {
+ URI definitionURI = caseDefinition.eResource().getURI();
+ return URI.createFileURI(uri).resolve(definitionURI);
+ }
+
+ /** Test the migration. */
+ public void testMigration() throws MigrationException, IOException {
+ URI modelURI = getURI(caseDefinition.getModel());
+ URI expectedURI = getURI(caseDefinition.getExpectedModel());
+ URI historyURI = getURI(caseDefinition.getSuite().getHistory());
+ URI metamodelURI = URIUtils.replaceExtension(historyURI, "ecore");
+
+ testMigration(suite.getMigrator(), modelURI, expectedURI, metamodelURI,
+ caseDefinition.getExpectedDifferences());
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public String getName() {
+ return caseDefinition.getName();
+ }
+
+
+
+
+}
diff --git a/tests/org.eclipse.emf.edapt.cdo.tests/src/org/eclipse/emf/edapt/cdo/tests/CDOMigrationTestSuite.java b/tests/org.eclipse.emf.edapt.cdo.tests/src/org/eclipse/emf/edapt/cdo/tests/CDOMigrationTestSuite.java
new file mode 100644
index 0000000..d7afba2
--- /dev/null
+++ b/tests/org.eclipse.emf.edapt.cdo.tests/src/org/eclipse/emf/edapt/cdo/tests/CDOMigrationTestSuite.java
@@ -0,0 +1,112 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 BMW Car IT, Technische Universitaet Muenchen, 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:
+ * BMW Car IT - Initial API and implementation
+ * Technische Universitaet Muenchen - Major refactoring and extension
+ *******************************************************************************/
+package org.eclipse.emf.edapt.cdo.tests;
+
+import java.io.IOException;
+
+import junit.framework.TestResult;
+import junit.framework.TestSuite;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.edapt.common.ResourceUtils;
+import org.eclipse.emf.edapt.history.History;
+import org.eclipse.emf.edapt.history.HistoryPackage;
+import org.eclipse.emf.edapt.migration.CustomMigration;
+import org.eclipse.emf.edapt.migration.execution.IClassLoader;
+import org.eclipse.emf.edapt.migration.execution.Migrator;
+import org.eclipse.emf.edapt.migration.test.TestCaseDefinition;
+import org.eclipse.emf.edapt.migration.test.TestPackage;
+import org.eclipse.emf.edapt.migration.test.TestSuiteDefinition;
+
+/**
+ * Suite to test a migration.
+ *
+ * @author herrmama
+ * @author $Author$
+ * @version $Rev$
+ * @levd.rating YELLOW Hash: 2C4DF77775780E1EA52BAB95C2F42E0A
+ */
+public class CDOMigrationTestSuite extends TestSuite {
+
+ /** Definition of the test suite. */
+ private final TestSuiteDefinition suiteDefinition;
+
+ /** Migrator. */
+ private Migrator migrator;
+
+ /** Classloader for loading {@link CustomMigration}s. */
+ private IClassLoader loader;
+
+ /** Constructor. */
+ public CDOMigrationTestSuite(URI definitionURI, IClassLoader loader)
+ throws IOException {
+ this(loadTestSuiteDefinition(definitionURI));
+ this.loader = loader;
+ }
+
+ /** Helper method to load a test suite definition. */
+ private static TestSuiteDefinition loadTestSuiteDefinition(URI definitionURI)
+ throws IOException {
+ // ensure that test metamodel is initialized.
+ TestPackage.eINSTANCE.getTestCaseDefinition();
+ return (TestSuiteDefinition) ResourceUtils.loadElement(definitionURI);
+ }
+
+ /** Constructor. */
+ public CDOMigrationTestSuite(TestSuiteDefinition suiteDefinition) {
+ super(suiteDefinition.getName());
+
+ this.suiteDefinition = suiteDefinition;
+
+ for (TestCaseDefinition caseDefinition : suiteDefinition.getCases()) {
+ addTest(new CDOMigrationTestCase(this, caseDefinition));
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void run(TestResult result) {
+ try {
+ migrator = loadMigrator();
+ super.run(result);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /** Resolve the {@link URI} relative to the location of the definition. */
+ private URI getURI(String uri) {
+ URI definitionURI = suiteDefinition.eResource().getURI();
+ return URI.createFileURI(uri).resolve(definitionURI);
+ }
+
+ /** Load the history. */
+ private History loadHistory() throws IOException {
+ // ensure that history metamodel is initialized.
+ HistoryPackage.eINSTANCE.getHistory();
+ URI historyURI = getURI(suiteDefinition.getHistory());
+ History history = ResourceUtils.loadElement(historyURI);
+ return history;
+ }
+
+ /** Get the migrator. */
+ Migrator getMigrator() {
+ return migrator;
+ }
+
+ /** Load the migrator from the history model. */
+ private Migrator loadMigrator() throws IOException {
+ History history = loadHistory();
+ Migrator migrator = new Migrator(history, loader);
+ return migrator;
+ }
+}
diff --git a/tests/org.eclipse.emf.edapt.cdo.tests/src/org/eclipse/emf/edapt/cdo/tests/CDOSingleMigrationTest.java b/tests/org.eclipse.emf.edapt.cdo.tests/src/org/eclipse/emf/edapt/cdo/tests/CDOSingleMigrationTest.java
new file mode 100644
index 0000000..88d971f
--- /dev/null
+++ b/tests/org.eclipse.emf.edapt.cdo.tests/src/org/eclipse/emf/edapt/cdo/tests/CDOSingleMigrationTest.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 BMW Car IT, Technische Universitaet Muenchen, 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:
+ * BMW Car IT - Initial API and implementation
+ * Technische Universitaet Muenchen - Major refactoring and extension
+ *******************************************************************************/
+package org.eclipse.emf.edapt.cdo.tests;
+
+import java.io.File;
+import java.io.IOException;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.edapt.common.FileUtils;
+import org.eclipse.emf.edapt.common.URIUtils;
+import org.eclipse.emf.edapt.migration.execution.ClassLoaderFacade;
+
+/**
+ * Test of model migrations defined by test models.
+ *
+ * @author Christophe Bouhier
+ * @version 0.4.0
+ */
+public class CDOSingleMigrationTest extends TestSuite {
+
+ // Add test models from the Edapt test plugin.
+
+ /** Assembling the test suite. */
+ public static Test suite() {
+ TestSuite suite = new TestSuite("Migration Test");
+ addMigrationTestSuites(suite, new File("data/component"));
+
+ return suite;
+ }
+
+ /** Search for test models and add them to the test suite. */
+ private static void addMigrationTestSuites(TestSuite suite, File dir) {
+ for (File file : dir.listFiles()) {
+ if (file.isDirectory()) {
+ addMigrationTestSuites(suite, file);
+ } else {
+ String extension = FileUtils.getExtension(file);
+ if (extension != null && "test".equals(extension)) {
+ URI uri = URIUtils.getURI(file);
+ try {
+ suite.addTest(new CDOMigrationTestSuite(uri,
+ new ClassLoaderFacade(CDOSingleMigrationTest.class
+ .getClassLoader())));
+
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/tests/org.eclipse.emf.edapt.cdo.tests/src/org/eclipse/emf/edapt/cdo/tests/CDOTest.java b/tests/org.eclipse.emf.edapt.cdo.tests/src/org/eclipse/emf/edapt/cdo/tests/CDOTest.java
new file mode 100644
index 0000000..0cc1899
--- /dev/null
+++ b/tests/org.eclipse.emf.edapt.cdo.tests/src/org/eclipse/emf/edapt/cdo/tests/CDOTest.java
@@ -0,0 +1,67 @@
+package org.eclipse.emf.edapt.cdo.tests;
+
+import junit.framework.TestCase;
+
+import org.eclipse.emf.cdo.common.model.CDOPackageRegistry;
+import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
+import org.eclipse.emf.cdo.eresource.CDOResource;
+import org.eclipse.emf.cdo.net4j.CDONet4jSession;
+import org.eclipse.emf.cdo.transaction.CDOTransaction;
+import org.eclipse.emf.cdo.util.CommitException;
+import org.eclipse.emf.cdo.util.ConcurrentAccessException;
+
+
+/**
+ *
+ * @author Christophe Bouhier
+ */
+public class CDOTest extends TestCase {
+
+
+
+
+
+
+
+ public void testCDO() {
+ CDONet4jSession openSession = CDOTestUtil.self.openSession();
+ CDOPackageRegistry packageRegistry = openSession.getPackageRegistry();
+ for (CDOPackageUnit unit : packageRegistry.getPackageUnits()) {
+ System.out.println(unit);
+ }
+ CDOTransaction t = openSession.openTransaction();
+ CDOResource res = createResource(t);
+
+ removeResource(t, res);
+ }
+
+ private void removeResource(CDOTransaction t, CDOResource res) {
+
+ // Now we need a test model.
+ t.getResourceSet().getResources().remove(res);
+
+ try {
+ t.commit();
+ } catch (ConcurrentAccessException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (CommitException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ private CDOResource createResource(CDOTransaction t) {
+ CDOResource testRes = t.getOrCreateResource("test");
+ try {
+ t.commit();
+ } catch (ConcurrentAccessException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (CommitException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return testRes;
+ }
+}
diff --git a/tests/org.eclipse.emf.edapt.cdo.tests/src/org/eclipse/emf/edapt/cdo/tests/CDOTestUtil.java b/tests/org.eclipse.emf.edapt.cdo.tests/src/org/eclipse/emf/edapt/cdo/tests/CDOTestUtil.java
new file mode 100644
index 0000000..ee208ee
--- /dev/null
+++ b/tests/org.eclipse.emf.edapt.cdo.tests/src/org/eclipse/emf/edapt/cdo/tests/CDOTestUtil.java
@@ -0,0 +1,73 @@
+package org.eclipse.emf.edapt.cdo.tests;
+
+import org.eclipse.emf.cdo.net4j.CDONet4jSession;
+import org.eclipse.emf.cdo.net4j.CDONet4jSessionConfiguration;
+import org.eclipse.emf.cdo.net4j.CDONet4jUtil;
+import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.session.CDOSession.ExceptionHandler;
+import org.eclipse.net4j.Net4jUtil;
+import org.eclipse.net4j.connector.IConnector;
+import org.eclipse.net4j.jvm.IJVMAcceptor;
+import org.eclipse.net4j.tcp.TCPUtil;
+import org.eclipse.net4j.util.container.ContainerUtil;
+import org.eclipse.net4j.util.container.IManagedContainer;
+import org.eclipse.net4j.util.om.OMPlatform;
+import org.eclipse.net4j.util.om.log.PrintLogHandler;
+import org.eclipse.net4j.util.om.trace.PrintTraceHandler;
+
+public class CDOTestUtil {
+
+ public static CDOTestUtil self = new CDOTestUtil();
+
+ private static final String REPO_NAME = "repo1";
+
+ @SuppressWarnings("unused")
+ private IJVMAcceptor acceptor;
+ private IConnector connector;
+
+ protected static final String CONNECTION_ADDRESS = "localhost:2036";
+
+ private ExceptionHandler exceptionHandler = new ExceptionHandler() {
+
+ public void handleException(CDOSession session, int attempt,
+ Exception exception) throws Exception {
+ System.out.println("CDO Exception: " + exception);
+ }
+ };
+
+ public CDONet4jSession openSession() {
+ CDONet4jSessionConfiguration sessionConfig = getSessionConfig();
+ CDONet4jSession openNet4jSession = sessionConfig.openNet4jSession();
+ return openNet4jSession;
+ }
+
+ private CDONet4jSessionConfiguration getSessionConfig() {
+
+ OMPlatform.INSTANCE.setDebugging(true);
+ OMPlatform.INSTANCE.addLogHandler(PrintLogHandler.CONSOLE);
+ OMPlatform.INSTANCE.addTraceHandler(PrintTraceHandler.CONSOLE);
+
+ final IManagedContainer container = ContainerUtil.createContainer();
+ // JVMUtil.prepareContainer(container);
+ Net4jUtil.prepareContainer(container); // Register Net4j factories
+ TCPUtil.prepareContainer(container); // Register TCP factories
+ CDONet4jUtil.prepareContainer(container); // Register CDO factories
+
+ container.activate();
+
+ // Create configuration
+ final CDONet4jSessionConfiguration sessionConfiguration = CDONet4jUtil
+ .createNet4jSessionConfiguration();
+
+ // acceptor = JVMUtil.getAcceptor(container, "default");
+ connector = TCPUtil.getConnector(container, CONNECTION_ADDRESS);
+
+ sessionConfiguration.setConnector(connector);
+ sessionConfiguration.setRepositoryName(REPO_NAME);
+ sessionConfiguration.setExceptionHandler(exceptionHandler);
+
+ return sessionConfiguration;
+
+ }
+
+}
diff --git a/tests/org.eclipse.emf.edapt.cdo.tests/src/org/eclipse/emf/edapt/cdo/tests/EdaptCDOViewProvider.java b/tests/org.eclipse.emf.edapt.cdo.tests/src/org/eclipse/emf/edapt/cdo/tests/EdaptCDOViewProvider.java
new file mode 100644
index 0000000..004018f
--- /dev/null
+++ b/tests/org.eclipse.emf.edapt.cdo.tests/src/org/eclipse/emf/edapt/cdo/tests/EdaptCDOViewProvider.java
@@ -0,0 +1,54 @@
+package org.eclipse.emf.edapt.cdo.tests;
+
+import org.eclipse.emf.cdo.net4j.CDONet4jSessionConfiguration;
+import org.eclipse.emf.cdo.net4j.CDONet4jUtil;
+import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.view.AbstractCDOViewProvider;
+import org.eclipse.emf.cdo.view.CDOView;
+import org.eclipse.emf.cdo.view.CDOViewProvider;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.net4j.Net4jUtil;
+import org.eclipse.net4j.connector.IConnector;
+import org.eclipse.net4j.tcp.TCPUtil;
+import org.eclipse.net4j.util.container.IManagedContainer;
+import org.eclipse.net4j.util.container.ManagedContainer;
+
+public class EdaptCDOViewProvider extends AbstractCDOViewProvider implements
+ CDOViewProvider {
+
+ private IManagedContainer container;
+
+ public EdaptCDOViewProvider() {
+ }
+
+ public EdaptCDOViewProvider(String regex) {
+ super(regex);
+ }
+
+ public EdaptCDOViewProvider(String regex, int priority) {
+ super(regex, priority);
+ }
+
+ public CDOView getView(URI uri, ResourceSet resourceSet) {
+ if (container == null)
+ {
+ container = new ManagedContainer();
+ Net4jUtil.prepareContainer(container);
+ TCPUtil.prepareContainer(container);
+ container.activate();
+ }
+
+ String repoName = uri.authority();
+
+ IConnector connector = (IConnector)container.getElement("org.eclipse.net4j.connectors", "tcp", "localhost");
+
+ CDONet4jSessionConfiguration config = CDONet4jUtil.createNet4jSessionConfiguration();
+ config.setConnector(connector);
+ config.setRepositoryName(repoName);
+
+ CDOSession session = config.openNet4jSession();
+ return session.openTransaction();
+ }
+
+}
diff --git a/tests/org.eclipse.emf.edapt.tests/src/org/eclipse/emf/edapt/tests/migration/SingleMigrationTest.java b/tests/org.eclipse.emf.edapt.tests/src/org/eclipse/emf/edapt/tests/migration/SingleMigrationTest.java
index b3cc675..7891597 100644
--- a/tests/org.eclipse.emf.edapt.tests/src/org/eclipse/emf/edapt/tests/migration/SingleMigrationTest.java
+++ b/tests/org.eclipse.emf.edapt.tests/src/org/eclipse/emf/edapt/tests/migration/SingleMigrationTest.java
@@ -37,7 +37,7 @@ public class SingleMigrationTest extends TestSuite {
public static Test suite() {
TestSuite suite = new TestSuite("Migration Test");
- addMigrationTestSuites(suite, new File("data/filesystem"));
+ addMigrationTestSuites(suite, new File("data/component"));
return suite;
}

Back to the top