diff options
author | Eike Stepper | 2017-01-13 07:41:44 +0000 |
---|---|---|
committer | Eike Stepper | 2017-01-13 08:18:31 +0000 |
commit | 226fddd44f9b402b4c2330ce32c469cdc71a61dd (patch) | |
tree | 12850a5dd1e3734ff8b17dd5413ddfdf48b6e8e6 /plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests | |
parent | bb6dacda5af21995d9632c1ec9444e7d5e2a63c5 (diff) | |
download | cdo-226fddd44f9b402b4c2330ce32c469cdc71a61dd.tar.gz cdo-226fddd44f9b402b4c2330ce32c469cdc71a61dd.tar.xz cdo-226fddd44f9b402b4c2330ce32c469cdc71a61dd.zip |
[510412] DefaultCDOMerger produces incorrect results for MOVE deltas in many-valued features
https://bugs.eclipse.org/bugs/show_bug.cgi?id=510412
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests')
16 files changed, 667 insertions, 341 deletions
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ConflictResolverExtendedTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ConflictResolverExtendedTest.java index cf7c30ac23..ac0ee6a3bb 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ConflictResolverExtendedTest.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ConflictResolverExtendedTest.java @@ -11,6 +11,7 @@ package org.eclipse.emf.cdo.tests; import org.eclipse.emf.cdo.CDOState; +import org.eclipse.emf.cdo.common.CDOCommonRepository.ListOrdering; import org.eclipse.emf.cdo.common.CDOCommonSession; import org.eclipse.emf.cdo.eresource.CDOResource; import org.eclipse.emf.cdo.session.CDOSession; @@ -43,11 +44,7 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest { private static final String TEST_RESOURCE_NAME = "/test1"; - // --- initialize model ---------------------------------------------------- - - // --- conflict test ------------------------------------------------------- - - public void _testProvokeConflictOnServerTest() throws Exception + public void _testProvokeConflictOnServer() throws Exception { initTestModelSimple(); @@ -74,7 +71,7 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest } } - public void _testProvokeConflictLocalTest() throws Exception + public void _testProvokeConflictLocal() throws Exception { initTestModelSimple(); @@ -101,9 +98,7 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest } } - // --- single value conflict resolver tests -------------------------- - - public void testChangeChangeTest() throws Exception + public void testChangeChange() throws Exception { initTestModelSimple(); @@ -124,7 +119,7 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest assertEquals(true, thatTransaction.hasConflict()); } - public void testRemoveChangeTest() throws Exception + public void testRemoveChange() throws Exception { initTestModelSimple(); @@ -146,7 +141,7 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest assertEquals(true, thatTransaction.hasConflict()); } - public void testChangeRemoveTest() throws Exception + public void testChangeRemove() throws Exception { initTestModelSimple(); @@ -175,7 +170,7 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest assertEquals(objects - 1, getTestModelRoot(thisTransaction).getListA().size()); } - public void testRemoveAddTest() throws Exception + public void testRemoveAdd() throws Exception { initTestModelSimple(); @@ -202,7 +197,7 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest assertEquals(true, thatTransaction.hasConflict()); } - public void testAddRemoveTest() throws Exception + public void testAddRemove() throws Exception { initTestModelSimple(); @@ -234,7 +229,7 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest assertEquals(objects - 1, getTestModelRoot(thisTransaction).getListB().size()); } - public void testRemoveRemoveTest() throws Exception + public void testRemoveRemove() throws Exception { initTestModelSimple(); @@ -261,9 +256,40 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest assertEquals(false, thatTransaction.hasConflict()); } - // --- resolve many valued changes ------------------------------------- + public void test_RemoveRemove_MoveRemoveRemoveRemove() throws Exception + { + initTestModel(); + + CDOSession session = openSessionWithAdditionsMode(); + CDOTransaction thisTransaction = session.openTransaction(); + CDOTransaction thatTransaction = session.openTransaction(); + addConflictResolver(thatTransaction); + + Root thisRoot = getTestModelRoot(thisTransaction); + Root thatRoot = thatTransaction.getObject(thisRoot); + + EList<BaseObject> thisList = thisRoot.getListA(); + EList<BaseObject> thatList = thatRoot.getListA(); + BaseObject thatLastObject = thatList.get(4); - public void testManyValuedAddAddTest() throws Exception + thisList.remove(1); // Removes the original index 1. + thisList.remove(1); // Removes the original index 2. + + thatList.move(1, 4); + thatList.remove(3); // Removes the original index 2. + thatList.remove(3); // Removes the original index 3. + thatList.remove(2); // Removes the original index 1. + thatList.remove(0); // Removes the original index 4. + + commitAndSync(thisTransaction, thatTransaction); + assertEquals(true, thatTransaction.isDirty()); + assertEquals(false, thatTransaction.hasConflict()); + + assertEquals(1, thatList.size()); + assertEquals(thatLastObject, thatList.get(0)); + } + + public void testManyValuedAddAdd() throws Exception { initTestModelSimple(); @@ -291,7 +317,92 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest assertEquals(false, thatTransaction.isDirty()); } - public void testManyValuedAddChangeTest() throws Exception + public void testManyValuedAddAdd_SameValue() throws Exception + { + initTestModel(); + + CDOSession session = openSessionWithAdditionsMode(); + CDOTransaction thisTransaction = session.openTransaction(); + CDOTransaction thatTransaction = session.openTransaction(); + addConflictResolver(thatTransaction); + + Root thisRoot = getTestModelRoot(thisTransaction); + EList<BaseObject> thisList = thisRoot.getListA(); + int objects = thisList.size(); + + Root thatRoot = thatTransaction.getObject(thisRoot); + EList<BaseObject> thatList = thatRoot.getListA(); + + // Add the same existing element from list B. + thisList.add(0, thisRoot.getListB().get(0)); + thatList.add(0, thatRoot.getListB().get(0)); + thatList.remove(1); + + commitAndSync(thisTransaction, thatTransaction); + commitAndSync(thatTransaction, thisTransaction); + + assertEquals(objects + 1 - 1, thisList.size()); + assertEquals(false, thisTransaction.isDirty()); + assertEquals(false, thatTransaction.isDirty()); + } + + public void testManyValuedAddSet_SameValue() throws Exception + { + initTestModel(); + + CDOSession session = openSessionWithAdditionsMode(); + CDOTransaction thisTransaction = session.openTransaction(); + CDOTransaction thatTransaction = session.openTransaction(); + addConflictResolver(thatTransaction); + + Root thisRoot = getTestModelRoot(thisTransaction); + EList<BaseObject> thisList = thisRoot.getListA(); + int objects = thisList.size(); + + Root thatRoot = thatTransaction.getObject(thisRoot); + EList<BaseObject> thatList = thatRoot.getListA(); + + // Add the same existing element from list B. + thisList.add(0, thisRoot.getListB().get(0)); + thatList.set(0, thatRoot.getListB().get(0)); + + commitAndSync(thisTransaction, thatTransaction); + commitAndSync(thatTransaction, thisTransaction); + + assertEquals(objects + 1 - 1, thisList.size()); + assertEquals(false, thisTransaction.isDirty()); + assertEquals(false, thatTransaction.isDirty()); + } + + public void testManyValuedSetAdd_SameValue() throws Exception + { + initTestModel(); + + CDOSession session = openSessionWithAdditionsMode(); + CDOTransaction thisTransaction = session.openTransaction(); + CDOTransaction thatTransaction = session.openTransaction(); + addConflictResolver(thatTransaction); + + Root thisRoot = getTestModelRoot(thisTransaction); + EList<BaseObject> thisList = thisRoot.getListA(); + int objects = thisList.size(); + + Root thatRoot = thatTransaction.getObject(thisRoot); + EList<BaseObject> thatList = thatRoot.getListA(); + + // Add the same existing element from list B. + thisList.set(0, thisRoot.getListB().get(0)); + thatList.add(0, thatRoot.getListB().get(0)); + + commitAndSync(thisTransaction, thatTransaction); + commitAndSync(thatTransaction, thisTransaction); + + assertEquals(objects + 1 - 1, thisList.size()); + assertEquals(false, thisTransaction.isDirty()); + assertEquals(false, thatTransaction.isDirty()); + } + + public void testManyValuedAddChange() throws Exception { initTestModelSimple(); @@ -322,7 +433,7 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest assertEquals(objects + 1, getTestModelRoot(thisTransaction).getListA().size()); } - public void testManyValuedChangeAddTest() throws Exception + public void testManyValuedChangeAdd() throws Exception { initTestModelSimple(); @@ -353,7 +464,7 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest assertEquals(objects + 1, getTestModelRoot(thisTransaction).getListA().size()); } - public void testManyValuedAddRemoveTest() throws Exception + public void testManyValuedAddRemove() throws Exception { initTestModelSimple(); @@ -383,7 +494,7 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest assertEquals(objects, getTestModelRoot(thisTransaction).getListA().size()); } - public void testManyValuedRemoveAddTest() throws Exception + public void testManyValuedRemoveAdd() throws Exception { initTestModelSimple(); @@ -413,7 +524,7 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest assertEquals(objects, thisList.size()); } - public void testManyValuedChangeRemoveTest() throws Exception + public void testManyValuedChangeRemove() throws Exception { initTestModelSimple(); @@ -472,7 +583,7 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest assertEquals(objects - 1, thisList.size()); } - public void testManyValuedRemoveChangeTest() throws Exception + public void testManyValuedRemoveChange() throws Exception { initTestModelSimple(); @@ -523,7 +634,7 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest assertEquals(false, thatTransaction.hasConflict()); } - public void testManyValuedChangeChangeTest() throws Exception + public void testManyValuedChangeChange() throws Exception { initTestModelSimple(); @@ -581,7 +692,7 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest assertEquals(objects, getTestModelRoot(thisTransaction).getListA().size()); } - public void testManyValuedRemoveRemoveTest() throws Exception + public void testManyValuedRemoveRemove() throws Exception { initTestModelSimple(); @@ -635,7 +746,7 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest assertEquals(objects - 1, getTestModelRoot(thisTransaction).getListA().size()); } - public void testManyValuedAddAddRemoveRemoveTest() throws Exception + public void testManyValuedAddAddRemoveRemove() throws Exception { initTestModelSimple(); @@ -668,7 +779,7 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest assertEquals(objects, thisList.size()); } - public void testManyValuedAddAddRemoveRemove2Test() throws Exception + public void testManyValuedAddAddRemoveRemove2() throws Exception { initTestModelSimple(); @@ -701,9 +812,7 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest } - // --- initialize model ---------------------------------------------------- - - public void testManyValuedRemoveRemoveAddAddTest() throws Exception + public void testManyValuedRemoveRemoveAddAdd() throws Exception { initTestModelSimple(); @@ -736,9 +845,7 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest } - // --- list conflict resolver tests ---------------------------------------- - - public void testAddHeadAddHeadTest() throws Exception + public void testAddHeadAddHead() throws Exception { initTestModel(); @@ -774,13 +881,17 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest // Check indices. assertEquals(false, thisTransaction.isDirty()); assertEquals(false, thatTransaction.isDirty()); - assertEquals(thisListA.get(1), thisObject); - assertEquals(thisListA.get(0), thisTransaction.getObject(thatObject)); - assertEquals(thatListA.get(1), thatTransaction.getObject(thisObject)); - assertEquals(thatListA.get(0), thatObject); + + if (getRepositoryConfig().listOrdering() == ListOrdering.ORDERED) + { + assertEquals(thisListA.get(0), thisObject); + assertEquals(thisListA.get(1), thisTransaction.getObject(thatObject)); + assertEquals(thatListA.get(0), thatTransaction.getObject(thisObject)); + assertEquals(thatListA.get(1), thatObject); + } } - public void testAddHeadAddTailTest() throws Exception + public void testAddHeadAddTail() throws Exception { initTestModel(); @@ -822,7 +933,7 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest assertEquals(objects + 2, thatList.size()); } - public void testAddTailAddTailTest() throws Exception + public void testAddTailAddTail() throws Exception { initTestModel(); @@ -857,13 +968,13 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest int size = thisRoot.getListA().size(); assertEquals(false, thisTransaction.isDirty()); assertEquals(false, thatTransaction.isDirty()); - assertEquals(thisRoot.getListA().get(size - 1), thisObject); - assertEquals(thisRoot.getListA().get(size - 2), thisTransaction.getObject(thatObject)); - assertEquals(thatRoot.getListA().get(size - 1), thatTransaction.getObject(thisObject)); - assertEquals(thatRoot.getListA().get(size - 2), thatObject); + assertEquals(thisRoot.getListA().get(size - 2), thisObject); + assertEquals(thisRoot.getListA().get(size - 1), thisTransaction.getObject(thatObject)); + assertEquals(thatRoot.getListA().get(size - 2), thatTransaction.getObject(thisObject)); + assertEquals(thatRoot.getListA().get(size - 1), thatObject); } - public void testAddTailAddHeadTest() throws Exception + public void testAddTailAddHead() throws Exception { initTestModel(); @@ -901,15 +1012,17 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest int size = thisList.size(); assertEquals(false, thisTransaction.isDirty()); assertEquals(false, thatTransaction.isDirty()); - assertEquals(thisList.get(size - 1), thisObject); - assertEquals(thisList.get(0), thisTransaction.getObject(thatObject)); - assertEquals(thatList.get(size - 1), thatTransaction.getObject(thisObject)); - assertEquals(thatList.get(0), thatObject); - } - // Add - remove + if (getRepositoryConfig().listOrdering() == ListOrdering.ORDERED) + { + assertEquals(thisList.get(size - 1), thisObject); + assertEquals(thisList.get(0), thisTransaction.getObject(thatObject)); + assertEquals(thatList.get(size - 1), thatTransaction.getObject(thisObject)); + assertEquals(thatList.get(0), thatObject); + } + } - public void testAddHeadRemoveHeadTest() throws Exception + public void testAddHeadRemoveHead() throws Exception { initTestModel(); @@ -947,15 +1060,19 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest // Check indices. assertEquals(false, thisTransaction.isDirty()); assertEquals(false, thatTransaction.isDirty()); - assertEquals(thisRoot.getListA().get(0), thisObject); - assertEquals(thisRoot.getListA().get(1), thisTransaction.getObject(thatAfterRemoveObject)); - assertEquals(thatRoot.getListA().get(0), thatTransaction.getObject(thisObject)); - assertEquals(thatRoot.getListA().get(1), thatAfterRemoveObject); assertEquals(CDOUtil.getCDOObject(thisRemoveObject).cdoState(), CDOState.INVALID); assertEquals(CDOUtil.getCDOObject(thatRemoveObject).cdoState(), CDOState.TRANSIENT); + + if (getRepositoryConfig().listOrdering() == ListOrdering.ORDERED) + { + assertEquals(thisRoot.getListA().get(0), thisObject); + assertEquals(thisRoot.getListA().get(1), thisTransaction.getObject(thatAfterRemoveObject)); + assertEquals(thatRoot.getListA().get(0), thatTransaction.getObject(thisObject)); + assertEquals(thatRoot.getListA().get(1), thatAfterRemoveObject); + } } - public void testAddHeadRemoveTailTest() throws Exception + public void testAddHeadRemoveTail() throws Exception { initTestModel(); @@ -995,15 +1112,19 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest int size = thisRoot.getListA().size(); assertEquals(false, thisTransaction.isDirty()); assertEquals(false, thatTransaction.isDirty()); - assertEquals(thisRoot.getListA().get(0), thisObject); - assertEquals(thisRoot.getListA().get(size - 1), thisTransaction.getObject(thatBeforeRemoveObject)); - assertEquals(thatRoot.getListA().get(0), thatTransaction.getObject(thisObject)); - assertEquals(thatRoot.getListA().get(size - 1), thatBeforeRemoveObject); assertEquals(CDOUtil.getCDOObject(thisRemoveObject).cdoState(), CDOState.INVALID); assertEquals(CDOUtil.getCDOObject(thatRemoveObject).cdoState(), CDOState.TRANSIENT); + + if (getRepositoryConfig().listOrdering() == ListOrdering.ORDERED) + { + assertEquals(thisRoot.getListA().get(0), thisObject); + assertEquals(thisRoot.getListA().get(size - 1), thisTransaction.getObject(thatBeforeRemoveObject)); + assertEquals(thatRoot.getListA().get(0), thatTransaction.getObject(thisObject)); + assertEquals(thatRoot.getListA().get(size - 1), thatBeforeRemoveObject); + } } - public void testAddTailRemoveTailTest() throws Exception + public void testAddTailRemoveTail() throws Exception { initTestModel(); @@ -1051,7 +1172,7 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest assertEquals(CDOUtil.getCDOObject(thatRemoveObject).cdoState(), CDOState.TRANSIENT); } - public void testAddTailRemoveHeadTest() throws Exception + public void testAddTailRemoveHead() throws Exception { initTestModel(); @@ -1098,9 +1219,7 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest assertEquals(CDOUtil.getCDOObject(thatRemoveObject).cdoState(), CDOState.TRANSIENT); } - // Add - move - - public void testAddHeadMoveHeadTest() throws Exception + public void testAddHeadMoveHead() throws Exception { initTestModel(); @@ -1136,13 +1255,17 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest int size = thisRoot.getListA().size(); assertEquals(false, thisTransaction.isDirty()); assertEquals(false, thatTransaction.isDirty()); - assertEquals(thisRoot.getListA().get(0), thisObject); - assertEquals(thisRoot.getListA().get(size - 1), thisTransaction.getObject(thatMoveObject)); - assertEquals(thatRoot.getListA().get(0), thatTransaction.getObject(thisObject)); - assertEquals(thatRoot.getListA().get(size - 1), thatMoveObject); + + if (getRepositoryConfig().listOrdering() == ListOrdering.ORDERED) + { + assertEquals(thisRoot.getListA().get(0), thisObject); + assertEquals(thisRoot.getListA().get(size - 1), thisTransaction.getObject(thatMoveObject)); + assertEquals(thatRoot.getListA().get(0), thatTransaction.getObject(thisObject)); + assertEquals(thatRoot.getListA().get(size - 1), thatMoveObject); + } } - public void testAddHeadMoveTailTest() throws Exception + public void testAddHeadMoveTail() throws Exception { initTestModel(); @@ -1182,7 +1305,7 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest assertEquals(objects + 1, thatList.size()); } - public void testAddTailMoveTailTest() throws Exception + public void testAddTailMoveTail() throws Exception { initTestModel(); @@ -1218,13 +1341,17 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest int size = thisRoot.getListA().size(); assertEquals(false, thisTransaction.isDirty()); assertEquals(false, thatTransaction.isDirty()); - assertEquals(thisRoot.getListA().get(size - 1), thisObject); - assertEquals(thisRoot.getListA().get(0), thisTransaction.getObject(thatMoveObject)); - assertEquals(thatRoot.getListA().get(size - 1), thatTransaction.getObject(thisObject)); - assertEquals(thatRoot.getListA().get(0), thatMoveObject); + + if (getRepositoryConfig().listOrdering() == ListOrdering.ORDERED) + { + assertEquals(thisRoot.getListA().get(size - 1), thisObject); + assertEquals(thisRoot.getListA().get(0), thisTransaction.getObject(thatMoveObject)); + assertEquals(thatRoot.getListA().get(size - 1), thatTransaction.getObject(thisObject)); + assertEquals(thatRoot.getListA().get(0), thatMoveObject); + } } - public void testAddTailMoveHeadTest() throws Exception + public void testAddTailMoveHead() throws Exception { initTestModel(); @@ -1266,7 +1393,7 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest assertEquals(thatRoot.getListA().get(0), thatAfterRemoveObject); } - public void testAddHeadClearTest() throws Exception + public void testAddHeadClear() throws Exception { initTestModel(); @@ -1311,7 +1438,7 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest assertEquals(CDOState.CLEAN, CDOUtil.getCDOObject(thisObject).cdoState()); } - public void testAddTailClearTest() throws Exception + public void testAddTailClear() throws Exception { initTestModel(); @@ -1356,7 +1483,7 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest assertEquals(CDOState.CLEAN, CDOUtil.getCDOObject(thisObject).cdoState()); } - public void testRemoveHeadAddHeadTest() throws Exception + public void testRemoveHeadAddHead() throws Exception { initTestModel(); @@ -1394,15 +1521,19 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest // Check indices. assertEquals(false, thisTransaction.isDirty()); assertEquals(false, thatTransaction.isDirty()); - assertEquals(thisRoot.getListA().get(0), thisTransaction.getObject(thatObject)); - assertEquals(thisRoot.getListA().get(1), thisAfterRemoveObject); - assertEquals(thatRoot.getListA().get(0), thatTransaction.getObject(thatObject)); - assertEquals(thatRoot.getListA().get(1), thatTransaction.getObject(thisAfterRemoveObject)); assertEquals(CDOState.TRANSIENT, CDOUtil.getCDOObject(thisRemoveObject).cdoState()); assertEquals(CDOState.INVALID, CDOUtil.getCDOObject(thatRemoveObject).cdoState()); + + if (getRepositoryConfig().listOrdering() == ListOrdering.ORDERED) + { + assertEquals(thisRoot.getListA().get(0), thisTransaction.getObject(thatObject)); + assertEquals(thisRoot.getListA().get(1), thisAfterRemoveObject); + assertEquals(thatRoot.getListA().get(0), thatTransaction.getObject(thatObject)); + assertEquals(thatRoot.getListA().get(1), thatTransaction.getObject(thisAfterRemoveObject)); + } } - public void testRemoveHeadAddTailTest() throws Exception + public void testRemoveHeadAddTail() throws Exception { initTestModel(); @@ -1449,7 +1580,7 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest assertEquals(CDOState.INVALID, CDOUtil.getCDOObject(thatRemoveObject).cdoState()); } - public void testRemoveTailAddHeadTest() throws Exception + public void testRemoveTailAddHead() throws Exception { initTestModel(); @@ -1488,15 +1619,19 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest int listSize = thisRoot.getListA().size(); assertEquals(false, thisTransaction.isDirty()); assertEquals(false, thatTransaction.isDirty()); - assertEquals(thisRoot.getListA().get(0), thisTransaction.getObject(thatObject)); - assertEquals(thisRoot.getListA().get(listSize - 1), thisAfterRemoveObject); - assertEquals(thatRoot.getListA().get(0), thatTransaction.getObject(thatObject)); - assertEquals(thatRoot.getListA().get(listSize - 1), thatTransaction.getObject(thisAfterRemoveObject)); assertEquals(CDOState.TRANSIENT, CDOUtil.getCDOObject(thisRemoveObject).cdoState()); assertEquals(CDOState.INVALID, CDOUtil.getCDOObject(thatRemoveObject).cdoState()); + + if (getRepositoryConfig().listOrdering() == ListOrdering.ORDERED) + { + assertEquals(thisRoot.getListA().get(0), thisTransaction.getObject(thatObject)); + assertEquals(thisRoot.getListA().get(listSize - 1), thisAfterRemoveObject); + assertEquals(thatRoot.getListA().get(0), thatTransaction.getObject(thatObject)); + assertEquals(thatRoot.getListA().get(listSize - 1), thatTransaction.getObject(thisAfterRemoveObject)); + } } - public void testRemoveTailAddTailTest() throws Exception + public void testRemoveTailAddTail() throws Exception { initTestModel(); @@ -1543,7 +1678,7 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest assertEquals(CDOState.INVALID, CDOUtil.getCDOObject(thatRemoveObject).cdoState()); } - public void testRemoveHeadRemoveHeadTest() throws Exception + public void testRemoveHeadRemoveHead() throws Exception { initTestModel(); @@ -1592,7 +1727,7 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest assertEquals(CDOState.TRANSIENT, CDOUtil.getCDOObject(thatRemoveObject2).cdoState()); } - public void testRemoveHeadRemoveTailTest() throws Exception + public void testRemoveHeadRemoveTail() throws Exception { initTestModel(); @@ -1644,7 +1779,7 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest assertEquals(CDOState.TRANSIENT, CDOUtil.getCDOObject(thatRemoveObject2).cdoState()); } - public void testRemoveTailRemoveHeadTest() throws Exception + public void testRemoveTailRemoveHead() throws Exception { initTestModel(); @@ -1696,7 +1831,7 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest assertEquals(CDOState.TRANSIENT, CDOUtil.getCDOObject(thatRemoveObject2).cdoState()); } - public void testRemoveTailRemoveTailTest() throws Exception + public void testRemoveTailRemoveTail() throws Exception { initTestModel(); @@ -1748,7 +1883,7 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest assertEquals(CDOState.TRANSIENT, CDOUtil.getCDOObject(thatRemoveObject2).cdoState()); } - public void testRemoveHeadMoveHeadTest() throws Exception + public void testRemoveHeadMoveHead() throws Exception { initTestModel(); @@ -1798,7 +1933,7 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest assertEquals(CDOState.INVALID, CDOUtil.getCDOObject(thatMoveObject).cdoState()); } - public void testRemoveHeadMoveTailTest() throws Exception + public void testRemoveHeadMoveTail() throws Exception { initTestModel(); @@ -1838,17 +1973,21 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest int listSize = thisRoot.getListA().size(); assertEquals(false, thisTransaction.isDirty()); assertEquals(false, thatTransaction.isDirty()); - assertEquals(thisAfterRemoveObject, thisRoot.getListA().get(1)); - assertEquals(thatTransaction.getObject(thisAfterRemoveObject), thatRoot.getListA().get(1)); - assertEquals(thisTransaction.getObject(thatMoveObject), thisRoot.getListA().get(0)); - assertEquals(thatMoveObject, thatRoot.getListA().get(0)); - assertEquals(thisTransaction.getObject(thatAfterMoveObject), thisRoot.getListA().get(listSize - 1)); - assertEquals(thatAfterMoveObject, thatRoot.getListA().get(listSize - 1)); assertEquals(CDOState.TRANSIENT, CDOUtil.getCDOObject(thisRemoveObject).cdoState()); assertEquals(CDOState.INVALID, CDOUtil.getCDOObject(thatRemoveObject).cdoState()); + + if (getRepositoryConfig().listOrdering() == ListOrdering.ORDERED) + { + assertEquals(thisAfterRemoveObject, thisRoot.getListA().get(1)); + assertEquals(thatTransaction.getObject(thisAfterRemoveObject), thatRoot.getListA().get(1)); + assertEquals(thisTransaction.getObject(thatMoveObject), thisRoot.getListA().get(0)); + assertEquals(thatMoveObject, thatRoot.getListA().get(0)); + assertEquals(thisTransaction.getObject(thatAfterMoveObject), thisRoot.getListA().get(listSize - 1)); + assertEquals(thatAfterMoveObject, thatRoot.getListA().get(listSize - 1)); + } } - public void testRemoveTailMoveHeadTest() throws Exception + public void testRemoveTailMoveHead() throws Exception { initTestModel(); @@ -1888,17 +2027,21 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest int listSize = thisRoot.getListA().size(); assertEquals(false, thisTransaction.isDirty()); assertEquals(false, thatTransaction.isDirty()); - assertEquals(thisAfterRemoveObject, thisRoot.getListA().get(listSize - 2)); - assertEquals(thatTransaction.getObject(thisAfterRemoveObject), thatRoot.getListA().get(listSize - 2)); - assertEquals(thisTransaction.getObject(thatMoveObject), thisRoot.getListA().get(listSize - 1)); - assertEquals(thatMoveObject, thatRoot.getListA().get(listSize - 1)); - assertEquals(thisTransaction.getObject(thatAfterMoveObject), thisRoot.getListA().get(0)); - assertEquals(thatAfterMoveObject, thatRoot.getListA().get(0)); assertEquals(CDOState.TRANSIENT, CDOUtil.getCDOObject(thisRemoveObject).cdoState()); assertEquals(CDOState.INVALID, CDOUtil.getCDOObject(thatRemoveObject).cdoState()); + + if (getRepositoryConfig().listOrdering() == ListOrdering.ORDERED) + { + assertEquals(thisAfterRemoveObject, thisRoot.getListA().get(listSize - 2)); + assertEquals(thatTransaction.getObject(thisAfterRemoveObject), thatRoot.getListA().get(listSize - 2)); + assertEquals(thisTransaction.getObject(thatMoveObject), thisRoot.getListA().get(listSize - 1)); + assertEquals(thatMoveObject, thatRoot.getListA().get(listSize - 1)); + assertEquals(thisTransaction.getObject(thatAfterMoveObject), thisRoot.getListA().get(0)); + assertEquals(thatAfterMoveObject, thatRoot.getListA().get(0)); + } } - public void testRemoveTailMoveTailTest() throws Exception + public void testRemoveTailMoveTail() throws Exception { initTestModel(); @@ -1947,7 +2090,7 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest assertEquals(CDOState.INVALID, CDOUtil.getCDOObject(thatMoveObject).cdoState()); } - public void testRemoveHeadClearTest() throws Exception + public void testRemoveHeadClear() throws Exception { initTestModel(); @@ -1995,7 +2138,7 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest assertEquals(CDOState.INVALID, CDOUtil.getCDOObject(thisAfterRemoveObject).cdoState()); } - public void testRemoveTailClearTest() throws Exception + public void testRemoveTailClear() throws Exception { initTestModel(); @@ -2039,7 +2182,7 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest assertEquals(CDOState.INVALID, CDOUtil.getCDOObject(thisAfterRemoveObject).cdoState()); } - public void testMoveHeadAddHeadTest() throws Exception + public void testMoveHeadAddHead() throws Exception { initTestModel(); @@ -2052,39 +2195,46 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest Root thisRoot = getTestModelRoot(thisTransaction); Root thatRoot = thatTransaction.getObject(thisRoot); + EList<BaseObject> thisList = thisRoot.getListA(); + EList<BaseObject> thatList = thatRoot.getListA(); + // Attach adapters. thisRoot.eAdapters().add(new ListPrintingAdapter("This root: ")); thatRoot.eAdapters().add(new ListPrintingAdapter("That root: ")); // Move object. - BaseObject thisMoveObject = thisRoot.getListA().get(0); - thisRoot.getListA().move(thisRoot.getListA().size() - 1, 0); - BaseObject thisAfterMoveObject = thisRoot.getListA().get(0); + BaseObject thisMoveObject = thisList.get(0); + thisList.move(thisList.size() - 1, 0); + BaseObject thisAfterMoveObject = thisList.get(0); // Create object. BaseObject thatObject = createBaseObject("ThatBaseObject 0"); - thatRoot.getListA().add(0, thatObject); + thatList.add(0, thatObject); commitAndSync(thisTransaction, thatTransaction); commitAndSync(thatTransaction, thisTransaction); // Print contents of lists - printList("This ", thisRoot.getListA()); - printList("That ", thatRoot.getListA()); + printList("This ", thisList); + printList("That ", thatList); // Check indices. - int size = thisRoot.getListA().size(); + int size = thisList.size(); assertEquals(false, thisTransaction.isDirty()); assertEquals(false, thatTransaction.isDirty()); - assertEquals(thisTransaction.getObject(thatObject), thisRoot.getListA().get(0)); - assertEquals(thatObject, thatRoot.getListA().get(0)); - assertEquals(thisAfterMoveObject, thisRoot.getListA().get(1)); - assertEquals(thatTransaction.getObject(thisAfterMoveObject), thatRoot.getListA().get(1)); - assertEquals(thisMoveObject, thisRoot.getListA().get(size - 1)); - assertEquals(thatTransaction.getObject(thisMoveObject), thatRoot.getListA().get(size - 1)); + + if (getRepositoryConfig().listOrdering() == ListOrdering.ORDERED) + { + assertEquals(thisTransaction.getObject(thatObject), thisList.get(4)); + assertEquals(thatObject, thatList.get(4)); + assertEquals(thisAfterMoveObject, thisList.get(0)); + assertEquals(thatTransaction.getObject(thisAfterMoveObject), thatList.get(0)); + assertEquals(thisMoveObject, thisList.get(size - 1)); + assertEquals(thatTransaction.getObject(thisMoveObject), thatList.get(size - 1)); + } } - public void testMoveHeadAddTailTest() throws Exception + public void testMoveHeadAddTail() throws Exception { initTestModel(); @@ -2121,15 +2271,19 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest int size = thisRoot.getListA().size(); assertEquals(false, thisTransaction.isDirty()); assertEquals(false, thatTransaction.isDirty()); - assertEquals(thisTransaction.getObject(thatObject), thisRoot.getListA().get(size - 1)); - assertEquals(thatObject, thatRoot.getListA().get(size - 1)); - assertEquals(thisAfterMoveObject, thisRoot.getListA().get(0)); - assertEquals(thatTransaction.getObject(thisAfterMoveObject), thatRoot.getListA().get(0)); - assertEquals(thisMoveObject, thisRoot.getListA().get(size - 2)); - assertEquals(thatTransaction.getObject(thisMoveObject), thatRoot.getListA().get(size - 2)); + + if (getRepositoryConfig().listOrdering() == ListOrdering.ORDERED) + { + assertEquals(thisTransaction.getObject(thatObject), thisRoot.getListA().get(size - 1)); + assertEquals(thatObject, thatRoot.getListA().get(size - 1)); + assertEquals(thisAfterMoveObject, thisRoot.getListA().get(0)); + assertEquals(thatTransaction.getObject(thisAfterMoveObject), thatRoot.getListA().get(0)); + assertEquals(thisMoveObject, thisRoot.getListA().get(size - 2)); + assertEquals(thatTransaction.getObject(thisMoveObject), thatRoot.getListA().get(size - 2)); + } } - public void testMoveTailAddHeadTest() throws Exception + public void testMoveTailAddHead() throws Exception { initTestModel(); @@ -2142,39 +2296,46 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest Root thisRoot = getTestModelRoot(thisTransaction); Root thatRoot = thatTransaction.getObject(thisRoot); + EList<BaseObject> thisList = thisRoot.getListA(); + EList<BaseObject> thatList = thatRoot.getListA(); + // Attach adapters. thisRoot.eAdapters().add(new ListPrintingAdapter("This root: ")); thatRoot.eAdapters().add(new ListPrintingAdapter("That root: ")); // Move object. - BaseObject thisMoveObject = thisRoot.getListA().get(thisRoot.getListA().size() - 1); - thisRoot.getListA().move(0, thisRoot.getListA().size() - 1); - BaseObject thisAfterMoveObject = thisRoot.getListA().get(thisRoot.getListA().size() - 1); + BaseObject thisMoveObject = thisList.get(thisList.size() - 1); + thisList.move(0, thisList.size() - 1); + BaseObject thisAfterMoveObject = thisList.get(thisList.size() - 1); // Create object. BaseObject thatObject = createBaseObject("ThatBaseObject 0"); - thatRoot.getListA().add(0, thatObject); + thatList.add(0, thatObject); commitAndSync(thisTransaction, thatTransaction); commitAndSync(thatTransaction, thisTransaction); // Print contents of lists - printList("This ", thisRoot.getListA()); - printList("That ", thatRoot.getListA()); + printList("This ", thisList); + printList("That ", thatList); // Check indices. - int size = thisRoot.getListA().size(); + int size = thisList.size(); assertEquals(false, thisTransaction.isDirty()); assertEquals(false, thatTransaction.isDirty()); - assertEquals(thisTransaction.getObject(thatObject), thisRoot.getListA().get(0)); - assertEquals(thatObject, thatRoot.getListA().get(0)); - assertEquals(thisAfterMoveObject, thisRoot.getListA().get(size - 1)); - assertEquals(thatTransaction.getObject(thisAfterMoveObject), thatRoot.getListA().get(size - 1)); - assertEquals(thisMoveObject, thisRoot.getListA().get(1)); - assertEquals(thatTransaction.getObject(thisMoveObject), thatRoot.getListA().get(1)); + + if (getRepositoryConfig().listOrdering() == ListOrdering.ORDERED) + { + assertEquals(thisTransaction.getObject(thatObject), thisList.get(1)); + assertEquals(thatObject, thatList.get(1)); + assertEquals(thisAfterMoveObject, thisList.get(size - 1)); + assertEquals(thatTransaction.getObject(thisAfterMoveObject), thatList.get(size - 1)); + assertEquals(thisMoveObject, thisList.get(0)); + assertEquals(thatTransaction.getObject(thisMoveObject), thatList.get(0)); + } } - public void testMoveTailAddTailTest() throws Exception + public void testMoveTailAddTail() throws Exception { initTestModel(); @@ -2211,15 +2372,19 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest int size = thisRoot.getListA().size(); assertEquals(false, thisTransaction.isDirty()); assertEquals(false, thatTransaction.isDirty()); - assertEquals(thisTransaction.getObject(thatObject), thisRoot.getListA().get(size - 1)); - assertEquals(thatObject, thatRoot.getListA().get(size - 1)); - assertEquals(thisAfterMoveObject, thisRoot.getListA().get(size - 2)); - assertEquals(thatTransaction.getObject(thisAfterMoveObject), thatRoot.getListA().get(size - 2)); - assertEquals(thisMoveObject, thisRoot.getListA().get(0)); - assertEquals(thatTransaction.getObject(thisMoveObject), thatRoot.getListA().get(0)); + + if (getRepositoryConfig().listOrdering() == ListOrdering.ORDERED) + { + assertEquals(thisTransaction.getObject(thatObject), thisRoot.getListA().get(size - 1)); + assertEquals(thatObject, thatRoot.getListA().get(size - 1)); + assertEquals(thisAfterMoveObject, thisRoot.getListA().get(size - 2)); + assertEquals(thatTransaction.getObject(thisAfterMoveObject), thatRoot.getListA().get(size - 2)); + assertEquals(thisMoveObject, thisRoot.getListA().get(0)); + assertEquals(thatTransaction.getObject(thisMoveObject), thatRoot.getListA().get(0)); + } } - public void testMoveHeadRemoveHeadTest() throws Exception + public void testMoveHeadRemoveHead() throws Exception { initTestModel(); @@ -2232,41 +2397,44 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest Root thisRoot = getTestModelRoot(thisTransaction); Root thatRoot = thatTransaction.getObject(thisRoot); + EList<BaseObject> thisList = thisRoot.getListA(); + EList<BaseObject> thatList = thatRoot.getListA(); + // Attach adapters. thisRoot.eAdapters().add(new ListPrintingAdapter("This root: ")); thatRoot.eAdapters().add(new ListPrintingAdapter("That root: ")); // Move object. - BaseObject thisMoveObject = thisRoot.getListA().get(0); - thisRoot.getListA().move(thisRoot.getListA().size() - 1, 0); - BaseObject thisAfterMoveObject = thisRoot.getListA().get(0); + BaseObject thisMoveObject = thisList.get(0); + thisList.move(thisList.size() - 1, 0); + BaseObject thisAfterMoveObject = thisList.get(0); // Remove object. - BaseObject thatRemoveObject = thatRoot.getListA().get(0); + BaseObject thatRemoveObject = thatList.get(0); BaseObject thisRemoveObject = thisTransaction.getObject(thatRemoveObject); - thatRoot.getListA().remove(0); - BaseObject thatAfterRemoveObject = thatRoot.getListA().get(0); + thatList.remove(0); + BaseObject thatAfterRemoveObject = thatList.get(0); commitAndSync(thisTransaction, thatTransaction); commitAndSync(thatTransaction, thisTransaction); // Print contents of lists - printList("This ", thisRoot.getListA()); - printList("That ", thatRoot.getListA()); + printList("This ", thisList); + printList("That ", thatList); // Check indices. assertEquals(false, thisTransaction.isDirty()); assertEquals(false, thatTransaction.isDirty()); - assertEquals(thisAfterMoveObject, thisRoot.getListA().get(0)); - assertEquals(thatTransaction.getObject(thisAfterMoveObject), thatRoot.getListA().get(0)); - assertEquals(thisTransaction.getObject(thatAfterRemoveObject), thisRoot.getListA().get(0)); - assertEquals(thatAfterRemoveObject, thatRoot.getListA().get(0)); + assertEquals(thisAfterMoveObject, thisList.get(0)); + assertEquals(thatTransaction.getObject(thisAfterMoveObject), thatList.get(0)); + assertEquals(thisTransaction.getObject(thatAfterRemoveObject), thisList.get(0)); + assertEquals(thatAfterRemoveObject, thatList.get(0)); assertEquals(CDOState.INVALID, CDOUtil.getCDOObject(thisRemoveObject).cdoState()); assertEquals(CDOState.TRANSIENT, CDOUtil.getCDOObject(thatRemoveObject).cdoState()); assertEquals(CDOState.INVALID, CDOUtil.getCDOObject(thisMoveObject).cdoState()); } - public void testMoveHeadRemoveTailTest() throws Exception + public void testMoveHeadRemoveTail() throws Exception { initTestModel(); @@ -2305,17 +2473,21 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest int size = thisRoot.getListA().size(); assertEquals(false, thisTransaction.isDirty()); assertEquals(false, thatTransaction.isDirty()); - assertEquals(thisAfterMoveObject, thisRoot.getListA().get(0)); - assertEquals(thatTransaction.getObject(thisAfterMoveObject), thatRoot.getListA().get(0)); - assertEquals(thisMoveObject, thisRoot.getListA().get(size - 1)); - assertEquals(thatTransaction.getObject(thisMoveObject), thatRoot.getListA().get(size - 1)); - assertEquals(thisTransaction.getObject(thatAfterRemoveObject), thisRoot.getListA().get(size - 2)); - assertEquals(thatAfterRemoveObject, thatRoot.getListA().get(size - 2)); assertEquals(CDOState.INVALID, CDOUtil.getCDOObject(thisRemoveObject).cdoState()); assertEquals(CDOState.TRANSIENT, CDOUtil.getCDOObject(thatRemoveObject).cdoState()); + + if (getRepositoryConfig().listOrdering() == ListOrdering.ORDERED) + { + assertEquals(thisAfterMoveObject, thisRoot.getListA().get(0)); + assertEquals(thatTransaction.getObject(thisAfterMoveObject), thatRoot.getListA().get(0)); + assertEquals(thisMoveObject, thisRoot.getListA().get(size - 1)); + assertEquals(thatTransaction.getObject(thisMoveObject), thatRoot.getListA().get(size - 1)); + assertEquals(thisTransaction.getObject(thatAfterRemoveObject), thisRoot.getListA().get(size - 2)); + assertEquals(thatAfterRemoveObject, thatRoot.getListA().get(size - 2)); + } } - public void testMoveTailRemoveHeadTest() throws Exception + public void testMoveTailRemoveHead() throws Exception { initTestModel(); @@ -2354,17 +2526,21 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest int size = thisRoot.getListA().size(); assertEquals(false, thisTransaction.isDirty()); assertEquals(false, thatTransaction.isDirty()); - assertEquals(thisAfterMoveObject, thisRoot.getListA().get(size - 1)); - assertEquals(thatTransaction.getObject(thisAfterMoveObject), thatRoot.getListA().get(size - 1)); - assertEquals(thisMoveObject, thisRoot.getListA().get(0)); - assertEquals(thatTransaction.getObject(thisMoveObject), thatRoot.getListA().get(0)); - assertEquals(thisTransaction.getObject(thatAfterRemoveObject), thisRoot.getListA().get(1)); - assertEquals(thatAfterRemoveObject, thatRoot.getListA().get(1)); assertEquals(CDOState.INVALID, CDOUtil.getCDOObject(thisRemoveObject).cdoState()); assertEquals(CDOState.TRANSIENT, CDOUtil.getCDOObject(thatRemoveObject).cdoState()); + + if (getRepositoryConfig().listOrdering() == ListOrdering.ORDERED) + { + assertEquals(thisAfterMoveObject, thisRoot.getListA().get(size - 1)); + assertEquals(thatTransaction.getObject(thisAfterMoveObject), thatRoot.getListA().get(size - 1)); + assertEquals(thisMoveObject, thisRoot.getListA().get(0)); + assertEquals(thatTransaction.getObject(thisMoveObject), thatRoot.getListA().get(0)); + assertEquals(thisTransaction.getObject(thatAfterRemoveObject), thisRoot.getListA().get(1)); + assertEquals(thatAfterRemoveObject, thatRoot.getListA().get(1)); + } } - public void testMoveTailRemoveTailTest() throws Exception + public void testMoveTailRemoveTail() throws Exception { initTestModel(); @@ -2412,7 +2588,7 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest assertEquals(CDOState.INVALID, CDOUtil.getCDOObject(thisMoveObject).cdoState()); } - public void testMoveHeadMoveHeadTest() throws Exception + public void testMoveHeadMoveHead() throws Exception { initTestModel(); @@ -2454,17 +2630,21 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest int size = thisRoot.getListA().size(); assertEquals(false, thisTransaction.isDirty()); assertEquals(false, thatTransaction.isDirty()); - assertEquals(thisMoveObject1, thisRoot.getListA().get(size - 1)); - assertEquals(thatMoveObject1, thatRoot.getListA().get(size - 1)); - assertEquals(thisMoveObject2, thisRoot.getListA().get(size - 1)); - assertEquals(thatMoveObject2, thatRoot.getListA().get(size - 1)); - assertEquals(thisAfterMoveObject1, thisRoot.getListA().get(0)); - assertEquals(thatAfterMoveObject1, thatRoot.getListA().get(0)); - assertEquals(thisAfterMoveObject2, thisRoot.getListA().get(0)); - assertEquals(thatAfterMoveObject2, thatRoot.getListA().get(0)); + + if (getRepositoryConfig().listOrdering() == ListOrdering.ORDERED) + { + assertEquals(thisMoveObject1, thisRoot.getListA().get(size - 1)); + assertEquals(thatMoveObject1, thatRoot.getListA().get(size - 1)); + assertEquals(thisMoveObject2, thisRoot.getListA().get(size - 1)); + assertEquals(thatMoveObject2, thatRoot.getListA().get(size - 1)); + assertEquals(thisAfterMoveObject1, thisRoot.getListA().get(0)); + assertEquals(thatAfterMoveObject1, thatRoot.getListA().get(0)); + assertEquals(thisAfterMoveObject2, thisRoot.getListA().get(0)); + assertEquals(thatAfterMoveObject2, thatRoot.getListA().get(0)); + } } - public void testMoveHeadMoveTailTest() throws Exception + public void testMoveHeadMoveTail() throws Exception { initTestModel(); @@ -2506,17 +2686,21 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest int size = thisRoot.getListA().size(); assertEquals(false, thisTransaction.isDirty()); assertEquals(false, thatTransaction.isDirty()); - assertEquals(thisMoveObject1, thisRoot.getListA().get(size - 1)); - assertEquals(thatMoveObject1, thatRoot.getListA().get(size - 1)); - assertEquals(thisMoveObject2, thisRoot.getListA().get(0)); - assertEquals(thatMoveObject2, thatRoot.getListA().get(0)); - assertEquals(thisAfterMoveObject1, thisRoot.getListA().get(1)); - assertEquals(thatAfterMoveObject1, thatRoot.getListA().get(1)); - assertEquals(thisAfterMoveObject2, thisRoot.getListA().get(size - 2)); - assertEquals(thatAfterMoveObject2, thatRoot.getListA().get(size - 2)); + + if (getRepositoryConfig().listOrdering() == ListOrdering.ORDERED) + { + assertEquals(thisMoveObject1, thisRoot.getListA().get(size - 1)); + assertEquals(thatMoveObject1, thatRoot.getListA().get(size - 1)); + assertEquals(thisMoveObject2, thisRoot.getListA().get(0)); + assertEquals(thatMoveObject2, thatRoot.getListA().get(0)); + assertEquals(thisAfterMoveObject1, thisRoot.getListA().get(1)); + assertEquals(thatAfterMoveObject1, thatRoot.getListA().get(1)); + assertEquals(thisAfterMoveObject2, thisRoot.getListA().get(size - 2)); + assertEquals(thatAfterMoveObject2, thatRoot.getListA().get(size - 2)); + } } - public void testMoveTailMoveHeadTest() throws Exception + public void testMoveTailMoveHead() throws Exception { initTestModel(); @@ -2558,17 +2742,21 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest int size = thisRoot.getListA().size(); assertEquals(false, thisTransaction.isDirty()); assertEquals(false, thatTransaction.isDirty()); - assertEquals(thisMoveObject1, thisRoot.getListA().get(0)); - assertEquals(thatMoveObject1, thatRoot.getListA().get(0)); - assertEquals(thisMoveObject2, thisRoot.getListA().get(size - 1)); - assertEquals(thatMoveObject2, thatRoot.getListA().get(size - 1)); - assertEquals(thisAfterMoveObject1, thisRoot.getListA().get(size - 2)); - assertEquals(thatAfterMoveObject1, thatRoot.getListA().get(size - 2)); - assertEquals(thisAfterMoveObject2, thisRoot.getListA().get(1)); - assertEquals(thatAfterMoveObject2, thatRoot.getListA().get(1)); + + if (getRepositoryConfig().listOrdering() == ListOrdering.ORDERED) + { + assertEquals(thisMoveObject1, thisRoot.getListA().get(0)); + assertEquals(thatMoveObject1, thatRoot.getListA().get(0)); + assertEquals(thisMoveObject2, thisRoot.getListA().get(size - 1)); + assertEquals(thatMoveObject2, thatRoot.getListA().get(size - 1)); + assertEquals(thisAfterMoveObject1, thisRoot.getListA().get(size - 2)); + assertEquals(thatAfterMoveObject1, thatRoot.getListA().get(size - 2)); + assertEquals(thisAfterMoveObject2, thisRoot.getListA().get(1)); + assertEquals(thatAfterMoveObject2, thatRoot.getListA().get(1)); + } } - public void testMoveTailMoveTailTest() throws Exception + public void testMoveTailMoveTail() throws Exception { initTestModel(); @@ -2610,17 +2798,21 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest int size = thisRoot.getListA().size(); assertEquals(false, thisTransaction.isDirty()); assertEquals(false, thatTransaction.isDirty()); - assertEquals(thisMoveObject1, thisRoot.getListA().get(0)); - assertEquals(thatMoveObject1, thatRoot.getListA().get(0)); - assertEquals(thisMoveObject2, thisRoot.getListA().get(0)); - assertEquals(thatMoveObject2, thatRoot.getListA().get(0)); - assertEquals(thisAfterMoveObject1, thisRoot.getListA().get(size - 1)); - assertEquals(thatAfterMoveObject1, thatRoot.getListA().get(size - 1)); - assertEquals(thisAfterMoveObject2, thisRoot.getListA().get(size - 1)); - assertEquals(thatAfterMoveObject2, thatRoot.getListA().get(size - 1)); + + if (getRepositoryConfig().listOrdering() == ListOrdering.ORDERED) + { + assertEquals(thisMoveObject1, thisRoot.getListA().get(0)); + assertEquals(thatMoveObject1, thatRoot.getListA().get(0)); + assertEquals(thisMoveObject2, thisRoot.getListA().get(0)); + assertEquals(thatMoveObject2, thatRoot.getListA().get(0)); + assertEquals(thisAfterMoveObject1, thisRoot.getListA().get(size - 1)); + assertEquals(thatAfterMoveObject1, thatRoot.getListA().get(size - 1)); + assertEquals(thisAfterMoveObject2, thisRoot.getListA().get(size - 1)); + assertEquals(thatAfterMoveObject2, thatRoot.getListA().get(size - 1)); + } } - public void testMoveHeadClearTest() throws Exception + public void testMoveHeadClear() throws Exception { initTestModel(); @@ -2665,7 +2857,7 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest assertEquals(CDOState.TRANSIENT, CDOUtil.getCDOObject(thatAfterMoveObject).cdoState()); } - public void testMoveTailClearTest() throws Exception + public void testMoveTailClear() throws Exception { initTestModel(); @@ -2710,7 +2902,7 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest assertEquals(CDOState.TRANSIENT, CDOUtil.getCDOObject(thatAfterMoveObject).cdoState()); } - public void testClearAddHeadTest() throws Exception + public void testClearAddHead() throws Exception { initTestModel(); @@ -2750,7 +2942,7 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest assertEquals(thatObject, thatRoot.getListA().get(0)); } - public void testClearAddTailTest() throws Exception + public void testClearAddTail() throws Exception { initTestModel(); @@ -2790,7 +2982,7 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest assertEquals(thatObject, thatRoot.getListA().get(0)); } - public void testClearRemoveHeadTest() throws Exception + public void testClearRemoveHead() throws Exception { initTestModel(); @@ -2833,7 +3025,7 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest assertEquals(CDOState.INVALID, CDOUtil.getCDOObject(thatAfterRemoveObject).cdoState()); } - public void testClearRemoveTailTest() throws Exception + public void testClearRemoveTail() throws Exception { initTestModel(); @@ -2876,7 +3068,7 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest assertEquals(CDOState.INVALID, CDOUtil.getCDOObject(thatAfterRemoveObject).cdoState()); } - public void testClearMoveHeadTest() throws Exception + public void testClearMoveHead() throws Exception { initTestModel(); @@ -2920,7 +3112,7 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest assertEquals(CDOState.TRANSIENT, CDOUtil.getCDOObject(thisAfterMoveObject).cdoState()); } - public void testClearMoveTailTest() throws Exception + public void testClearMoveTail() throws Exception { initTestModel(); @@ -2964,7 +3156,7 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest assertEquals(CDOState.TRANSIENT, CDOUtil.getCDOObject(thisAfterMoveObject).cdoState()); } - public void testClearClearTest() throws Exception + public void testClearClear() throws Exception { initTestModel(); @@ -3004,7 +3196,7 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest assertEquals(CDOState.TRANSIENT, CDOUtil.getCDOObject(thatObject).cdoState()); } - public void testRemoveHeadMoveHeadRemoveMiddleTest() throws Exception + public void testRemoveHeadMoveHeadRemoveMiddle() throws Exception { initTestModel(); @@ -3059,7 +3251,7 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest assertEquals(CDOState.INVALID, CDOUtil.getCDOObject(thatMoveObject).cdoState()); } - public void testMoveHeadMoveHeadRemoveMiddleTest() throws Exception + public void testMoveHeadMoveHeadRemoveMiddle() throws Exception { initTestModel(); @@ -3072,48 +3264,55 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest Root thisRoot = getTestModelRoot(thisTransaction); Root thatRoot = thatTransaction.getObject(thisRoot); + EList<BaseObject> thisList = thisRoot.getListA(); + EList<BaseObject> thatList = thatRoot.getListA(); + // Attach adapters. thisRoot.eAdapters().add(new ListPrintingAdapter("This root: ")); thatRoot.eAdapters().add(new ListPrintingAdapter("That root: ")); // Move object. - BaseObject thisMoveObject = thisRoot.getListA().get(0); - thisRoot.getListA().move(thisRoot.getListA().size() - 1, 0); - BaseObject thisAfterMoveObject = thisRoot.getListA().get(0); + BaseObject thisMoveObject = thisList.get(0); + thisList.move(thisList.size() - 1, 0); + BaseObject thisAfterMoveObject = thisList.get(0); // Move object. - BaseObject thatMoveObject = thatRoot.getListA().get(0); - BaseObject thatRemoveAfterMoveObject = thatRoot.getListA().get(2); - BaseObject thatAfterRemoveAfterMoveObject = thatRoot.getListA().get(3); - thatRoot.getListA().move(thatRoot.getListA().size() - 1, 0); - BaseObject thatAfterMoveObject = thatRoot.getListA().get(0); + BaseObject thatMoveObject = thatList.get(0); + BaseObject thatRemoveAfterMoveObject = thatList.get(2); + BaseObject thatAfterRemoveAfterMoveObject = thatList.get(3); + thatList.move(thatList.size() - 1, 0); + BaseObject thatAfterMoveObject = thatList.get(0); // Remove object. BaseObject thisRemoveAfterMoveObject = thisTransaction.getObject(thatRemoveAfterMoveObject); - thatRoot.getListA().remove(thatRemoveAfterMoveObject); + thatList.remove(thatRemoveAfterMoveObject); commitAndSync(thisTransaction, thatTransaction); commitAndSync(thatTransaction, thisTransaction); // Print contents of lists - printList("This ", thisRoot.getListA()); - printList("That ", thatRoot.getListA()); + printList("This ", thisList); + printList("That ", thatList); // Check indices. - int listSize = thisRoot.getListA().size(); + int listSize = thisList.size(); assertEquals(false, thisTransaction.isDirty()); assertEquals(false, thatTransaction.isDirty()); - assertEquals(thisMoveObject, thisRoot.getListA().get(listSize - 1)); - assertEquals(thatMoveObject, thatRoot.getListA().get(listSize - 1)); - assertEquals(thisAfterMoveObject, thisRoot.getListA().get(0)); - assertEquals(thatAfterMoveObject, thatRoot.getListA().get(0)); - assertEquals(thisTransaction.getObject(thatAfterRemoveAfterMoveObject), thisRoot.getListA().get(1)); - assertEquals(thatAfterRemoveAfterMoveObject, thatRoot.getListA().get(1)); assertEquals(CDOState.TRANSIENT, CDOUtil.getCDOObject(thatRemoveAfterMoveObject).cdoState()); assertEquals(CDOState.INVALID, CDOUtil.getCDOObject(thisRemoveAfterMoveObject).cdoState()); + + if (getRepositoryConfig().listOrdering() == ListOrdering.ORDERED) + { + assertEquals(thisMoveObject, thisList.get(listSize - 1)); + assertEquals(thatMoveObject, thatList.get(listSize - 1)); + assertEquals(thisAfterMoveObject, thisList.get(0)); + assertEquals(thatAfterMoveObject, thatList.get(0)); + assertEquals(thisTransaction.getObject(thatAfterRemoveAfterMoveObject), thisList.get(1)); + assertEquals(thatAfterRemoveAfterMoveObject, thatList.get(1)); + } } - public void testMoveHeadRemoveHeadRemoveMiddleTest() throws Exception + public void testMoveHeadRemoveHeadRemoveMiddle() throws Exception { initTestModel(); @@ -3468,8 +3667,6 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest assertEquals(true, thatTransaction.hasConflict()); } - // ========== HELPERS ====================================================== - protected BaseObject createBaseObject(String attribute) { BaseObject baseObj = getModel6Factory().createBaseObject(); @@ -3499,8 +3696,6 @@ public class ConflictResolverExtendedTest extends AbstractCDOTest return session; } - // --- initialize model ---------------------------------------------------- - private void initTestModelSimple() throws CommitException { CDOSession session = openSessionWithAdditionsMode(); diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ConflictResolverTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ConflictResolverTest.java index 77457aacc6..d61c424c22 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ConflictResolverTest.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ConflictResolverTest.java @@ -220,8 +220,8 @@ public class ConflictResolverTest extends AbstractCDOTest commitAndSync(transaction2, transaction1); assertEquals(2, orderDetails1.size()); - assertEquals(CDOUtil.getCDOObject(orderDetail2).cdoID(), CDOUtil.getCDOObject(orderDetails1.get(0)).cdoID()); - assertEquals(CDOUtil.getCDOObject(orderDetail1).cdoID(), CDOUtil.getCDOObject(orderDetails1.get(1)).cdoID()); + assertEquals(CDOUtil.getCDOObject(orderDetail1).cdoID(), CDOUtil.getCDOObject(orderDetails1.get(0)).cdoID()); + assertEquals(CDOUtil.getCDOObject(orderDetail2).cdoID(), CDOUtil.getCDOObject(orderDetails1.get(1)).cdoID()); } protected CDOConflictResolver createConflictResolver() diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ExternalReferenceTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ExternalReferenceTest.java index 2e7a8cbee8..a4eac61aa7 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ExternalReferenceTest.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ExternalReferenceTest.java @@ -408,7 +408,6 @@ public class ExternalReferenceTest extends AbstractCDOTest public void testWithXMLAndPrefetching() throws Exception { - { ResourceSet resourceSet = new ResourceSetImpl(); Map<String, Object> map = resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap(); @@ -420,13 +419,14 @@ public class ExternalReferenceTest extends AbstractCDOTest CDOTransaction transaction = session.openTransaction(resourceSet); Supplier supplier = getModel1Factory().createSupplier(); + EList<PurchaseOrder> purchaseOrders = supplier.getPurchaseOrders(); for (int i = 0; i < 200; i++) { PurchaseOrder externalObject = getModel1Factory().createPurchaseOrder(); externalResource.getContents().add(externalObject); - supplier.getPurchaseOrders().add(externalObject); + purchaseOrders.add(externalObject); } CDOResource resource = transaction.createResource(getResourcePath("/internal")); diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/OCLQueryTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/OCLQueryTest.java index fe6b64b300..dd29c08091 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/OCLQueryTest.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/OCLQueryTest.java @@ -234,7 +234,7 @@ public class OCLQueryTest extends AbstractCDOTest List<Product1> products = query.getResult(); assertEquals(NUM_OF_PRODUCTS + 1, products.size()); - resource.getContents().remove(0); + resource.getContents().remove(p1); assertEquals(true, transaction.isDirty()); query = createQuery("Product1.allInstances()", getModel1Package().getProduct1(), true); @@ -255,7 +255,7 @@ public class OCLQueryTest extends AbstractCDOTest resource.getContents().add(0, p1); transaction.commit(); - resource.getContents().remove(0); + resource.getContents().remove(p1); transaction.commit(); query = createQuery("Product1.allInstances()", getModel1Package().getProduct1(), true); @@ -271,7 +271,7 @@ public class OCLQueryTest extends AbstractCDOTest resource.getContents().add(0, p1); transaction.commit(); - resource.getContents().remove(0); + resource.getContents().remove(p1); transaction.commit(); CDOQuery query = createQuery("Product1.allInstances()", getModel1Package().getProduct1(), false); @@ -290,7 +290,7 @@ public class OCLQueryTest extends AbstractCDOTest resource.getContents().add(0, p1); CDOCommitInfo commitInfo = transaction.commit(); - resource.getContents().remove(0); + resource.getContents().remove(p1); transaction.commit(); CDOView audit = transaction.getSession().openView(commitInfo); diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/PushTransactionTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/PushTransactionTest.java index ef8b5951fd..368e372fca 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/PushTransactionTest.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/PushTransactionTest.java @@ -13,6 +13,7 @@ package org.eclipse.emf.cdo.tests; import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta; import org.eclipse.emf.cdo.eresource.CDOResource; import org.eclipse.emf.cdo.session.CDOSession; +import org.eclipse.emf.cdo.tests.config.IRepositoryConfig; import org.eclipse.emf.cdo.tests.model1.Category; import org.eclipse.emf.cdo.tests.model1.Company; import org.eclipse.emf.cdo.tests.model1.OrderDetail; @@ -363,6 +364,7 @@ public class PushTransactionTest extends AbstractCDOTest assertEquals(orderDetailPrice, detail.getPrice()); } + @Skips(IRepositoryConfig.CAPABILITY_UNORDERED_LISTS) public void testMoveObject() throws Exception { { diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/RevisionDeltaTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/RevisionDeltaTest.java index 81c808a401..fa9f12d27f 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/RevisionDeltaTest.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/RevisionDeltaTest.java @@ -26,6 +26,7 @@ import org.eclipse.emf.cdo.server.IStore; import org.eclipse.emf.cdo.session.CDOSession; import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision; import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionManager; +import org.eclipse.emf.cdo.tests.config.IRepositoryConfig; import org.eclipse.emf.cdo.tests.model1.Category; import org.eclipse.emf.cdo.tests.model1.Company; import org.eclipse.emf.cdo.tests.model1.Customer; @@ -351,6 +352,7 @@ public class RevisionDeltaTest extends AbstractCDOTest }); } + @Skips(IRepositoryConfig.CAPABILITY_UNORDERED_LISTS) public void testListSimpleMove() { testStoreDelta(new ListManipulator() @@ -362,6 +364,7 @@ public class RevisionDeltaTest extends AbstractCDOTest }); } + @Skips(IRepositoryConfig.CAPABILITY_UNORDERED_LISTS) public void testListMoveToLast() { testStoreDelta(new ListManipulator() @@ -373,6 +376,7 @@ public class RevisionDeltaTest extends AbstractCDOTest }); } + @Skips(IRepositoryConfig.CAPABILITY_UNORDERED_LISTS) public void testListMoveToFirst() { testStoreDelta(new ListManipulator() @@ -384,6 +388,7 @@ public class RevisionDeltaTest extends AbstractCDOTest }); } + @Skips(IRepositoryConfig.CAPABILITY_UNORDERED_LISTS) public void testListTwoIndependentMoves() { testStoreDelta(new ListManipulator() @@ -396,6 +401,7 @@ public class RevisionDeltaTest extends AbstractCDOTest }); } + @Skips(IRepositoryConfig.CAPABILITY_UNORDERED_LISTS) public void testListTwoIntersectingMoves() { testStoreDelta(new ListManipulator() @@ -408,6 +414,7 @@ public class RevisionDeltaTest extends AbstractCDOTest }); } + @Skips(IRepositoryConfig.CAPABILITY_UNORDERED_LISTS) public void testListInsertFirst() { testStoreDelta(new ListManipulator() @@ -423,6 +430,7 @@ public class RevisionDeltaTest extends AbstractCDOTest }); } + @Skips(IRepositoryConfig.CAPABILITY_UNORDERED_LISTS) public void testListInsertMiddle() { testStoreDelta(new ListManipulator() @@ -453,6 +461,7 @@ public class RevisionDeltaTest extends AbstractCDOTest }); } + @Skips(IRepositoryConfig.CAPABILITY_UNORDERED_LISTS) public void testListMultipleOpsWithClear() { testStoreDelta(new ListManipulator() @@ -491,6 +500,7 @@ public class RevisionDeltaTest extends AbstractCDOTest }); } + @Skips(IRepositoryConfig.CAPABILITY_UNORDERED_LISTS) public void testListMultipleOps() { testStoreDelta(new ListManipulator() @@ -529,6 +539,7 @@ public class RevisionDeltaTest extends AbstractCDOTest }); } + @Skips(IRepositoryConfig.CAPABILITY_UNORDERED_LISTS) public void testMultipleInserts() { testStoreDelta(new ListManipulator() @@ -547,6 +558,7 @@ public class RevisionDeltaTest extends AbstractCDOTest }); } + @Skips(IRepositoryConfig.CAPABILITY_UNORDERED_LISTS) public void testInsertAndRemove() { testStoreDelta(new ListManipulator() @@ -563,6 +575,7 @@ public class RevisionDeltaTest extends AbstractCDOTest }); } + @Skips(IRepositoryConfig.CAPABILITY_UNORDERED_LISTS) public void testInsertAndMove() { testStoreDelta(new ListManipulator() @@ -610,6 +623,7 @@ public class RevisionDeltaTest extends AbstractCDOTest }); } + @Skips(IRepositoryConfig.CAPABILITY_UNORDERED_LISTS) public void testInsertAndSet() { testStoreDelta(new ListManipulator() @@ -629,6 +643,7 @@ public class RevisionDeltaTest extends AbstractCDOTest }); } + @Skips(IRepositoryConfig.CAPABILITY_UNORDERED_LISTS) public void testSetAndRemove() { testStoreDelta(new ListManipulator() diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/RevisionManagerTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/RevisionManagerTest.java index 20537e05bc..5e4352333d 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/RevisionManagerTest.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/RevisionManagerTest.java @@ -96,7 +96,7 @@ public class RevisionManagerTest extends AbstractCDOTest { super.doSetUp(); - if (getRepositoryConfig().getIDGenerationLocation() == IDGenerationLocation.STORE) + if (getRepositoryConfig().idGenerationLocation() == IDGenerationLocation.STORE) { objectID = CDOIDUtil.createLong(2); } diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/XRefTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/XRefTest.java index 76d8a1f00d..db5498e696 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/XRefTest.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/XRefTest.java @@ -16,6 +16,7 @@ import org.eclipse.emf.cdo.CDOObjectReference; import org.eclipse.emf.cdo.common.model.EMFUtil; import org.eclipse.emf.cdo.eresource.CDOResource; import org.eclipse.emf.cdo.session.CDOSession; +import org.eclipse.emf.cdo.tests.config.IRepositoryConfig; import org.eclipse.emf.cdo.tests.model1.PurchaseOrder; import org.eclipse.emf.cdo.tests.model1.Supplier; import org.eclipse.emf.cdo.transaction.CDOTransaction; @@ -133,6 +134,7 @@ public class XRefTest extends AbstractCDOTest } } + @Skips(IRepositoryConfig.CAPABILITY_UNORDERED_LISTS) @SuppressWarnings("unchecked") public void testXRefsToMany() throws Exception { @@ -354,6 +356,7 @@ public class XRefTest extends AbstractCDOTest assertEquals(true, found1 && found2); } + @Skips(IRepositoryConfig.CAPABILITY_UNORDERED_LISTS) @SuppressWarnings({ "unchecked", "unused" }) public void testSpecificReferences0() throws Exception { @@ -430,6 +433,7 @@ public class XRefTest extends AbstractCDOTest } } + @Skips(IRepositoryConfig.CAPABILITY_UNORDERED_LISTS) @SuppressWarnings({ "unchecked", "unused" }) public void testSpecificReferences1() throws Exception { @@ -501,6 +505,7 @@ public class XRefTest extends AbstractCDOTest } } + @Skips(IRepositoryConfig.CAPABILITY_UNORDERED_LISTS) @SuppressWarnings({ "unchecked", "unused" }) public void testSpecificReferences2() throws Exception { diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_310574_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_310574_Test.java index 6e7abaacd0..87fd3c2f0c 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_310574_Test.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_310574_Test.java @@ -10,6 +10,7 @@ */ package org.eclipse.emf.cdo.tests.bugzilla; +import org.eclipse.emf.cdo.common.CDOCommonRepository.ListOrdering; import org.eclipse.emf.cdo.common.id.CDOID; import org.eclipse.emf.cdo.common.revision.delta.CDOAddFeatureDelta; import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta; @@ -410,9 +411,12 @@ public class Bugzilla_310574_Test extends AbstractCDOTest Customer testCustomer = (Customer)resource.getContents().get(0); EList<SalesOrder> orders = testCustomer.getSalesOrders(); - for (int i = 0; i < orders.size(); i++) + if (getRepositoryConfig().listOrdering() == ListOrdering.ORDERED) { - assertEquals(positions[i], orders.get(i).getId()); + for (int i = 0; i < orders.size(); i++) + { + assertEquals(positions[i], orders.get(i).getId()); + } } transaction.close(); @@ -473,9 +477,12 @@ public class Bugzilla_310574_Test extends AbstractCDOTest Customer testCustomer = (Customer)resource.getContents().get(0); EList<SalesOrder> orders = testCustomer.getSalesOrders(); - for (int i = 0; i < orders.size(); i++) + if (getRepositoryConfig().listOrdering() == ListOrdering.ORDERED) { - assertEquals(positions[i], orders.get(i).getId()); + for (int i = 0; i < orders.size(); i++) + { + assertEquals(positions[i], orders.get(i).getId()); + } } transaction.close(); @@ -533,9 +540,12 @@ public class Bugzilla_310574_Test extends AbstractCDOTest Customer testCustomer = (Customer)resource.getContents().get(0); EList<SalesOrder> orders = testCustomer.getSalesOrders(); - for (int i = 0; i < orders.size(); i++) + if (getRepositoryConfig().listOrdering() == ListOrdering.ORDERED) { - assertEquals(positions[i], orders.get(i).getId()); + for (int i = 0; i < orders.size(); i++) + { + assertEquals(positions[i], orders.get(i).getId()); + } } transaction.close(); @@ -592,9 +602,12 @@ public class Bugzilla_310574_Test extends AbstractCDOTest Customer testCustomer = (Customer)resource.getContents().get(0); EList<SalesOrder> orders = testCustomer.getSalesOrders(); - for (int i = 0; i < orders.size(); i++) + if (getRepositoryConfig().listOrdering() == ListOrdering.ORDERED) { - assertEquals(positions[i], orders.get(i).getId()); + for (int i = 0; i < orders.size(); i++) + { + assertEquals(positions[i], orders.get(i).getId()); + } } transaction.close(); @@ -774,9 +787,12 @@ public class Bugzilla_310574_Test extends AbstractCDOTest Customer testCustomer = (Customer)resource.getContents().get(0); EList<SalesOrder> orders = testCustomer.getSalesOrders(); - for (int i = 0; i < orders.size(); i++) + if (getRepositoryConfig().listOrdering() == ListOrdering.ORDERED) { - assertEquals(positions[i], orders.get(i).getId()); + for (int i = 0; i < orders.size(); i++) + { + assertEquals(positions[i], orders.get(i).getId()); + } } transaction.close(); @@ -829,7 +845,6 @@ public class Bugzilla_310574_Test extends AbstractCDOTest } transaction.commit(); - session.close(); } @@ -844,9 +859,12 @@ public class Bugzilla_310574_Test extends AbstractCDOTest // assertEquals(4, orders.size()); - for (int i = 0; i < orders.size(); i++) + if (getRepositoryConfig().listOrdering() == ListOrdering.ORDERED) { - assertEquals(positions[i], orders.get(i).getId()); + for (int i = 0; i < orders.size(); i++) + { + assertEquals(positions[i], orders.get(i).getId()); + } } transaction.close(); @@ -902,10 +920,13 @@ public class Bugzilla_310574_Test extends AbstractCDOTest assertEquals(4, orders.size()); - int[] array = { 0, 1, 3, 2 }; - for (int i = 0; i < array.length; i++) + if (getRepositoryConfig().listOrdering() == ListOrdering.ORDERED) { - assertEquals(array[i], orders.get(i).getId()); + int[] array = { 0, 1, 3, 2 }; + for (int i = 0; i < array.length; i++) + { + assertEquals(array[i], orders.get(i).getId()); + } } transaction.close(); @@ -960,10 +981,13 @@ public class Bugzilla_310574_Test extends AbstractCDOTest assertEquals(3, orders.size()); - int[] array = { 3, 0, 2 }; - for (int i = 0; i < array.length; i++) + if (getRepositoryConfig().listOrdering() == ListOrdering.ORDERED) { - assertEquals(array[i], orders.get(i).getId()); + int[] array = { 3, 0, 2 }; + for (int i = 0; i < array.length; i++) + { + assertEquals(array[i], orders.get(i).getId()); + } } transaction.close(); diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_384496_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_384496_Test.java index fa964d11cd..ab67e60a26 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_384496_Test.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_384496_Test.java @@ -10,6 +10,7 @@ */ package org.eclipse.emf.cdo.tests.bugzilla; +import org.eclipse.emf.cdo.common.CDOCommonRepository.ListOrdering; import org.eclipse.emf.cdo.eresource.CDOResource; import org.eclipse.emf.cdo.session.CDOSession; import org.eclipse.emf.cdo.tests.AbstractCDOTest; @@ -71,7 +72,15 @@ public class Bugzilla_384496_Test extends AbstractCDOTest } }.assertNoTimeOut(); - assertEquals(1, adapter.getNotifications().length); + if (getRepositoryConfig().listOrdering() == ListOrdering.ORDERED) + { + assertEquals(1, adapter.getNotifications().length); + } + else + { + assertEquals(2, adapter.getNotifications().length); + } + assertEquals(1, adapter.getNotifications()[0].getPosition()); } } diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_435532_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_435532_Test.java index 3bb922c0d1..9ce84a6b50 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_435532_Test.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_435532_Test.java @@ -31,7 +31,7 @@ import java.util.List; * * @author Alex Lagarde */ -@Skips({ IRepositoryConfig.CAPABILITY_AUDITING, IRepositoryConfig.CAPABILITY_BRANCHING }) +@Skips({ IRepositoryConfig.CAPABILITY_AUDITING, IRepositoryConfig.CAPABILITY_BRANCHING, IRepositoryConfig.CAPABILITY_UNORDERED_LISTS }) public class Bugzilla_435532_Test extends AbstractCDOTest { private static final int CHILDREN_NUMBER = 100; diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_505654_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_505654_Test.java index 9683d2f5b0..e0b688bacd 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_505654_Test.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_505654_Test.java @@ -109,10 +109,15 @@ public class Bugzilla_505654_Test extends AbstractCDOTest return dump(" ", rightCompany); } + private CDOMerger createMerger() + { + return new DefaultCDOMerger.PerFeature.ManyValued(); + } + private List<CDOID> leftMerge() throws CommitException { System.out.println(" <----------------"); - CDOMerger merger = new DefaultCDOMerger.PerFeature.ManyValued(); + CDOMerger merger = createMerger(); leftTransaction.merge(rightTransaction.getBranch(), merger); lastCommit = null; return leftCommit(); @@ -121,7 +126,7 @@ public class Bugzilla_505654_Test extends AbstractCDOTest private List<CDOID> rightMerge() throws CommitException { System.out.println(" ---------------->"); - CDOMerger merger = new DefaultCDOMerger.PerFeature.ManyValued(); + CDOMerger merger = createMerger(); rightTransaction.merge(leftTransaction.getBranch(), merger); lastCommit = null; return rightCommit(); @@ -205,15 +210,15 @@ public class Bugzilla_505654_Test extends AbstractCDOTest { CDOID customer1 = leftAdd(getModel1Package().getCustomer()); CDOID customer1b = rightAdd(getModel1Package().getCustomer()); - assertIDs(leftMerge(), customer1, customer1b); + assertIDs(leftMerge(), customer1b, customer1); CDOID customer2 = leftAdd(getModel1Package().getCustomer()); CDOID customer2b = rightAdd(getModel1Package().getCustomer()); - assertIDs(leftMerge(), customer1, customer2b, customer2, customer1b); + assertIDs(leftMerge(), customer1b, customer2b, customer1, customer2); CDOID customer3 = leftAdd(getModel1Package().getCustomer()); CDOID customer3b = rightAdd(getModel1Package().getCustomer()); - assertIDs(leftMerge(), customer1, customer2b, customer3b, customer3, customer2, customer1b); + assertIDs(leftMerge(), customer1b, customer2b, customer3b, customer1, customer2, customer3); } public void testCrossMerge() throws Exception @@ -228,8 +233,8 @@ public class Bugzilla_505654_Test extends AbstractCDOTest { CDOID customer1 = leftAdd(getModel1Package().getCustomer()); CDOID customer1b = rightAdd(getModel1Package().getCustomer()); - assertIDs(leftMerge(), customer1, customer1b); - assertIDs(rightMerge(), customer1, customer1b); + assertIDs(leftMerge(), customer1b, customer1); + assertIDs(rightMerge(), customer1b, customer1); } public void testCrossMergeAndRemerge() throws Exception @@ -246,10 +251,10 @@ public class Bugzilla_505654_Test extends AbstractCDOTest { CDOID customer1 = leftAdd(getModel1Package().getCustomer()); CDOID customer1b = rightAdd(getModel1Package().getCustomer()); - assertIDs(rightMerge(), customer1b, customer1); + assertIDs(rightMerge(), customer1, customer1b); CDOID customer2b = rightAdd(getModel1Package().getCustomer()); - assertIDs(leftMerge(), customer1b, customer1, customer2b); + assertIDs(leftMerge(), customer1, customer1b, customer2b); } public void testMergeAndCrossMergeAndRemerge() throws Exception @@ -267,11 +272,11 @@ public class Bugzilla_505654_Test extends AbstractCDOTest { CDOID customer1 = leftAdd(getModel1Package().getCustomer()); CDOID customer1b = rightAdd(getModel1Package().getCustomer()); - assertIDs(leftMerge(), customer1, customer1b); - assertIDs(rightMerge(), customer1, customer1b); + assertIDs(leftMerge(), customer1b, customer1); + assertIDs(rightMerge(), customer1b, customer1); CDOID customer2b = rightAdd(getModel1Package().getCustomer()); - assertIDs(leftMerge(), customer1, customer1b, customer2b); + assertIDs(leftMerge(), customer1b, customer1, customer2b); } public void testCrossMergeAndMultipleRemerges() throws Exception @@ -292,14 +297,14 @@ public class Bugzilla_505654_Test extends AbstractCDOTest { CDOID customer1 = leftAdd(getModel1Package().getCustomer()); CDOID customer1b = rightAdd(getModel1Package().getCustomer()); - assertIDs(leftMerge(), customer1, customer1b); - assertIDs(rightMerge(), customer1, customer1b); + assertIDs(leftMerge(), customer1b, customer1); + assertIDs(rightMerge(), customer1b, customer1); CDOID customer2b = rightAdd(getModel1Package().getCustomer()); - assertIDs(leftMerge(), customer1, customer1b, customer2b); + assertIDs(leftMerge(), customer1b, customer1, customer2b); CDOID customer3b = rightAdd(getModel1Package().getCustomer()); - assertIDs(leftMerge(), customer1, customer1b, customer2b, customer3b); + assertIDs(leftMerge(), customer1b, customer1, customer2b, customer3b); } public void testCrossMergeAndAdditionsAndRemerges() throws Exception @@ -322,15 +327,15 @@ public class Bugzilla_505654_Test extends AbstractCDOTest { CDOID customer1 = leftAdd(getModel1Package().getCustomer()); CDOID customer1b = rightAdd(getModel1Package().getCustomer()); - assertIDs(leftMerge(), customer1, customer1b); - assertIDs(rightMerge(), customer1, customer1b); + assertIDs(leftMerge(), customer1b, customer1); + assertIDs(rightMerge(), customer1b, customer1); CDOID customer2 = leftAdd(getModel1Package().getCustomer()); CDOID customer2b = rightAdd(getModel1Package().getCustomer()); - assertIDs(leftMerge(), customer1, customer1b, customer2, customer2b); + assertIDs(leftMerge(), customer1b, customer1, customer2b, customer2); CDOID customer3 = leftAdd(getModel1Package().getCustomer()); CDOID customer3b = rightAdd(getModel1Package().getCustomer()); - assertIDs(leftMerge(), customer1, customer1b, customer2, customer3b, customer3, customer2b); + assertIDs(leftMerge(), customer1b, customer1, customer2b, customer3b, customer2, customer3); } } diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/IConstants.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/IConstants.java index d3ad3ce1ca..a856e441d5 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/IConstants.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/IConstants.java @@ -23,17 +23,17 @@ import org.eclipse.emf.cdo.tests.config.impl.SessionConfig.Net4j; */ public interface IConstants { - public static final RepositoryConfig MEM = new MEMConfig(false, false, IDGenerationLocation.STORE); + public static final RepositoryConfig MEM = new MEMConfig(); - public static final RepositoryConfig MEM_AUDITS = new MEMConfig(true, false, IDGenerationLocation.STORE); + public static final RepositoryConfig MEM_AUDITS = new MEMConfig().supportingAudits(true); - public static final RepositoryConfig MEM_BRANCHES = new MEMConfig(true, true, IDGenerationLocation.STORE); + public static final RepositoryConfig MEM_BRANCHES = new MEMConfig().supportingBranches(true); - public static final RepositoryConfig MEM_BRANCHES_UUIDS = new MEMConfig(true, true, IDGenerationLocation.CLIENT); + public static final RepositoryConfig MEM_BRANCHES_UUIDS = new MEMConfig().idGenerationLocation(IDGenerationLocation.CLIENT); - public static final RepositoryConfig MEM_OFFLINE = new MEMOfflineConfig(IDGenerationLocation.CLIENT); + public static final RepositoryConfig MEM_OFFLINE = new MEMOfflineConfig().idGenerationLocation(IDGenerationLocation.CLIENT); - public static final RepositoryConfig MEM_EMBEDDED_BRANCHES = new MEMConfig.Embedded(true, true, IDGenerationLocation.STORE); + public static final RepositoryConfig MEM_EMBEDDED_BRANCHES = new MEMConfig.Embedded().supportingBranches(true); public static final SessionConfig EMBEDDED = Net4j.JVM.Embedded.INSTANCE; diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/IRepositoryConfig.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/IRepositoryConfig.java index e9344a7042..7b58404ce3 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/IRepositoryConfig.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/IRepositoryConfig.java @@ -11,6 +11,7 @@ package org.eclipse.emf.cdo.tests.config; import org.eclipse.emf.cdo.common.CDOCommonRepository.IDGenerationLocation; +import org.eclipse.emf.cdo.common.CDOCommonRepository.ListOrdering; import org.eclipse.emf.cdo.server.IRepositoryProvider; import org.eclipse.emf.cdo.server.IStore; import org.eclipse.emf.cdo.spi.server.InternalRepository; @@ -39,6 +40,8 @@ public interface IRepositoryConfig extends IConfig, IRepositoryProvider public static final String CAPABILITY_EXTERNAL_REFS = "repository.external.refs"; + public static final String CAPABILITY_UNORDERED_LISTS = "repository.unordered.lists"; + public static final String CAPABILITY_UUIDS = "repository.uuids"; public static final String CAPABILITY_OFFLINE = "repository.offline"; @@ -49,15 +52,17 @@ public interface IRepositoryConfig extends IConfig, IRepositoryProvider public boolean hasServerContainer(); - public boolean isSupportingAudits(); + public boolean supportingAudits(); + + public boolean supportingBranches(); - public boolean isSupportingBranches(); + public boolean supportingChunks(); - public boolean isSupportingChunks(); + public boolean supportingExtRefs(); - public boolean isSupportingExtRefs(); + public IDGenerationLocation idGenerationLocation(); - public IDGenerationLocation getIDGenerationLocation(); + public ListOrdering listOrdering(); public Map<String, String> getRepositoryProperties(); diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/RepositoryConfig.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/RepositoryConfig.java index 2dec90aa22..508e0c5b04 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/RepositoryConfig.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/RepositoryConfig.java @@ -12,6 +12,7 @@ package org.eclipse.emf.cdo.tests.config.impl; import org.eclipse.emf.cdo.common.CDOCommonRepository.IDGenerationLocation; +import org.eclipse.emf.cdo.common.CDOCommonRepository.ListOrdering; import org.eclipse.emf.cdo.common.CDOCommonView; import org.eclipse.emf.cdo.common.commit.CDOCommitInfo; import org.eclipse.emf.cdo.common.commit.CDOCommitInfoHandler; @@ -147,7 +148,13 @@ public abstract class RepositoryConfig extends Config implements IRepositoryConf private boolean supportingBranches; - private IDGenerationLocation idGenerationLocation; + private boolean supportingChunks = true; + + private boolean supportingExtRefs = true; + + private IDGenerationLocation idGenerationLocation = IDGenerationLocation.STORE; + + private ListOrdering listOrdering = ListOrdering.ORDERED; /** * Flag used to signal that a repository is being restarted. This prevents cleaning and reinitialization of persistent @@ -159,37 +166,38 @@ public abstract class RepositoryConfig extends Config implements IRepositoryConf private transient IRepository.WriteAccessHandler resourcePathChecker; - public RepositoryConfig(String name, boolean supportingAudits, boolean supportingBranches, IDGenerationLocation idGenerationLocation) + public RepositoryConfig(String name) { super(name); - - this.supportingAudits = supportingAudits; - this.supportingBranches = supportingBranches; - this.idGenerationLocation = idGenerationLocation; } public void initCapabilities(Set<String> capabilities) { - if (isSupportingAudits()) + if (supportingAudits()) { capabilities.add(CAPABILITY_AUDITING); - if (isSupportingBranches()) + if (supportingBranches()) { capabilities.add(CAPABILITY_BRANCHING); } } - if (isSupportingChunks()) + if (supportingChunks()) { capabilities.add(CAPABILITY_CHUNKING); } - if (isSupportingExtRefs()) + if (supportingExtRefs()) { capabilities.add(CAPABILITY_EXTERNAL_REFS); } - if (getIDGenerationLocation() == IDGenerationLocation.CLIENT) + if (listOrdering() != ListOrdering.ORDERED) + { + capabilities.add(CAPABILITY_UNORDERED_LISTS); + } + + if (idGenerationLocation() == IDGenerationLocation.CLIENT) { capabilities.add(CAPABILITY_UUIDS); } @@ -209,31 +217,84 @@ public abstract class RepositoryConfig extends Config implements IRepositoryConf return true; } - public boolean isSupportingAudits() + public boolean supportingAudits() { return supportingAudits; } - public boolean isSupportingBranches() + public RepositoryConfig supportingAudits(boolean supportingAudits) + { + this.supportingAudits = supportingAudits; + + if (!supportingAudits) + { + supportingBranches(false); + } + + return this; + } + + public boolean supportingBranches() { return supportingBranches; } - public boolean isSupportingChunks() + public RepositoryConfig supportingBranches(boolean supportingBranches) { - return true; + this.supportingBranches = supportingBranches; + + if (supportingBranches) + { + supportingAudits(true); + } + + return this; } - public boolean isSupportingExtRefs() + public boolean supportingChunks() { - return true; + return supportingChunks; + } + + public RepositoryConfig supportingChunks(boolean supportingChunks) + { + this.supportingChunks = supportingChunks; + return this; + } + + public boolean supportingExtRefs() + { + return supportingExtRefs; + } + + public RepositoryConfig supportingExtRefs(boolean supportingExtRefs) + { + this.supportingExtRefs = supportingExtRefs; + return this; } - public IDGenerationLocation getIDGenerationLocation() + public IDGenerationLocation idGenerationLocation() { return idGenerationLocation; } + public RepositoryConfig idGenerationLocation(IDGenerationLocation idGenerationLocation) + { + this.idGenerationLocation = idGenerationLocation; + return this; + } + + public ListOrdering listOrdering() + { + return listOrdering; + } + + public RepositoryConfig listOrdering(ListOrdering listOrdering) + { + this.listOrdering = listOrdering; + return this; + } + @Override public String getName() { @@ -417,6 +478,9 @@ public abstract class RepositoryConfig extends Config implements IRepositoryConf props.put(Props.SUPPORTING_AUDITS, Boolean.toString(supportingAudits)); props.put(Props.SUPPORTING_BRANCHES, Boolean.toString(supportingBranches)); props.put(Props.ID_GENERATION_LOCATION, idGenerationLocation.toString()); + + // TODO list-ordering + // props.put(Props.LIST_ORDERING, listOrdering.toString()); } public void registerRepository(final InternalRepository repository) @@ -841,9 +905,11 @@ public abstract class RepositoryConfig extends Config implements IRepositoryConf private transient IAcceptor masterAcceptor; - public OfflineConfig(String name, IDGenerationLocation idGenerationLocation) + public OfflineConfig(String name) { - super(name, true, true, idGenerationLocation); + super(name); + supportingAudits(true); + supportingBranches(true); } @Override @@ -1109,14 +1175,14 @@ public abstract class RepositoryConfig extends Config implements IRepositoryConf private static final long serialVersionUID = 1L; - public MEMConfig(String name, boolean supportingAudits, boolean supportingBranches, IDGenerationLocation idGenerationLocation) + public MEMConfig(String name) { - super(name, supportingAudits, supportingBranches, idGenerationLocation); + super(name); } - public MEMConfig(boolean supportingAudits, boolean supportingBranches, IDGenerationLocation idGenerationLocation) + public MEMConfig() { - this(STORE_NAME, supportingAudits, supportingBranches, idGenerationLocation); + this(STORE_NAME); } @Override @@ -1143,9 +1209,9 @@ public abstract class RepositoryConfig extends Config implements IRepositoryConf { private static final long serialVersionUID = 1L; - public Embedded(boolean supportingAudits, boolean supportingBranches, IDGenerationLocation idGenerationLocation) + public Embedded() { - super(STORE_NAME + "Embedded", supportingAudits, supportingBranches, idGenerationLocation); + super(STORE_NAME + "Embedded"); } @Override @@ -1172,9 +1238,9 @@ public abstract class RepositoryConfig extends Config implements IRepositoryConf { private static final long serialVersionUID = 1L; - public MEMOfflineConfig(IDGenerationLocation idGenerationLocation) + public MEMOfflineConfig() { - super(MEMConfig.STORE_NAME + "Offline", idGenerationLocation); + super(MEMConfig.STORE_NAME + "Offline"); } @Override diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/offline/OfflineTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/offline/OfflineTest.java index cfd177c230..5629f740d0 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/offline/OfflineTest.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/offline/OfflineTest.java @@ -324,7 +324,7 @@ public class OfflineTest extends AbstractSyncingTest assertEquals(1, transaction.getNewObjects().size()); CDOObject offlineCompany = transaction.getNewObjects().values().iterator().next(); - if (getRepositoryConfig().getIDGenerationLocation() != IDGenerationLocation.CLIENT) + if (getRepositoryConfig().idGenerationLocation() != IDGenerationLocation.CLIENT) { assertEquals(CDOID.Type.TEMP_OBJECT, offlineCompany.cdoID().getType()); } |