From 0dc0e081796856373a370adf238732e19bb6bbfb Mon Sep 17 00:00:00 2001 From: Eike Stepper Date: Thu, 10 Aug 2006 04:03:21 +0000 Subject: *** empty log message *** --- plugins/org.eclipse.emf.cdo.tests/.classpath | 2 +- .../.settings/org.eclipse.jdt.core.prefs | 7 +- .../org.eclipse.emf.cdo.tests/META-INF/MANIFEST.MF | 11 +- .../META-INF/cdo/client/cdo-client.properties | 4 + .../META-INF/cdo/client/cdo-client.xml | 65 +++ .../META-INF/cdo/server/cdo-server.properties | 55 +++ .../META-INF/cdo/server/cdo-server.xml | 126 +++++ .../META-INF/net4j/client/net4j-client.properties | 3 + .../META-INF/net4j/client/net4j-client.xml | 42 ++ .../net4j/embedded/net4j-embedded.properties | 14 + .../META-INF/net4j/embedded/net4j-embedded.xml | 47 ++ .../META-INF/net4j/net4j.properties | 4 + .../META-INF/net4j/net4j.xml | 63 +++ .../META-INF/net4j/server/auth.users | 1 + .../META-INF/net4j/server/net4j-server.properties | 11 + .../META-INF/net4j/server/net4j-server.xml | 62 +++ plugins/org.eclipse.emf.cdo.tests/build.properties | 4 +- .../launches/IntegrationTest.launch | 38 ++ plugins/org.eclipse.emf.cdo.tests/lib/.cvsignore | 0 .../model/TestModel1.ecore | 17 + .../model/TestModel1.genmodel | 21 + .../org.eclipse.emf.cdo.tests/plugin.properties | 2 + plugins/org.eclipse.emf.cdo.tests/plugin.xml | 15 + .../emf/cdo/tests/AbstractIntegrationTest.java | 83 ++++ .../eclipse/emf/cdo/tests/AbstractTopology.java | 91 ++++ .../src/org/eclipse/emf/cdo/tests/AllSuites.java | 21 +- .../src/org/eclipse/emf/cdo/tests/AllTests.java | 10 + .../org/eclipse/emf/cdo/tests/CDOTestPlugin.java | 47 +- .../cdo/tests/ClientSeparatedServerTopology.java | 70 +++ .../emf/cdo/tests/ClientServerTopology.java | 67 +++ .../org/eclipse/emf/cdo/tests/ClientTopology.java | 27 ++ .../eclipse/emf/cdo/tests/EmbeddedTopology.java | 27 ++ .../src/org/eclipse/emf/cdo/tests/ITopology.java | 26 ++ .../org/eclipse/emf/cdo/tests/IntegrationTest.java | 62 +++ .../src/org/eclipse/emf/cdo/tests/SampleTest.java | 10 + .../src/testmodel1/TestModel1Factory.java | 49 ++ .../src/testmodel1/TestModel1Package.java | 300 ++++++++++++ .../src/testmodel1/TreeNode.java | 180 ++++++++ .../src/testmodel1/impl/TestModel1FactoryImpl.java | 113 +++++ .../src/testmodel1/impl/TestModel1PackageImpl.java | 281 +++++++++++ .../src/testmodel1/impl/TreeNodeImpl.java | 511 +++++++++++++++++++++ .../testmodel1/util/TestModel1AdapterFactory.java | 176 +++++++ .../src/testmodel1/util/TestModel1Switch.java | 180 ++++++++ 43 files changed, 2891 insertions(+), 54 deletions(-) create mode 100644 plugins/org.eclipse.emf.cdo.tests/META-INF/cdo/client/cdo-client.properties create mode 100644 plugins/org.eclipse.emf.cdo.tests/META-INF/cdo/client/cdo-client.xml create mode 100644 plugins/org.eclipse.emf.cdo.tests/META-INF/cdo/server/cdo-server.properties create mode 100644 plugins/org.eclipse.emf.cdo.tests/META-INF/cdo/server/cdo-server.xml create mode 100644 plugins/org.eclipse.emf.cdo.tests/META-INF/net4j/client/net4j-client.properties create mode 100644 plugins/org.eclipse.emf.cdo.tests/META-INF/net4j/client/net4j-client.xml create mode 100644 plugins/org.eclipse.emf.cdo.tests/META-INF/net4j/embedded/net4j-embedded.properties create mode 100644 plugins/org.eclipse.emf.cdo.tests/META-INF/net4j/embedded/net4j-embedded.xml create mode 100644 plugins/org.eclipse.emf.cdo.tests/META-INF/net4j/net4j.properties create mode 100644 plugins/org.eclipse.emf.cdo.tests/META-INF/net4j/net4j.xml create mode 100644 plugins/org.eclipse.emf.cdo.tests/META-INF/net4j/server/auth.users create mode 100644 plugins/org.eclipse.emf.cdo.tests/META-INF/net4j/server/net4j-server.properties create mode 100644 plugins/org.eclipse.emf.cdo.tests/META-INF/net4j/server/net4j-server.xml create mode 100644 plugins/org.eclipse.emf.cdo.tests/launches/IntegrationTest.launch delete mode 100644 plugins/org.eclipse.emf.cdo.tests/lib/.cvsignore create mode 100644 plugins/org.eclipse.emf.cdo.tests/model/TestModel1.ecore create mode 100644 plugins/org.eclipse.emf.cdo.tests/model/TestModel1.genmodel create mode 100644 plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AbstractIntegrationTest.java create mode 100644 plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AbstractTopology.java create mode 100644 plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ClientSeparatedServerTopology.java create mode 100644 plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ClientServerTopology.java create mode 100644 plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ClientTopology.java create mode 100644 plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/EmbeddedTopology.java create mode 100644 plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ITopology.java create mode 100644 plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/IntegrationTest.java create mode 100644 plugins/org.eclipse.emf.cdo.tests/src/testmodel1/TestModel1Factory.java create mode 100644 plugins/org.eclipse.emf.cdo.tests/src/testmodel1/TestModel1Package.java create mode 100644 plugins/org.eclipse.emf.cdo.tests/src/testmodel1/TreeNode.java create mode 100644 plugins/org.eclipse.emf.cdo.tests/src/testmodel1/impl/TestModel1FactoryImpl.java create mode 100644 plugins/org.eclipse.emf.cdo.tests/src/testmodel1/impl/TestModel1PackageImpl.java create mode 100644 plugins/org.eclipse.emf.cdo.tests/src/testmodel1/impl/TreeNodeImpl.java create mode 100644 plugins/org.eclipse.emf.cdo.tests/src/testmodel1/util/TestModel1AdapterFactory.java create mode 100644 plugins/org.eclipse.emf.cdo.tests/src/testmodel1/util/TestModel1Switch.java diff --git a/plugins/org.eclipse.emf.cdo.tests/.classpath b/plugins/org.eclipse.emf.cdo.tests/.classpath index 065ac06e19..751c8f2e50 100644 --- a/plugins/org.eclipse.emf.cdo.tests/.classpath +++ b/plugins/org.eclipse.emf.cdo.tests/.classpath @@ -1,7 +1,7 @@ - + diff --git a/plugins/org.eclipse.emf.cdo.tests/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.emf.cdo.tests/.settings/org.eclipse.jdt.core.prefs index fb74a5035d..e74445d9fe 100644 --- a/plugins/org.eclipse.emf.cdo.tests/.settings/org.eclipse.jdt.core.prefs +++ b/plugins/org.eclipse.emf.cdo.tests/.settings/org.eclipse.jdt.core.prefs @@ -1,4 +1,4 @@ -#Mon Mar 13 08:16:19 CET 2006 +#Wed Aug 09 09:49:26 CEST 2006 eclipse.preferences.version=1 org.eclipse.jdt.core.codeComplete.argumentPrefixes= org.eclipse.jdt.core.codeComplete.argumentSuffixes= @@ -8,11 +8,6 @@ org.eclipse.jdt.core.codeComplete.localPrefixes= org.eclipse.jdt.core.codeComplete.localSuffixes= org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 -org.eclipse.jdt.core.compiler.compliance=1.5 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.5 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 diff --git a/plugins/org.eclipse.emf.cdo.tests/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.tests/META-INF/MANIFEST.MF index 5081e0b207..5f4122522c 100644 --- a/plugins/org.eclipse.emf.cdo.tests/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.emf.cdo.tests/META-INF/MANIFEST.MF @@ -1,15 +1,16 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName -Bundle-SymbolicName: org.eclipse.emf.cdo.tests;singleton:=true +Bundle-SymbolicName: org.eclipse.emf.cdo.tests; singleton:=true Bundle-Version: 1.0.0.qualifier Bundle-Activator: org.eclipse.emf.cdo.tests.CDOTestPlugin Bundle-ClassPath: cdo.tests.jar Bundle-Vendor: %providerName Bundle-Localization: plugin -Eclipse-LazyStart: false -Export-Package: org.eclipse.emf.cdo.tests +Eclipse-LazyStart: true Require-Bundle: org.eclipse.core.runtime, org.junit, - org.eclipse.emf.cdo.core, - org.eclipse.net4j.core + org.eclipse.emf.cdo.client, + org.eclipse.emf.cdo.server, + org.eclipse.net4j.embedded, + org.eclipse.net4j.socket diff --git a/plugins/org.eclipse.emf.cdo.tests/META-INF/cdo/client/cdo-client.properties b/plugins/org.eclipse.emf.cdo.tests/META-INF/cdo/client/cdo-client.properties new file mode 100644 index 0000000000..2a939aac7d --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests/META-INF/cdo/client/cdo-client.properties @@ -0,0 +1,4 @@ +connector.host=localhost +connector.port=2036 +#connector.userName=test +#connector.password=test diff --git a/plugins/org.eclipse.emf.cdo.tests/META-INF/cdo/client/cdo-client.xml b/plugins/org.eclipse.emf.cdo.tests/META-INF/cdo/client/cdo-client.xml new file mode 100644 index 0000000000..9fd8a554fc --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests/META-INF/cdo/client/cdo-client.xml @@ -0,0 +1,65 @@ + + + + + + + + + plugin:/META-INF/cdo/client/cdo-client.properties + + + + + + + + 48 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/org.eclipse.emf.cdo.tests/META-INF/cdo/server/cdo-server.properties b/plugins/org.eclipse.emf.cdo.tests/META-INF/cdo/server/cdo-server.properties new file mode 100644 index 0000000000..08a63f3604 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests/META-INF/cdo/server/cdo-server.properties @@ -0,0 +1,55 @@ +################### +# JDBC PROPERTIES # +################### + + +######### +# DERBY # +######### + +#jdbc.dialect=DERBY +#jdbc.driver=org.apache.derby.jdbc.EmbeddedDriver +#jdbc.url=jdbc:derby:cdoTest;create=true +#jdbc.username=test +#jdbc.password=test + +########## +# HSQLDB # +########## + +jdbc.dialect=HSQLDB +jdbc.driver=org.hsqldb.jdbcDriver +jdbc.url=jdbc:hsqldb:. +jdbc.username=sa +jdbc.password= + +######### +# MYSQL # +######### + +#jdbc.dialect=MYSQL +#jdbc.driver=org.gjt.mm.mysql.Driver +#jdbc.url=jdbc:mysql://localhost/cdoTest +#jdbc.username=test +#jdbc.password=test + +########## +# ORACLE # +########## + +#jdbc.dialect=oracle +#jdbc.driver= +#jdbc.url= +#jdbc.username= +#jdbc.password= + +######### +# MIMER # +######### + +#jdbc.dialect=mimer +#jdbc.driver= +#jdbc.url= +#jdbc.username= +#jdbc.password= + diff --git a/plugins/org.eclipse.emf.cdo.tests/META-INF/cdo/server/cdo-server.xml b/plugins/org.eclipse.emf.cdo.tests/META-INF/cdo/server/cdo-server.xml new file mode 100644 index 0000000000..3250abb304 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests/META-INF/cdo/server/cdo-server.xml @@ -0,0 +1,126 @@ + + + + + + + + + plugin:/META-INF/cdo/server/cdo-server.properties + + + + + + + + 48 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${jdbc.driver} + + + ${jdbc.url} + + + ${jdbc.username} + + + ${jdbc.password} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${jdbc.dialect} + + + + diff --git a/plugins/org.eclipse.emf.cdo.tests/META-INF/net4j/client/net4j-client.properties b/plugins/org.eclipse.emf.cdo.tests/META-INF/net4j/client/net4j-client.properties new file mode 100644 index 0000000000..b3dd5ff1c3 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests/META-INF/net4j/client/net4j-client.properties @@ -0,0 +1,3 @@ +# Connection +connector.host=localhost +connector.port=2036 \ No newline at end of file diff --git a/plugins/org.eclipse.emf.cdo.tests/META-INF/net4j/client/net4j-client.xml b/plugins/org.eclipse.emf.cdo.tests/META-INF/net4j/client/net4j-client.xml new file mode 100644 index 0000000000..0351e76597 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests/META-INF/net4j/client/net4j-client.xml @@ -0,0 +1,42 @@ + + + + + + + + + plugin:/META-INF/net4j/client/net4j-client.properties + + + + + + + + + + + + + + + + + + + + + + + + ${connector.host} + + + ${connector.port} + + + + diff --git a/plugins/org.eclipse.emf.cdo.tests/META-INF/net4j/embedded/net4j-embedded.properties b/plugins/org.eclipse.emf.cdo.tests/META-INF/net4j/embedded/net4j-embedded.properties new file mode 100644 index 0000000000..c5cac7c15c --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests/META-INF/net4j/embedded/net4j-embedded.properties @@ -0,0 +1,14 @@ +# Service +acceptor.listenAddr=0.0.0.0 +acceptor.listenPort=2036 + +# Authentication +passiveNegotiator.algorithmName=PBEWithMD5AndDES +passiveNegotiator.tokenLength=128 +auth.users.file=plugin:/META-INF/auth.users + +# Internal +randomizer.algorithm=SHA1PRNG +bufferPool.bufferSize=4096 +channel.responseTimeoutMillis=250000 +connectionManager.maxConnections=50 diff --git a/plugins/org.eclipse.emf.cdo.tests/META-INF/net4j/embedded/net4j-embedded.xml b/plugins/org.eclipse.emf.cdo.tests/META-INF/net4j/embedded/net4j-embedded.xml new file mode 100644 index 0000000000..19e5527540 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests/META-INF/net4j/embedded/net4j-embedded.xml @@ -0,0 +1,47 @@ + + + + + + + + + plugin:/META-INF/net4j/embedded/net4j-embedded.properties + + + + + + + + + + + + + + + + + + + + + + ${connectionManager.maxConnections} + + + + + + + false + + + + diff --git a/plugins/org.eclipse.emf.cdo.tests/META-INF/net4j/net4j.properties b/plugins/org.eclipse.emf.cdo.tests/META-INF/net4j/net4j.properties new file mode 100644 index 0000000000..3d2f81ba85 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests/META-INF/net4j/net4j.properties @@ -0,0 +1,4 @@ +# Internal +randomizer.algorithm=SHA1PRNG +bufferPool.bufferSize=4096 +channel.responseTimeoutMillis=250000 diff --git a/plugins/org.eclipse.emf.cdo.tests/META-INF/net4j/net4j.xml b/plugins/org.eclipse.emf.cdo.tests/META-INF/net4j/net4j.xml new file mode 100644 index 0000000000..882e28aea7 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests/META-INF/net4j/net4j.xml @@ -0,0 +1,63 @@ + + + + + + + + + plugin:/META-INF/net4j/net4j.properties + + + + + + + + ${randomizer.algorithm} + + + + + + + ${bufferPool.bufferSize} + + + + + + + + + + + + + + + + ${channel.responseTimeoutMillis} + + + + + + + + + + + + + + + + + diff --git a/plugins/org.eclipse.emf.cdo.tests/META-INF/net4j/server/auth.users b/plugins/org.eclipse.emf.cdo.tests/META-INF/net4j/server/auth.users new file mode 100644 index 0000000000..38fac2f997 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests/META-INF/net4j/server/auth.users @@ -0,0 +1 @@ +test=test diff --git a/plugins/org.eclipse.emf.cdo.tests/META-INF/net4j/server/net4j-server.properties b/plugins/org.eclipse.emf.cdo.tests/META-INF/net4j/server/net4j-server.properties new file mode 100644 index 0000000000..19955f023c --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests/META-INF/net4j/server/net4j-server.properties @@ -0,0 +1,11 @@ +# Service +acceptor.listenAddr=0.0.0.0 +acceptor.listenPort=2036 + +# Authentication +passiveNegotiator.algorithmName=PBEWithMD5AndDES +passiveNegotiator.tokenLength=128 +auth.users.file=plugin:/META-INF/net4j/server/auth.users + +# Internal +connectionManager.maxConnections=50 diff --git a/plugins/org.eclipse.emf.cdo.tests/META-INF/net4j/server/net4j-server.xml b/plugins/org.eclipse.emf.cdo.tests/META-INF/net4j/server/net4j-server.xml new file mode 100644 index 0000000000..82dcff5053 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests/META-INF/net4j/server/net4j-server.xml @@ -0,0 +1,62 @@ + + + + + + + + + plugin:/META-INF/net4j/server/net4j-server.properties + + + + + + + + + + + + + + + ${connectionManager.maxConnections} + + + + + + + ${acceptor.listenAddr} + + + ${acceptor.listenPort} + + + false + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/org.eclipse.emf.cdo.tests/build.properties b/plugins/org.eclipse.emf.cdo.tests/build.properties index 3b39ee8e84..1ccdf67dbc 100644 --- a/plugins/org.eclipse.emf.cdo.tests/build.properties +++ b/plugins/org.eclipse.emf.cdo.tests/build.properties @@ -8,12 +8,12 @@ bin.includes = plugin.xml,\ test.xml,\ META-INF/,\ epl-v10.html,\ - lib/,\ cdo.tests.jar,\ copyright.txt,\ about.html,\ plugin.properties,\ - license.html + license.html,\ + model/ jars.compile.order = cdo.tests.jar source.cdo.tests.jar = src/ output.cdo.tests.jar = bin/ diff --git a/plugins/org.eclipse.emf.cdo.tests/launches/IntegrationTest.launch b/plugins/org.eclipse.emf.cdo.tests/launches/IntegrationTest.launch new file mode 100644 index 0000000000..00b80d3d8e --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests/launches/IntegrationTest.launch @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/org.eclipse.emf.cdo.tests/lib/.cvsignore b/plugins/org.eclipse.emf.cdo.tests/lib/.cvsignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/plugins/org.eclipse.emf.cdo.tests/model/TestModel1.ecore b/plugins/org.eclipse.emf.cdo.tests/model/TestModel1.ecore new file mode 100644 index 0000000000..586af7c08e --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests/model/TestModel1.ecore @@ -0,0 +1,17 @@ + + + + + + + + + + + diff --git a/plugins/org.eclipse.emf.cdo.tests/model/TestModel1.genmodel b/plugins/org.eclipse.emf.cdo.tests/model/TestModel1.genmodel new file mode 100644 index 0000000000..f394e468a5 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests/model/TestModel1.genmodel @@ -0,0 +1,21 @@ + + + TestModel1.ecore + + + + + + + + + + + diff --git a/plugins/org.eclipse.emf.cdo.tests/plugin.properties b/plugins/org.eclipse.emf.cdo.tests/plugin.properties index f74040e4e2..8b30f2f587 100644 --- a/plugins/org.eclipse.emf.cdo.tests/plugin.properties +++ b/plugins/org.eclipse.emf.cdo.tests/plugin.properties @@ -1,2 +1,4 @@ pluginName = CDO Tests providerName = Eclipse.org +# ==================================================================== + diff --git a/plugins/org.eclipse.emf.cdo.tests/plugin.xml b/plugins/org.eclipse.emf.cdo.tests/plugin.xml index 8e49b52120..586d2ae9f0 100644 --- a/plugins/org.eclipse.emf.cdo.tests/plugin.xml +++ b/plugins/org.eclipse.emf.cdo.tests/plugin.xml @@ -1,5 +1,20 @@ + + + + + + + + + + diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AbstractIntegrationTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AbstractIntegrationTest.java new file mode 100644 index 0000000000..4522edaea2 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AbstractIntegrationTest.java @@ -0,0 +1,83 @@ +/*************************************************************************** + * Copyright (c) 2004, 2005, 2006 Eike Stepper, Fuggerstr. 39, 10777 Berlin, Germany. + * 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 + **************************************************************************/ +package org.eclipse.emf.cdo.tests; + + +import org.eclipse.emf.cdo.client.ResourceManager; + +import org.eclipse.emf.ecore.resource.ResourceSet; + +import junit.framework.TestCase; + + +public class AbstractIntegrationTest extends TestCase +{ + public static final String CLIENT_SEPARATED_SERVER_MODE = "client-separated-server"; + + public static final String CLIENT_SERVER_MODE = "client-server"; + + public static final String CLIENT_MODE = "client"; + + public static final String EMBEDDED_MODE = "embedded"; + + private ITopology topology; + + @Override + protected void setUp() throws Exception + { + super.setUp(); + topology = createTopology(); + topology.start(); + } + + @Override + protected void tearDown() throws Exception + { + topology.stop(); + super.tearDown(); + } + + protected ResourceManager createResourceManager(ResourceSet resourceSet) + { + return topology.createResourceManager(resourceSet); + } + + protected ITopology createTopology() + { + String mode = getMode(); + if (EMBEDDED_MODE.equals(mode)) + { + return new EmbeddedTopology(); + } + + if (CLIENT_MODE.equals(mode)) + { + return new ClientTopology(); + } + + if (CLIENT_SERVER_MODE.equals(mode)) + { + return new ClientServerTopology(); + } + + if (CLIENT_SEPARATED_SERVER_MODE.equals(mode)) + { + return new ClientSeparatedServerTopology(); + } + + return null; + } + + protected String getMode() + { + return System.getProperty("cdo.test.mode", EMBEDDED_MODE).toLowerCase(); + } +} diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AbstractTopology.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AbstractTopology.java new file mode 100644 index 0000000000..a164f47ca3 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AbstractTopology.java @@ -0,0 +1,91 @@ +/*************************************************************************** + * Copyright (c) 2004, 2005, 2006 Eike Stepper, Fuggerstr. 39, 10777 Berlin, Germany. + * 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 + **************************************************************************/ +package org.eclipse.emf.cdo.tests; + + +import org.eclipse.emf.cdo.client.ResourceManager; + +import org.eclipse.emf.ecore.resource.ResourceSet; + +import org.eclipse.core.runtime.FileLocator; +import org.eclipse.net4j.spring.Container; +import org.eclipse.net4j.spring.impl.ContainerImpl; + +import org.osgi.framework.Bundle; + +import java.net.URL; + + +public abstract class AbstractTopology implements ITopology +{ + protected static final String NET4J_LOCATION = "META-INF/net4j/net4j.xml"; + + protected static final String NET4J_CLIENT_LOCATION = "META-INF/net4j/client/net4j-client.xml"; + + protected static final String NET4J_SERVER_LOCATION = "META-INF/net4j/server/net4j-server.xml"; + + protected static final String NET4J_EMBEDDED_LOCATION = "META-INF/net4j/embedded/net4j-embedded.xml"; + + protected static final String CDO_CLIENT_LOCATION = "META-INF/cdo/client/cdo-client.xml"; + + protected static final String CDO_SERVER_LOCATION = "META-INF/cdo/server/cdo-server.xml"; + + private String bundleLocation; + + private Container cdoClient; + + protected AbstractTopology() + { + } + + public void start() throws Exception + { + CDOTestPlugin plugin = CDOTestPlugin.getPlugin(); + Bundle bundle = plugin.getBundle(); + URL url = bundle.getEntry("/"); + bundleLocation = FileLocator.toFileURL(url).getFile(); + } + + public void stop() throws Exception + { + cdoClient.stop(); + cdoClient = null; + } + + public ResourceManager createResourceManager(ResourceSet resourceSet) + { + ResourceManager resourceManager = (ResourceManager) cdoClient.getBean("resourceManager"); + resourceManager.setResourceSet(resourceSet); + + try + { + resourceManager.start(); + } + catch (Exception ex) + { + ex.printStackTrace(); + return null; + } + + return resourceManager; + } + + protected void createCDOClient(String name, Container parent) + { + cdoClient = createContainer(name, CDO_CLIENT_LOCATION, parent); + } + + protected ContainerImpl createContainer(String name, String location, Container parent) + { + return new ContainerImpl(bundleLocation, location, name, parent, CDOTestPlugin.class + .getClassLoader()); + } +} diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllSuites.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllSuites.java index 96cecc395b..354db0b6fd 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllSuites.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllSuites.java @@ -1,20 +1,13 @@ -/** - * - * - * Copyright (c) 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials +/*************************************************************************** + * Copyright (c) 2004, 2005, 2006 Eike Stepper, Fuggerstr. 39, 10777 Berlin, Germany. + * 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: - * IBM - Initial API and implementation - * - * - * - * $Id: AllSuites.java,v 1.1 2006-05-29 23:06:29 nickb Exp $ - */ - + * Eike Stepper - initial API and implementation + **************************************************************************/ package org.eclipse.emf.cdo.tests; @@ -58,4 +51,4 @@ public class AllSuites extends TestSuite addTest(suites[i]); } } -} \ No newline at end of file +} diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllTests.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllTests.java index 5defe0c0b0..1b7df5c3c0 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllTests.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllTests.java @@ -1,3 +1,13 @@ +/*************************************************************************** + * Copyright (c) 2004, 2005, 2006 Eike Stepper, Fuggerstr. 39, 10777 Berlin, Germany. + * 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 + **************************************************************************/ package org.eclipse.emf.cdo.tests; diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/CDOTestPlugin.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/CDOTestPlugin.java index 83b472d937..2cc51f1173 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/CDOTestPlugin.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/CDOTestPlugin.java @@ -1,36 +1,31 @@ -/** - * - * - * Copyright (c) 2002-2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials +/*************************************************************************** + * Copyright (c) 2004, 2005, 2006 Eike Stepper, Fuggerstr. 39, 10777 Berlin, Germany. + * 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: - * IBM - Initial API and implementation - * - * - * - * $Id: CDOTestPlugin.java,v 1.1 2006-05-29 23:06:29 nickb Exp $ - */ + * Eike Stepper - initial API and implementation + **************************************************************************/ package org.eclipse.emf.cdo.tests; -import org.eclipse.core.runtime.Plugin; -public class CDOTestPlugin -extends Plugin +import org.eclipse.net4j.util.eclipse.AbstractPlugin; + + +public class CDOTestPlugin extends AbstractPlugin { - private static CDOTestPlugin instance; - - public CDOTestPlugin() - { - super(); - instance = this; - } + private static CDOTestPlugin instance; + + public CDOTestPlugin() + { + super(); + instance = this; + } - public static CDOTestPlugin getPlugin() - { - return instance; - } + public static CDOTestPlugin getPlugin() + { + return instance; + } } diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ClientSeparatedServerTopology.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ClientSeparatedServerTopology.java new file mode 100644 index 0000000000..d2fd35a30d --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ClientSeparatedServerTopology.java @@ -0,0 +1,70 @@ +/*************************************************************************** + * Copyright (c) 2004, 2005, 2006 Eike Stepper, Fuggerstr. 39, 10777 Berlin, Germany. + * 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 + **************************************************************************/ +package org.eclipse.emf.cdo.tests; + + +import org.eclipse.net4j.core.Acceptor; +import org.eclipse.net4j.spring.Container; + + +public class ClientSeparatedServerTopology extends AbstractTopology +{ + private Container serverNet4j; + + private Container net4jServer; + + private Container cdoServer; + + private Container clientNet4j; + + private Container net4jClient; + + private Acceptor acceptor; + + public ClientSeparatedServerTopology() + { + } + + public void start() throws Exception + { + super.start(); + + // Start server + serverNet4j = createContainer("net4j", NET4J_LOCATION, null); + net4jServer = createContainer("server", NET4J_SERVER_LOCATION, serverNet4j); + cdoServer = createContainer("cdo", CDO_SERVER_LOCATION, net4jServer); + + acceptor = (Acceptor) cdoServer.getBean("acceptor", Acceptor.class); + acceptor.start(); + + // Start client + clientNet4j = createContainer("net4j", NET4J_LOCATION, null); + net4jClient = createContainer("client", NET4J_CLIENT_LOCATION, clientNet4j); + createCDOClient("cdo", net4jClient); + } + + public void stop() throws Exception + { + super.stop(); + + //Stop client + net4jClient.stop(); + clientNet4j.stop(); + + //Stop server + acceptor.stop(); + acceptor = null; + + cdoServer.stop(); + net4jServer.stop(); + serverNet4j.stop(); + } +} diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ClientServerTopology.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ClientServerTopology.java new file mode 100644 index 0000000000..67e5bdb7ad --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ClientServerTopology.java @@ -0,0 +1,67 @@ +/*************************************************************************** + * Copyright (c) 2004, 2005, 2006 Eike Stepper, Fuggerstr. 39, 10777 Berlin, Germany. + * 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 + **************************************************************************/ +package org.eclipse.emf.cdo.tests; + + +import org.eclipse.net4j.core.Acceptor; +import org.eclipse.net4j.spring.Container; + + +public class ClientServerTopology extends AbstractTopology +{ + private Container net4j; + + private Container net4jServer; + + private Container cdoServer; + + private Container net4jClient; + + private Acceptor acceptor; + + public ClientServerTopology() + { + } + + public void start() throws Exception + { + super.start(); + net4j = createContainer("net4j", NET4J_LOCATION, null); + + // Start server + net4jServer = createContainer("server", NET4J_SERVER_LOCATION, net4j); + cdoServer = createContainer("cdo", CDO_SERVER_LOCATION, net4jServer); + + acceptor = (Acceptor) cdoServer.getBean("acceptor", Acceptor.class); + acceptor.start(); + + // Start client + net4jClient = createContainer("client", NET4J_CLIENT_LOCATION, net4j); + createCDOClient("cdo", net4jClient); + } + + public void stop() throws Exception + { + super.stop(); + + //Stop client + net4jClient.stop(); + + //Stop server + acceptor.stop(); + acceptor = null; + + cdoServer.stop(); + net4jServer.stop(); + + net4j.stop(); + } +} diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ClientTopology.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ClientTopology.java new file mode 100644 index 0000000000..ad0e93989c --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ClientTopology.java @@ -0,0 +1,27 @@ +/*************************************************************************** + * Copyright (c) 2004, 2005, 2006 Eike Stepper, Fuggerstr. 39, 10777 Berlin, Germany. + * 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 + **************************************************************************/ +package org.eclipse.emf.cdo.tests; + + +public class ClientTopology extends AbstractTopology +{ + public ClientTopology() + { + } + + public void start() throws Exception + { + } + + public void stop() throws Exception + { + } +} diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/EmbeddedTopology.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/EmbeddedTopology.java new file mode 100644 index 0000000000..2ed0a899cd --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/EmbeddedTopology.java @@ -0,0 +1,27 @@ +/*************************************************************************** + * Copyright (c) 2004, 2005, 2006 Eike Stepper, Fuggerstr. 39, 10777 Berlin, Germany. + * 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 + **************************************************************************/ +package org.eclipse.emf.cdo.tests; + + +public class EmbeddedTopology extends AbstractTopology +{ + public EmbeddedTopology() + { + } + + public void start() throws Exception + { + } + + public void stop() throws Exception + { + } +} diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ITopology.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ITopology.java new file mode 100644 index 0000000000..61b5e7ac06 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ITopology.java @@ -0,0 +1,26 @@ +/*************************************************************************** + * Copyright (c) 2004, 2005, 2006 Eike Stepper, Fuggerstr. 39, 10777 Berlin, Germany. + * 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 + **************************************************************************/ +package org.eclipse.emf.cdo.tests; + + +import org.eclipse.emf.cdo.client.ResourceManager; + +import org.eclipse.emf.ecore.resource.ResourceSet; + + +public interface ITopology +{ + public void start() throws Exception; + + public void stop() throws Exception; + + public ResourceManager createResourceManager(ResourceSet resourceSet); +} diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/IntegrationTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/IntegrationTest.java new file mode 100644 index 0000000000..702294f841 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/IntegrationTest.java @@ -0,0 +1,62 @@ +/*************************************************************************** + * Copyright (c) 2004, 2005, 2006 Eike Stepper, Fuggerstr. 39, 10777 Berlin, Germany. + * 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 + **************************************************************************/ +package org.eclipse.emf.cdo.tests; + + +import org.eclipse.emf.cdo.client.CDOResource; +import org.eclipse.emf.cdo.client.ResourceManager; + +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; + +import testmodel1.TestModel1Factory; +import testmodel1.TreeNode; + +import java.util.Arrays; + + +public class IntegrationTest extends AbstractIntegrationTest +{ + public void testSimple() throws Exception + { + ResourceSet resourceSet = new ResourceSetImpl(); + ResourceManager resourceManager = createResourceManager(resourceSet); + + CDOResource resource = (CDOResource) resourceSet.createResource(URI + .createURI("cdo:///test/res1")); + + TreeNode node0 = createNode("node0", null); + TreeNode node1 = createNode("node1", node0); + TreeNode node2 = createNode("node2", node0); + TreeNode node3 = createNode("node3", node0); + + resource.getContents().add(node0); + resourceManager.commit(); + resourceManager.stop(); + + } + + protected TreeNode createNode(String name, TreeNode parent) + { + TreeNode node = TestModel1Factory.eINSTANCE.createTreeNode(); + node.setStringFeature(name); + node.setParent(parent); + return node; + } + + protected TreeNode createNode(String name, TreeNode parent, TreeNode[] references) + { + TreeNode node = createNode(name, parent); + node.getReferences().add(Arrays.asList(references)); + return node; + } +} diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/SampleTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/SampleTest.java index e91d717e6a..dc691c8264 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/SampleTest.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/SampleTest.java @@ -1,3 +1,13 @@ +/*************************************************************************** + * Copyright (c) 2004, 2005, 2006 Eike Stepper, Fuggerstr. 39, 10777 Berlin, Germany. + * 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 + **************************************************************************/ package org.eclipse.emf.cdo.tests; import junit.framework.TestCase; diff --git a/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/TestModel1Factory.java b/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/TestModel1Factory.java new file mode 100644 index 0000000000..a2254ecfcc --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/TestModel1Factory.java @@ -0,0 +1,49 @@ +/** + * + * + * + * $Id$ + */ +package testmodel1; + + +import org.eclipse.emf.ecore.EFactory; + + +/** + * + * The Factory for the model. + * It provides a create method for each non-abstract class of the model. + * + * @see testmodel1.TestModel1Package + * @generated + */ +public interface TestModel1Factory extends EFactory +{ + /** + * The singleton instance of the factory. + * + * + * @generated + */ + TestModel1Factory eINSTANCE = testmodel1.impl.TestModel1FactoryImpl.init(); + + /** + * Returns a new object of class 'Tree Node'. + * + * + * @return a new object of class 'Tree Node'. + * @generated + */ + TreeNode createTreeNode(); + + /** + * Returns the package supported by this factory. + * + * + * @return the package supported by this factory. + * @generated + */ + TestModel1Package getTestModel1Package(); + +} //TestModel1Factory diff --git a/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/TestModel1Package.java b/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/TestModel1Package.java new file mode 100644 index 0000000000..35c5fee80a --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/TestModel1Package.java @@ -0,0 +1,300 @@ +/** + * + * + * + * $Id$ + */ +package testmodel1; + + +import org.eclipse.emf.cdo.client.CDOPackage; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; + + +/** + * + * The Package for the model. + * It contains accessors for the meta objects to represent + * + * + * @see testmodel1.TestModel1Factory + * @model kind="package" + * @generated + */ +public interface TestModel1Package extends EPackage +{ + /** + * The package name. + * + * + * @generated + */ + String eNAME = "testmodel1"; + + /** + * The package namespace URI. + * + * + * @generated + */ + String eNS_URI = "http://www.eclipse.org/emf/cdo/2006/TestModel1"; + + /** + * The package namespace name. + * + * + * @generated + */ + String eNS_PREFIX = "testmodel1"; + + /** + * The singleton instance of the package. + * + * + * @generated + */ + TestModel1Package eINSTANCE = testmodel1.impl.TestModel1PackageImpl.init(); + + /** + * The meta object id for the '{@link testmodel1.impl.TreeNodeImpl Tree Node}' class. + * + * + * @see testmodel1.impl.TreeNodeImpl + * @see testmodel1.impl.TestModel1PackageImpl#getTreeNode() + * @generated + */ + int TREE_NODE = 0; + + /** + * The feature id for the 'Parent' container reference. + * + * + * @generated + * @ordered + */ + int TREE_NODE__PARENT = CDOPackage.CDO_PERSISTENT_FEATURE_COUNT + 0; + + /** + * The feature id for the 'Children' containment reference list. + * + * + * @generated + * @ordered + */ + int TREE_NODE__CHILDREN = CDOPackage.CDO_PERSISTENT_FEATURE_COUNT + 1; + + /** + * The feature id for the 'References' reference list. + * + * + * @generated + * @ordered + */ + int TREE_NODE__REFERENCES = CDOPackage.CDO_PERSISTENT_FEATURE_COUNT + 2; + + /** + * The feature id for the 'Boolean Feature' attribute. + * + * + * @generated + * @ordered + */ + int TREE_NODE__BOOLEAN_FEATURE = CDOPackage.CDO_PERSISTENT_FEATURE_COUNT + 3; + + /** + * The feature id for the 'Int Feature' attribute. + * + * + * @generated + * @ordered + */ + int TREE_NODE__INT_FEATURE = CDOPackage.CDO_PERSISTENT_FEATURE_COUNT + 4; + + /** + * The feature id for the 'String Feature' attribute. + * + * + * @generated + * @ordered + */ + int TREE_NODE__STRING_FEATURE = CDOPackage.CDO_PERSISTENT_FEATURE_COUNT + 5; + + /** + * The number of structural features of the 'Tree Node' class. + * + * + * @generated + * @ordered + */ + int TREE_NODE_FEATURE_COUNT = CDOPackage.CDO_PERSISTENT_FEATURE_COUNT + 6; + + /** + * Returns the meta object for class '{@link testmodel1.TreeNode Tree Node}'. + * + * + * @return the meta object for class 'Tree Node'. + * @see testmodel1.TreeNode + * @generated + */ + EClass getTreeNode(); + + /** + * Returns the meta object for the container reference '{@link testmodel1.TreeNode#getParent Parent}'. + * + * + * @return the meta object for the container reference 'Parent'. + * @see testmodel1.TreeNode#getParent() + * @see #getTreeNode() + * @generated + */ + EReference getTreeNode_Parent(); + + /** + * Returns the meta object for the containment reference list '{@link testmodel1.TreeNode#getChildren Children}'. + * + * + * @return the meta object for the containment reference list 'Children'. + * @see testmodel1.TreeNode#getChildren() + * @see #getTreeNode() + * @generated + */ + EReference getTreeNode_Children(); + + /** + * Returns the meta object for the reference list '{@link testmodel1.TreeNode#getReferences References}'. + * + * + * @return the meta object for the reference list 'References'. + * @see testmodel1.TreeNode#getReferences() + * @see #getTreeNode() + * @generated + */ + EReference getTreeNode_References(); + + /** + * Returns the meta object for the attribute '{@link testmodel1.TreeNode#isBooleanFeature Boolean Feature}'. + * + * + * @return the meta object for the attribute 'Boolean Feature'. + * @see testmodel1.TreeNode#isBooleanFeature() + * @see #getTreeNode() + * @generated + */ + EAttribute getTreeNode_BooleanFeature(); + + /** + * Returns the meta object for the attribute '{@link testmodel1.TreeNode#getIntFeature Int Feature}'. + * + * + * @return the meta object for the attribute 'Int Feature'. + * @see testmodel1.TreeNode#getIntFeature() + * @see #getTreeNode() + * @generated + */ + EAttribute getTreeNode_IntFeature(); + + /** + * Returns the meta object for the attribute '{@link testmodel1.TreeNode#getStringFeature String Feature}'. + * + * + * @return the meta object for the attribute 'String Feature'. + * @see testmodel1.TreeNode#getStringFeature() + * @see #getTreeNode() + * @generated + */ + EAttribute getTreeNode_StringFeature(); + + /** + * Returns the factory that creates the instances of the model. + * + * + * @return the factory that creates the instances of the model. + * @generated + */ + TestModel1Factory getTestModel1Factory(); + + + /** + * + * Defines literals for the meta objects that represent + * + * + * @generated + */ + interface Literals + { + /** + * The meta object literal for the '{@link testmodel1.impl.TreeNodeImpl Tree Node}' class. + * + * + * @see testmodel1.impl.TreeNodeImpl + * @see testmodel1.impl.TestModel1PackageImpl#getTreeNode() + * @generated + */ + EClass TREE_NODE = eINSTANCE.getTreeNode(); + + /** + * The meta object literal for the 'Parent' container reference feature. + * + * + * @generated + */ + EReference TREE_NODE__PARENT = eINSTANCE.getTreeNode_Parent(); + + /** + * The meta object literal for the 'Children' containment reference list feature. + * + * + * @generated + */ + EReference TREE_NODE__CHILDREN = eINSTANCE.getTreeNode_Children(); + + /** + * The meta object literal for the 'References' reference list feature. + * + * + * @generated + */ + EReference TREE_NODE__REFERENCES = eINSTANCE.getTreeNode_References(); + + /** + * The meta object literal for the 'Boolean Feature' attribute feature. + * + * + * @generated + */ + EAttribute TREE_NODE__BOOLEAN_FEATURE = eINSTANCE.getTreeNode_BooleanFeature(); + + /** + * The meta object literal for the 'Int Feature' attribute feature. + * + * + * @generated + */ + EAttribute TREE_NODE__INT_FEATURE = eINSTANCE.getTreeNode_IntFeature(); + + /** + * The meta object literal for the 'String Feature' attribute feature. + * + * + * @generated + */ + EAttribute TREE_NODE__STRING_FEATURE = eINSTANCE.getTreeNode_StringFeature(); + + } + +} //TestModel1Package diff --git a/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/TreeNode.java b/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/TreeNode.java new file mode 100644 index 0000000000..95e0fb5eeb --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/TreeNode.java @@ -0,0 +1,180 @@ +/** + * + * + * + * $Id$ + */ +package testmodel1; + + +import org.eclipse.emf.cdo.client.CDOPersistent; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EObject; + + +/** + * + * A representation of the model object 'Tree Node'. + * + * + *

+ * The following features are supported: + *

+ *

+ * + * @see testmodel1.TestModel1Package#getTreeNode() + * @model + * @generated + */ +public interface TreeNode extends CDOPersistent +{ + /** + * Returns the value of the 'Parent' container reference. + * It is bidirectional and its opposite is '{@link testmodel1.TreeNode#getChildren Children}'. + * + *

+ * If the meaning of the 'Parent' container reference isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Parent' container reference. + * @see #setParent(TreeNode) + * @see testmodel1.TestModel1Package#getTreeNode_Parent() + * @see testmodel1.TreeNode#getChildren + * @model opposite="children" + * @generated + */ + TreeNode getParent(); + + /** + * Sets the value of the '{@link testmodel1.TreeNode#getParent Parent}' container reference. + * + * + * @param value the new value of the 'Parent' container reference. + * @see #getParent() + * @generated + */ + void setParent(TreeNode value); + + /** + * Returns the value of the 'Children' containment reference list. + * The list contents are of type {@link testmodel1.TreeNode}. + * It is bidirectional and its opposite is '{@link testmodel1.TreeNode#getParent Parent}'. + * + *

+ * If the meaning of the 'Children' containment reference list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Children' containment reference list. + * @see testmodel1.TestModel1Package#getTreeNode_Children() + * @see testmodel1.TreeNode#getParent + * @model type="testmodel1.TreeNode" opposite="parent" containment="true" + * @generated + */ + EList getChildren(); + + /** + * Returns the value of the 'References' reference list. + * The list contents are of type {@link testmodel1.TreeNode}. + * + *

+ * If the meaning of the 'References' reference list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'References' reference list. + * @see testmodel1.TestModel1Package#getTreeNode_References() + * @model type="testmodel1.TreeNode" + * @generated + */ + EList getReferences(); + + /** + * Returns the value of the 'Boolean Feature' attribute. + * + *

+ * If the meaning of the 'Boolean Feature' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Boolean Feature' attribute. + * @see #setBooleanFeature(boolean) + * @see testmodel1.TestModel1Package#getTreeNode_BooleanFeature() + * @model + * @generated + */ + boolean isBooleanFeature(); + + /** + * Sets the value of the '{@link testmodel1.TreeNode#isBooleanFeature Boolean Feature}' attribute. + * + * + * @param value the new value of the 'Boolean Feature' attribute. + * @see #isBooleanFeature() + * @generated + */ + void setBooleanFeature(boolean value); + + /** + * Returns the value of the 'Int Feature' attribute. + * + *

+ * If the meaning of the 'Int Feature' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Int Feature' attribute. + * @see #setIntFeature(int) + * @see testmodel1.TestModel1Package#getTreeNode_IntFeature() + * @model + * @generated + */ + int getIntFeature(); + + /** + * Sets the value of the '{@link testmodel1.TreeNode#getIntFeature Int Feature}' attribute. + * + * + * @param value the new value of the 'Int Feature' attribute. + * @see #getIntFeature() + * @generated + */ + void setIntFeature(int value); + + /** + * Returns the value of the 'String Feature' attribute. + * + *

+ * If the meaning of the 'String Feature' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'String Feature' attribute. + * @see #setStringFeature(String) + * @see testmodel1.TestModel1Package#getTreeNode_StringFeature() + * @model + * @generated + */ + String getStringFeature(); + + /** + * Sets the value of the '{@link testmodel1.TreeNode#getStringFeature String Feature}' attribute. + * + * + * @param value the new value of the 'String Feature' attribute. + * @see #getStringFeature() + * @generated + */ + void setStringFeature(String value); + +} // TreeNode \ No newline at end of file diff --git a/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/impl/TestModel1FactoryImpl.java b/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/impl/TestModel1FactoryImpl.java new file mode 100644 index 0000000000..d3684d8b95 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/impl/TestModel1FactoryImpl.java @@ -0,0 +1,113 @@ +/** + * + * + * + * $Id$ + */ +package testmodel1.impl; + + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.impl.EFactoryImpl; + +import org.eclipse.emf.ecore.plugin.EcorePlugin; + +import testmodel1.*; + + +/** + * + * An implementation of the model Factory. + * + * @generated + */ +public class TestModel1FactoryImpl extends EFactoryImpl implements TestModel1Factory +{ + /** + * Creates the default factory implementation. + * + * + * @generated + */ + public static TestModel1Factory init() + { + try + { + TestModel1Factory theTestModel1Factory = (TestModel1Factory) EPackage.Registry.INSTANCE + .getEFactory("http://www.eclipse.org/emf/cdo/2006/TestModel1"); + if (theTestModel1Factory != null) + { + return theTestModel1Factory; + } + } + catch (Exception exception) + { + EcorePlugin.INSTANCE.log(exception); + } + return new TestModel1FactoryImpl(); + } + + /** + * Creates an instance of the factory. + * + * + * @generated + */ + public TestModel1FactoryImpl() + { + super(); + } + + /** + * + * + * @generated + */ + public EObject create(EClass eClass) + { + switch (eClass.getClassifierID()) + { + case TestModel1Package.TREE_NODE: + return createTreeNode(); + default: + throw new IllegalArgumentException("The class '" + eClass.getName() + + "' is not a valid classifier"); + } + } + + /** + * + * + * @generated + */ + public TreeNode createTreeNode() + { + TreeNodeImpl treeNode = new TreeNodeImpl(); + return treeNode; + } + + /** + * + * + * @generated + */ + public TestModel1Package getTestModel1Package() + { + return (TestModel1Package) getEPackage(); + } + + /** + * + * + * @deprecated + * @generated + */ + public static TestModel1Package getPackage() + { + return TestModel1Package.eINSTANCE; + } + +} //TestModel1FactoryImpl diff --git a/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/impl/TestModel1PackageImpl.java b/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/impl/TestModel1PackageImpl.java new file mode 100644 index 0000000000..d9b692e9eb --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/impl/TestModel1PackageImpl.java @@ -0,0 +1,281 @@ +/** + * + * + * + * $Id$ + */ +package testmodel1.impl; + + +import org.eclipse.emf.cdo.client.CDOPackage; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; + +import org.eclipse.emf.ecore.impl.EPackageImpl; + +import testmodel1.TestModel1Factory; +import testmodel1.TestModel1Package; +import testmodel1.TreeNode; + + +/** + * + * An implementation of the model Package. + * + * @generated + */ +public class TestModel1PackageImpl extends EPackageImpl implements TestModel1Package +{ + /** + * + * + * @generated + */ + private EClass treeNodeEClass = null; + + /** + * Creates an instance of the model Package, registered with + * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package + * package URI value. + *

Note: the correct way to create the package is via the static + * factory method {@link #init init()}, which also performs + * initialization of the package, or returns the registered package, + * if one already exists. + * + * + * @see org.eclipse.emf.ecore.EPackage.Registry + * @see testmodel1.TestModel1Package#eNS_URI + * @see #init() + * @generated + */ + private TestModel1PackageImpl() + { + super(eNS_URI, TestModel1Factory.eINSTANCE); + } + + /** + * + * + * @generated + */ + private static boolean isInited = false; + + /** + * Creates, registers, and initializes the Package for this + * model, and for any others upon which it depends. Simple + * dependencies are satisfied by calling this method on all + * dependent packages before doing anything else. This method drives + * initialization for interdependent packages directly, in parallel + * with this package, itself. + *

Of this package and its interdependencies, all packages which + * have not yet been registered by their URI values are first created + * and registered. The packages are then initialized in two steps: + * meta-model objects for all of the packages are created before any + * are initialized, since one package's meta-model objects may refer to + * those of another. + *

Invocation of this method will not affect any packages that have + * already been initialized. + * + * + * @see #eNS_URI + * @see #createPackageContents() + * @see #initializePackageContents() + * @generated + */ + public static TestModel1Package init() + { + if (isInited) + return (TestModel1Package) EPackage.Registry.INSTANCE.getEPackage(TestModel1Package.eNS_URI); + + // Obtain or create and register package + TestModel1PackageImpl theTestModel1Package = (TestModel1PackageImpl) (EPackage.Registry.INSTANCE + .getEPackage(eNS_URI) instanceof TestModel1PackageImpl ? EPackage.Registry.INSTANCE + .getEPackage(eNS_URI) : new TestModel1PackageImpl()); + + isInited = true; + + // Initialize simple dependencies + CDOPackage.eINSTANCE.eClass(); + + // Create package meta-data objects + theTestModel1Package.createPackageContents(); + + // Initialize created meta-data + theTestModel1Package.initializePackageContents(); + + // Mark meta-data to indicate it can't be changed + theTestModel1Package.freeze(); + + return theTestModel1Package; + } + + /** + * + * + * @generated + */ + public EClass getTreeNode() + { + return treeNodeEClass; + } + + /** + * + * + * @generated + */ + public EReference getTreeNode_Parent() + { + return (EReference) treeNodeEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EReference getTreeNode_Children() + { + return (EReference) treeNodeEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EReference getTreeNode_References() + { + return (EReference) treeNodeEClass.getEStructuralFeatures().get(2); + } + + /** + * + * + * @generated + */ + public EAttribute getTreeNode_BooleanFeature() + { + return (EAttribute) treeNodeEClass.getEStructuralFeatures().get(3); + } + + /** + * + * + * @generated + */ + public EAttribute getTreeNode_IntFeature() + { + return (EAttribute) treeNodeEClass.getEStructuralFeatures().get(4); + } + + /** + * + * + * @generated + */ + public EAttribute getTreeNode_StringFeature() + { + return (EAttribute) treeNodeEClass.getEStructuralFeatures().get(5); + } + + /** + * + * + * @generated + */ + public TestModel1Factory getTestModel1Factory() + { + return (TestModel1Factory) getEFactoryInstance(); + } + + /** + * + * + * @generated + */ + private boolean isCreated = false; + + /** + * Creates the meta-model objects for the package. This method is + * guarded to have no affect on any invocation but its first. + * + * + * @generated + */ + public void createPackageContents() + { + if (isCreated) return; + isCreated = true; + + // Create classes and their features + treeNodeEClass = createEClass(TREE_NODE); + createEReference(treeNodeEClass, TREE_NODE__PARENT); + createEReference(treeNodeEClass, TREE_NODE__CHILDREN); + createEReference(treeNodeEClass, TREE_NODE__REFERENCES); + createEAttribute(treeNodeEClass, TREE_NODE__BOOLEAN_FEATURE); + createEAttribute(treeNodeEClass, TREE_NODE__INT_FEATURE); + createEAttribute(treeNodeEClass, TREE_NODE__STRING_FEATURE); + } + + /** + * + * + * @generated + */ + private boolean isInitialized = false; + + /** + * Complete the initialization of the package and its meta-model. This + * method is guarded to have no affect on any invocation but its first. + * + * + * @generated + */ + public void initializePackageContents() + { + if (isInitialized) return; + isInitialized = true; + + // Initialize package + setName(eNAME); + setNsPrefix(eNS_PREFIX); + setNsURI(eNS_URI); + + // Obtain other dependent packages + CDOPackage theCDOPackage = (CDOPackage) EPackage.Registry.INSTANCE + .getEPackage(CDOPackage.eNS_URI); + + // Add supertypes to classes + treeNodeEClass.getESuperTypes().add(theCDOPackage.getCDOPersistent()); + + // Initialize classes and features; add operations and parameters + initEClass(treeNodeEClass, TreeNode.class, "TreeNode", !IS_ABSTRACT, !IS_INTERFACE, + IS_GENERATED_INSTANCE_CLASS); + initEReference(getTreeNode_Parent(), this.getTreeNode(), this.getTreeNode_Children(), "parent", + null, 0, 1, TreeNode.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, + !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getTreeNode_Children(), this.getTreeNode(), this.getTreeNode_Parent(), + "children", null, 0, -1, TreeNode.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, + IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getTreeNode_References(), this.getTreeNode(), null, "references", null, 0, -1, + TreeNode.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, + IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getTreeNode_BooleanFeature(), ecorePackage.getEBoolean(), "booleanFeature", + null, 0, 1, TreeNode.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, + !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getTreeNode_IntFeature(), ecorePackage.getEInt(), "intFeature", null, 0, 1, + TreeNode.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, + IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getTreeNode_StringFeature(), ecorePackage.getEString(), "stringFeature", null, + 0, 1, TreeNode.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, + IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + // Create resource + createResource(eNS_URI); + } + +} //TestModel1PackageImpl diff --git a/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/impl/TreeNodeImpl.java b/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/impl/TreeNodeImpl.java new file mode 100644 index 0000000000..4a084bd976 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/impl/TreeNodeImpl.java @@ -0,0 +1,511 @@ +/** + * + * + * + * $Id$ + */ +package testmodel1.impl; + + +import java.util.Collection; + +import org.eclipse.emf.cdo.client.impl.CDOPersistentImpl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; + +import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList; +import org.eclipse.emf.ecore.util.EObjectResolvingEList; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.ecore.util.InternalEList; + +import testmodel1.TestModel1Package; +import testmodel1.TreeNode; + + +/** + * + * An implementation of the model object 'Tree Node'. + * + *

+ * The following features are implemented: + *

+ *

+ * + * @generated + */ +public class TreeNodeImpl extends CDOPersistentImpl implements TreeNode +{ + /** + * The cached value of the '{@link #getChildren() Children}' containment reference list. + * + * + * @see #getChildren() + * @generated + * @ordered + */ + protected EList children = null; + + /** + * The cached value of the '{@link #getReferences() References}' reference list. + * + * + * @see #getReferences() + * @generated + * @ordered + */ + protected EList references = null; + + /** + * The default value of the '{@link #isBooleanFeature() Boolean Feature}' attribute. + * + * + * @see #isBooleanFeature() + * @generated + * @ordered + */ + protected static final boolean BOOLEAN_FEATURE_EDEFAULT = false; + + /** + * The cached value of the '{@link #isBooleanFeature() Boolean Feature}' attribute. + * + * + * @see #isBooleanFeature() + * @generated + * @ordered + */ + protected boolean booleanFeature = BOOLEAN_FEATURE_EDEFAULT; + + /** + * The default value of the '{@link #getIntFeature() Int Feature}' attribute. + * + * + * @see #getIntFeature() + * @generated + * @ordered + */ + protected static final int INT_FEATURE_EDEFAULT = 0; + + /** + * The cached value of the '{@link #getIntFeature() Int Feature}' attribute. + * + * + * @see #getIntFeature() + * @generated + * @ordered + */ + protected int intFeature = INT_FEATURE_EDEFAULT; + + /** + * The default value of the '{@link #getStringFeature() String Feature}' attribute. + * + * + * @see #getStringFeature() + * @generated + * @ordered + */ + protected static final String STRING_FEATURE_EDEFAULT = null; + + /** + * The cached value of the '{@link #getStringFeature() String Feature}' attribute. + * + * + * @see #getStringFeature() + * @generated + * @ordered + */ + protected String stringFeature = STRING_FEATURE_EDEFAULT; + + /** + * + * + * @generated + */ + protected TreeNodeImpl() + { + super(); + } + + /** + * + * + * @generated + */ + protected EClass eStaticClass() + { + return TestModel1Package.Literals.TREE_NODE; + } + + /** + * + * + * @generated + */ + public TreeNode getParent() + { + + if (eContainerFeatureID != TestModel1Package.TREE_NODE__PARENT) return null; + return (TreeNode) eContainer(); + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetParent(TreeNode newParent, NotificationChain msgs) + { + cdoLoad(); + msgs = eBasicSetContainer((InternalEObject) newParent, TestModel1Package.TREE_NODE__PARENT, + msgs); + return msgs; + } + + /** + * + * + * @generated + */ + public void setParent(TreeNode newParent) + { + + if (newParent != eInternalContainer() + || (eContainerFeatureID != TestModel1Package.TREE_NODE__PARENT && newParent != null)) + { + if (EcoreUtil.isAncestor(this, newParent)) + throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); + NotificationChain msgs = null; + if (eInternalContainer() != null) msgs = eBasicRemoveFromContainer(msgs); + if (newParent != null) + msgs = ((InternalEObject) newParent).eInverseAdd(this, + TestModel1Package.TREE_NODE__CHILDREN, TreeNode.class, msgs); + msgs = basicSetParent(newParent, msgs); + if (msgs != null) msgs.dispatch(); + } + else if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, TestModel1Package.TREE_NODE__PARENT, + newParent, newParent)); + } + + /** + * + * + * @generated + */ + public EList getChildren() + { + + cdoLoad(); + if (children == null) + { + children = new EObjectContainmentWithInverseEList(TreeNode.class, this, + TestModel1Package.TREE_NODE__CHILDREN, TestModel1Package.TREE_NODE__PARENT); + } + return children; + } + + /** + * + * + * @generated + */ + public EList getReferences() + { + + cdoLoad(); + if (references == null) + { + references = new EObjectResolvingEList(TreeNode.class, this, + TestModel1Package.TREE_NODE__REFERENCES); + } + return references; + } + + /** + * + * + * @generated + */ + public boolean isBooleanFeature() + { + + cdoLoad(); + return booleanFeature; + } + + /** + * + * + * @generated + */ + public void setBooleanFeature(boolean newBooleanFeature) + { + + cdoLoad(); + boolean oldBooleanFeature = booleanFeature; + booleanFeature = newBooleanFeature; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, + TestModel1Package.TREE_NODE__BOOLEAN_FEATURE, oldBooleanFeature, booleanFeature)); + } + + /** + * + * + * @generated + */ + public int getIntFeature() + { + + cdoLoad(); + return intFeature; + } + + /** + * + * + * @generated + */ + public void setIntFeature(int newIntFeature) + { + + cdoLoad(); + int oldIntFeature = intFeature; + intFeature = newIntFeature; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, + TestModel1Package.TREE_NODE__INT_FEATURE, oldIntFeature, intFeature)); + } + + /** + * + * + * @generated + */ + public String getStringFeature() + { + + cdoLoad(); + return stringFeature; + } + + /** + * + * + * @generated + */ + public void setStringFeature(String newStringFeature) + { + + cdoLoad(); + String oldStringFeature = stringFeature; + stringFeature = newStringFeature; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, + TestModel1Package.TREE_NODE__STRING_FEATURE, oldStringFeature, stringFeature)); + } + + /** + * + * + * @generated + */ + public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, + NotificationChain msgs) + { + switch (featureID) + { + case TestModel1Package.TREE_NODE__PARENT: + if (eInternalContainer() != null) msgs = eBasicRemoveFromContainer(msgs); + return basicSetParent((TreeNode) otherEnd, msgs); + case TestModel1Package.TREE_NODE__CHILDREN: + return ((InternalEList) getChildren()).basicAdd(otherEnd, msgs); + } + return super.eInverseAdd(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, + NotificationChain msgs) + { + switch (featureID) + { + case TestModel1Package.TREE_NODE__PARENT: + return basicSetParent(null, msgs); + case TestModel1Package.TREE_NODE__CHILDREN: + return ((InternalEList) getChildren()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) + { + switch (eContainerFeatureID) + { + case TestModel1Package.TREE_NODE__PARENT: + return eInternalContainer().eInverseRemove(this, TestModel1Package.TREE_NODE__CHILDREN, + TreeNode.class, msgs); + } + return super.eBasicRemoveFromContainerFeature(msgs); + } + + /** + * + * + * @generated + */ + public Object eGet(int featureID, boolean resolve, boolean coreType) + { + switch (featureID) + { + case TestModel1Package.TREE_NODE__PARENT: + return getParent(); + case TestModel1Package.TREE_NODE__CHILDREN: + return getChildren(); + case TestModel1Package.TREE_NODE__REFERENCES: + return getReferences(); + case TestModel1Package.TREE_NODE__BOOLEAN_FEATURE: + return isBooleanFeature() ? Boolean.TRUE : Boolean.FALSE; + case TestModel1Package.TREE_NODE__INT_FEATURE: + return new Integer(getIntFeature()); + case TestModel1Package.TREE_NODE__STRING_FEATURE: + return getStringFeature(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + public void eSet(int featureID, Object newValue) + { + switch (featureID) + { + case TestModel1Package.TREE_NODE__PARENT: + setParent((TreeNode) newValue); + return; + case TestModel1Package.TREE_NODE__CHILDREN: + getChildren().clear(); + getChildren().addAll((Collection) newValue); + return; + case TestModel1Package.TREE_NODE__REFERENCES: + getReferences().clear(); + getReferences().addAll((Collection) newValue); + return; + case TestModel1Package.TREE_NODE__BOOLEAN_FEATURE: + setBooleanFeature(((Boolean) newValue).booleanValue()); + return; + case TestModel1Package.TREE_NODE__INT_FEATURE: + setIntFeature(((Integer) newValue).intValue()); + return; + case TestModel1Package.TREE_NODE__STRING_FEATURE: + setStringFeature((String) newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + public void eUnset(int featureID) + { + switch (featureID) + { + case TestModel1Package.TREE_NODE__PARENT: + setParent((TreeNode) null); + return; + case TestModel1Package.TREE_NODE__CHILDREN: + getChildren().clear(); + return; + case TestModel1Package.TREE_NODE__REFERENCES: + getReferences().clear(); + return; + case TestModel1Package.TREE_NODE__BOOLEAN_FEATURE: + setBooleanFeature(BOOLEAN_FEATURE_EDEFAULT); + return; + case TestModel1Package.TREE_NODE__INT_FEATURE: + setIntFeature(INT_FEATURE_EDEFAULT); + return; + case TestModel1Package.TREE_NODE__STRING_FEATURE: + setStringFeature(STRING_FEATURE_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + public boolean eIsSet(int featureID) + { + switch (featureID) + { + case TestModel1Package.TREE_NODE__PARENT: + return getParent() != null; + case TestModel1Package.TREE_NODE__CHILDREN: + return children != null && !children.isEmpty(); + case TestModel1Package.TREE_NODE__REFERENCES: + return references != null && !references.isEmpty(); + case TestModel1Package.TREE_NODE__BOOLEAN_FEATURE: + return booleanFeature != BOOLEAN_FEATURE_EDEFAULT; + case TestModel1Package.TREE_NODE__INT_FEATURE: + return intFeature != INT_FEATURE_EDEFAULT; + case TestModel1Package.TREE_NODE__STRING_FEATURE: + return STRING_FEATURE_EDEFAULT == null ? stringFeature != null : !STRING_FEATURE_EDEFAULT + .equals(stringFeature); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + public String toString() + { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (booleanFeature: "); + result.append(booleanFeature); + result.append(", intFeature: "); + result.append(intFeature); + result.append(", stringFeature: "); + result.append(stringFeature); + result.append(')'); + return result.toString(); + } + +} //TreeNodeImpl \ No newline at end of file diff --git a/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/util/TestModel1AdapterFactory.java b/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/util/TestModel1AdapterFactory.java new file mode 100644 index 0000000000..dd4732b893 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/util/TestModel1AdapterFactory.java @@ -0,0 +1,176 @@ +/** + * + * + * + * $Id$ + */ +package testmodel1.util; + + +import org.eclipse.emf.cdo.client.CDOPersistable; +import org.eclipse.emf.cdo.client.CDOPersistent; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notifier; + +import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; + +import org.eclipse.emf.ecore.EObject; + +import testmodel1.*; + + +/** + * + * The Adapter Factory for the model. + * It provides an adapter createXXX method for each class of the model. + * + * @see testmodel1.TestModel1Package + * @generated + */ +public class TestModel1AdapterFactory extends AdapterFactoryImpl +{ + /** + * The cached model package. + * + * + * @generated + */ + protected static TestModel1Package modelPackage; + + /** + * Creates an instance of the adapter factory. + * + * + * @generated + */ + public TestModel1AdapterFactory() + { + if (modelPackage == null) + { + modelPackage = TestModel1Package.eINSTANCE; + } + } + + /** + * Returns whether this factory is applicable for the type of the object. + * + * This implementation returns true if the object is either the model's package or is an instance object of the model. + * + * @return whether this factory is applicable for the type of the object. + * @generated + */ + public boolean isFactoryForType(Object object) + { + if (object == modelPackage) + { + return true; + } + if (object instanceof EObject) + { + return ((EObject) object).eClass().getEPackage() == modelPackage; + } + return false; + } + + /** + * The switch the delegates to the createXXX methods. + * + * + * @generated + */ + protected TestModel1Switch modelSwitch = new TestModel1Switch() + { + public Object caseTreeNode(TreeNode object) + { + return createTreeNodeAdapter(); + } + + public Object caseCDOPersistable(CDOPersistable object) + { + return createCDOPersistableAdapter(); + } + + public Object caseCDOPersistent(CDOPersistent object) + { + return createCDOPersistentAdapter(); + } + + public Object defaultCase(EObject object) + { + return createEObjectAdapter(); + } + }; + + /** + * Creates an adapter for the target. + * + * + * @param target the object to adapt. + * @return the adapter for the target. + * @generated + */ + public Adapter createAdapter(Notifier target) + { + return (Adapter) modelSwitch.doSwitch((EObject) target); + } + + /** + * Creates a new adapter for an object of class '{@link testmodel1.TreeNode Tree Node}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see testmodel1.TreeNode + * @generated + */ + public Adapter createTreeNodeAdapter() + { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.emf.cdo.client.CDOPersistable Persistable}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.eclipse.emf.cdo.client.CDOPersistable + * @generated + */ + public Adapter createCDOPersistableAdapter() + { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.emf.cdo.client.CDOPersistent Persistent}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.eclipse.emf.cdo.client.CDOPersistent + * @generated + */ + public Adapter createCDOPersistentAdapter() + { + return null; + } + + /** + * Creates a new adapter for the default case. + * + * This default implementation returns null. + * + * @return the new adapter. + * @generated + */ + public Adapter createEObjectAdapter() + { + return null; + } + +} //TestModel1AdapterFactory diff --git a/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/util/TestModel1Switch.java b/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/util/TestModel1Switch.java new file mode 100644 index 0000000000..6ed1b9681b --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/util/TestModel1Switch.java @@ -0,0 +1,180 @@ +/** + * + * + * + * $Id$ + */ +package testmodel1.util; + + +import java.util.List; + +import org.eclipse.emf.cdo.client.CDOPersistable; +import org.eclipse.emf.cdo.client.CDOPersistent; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; + +import testmodel1.*; + + +/** + * + * The Switch for the model's inheritance hierarchy. + * It supports the call {@link #doSwitch(EObject) doSwitch(object)} + * to invoke the caseXXX method for each class of the model, + * starting with the actual class of the object + * and proceeding up the inheritance hierarchy + * until a non-null result is returned, + * which is the result of the switch. + * + * @see testmodel1.TestModel1Package + * @generated + */ +public class TestModel1Switch +{ + /** + * The cached model package + * + * + * @generated + */ + protected static TestModel1Package modelPackage; + + /** + * Creates an instance of the switch. + * + * + * @generated + */ + public TestModel1Switch() + { + if (modelPackage == null) + { + modelPackage = TestModel1Package.eINSTANCE; + } + } + + /** + * Calls caseXXX for each class of the model until one returns a non null result; it yields that result. + * + * + * @return the first non-null result returned by a caseXXX call. + * @generated + */ + public Object doSwitch(EObject theEObject) + { + return doSwitch(theEObject.eClass(), theEObject); + } + + /** + * Calls caseXXX for each class of the model until one returns a non null result; it yields that result. + * + * + * @return the first non-null result returned by a caseXXX call. + * @generated + */ + protected Object doSwitch(EClass theEClass, EObject theEObject) + { + if (theEClass.eContainer() == modelPackage) + { + return doSwitch(theEClass.getClassifierID(), theEObject); + } + else + { + List eSuperTypes = theEClass.getESuperTypes(); + return eSuperTypes.isEmpty() ? defaultCase(theEObject) : doSwitch( + (EClass) eSuperTypes.get(0), theEObject); + } + } + + /** + * Calls caseXXX for each class of the model until one returns a non null result; it yields that result. + * + * + * @return the first non-null result returned by a caseXXX call. + * @generated + */ + protected Object doSwitch(int classifierID, EObject theEObject) + { + switch (classifierID) + { + case TestModel1Package.TREE_NODE: + { + TreeNode treeNode = (TreeNode) theEObject; + Object result = caseTreeNode(treeNode); + if (result == null) result = caseCDOPersistent(treeNode); + if (result == null) result = caseCDOPersistable(treeNode); + if (result == null) result = defaultCase(theEObject); + return result; + } + default: + return defaultCase(theEObject); + } + } + + /** + * Returns the result of interpretting the object as an instance of 'Tree Node'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpretting the object as an instance of 'Tree Node'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public Object caseTreeNode(TreeNode object) + { + return null; + } + + /** + * Returns the result of interpretting the object as an instance of 'Persistable'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpretting the object as an instance of 'Persistable'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public Object caseCDOPersistable(CDOPersistable object) + { + return null; + } + + /** + * Returns the result of interpretting the object as an instance of 'Persistent'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpretting the object as an instance of 'Persistent'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public Object caseCDOPersistent(CDOPersistent object) + { + return null; + } + + /** + * Returns the result of interpretting the object as an instance of 'EObject'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch, but this is the last case anyway. + * + * @param object the target of the switch. + * @return the result of interpretting the object as an instance of 'EObject'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) + * @generated + */ + public Object defaultCase(EObject object) + { + return null; + } + +} //TestModel1Switch -- cgit v1.2.3