Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2013-01-10 02:32:59 -0500
committerEike Stepper2013-01-10 02:35:26 -0500
commitb899f55d75a91e78c3da5c7038cbe0810335df6e (patch)
tree0e6daaf55bf203812b1c4a98d7f988238c991ccf
parent23bec8f55f995a5b31deb2714f6d5c335c091d29 (diff)
downloadcdo-b899f55d75a91e78c3da5c7038cbe0810335df6e.tar.gz
cdo-b899f55d75a91e78c3da5c7038cbe0810335df6e.tar.xz
cdo-b899f55d75a91e78c3da5c7038cbe0810335df6e.zip
[390283] [DB] Incorrect handling of operations on unordered ELists
https://bugs.eclipse.org/bugs/show_bug.cgi?id=390283
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_390283_Test.java82
1 files changed, 82 insertions, 0 deletions
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_390283_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_390283_Test.java
new file mode 100644
index 0000000000..65bc5b6f89
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_390283_Test.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2004 - 2012 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:
+ * Eike Stepper - 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.config.impl.ConfigTest.Skips;
+import org.eclipse.emf.cdo.tests.model6.UnorderedList;
+import org.eclipse.emf.cdo.transaction.CDOTransaction;
+
+import org.eclipse.emf.common.util.EList;
+
+import java.util.Arrays;
+
+/**
+ * Bug 390283: Incorrect handling of operations on unordered ELists
+ *
+ * @author Eike Stepper
+ */
+@Skips("DB.ranges")
+public class Bugzilla_390283_Test extends AbstractCDOTest
+{
+ public void testAddAfterRemove() throws Exception
+ {
+ CDOSession session = openSession();
+ CDOTransaction transaction = session.openTransaction();
+ CDOResource resource = transaction.createResource(getResourcePath("/resource1"));
+
+ UnorderedList object = getModel6Factory().createUnorderedList();
+ EList<UnorderedList> list = object.getContained();
+
+ UnorderedList elem0 = getModel6Factory().createUnorderedList();
+ UnorderedList elem1 = getModel6Factory().createUnorderedList();
+ UnorderedList elem2 = getModel6Factory().createUnorderedList();
+ UnorderedList elem3 = getModel6Factory().createUnorderedList(); // Does not fail for less than 4 elems!
+ list.addAll(Arrays.asList(elem0, elem1, elem2, elem3));
+
+ resource.getContents().add(object);
+ transaction.commit();
+
+ // Remove
+ list.remove(elem1);
+
+ // Add
+ UnorderedList elem4 = getModel6Factory().createUnorderedList();
+ list.add(elem4);
+
+ transaction.commit();
+ }
+
+ public void testRemoveFromMiddle() throws Exception
+ {
+ CDOSession session = openSession();
+ CDOTransaction transaction = session.openTransaction();
+ CDOResource resource = transaction.createResource(getResourcePath("/resource1"));
+
+ UnorderedList object = getModel6Factory().createUnorderedList();
+ EList<UnorderedList> list = object.getContained();
+
+ UnorderedList elem1 = getModel6Factory().createUnorderedList();
+ UnorderedList elem2 = getModel6Factory().createUnorderedList();
+ UnorderedList elem3 = getModel6Factory().createUnorderedList();
+ list.addAll(Arrays.asList(elem1, elem2, elem3));
+
+ resource.getContents().add(object);
+ transaction.commit();
+
+ // Remove
+ list.remove(elem1); // Does not fail for "remove by index"!
+
+ transaction.commit();
+ }
+}

Back to the top