summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2006-08-21 13:05:39 (EDT)
committerEike Stepper2006-08-21 13:05:39 (EDT)
commit78b35453b7b4b85ac9c7beaae2a4d90f54f28a6a (patch)
tree268c4e9bdf38df8c30afdf6dd85ace2bbb93d4bc
parentabfedc7229e6dacf0c64e22dac924e00d08b0d24 (diff)
downloadcdo-78b35453b7b4b85ac9c7beaae2a4d90f54f28a6a.zip
cdo-78b35453b7b4b85ac9c7beaae2a4d90f54f28a6a.tar.gz
cdo-78b35453b7b4b85ac9c7beaae2a4d90f54f28a6a.tar.bz2
[154570] eContainer() is null
https://bugs.eclipse.org/bugs/show_bug.cgi?id=154570
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/BasicTest.java75
1 files changed, 75 insertions, 0 deletions
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/BasicTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/BasicTest.java
index 3adc064..be05e83 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/BasicTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/BasicTest.java
@@ -343,6 +343,81 @@ public class BasicTest extends AbstractModel1Test
}
}
+ public void testGetEContainer() throws Exception
+ {
+ final String RESOURCE = "/test/res";
+ final String ROOT = "root";
+ final String[] PATH = { "a1", "a2", "a3", "a4"};
+
+ { // Execution
+ TreeNode root = createNode(ROOT);
+ createPath(PATH, root, false);
+ saveRoot(root, RESOURCE);
+ }
+
+ { // Verification
+ TreeNode root = (TreeNode) loadRoot(RESOURCE);
+ TreeNode a4 = findPath(PATH, root);
+
+ TreeNode a3 = (TreeNode) a4.eContainer();
+ assertNode(PATH[2], a3);
+
+ TreeNode a2 = (TreeNode) a3.eContainer();
+ assertNode(PATH[1], a2);
+
+ TreeNode a1 = (TreeNode) a2.eContainer();
+ assertNode(PATH[0], a1);
+
+ TreeNode a0 = (TreeNode) a1.eContainer();
+ assertNode(ROOT, a0);
+ assertEquals(a0, root);
+
+ assertResource(RESOURCE, a0);
+ assertResource(RESOURCE, a1);
+ assertResource(RESOURCE, a2);
+ assertResource(RESOURCE, a3);
+ assertResource(RESOURCE, a4);
+ }
+ }
+
+ public void testGetEContainerViaRef() throws Exception
+ {
+ final String RESOURCE = "/test/res";
+ final String ROOT = "root";
+ final String[] PATH = { "a1", "a2", "a3", "a4"};
+
+ { // Execution
+ TreeNode root = createNode(ROOT);
+ TreeNode a4 = createPath(PATH, root, false);
+ root.getReferences().add(a4);
+ saveRoot(root, RESOURCE);
+ }
+
+ { // Verification
+ TreeNode root = (TreeNode) loadRoot(RESOURCE);
+ TreeNode a4 = (TreeNode) root.getReferences().get(0);
+
+ TreeNode a3 = (TreeNode) a4.eContainer();
+ assertNode(PATH[2], a3);
+
+ TreeNode a2 = (TreeNode) a3.eContainer();
+ assertNode(PATH[1], a2);
+
+ TreeNode a1 = (TreeNode) a2.eContainer();
+ assertNode(PATH[0], a1);
+
+ TreeNode a0 = (TreeNode) a1.eContainer();
+ assertNode(ROOT, a0);
+ assertEquals(a0, root);
+
+ assertResource(RESOURCE, a0);
+ assertResource(RESOURCE, a1);
+ assertResource(RESOURCE, a2);
+ assertResource(RESOURCE, a3);
+ assertResource(RESOURCE, a4);
+ }
+ }
+
public void testUpdate() throws Exception
{
final String RESOURCE = "/test/res";