diff options
author | Christophe Bouhier | 2013-12-30 10:26:44 +0000 |
---|---|---|
committer | Christophe Bouhier | 2013-12-30 10:26:44 +0000 |
commit | 0adf9c44ca6e6081fef180b8bbaee8cf1d59121f (patch) | |
tree | ae6e67825b042b00cf52bf935276348f2b9c6a25 | |
parent | e27df8cd40800e5bf8e7bc025a6b7dddae6d6b87 (diff) | |
download | org.eclipse.emf.edapt-0adf9c44ca6e6081fef180b8bbaee8cf1d59121f.tar.gz org.eclipse.emf.edapt-0adf9c44ca6e6081fef180b8bbaee8cf1d59121f.tar.xz org.eclipse.emf.edapt-0adf9c44ca6e6081fef180b8bbaee8cf1d59121f.zip |
test setup for CDO.
- source repo
- target repo
- test case implementation, copies a resource to source repo, migrates
it and writes it target repo.
34 files changed, 1345 insertions, 155 deletions
diff --git a/tests/org.eclipse.emf.edapt.cdo.server.source/.classpath b/tests/org.eclipse.emf.edapt.cdo.server.source/.classpath new file mode 100644 index 0000000..c835067 --- /dev/null +++ b/tests/org.eclipse.emf.edapt.cdo.server.source/.classpath @@ -0,0 +1,6 @@ +<?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="output" path="bin"/> +</classpath> diff --git a/tests/org.eclipse.emf.edapt.cdo.server.source/.project b/tests/org.eclipse.emf.edapt.cdo.server.source/.project new file mode 100644 index 0000000..80386fc --- /dev/null +++ b/tests/org.eclipse.emf.edapt.cdo.server.source/.project @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.emf.edapt.cdo.server.source</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> + </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.server.source/EdaptSourceServer.launch b/tests/org.eclipse.emf.edapt.cdo.server.source/EdaptSourceServer.launch new file mode 100644 index 0000000..39a65b0 --- /dev/null +++ b/tests/org.eclipse.emf.edapt.cdo.server.source/EdaptSourceServer.launch @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<launchConfiguration type="org.eclipse.pde.ui.RuntimeWorkbench"> +<booleanAttribute key="append.args" value="true"/> +<stringAttribute key="application" value="org.eclipse.emf.cdo.server.app"/> +<booleanAttribute key="askclear" value="false"/> +<booleanAttribute key="automaticAdd" value="false"/> +<booleanAttribute key="automaticValidate" value="false"/> +<stringAttribute key="bootstrap" value=""/> +<stringAttribute key="checked" value="org.eclipse.emf.cdo.common,org.eclipse.emf.cdo.security,org.eclipse.emf.cdo.server,org.eclipse.emf.cdo.server.admin,org.eclipse.emf.cdo.server.db,org.eclipse.emf.cdo.server.net4j,org.eclipse.net4j,org.eclipse.net4j.db,org.eclipse.net4j.db.h2,org.eclipse.net4j.tcp,org.eclipse.net4j.util"/> +<booleanAttribute key="clearConfig" value="false"/> +<booleanAttribute key="clearws" value="true"/> +<booleanAttribute key="clearwslog" value="false"/> +<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/EdaptSourceServer"/> +<booleanAttribute key="default" value="false"/> +<booleanAttribute key="includeOptional" value="false"/> +<stringAttribute key="location" value="${workspace_loc}/../runtime-EdaptSourceServer"/> +<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/> +<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> +<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -debug -console"/> +<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/> +<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms40m -Xmx1024m -Ddebug=true -Dnet4j.config="${project_loc:/org.eclipse.emf.edapt.cdo.server.source}/config" -Dorg.eclipse.emf.cdo.server.browser.port=7777 -Dosgi.console.enable.builtin=true"/> +<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:org.eclipse.emf.edapt.cdo.server.source}"/> +<stringAttribute key="pde.version" value="3.3"/> +<stringAttribute key="product" value="org.eclipse.platform.ide"/> +<stringAttribute key="selected_target_plugins" value="com.ibm.icu@default:default,javax.xml@default:default,org.eclipse.ant.core@default:default,org.eclipse.compare.core@default:default,org.eclipse.core.contenttype*3.4.200.v20120523-2004@default:default,org.eclipse.core.contenttype*3.4.200.v20130326-1255@default:default,org.eclipse.core.expressions@default:default,org.eclipse.core.filesystem.macosx@default:false,org.eclipse.core.filesystem@default:default,org.eclipse.core.jobs*3.5.200.v20120521-2346@default:default,org.eclipse.core.jobs*3.5.300.v20130429-1813@default:default,org.eclipse.core.resources@default:default,org.eclipse.core.runtime*3.8.0.v20120521-2346@default:true,org.eclipse.core.runtime*3.9.0.v20130326-1255@default:true,org.eclipse.core.runtime.compatibility.registry*3.5.100.v20120521-2346@default:false,org.eclipse.core.runtime.compatibility.registry*3.5.200.v20130514-1256@default:false,org.eclipse.core.variables@default:default,org.eclipse.emf.cdo.common@default:default,org.eclipse.emf.cdo.ecore.retrofit@default:false,org.eclipse.emf.cdo.server.admin@default:default,org.eclipse.emf.cdo.server.db@default:default,org.eclipse.emf.cdo.server.net4j@default:default,org.eclipse.emf.cdo.server@default:default,org.eclipse.emf.cdo@default:default,org.eclipse.emf.common@default:default,org.eclipse.emf.ecore.change@default:default,org.eclipse.emf.ecore.xmi@default:default,org.eclipse.emf.ecore@default:default,org.eclipse.equinox.app*1.3.100.v20120522-1841@default:default,org.eclipse.equinox.app*1.3.100.v20130327-1442@default:default,org.eclipse.equinox.common*3.6.100.v20120522-1841@2:true,org.eclipse.equinox.common*3.6.200.v20130402-1505@2:true,org.eclipse.equinox.preferences*3.5.1.v20121031-182809@default:default,org.eclipse.equinox.preferences*3.5.100.v20130422-1538@default:default,org.eclipse.equinox.registry*3.5.200.v20120522-1841@default:default,org.eclipse.equinox.registry*3.5.300.v20130327-1442@default:default,org.eclipse.equinox.transforms.hook@default:false,org.eclipse.equinox.weaving.hook@default:false,org.eclipse.net4j.db.h2@default:default,org.eclipse.net4j.db@default:default,org.eclipse.net4j.tcp@default:default,org.eclipse.net4j.util@default:default,org.eclipse.net4j@default:default,org.eclipse.osgi*3.8.2.v20130124-134944@-1:true,org.eclipse.osgi*3.9.0.v20130529-1710@-1:true,org.eclipse.team.core@default:default,org.h2@default:default"/> +<booleanAttribute key="show_selected_only" value="true"/> +<stringAttribute key="templateConfig" value="${target_home}\configuration\config.ini"/> +<booleanAttribute key="tracing" value="true"/> +<booleanAttribute key="useCustomFeatures" value="false"/> +<booleanAttribute key="useDefaultConfig" value="true"/> +<booleanAttribute key="useDefaultConfigArea" value="true"/> +<booleanAttribute key="useProduct" value="false"/> +</launchConfiguration> diff --git a/tests/org.eclipse.emf.edapt.cdo.server.source/META-INF/MANIFEST.MF b/tests/org.eclipse.emf.edapt.cdo.server.source/META-INF/MANIFEST.MF new file mode 100644 index 0000000..76d22a3 --- /dev/null +++ b/tests/org.eclipse.emf.edapt.cdo.server.source/META-INF/MANIFEST.MF @@ -0,0 +1,17 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: org.eclipse.emf.edapt.cdo.server.source;singleton:=true +Bundle-Version: 4.1.100.qualifier +Bundle-Name: %pluginName +Bundle-Vendor: %providerName +Bundle-ActivationPolicy: lazy +Bundle-Localization: plugin +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)", + org.eclipse.emf.cdo.server;bundle-version="[4.0.0,5.0.0)", + org.eclipse.emf.cdo.server.admin;bundle-version="[4.1.0,5.0.0)", + org.eclipse.emf.cdo.server.db;bundle-version="[4.0.0,5.0.0)", + org.eclipse.emf.cdo.server.net4j;bundle-version="[4.0.0,5.0.0)", + org.eclipse.net4j.tcp;bundle-version="[4.0.0,5.0.0)", + org.eclipse.net4j.db.h2;bundle-version="[4.0.0,5.0.0)" +Import-Package: org.h2.jdbcx;version="[1.0.0,2.0.0)" diff --git a/tests/org.eclipse.emf.edapt.cdo.server.source/README.html b/tests/org.eclipse.emf.edapt.cdo.server.source/README.html new file mode 100644 index 0000000..ef11638 --- /dev/null +++ b/tests/org.eclipse.emf.edapt.cdo.server.source/README.html @@ -0,0 +1,40 @@ +<html> +<head> +<title>CDO Master Server Example</title> +</head> + +<body> + +<h1>CDO Master Server Example</h1> + +This project contains the launch configuration "ExampleMasterServer" that +can be used to start a new OSGi process with a CDO master repository. +You may need to update the launch configuration by clicking the "Add Required +Plugins" button on the Plugins tab. +<p> +Before you actually run this master server you should review the server +configuration file /config/cdo-server.xml in this project. In particular +you may want to adjust the following settings: +<p> +<ul> + <li> + Acceptor port. + Default is 2036. + </li> + <li> + H2 datasource URL. + Default is a /database folder in the current directory, i.e., this project. + </li> + <li> + ID generation location. + Default is STORE, should be changed to CLIENT for all offline scenarios! + </li> +</ul> + +If the server is running you can point your web browser to +<a href="http://localhost:7777">http://localhost:7777</a> in order to +introspect the repository. Please note that this introspection facility +should not be used in production! + +</body> +</html> diff --git a/tests/org.eclipse.emf.edapt.cdo.server.source/about.html b/tests/org.eclipse.emf.edapt.cdo.server.source/about.html new file mode 100644 index 0000000..f2decc3 --- /dev/null +++ b/tests/org.eclipse.emf.edapt.cdo.server.source/about.html @@ -0,0 +1,70 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> +<title>About</title> +</head> +<body lang="EN-US"> +<h2>About This Content</h2> + +<p>June 5, 2007</p> +<h3>License</h3> + +<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise +indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. +For purposes of the EPL, "Program" will mean the Content.</p> + +<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor's license that was +provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p> + +</body> +</html> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> + + <head> + + <meta content="text/html; charset=ISO-8859-1" + http-equiv="Content-Type"/> + + <title>About</title> + + </head> + + <body lang="EN-US"> + + <h2>About This Content</h2> + + <p>May 17, 2007</p> + + <h3>License</h3> + + <p>The Eclipse Foundation makes available all content in this + plug-in ("Content"). Unless otherwise indicated below, + the Content is provided to you under the terms and conditions of + the Eclipse Public License Version 1.0 ("EPL"). A copy of + the EPL is available at + <a href="http://www.eclipse.org/legal/epl-v10.html"> + http://www.eclipse.org/legal/epl-v10.html</a>. For purposes of the + EPL, "Program" will mean the Content.</p> + + <p>If you did not receive this Content directly from the Eclipse + Foundation, the Content is being redistributed by another party + ("Redistributor") and different terms and conditions may + apply to your use of any object code in the Content. Check the + Redistributor's license that was provided with the Content. If + no such license exists, contact the Redistributor. Unless otherwise + indicated below, the terms and conditions of the EPL still apply to + any source code in the Content.</p> + + </body> + +</html> + diff --git a/tests/org.eclipse.emf.edapt.cdo.server.source/build.properties b/tests/org.eclipse.emf.edapt.cdo.server.source/build.properties new file mode 100644 index 0000000..4347f76 --- /dev/null +++ b/tests/org.eclipse.emf.edapt.cdo.server.source/build.properties @@ -0,0 +1,22 @@ +# Copyright (c) 2012 Eike Stepper (Berlin, Germany) 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: +# Eike Stepper - initial API and implementation + +# NLS_MESSAGEFORMAT_VAR + +bin.includes = META-INF/,\ + plugin.properties,\ + about.html,\ + copyright.txt,\ + README.html,\ + config/ +src.includes = about.html,\ + copyright.txt,\ + EdaptSourceServer.launch + +generateSourceReferences = true diff --git a/tests/org.eclipse.emf.edapt.cdo.server.source/config/.options b/tests/org.eclipse.emf.edapt.cdo.server.source/config/.options new file mode 100644 index 0000000..b857fd9 --- /dev/null +++ b/tests/org.eclipse.emf.edapt.cdo.server.source/config/.options @@ -0,0 +1,24 @@ +#Master Tracing Options +org.eclipse.emf.cdo.common/debug.model=true +org.eclipse.emf.cdo.common/debug.protocol=true +org.eclipse.emf.cdo.common/debug.revision=true +org.eclipse.emf.cdo.common/debug=true + +org.eclipse.net4j/debug.acceptor=true +org.eclipse.net4j/debug.buffer.stream=false +org.eclipse.net4j/debug.buffer=true +org.eclipse.net4j/debug.channel=true +org.eclipse.net4j/debug.connector=true +org.eclipse.net4j/debug.selector=true +org.eclipse.net4j/debug.signal=true +org.eclipse.net4j/debug=true +org.eclipse.net4j/perf=false + +org.eclipse.net4j.util/debug.concurrency=true +org.eclipse.net4j.util/debug.lifecycle.dump=true +org.eclipse.net4j.util/debug.lifecycle=true +org.eclipse.net4j.util/debug.om=true +org.eclipse.net4j.util/debug.registry=true +org.eclipse.net4j.util/debug=true + +org.eclipse.net4j.tcp/debug=true diff --git a/tests/org.eclipse.emf.edapt.cdo.server.source/config/cdo-server.xml b/tests/org.eclipse.emf.edapt.cdo.server.source/config/cdo-server.xml new file mode 100644 index 0000000..a968e5f --- /dev/null +++ b/tests/org.eclipse.emf.edapt.cdo.server.source/config/cdo-server.xml @@ -0,0 +1,141 @@ +<?xml version="1.0" encoding="UTF-8"?> +<cdoServer> + + <!-- ============================================================== --> + <!-- See http://wiki.eclipse.org/CDO/Server_Configuration_Reference --> + <!-- ============================================================== --> + + <acceptor type="tcp" listenAddr="0.0.0.0" port="2036"/> + + <!-- Examples: + <acceptor type="ssl" listenAddr="0.0.0.0" port="2036"/> + <acceptor type="http"/> + --> + + <repository name="repo_source"> + + <property name="overrideUUID" value=""/> + <property name="supportingAudits" value="true"/> + <property name="supportingBranches" value="true"/> + <property name="ensureReferentialIntegrity" value="false"/> + <property name="allowInterruptRunningQueries" value="true"/> + <property name="idGenerationLocation" value="CLIENT"/> <!-- Possible values: STORE | CLIENT --> + <property name="serializeCommits" value="false"/> + <property name="optimisticLockingTimeout" value="10000"/> + + <!-- Example http://bugs.eclipse.org/380629 + <securityManager type="default" realmPath="/security"/> + <securityManager type="annotation" realmPath="/security"/> + --> + + <!-- Example http://bugs.eclipse.org/302775 + <authenticator type="file" description="_database/repo1.users"/> + --> + + <!-- Example http://bugs.eclipse.org/345431 + <initialPackage nsURI="http://www.eclipse.org/emf/CDO/examples/company/1.0.0"/> + --> + + <store type="db"> + + <!-- Example http://bugs.eclipse.org/396379 (if idGenerationLocation == CLIENT) + <property name="idColumnLength" value="34"/> + --> + + <!-- Period at which to execute an SQL statement to keep DB connection alive, in minutes --> + <property name="connectionKeepAlivePeriod" value="60"/> + + <!-- Maximum number of store accessors (JDBC connections) to keep in the reader pool. The default value is 15. --> + <property name="readerPoolCapacity" value="20"/> + + <!-- Maximum number of store accessors (JDBC connections) to keep in the writer pool. The default value is 15. --> + <property name="writerPoolCapacity" value="20"/> + + <mappingStrategy type="horizontal"> <!-- callout --> + <property name="qualifiedNames" value="true"/> + + <!-- + Per default, the objectTypeCache is in-memory and contains + 100,000 cache entries. If you want to change the size, + uncomment the following line and set the desired size. + The cache can be disabled by setting a size of 0. + --> + + <!-- Optional: + <property name="objectTypeCacheSize" value="100000"/> + --> + + </mappingStrategy> + + <dbAdapter name="h2"/> + <dataSource class="org.h2.jdbcx.JdbcDataSource" + URL="jdbc:h2:database/repo_source"/> + + <!-- Example: + <dbAdapter name="derby-embedded"/> + <dataSource class="org.apache.derby.jdbc.EmbeddedDataSource" + databaseName="/temp/repo1" + createDatabase="create"/> + --> + + <!-- Example: + <dbAdapter name="hsqldb"/> + <dataSource class="org.eclipse.net4j.db.hsqldb.HSQLDBDataSource" + database="jdbc:hsqldb:file:/temp/repo1" + user="sa"/> + --> + + <!-- Example: + <dbAdapter name="mysql"/> + <dataSource class="com.mysql.jdbc.jdbc2.optional.MysqlDataSource" + url="jdbc:mysql://localhost/repo1" + user="sa"/> + --> + + <!-- Example: + <dbAdapter name="postgresql"/> + <dataSource class="org.postgresql.ds.PGSimpleDataSource" + serverName="localhost" + portNumber="5432" + databaseName="repo1" + user="postgres" + password="postgres"/> + --> + + <!-- Example: + <dbAdapter name="oracle"/> + <dataSource class="oracle.jdbc.pool.OracleDataSource" + driverType="thin" + serverName="serverURL" + portNumber="1521" + databaseName="SID" + user="user" + password="passwd"/> + --> + + </store> + + <!-- ONLY THE FIRST CONFIGURED STORE IS USED FOR THE REPOSITORY!!! --> + + <store type="mongodb"> + <property name="uri" value="mongodb://localhost"/> + <property name="db" value="cdodb"/> + <!-- Optional: + <property name="drop" value="true"/> + --> + </store> + + </repository> + + <!-- Example of a DB4O repo/store: + <repository name="repo1"> + <property name="supportingAudits" value="false"/> + <property name="supportingBranches" value="false"/> + <store type="db4o"> + <property name="path" value="/tmp/cdodb4.db4o"/> + <property name="port" value="50032"/> + </store> + </repository> + --> + +</cdoServer> diff --git a/tests/org.eclipse.emf.edapt.cdo.server.source/copyright.txt b/tests/org.eclipse.emf.edapt.cdo.server.source/copyright.txt new file mode 100644 index 0000000..1c77978 --- /dev/null +++ b/tests/org.eclipse.emf.edapt.cdo.server.source/copyright.txt @@ -0,0 +1,8 @@ +Copyright (c) 2004-2013 Eike Stepper (Berlin, Germany) 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: + Eike Stepper - initial API and implementation diff --git a/tests/org.eclipse.emf.edapt.cdo.server.source/database/repo_source.h2.db b/tests/org.eclipse.emf.edapt.cdo.server.source/database/repo_source.h2.db Binary files differnew file mode 100644 index 0000000..3a5b8ef --- /dev/null +++ b/tests/org.eclipse.emf.edapt.cdo.server.source/database/repo_source.h2.db diff --git a/tests/org.eclipse.emf.edapt.cdo.server.source/database/repo_source.lock.db b/tests/org.eclipse.emf.edapt.cdo.server.source/database/repo_source.lock.db new file mode 100644 index 0000000..4c6b463 --- /dev/null +++ b/tests/org.eclipse.emf.edapt.cdo.server.source/database/repo_source.lock.db @@ -0,0 +1,4 @@ +#FileLock +#Mon Dec 30 10:13:02 CET 2013 +id=14342c71e59fc8022d98a2573fcc048b93cec7445bd +method=file diff --git a/tests/org.eclipse.emf.edapt.cdo.server.source/database/repo_source.trace.db b/tests/org.eclipse.emf.edapt.cdo.server.source/database/repo_source.trace.db new file mode 100644 index 0000000..2e9524e --- /dev/null +++ b/tests/org.eclipse.emf.edapt.cdo.server.source/database/repo_source.trace.db @@ -0,0 +1,3 @@ +12-23 17:08:12 jdbc[2]: exception +org.h2.jdbc.JdbcSQLException: Table "CDO_PROPERTIES" not found; SQL statement: +SELECT VALUE FROM CDO_PROPERTIES WHERE NAME='org.eclipse.emf.cdo.server.db.schemaVersion' [42102-168] diff --git a/tests/org.eclipse.emf.edapt.cdo.server.source/plugin.properties b/tests/org.eclipse.emf.edapt.cdo.server.source/plugin.properties new file mode 100644 index 0000000..1317dab --- /dev/null +++ b/tests/org.eclipse.emf.edapt.cdo.server.source/plugin.properties @@ -0,0 +1,11 @@ +# Copyright (c) 2012 Eike Stepper (Berlin, Germany) 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: +# Eike Stepper - initial API and implementation + +pluginName = CDO Edapt Source server +providerName = Eclipse Modeling Project diff --git a/tests/org.eclipse.emf.edapt.cdo.server.target/.classpath b/tests/org.eclipse.emf.edapt.cdo.server.target/.classpath new file mode 100644 index 0000000..c835067 --- /dev/null +++ b/tests/org.eclipse.emf.edapt.cdo.server.target/.classpath @@ -0,0 +1,6 @@ +<?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="output" path="bin"/> +</classpath> diff --git a/tests/org.eclipse.emf.edapt.cdo.server.target/.project b/tests/org.eclipse.emf.edapt.cdo.server.target/.project new file mode 100644 index 0000000..265871a --- /dev/null +++ b/tests/org.eclipse.emf.edapt.cdo.server.target/.project @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.emf.edapt.cdo.server.target</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> + </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.server.target/EdaptTargetServer.launch b/tests/org.eclipse.emf.edapt.cdo.server.target/EdaptTargetServer.launch new file mode 100644 index 0000000..ea9f62d --- /dev/null +++ b/tests/org.eclipse.emf.edapt.cdo.server.target/EdaptTargetServer.launch @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<launchConfiguration type="org.eclipse.pde.ui.RuntimeWorkbench"> +<booleanAttribute key="append.args" value="true"/> +<stringAttribute key="application" value="org.eclipse.emf.cdo.server.app"/> +<booleanAttribute key="askclear" value="true"/> +<booleanAttribute key="automaticAdd" value="false"/> +<booleanAttribute key="automaticValidate" value="false"/> +<stringAttribute key="bootstrap" value=""/> +<stringAttribute key="checked" value="org.eclipse.emf.cdo.common,org.eclipse.emf.cdo.security,org.eclipse.emf.cdo.server,org.eclipse.emf.cdo.server.admin,org.eclipse.emf.cdo.server.db,org.eclipse.emf.cdo.server.net4j,org.eclipse.net4j,org.eclipse.net4j.db,org.eclipse.net4j.db.h2,org.eclipse.net4j.tcp,org.eclipse.net4j.util"/> +<booleanAttribute key="clearConfig" value="false"/> +<booleanAttribute key="clearws" value="false"/> +<booleanAttribute key="clearwslog" value="false"/> +<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/EdaptTargetServer"/> +<booleanAttribute key="default" value="false"/> +<booleanAttribute key="includeOptional" value="false"/> +<stringAttribute key="location" value="${workspace_loc}/../runtime-EdaptTargetServer"/> +<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/> +<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> +<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -debug -console"/> +<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/> +<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms40m -Xmx1024m -Ddebug=true -Dnet4j.config="${project_loc:/org.eclipse.emf.edapt.cdo.server.target}/config" -Dorg.eclipse.emf.cdo.server.browser.port=7778 -Dosgi.console.enable.builtin=true"/> +<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:org.eclipse.emf.edapt.cdo.server.target}"/> +<stringAttribute key="pde.version" value="3.3"/> +<stringAttribute key="product" value="org.eclipse.platform.ide"/> +<stringAttribute key="selected_target_plugins" value="org.eclipse.ant.core@default:default,org.eclipse.core.contenttype*3.4.200.v20120523-2004@default:default,org.eclipse.core.contenttype*3.4.200.v20130326-1255@default:default,org.eclipse.core.expressions@default:default,org.eclipse.core.filesystem@default:default,org.eclipse.core.jobs*3.5.200.v20120521-2346@default:default,org.eclipse.core.jobs*3.5.300.v20130429-1813@default:default,org.eclipse.core.resources@default:default,org.eclipse.core.runtime*3.8.0.v20120521-2346@default:true,org.eclipse.core.runtime*3.9.0.v20130326-1255@default:true,org.eclipse.core.runtime.compatibility.registry*3.5.100.v20120521-2346@default:false,org.eclipse.core.runtime.compatibility.registry*3.5.200.v20130514-1256@default:false,org.eclipse.core.variables@default:default,org.eclipse.emf.cdo.common@default:default,org.eclipse.emf.cdo.server.admin@default:default,org.eclipse.emf.cdo.server.db@default:default,org.eclipse.emf.cdo.server.net4j@default:default,org.eclipse.emf.cdo.server@default:default,org.eclipse.emf.cdo@default:default,org.eclipse.emf.common@default:default,org.eclipse.emf.ecore.change@default:default,org.eclipse.emf.ecore.xmi@default:default,org.eclipse.emf.ecore@default:default,org.eclipse.equinox.app*1.3.100.v20120522-1841@default:default,org.eclipse.equinox.app*1.3.100.v20130327-1442@default:default,org.eclipse.equinox.common*3.6.100.v20120522-1841@2:true,org.eclipse.equinox.common*3.6.200.v20130402-1505@2:true,org.eclipse.equinox.preferences*3.5.1.v20121031-182809@default:default,org.eclipse.equinox.preferences*3.5.100.v20130422-1538@default:default,org.eclipse.equinox.registry*3.5.200.v20120522-1841@default:default,org.eclipse.equinox.registry*3.5.300.v20130327-1442@default:default,org.eclipse.net4j.db.h2@default:default,org.eclipse.net4j.db@default:default,org.eclipse.net4j.tcp@default:default,org.eclipse.net4j.util@default:default,org.eclipse.net4j@default:default,org.eclipse.osgi*3.8.2.v20130124-134944@-1:true,org.eclipse.osgi*3.9.0.v20130529-1710@-1:true,org.eclipse.team.core@default:default,org.h2@default:default"/> +<booleanAttribute key="show_selected_only" value="true"/> +<stringAttribute key="templateConfig" value="${target_home}\configuration\config.ini"/> +<booleanAttribute key="tracing" value="true"/> +<booleanAttribute key="useCustomFeatures" value="false"/> +<booleanAttribute key="useDefaultConfig" value="true"/> +<booleanAttribute key="useDefaultConfigArea" value="true"/> +<booleanAttribute key="useProduct" value="false"/> +</launchConfiguration> diff --git a/tests/org.eclipse.emf.edapt.cdo.server.target/META-INF/MANIFEST.MF b/tests/org.eclipse.emf.edapt.cdo.server.target/META-INF/MANIFEST.MF new file mode 100644 index 0000000..e3d0948 --- /dev/null +++ b/tests/org.eclipse.emf.edapt.cdo.server.target/META-INF/MANIFEST.MF @@ -0,0 +1,17 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: org.eclipse.emf.edapt.cdo.server.target;singleton:=true +Bundle-Version: 4.1.100.qualifier +Bundle-Name: %pluginName +Bundle-Vendor: %providerName +Bundle-ActivationPolicy: lazy +Bundle-Localization: plugin +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)", + org.eclipse.emf.cdo.server;bundle-version="[4.0.0,5.0.0)", + org.eclipse.emf.cdo.server.admin;bundle-version="[4.1.0,5.0.0)", + org.eclipse.emf.cdo.server.db;bundle-version="[4.0.0,5.0.0)", + org.eclipse.emf.cdo.server.net4j;bundle-version="[4.0.0,5.0.0)", + org.eclipse.net4j.tcp;bundle-version="[4.0.0,5.0.0)", + org.eclipse.net4j.db.h2;bundle-version="[4.0.0,5.0.0)" +Import-Package: org.h2.jdbcx;version="[1.0.0,2.0.0)" diff --git a/tests/org.eclipse.emf.edapt.cdo.server.target/README.html b/tests/org.eclipse.emf.edapt.cdo.server.target/README.html new file mode 100644 index 0000000..ef11638 --- /dev/null +++ b/tests/org.eclipse.emf.edapt.cdo.server.target/README.html @@ -0,0 +1,40 @@ +<html> +<head> +<title>CDO Master Server Example</title> +</head> + +<body> + +<h1>CDO Master Server Example</h1> + +This project contains the launch configuration "ExampleMasterServer" that +can be used to start a new OSGi process with a CDO master repository. +You may need to update the launch configuration by clicking the "Add Required +Plugins" button on the Plugins tab. +<p> +Before you actually run this master server you should review the server +configuration file /config/cdo-server.xml in this project. In particular +you may want to adjust the following settings: +<p> +<ul> + <li> + Acceptor port. + Default is 2036. + </li> + <li> + H2 datasource URL. + Default is a /database folder in the current directory, i.e., this project. + </li> + <li> + ID generation location. + Default is STORE, should be changed to CLIENT for all offline scenarios! + </li> +</ul> + +If the server is running you can point your web browser to +<a href="http://localhost:7777">http://localhost:7777</a> in order to +introspect the repository. Please note that this introspection facility +should not be used in production! + +</body> +</html> diff --git a/tests/org.eclipse.emf.edapt.cdo.server.target/about.html b/tests/org.eclipse.emf.edapt.cdo.server.target/about.html new file mode 100644 index 0000000..f2decc3 --- /dev/null +++ b/tests/org.eclipse.emf.edapt.cdo.server.target/about.html @@ -0,0 +1,70 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> +<title>About</title> +</head> +<body lang="EN-US"> +<h2>About This Content</h2> + +<p>June 5, 2007</p> +<h3>License</h3> + +<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise +indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. +For purposes of the EPL, "Program" will mean the Content.</p> + +<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor's license that was +provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p> + +</body> +</html> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> + + <head> + + <meta content="text/html; charset=ISO-8859-1" + http-equiv="Content-Type"/> + + <title>About</title> + + </head> + + <body lang="EN-US"> + + <h2>About This Content</h2> + + <p>May 17, 2007</p> + + <h3>License</h3> + + <p>The Eclipse Foundation makes available all content in this + plug-in ("Content"). Unless otherwise indicated below, + the Content is provided to you under the terms and conditions of + the Eclipse Public License Version 1.0 ("EPL"). A copy of + the EPL is available at + <a href="http://www.eclipse.org/legal/epl-v10.html"> + http://www.eclipse.org/legal/epl-v10.html</a>. For purposes of the + EPL, "Program" will mean the Content.</p> + + <p>If you did not receive this Content directly from the Eclipse + Foundation, the Content is being redistributed by another party + ("Redistributor") and different terms and conditions may + apply to your use of any object code in the Content. Check the + Redistributor's license that was provided with the Content. If + no such license exists, contact the Redistributor. Unless otherwise + indicated below, the terms and conditions of the EPL still apply to + any source code in the Content.</p> + + </body> + +</html> + diff --git a/tests/org.eclipse.emf.edapt.cdo.server.target/build.properties b/tests/org.eclipse.emf.edapt.cdo.server.target/build.properties new file mode 100644 index 0000000..2c37457 --- /dev/null +++ b/tests/org.eclipse.emf.edapt.cdo.server.target/build.properties @@ -0,0 +1,22 @@ +# Copyright (c) 2012 Eike Stepper (Berlin, Germany) 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: +# Eike Stepper - initial API and implementation + +# NLS_MESSAGEFORMAT_VAR + +bin.includes = META-INF/,\ + plugin.properties,\ + about.html,\ + copyright.txt,\ + README.html,\ + config/ +src.includes = about.html,\ + copyright.txt,\ + EdaptTargetServer.launch + +generateSourceReferences = true diff --git a/tests/org.eclipse.emf.edapt.cdo.server.target/config/.options b/tests/org.eclipse.emf.edapt.cdo.server.target/config/.options new file mode 100644 index 0000000..b857fd9 --- /dev/null +++ b/tests/org.eclipse.emf.edapt.cdo.server.target/config/.options @@ -0,0 +1,24 @@ +#Master Tracing Options +org.eclipse.emf.cdo.common/debug.model=true +org.eclipse.emf.cdo.common/debug.protocol=true +org.eclipse.emf.cdo.common/debug.revision=true +org.eclipse.emf.cdo.common/debug=true + +org.eclipse.net4j/debug.acceptor=true +org.eclipse.net4j/debug.buffer.stream=false +org.eclipse.net4j/debug.buffer=true +org.eclipse.net4j/debug.channel=true +org.eclipse.net4j/debug.connector=true +org.eclipse.net4j/debug.selector=true +org.eclipse.net4j/debug.signal=true +org.eclipse.net4j/debug=true +org.eclipse.net4j/perf=false + +org.eclipse.net4j.util/debug.concurrency=true +org.eclipse.net4j.util/debug.lifecycle.dump=true +org.eclipse.net4j.util/debug.lifecycle=true +org.eclipse.net4j.util/debug.om=true +org.eclipse.net4j.util/debug.registry=true +org.eclipse.net4j.util/debug=true + +org.eclipse.net4j.tcp/debug=true diff --git a/tests/org.eclipse.emf.edapt.cdo.server.target/config/cdo-server.xml b/tests/org.eclipse.emf.edapt.cdo.server.target/config/cdo-server.xml new file mode 100644 index 0000000..631bdf4 --- /dev/null +++ b/tests/org.eclipse.emf.edapt.cdo.server.target/config/cdo-server.xml @@ -0,0 +1,141 @@ +<?xml version="1.0" encoding="UTF-8"?> +<cdoServer> + + <!-- ============================================================== --> + <!-- See http://wiki.eclipse.org/CDO/Server_Configuration_Reference --> + <!-- ============================================================== --> + + <acceptor type="tcp" listenAddr="0.0.0.0" port="2037"/> + + <!-- Examples: + <acceptor type="ssl" listenAddr="0.0.0.0" port="2036"/> + <acceptor type="http"/> + --> + + <repository name="repo_target"> + + <property name="overrideUUID" value=""/> + <property name="supportingAudits" value="true"/> + <property name="supportingBranches" value="true"/> + <property name="ensureReferentialIntegrity" value="false"/> + <property name="allowInterruptRunningQueries" value="true"/> + <property name="idGenerationLocation" value="CLIENT"/> <!-- Possible values: STORE | CLIENT --> + <property name="serializeCommits" value="false"/> + <property name="optimisticLockingTimeout" value="10000"/> + + <!-- Example http://bugs.eclipse.org/380629 + <securityManager type="default" realmPath="/security"/> + <securityManager type="annotation" realmPath="/security"/> + --> + + <!-- Example http://bugs.eclipse.org/302775 + <authenticator type="file" description="_database/repo1.users"/> + --> + + <!-- Example http://bugs.eclipse.org/345431 + <initialPackage nsURI="http://www.eclipse.org/emf/CDO/examples/company/1.0.0"/> + --> + + <store type="db"> + + <!-- Example http://bugs.eclipse.org/396379 (if idGenerationLocation == CLIENT) + <property name="idColumnLength" value="34"/> + --> + + <!-- Period at which to execute an SQL statement to keep DB connection alive, in minutes --> + <property name="connectionKeepAlivePeriod" value="60"/> + + <!-- Maximum number of store accessors (JDBC connections) to keep in the reader pool. The default value is 15. --> + <property name="readerPoolCapacity" value="20"/> + + <!-- Maximum number of store accessors (JDBC connections) to keep in the writer pool. The default value is 15. --> + <property name="writerPoolCapacity" value="20"/> + + <mappingStrategy type="horizontal"> <!-- callout --> + <property name="qualifiedNames" value="true"/> + + <!-- + Per default, the objectTypeCache is in-memory and contains + 100,000 cache entries. If you want to change the size, + uncomment the following line and set the desired size. + The cache can be disabled by setting a size of 0. + --> + + <!-- Optional: + <property name="objectTypeCacheSize" value="100000"/> + --> + + </mappingStrategy> + + <dbAdapter name="h2"/> + <dataSource class="org.h2.jdbcx.JdbcDataSource" + URL="jdbc:h2:database/repo_target"/> + + <!-- Example: + <dbAdapter name="derby-embedded"/> + <dataSource class="org.apache.derby.jdbc.EmbeddedDataSource" + databaseName="/temp/repo1" + createDatabase="create"/> + --> + + <!-- Example: + <dbAdapter name="hsqldb"/> + <dataSource class="org.eclipse.net4j.db.hsqldb.HSQLDBDataSource" + database="jdbc:hsqldb:file:/temp/repo1" + user="sa"/> + --> + + <!-- Example: + <dbAdapter name="mysql"/> + <dataSource class="com.mysql.jdbc.jdbc2.optional.MysqlDataSource" + url="jdbc:mysql://localhost/repo1" + user="sa"/> + --> + + <!-- Example: + <dbAdapter name="postgresql"/> + <dataSource class="org.postgresql.ds.PGSimpleDataSource" + serverName="localhost" + portNumber="5432" + databaseName="repo1" + user="postgres" + password="postgres"/> + --> + + <!-- Example: + <dbAdapter name="oracle"/> + <dataSource class="oracle.jdbc.pool.OracleDataSource" + driverType="thin" + serverName="serverURL" + portNumber="1521" + databaseName="SID" + user="user" + password="passwd"/> + --> + + </store> + + <!-- ONLY THE FIRST CONFIGURED STORE IS USED FOR THE REPOSITORY!!! --> + + <store type="mongodb"> + <property name="uri" value="mongodb://localhost"/> + <property name="db" value="cdodb"/> + <!-- Optional: + <property name="drop" value="true"/> + --> + </store> + + </repository> + + <!-- Example of a DB4O repo/store: + <repository name="repo1"> + <property name="supportingAudits" value="false"/> + <property name="supportingBranches" value="false"/> + <store type="db4o"> + <property name="path" value="/tmp/cdodb4.db4o"/> + <property name="port" value="50032"/> + </store> + </repository> + --> + +</cdoServer> diff --git a/tests/org.eclipse.emf.edapt.cdo.server.target/copyright.txt b/tests/org.eclipse.emf.edapt.cdo.server.target/copyright.txt new file mode 100644 index 0000000..1c77978 --- /dev/null +++ b/tests/org.eclipse.emf.edapt.cdo.server.target/copyright.txt @@ -0,0 +1,8 @@ +Copyright (c) 2004-2013 Eike Stepper (Berlin, Germany) 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: + Eike Stepper - initial API and implementation diff --git a/tests/org.eclipse.emf.edapt.cdo.server.target/database/repo_target.h2.db b/tests/org.eclipse.emf.edapt.cdo.server.target/database/repo_target.h2.db Binary files differnew file mode 100644 index 0000000..f1726be --- /dev/null +++ b/tests/org.eclipse.emf.edapt.cdo.server.target/database/repo_target.h2.db diff --git a/tests/org.eclipse.emf.edapt.cdo.server.target/database/repo_target.lock.db b/tests/org.eclipse.emf.edapt.cdo.server.target/database/repo_target.lock.db new file mode 100644 index 0000000..b5bc24f --- /dev/null +++ b/tests/org.eclipse.emf.edapt.cdo.server.target/database/repo_target.lock.db @@ -0,0 +1,4 @@ +#FileLock +#Mon Dec 30 11:01:56 CET 2013 +id=14342f3e435f00eeb86f55bcaddf88fccd777e22ea7 +method=file diff --git a/tests/org.eclipse.emf.edapt.cdo.server.target/database/repo_target.trace.db b/tests/org.eclipse.emf.edapt.cdo.server.target/database/repo_target.trace.db new file mode 100644 index 0000000..b5d1ebb --- /dev/null +++ b/tests/org.eclipse.emf.edapt.cdo.server.target/database/repo_target.trace.db @@ -0,0 +1,3 @@ +12-23 17:08:17 jdbc[2]: exception +org.h2.jdbc.JdbcSQLException: Table "CDO_PROPERTIES" not found; SQL statement: +SELECT VALUE FROM CDO_PROPERTIES WHERE NAME='org.eclipse.emf.cdo.server.db.schemaVersion' [42102-168] diff --git a/tests/org.eclipse.emf.edapt.cdo.server.target/plugin.properties b/tests/org.eclipse.emf.edapt.cdo.server.target/plugin.properties new file mode 100644 index 0000000..8a000ed --- /dev/null +++ b/tests/org.eclipse.emf.edapt.cdo.server.target/plugin.properties @@ -0,0 +1,11 @@ +# Copyright (c) 2012 Eike Stepper (Berlin, Germany) 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: +# Eike Stepper - initial API and implementation + +pluginName = CDO Edapt Target server +providerName = Eclipse Modeling Project 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 index 4482399..a2bf4f6 100644 --- a/tests/org.eclipse.emf.edapt.cdo.tests/META-INF/MANIFEST.MF +++ b/tests/org.eclipse.emf.edapt.cdo.tests/META-INF/MANIFEST.MF @@ -14,4 +14,5 @@ Require-Bundle: org.eclipse.core.runtime, 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" + org.eclipse.emf.edapt.tests;bundle-version="0.3.0", + org.eclipse.emf.edapt.history.cdo;bundle-version="1.0.0" 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 index c68902f..2ddf729 100644 --- a/tests/org.eclipse.emf.edapt.cdo.tests/data/component/component.test +++ b/tests/org.eclipse.emf.edapt.cdo.tests/data/component/component.test @@ -1,4 +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"/>
+ <cases name="Component Model" model="component_r0.xmi" expectedModel="cdo://repo_target/component_ro"/>
</test:TestSuiteDefinition>
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 index 7b7bdff..47034e7 100644 --- 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 @@ -12,15 +12,25 @@ package org.eclipse.emf.edapt.cdo.tests; import java.io.IOException; +import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.Map; import java.util.Set; import junit.framework.TestCase; +import org.eclipse.core.runtime.Path; import org.eclipse.emf.cdo.eresource.CDOResource; +import org.eclipse.emf.cdo.eresource.CDOResourceFactory; +import org.eclipse.emf.cdo.eresource.CDOResourceFolder; +import org.eclipse.emf.cdo.eresource.CDOResourceLeaf; +import org.eclipse.emf.cdo.eresource.CDOResourceNode; import org.eclipse.emf.cdo.net4j.CDONet4jSession; +import org.eclipse.emf.cdo.net4j.CDONet4jUtil; import org.eclipse.emf.cdo.transaction.CDOTransaction; +import org.eclipse.emf.cdo.util.CDOURIData; +import org.eclipse.emf.cdo.util.CDOURIUtil; import org.eclipse.emf.cdo.util.CommitException; import org.eclipse.emf.cdo.util.ConcurrentAccessException; import org.eclipse.emf.cdo.view.CDOViewProvider; @@ -36,32 +46,74 @@ 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.cdo.migration.execution.CDOMigrator; +import org.eclipse.emf.edapt.common.IResourceSetFactory; +import org.eclipse.emf.edapt.common.ResourceSetFactoryImpl; 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.Model; 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 Christophe Bouhier * @author $Author$ * @version $Rev$ * @levd.rating YELLOW Hash: 028BD5369E87644723FF537FB5E55E4D */ public abstract class CDOMigrationTestBase extends TestCase { + @Override + protected void setUp() throws Exception { + super.setUp(); + + // Make sure we register various protocols with the CDO Factory. + registerCDOResourceFactory(); + + // Initialize the PluginViewProvider (Which needs a Session factory), it + // can deal with + // both cdo and cdo.net4j.tcp + CDOViewProviderRegistry vpRegistry = CDOViewProviderRegistry.INSTANCE; + vpRegistry.addViewProvider(new EdaptCDOViewProvider( + "cdo(\\.net4j\\.tcp)?://.*", CDOViewProvider.DEFAULT_PRIORITY)); + + // clearCDORepositories(); + + } + + private void clearCDORepositories() { + ResourceSetImpl set = new ResourceSetImpl(); + + URI uri = cdoConnectionAwareURI("", CDOTestUtil.SOURCE_PORT, + CDOTestUtil.REPO_SOURCE); + Resource resource = set.getResource(uri, true); + clearCDO((CDOResourceNode) resource); + + } + + private void clearCDO(CDOResourceNode resource) { + // Walk the resource hierarchy and clean all. + if (resource instanceof CDOResourceFolder) { + CDOResourceFolder folder = (CDOResourceFolder) resource; + for (CDOResourceNode node : folder.getNodes()) { + clearCDO(node); + } + } else if (resource instanceof CDOResourceLeaf) { + // clear the leaf object. + EObject eContainer = resource.eContainer(); + + } + } + private CDONet4jSession testSession; /** @@ -80,7 +132,7 @@ public abstract class CDOMigrationTestBase extends TestCase { URI expectedTargetModelURI, URI expectedTargetMetamodelURI, IClassLoader loader) throws MigrationException, IOException { - Migrator migrator = new Migrator(migratorURI, loader); + CDOMigrator migrator = new CDOMigrator(migratorURI, loader); testMigration(migrator, modelURI, expectedTargetModelURI, expectedTargetMetamodelURI); } @@ -97,7 +149,7 @@ public abstract class CDOMigrationTestBase extends TestCase { * @param expectedTargetMetamodelURI * URI of the target metamodel of the migration */ - public void testMigration(Migrator migrator, URI modelURI, + public void testMigration(CDOMigrator migrator, URI modelURI, URI expectedTargetModelURI, URI expectedTargetMetamodelURI) throws MigrationException, IOException { testMigration(migrator, modelURI, expectedTargetModelURI, @@ -105,7 +157,11 @@ public abstract class CDOMigrationTestBase extends TestCase { } /** - * Test a model migration. + * Test a model migration by loading the model into a source repository in + * CDO first, let the Migrator produces a migrated {@link Model} instance + * and push the result to a target repository. The result resource URI is + * specified by the argument <code>expectedTargetModelURI</code> in CDO URI + * format as specified by {@link CDOURIData} * * @param migrator * Migrator @@ -118,129 +174,404 @@ public abstract class CDOMigrationTestBase extends TestCase { * @param expectedNumber * Expected number of differences */ - public void testMigration(Migrator migrator, URI modelURI, + public void testMigration(CDOMigrator migrator, URI modelURI, URI expectedTargetModelURI, URI expectedTargetMetamodelURI, int expectedNumber) throws MigrationException, IOException { - prepareSession(); + // Get the release for source model URI. + // FIXME, get release is not CDO Compatible (yet). + Set<Release> releases = migrator.getRelease(modelURI); + assertTrue(releases.size() >= 1); -// EPackage ePack = loadEPackageFromEcore(expectedTargetMetamodelURI); + Release release = HistoryUtils.getMinimumRelease(releases); -// if (ePack != null) { - - CDOTransaction t = testSession.openTransaction(); + // Get a metamodel to construct to load the resource with the + // matching EPackage. + Metamodel metamodel = migrator.getMetamodel(release); - Set<Release> releases = migrator.getRelease(modelURI); + // Rename in case we want a URI for a regular resource... + // URI targetModelURI = rename(metamodel, modelURI, release); + // List<URI> cdoTargetURIs = Collections.singletonList(targetModelURI); - assertTrue(releases.size() >= 1); + List<URI> modelURIs = Collections.singletonList(modelURI); - Release release = HistoryUtils.getMinimumRelease(releases); + // Get the source and target CDO URIs + List<URI> cdoSourceURIs = cdoSourceURIs(modelURIs); + List<URI> cdoTargetURIs = cdoTargetURIs(modelURIs); + + // Load the source set for the model URI(s). + ResourceSet sourceSet = ResourceUtils.loadResourceSet(modelURIs, + metamodel.getEPackages()); + + ResourceSetFactoryImpl resourceSetFactoryImpl = new ResourceSetFactoryImpl(); + + clear(cdoSourceURIs, resourceSetFactoryImpl); + clear(cdoTargetURIs, resourceSetFactoryImpl); + + // Copy the source set to the CDO source repo, let our CDOView provider + // do all the CDO stuff + // like creating a container, connector, session and transaction. See + // EDaptCDOViewProvider + copy(metamodel, sourceSet, cdoSourceURIs, new ResourceSetFactoryImpl()); + + // CB FIX the CDOMigrationTestCase so it can work with connection aware + // CDO URI's! For now we produce the target URI ourself. + migrator.migrateAndSave(cdoSourceURIs, release, null, + new PrintStreamProgressMonitor(System.out), cdoTargetURIs); + + // Test Comparision is metamodel based. + + 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(); + } - // Get a metamodel to construct to load the resource with the - // matching EPackage. - - Metamodel metamodel = migrator.getMetamodel(release); - - List<URI> modelURIs = Collections.singletonList(modelURI); + private void clear(List<URI> cdoSourceURIs, + ResourceSetFactoryImpl resourceSetFactoryImpl) { + ResourceSet set = resourceSetFactoryImpl.createResourceSet(); - 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); + CDOTransaction transaction; + for (URI uri : cdoSourceURIs) { + + try { + + Resource resource = set.getResource(uri, true); + + if (resource instanceof CDOResource) { + CDOResource cdoRes = (CDOResource) resource; + transaction = (CDOTransaction) cdoRes.cdoView(); + try { + cdoRes.delete(null); + transaction.commit(); + } catch (IOException e) { + } catch (ConcurrentAccessException e) { + } catch (CommitException e) { + } } + } catch (RuntimeException re) { + // Guard for Exception, as the resource might not exist, + // which will be an invalid URI when demand loading duh.... } - - // 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); + private void registerCDOResourceFactory() { + // Initialize our factoy. + Map<String, Object> map = Resource.Factory.Registry.INSTANCE + .getProtocolToFactoryMap(); - // The resource without the extension. - cdoResource = t.createResource(resourceName); + // cdo.net4j.tcp + if (!map.containsKey(CDONet4jUtil.PROTOCOL_TCP)) { + map.put(CDONet4jUtil.PROTOCOL_TCP, CDOResourceFactory.INSTANCE); + } + // cdo + if (!map.containsKey(CDOURIUtil.PROTOCOL_NAME)) { + map.put(CDOURIUtil.PROTOCOL_NAME, CDOResourceFactory.INSTANCE); + } + } - // Copy will not work, as the EPackage resolved from the - // referenced, - // .ecore in the serialization, which is already upgraded. + /** + * Copies a the resources + * + * + * @param modelURI + * @param t + * @param metamodel + * @param model + * @return + */ + @SuppressWarnings("unused") + private URI copyToCDORepo(URI modelURI, CDOTransaction t, + Metamodel metamodel, ResourceSet model) { + // 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); + } + } - EObject copy = EcoreUtil.copy(loadElement); - cdoResource.getContents().add(copy); - } + // 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; + } + + if (commitTransaction(t)) { + // Commit failed. + // Nothing going on in CDO, remove the package and return. + // clearEPackage(ePack); + throw new IllegalStateException("Commit failed"); + } + + // We need a CDO resource to proceed. + if (cdoResource == null) { + throw new IllegalStateException("CDO Resource not created"); + } + // Change the modelURI to deal with CDO. + URI cdoModelURI = cdoResource.getURI(); + return cdoModelURI; + } + + /** + * Construct CDO {@link URI} from a given {@link ResourceSet source models}, + * create {@link ResourceSet target models } and copy the source content to + * the target content. Note: this will only work with a configured + * {@link CDOViewProvider}. + * + * @param metamodel + * @param sourceModels + * @param resourceSetFactory + * @return + */ + private ResourceSet copyToSource(Metamodel metamodel, + ResourceSet sourceModels, IResourceSetFactory resourceSetFactory) { + + // Our CDO target Resourceset. + ResourceSet set = resourceSetFactory.createResourceSet(); + + for (Resource resource : sourceModels.getResources()) { + + // Construct a URI for each resource in the Model ResourceSet, let + // the CDO View Provider take care of the session, transaction, + // etc.... + if (resource.getURI() == null + || resource.getURI().isPlatformPlugin()) { + continue; } - - // We need a CDO resource to proceed. - if(cdoResource == null){ - return; + + URI cdoResourceURI = cdoSourceConnectionAwareURI(resource.getURI()); + CDOResource cdoLoadResource = cdoCreateResource(set, + cdoResourceURI, metamodel); + EObject loadElement = resource.getContents().get(0); + + EObject copy = EcoreUtil.copy(loadElement); + cdoLoadResource.getContents().add(copy); + + try { + cdoLoadResource.save(null); + } catch (IOException e) { + e.printStackTrace(); } - // 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(); + } + return set; } + /** + * Construct CDO {@link URI} from a given {@link ResourceSet source models}, + * create {@link ResourceSet target models } and copy the source content to + * the target content. Note: this will only work with a configured + * {@link CDOViewProvider}. + * + * @param metamodel + * @param sourceModels + * @param resourceSetFactory + * @return + */ + public void copy(Metamodel metamodel, ResourceSet sourceModels, + List<URI> cdoURIs, IResourceSetFactory resourceSetFactory) { + + // Our CDO target Resourceset. + ResourceSet set = resourceSetFactory.createResourceSet(); + + for (Resource resource : sourceModels.getResources()) { + + int index = sourceModels.getResources().indexOf(resource); + URI cdoResourceURI = cdoURIs.get(index); + + CDOResource cdoLoadResource = cdoCreateResource(set, + cdoResourceURI, metamodel); + + // Copy over the stuff to CDO. + EObject loadElement = resource.getContents().get(0); + + EObject copy = EcoreUtil.copy(loadElement); + cdoLoadResource.getContents().add(copy); + + try { + cdoLoadResource.save(null); + } catch (IOException e) { + e.printStackTrace(); + } + } + // TODO, how to get rid of the transaction? + + } + + /** + * Obtain CDO {@link CDOURIData Connection Aware URI} from a collection of + * 'file' based URI's. The connection details are taken from the target + * repository settings. + * + * FIXME Implement an abstract ConnectURIProvider which can be specialized + * for source and target. + * + * @param modelURIs + * @return + */ + public List<URI> cdoTargetURIs(List<URI> modelURIs) { + + List<URI> arrayList = new ArrayList<URI>(); + for (URI uri : modelURIs) { + URI cdoTargetConnectionAwareURI = cdoTargetConnectionAwareURI(uri); + arrayList.add(cdoTargetConnectionAwareURI); + } + + return arrayList; + + } + + public List<URI> cdoSourceURIs(List<URI> modelURIs) { + + List<URI> arrayList = new ArrayList<URI>(); + for (URI uri : modelURIs) { + URI cdoTargetConnectionAwareURI = cdoSourceConnectionAwareURI(uri); + arrayList.add(cdoTargetConnectionAwareURI); + } + + return arrayList; + + } + + private URI cdoSourceConnectionAwareURI(URI sourceURI) { + return cdoConnectionAwareURI(sourceURI, CDOTestUtil.SOURCE_PORT, + CDOTestUtil.REPO_SOURCE); + } + + private URI cdoTargetConnectionAwareURI(URI sourceURI) { + return cdoConnectionAwareURI(sourceURI, CDOTestUtil.TARGET_PORT, + CDOTestUtil.REPO_TARGET); + } + + /** + * Converts a 'regular' resource URI to a CDO Resource URI. + * + * @param sourceURI + * @return + */ + private URI cdoConnectionAwareURI(URI sourceURI, String port, String repo) { + + try { + URI createFileURI = URI.createFileURI(sourceURI.toString()); + } catch (Exception e) { + // bail when we are not a file URI. + e.printStackTrace(); + } + + String fileName = sourceURI.lastSegment(); + + // Strip the extension of the file name. + String resourceName = fileName.substring(0, fileName.lastIndexOf(".")); + return cdoConnectionAwareURI(resourceName, port, repo); + } + + private URI cdoConnectionAwareURI(String resourceName, String port, + String repo) { + + CDOURIData cdouriData = new CDOURIData(); + cdouriData.setScheme("cdo.net4j.tcp"); + cdouriData.setAuthority(CDOTestUtil.HOST + ":" + port); + cdouriData.setRepositoryName(repo); + cdouriData.setResourcePath(new Path(resourceName)); + + return cdouriData.toURI(); + } + + /** + * Converts a 'regular' resource URI to a CDO Resource URI. + * + * @param sourceURI + * @return + */ + @SuppressWarnings("unused") + private URI cdoCanonicalURI(URI sourceURI) { + + // FIXME, check the URI is file based.... + String fileName = sourceURI.lastSegment(); + + // Strip the extension of the file name. + String resourceName = fileName.substring(0, fileName.lastIndexOf(".")); + + CDOURIData cdouriData = new CDOURIData(); + + cdouriData.setScheme("cdo"); + cdouriData.setRepositoryName(CDOTestUtil.REPO_SOURCE); + cdouriData.setResourcePath(new Path(resourceName)); + + return cdouriData.toURI(); + } + + /** + * Create a {@link CDOResource} from a {@link URI} the {@link Metamodel + * MMMeta} will be used to register the corresponding {@link EPackage} by + * the {@link CDOViewProvider}. + * + * @param set + * @param cdoResourceURI + * @param mmmeta + * @return + */ + public CDOResource cdoCreateResource(ResourceSet set, URI cdoResourceURI, + Metamodel mmmeta) { + + ResourceUtils.register(mmmeta.getEPackages(), set.getPackageRegistry()); + + Resource resource = set.createResource(cdoResourceURI); + + if (resource instanceof CDOResource) { + return (CDOResource) resource; + } + return null; + } + + @SuppressWarnings("unused") private void clearEPackage(EPackage ePack) { if (testSession.getPackageRegistry().containsKey(ePack.getNsURI())) { testSession.getPackageRegistry().remove(ePack.getNsURI()); @@ -261,16 +592,7 @@ public abstract class CDOMigrationTestBase extends TestCase { return commitFailed; } - private void prepareSession() { - testSession = CDOTestUtil.self.openSession(); - } - - private void closeSession() { - if (testSession != null && !testSession.isClosed()) { - testSession.close(); - } - } - + @SuppressWarnings("unused") private EPackage loadEPackageFromEcore(URI expectedTargetMetamodelURI) { // register globally the Ecore Resource Factory to the ".ecore" // extension @@ -298,17 +620,16 @@ public abstract class CDOMigrationTestBase extends TestCase { /** * Rename a model. * - * @param migrator + * @param metamodel * 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) + private URI rename(Metamodel metamodel, 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); @@ -346,11 +667,16 @@ public abstract class CDOMigrationTestBase extends TestCase { URI expectedTargetMetamodelURI, int expectedDifferences) throws MigrationException, IOException { - String nsURI = ReleaseUtils.getNamespaceURI(modelURI); + // CB TODO, Fix the Migrator Registry, define IMigrator to support + // various implementations.... + + // String nsURI = ReleaseUtils.getNamespaceURI(modelURI); + // + // Migrator migrator = + // MigratorRegistry.getInstance().getMigrator(nsURI); + // assertNotNull(migrator); + // testMigration(migrator, modelURI, expectedTargetModelURI, + // expectedTargetMetamodelURI, expectedDifferences); - 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/CDOMigrationTestSuite.java b/tests/org.eclipse.emf.edapt.cdo.tests/src/org/eclipse/emf/edapt/cdo/tests/CDOMigrationTestSuite.java index d7afba2..3bad4ae 100644 --- 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 @@ -17,12 +17,12 @@ import junit.framework.TestResult; import junit.framework.TestSuite; import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.edapt.cdo.migration.execution.CDOMigrator; 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; @@ -41,7 +41,7 @@ public class CDOMigrationTestSuite extends TestSuite { private final TestSuiteDefinition suiteDefinition; /** Migrator. */ - private Migrator migrator; + private CDOMigrator migrator; /** Classloader for loading {@link CustomMigration}s. */ private IClassLoader loader; @@ -99,14 +99,14 @@ public class CDOMigrationTestSuite extends TestSuite { } /** Get the migrator. */ - Migrator getMigrator() { + CDOMigrator getMigrator() { return migrator; } /** Load the migrator from the history model. */ - private Migrator loadMigrator() throws IOException { + private CDOMigrator loadMigrator() throws IOException { History history = loadHistory(); - Migrator migrator = new Migrator(history, loader); + CDOMigrator migrator = new CDOMigrator(history, loader); return migrator; } } 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 index ee208ee..7ff80df 100644 --- 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 @@ -19,13 +19,20 @@ public class CDOTestUtil { public static CDOTestUtil self = new CDOTestUtil(); - private static final String REPO_NAME = "repo1"; + public static final String REPO_SOURCE = "repo_source"; + public static final String REPO_TARGET = "repo_target"; + + public static final String SOURCE_PORT = "2036"; + public static final String TARGET_PORT = "2037"; + + public static final String CONNECTOR_TYPE = "tcp"; + @SuppressWarnings("unused") private IJVMAcceptor acceptor; private IConnector connector; - protected static final String CONNECTION_ADDRESS = "localhost:2036"; + protected static final String HOST = "127.0.0.1"; private ExceptionHandler exceptionHandler = new ExceptionHandler() { @@ -60,10 +67,13 @@ public class CDOTestUtil { .createNet4jSessionConfiguration(); // acceptor = JVMUtil.getAcceptor(container, "default"); - connector = TCPUtil.getConnector(container, CONNECTION_ADDRESS); + + // Use a factory to produce a Connect and parse the connector description (See TCPCOnnectorFactory). + + connector = TCPUtil.getConnector(container, HOST + ":" + SOURCE_PORT); sessionConfiguration.setConnector(connector); - sessionConfiguration.setRepositoryName(REPO_NAME); + sessionConfiguration.setRepositoryName(REPO_SOURCE); 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 index 004018f..85daf7d 100644 --- 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 @@ -1,12 +1,22 @@ package org.eclipse.emf.edapt.cdo.tests; +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.emf.cdo.common.model.CDOPackageRegistry; 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.transaction.CDOTransaction; +import org.eclipse.emf.cdo.util.CDOURIData; +import org.eclipse.emf.cdo.util.CommitException; +import org.eclipse.emf.cdo.util.ConcurrentAccessException; 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.EPackage; +import org.eclipse.emf.ecore.EPackage.Registry; import org.eclipse.emf.ecore.resource.ResourceSet; import org.eclipse.net4j.Net4jUtil; import org.eclipse.net4j.connector.IConnector; @@ -17,8 +27,9 @@ import org.eclipse.net4j.util.container.ManagedContainer; public class EdaptCDOViewProvider extends AbstractCDOViewProvider implements CDOViewProvider { - private IManagedContainer container; - + // A Map holding containers specific to a repository. + private static Map<String, IManagedContainer> repoContainers = new HashMap<String, IManagedContainer>(); + public EdaptCDOViewProvider() { } @@ -31,24 +42,62 @@ public class EdaptCDOViewProvider extends AbstractCDOViewProvider implements } 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(); + + CDOURIData cdouriData = new CDOURIData(uri); + + String repoName = cdouriData.getRepositoryName(); + + IManagedContainer container = repoContainers.get(repoName); + + if (container == null) { + container = new ManagedContainer(); + Net4jUtil.prepareContainer(container); + TCPUtil.prepareContainer(container); + container.activate(); + repoContainers.put(repoName, container); + }else{ + for(Object e : container.getElements()){ + System.out.println(e); + } + } - IConnector connector = (IConnector)container.getElement("org.eclipse.net4j.connectors", "tcp", "localhost"); + // Produce a TCPConnector which respects all params like UserID, Port, + // and Host. + IConnector connector = (IConnector) container.getElement( + "org.eclipse.net4j.connectors", "tcp", cdouriData.getAuthority()); - CDONet4jSessionConfiguration config = CDONet4jUtil.createNet4jSessionConfiguration(); - config.setConnector(connector); - config.setRepositoryName(repoName); + CDONet4jSessionConfiguration config = CDONet4jUtil + .createNet4jSessionConfiguration(); + config.setConnector(connector); + config.setRepositoryName(repoName); - CDOSession session = config.openNet4jSession(); - return session.openTransaction(); - } + CDOSession session = config.openNet4jSession(); + + // Get the package registry for this resource set and make sure + // it is known in the repository. + Registry packageRegistry = resourceSet.getPackageRegistry(); + CDOPackageRegistry cdoPackageRegistry = session.getPackageRegistry(); + + for (String nsURI : packageRegistry.keySet()) { + EPackage packageToAdd = packageRegistry.getEPackage(nsURI); + EPackage ePackage = cdoPackageRegistry.getEPackage(nsURI); + if(ePackage == null){ + cdoPackageRegistry.putEPackage(packageToAdd); + } + } + + CDOTransaction openTransaction = session.openTransaction(resourceSet); + try { + openTransaction.commit(); + } catch (ConcurrentAccessException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (CommitException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return openTransaction; + } } |