summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2006-08-10 01:16:30 (EDT)
committerEike Stepper2006-08-10 01:16:30 (EDT)
commit464df8526f8f0673f743e861ca6a9ffbf68f40d8 (patch)
treea445eb364a7beb8f988437a5f576a03e063204c2
parent1c0aca58415cf9fa828fcebfaab7e0b4b1d4b9e2 (diff)
downloadcdo-464df8526f8f0673f743e861ca6a9ffbf68f40d8.zip
cdo-464df8526f8f0673f743e861ca6a9ffbf68f40d8.tar.gz
cdo-464df8526f8f0673f743e861ca6a9ffbf68f40d8.tar.bz2
*** empty log message ***
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AbstractTopologyTest.java21
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ClientSeparatedServerTopology.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/Model1Test.java15
3 files changed, 34 insertions, 10 deletions
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AbstractTopologyTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AbstractTopologyTest.java
index 7dbb28c..c348ed4 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AbstractTopologyTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AbstractTopologyTest.java
@@ -13,13 +13,13 @@ package org.eclipse.emf.cdo.tests;
import org.eclipse.emf.cdo.client.CDOResource;
import org.eclipse.emf.cdo.client.ResourceManager;
+import org.eclipse.emf.cdo.client.impl.CDOResourceFactoryImpl;
import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
-import testmodel1.TreeNode;
-
import java.io.IOException;
import junit.framework.TestCase;
@@ -68,11 +68,24 @@ public abstract class AbstractTopologyTest extends TestCase
protected CDOResource createResource(String path)
{
ResourceManager resourceManager = createResourceManager();
- URI uri = URI.createURI("cdo://" + path);
+ URI uri = CDOResourceFactoryImpl.formatURI(path);
return (CDOResource) resourceManager.createResource(uri);
}
- protected CDOResource saveResource(String path, TreeNode root) throws IOException
+ protected CDOResource getResource(String path)
+ {
+ ResourceManager resourceManager = createResourceManager();
+ URI uri = CDOResourceFactoryImpl.formatURI(path);
+ return (CDOResource) resourceManager.getResource(uri, true);
+ }
+
+ protected EObject loadRoot(String path) throws IOException
+ {
+ CDOResource resource = getResource(path);
+ return (EObject) resource.getContents().get(0);
+ }
+
+ protected CDOResource saveRoot(EObject root, String path) throws IOException
{
CDOResource resource = createResource(path);
resource.getContents().add(root);
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
index d2fd35a..938728d 100644
--- 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
@@ -38,16 +38,16 @@ public class ClientSeparatedServerTopology extends AbstractTopology
super.start();
// Start server
- serverNet4j = createContainer("net4j", NET4J_LOCATION, null);
- net4jServer = createContainer("server", NET4J_SERVER_LOCATION, serverNet4j);
+ serverNet4j = createContainer("server", NET4J_LOCATION, null);
+ net4jServer = createContainer("socket", 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);
+ clientNet4j = createContainer("client", NET4J_LOCATION, null);
+ net4jClient = createContainer("socket", NET4J_CLIENT_LOCATION, clientNet4j);
createCDOClient("cdo", net4jClient);
}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/Model1Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/Model1Test.java
index 85d106d..8e06c3e 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/Model1Test.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/Model1Test.java
@@ -11,6 +11,7 @@
package org.eclipse.emf.cdo.tests;
+import org.eclipse.emf.common.util.EList;
import testmodel1.TestModel1Factory;
import testmodel1.TreeNode;
@@ -18,17 +19,27 @@ import testmodel1.TreeNode;
import java.util.Arrays;
-
public class Model1Test extends AbstractTopologyTest
{
+ protected static final String PATH1 = "/test/res1";
+
public void testSimple() throws Exception
{
TreeNode root = createNode("root", null);
createNode("node1", root);
createNode("node2", root);
createNode("node3", root);
+ saveRoot(root, PATH1);
+
+ TreeNode n0 = (TreeNode) loadRoot(PATH1);
+ assertNotNull(n0);
+ assertEquals("root", n0.getStringFeature());
- saveResource("/test/res1", root);
+ EList children = n0.getChildren();
+ assertEquals(3, children.size());
+ assertEquals("node1", ((TreeNode) children.get(0)).getStringFeature());
+ assertEquals("node2", ((TreeNode) children.get(1)).getStringFeature());
+ assertEquals("node3", ((TreeNode) children.get(2)).getStringFeature());
}
protected TreeNode createNode(String name, TreeNode parent)