Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2006-08-20 05:34:24 -0400
committerEike Stepper2006-08-20 05:34:24 -0400
commitf3b24fde9eac46af2b49314ffeac98bedebf1327 (patch)
tree5ee84d34faf98534a24b716b0aa8c30cd824b6b3 /plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo
parenta7b05434dcd682b3a5f6cba5f1d9589e9ae5168c (diff)
downloadcdo-f3b24fde9eac46af2b49314ffeac98bedebf1327.tar.gz
cdo-f3b24fde9eac46af2b49314ffeac98bedebf1327.tar.xz
cdo-f3b24fde9eac46af2b49314ffeac98bedebf1327.zip
[154389] attributes in super class returned by server, ignored by client
https://bugs.eclipse.org/bugs/show_bug.cgi?id=154389
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo')
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/AbstractModel1Test.java15
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/Bugzilla154389Test.java118
2 files changed, 133 insertions, 0 deletions
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 aaa61eb4c2..f77756482d 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
@@ -19,6 +19,7 @@ import org.eclipse.emf.ecore.resource.Resource;
import org.springframework.jdbc.core.JdbcTemplate;
+import testmodel1.EmptyNode;
import testmodel1.ExtendedNode;
import testmodel1.TestModel1Factory;
import testmodel1.TreeNode;
@@ -140,6 +141,19 @@ public abstract class AbstractModel1Test extends AbstractTopologyTest
return node;
}
+ protected EmptyNode createEmpty(String name)
+ {
+ return createEmpty(name, null);
+ }
+
+ protected EmptyNode createEmpty(String name, TreeNode parent)
+ {
+ EmptyNode node = TestModel1Factory.eINSTANCE.createEmptyNode();
+ node.setStringFeature(name);
+ node.setParent(parent);
+ return node;
+ }
+
protected TreeNode findChild(String name, TreeNode parent)
{
return findNode(name, parent.getChildren());
@@ -179,6 +193,7 @@ public abstract class AbstractModel1Test extends AbstractTopologyTest
{
super.wipeDatabase(jdbc);
dropTable(jdbc, "TREE_NODE");
+ dropTable(jdbc, "EMPTY_NODE");
dropTable(jdbc, "EXTENDED_NODE");
}
}
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
new file mode 100644
index 0000000000..d8358bbd06
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/Bugzilla154389Test.java
@@ -0,0 +1,118 @@
+/***************************************************************************
+ * 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.model1;
+
+
+import testmodel1.EmptyNode;
+import testmodel1.TreeNode;
+
+
+/**
+ * attributes in super class returned by server, ignored by client.
+ *
+ * The issue occurs when an object is loaded that has no attributes.
+ * All the attributes are in the super class.
+ *
+ * When the object is loaded the server transmits all of the attributes,
+ * which include the super class attributes. The client side ignored the
+ * attributes and mis-interpreted the message containing the attributes as
+ * the next object. From this point on nothing will work...
+ *
+ * So, it looks like the client and server don't match here.
+ *
+ * Both client and server are current with CVS as of today.
+ *
+ * See https://bugs.eclipse.org/bugs/show_bug.cgi?id=154389
+ */
+public class Bugzilla154389Test extends AbstractModel1Test
+{
+ public void testEmptyRoot() throws Exception
+ {
+ final String RESOURCE = "/test/res";
+ final String ROOT = "root";
+ final boolean BOOLEAN_VALUE = true;
+ final int INT_VALUE = 12345;
+
+ { // Execution
+ TreeNode root = createEmpty(ROOT);
+ root.setBooleanFeature(BOOLEAN_VALUE);
+ root.setIntFeature(INT_VALUE);
+ saveRoot(root, RESOURCE);
+ }
+
+ { // Verification
+ TreeNode root = (TreeNode) loadRoot(RESOURCE);
+ assertNode(ROOT, root);
+ assertEquals(BOOLEAN_VALUE, root.isBooleanFeature());
+ assertEquals(INT_VALUE, root.getIntFeature());
+ }
+ }
+
+ public void testEmptyChild() throws Exception
+ {
+ final String RESOURCE = "/test/res";
+ final String ROOT = "root";
+ final String CHILD = "child";
+ final boolean BOOLEAN_VALUE = true;
+ final int INT_VALUE = 12345;
+
+ { // Execution
+ TreeNode root = createEmpty(ROOT);
+ EmptyNode child = createEmpty(CHILD, root);
+ child.setBooleanFeature(BOOLEAN_VALUE);
+ child.setIntFeature(INT_VALUE);
+ saveRoot(root, RESOURCE);
+ }
+
+ { // Verification
+ TreeNode root = (TreeNode) loadRoot(RESOURCE);
+ assertNode(ROOT, root);
+
+ TreeNode child = findChild(CHILD, root);
+ assertEquals(BOOLEAN_VALUE, child.isBooleanFeature());
+ assertEquals(INT_VALUE, child.getIntFeature());
+ }
+ }
+
+ public void testEmptyXRef() 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);
+ 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());
+ }
+ }
+}

Back to the top