From 54136e4fa8ea5039f0f42fcc933e993abfb1d576 Mon Sep 17 00:00:00 2001
From: Eike Stepper
Date: Sun, 20 Aug 2006 09:44:44 +0000
Subject: [154389] attributes in super class returned by server, ignored by
client https://bugs.eclipse.org/bugs/show_bug.cgi?id=154389
---
.../emf/cdo/tests/model1/AbstractModel1Test.java | 15 +++
.../eclipse/emf/cdo/tests/model1/BasicTest.java | 14 +-
.../emf/cdo/tests/model1/Bugzilla154389Test.java | 65 ++++++++-
.../src/testmodel1/EmptyRefNode.java | 47 +++++++
.../src/testmodel1/impl/EmptyRefNodeImpl.java | 145 +++++++++++++++++++++
5 files changed, 276 insertions(+), 10 deletions(-)
create mode 100644 plugins/org.eclipse.emf.cdo.tests/src/testmodel1/EmptyRefNode.java
create mode 100644 plugins/org.eclipse.emf.cdo.tests/src/testmodel1/impl/EmptyRefNodeImpl.java
(limited to 'plugins/org.eclipse.emf.cdo.tests/src')
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/AbstractModel1Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/AbstractModel1Test.java
index f77756482d..45fd503093 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/AbstractModel1Test.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/AbstractModel1Test.java
@@ -20,6 +20,7 @@ import org.eclipse.emf.ecore.resource.Resource;
import org.springframework.jdbc.core.JdbcTemplate;
import testmodel1.EmptyNode;
+import testmodel1.EmptyRefNode;
import testmodel1.ExtendedNode;
import testmodel1.TestModel1Factory;
import testmodel1.TreeNode;
@@ -154,6 +155,19 @@ public abstract class AbstractModel1Test extends AbstractTopologyTest
return node;
}
+ protected EmptyRefNode createEmptyRef(String name)
+ {
+ return createEmptyRef(name, null);
+ }
+
+ protected EmptyRefNode createEmptyRef(String name, TreeNode parent)
+ {
+ EmptyRefNode node = TestModel1Factory.eINSTANCE.createEmptyRefNode();
+ node.setStringFeature(name);
+ node.setParent(parent);
+ return node;
+ }
+
protected TreeNode findChild(String name, TreeNode parent)
{
return findNode(name, parent.getChildren());
@@ -194,6 +208,7 @@ public abstract class AbstractModel1Test extends AbstractTopologyTest
super.wipeDatabase(jdbc);
dropTable(jdbc, "TREE_NODE");
dropTable(jdbc, "EMPTY_NODE");
+ dropTable(jdbc, "EMPTY_REF_NODE");
dropTable(jdbc, "EXTENDED_NODE");
}
}
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 f105f1a222..123bb4306c 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
@@ -66,7 +66,7 @@ public class BasicTest extends AbstractModel1Test
}
}
- public void testXRefAlreadyLoaded() throws Exception
+ public void testRefAlreadyLoaded() throws Exception
{
final String RESOURCE = "/test/res";
final String ROOT = "root";
@@ -91,7 +91,7 @@ public class BasicTest extends AbstractModel1Test
}
}
- public void testXRefNotYetLoaded() throws Exception
+ public void testRefNotYetLoaded() throws Exception
{
final String RESOURCE = "/test/res";
final String ROOT = "root";
@@ -148,7 +148,7 @@ public class BasicTest extends AbstractModel1Test
}
}
- public void testGetResourceWithXRef() throws Exception
+ public void testGetResourceWithRef() throws Exception
{
final String RESOURCE = "/test/res";
final String ROOT = "root";
@@ -171,7 +171,7 @@ public class BasicTest extends AbstractModel1Test
}
}
- public void testInterResourceXRef1() throws Exception
+ public void testInterResourceRef1() throws Exception
{
final String RESOURCE1 = "/test/res1";
final String RESOURCE2 = "/test/res2";
@@ -198,7 +198,7 @@ public class BasicTest extends AbstractModel1Test
}
}
- public void testInterResourceXRef2() throws Exception
+ public void testInterResourceRef2() throws Exception
{
final String RESOURCE1 = "/test/res1";
final String RESOURCE2 = "/test/res2";
@@ -227,7 +227,7 @@ public class BasicTest extends AbstractModel1Test
}
}
- public void testInterResourceXRef3() throws Exception
+ public void testInterResourceRef3() throws Exception
{
final String RESOURCE1 = "/test/res1";
final String RESOURCE2 = "/test/res2";
@@ -301,7 +301,7 @@ public class BasicTest extends AbstractModel1Test
}
}
- public void testGetContainerWithXRef() throws Exception
+ public void testGetContainerWithRef() throws Exception
{
final String RESOURCE = "/test/res";
final String ROOT = "root";
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/Bugzilla154389Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/Bugzilla154389Test.java
index d8358bbd06..03e4b939e1 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/Bugzilla154389Test.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/Bugzilla154389Test.java
@@ -12,6 +12,7 @@ package org.eclipse.emf.cdo.tests.model1;
import testmodel1.EmptyNode;
+import testmodel1.EmptyRefNode;
import testmodel1.TreeNode;
@@ -82,7 +83,7 @@ public class Bugzilla154389Test extends AbstractModel1Test
}
}
- public void testEmptyXRef() throws Exception
+ public void testEmptyViaRef() throws Exception
{
final String RESOURCE = "/test/res";
final String ROOT = "root";
@@ -97,8 +98,41 @@ public class Bugzilla154389Test extends AbstractModel1Test
TreeNode b = createEmpty(CHILD_B, root);
b.setBooleanFeature(BOOLEAN_VALUE);
b.setIntFeature(INT_VALUE);
+ a.getReferences().add(b);
+ saveRoot(root, RESOURCE);
+ }
+
+ { // Verification
+ TreeNode root = (TreeNode) loadRoot(RESOURCE);
+ assertNode(ROOT, root);
+ TreeNode a = (TreeNode) root.getChildren().get(0);
+ assertNode(CHILD_A, a);
+
+ TreeNode b = (TreeNode) a.getReferences().get(0);
+ assertNode(CHILD_B, b);
+ assertEquals(BOOLEAN_VALUE, b.isBooleanFeature());
+ assertEquals(INT_VALUE, b.getIntFeature());
+ }
+ }
+
+ public void testEmptyViaRefWithRef() throws Exception
+ {
+ final String RESOURCE = "/test/res";
+ final String ROOT = "root";
+ final String CHILD_A = "a";
+ final String CHILD_B = "b";
+ final boolean BOOLEAN_VALUE = true;
+ final int INT_VALUE = 12345;
+
+ { // Execution
+ TreeNode root = createNode(ROOT);
+ TreeNode a = createNode(CHILD_A, root);
+ TreeNode b = createEmpty(CHILD_B, root);
+ b.setBooleanFeature(BOOLEAN_VALUE);
+ b.setIntFeature(INT_VALUE);
a.getReferences().add(b);
+ b.getReferences().add(a);
saveRoot(root, RESOURCE);
}
@@ -106,13 +140,38 @@ public class Bugzilla154389Test extends AbstractModel1Test
TreeNode root = (TreeNode) loadRoot(RESOURCE);
assertNode(ROOT, root);
- TreeNode a = (TreeNode )root.getChildren().get(0);
+ TreeNode a = (TreeNode) root.getChildren().get(0);
assertNode(CHILD_A, a);
-
+
TreeNode b = (TreeNode) a.getReferences().get(0);
assertNode(CHILD_B, b);
assertEquals(BOOLEAN_VALUE, b.isBooleanFeature());
assertEquals(INT_VALUE, b.getIntFeature());
+ assertEquals(CHILD_A, ((TreeNode) b.getReferences().get(0)).getStringFeature());
+ }
+ }
+
+ public void testEmptyRefRoot() throws Exception
+ {
+ final String RESOURCE = "/test/res";
+ final String ROOT = "root";
+ final boolean BOOLEAN_VALUE = true;
+ final int INT_VALUE = 12345;
+
+ { // Execution
+ EmptyRefNode root = createEmptyRef(ROOT);
+ root.setBooleanFeature(BOOLEAN_VALUE);
+ root.setIntFeature(INT_VALUE);
+ root.getMoreReferences().add(root);
+ saveRoot(root, RESOURCE);
+ }
+
+ { // Verification
+ EmptyRefNode root = (EmptyRefNode) loadRoot(RESOURCE);
+ assertNode(ROOT, root);
+ assertEquals(BOOLEAN_VALUE, root.isBooleanFeature());
+ assertEquals(INT_VALUE, root.getIntFeature());
+ assertEquals(ROOT, ((TreeNode) root.getMoreReferences().get(0)).getStringFeature());
}
}
}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/EmptyRefNode.java b/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/EmptyRefNode.java
new file mode 100644
index 0000000000..76938f1b82
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/EmptyRefNode.java
@@ -0,0 +1,47 @@
+/**
+ *
+ * The following features are supported: + *
+ * If the meaning of the 'More References' reference list isn't clear, + * there really should be more of a description here... + *
+ * + * @return the value of the 'More References' reference list. + * @see testmodel1.TestModel1Package#getEmptyRefNode_MoreReferences() + * @model type="testmodel1.TreeNode" + * @generated + */ + EList getMoreReferences(); + +} // EmptyRefNode \ No newline at end of file diff --git a/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/impl/EmptyRefNodeImpl.java b/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/impl/EmptyRefNodeImpl.java new file mode 100644 index 0000000000..6d6c6c5118 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/impl/EmptyRefNodeImpl.java @@ -0,0 +1,145 @@ +/** + *+ * The following features are implemented: + *