summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Winkler2009-04-03 06:08:36 (EDT)
committerStefan Winkler2009-04-03 06:08:36 (EDT)
commit4522d046be034380335f11c44edaa3d5f2878e96 (patch)
treed21fefc40a5116d6bdb0beeb181c4fdfed5bbc00
parent27d8e810383f54683f5ee508f7564c055b37c817 (diff)
downloadcdo-4522d046be034380335f11c44edaa3d5f2878e96.zip
cdo-4522d046be034380335f11c44edaa3d5f2878e96.tar.gz
cdo-4522d046be034380335f11c44edaa3d5f2878e96.tar.bz2
[270429] [DB] Removing references from MutiValued References does not work in delta-aware DB-Store
https://bugs.eclipse.org/bugs/show_bug.cgi?id=270429
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/ClassMapping.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllTestsAllConfigs.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_270429_Test.java100
3 files changed, 103 insertions, 1 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/ClassMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/ClassMapping.java
index fc67745..396bfe5 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/ClassMapping.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/ClassMapping.java
@@ -694,7 +694,7 @@ public abstract class ClassMapping implements IClassMapping
public void visit(CDORemoveFeatureDelta delta)
{
- getReferenceMapping(delta.getFeature()).removeReferenceEntry(accessor, id, newVersion, delta.getIndex());
+ getReferenceMapping(delta.getFeature()).removeReferenceEntry(accessor, id, delta.getIndex(), newVersion);
}
public void visit(CDOContainerFeatureDelta delta)
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllTestsAllConfigs.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllTestsAllConfigs.java
index 0de9fca..4aff831 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllTestsAllConfigs.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllTestsAllConfigs.java
@@ -44,6 +44,7 @@ import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_265114_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_266857_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_266982_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_267050_Test;
+import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_270429_Test;
import org.eclipse.emf.cdo.tests.config.impl.ConfigTest;
import org.eclipse.emf.cdo.tests.config.impl.ConfigTestSuite;
@@ -136,6 +137,7 @@ public abstract class AllTestsAllConfigs extends ConfigTestSuite
testClasses.add(Bugzilla_266982_Test.class);
testClasses.add(Bugzilla_267050_Test.class);
// testClasses.add(Bugzilla_267352_Test.class);
+ testClasses.add(Bugzilla_270429_Test.class);
// TODO testClasses.add(NonCDOResourceTest.class);
// TODO testClasses.add(GeneratedEcoreTest.class);
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_270429_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_270429_Test.java
new file mode 100644
index 0000000..3242c88
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_270429_Test.java
@@ -0,0 +1,100 @@
+/**
+ * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
+ * 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:
+ * Stefan Winkler - initial API and implementation
+ */
+package org.eclipse.emf.cdo.tests.bugzilla;
+
+import org.eclipse.emf.cdo.eresource.CDOResource;
+import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.tests.AbstractCDOTest;
+import org.eclipse.emf.cdo.tests.model4.MultiContainedElement;
+import org.eclipse.emf.cdo.tests.model4.RefMultiContained;
+import org.eclipse.emf.cdo.tests.model4.model4Factory;
+import org.eclipse.emf.cdo.tests.model4.model4Package;
+import org.eclipse.emf.cdo.tests.model4interfaces.model4interfacesPackage;
+import org.eclipse.emf.cdo.transaction.CDOTransaction;
+import org.eclipse.emf.cdo.view.CDOView;
+
+/**
+ * @author Stefan Winkler
+ */
+public class Bugzilla_270429_Test extends AbstractCDOTest
+{
+ public void testTwoWayReferenceDeletion()
+ {
+
+ {
+ CDOSession session = openSession();
+ session.getPackageRegistry().putEPackage(model4Package.eINSTANCE);
+ session.getPackageRegistry().putEPackage(model4interfacesPackage.eINSTANCE);
+
+ CDOTransaction tx = session.openTransaction();
+ CDOResource res = tx.createResource("/test/1");
+
+ RefMultiContained parent = model4Factory.eINSTANCE.createRefMultiContained();
+
+ MultiContainedElement child1 = model4Factory.eINSTANCE.createMultiContainedElement();
+ child1.setName("Element1");
+ child1.setParent(parent);
+
+ MultiContainedElement child2 = model4Factory.eINSTANCE.createMultiContainedElement();
+ child2.setName("Element2");
+ parent.getElements().add(child2);
+
+ res.getContents().add(parent);
+
+ tx.commit();
+
+ tx.close();
+ session.close();
+ clearCache(getRepository().getRevisionManager());
+
+ }
+
+ {
+ CDOSession session = openSession();
+ session.getPackageRegistry().putEPackage(model4Package.eINSTANCE);
+ session.getPackageRegistry().putEPackage(model4interfacesPackage.eINSTANCE);
+
+ CDOTransaction tx = session.openTransaction();
+ CDOResource res = tx.getResource("/test/1");
+
+ RefMultiContained parent = (RefMultiContained)res.getContents().get(0);
+ MultiContainedElement child1 = parent.getElements().get(0);
+ MultiContainedElement child2 = parent.getElements().get(1);
+
+ assertEquals("Element1", child1.getName());
+ assertEquals("Element2", child2.getName());
+
+ parent.getElements().remove(child1);
+ child2.setParent(null);
+
+ tx.commit();
+ tx.close();
+ session.close();
+ clearCache(getRepository().getRevisionManager());
+ }
+
+ {
+ CDOSession session = openSession();
+ session.getPackageRegistry().putEPackage(model4Package.eINSTANCE);
+ session.getPackageRegistry().putEPackage(model4interfacesPackage.eINSTANCE);
+
+ CDOView tx = session.openView();
+ CDOResource res = tx.getResource("/test/1");
+
+ RefMultiContained parent = (RefMultiContained)res.getContents().get(0);
+ assertEquals(0, parent.getElements().size());
+
+ tx.close();
+ session.close();
+ clearCache(getRepository().getRevisionManager());
+ }
+ }
+}