summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2006-08-21 10:56:27 (EDT)
committerEike Stepper2006-08-21 10:56:27 (EDT)
commit417bd1ac6efa9f1d680408a47df8bb0d38cf0d0c (patch)
tree22834501fc164705c70b7bbbbe3b328e0f217cfb
parent3009d715dee6bfc028d308aadd2543e2daf5c40a (diff)
downloadcdo-417bd1ac6efa9f1d680408a47df8bb0d38cf0d0c.zip
cdo-417bd1ac6efa9f1d680408a47df8bb0d38cf0d0c.tar.gz
cdo-417bd1ac6efa9f1d680408a47df8bb0d38cf0d0c.tar.bz2
[154522] Copy from CDO resource to XMI resource does not work
https://bugs.eclipse.org/bugs/show_bug.cgi?id=154389
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/NotificationTest.java75
1 files changed, 74 insertions, 1 deletions
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/NotificationTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/NotificationTest.java
index ff0fcea..f3785d5 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/NotificationTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/NotificationTest.java
@@ -19,7 +19,7 @@ import junit.framework.ComparisonFailure;
public class NotificationTest extends AbstractModel1Test
{
- public void testOneConnection() throws Exception
+ public void testRoot() throws Exception
{
final String RESOURCE = "/test/res";
final String ROOT = "root";
@@ -51,4 +51,77 @@ public class NotificationTest extends AbstractModel1Test
Thread.sleep(1);
}
}
+
+ public void testChildNotYetLoaded() throws Exception
+ {
+ final String RESOURCE = "/test/res";
+ final String ROOT = "root";
+ final String CHILD = "a";
+ final String NEW_NAME = "a2";
+ final long TIME_LIMIT = 100;
+
+ // Client1 creates resource
+ TreeNode root = createNode(ROOT);
+ TreeNode a = createNode(CHILD, root);
+ saveRoot(root, RESOURCE);
+
+ // Client2 loads resource
+ TreeNode loaded = (TreeNode) loadRoot(RESOURCE);
+ TreeNode loadedA = (TreeNode) loaded.getChildren().get(0);
+
+ // Client1 modifies and commits resource
+ a.setStringFeature(NEW_NAME);
+ Resource resource = root.eResource();
+ resource.save(null);
+
+ // Give server and client2 enough time to get notified
+ long start = System.currentTimeMillis();
+ try
+ {
+ assertNode(NEW_NAME, loadedA);
+ }
+ catch (ComparisonFailure ex)
+ {
+ long duration = System.currentTimeMillis() - start;
+ if (duration > TIME_LIMIT) throw ex;
+ Thread.sleep(1);
+ }
+ }
+
+ public void testChildAlreadyLoaded() throws Exception
+ {
+ final String RESOURCE = "/test/res";
+ final String ROOT = "root";
+ final String CHILD = "a";
+ final String NEW_NAME = "a2";
+ final long TIME_LIMIT = 100;
+
+ // Client1 creates resource
+ TreeNode root = createNode(ROOT);
+ TreeNode a = createNode(CHILD, root);
+ saveRoot(root, RESOURCE);
+
+ // Client2 loads resource
+ TreeNode loaded = (TreeNode) loadRoot(RESOURCE);
+ TreeNode loadedA = (TreeNode) loaded.getChildren().get(0);
+ assertNode(CHILD, loadedA);
+
+ // Client1 modifies and commits resource
+ a.setStringFeature(NEW_NAME);
+ Resource resource = root.eResource();
+ resource.save(null);
+
+ // Give server and client2 enough time to get notified
+ long start = System.currentTimeMillis();
+ try
+ {
+ assertNode(NEW_NAME, loadedA);
+ }
+ catch (ComparisonFailure ex)
+ {
+ long duration = System.currentTimeMillis() - start;
+ if (duration > TIME_LIMIT) throw ex;
+ Thread.sleep(1);
+ }
+ }
}