summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2006-08-20 05:44:44 (EDT)
committerEike Stepper2006-08-20 05:44:44 (EDT)
commit54136e4fa8ea5039f0f42fcc933e993abfb1d576 (patch)
tree53e2e04c73e7d216e3402d417524e9303b82f6f3
parentf3b24fde9eac46af2b49314ffeac98bedebf1327 (diff)
downloadcdo-54136e4fa8ea5039f0f42fcc933e993abfb1d576.zip
cdo-54136e4fa8ea5039f0f42fcc933e993abfb1d576.tar.gz
cdo-54136e4fa8ea5039f0f42fcc933e993abfb1d576.tar.bz2
[154389] attributes in super class returned by server, ignored by client
https://bugs.eclipse.org/bugs/show_bug.cgi?id=154389
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/model/TestModel1.ecore4
-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/BasicTest.java14
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/Bugzilla154389Test.java65
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/testmodel1/EmptyRefNode.java47
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/testmodel1/impl/EmptyRefNodeImpl.java145
6 files changed, 280 insertions, 10 deletions
diff --git a/plugins/org.eclipse.emf.cdo.tests/model/TestModel1.ecore b/plugins/org.eclipse.emf.cdo.tests/model/TestModel1.ecore
index 63cd1f5..b010a1e 100644
--- a/plugins/org.eclipse.emf.cdo.tests/model/TestModel1.ecore
+++ b/plugins/org.eclipse.emf.cdo.tests/model/TestModel1.ecore
@@ -22,4 +22,8 @@
<eStructuralFeatures xsi:type="ecore:EAttribute" name="stringFeature2" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="EmptyNode" eSuperTypes="#//TreeNode"/>
+ <eClassifiers xsi:type="ecore:EClass" name="EmptyRefNode" eSuperTypes="#//TreeNode">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="moreReferences" upperBound="-1"
+ eType="#//TreeNode"/>
+ </eClassifiers>
</ecore:EPackage>
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 f777564..45fd503 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 f105f1a..123bb43 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 d8358bb..03e4b93 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 0000000..76938f1
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/EmptyRefNode.java
@@ -0,0 +1,47 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package testmodel1;
+
+
+import org.eclipse.emf.common.util.EList;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Empty Ref Node</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link testmodel1.EmptyRefNode#getMoreReferences <em>More References</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see testmodel1.TestModel1Package#getEmptyRefNode()
+ * @model
+ * @generated
+ */
+public interface EmptyRefNode extends TreeNode
+{
+ /**
+ * Returns the value of the '<em><b>More References</b></em>' reference list.
+ * The list contents are of type {@link testmodel1.TreeNode}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>More References</em>' reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>More References</em>' 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 0000000..6d6c6c5
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/impl/EmptyRefNodeImpl.java
@@ -0,0 +1,145 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package testmodel1.impl;
+
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.util.EObjectResolvingEList;
+
+import testmodel1.EmptyRefNode;
+import testmodel1.TestModel1Package;
+import testmodel1.TreeNode;
+
+import java.util.Collection;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Empty Ref Node</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link testmodel1.impl.EmptyRefNodeImpl#getMoreReferences <em>More References</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class EmptyRefNodeImpl extends TreeNodeImpl implements EmptyRefNode
+{
+ /**
+ * The cached value of the '{@link #getMoreReferences() <em>More References</em>}' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getMoreReferences()
+ * @generated
+ * @ordered
+ */
+ protected EList moreReferences = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected EmptyRefNodeImpl()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected EClass eStaticClass()
+ {
+ return TestModel1Package.Literals.EMPTY_REF_NODE;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EList getMoreReferences()
+ {
+ cdoLoad();
+ if (moreReferences == null)
+ {
+ moreReferences = new EObjectResolvingEList(TreeNode.class, this,
+ TestModel1Package.EMPTY_REF_NODE__MORE_REFERENCES);
+ }
+ return moreReferences;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case TestModel1Package.EMPTY_REF_NODE__MORE_REFERENCES:
+ return getMoreReferences();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case TestModel1Package.EMPTY_REF_NODE__MORE_REFERENCES:
+ getMoreReferences().clear();
+ getMoreReferences().addAll((Collection) newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case TestModel1Package.EMPTY_REF_NODE__MORE_REFERENCES:
+ getMoreReferences().clear();
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case TestModel1Package.EMPTY_REF_NODE__MORE_REFERENCES:
+ return moreReferences != null && !moreReferences.isEmpty();
+ }
+ return super.eIsSet(featureID);
+ }
+
+} //EmptyRefNodeImpl \ No newline at end of file