Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2017-01-13 02:41:44 -0500
committerEike Stepper2017-01-13 03:18:31 -0500
commit226fddd44f9b402b4c2330ce32c469cdc71a61dd (patch)
tree12850a5dd1e3734ff8b17dd5413ddfdf48b6e8e6
parentbb6dacda5af21995d9632c1ec9444e7d5e2a63c5 (diff)
downloadcdo-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
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/CDOCommonRepository.java49
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOAddFeatureDeltaImpl.java24
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOListFeatureDeltaImpl.java16
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOMoveFeatureDeltaImpl.java101
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDORemoveFeatureDeltaImpl.java10
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDORevisionDeltaImpl.java29
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOSingleValueFeatureDeltaImpl.java13
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDOFeatureDelta.java15
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.all/src/org/eclipse/emf/cdo/tests/all/GerritTests.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AbstractSetupDBConfig.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBDerby.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBH2Audit.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBH2Branching.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBH2BranchingUUIDs.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBH2NonAudit.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBHsqldb.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBHsqldbNonAudit.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBMysql.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBOracle.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBPsql.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AnyTestManyTimesDB.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DBConfig.java70
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DBConfigs.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DerbyConfig.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/H2Config.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/HsqldbConfig.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/MysqlConfig.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/OracleConfig.java11
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/PostgresqlConfig.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/offline/AllTestsDBH2Offline.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/offline/AllTestsDBMysqlOffline.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/offline/Bugzilla_351078_DB_Test.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/offline/DBOfflineConfig.java58
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/offline/H2OfflineConfig.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/offline/MysqlOfflineConfig.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/performance/AllPerformanceTestsH2NonAudit.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db4o/META-INF/MANIFEST.MF4
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db4o/src/org/eclipse/emf/cdo/tests/db4o/DB4OConfig.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/AllTestsHibernate.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/HibernateConfig.java9
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.lissome/src/org/eclipse/emf/cdo/tests/lissome/LissomeConfig.java11
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.mongodb/src/org/eclipse/emf/cdo/tests/mongodb/AllTestsMongoDB.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.mongodb/src/org/eclipse/emf/cdo/tests/mongodb/MongoDBConfig.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.objectivity/src/org/eclipse/emf/cdo/tests/objectivity/AllTestsObjyAudit.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.objectivity/src/org/eclipse/emf/cdo/tests/objectivity/AllTestsObjyBranching.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.objectivity/src/org/eclipse/emf/cdo/tests/objectivity/AllTestsObjyNonAudit.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.objectivity/src/org/eclipse/emf/cdo/tests/objectivity/ObjyConfig.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.objectivity/src/org/eclipse/emf/cdo/tests/objectivity/ObjyDBConfigs.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.objectivity/src/org/eclipse/emf/cdo/tests/objectivity/SampleTestsObjy.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ConflictResolverExtendedTest.java697
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ConflictResolverTest.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ExternalReferenceTest.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/OCLQueryTest.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/PushTransactionTest.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/RevisionDeltaTest.java15
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/RevisionManagerTest.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/XRefTest.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_310574_Test.java62
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_384496_Test.java11
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_435532_Test.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_505654_Test.java45
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/IConstants.java12
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/IRepositoryConfig.java15
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/RepositoryConfig.java122
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/offline/OfflineTest.java2
-rw-r--r--plugins/org.eclipse.emf.cdo/.settings/.api_filters82
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/DefaultCDOMerger.java499
67 files changed, 1637 insertions, 526 deletions
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/CDOCommonRepository.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/CDOCommonRepository.java
index d95b3c95f7..fcd750f1ea 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/CDOCommonRepository.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/CDOCommonRepository.java
@@ -15,6 +15,8 @@ import org.eclipse.emf.cdo.common.util.CDOTimeProvider;
import org.eclipse.net4j.util.event.IEvent;
+import org.eclipse.emf.ecore.EReference;
+
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -156,6 +158,53 @@ public interface CDOCommonRepository extends CDOTimeProvider, IAdaptable
}
/**
+ * @author Eike Stepper
+ * @since 4.6
+ */
+ public static enum ListOrdering
+ {
+ ORDERED
+ {
+ @Override
+ public boolean isOrdered(EReference reference)
+ {
+ return true;
+ }
+ },
+
+ UNORDERED
+ {
+ @Override
+ public boolean isOrdered(EReference reference)
+ {
+ return false;
+ }
+ },
+
+ BY_ECORE
+ {
+ @Override
+ public boolean isOrdered(EReference reference)
+ {
+ return reference.isOrdered();
+ }
+ },
+
+ BY_ANNOTATED_ECORE
+ {
+ @Override
+ public boolean isOrdered(EReference reference)
+ {
+ // TODO list-ordering
+ // return !EMFUtil.isUnordered(reference);
+ return reference.isOrdered();
+ }
+ };
+
+ public abstract boolean isOrdered(EReference reference);
+ }
+
+ /**
* Enumerates the possible {@link CDOCommonRepository#getIDGenerationLocation() ID generation locations} of a CDO
* repository.
*
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOAddFeatureDeltaImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOAddFeatureDeltaImpl.java
index 58f8990843..8eb85c0e94 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOAddFeatureDeltaImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOAddFeatureDeltaImpl.java
@@ -53,6 +53,20 @@ public class CDOAddFeatureDeltaImpl extends CDOSingleValueFeatureDeltaImpl imple
InternalCDORevision internalRevision = (InternalCDORevision)revision;
CDOList list = internalRevision.getList(feature);
+
+ if (index < 0)
+ {
+ index = 0;
+ }
+ else
+ {
+ int size = list.size();
+ if (index > size)
+ {
+ index = size;
+ }
+ }
+
list.add(index, value);
return null;
}
@@ -83,4 +97,14 @@ public class CDOAddFeatureDeltaImpl extends CDOSingleValueFeatureDeltaImpl imple
}
}
}
+
+ public int projectIndex(int index)
+ {
+ if (index >= getIndex())
+ {
+ --index;
+ }
+
+ return index;
+ }
}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOListFeatureDeltaImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOListFeatureDeltaImpl.java
index 45f459c347..1e1ebc6c5a 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOListFeatureDeltaImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOListFeatureDeltaImpl.java
@@ -467,6 +467,19 @@ public class CDOListFeatureDeltaImpl extends CDOFeatureDeltaImpl implements CDOL
--this.index;
}
}
+
+ public void adjustAfterMove(int oldPosition, int newPosition)
+ {
+ if (index == oldPosition)
+ {
+ index = newPosition;
+ }
+ else
+ {
+ adjustAfterRemoval(oldPosition);
+ adjustAfterAddition(newPosition);
+ }
+ }
}
int size = listChanges.size();
@@ -483,8 +496,7 @@ public class CDOListFeatureDeltaImpl extends CDOFeatureDeltaImpl implements CDOL
int newPosition = ((CDOMoveFeatureDelta)fd).getNewPosition();
for (DeltaProxy proxy : proxies)
{
- proxy.adjustAfterRemoval(oldPosition);
- proxy.adjustAfterAddition(newPosition);
+ proxy.adjustAfterMove(oldPosition, newPosition);
}
break;
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOMoveFeatureDeltaImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOMoveFeatureDeltaImpl.java
index 1d8447eef0..674c965828 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOMoveFeatureDeltaImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOMoveFeatureDeltaImpl.java
@@ -24,10 +24,14 @@ import org.eclipse.emf.cdo.spi.common.revision.InternalCDOFeatureDelta.WithIndex
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EcorePackage;
import java.io.IOException;
import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.List;
/**
* @author Simon McDuff
@@ -79,6 +83,11 @@ public class CDOMoveFeatureDeltaImpl extends CDOFeatureDeltaImpl implements CDOM
return Type.MOVE;
}
+ public int getIndex()
+ {
+ return oldPosition;
+ }
+
public Object getValue()
{
return value;
@@ -112,6 +121,27 @@ public class CDOMoveFeatureDeltaImpl extends CDOFeatureDeltaImpl implements CDOM
InternalCDORevision internalRevision = (InternalCDORevision)revision;
CDOList list = internalRevision.getList(feature);
+
+ if (oldPosition < 0)
+ {
+ return null;
+ }
+
+ int size = list.size();
+ if (oldPosition > size)
+ {
+ return null;
+ }
+
+ if (newPosition < 0)
+ {
+ newPosition = 0;
+ }
+ else if (newPosition > size)
+ {
+ newPosition = size;
+ }
+
return list.move(newPosition, oldPosition);
}
@@ -147,6 +177,64 @@ public class CDOMoveFeatureDeltaImpl extends CDOFeatureDeltaImpl implements CDOM
}
}
+ public static void main(String[] args)
+ {
+ final EReference feature = EcorePackage.Literals.EPACKAGE__ECLASSIFIERS;
+
+ List<CDOFeatureDelta> deltas = new ArrayList<CDOFeatureDelta>();
+ deltas.add(new CDOMoveFeatureDeltaImpl(feature, 7, 1));
+ // deltas.add(new CDORemoveFeatureDeltaImpl(feature, 1));
+ // deltas.add(new CDORemoveFeatureDeltaImpl(feature, 1));
+
+ for (int i = 0; i < 10; i++)
+ {
+ projectIndex(deltas, i);
+ }
+ }
+
+ private static void projectIndex(List<CDOFeatureDelta> deltas, int index)
+ {
+ for (CDOFeatureDelta delta : deltas)
+ {
+ if (delta instanceof ListIndexAffecting)
+ {
+ index = ((ListIndexAffecting)delta).projectIndex(index);
+ }
+ }
+
+ System.out.println(index);
+ }
+
+ public int projectIndex(int index)
+ {
+ if (oldPosition < newPosition)
+ {
+ // Move to right.
+ if (oldPosition <= index && index < newPosition)
+ {
+ ++index;
+ }
+ else if (index == newPosition)
+ {
+ index = oldPosition;
+ }
+ }
+ else
+ {
+ // Move to left.
+ if (newPosition < index && index <= oldPosition)
+ {
+ --index;
+ }
+ else if (index == newPosition)
+ {
+ index = oldPosition;
+ }
+ }
+
+ return index;
+ }
+
public void accept(CDOFeatureDeltaVisitor visitor)
{
visitor.visit(this);
@@ -184,6 +272,19 @@ public class CDOMoveFeatureDeltaImpl extends CDOFeatureDeltaImpl implements CDOM
}
}
+ public void adjustAfterMove(int oldPosition, int newPosition)
+ {
+ if (this.oldPosition == oldPosition)
+ {
+ this.oldPosition = newPosition;
+ }
+ else
+ {
+ adjustAfterRemoval(oldPosition);
+ adjustAfterAddition(newPosition);
+ }
+ }
+
@Override
public boolean adjustReferences(CDOReferenceAdjuster adjuster)
{
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDORemoveFeatureDeltaImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDORemoveFeatureDeltaImpl.java
index d14aec4e7e..c2ce31558d 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDORemoveFeatureDeltaImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDORemoveFeatureDeltaImpl.java
@@ -101,4 +101,14 @@ public class CDORemoveFeatureDeltaImpl extends CDOSingleValueFeatureDeltaImpl im
}
}
}
+
+ public int projectIndex(int index)
+ {
+ if (index >= getIndex())
+ {
+ ++index;
+ }
+
+ return index;
+ }
}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDORevisionDeltaImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDORevisionDeltaImpl.java
index 1c6fdc84cf..c1b76c5239 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDORevisionDeltaImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDORevisionDeltaImpl.java
@@ -43,6 +43,7 @@ import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionDelta;
import org.eclipse.net4j.util.Predicate;
import org.eclipse.net4j.util.Predicates;
+import org.eclipse.net4j.util.om.OMPlatform;
import org.eclipse.emf.common.util.ECollections;
import org.eclipse.emf.common.util.EList;
@@ -66,6 +67,8 @@ import java.util.Map;
*/
public class CDORevisionDeltaImpl implements InternalCDORevisionDelta
{
+ private static final boolean WORK_AROUND_BUG_308618 = OMPlatform.INSTANCE.isProperty("org.eclipse.emf.cdo.common.revision.delta.WORK_AROUND_BUG_308618");
+
private EClass eClass;
private CDOID id;
@@ -406,8 +409,17 @@ public class CDORevisionDeltaImpl implements InternalCDORevisionDelta
protected void createRemoveListChange(EList<?> oldList, EList<ListChange> listChanges, Object value, int index)
{
CDORemoveFeatureDeltaImpl delta = new CDORemoveFeatureDeltaImpl(feature, index);
- // fix until ListDifferenceAnalyzer delivers the correct value (bug #308618).
- delta.setValue(oldList.get(index));
+
+ if (WORK_AROUND_BUG_308618)
+ {
+ // Fix until ListDifferenceAnalyzer delivers the correct value (bug 308618).
+ delta.setValue(oldList.get(index));
+ }
+ else
+ {
+ delta.setValue(value);
+ }
+
changes.add(delta);
oldList.remove(index);
}
@@ -416,8 +428,17 @@ public class CDORevisionDeltaImpl implements InternalCDORevisionDelta
protected void createMoveListChange(EList<?> oldList, EList<ListChange> listChanges, Object value, int index, int toIndex)
{
CDOMoveFeatureDeltaImpl delta = new CDOMoveFeatureDeltaImpl(feature, toIndex, index);
- // fix until ListDifferenceAnalyzer delivers the correct value (same problem as bug #308618).
- delta.setValue(oldList.get(index));
+
+ if (WORK_AROUND_BUG_308618)
+ {
+ // Fix until ListDifferenceAnalyzer delivers the correct value (bug 308618).
+ delta.setValue(oldList.get(index));
+ }
+ else
+ {
+ delta.setValue(value);
+ }
+
changes.add(delta);
oldList.move(toIndex, index);
}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOSingleValueFeatureDeltaImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOSingleValueFeatureDeltaImpl.java
index 7d7d5add23..6cd42fe3ac 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOSingleValueFeatureDeltaImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOSingleValueFeatureDeltaImpl.java
@@ -148,6 +148,19 @@ public abstract class CDOSingleValueFeatureDeltaImpl extends CDOFeatureDeltaImpl
}
}
+ public void adjustAfterMove(int oldPosition, int newPosition)
+ {
+ if (index == oldPosition)
+ {
+ index = newPosition;
+ }
+ else
+ {
+ adjustAfterRemoval(oldPosition);
+ adjustAfterAddition(newPosition);
+ }
+ }
+
@Override
public boolean adjustReferences(CDOReferenceAdjuster referenceAdjuster)
{
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDOFeatureDelta.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDOFeatureDelta.java
index ad447f2b1a..80d8b003c1 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDOFeatureDelta.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDOFeatureDelta.java
@@ -30,9 +30,19 @@ public interface InternalCDOFeatureDelta extends CDOFeatureDelta
*/
public interface WithIndex
{
+ /**
+ * @since 4.6
+ */
+ public int getIndex();
+
public void adjustAfterAddition(int index);
public void adjustAfterRemoval(int index);
+
+ /**
+ * @since 4.6
+ */
+ public void adjustAfterMove(int oldPosition, int newPosition);
}
/**
@@ -48,6 +58,11 @@ public interface InternalCDOFeatureDelta extends CDOFeatureDelta
* Expects the number of indices in the first element of the indices array.
*/
public void affectIndices(ListTargetAdding source[], int[] indices);
+
+ /**
+ * @since 4.6
+ */
+ public int projectIndex(int index);
}
/**
diff --git a/plugins/org.eclipse.emf.cdo.tests.all/src/org/eclipse/emf/cdo/tests/all/GerritTests.java b/plugins/org.eclipse.emf.cdo.tests.all/src/org/eclipse/emf/cdo/tests/all/GerritTests.java
index 139c8f9cbd..aa74561f3b 100644
--- a/plugins/org.eclipse.emf.cdo.tests.all/src/org/eclipse/emf/cdo/tests/all/GerritTests.java
+++ b/plugins/org.eclipse.emf.cdo.tests.all/src/org/eclipse/emf/cdo/tests/all/GerritTests.java
@@ -11,7 +11,6 @@
*/
package org.eclipse.emf.cdo.tests.all;
-import org.eclipse.emf.cdo.common.CDOCommonRepository.IDGenerationLocation;
import org.eclipse.emf.cdo.tests.db.DBConfigs;
import org.eclipse.emf.cdo.tests.db.H2Config;
@@ -31,7 +30,7 @@ public class GerritTests extends DBConfigs
@Override
protected void initConfigSuites(TestSuite parent)
{
- addScenario(parent, new H2Config(false, false, true, false, false, IDGenerationLocation.STORE), JVM, NATIVE);
- addScenario(parent, new H2Config(true, true, true, false, false, IDGenerationLocation.STORE), JVM, NATIVE);
+ addScenario(parent, new H2Config(), JVM, NATIVE);
+ addScenario(parent, new H2Config().supportingBranches(true), JVM, NATIVE);
}
}
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AbstractSetupDBConfig.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AbstractSetupDBConfig.java
index 18192d8c60..2bd9a1fe07 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AbstractSetupDBConfig.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AbstractSetupDBConfig.java
@@ -10,8 +10,6 @@
*/
package org.eclipse.emf.cdo.tests.db;
-import org.eclipse.emf.cdo.common.CDOCommonRepository.IDGenerationLocation;
-
import org.eclipse.net4j.db.DBException;
import org.eclipse.net4j.db.DBUtil;
@@ -30,10 +28,9 @@ public abstract class AbstractSetupDBConfig extends DBConfig
private transient DataSource setupDataSource;
- public AbstractSetupDBConfig(String name, boolean supportingAudits, boolean supportingBranches, boolean withRanges, boolean copyOnBranch,
- boolean inverseLists, IDGenerationLocation idGenerationLocation)
+ public AbstractSetupDBConfig(String name)
{
- super(name, supportingAudits, supportingBranches, withRanges, copyOnBranch, inverseLists, idGenerationLocation);
+ super(name);
}
protected String getDBName(String repoName)
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBDerby.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBDerby.java
index 66ab714fd4..00f5972e37 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBDerby.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBDerby.java
@@ -10,8 +10,6 @@
*/
package org.eclipse.emf.cdo.tests.db;
-import org.eclipse.emf.cdo.common.CDOCommonRepository.IDGenerationLocation;
-
import junit.framework.Test;
import junit.framework.TestSuite;
@@ -28,7 +26,7 @@ public class AllTestsDBDerby extends DBConfigs
@Override
protected void initConfigSuites(TestSuite parent)
{
- addScenario(parent, new DerbyConfig(true, true, IDGenerationLocation.STORE), JVM, NATIVE);
+ addScenario(parent, new DerbyConfig().supportingBranches(true), JVM, NATIVE);
// addScenario(parent, AllTestsDBDerby.Derby.INSTANCE, TCP, NATIVE);
}
}
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBH2Audit.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBH2Audit.java
index d0105fdb7f..1ad0f605b6 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBH2Audit.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBH2Audit.java
@@ -30,10 +30,10 @@ public class AllTestsDBH2Audit extends DBConfigs
public static void initConfigSuites(ConfigTestSuite suite, TestSuite parent, IDGenerationLocation idGenerationLocation)
{
// Without ranges
- suite.addScenario(parent, new H2Config(true, false, false, false, false, idGenerationLocation), JVM, NATIVE);
+ suite.addScenario(parent, new H2Config().supportingAudits(true).idGenerationLocation(idGenerationLocation), JVM, NATIVE);
// With ranges
- suite.addScenario(parent, new H2Config(true, false, true, false, false, idGenerationLocation), JVM, NATIVE);
+ suite.addScenario(parent, new H2Config().supportingAudits(true).idGenerationLocation(idGenerationLocation).copyOnBranch(true), JVM, NATIVE);
}
@Override
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBH2Branching.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBH2Branching.java
index 26e658e3e7..03b9b2ca4a 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBH2Branching.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBH2Branching.java
@@ -29,13 +29,14 @@ public class AllTestsDBH2Branching extends DBConfigs
public static void initConfigSuites(ConfigTestSuite suite, TestSuite parent, IDGenerationLocation idGenerationLocation)
{
// Without ranges
- suite.addScenario(parent, new H2Config(true, true, false, false, false, idGenerationLocation), JVM, NATIVE);
+ suite.addScenario(parent, new H2Config().supportingBranches(true).idGenerationLocation(idGenerationLocation), JVM, NATIVE);
// With ranges
- suite.addScenario(parent, new H2Config(true, true, true, false, false, idGenerationLocation), JVM, NATIVE);
+ suite.addScenario(parent, new H2Config().supportingBranches(true).idGenerationLocation(idGenerationLocation).withRanges(true), JVM, NATIVE);
// With ranges and copy-on-branch
- // suite.addScenario(parent, new H2Config(true, true, true, true, idGenerationLocation), JVM, NATIVE);
+ // suite.addScenario(parent, new
+ // H2Config().supportingBranches(true).idGenerationLocation(idGenerationLocation).copyOnBranch(true), JVM, NATIVE);
}
@Override
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBH2BranchingUUIDs.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBH2BranchingUUIDs.java
index a587a52153..03062d74e2 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBH2BranchingUUIDs.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBH2BranchingUUIDs.java
@@ -28,6 +28,6 @@ public class AllTestsDBH2BranchingUUIDs extends DBConfigs
@Override
protected void initConfigSuites(TestSuite parent)
{
- addScenario(parent, new H2Config(true, true, false, false, false, IDGenerationLocation.CLIENT), JVM, NATIVE);
+ addScenario(parent, new H2Config().supportingBranches(true).idGenerationLocation(IDGenerationLocation.CLIENT), JVM, NATIVE);
}
}
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBH2NonAudit.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBH2NonAudit.java
index f1a0f668a2..ed72145a11 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBH2NonAudit.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBH2NonAudit.java
@@ -12,6 +12,7 @@ package org.eclipse.emf.cdo.tests.db;
import org.eclipse.emf.cdo.common.CDOCommonRepository.IDGenerationLocation;
import org.eclipse.emf.cdo.tests.config.impl.ConfigTestSuite;
+import org.eclipse.emf.cdo.tests.config.impl.RepositoryConfig;
import junit.framework.Test;
import junit.framework.TestSuite;
@@ -28,7 +29,12 @@ public class AllTestsDBH2NonAudit extends DBConfigs
public static void initConfigSuites(ConfigTestSuite suite, TestSuite parent, IDGenerationLocation idGenerationLocation)
{
- suite.addScenario(parent, new H2Config(false, false, false, false, false, idGenerationLocation), JVM, NATIVE);
+ RepositoryConfig config = new H2Config().idGenerationLocation(idGenerationLocation);
+
+ // TODO list-ordering
+ // config.listOrdering(ListOrdering.UNORDERED).supportingChunks(false);
+
+ suite.addScenario(parent, config, JVM, NATIVE);
}
@Override
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBHsqldb.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBHsqldb.java
index 6c3f5f1f05..86ac3f18b7 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBHsqldb.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBHsqldb.java
@@ -10,7 +10,6 @@
*/
package org.eclipse.emf.cdo.tests.db;
-import org.eclipse.emf.cdo.common.CDOCommonRepository.IDGenerationLocation;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_266982_Test;
import org.eclipse.emf.cdo.tests.config.IScenario;
import org.eclipse.emf.cdo.tests.config.impl.ConfigTest;
@@ -33,7 +32,7 @@ public class AllTestsDBHsqldb extends DBConfigs
@Override
protected void initConfigSuites(TestSuite parent)
{
- addScenario(parent, new HsqldbConfig(true, false, IDGenerationLocation.STORE), JVM, NATIVE);
+ addScenario(parent, new HsqldbConfig().supportingAudits(true), JVM, NATIVE);
}
@Override
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBHsqldbNonAudit.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBHsqldbNonAudit.java
index 131b99ebae..a85dd92e1a 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBHsqldbNonAudit.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBHsqldbNonAudit.java
@@ -10,7 +10,6 @@
*/
package org.eclipse.emf.cdo.tests.db;
-import org.eclipse.emf.cdo.common.CDOCommonRepository.IDGenerationLocation;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_261218_Test;
import org.eclipse.emf.cdo.tests.config.IScenario;
import org.eclipse.emf.cdo.tests.config.impl.ConfigTest;
@@ -33,7 +32,7 @@ public class AllTestsDBHsqldbNonAudit extends DBConfigs
@Override
protected void initConfigSuites(TestSuite parent)
{
- addScenario(parent, new HsqldbConfig(false, false, IDGenerationLocation.STORE), TCP, NATIVE);
+ addScenario(parent, new HsqldbConfig().supportingAudits(true), TCP, NATIVE);
}
@Override
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBMysql.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBMysql.java
index 6d1386cfd6..a9b675c13c 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBMysql.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBMysql.java
@@ -11,7 +11,6 @@
*/
package org.eclipse.emf.cdo.tests.db;
-import org.eclipse.emf.cdo.common.CDOCommonRepository.IDGenerationLocation;
import org.eclipse.emf.cdo.tests.BranchingSameSessionTest;
import org.eclipse.emf.cdo.tests.BranchingTest;
import org.eclipse.emf.cdo.tests.MergingTest;
@@ -36,7 +35,7 @@ public class AllTestsDBMysql extends DBConfigs
@Override
protected void initConfigSuites(TestSuite parent)
{
- addScenario(parent, new MysqlConfig(false, false, false, IDGenerationLocation.STORE), JVM, NATIVE);
+ addScenario(parent, new MysqlConfig(), JVM, NATIVE);
}
@Override
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBOracle.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBOracle.java
index 49c7a6608c..0a5eb4f6b8 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBOracle.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBOracle.java
@@ -35,6 +35,6 @@ public class AllTestsDBOracle extends DBConfigs
private void addScenarios(TestSuite parent, IDGenerationLocation idGenerationLocation)
{
- addScenario(parent, new OracleConfig.SingleUser(false, false, idGenerationLocation), JVM, NATIVE);
+ addScenario(parent, new OracleConfig.SingleUser().idGenerationLocation(idGenerationLocation), JVM, NATIVE);
}
}
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBPsql.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBPsql.java
index 5a3b14daee..79c4fa6c66 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBPsql.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBPsql.java
@@ -12,8 +12,6 @@
*/
package org.eclipse.emf.cdo.tests.db;
-import org.eclipse.emf.cdo.common.CDOCommonRepository.IDGenerationLocation;
-
import junit.framework.Test;
import junit.framework.TestSuite;
@@ -37,8 +35,8 @@ public class AllTestsDBPsql extends DBConfigs
@Override
protected void initConfigSuites(TestSuite parent)
{
- addScenario(parent, new PostgresqlConfig(false, false, IDGenerationLocation.STORE), JVM, NATIVE);
- addScenario(parent, new PostgresqlConfig(true, false, IDGenerationLocation.STORE), JVM, NATIVE);
- addScenario(parent, new PostgresqlConfig(true, true, IDGenerationLocation.STORE), JVM, NATIVE);
+ addScenario(parent, new PostgresqlConfig(), JVM, NATIVE);
+ addScenario(parent, new PostgresqlConfig().supportingAudits(true), JVM, NATIVE);
+ addScenario(parent, new PostgresqlConfig().supportingBranches(true), JVM, NATIVE);
}
}
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AnyTestManyTimesDB.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AnyTestManyTimesDB.java
index 5b017c0079..db668bb9b9 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AnyTestManyTimesDB.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AnyTestManyTimesDB.java
@@ -40,8 +40,8 @@ public class AnyTestManyTimesDB extends TestSuite implements IConstants
private static final IDGenerationLocation ID_GENERATION_LOCATION = IDGenerationLocation.STORE;
- private static final RepositoryConfig REPOSITORY_CONFIG = new H2Config(SUPPORTING_AUDITS, SUPPORTING_BRANCHES, WITH_RANGES, COPY_ON_BRANCH, INVERSE_LISTS,
- ID_GENERATION_LOCATION);
+ private static final RepositoryConfig REPOSITORY_CONFIG = new H2Config().supportingAudits(SUPPORTING_AUDITS).supportingBranches(SUPPORTING_BRANCHES)
+ .withRanges(WITH_RANGES).copyOnBranch(COPY_ON_BRANCH).inverseLists(INVERSE_LISTS).idGenerationLocation(ID_GENERATION_LOCATION);
private static final SessionConfig SESSION_CONFIG = JVM;
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DBConfig.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DBConfig.java
index 8a34e65832..d12bf95046 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DBConfig.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DBConfig.java
@@ -53,13 +53,9 @@ public abstract class DBConfig extends RepositoryConfig
private transient IDBAdapter dbAdapter;
- public DBConfig(String name, boolean supportingAudits, boolean supportingBranches, boolean withRanges, boolean copyOnBranch, boolean inverseLists,
- IDGenerationLocation idGenerationLocation)
+ public DBConfig(String name)
{
- super(name, supportingAudits, supportingBranches, idGenerationLocation);
- this.withRanges = withRanges;
- this.copyOnBranch = copyOnBranch;
- this.inverseLists = inverseLists;
+ super(name);
}
@Override
@@ -69,17 +65,17 @@ public abstract class DBConfig extends RepositoryConfig
capabilities.add(CAPABILITY);
capabilities.add(getDBAdapterName());
- if (isWithRanges())
+ if (withRanges())
{
capabilities.add(CAPABILITY_RANGES);
}
- if (isCopyOnBranch())
+ if (copyOnBranch())
{
capabilities.add(CAPABILITY_COPY_ON_BRANCH);
}
- if (isInverseLists())
+ if (inverseLists())
{
capabilities.add(CAPABILITY_INVERSE_LISTS);
}
@@ -103,21 +99,69 @@ public abstract class DBConfig extends RepositoryConfig
return "DB";
}
- public boolean isWithRanges()
+ @Override
+ public DBConfig supportingAudits(boolean supportingAudits)
+ {
+ return (DBConfig)super.supportingAudits(supportingAudits);
+ }
+
+ @Override
+ public DBConfig supportingBranches(boolean supportingBranches)
+ {
+ return (DBConfig)super.supportingBranches(supportingBranches);
+ }
+
+ @Override
+ public DBConfig supportingChunks(boolean supportingChunks)
+ {
+ return (DBConfig)super.supportingChunks(supportingChunks);
+ }
+
+ @Override
+ public DBConfig supportingExtRefs(boolean supportingExtRefs)
+ {
+ return (DBConfig)super.supportingExtRefs(supportingExtRefs);
+ }
+
+ @Override
+ public DBConfig idGenerationLocation(IDGenerationLocation idGenerationLocation)
+ {
+ return (DBConfig)super.idGenerationLocation(idGenerationLocation);
+ }
+
+ public boolean withRanges()
{
return withRanges;
}
- public boolean isCopyOnBranch()
+ public DBConfig withRanges(boolean withRanges)
+ {
+ this.withRanges = withRanges;
+ return this;
+ }
+
+ public boolean copyOnBranch()
{
return copyOnBranch;
}
- public boolean isInverseLists()
+ public DBConfig copyOnBranch(boolean copyOnBranch)
+ {
+ this.copyOnBranch = copyOnBranch;
+ return this;
+ }
+
+ public boolean inverseLists()
{
return inverseLists;
}
+ public DBConfig inverseLists(boolean inverseLists)
+ {
+ this.inverseLists = inverseLists;
+ return this;
+ }
+
@Override
public void setUp() throws Exception
{
@@ -165,7 +209,7 @@ public abstract class DBConfig extends RepositoryConfig
return mappingStrategy;
}
- return CDODBUtil.createHorizontalMappingStrategy(isSupportingAudits(), isSupportingBranches(), withRanges);
+ return CDODBUtil.createHorizontalMappingStrategy(supportingAudits(), supportingBranches(), withRanges);
}
protected IMappingStrategy getTestMappingStrategy()
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DBConfigs.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DBConfigs.java
index bde5b498ee..4b171a5cad 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DBConfigs.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DBConfigs.java
@@ -45,7 +45,7 @@ public abstract class DBConfigs extends AllConfigs
super.initTestClasses(testClasses, scenario);
testClasses.remove(MEMStoreQueryTest.class);
- if (!scenario.getRepositoryConfig().isSupportingBranches())
+ if (!scenario.getRepositoryConfig().supportingBranches())
{
testClasses.remove(BranchingTest.class);
testClasses.remove(BranchingSameSessionTest.class);
@@ -53,7 +53,7 @@ public abstract class DBConfigs extends AllConfigs
testClasses.remove(Bugzilla_303807_Test.class);
}
- if (!scenario.getRepositoryConfig().isSupportingAudits())
+ if (!scenario.getRepositoryConfig().supportingAudits())
{
// non-audit mode - remove audit tests
testClasses.remove(AuditTest.class);
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DerbyConfig.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DerbyConfig.java
index a9e591d4bc..6c0485cc31 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DerbyConfig.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DerbyConfig.java
@@ -10,8 +10,6 @@
*/
package org.eclipse.emf.cdo.tests.db;
-import org.eclipse.emf.cdo.common.CDOCommonRepository.IDGenerationLocation;
-
import org.eclipse.net4j.db.DBUtil;
import org.eclipse.net4j.db.IDBAdapter;
import org.eclipse.net4j.db.derby.EmbeddedDerbyAdapter;
@@ -41,9 +39,9 @@ public class DerbyConfig extends DBConfig
private static HashMap<File, EmbeddedDataSource> dataSources = new HashMap<File, EmbeddedDataSource>();
- public DerbyConfig(boolean supportingAudits, boolean supportingBranches, IDGenerationLocation idGenerationLocation)
+ public DerbyConfig()
{
- super(DB_ADAPTER_NAME, supportingAudits, supportingBranches, false, false, false, idGenerationLocation);
+ super(DB_ADAPTER_NAME);
}
@Override
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/H2Config.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/H2Config.java
index 027808fcd7..6cc23fc24c 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/H2Config.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/H2Config.java
@@ -10,8 +10,6 @@
*/
package org.eclipse.emf.cdo.tests.db;
-import org.eclipse.emf.cdo.common.CDOCommonRepository.IDGenerationLocation;
-
import org.eclipse.net4j.db.IDBAdapter;
import org.eclipse.net4j.db.h2.H2Adapter;
import org.eclipse.net4j.util.io.IOUtil;
@@ -36,10 +34,9 @@ public class H2Config extends DBConfig
private static JdbcDataSource defaultDataSource;
- public H2Config(boolean supportingAudits, boolean supportingBranches, boolean withRanges, boolean copyOnBranch, boolean inverseLists,
- IDGenerationLocation idGenerationLocation)
+ public H2Config()
{
- super(DB_ADAPTER_NAME, supportingAudits, supportingBranches, withRanges, copyOnBranch, inverseLists, idGenerationLocation);
+ super(DB_ADAPTER_NAME);
}
@Override
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/HsqldbConfig.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/HsqldbConfig.java
index 42951cdbe9..6bc56f9e1d 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/HsqldbConfig.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/HsqldbConfig.java
@@ -10,7 +10,6 @@
*/
package org.eclipse.emf.cdo.tests.db;
-import org.eclipse.emf.cdo.common.CDOCommonRepository.IDGenerationLocation;
import org.eclipse.emf.cdo.server.IRepository;
import org.eclipse.emf.cdo.server.IRepository.Props;
import org.eclipse.emf.cdo.tests.db.bundle.OM;
@@ -45,9 +44,9 @@ public class HsqldbConfig extends DBConfig
private transient ArrayList<HSQLDBDataSource> dataSources;
- public HsqldbConfig(boolean supportingAudits, boolean supportingBranches, IDGenerationLocation idGenerationLocation)
+ public HsqldbConfig()
{
- super(DB_ADAPTER_NAME, supportingAudits, supportingBranches, false, false, false, idGenerationLocation);
+ super(DB_ADAPTER_NAME);
}
@Override
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/MysqlConfig.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/MysqlConfig.java
index 72e7252120..49f9ba9921 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/MysqlConfig.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/MysqlConfig.java
@@ -10,8 +10,6 @@
*/
package org.eclipse.emf.cdo.tests.db;
-import org.eclipse.emf.cdo.common.CDOCommonRepository.IDGenerationLocation;
-
import org.eclipse.net4j.db.IDBAdapter;
import org.eclipse.net4j.db.mysql.MYSQLAdapter;
@@ -43,9 +41,9 @@ public class MysqlConfig extends AbstractSetupDBConfig
private static final long serialVersionUID = 1L;
- public MysqlConfig(boolean supportingAudits, boolean supportingBranches, boolean inverseLists, IDGenerationLocation idGenerationLocation)
+ public MysqlConfig()
{
- super(DB_ADAPTER_NAME, supportingAudits, supportingBranches, false, false, inverseLists, idGenerationLocation);
+ super(DB_ADAPTER_NAME);
}
@Override
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/OracleConfig.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/OracleConfig.java
index 03240bb814..c19bc15cc8 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/OracleConfig.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/OracleConfig.java
@@ -10,7 +10,6 @@
*/
package org.eclipse.emf.cdo.tests.db;
-import org.eclipse.emf.cdo.common.CDOCommonRepository.IDGenerationLocation;
import org.eclipse.emf.cdo.server.db.IDBStore;
import org.eclipse.emf.cdo.tests.db.bundle.OM;
@@ -49,9 +48,9 @@ public abstract class OracleConfig extends AbstractSetupDBConfig
private static final long serialVersionUID = 1L;
- public OracleConfig(boolean supportingAudits, boolean supportingBranches, IDGenerationLocation idGenerationLocation)
+ public OracleConfig()
{
- super(DB_ADAPTER_NAME, supportingAudits, supportingBranches, false, false, false, idGenerationLocation);
+ super(DB_ADAPTER_NAME);
}
@Override
@@ -106,9 +105,8 @@ public abstract class OracleConfig extends AbstractSetupDBConfig
{
private static final long serialVersionUID = 1L;
- public SingleUser(boolean supportingAudits, boolean supportingBranches, IDGenerationLocation idGenerationLocation)
+ public SingleUser()
{
- super(supportingAudits, supportingBranches, idGenerationLocation);
}
@Override
@@ -138,9 +136,8 @@ public abstract class OracleConfig extends AbstractSetupDBConfig
{
private static final long serialVersionUID = 1L;
- public MultiUser(boolean supportingAudits, boolean supportingBranches, IDGenerationLocation idGenerationLocation)
+ public MultiUser()
{
- super(supportingAudits, supportingBranches, idGenerationLocation);
}
@Override
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/PostgresqlConfig.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/PostgresqlConfig.java
index 541be6617a..510b59c677 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/PostgresqlConfig.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/PostgresqlConfig.java
@@ -10,8 +10,6 @@
*/
package org.eclipse.emf.cdo.tests.db;
-import org.eclipse.emf.cdo.common.CDOCommonRepository.IDGenerationLocation;
-
import org.eclipse.net4j.db.IDBAdapter;
import org.eclipse.net4j.db.postgresql.PostgreSQLAdapter;
@@ -38,9 +36,9 @@ public class PostgresqlConfig extends AbstractSetupDBConfig
private static final long serialVersionUID = 1L;
- public PostgresqlConfig(boolean supportingAudits, boolean supportingBranches, IDGenerationLocation idGenerationLocation)
+ public PostgresqlConfig()
{
- super(DB_ADAPTER_NAME, supportingAudits, supportingBranches, false, false, false, idGenerationLocation);
+ super(DB_ADAPTER_NAME);
}
@Override
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/offline/AllTestsDBH2Offline.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/offline/AllTestsDBH2Offline.java
index 68e36e6e16..51d68fa44f 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/offline/AllTestsDBH2Offline.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/offline/AllTestsDBH2Offline.java
@@ -45,9 +45,7 @@ public class AllTestsDBH2Offline extends DBConfigs
@Override
protected void initConfigSuites(TestSuite parent)
{
- // addScenario(parent, new H2OfflineConfig(false, false, IDGenerationLocation.STORE), JVM, NATIVE);
- addScenario(parent, new H2OfflineConfig(false, false, IDGenerationLocation.CLIENT), JVM, NATIVE);
- // addScenario(parent, new H2OfflineConfig(true, false, IDGenerationLocation.STORE), JVM, NATIVE);
+ addScenario(parent, new H2OfflineConfig().idGenerationLocation(IDGenerationLocation.CLIENT), JVM, NATIVE);
}
@Override
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/offline/AllTestsDBMysqlOffline.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/offline/AllTestsDBMysqlOffline.java
index 412b3ebdac..6ce753d4db 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/offline/AllTestsDBMysqlOffline.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/offline/AllTestsDBMysqlOffline.java
@@ -45,9 +45,7 @@ public class AllTestsDBMysqlOffline extends DBConfigs
@Override
protected void initConfigSuites(TestSuite parent)
{
- // addScenario(parent, new MysqlOfflineConfig(false, false, IDGenerationLocation.STORE), JVM, NATIVE);
- addScenario(parent, new MysqlOfflineConfig(false, false, IDGenerationLocation.CLIENT), JVM, NATIVE);
- // addScenario(parent, new MysqlOfflineConfig(true, false, IDGenerationLocation.STORE), JVM, NATIVE);
+ addScenario(parent, new MysqlOfflineConfig().idGenerationLocation(IDGenerationLocation.CLIENT), JVM, NATIVE);
}
@Override
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/offline/Bugzilla_351078_DB_Test.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/offline/Bugzilla_351078_DB_Test.java
index 4c6a683bfc..d57961c360 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/offline/Bugzilla_351078_DB_Test.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/offline/Bugzilla_351078_DB_Test.java
@@ -38,7 +38,7 @@ public class Bugzilla_351078_DB_Test extends Bugzilla_351078_Test
// XXX use capabilities?!
DBOfflineConfig config = (DBOfflineConfig)getRepositoryConfig();
- if (config.isWithRanges())
+ if (config.withRanges())
{
byte[] masterTable = readTable(master);
byte[] cloneTable = readTable(getRepository());
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/offline/DBOfflineConfig.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/offline/DBOfflineConfig.java
index 0fe2b3d1d1..0826f2d9f8 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/offline/DBOfflineConfig.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/offline/DBOfflineConfig.java
@@ -39,23 +39,63 @@ public abstract class DBOfflineConfig extends OfflineConfig
private boolean copyOnBranch;
- public DBOfflineConfig(String name, boolean withRanges, boolean copyOnBranch, IDGenerationLocation idGenerationLocation)
+ public DBOfflineConfig(String name)
{
- super(name, idGenerationLocation);
- this.withRanges = withRanges;
- this.copyOnBranch = copyOnBranch;
+ super(name);
+ }
+
+ @Override
+ public DBOfflineConfig supportingAudits(boolean supportingAudits)
+ {
+ return (DBOfflineConfig)super.supportingAudits(supportingAudits);
+ }
+
+ @Override
+ public DBOfflineConfig supportingBranches(boolean supportingBranches)
+ {
+ return (DBOfflineConfig)super.supportingBranches(supportingBranches);
+ }
+
+ @Override
+ public DBOfflineConfig supportingChunks(boolean supportingChunks)
+ {
+ return (DBOfflineConfig)super.supportingChunks(supportingChunks);
+ }
+
+ @Override
+ public DBOfflineConfig supportingExtRefs(boolean supportingExtRefs)
+ {
+ return (DBOfflineConfig)super.supportingExtRefs(supportingExtRefs);
+ }
+
+ @Override
+ public DBOfflineConfig idGenerationLocation(IDGenerationLocation idGenerationLocation)
+ {
+ return (DBOfflineConfig)super.idGenerationLocation(idGenerationLocation);
}
- public boolean isWithRanges()
+ public boolean withRanges()
{
return withRanges;
}
- public boolean isCopyOnBranch()
+ public DBOfflineConfig withRanges(boolean withRanges)
+ {
+ this.withRanges = withRanges;
+ return this;
+ }
+
+ public boolean copyOnBranch()
{
return copyOnBranch;
}
+ public DBOfflineConfig copyOnBranch(boolean copyOnBranch)
+ {
+ this.copyOnBranch = copyOnBranch;
+ return this;
+ }
+
@Override
protected String getStoreName()
{
@@ -67,12 +107,12 @@ public abstract class DBOfflineConfig extends OfflineConfig
{
super.initCapabilities(capabilities);
- if (isWithRanges())
+ if (withRanges())
{
capabilities.add(DBConfig.CAPABILITY_RANGES);
}
- if (isCopyOnBranch())
+ if (copyOnBranch())
{
capabilities.add(DBConfig.CAPABILITY_COPY_ON_BRANCH);
}
@@ -108,7 +148,7 @@ public abstract class DBOfflineConfig extends OfflineConfig
protected IMappingStrategy createMappingStrategy()
{
- return CDODBUtil.createHorizontalMappingStrategy(isSupportingAudits(), isSupportingBranches(), withRanges);
+ return CDODBUtil.createHorizontalMappingStrategy(supportingAudits(), supportingBranches(), withRanges);
}
@Override
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/offline/H2OfflineConfig.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/offline/H2OfflineConfig.java
index 46eb0d8e4d..691fa03326 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/offline/H2OfflineConfig.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/offline/H2OfflineConfig.java
@@ -10,7 +10,6 @@
*/
package org.eclipse.emf.cdo.tests.db.offline;
-import org.eclipse.emf.cdo.common.CDOCommonRepository.IDGenerationLocation;
import org.eclipse.emf.cdo.tests.db.H2Config;
import org.eclipse.net4j.db.DBUtil;
@@ -40,9 +39,9 @@ public class H2OfflineConfig extends DBOfflineConfig
private static JdbcDataSource defaultDataSource;
- public H2OfflineConfig(boolean withRanges, boolean copyOnBranch, IDGenerationLocation idGenerationLocation)
+ public H2OfflineConfig()
{
- super("H2Offline", withRanges, copyOnBranch, idGenerationLocation);
+ super("H2Offline");
}
@Override
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/offline/MysqlOfflineConfig.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/offline/MysqlOfflineConfig.java
index 5e51e19245..93449fdb94 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/offline/MysqlOfflineConfig.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/offline/MysqlOfflineConfig.java
@@ -10,7 +10,6 @@
*/
package org.eclipse.emf.cdo.tests.db.offline;
-import org.eclipse.emf.cdo.common.CDOCommonRepository.IDGenerationLocation;
import org.eclipse.emf.cdo.tests.db.MysqlConfig;
import org.eclipse.net4j.db.DBUtil;
@@ -51,9 +50,9 @@ public class MysqlOfflineConfig extends DBOfflineConfig
private transient List<String> databases = new ArrayList<String>();
- public MysqlOfflineConfig(boolean withRanges, boolean copyOnBranch, IDGenerationLocation idGenerationLocation)
+ public MysqlOfflineConfig()
{
- super("MySqlOffline", withRanges, copyOnBranch, idGenerationLocation);
+ super("MySqlOffline");
}
@Override
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/performance/AllPerformanceTestsH2NonAudit.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/performance/AllPerformanceTestsH2NonAudit.java
index 24335f3645..3bb4dddd3c 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/performance/AllPerformanceTestsH2NonAudit.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/performance/AllPerformanceTestsH2NonAudit.java
@@ -10,7 +10,6 @@
*/
package org.eclipse.emf.cdo.tests.db.performance;
-import org.eclipse.emf.cdo.common.CDOCommonRepository.IDGenerationLocation;
import org.eclipse.emf.cdo.tests.db.H2Config;
import org.eclipse.emf.cdo.tests.performance.AllPerformanceTests;
@@ -30,6 +29,6 @@ public class AllPerformanceTestsH2NonAudit extends AllPerformanceTests
@Override
protected void initConfigSuites(TestSuite parent)
{
- addScenario(parent, new H2Config(false, false, false, false, false, IDGenerationLocation.STORE), JVM, NATIVE);
+ addScenario(parent, new H2Config(), JVM, NATIVE);
}
}
diff --git a/plugins/org.eclipse.emf.cdo.tests.db4o/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.tests.db4o/META-INF/MANIFEST.MF
index cc0d9d342a..e7f9a8b3a0 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db4o/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.tests.db4o/META-INF/MANIFEST.MF
@@ -2,12 +2,12 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.emf.cdo.tests.db4o
-Bundle-Version: 4.0.500.qualifier
+Bundle-Version: 4.0.600.qualifier
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Require-Bundle: org.eclipse.emf.cdo.tests;bundle-version="[4.0.0,5.0.0)",
org.eclipse.emf.cdo.server.db4o;bundle-version="[4.0.0,5.0.0)"
Bundle-Vendor: %providerName
-Export-Package: org.eclipse.emf.cdo.tests.db4o;version="4.0.500";x-internal:=true
+Export-Package: org.eclipse.emf.cdo.tests.db4o;version="4.0.600";x-internal:=true
Bundle-Localization: plugin
Import-Package: com.db4o;version="[7.4.0,9.0.0)",
com.db4o.ext;version="[7.4.0,9.0.0)"
diff --git a/plugins/org.eclipse.emf.cdo.tests.db4o/src/org/eclipse/emf/cdo/tests/db4o/DB4OConfig.java b/plugins/org.eclipse.emf.cdo.tests.db4o/src/org/eclipse/emf/cdo/tests/db4o/DB4OConfig.java
index f871ea0973..1d4cc31a77 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db4o/src/org/eclipse/emf/cdo/tests/db4o/DB4OConfig.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db4o/src/org/eclipse/emf/cdo/tests/db4o/DB4OConfig.java
@@ -10,7 +10,6 @@
*/
package org.eclipse.emf.cdo.tests.db4o;
-import org.eclipse.emf.cdo.common.CDOCommonRepository.IDGenerationLocation;
import org.eclipse.emf.cdo.server.IStore;
import org.eclipse.emf.cdo.server.internal.db4o.DB4OStore;
import org.eclipse.emf.cdo.tests.config.impl.RepositoryConfig;
@@ -42,7 +41,7 @@ public class DB4OConfig extends RepositoryConfig
public DB4OConfig(boolean mem)
{
- super("DB4O-" + (mem ? "mem" : "net"), false, false, IDGenerationLocation.STORE);
+ super("DB4O-" + (mem ? "mem" : "net"));
this.mem = mem;
}
diff --git a/plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/AllTestsHibernate.java b/plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/AllTestsHibernate.java
index 12f74d9789..5356f48d77 100644
--- a/plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/AllTestsHibernate.java
+++ b/plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/AllTestsHibernate.java
@@ -94,7 +94,7 @@ public class AllTestsHibernate extends AllConfigs
super.initTestClasses(testClasses, scenario);
// TODO: find out why this does not work for non-auditing
- if (scenario.getRepositoryConfig().isSupportingAudits())
+ if (scenario.getRepositoryConfig().supportingAudits())
{
testClasses.add(HibernateBugzilla_380987_Test.class);
}
@@ -160,7 +160,7 @@ public class AllTestsHibernate extends AllConfigs
// TODO: research this
testClasses.remove(Bugzilla_416474_Test.class);
- if (scenario.getRepositoryConfig().isSupportingAudits())
+ if (scenario.getRepositoryConfig().supportingAudits())
{
// need to add additional auditing annotations
testClasses.remove(HibernateBugzilla_405191_Test.class);
diff --git a/plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/HibernateConfig.java b/plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/HibernateConfig.java
index dd665cbb49..3c9fa8fa1e 100644
--- a/plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/HibernateConfig.java
+++ b/plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/HibernateConfig.java
@@ -10,7 +10,6 @@
*/
package org.eclipse.emf.cdo.tests.hibernate;
-import org.eclipse.emf.cdo.common.CDOCommonRepository.IDGenerationLocation;
import org.eclipse.emf.cdo.server.IStore;
import org.eclipse.emf.cdo.server.hibernate.CDOHibernateUtil;
import org.eclipse.emf.cdo.server.hibernate.IHibernateMappingProvider;
@@ -30,9 +29,9 @@ public class HibernateConfig extends RepositoryConfig
{
public static final String STORE_NAME = "Hibernate";
- public static final HibernateConfig INSTANCE = new HibernateConfig(false);
+ public static final HibernateConfig INSTANCE = new HibernateConfig();
- public static final HibernateConfig AUDIT_INSTANCE = new HibernateConfig(true);
+ public static final HibernateConfig AUDIT_INSTANCE = (HibernateConfig)new HibernateConfig().supportingAudits(true);
public static final String MAPPING_FILE = "mappingfile";
@@ -40,9 +39,9 @@ public class HibernateConfig extends RepositoryConfig
private Map<String, String> additionalProperties = new HashMap<String, String>();
- public HibernateConfig(boolean supportAuditing)
+ public HibernateConfig()
{
- super(STORE_NAME, supportAuditing, false, IDGenerationLocation.STORE);
+ super(STORE_NAME);
}
@Override
diff --git a/plugins/org.eclipse.emf.cdo.tests.lissome/src/org/eclipse/emf/cdo/tests/lissome/LissomeConfig.java b/plugins/org.eclipse.emf.cdo.tests.lissome/src/org/eclipse/emf/cdo/tests/lissome/LissomeConfig.java
index 8678857c2a..0d424d30ec 100644
--- a/plugins/org.eclipse.emf.cdo.tests.lissome/src/org/eclipse/emf/cdo/tests/lissome/LissomeConfig.java
+++ b/plugins/org.eclipse.emf.cdo.tests.lissome/src/org/eclipse/emf/cdo/tests/lissome/LissomeConfig.java
@@ -10,7 +10,6 @@
*/
package org.eclipse.emf.cdo.tests.lissome;
-import org.eclipse.emf.cdo.common.CDOCommonRepository.IDGenerationLocation;
import org.eclipse.emf.cdo.server.IStore;
import org.eclipse.emf.cdo.server.internal.lissome.LissomeBrowserPage;
import org.eclipse.emf.cdo.server.internal.lissome.LissomeStore;
@@ -32,7 +31,7 @@ import java.io.File;
*/
public class LissomeConfig extends RepositoryConfig
{
- public static final RepositoryConfig INSTANCE = new LissomeConfig(IDGenerationLocation.STORE);
+ public static final RepositoryConfig INSTANCE = new LissomeConfig();
public static final String STORE_NAME = "Lissome";
@@ -40,9 +39,11 @@ public class LissomeConfig extends RepositoryConfig
private static File reusableFolder;
- public LissomeConfig(IDGenerationLocation idGenerationLocation)
+ public LissomeConfig()
{
- super(STORE_NAME, true, true, idGenerationLocation);
+ super(STORE_NAME);
+ supportingAudits(true);
+ supportingBranches(true);
}
@Override
@@ -64,7 +65,7 @@ public class LissomeConfig extends RepositoryConfig
}
@Override
- public boolean isSupportingExtRefs()
+ public boolean supportingExtRefs()
{
return false;
}
diff --git a/plugins/org.eclipse.emf.cdo.tests.mongodb/src/org/eclipse/emf/cdo/tests/mongodb/AllTestsMongoDB.java b/plugins/org.eclipse.emf.cdo.tests.mongodb/src/org/eclipse/emf/cdo/tests/mongodb/AllTestsMongoDB.java
index 3983e0b68a..188400db90 100644
--- a/plugins/org.eclipse.emf.cdo.tests.mongodb/src/org/eclipse/emf/cdo/tests/mongodb/AllTestsMongoDB.java
+++ b/plugins/org.eclipse.emf.cdo.tests.mongodb/src/org/eclipse/emf/cdo/tests/mongodb/AllTestsMongoDB.java
@@ -11,7 +11,6 @@
*/
package org.eclipse.emf.cdo.tests.mongodb;
-import org.eclipse.emf.cdo.common.CDOCommonRepository.IDGenerationLocation;
import org.eclipse.emf.cdo.tests.AllConfigs;
import org.eclipse.emf.cdo.tests.MEMStoreQueryTest;
import org.eclipse.emf.cdo.tests.config.IScenario;
@@ -35,9 +34,8 @@ public class AllTestsMongoDB extends AllConfigs
@Override
protected void initConfigSuites(TestSuite parent)
{
- addScenario(parent, new MongoDBConfig(false, false, IDGenerationLocation.STORE), JVM, NATIVE);
- addScenario(parent, new MongoDBConfig(true, false, IDGenerationLocation.STORE), JVM, NATIVE);
- // addScenario(parent, MongoDBStoreRepositoryConfig.BRANCHING, JVM, NATIVE);
+ addScenario(parent, new MongoDBConfig(), JVM, NATIVE);
+ addScenario(parent, new MongoDBConfig().supportingAudits(true), JVM, NATIVE);
}
@Override
diff --git a/plugins/org.eclipse.emf.cdo.tests.mongodb/src/org/eclipse/emf/cdo/tests/mongodb/MongoDBConfig.java b/plugins/org.eclipse.emf.cdo.tests.mongodb/src/org/eclipse/emf/cdo/tests/mongodb/MongoDBConfig.java
index 932cfc0033..a493277054 100644
--- a/plugins/org.eclipse.emf.cdo.tests.mongodb/src/org/eclipse/emf/cdo/tests/mongodb/MongoDBConfig.java
+++ b/plugins/org.eclipse.emf.cdo.tests.mongodb/src/org/eclipse/emf/cdo/tests/mongodb/MongoDBConfig.java
@@ -10,7 +10,6 @@
*/
package org.eclipse.emf.cdo.tests.mongodb;
-import org.eclipse.emf.cdo.common.CDOCommonRepository.IDGenerationLocation;
import org.eclipse.emf.cdo.server.IStore;
import org.eclipse.emf.cdo.server.mongodb.CDOMongoDBUtil;
import org.eclipse.emf.cdo.tests.config.impl.RepositoryConfig;
@@ -31,9 +30,9 @@ public class MongoDBConfig extends RepositoryConfig
private static final long serialVersionUID = 1L;
- public MongoDBConfig(boolean supportingAudits, boolean supportingBranches, IDGenerationLocation idGenerationLocation)
+ public MongoDBConfig()
{
- super(STORE_NAME, supportingAudits, supportingBranches, idGenerationLocation);
+ super(STORE_NAME);
}
@Override
@@ -87,7 +86,7 @@ public class MongoDBConfig extends RepositoryConfig
}
@Override
- public boolean isSupportingExtRefs()
+ public boolean supportingExtRefs()
{
return false;
}
diff --git a/plugins/org.eclipse.emf.cdo.tests.objectivity/src/org/eclipse/emf/cdo/tests/objectivity/AllTestsObjyAudit.java b/plugins/org.eclipse.emf.cdo.tests.objectivity/src/org/eclipse/emf/cdo/tests/objectivity/AllTestsObjyAudit.java
index 61e5be9dfc..bda75d0579 100644
--- a/plugins/org.eclipse.emf.cdo.tests.objectivity/src/org/eclipse/emf/cdo/tests/objectivity/AllTestsObjyAudit.java
+++ b/plugins/org.eclipse.emf.cdo.tests.objectivity/src/org/eclipse/emf/cdo/tests/objectivity/AllTestsObjyAudit.java
@@ -27,6 +27,6 @@ public class AllTestsObjyAudit extends ObjyDBConfigs
@Override
protected void initConfigSuites(TestSuite parent)
{
- addScenario(parent, new ObjyConfig(true, false), JVM, NATIVE);
+ addScenario(parent, new ObjyConfig().supportingAudits(true), JVM, NATIVE);
}
}
diff --git a/plugins/org.eclipse.emf.cdo.tests.objectivity/src/org/eclipse/emf/cdo/tests/objectivity/AllTestsObjyBranching.java b/plugins/org.eclipse.emf.cdo.tests.objectivity/src/org/eclipse/emf/cdo/tests/objectivity/AllTestsObjyBranching.java
index 6439067302..2c20de5dde 100644
--- a/plugins/org.eclipse.emf.cdo.tests.objectivity/src/org/eclipse/emf/cdo/tests/objectivity/AllTestsObjyBranching.java
+++ b/plugins/org.eclipse.emf.cdo.tests.objectivity/src/org/eclipse/emf/cdo/tests/objectivity/AllTestsObjyBranching.java
@@ -27,6 +27,6 @@ public class AllTestsObjyBranching extends ObjyDBConfigs
@Override
protected void initConfigSuites(TestSuite parent)
{
- addScenario(parent, new ObjyConfig(true, true), JVM, NATIVE);
+ addScenario(parent, new ObjyConfig().supportingBranches(true), JVM, NATIVE);
}
}
diff --git a/plugins/org.eclipse.emf.cdo.tests.objectivity/src/org/eclipse/emf/cdo/tests/objectivity/AllTestsObjyNonAudit.java b/plugins/org.eclipse.emf.cdo.tests.objectivity/src/org/eclipse/emf/cdo/tests/objectivity/AllTestsObjyNonAudit.java
index 314049a47f..c8fd22623f 100644
--- a/plugins/org.eclipse.emf.cdo.tests.objectivity/src/org/eclipse/emf/cdo/tests/objectivity/AllTestsObjyNonAudit.java
+++ b/plugins/org.eclipse.emf.cdo.tests.objectivity/src/org/eclipse/emf/cdo/tests/objectivity/AllTestsObjyNonAudit.java
@@ -33,7 +33,7 @@ public class AllTestsObjyNonAudit extends ObjyDBConfigs
@Override
protected void initConfigSuites(TestSuite parent)
{
- addScenario(parent, new ObjyConfig(false, false), JVM, NATIVE);
+ addScenario(parent, new ObjyConfig(), JVM, NATIVE);
}
@Override
diff --git a/plugins/org.eclipse.emf.cdo.tests.objectivity/src/org/eclipse/emf/cdo/tests/objectivity/ObjyConfig.java b/plugins/org.eclipse.emf.cdo.tests.objectivity/src/org/eclipse/emf/cdo/tests/objectivity/ObjyConfig.java
index 21fa12f3e3..707885cfde 100644
--- a/plugins/org.eclipse.emf.cdo.tests.objectivity/src/org/eclipse/emf/cdo/tests/objectivity/ObjyConfig.java
+++ b/plugins/org.eclipse.emf.cdo.tests.objectivity/src/org/eclipse/emf/cdo/tests/objectivity/ObjyConfig.java
@@ -10,7 +10,6 @@
*/
package org.eclipse.emf.cdo.tests.objectivity;
-import org.eclipse.emf.cdo.common.CDOCommonRepository.IDGenerationLocation;
import org.eclipse.emf.cdo.server.IStore;
import org.eclipse.emf.cdo.server.internal.objectivity.ObjectivityStoreConfig;
import org.eclipse.emf.cdo.server.objectivity.ObjyStoreUtil;
@@ -27,9 +26,9 @@ public class ObjyConfig extends RepositoryConfig
private static ObjectivityStoreConfig storeConfig = new ObjectivityStoreConfig();
- public ObjyConfig(boolean supportingAudits, boolean supportingBranches)
+ public ObjyConfig()
{
- super(STORE_NAME, supportingAudits, supportingBranches, IDGenerationLocation.STORE);
+ super(STORE_NAME);
org.eclipse.emf.cdo.server.internal.objectivity.bundle.OM.DEBUG.setEnabled(true);
org.eclipse.emf.cdo.server.internal.objectivity.bundle.OM.INFO.setEnabled(true);
diff --git a/plugins/org.eclipse.emf.cdo.tests.objectivity/src/org/eclipse/emf/cdo/tests/objectivity/ObjyDBConfigs.java b/plugins/org.eclipse.emf.cdo.tests.objectivity/src/org/eclipse/emf/cdo/tests/objectivity/ObjyDBConfigs.java
index bcce5fb794..8daf1096e6 100644
--- a/plugins/org.eclipse.emf.cdo.tests.objectivity/src/org/eclipse/emf/cdo/tests/objectivity/ObjyDBConfigs.java
+++ b/plugins/org.eclipse.emf.cdo.tests.objectivity/src/org/eclipse/emf/cdo/tests/objectivity/ObjyDBConfigs.java
@@ -36,7 +36,7 @@ public abstract class ObjyDBConfigs extends AllConfigs
// remove BranchingTests because most mappings do not support it
// Subclasses should add Banching tests if supported
- if (!scenario.getRepositoryConfig().isSupportingBranches())
+ if (!scenario.getRepositoryConfig().supportingBranches())
{
testClasses.remove(BranchingTest.class);
testClasses.remove(BranchingSameSessionTest.class);
@@ -44,7 +44,7 @@ public abstract class ObjyDBConfigs extends AllConfigs
testClasses.remove(Bugzilla_303807_Test.class);
}
- if (!scenario.getRepositoryConfig().isSupportingAudits())
+ if (!scenario.getRepositoryConfig().supportingAudits())
{
// non-audit mode - remove audit tests
testClasses.remove(AuditTest.class);
diff --git a/plugins/org.eclipse.emf.cdo.tests.objectivity/src/org/eclipse/emf/cdo/tests/objectivity/SampleTestsObjy.java b/plugins/org.eclipse.emf.cdo.tests.objectivity/src/org/eclipse/emf/cdo/tests/objectivity/SampleTestsObjy.java
index 98df84415f..3d30c58115 100644
--- a/plugins/org.eclipse.emf.cdo.tests.objectivity/src/org/eclipse/emf/cdo/tests/objectivity/SampleTestsObjy.java
+++ b/plugins/org.eclipse.emf.cdo.tests.objectivity/src/org/eclipse/emf/cdo/tests/objectivity/SampleTestsObjy.java
@@ -39,7 +39,7 @@ public class SampleTestsObjy extends ObjyDBConfigs
@Override
protected void initConfigSuites(TestSuite parent)
{
- addScenario(parent, new ObjyConfig(false, false), JVM, NATIVE);
+ addScenario(parent, new ObjyConfig(), JVM, NATIVE);
}
@Override
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());
}
diff --git a/plugins/org.eclipse.emf.cdo/.settings/.api_filters b/plugins/org.eclipse.emf.cdo/.settings/.api_filters
index c8dc2f5a49..93ddddd80b 100644
--- a/plugins/org.eclipse.emf.cdo/.settings/.api_filters
+++ b/plugins/org.eclipse.emf.cdo/.settings/.api_filters
@@ -1,5 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<component id="org.eclipse.emf.cdo" version="2">
+ <resource path="META-INF/MANIFEST.MF">
+ <filter id="923795461">
+ <message_arguments>
+ <message_argument value="4.6.0"/>
+ <message_argument value="4.5.0"/>
+ </message_arguments>
+ </filter>
+ </resource>
<resource path="META-INF/MANIFEST.MF" type="org.eclipse.emf.cdo.spi.common.id.AbstractCDOIDByteArray">
<filter id="305422471">
<message_arguments>
@@ -721,6 +729,80 @@
</message_arguments>
</filter>
</resource>
+ <resource path="src/org/eclipse/emf/spi/cdo/DefaultCDOMerger.java" type="org.eclipse.emf.spi.cdo.DefaultCDOMerger$PerFeature$ManyValued">
+ <filter id="338792546">
+ <message_arguments>
+ <message_argument value="org.eclipse.emf.spi.cdo.DefaultCDOMerger.PerFeature.ManyValued"/>
+ <message_argument value="adjustAfterAddition(List&lt;CDOFeatureDelta&gt;, int)"/>
+ </message_arguments>
+ </filter>
+ <filter id="338792546">
+ <message_arguments>
+ <message_argument value="org.eclipse.emf.spi.cdo.DefaultCDOMerger.PerFeature.ManyValued"/>
+ <message_argument value="adjustAfterMove(List&lt;CDOFeatureDelta&gt;, int, int)"/>
+ </message_arguments>
+ </filter>
+ <filter id="338792546">
+ <message_arguments>
+ <message_argument value="org.eclipse.emf.spi.cdo.DefaultCDOMerger.PerFeature.ManyValued"/>
+ <message_argument value="adjustAfterRemoval(List&lt;CDOFeatureDelta&gt;, int)"/>
+ </message_arguments>
+ </filter>
+ <filter id="338792546">
+ <message_arguments>
+ <message_argument value="org.eclipse.emf.spi.cdo.DefaultCDOMerger.PerFeature.ManyValued"/>
+ <message_argument value="createResult(EStructuralFeature)"/>
+ </message_arguments>
+ </filter>
+ <filter id="338792546">
+ <message_arguments>
+ <message_argument value="org.eclipse.emf.spi.cdo.DefaultCDOMerger.PerFeature.ManyValued"/>
+ <message_argument value="handleListDelta(List&lt;CDOFeatureDelta&gt;, List&lt;CDOFeatureDelta&gt;, List&lt;CDOFeatureDelta&gt;)"/>
+ </message_arguments>
+ </filter>
+ <filter id="338792546">
+ <message_arguments>
+ <message_argument value="org.eclipse.emf.spi.cdo.DefaultCDOMerger.PerFeature.ManyValued"/>
+ <message_argument value="handleListDeltaAdd(List&lt;CDOFeatureDelta&gt;, CDOAddFeatureDelta, List&lt;CDOFeatureDelta&gt;)"/>
+ </message_arguments>
+ </filter>
+ <filter id="338792546">
+ <message_arguments>
+ <message_argument value="org.eclipse.emf.spi.cdo.DefaultCDOMerger.PerFeature.ManyValued"/>
+ <message_argument value="handleListDeltaMove(List&lt;CDOFeatureDelta&gt;, CDOMoveFeatureDelta, List&lt;CDOFeatureDelta&gt;)"/>
+ </message_arguments>
+ </filter>
+ <filter id="338792546">
+ <message_arguments>
+ <message_argument value="org.eclipse.emf.spi.cdo.DefaultCDOMerger.PerFeature.ManyValued"/>
+ <message_argument value="handleListDeltaRemove(List&lt;CDOFeatureDelta&gt;, CDORemoveFeatureDelta, List&lt;CDOFeatureDelta&gt;)"/>
+ </message_arguments>
+ </filter>
+ <filter id="338792546">
+ <message_arguments>
+ <message_argument value="org.eclipse.emf.spi.cdo.DefaultCDOMerger.PerFeature.ManyValued"/>
+ <message_argument value="other(DefaultCDOMerger.PerFeature.ManyValued.Side)"/>
+ </message_arguments>
+ </filter>
+ <filter id="338886760">
+ <message_arguments>
+ <message_argument value="org.eclipse.emf.spi.cdo.DefaultCDOMerger.PerFeature.ManyValued.Element"/>
+ <message_argument value="org.eclipse.emf.cdo_4.6.0"/>
+ </message_arguments>
+ </filter>
+ <filter id="338886760">
+ <message_arguments>
+ <message_argument value="org.eclipse.emf.spi.cdo.DefaultCDOMerger.PerFeature.ManyValued.PerSide"/>
+ <message_argument value="org.eclipse.emf.cdo_4.6.0"/>
+ </message_arguments>
+ </filter>
+ <filter id="338886760">
+ <message_arguments>
+ <message_argument value="org.eclipse.emf.spi.cdo.DefaultCDOMerger.PerFeature.ManyValued.Side"/>
+ <message_argument value="org.eclipse.emf.cdo_4.6.0"/>
+ </message_arguments>
+ </filter>
+ </resource>
<resource path="src/org/eclipse/emf/spi/cdo/InternalCDOObject.java" type="org.eclipse.emf.spi.cdo.InternalCDOObject">
<filter id="571473929">
<message_arguments>
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/DefaultCDOMerger.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/DefaultCDOMerger.java
index ea2a5e1121..5d37c75c30 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/DefaultCDOMerger.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/DefaultCDOMerger.java
@@ -10,6 +10,7 @@
*/
package org.eclipse.emf.spi.cdo;
+import org.eclipse.emf.cdo.common.CDOCommonRepository.ListOrdering;
import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
import org.eclipse.emf.cdo.common.commit.CDOChangeSet;
import org.eclipse.emf.cdo.common.commit.CDOChangeSetData;
@@ -32,7 +33,10 @@ import org.eclipse.emf.cdo.internal.common.revision.delta.CDOListFeatureDeltaImp
import org.eclipse.emf.cdo.internal.common.revision.delta.CDOMoveFeatureDeltaImpl;
import org.eclipse.emf.cdo.internal.common.revision.delta.CDORemoveFeatureDeltaImpl;
import org.eclipse.emf.cdo.internal.common.revision.delta.CDORevisionDeltaImpl;
+import org.eclipse.emf.cdo.internal.common.revision.delta.CDOSingleValueFeatureDeltaImpl;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDOFeatureDelta;
+import org.eclipse.emf.cdo.spi.common.revision.InternalCDOFeatureDelta.ListIndexAffecting;
+import org.eclipse.emf.cdo.spi.common.revision.InternalCDOFeatureDelta.WithIndex;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionDelta;
import org.eclipse.emf.cdo.transaction.CDOMerger;
@@ -62,6 +66,8 @@ public class DefaultCDOMerger implements CDOMerger
{
private final ResolutionPreference resolutionPreference;
+ private final ListOrdering listOrdering;
+
private CDOChangeSetData result;
private Map<CDOID, Conflict> conflicts;
@@ -76,12 +82,31 @@ public class DefaultCDOMerger implements CDOMerger
}
/**
+ * @since 4.6
+ */
+ public DefaultCDOMerger(ListOrdering listOrdering)
+ {
+ this(ResolutionPreference.NONE, listOrdering);
+ }
+
+ /**
* @since 4.2
*/
public DefaultCDOMerger(ResolutionPreference resolutionPreference)
{
+ this(resolutionPreference, ListOrdering.ORDERED);
+ }
+
+ /**
+ * @since 4.6
+ */
+ public DefaultCDOMerger(ResolutionPreference resolutionPreference, ListOrdering listOrdering)
+ {
CheckUtil.checkArg(resolutionPreference, "resolutionPreference");
this.resolutionPreference = resolutionPreference;
+
+ CheckUtil.checkArg(listOrdering, "listOrdering");
+ this.listOrdering = listOrdering;
}
/**
@@ -92,6 +117,14 @@ public class DefaultCDOMerger implements CDOMerger
return resolutionPreference;
}
+ /**
+ * @since 4.6
+ */
+ public ListOrdering getListOrdering()
+ {
+ return listOrdering;
+ }
+
public CDOChangeSetData getResult()
{
return result;
@@ -701,6 +734,424 @@ public class DefaultCDOMerger implements CDOMerger
{
if (targetFeatureDelta instanceof CDOListFeatureDelta && sourceFeatureDelta instanceof CDOListFeatureDelta)
{
+ List<CDOFeatureDelta> originalSourceDeltas = ((CDOListFeatureDelta)sourceFeatureDelta).getListChanges();
+ List<CDOFeatureDelta> originalTargetDeltas = ((CDOListFeatureDelta)targetFeatureDelta).getListChanges();
+ int originSize = ((CDOListFeatureDelta)targetFeatureDelta).getOriginSize();
+ boolean treatAsUnique = treatAsUnique(feature);
+
+ // Copy the target deltas and build a map from original indices to the relevant target deltas.
+ List<CDOFeatureDelta> targetDeltas = new ArrayList<CDOFeatureDelta>();
+ TargetCopyProcessor targetProcessor = new TargetCopyProcessor(treatAsUnique);
+ copy(originalTargetDeltas, originSize, targetDeltas, targetProcessor);
+
+ // Copy the source deltas and eliminate/convert the corresponding target deltas.
+ CDOListFeatureDelta result = new CDOListFeatureDeltaImpl(feature, originSize);
+ List<CDOFeatureDelta> sourceDeltas = result.getListChanges();
+ Map<Object, Object> targetMap = targetProcessor.getTargetMap();
+ SourceCopyProcessor sourceProcessor = new SourceCopyProcessor(targetDeltas, targetMap, targetProcessor.getTargetAdditions());
+ copy(originalSourceDeltas, originSize, sourceDeltas, sourceProcessor);
+
+ // Move the remaining target deltas to the end of the source delta list and adjust their indices accordingly.
+ for (CDOFeatureDelta targetDelta : targetDeltas)
+ {
+ if (targetDelta != null)
+ {
+ int projectedIndex = (Integer)targetMap.get(targetDelta);
+
+ if (targetDelta instanceof CDOSingleValueFeatureDeltaImpl)
+ {
+ CDOSingleValueFeatureDeltaImpl impl = (CDOSingleValueFeatureDeltaImpl)targetDelta;
+ impl.setIndex(projectedIndex);
+ }
+ else
+ {
+ CDOMoveFeatureDeltaImpl impl = (CDOMoveFeatureDeltaImpl)targetDelta;
+ int moveOffset = impl.getNewPosition() - impl.getOldPosition();
+ impl.setNewPosition(projectedIndex + moveOffset);
+ impl.setOldPosition(projectedIndex);
+ }
+
+ WithIndex targetDeltaWithIndex = (WithIndex)targetDelta;
+ int sourceCount = sourceDeltas.size();
+
+ for (int sourcePosition = 0; sourcePosition < sourceCount; sourcePosition++)
+ {
+ CDOFeatureDelta sourceDelta = sourceDeltas.get(sourcePosition);
+ int sourceIndex = ((WithIndex)sourceDelta).getIndex();
+ Type sourceType = sourceDelta.getType();
+
+ switch (sourceType)
+ {
+ case ADD:
+ targetDeltaWithIndex.adjustAfterAddition(sourceIndex);
+ break;
+
+ case REMOVE:
+ targetDeltaWithIndex.adjustAfterRemoval(sourceIndex);
+ break;
+
+ case SET:
+ // Neutral; do nothing.
+ break;
+
+ case MOVE:
+ targetDeltaWithIndex.adjustAfterMove(sourceIndex, ((CDOMoveFeatureDelta)sourceDelta).getNewPosition());
+ break;
+
+ default:
+ throw new IllegalStateException("Illegal source type: " + sourceType);
+ }
+ }
+
+ sourceDeltas.add(targetDelta);
+ }
+ }
+
+ return result;
+ }
+
+ return super.changedInSourceAndTargetManyValued(feature, targetFeatureDelta, sourceFeatureDelta);
+ }
+
+ private static int projectIndex(List<CDOFeatureDelta> changes, int count, int index)
+ {
+ for (int i = count - 1; i >= 0; --i)
+ {
+ CDOFeatureDelta projectingDelta = changes.get(i);
+ if (projectingDelta instanceof ListIndexAffecting)
+ {
+ index = ((ListIndexAffecting)projectingDelta).projectIndex(index);
+ }
+ }
+
+ return index;
+ }
+
+ private static void copy(List<CDOFeatureDelta> featureDeltas, int originSize, List<CDOFeatureDelta> copyDeltas, CopyProcessor processor)
+ {
+ boolean first = true;
+
+ for (CDOFeatureDelta featureDelta : featureDeltas)
+ {
+ if (first)
+ {
+ first = false;
+
+ Type type = featureDelta.getType();
+ if (type == Type.CLEAR || type == Type.UNSET)
+ {
+ EStructuralFeature feature = featureDelta.getFeature();
+ for (int deltaPosition = 0; deltaPosition < originSize; deltaPosition++)
+ {
+ CDORemoveFeatureDelta copyDelta = new CDORemoveFeatureDeltaImpl(feature, 0);
+ copyDeltas.add(copyDelta);
+
+ processor.processRemoveExpansion(copyDeltas, copyDelta, deltaPosition);
+ }
+
+ continue;
+ }
+ }
+
+ CDOFeatureDelta copyDelta = featureDelta.copy();
+ copyDeltas.add(copyDelta);
+
+ int deltaPosition = copyDeltas.size() - 1;
+ processor.processDeltaCopy(copyDeltas, copyDelta, deltaPosition);
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ private interface CopyProcessor
+ {
+ public void processRemoveExpansion(List<CDOFeatureDelta> deltas, CDORemoveFeatureDelta delta, int deltaPosition);
+
+ public void processDeltaCopy(List<CDOFeatureDelta> deltas, CDOFeatureDelta delta, int deltaPosition);
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ private static final class TargetCopyProcessor implements CopyProcessor
+ {
+ private final Map<Object, Object> targetMap = new HashMap<Object, Object>();
+
+ private final Map<Object, Integer> targetAdditions;
+
+ public TargetCopyProcessor(boolean treatAsUnique)
+ {
+ targetAdditions = treatAsUnique ? new HashMap<Object, Integer>() : null;
+ }
+
+ public Map<Object, Object> getTargetMap()
+ {
+ return targetMap;
+ }
+
+ public Map<Object, Integer> getTargetAdditions()
+ {
+ return targetAdditions;
+ }
+
+ public void processRemoveExpansion(List<CDOFeatureDelta> targetDeltas, CDORemoveFeatureDelta targetDelta, int deltaPosition)
+ {
+ int projectedIndex = deltaPosition;
+ targetMap.put(targetDelta, projectedIndex);
+ targetMap.put(deltaPosition, projectedIndex);
+ }
+
+ public void processDeltaCopy(List<CDOFeatureDelta> targetDeltas, CDOFeatureDelta targetDelta, int deltaPosition)
+ {
+ int deltaIndex = ((WithIndex)targetDelta).getIndex();
+ int projectedIndex = projectIndex(targetDeltas, deltaPosition, deltaIndex);
+
+ targetMap.put(targetDelta, projectedIndex);
+
+ Object positions = targetMap.get(projectedIndex);
+ if (positions == null)
+ {
+ targetMap.put(projectedIndex, deltaPosition);
+ }
+ else if (positions instanceof Integer)
+ {
+ List<Integer> list = new ArrayList<Integer>(2);
+ list.add((Integer)positions);
+ list.add(deltaPosition);
+ targetMap.put(projectedIndex, list);
+ }
+ else
+ {
+ @SuppressWarnings("unchecked")
+ List<Integer> list = (List<Integer>)positions;
+ list.add(deltaPosition);
+ }
+
+ if (targetAdditions != null)
+ {
+ Type targetType = targetDelta.getType();
+ switch (targetType)
+ {
+ case ADD:
+ case SET:
+ targetAdditions.put(((CDOSingleValueFeatureDeltaImpl)targetDelta).getValue(), deltaPosition);
+ break;
+
+ default:
+ break;
+ }
+ }
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ private static final class SourceCopyProcessor implements CopyProcessor
+ {
+ private final List<CDOFeatureDelta> targetDeltas;
+
+ private final Map<Object, Object> targetMap;
+
+ private final Map<Object, Integer> targetAdditions;
+
+ public SourceCopyProcessor(List<CDOFeatureDelta> targetDeltas, Map<Object, Object> targetMap, Map<Object, Integer> targetAdditions)
+ {
+ this.targetDeltas = targetDeltas;
+ this.targetMap = targetMap;
+ this.targetAdditions = targetAdditions;
+ }
+
+ public void processRemoveExpansion(List<CDOFeatureDelta> sourceDeltas, CDORemoveFeatureDelta sourceDelta, int deltaPosition)
+ {
+ processDeltaCopy(sourceDeltas, sourceDelta, deltaPosition);
+ }
+
+ public void processDeltaCopy(List<CDOFeatureDelta> sourceDeltas, CDOFeatureDelta sourceDelta, int deltaPosition)
+ {
+ Type sourceType = sourceDelta.getType();
+
+ switch (sourceType)
+ {
+ case ADD:
+ processDuplicateValues(sourceDelta);
+ break;
+
+ case REMOVE:
+ processSourceRemove(sourceDeltas, sourceDelta, deltaPosition);
+ break;
+
+ case SET:
+ processSourceRemove(sourceDeltas, sourceDelta, deltaPosition);
+ processDuplicateValues(sourceDelta);
+ break;
+
+ case MOVE:
+ // Neutral; do nothing.
+ break;
+
+ default:
+ throw new IllegalStateException("Illegal source type: " + sourceType);
+ }
+ }
+
+ private void processSourceRemove(List<CDOFeatureDelta> sourceDeltas, CDOFeatureDelta sourceDelta, int deltaPosition)
+ {
+ int projectedIndex = projectIndex(sourceDeltas, deltaPosition, ((WithIndex)sourceDelta).getIndex());
+ Object targetPositions = targetMap.get(projectedIndex);
+ if (targetPositions != null)
+ {
+ if (targetPositions instanceof Integer)
+ {
+ Integer targetPosition = (Integer)targetPositions;
+ processSourceRemove(targetPosition);
+ }
+ else
+ {
+ @SuppressWarnings("unchecked")
+ List<Integer> list = (List<Integer>)targetPositions;
+ for (Integer targetPosition : list)
+ {
+ processSourceRemove(targetPosition);
+ }
+ }
+ }
+ }
+
+ private void processSourceRemove(Integer targetPosition)
+ {
+ CDOFeatureDelta targetDelta = targetDeltas.get(targetPosition);
+ Type targetType = targetDelta.getType();
+
+ switch (targetType)
+ {
+ case ADD:
+ // Neutral; do nothing.
+ break;
+
+ case REMOVE:
+ {
+ CDORemoveFeatureDelta targetRemoveDelta = (CDORemoveFeatureDelta)targetDelta;
+ int removedIndex = targetRemoveDelta.getIndex();
+
+ targetDeltas.set(targetPosition, null);
+ adjustRemainingDeltas(targetPosition, removedIndex, CDOFeatureDelta.NO_INDEX);
+ break;
+ }
+
+ case SET:
+ {
+ CDOSetFeatureDelta targetSetDelta = (CDOSetFeatureDelta)targetDelta;
+ int removedIndex = targetSetDelta.getIndex();
+
+ targetDelta = new CDOAddFeatureDeltaImpl(targetSetDelta.getFeature(), removedIndex, targetSetDelta.getValue());
+ targetDeltas.set(targetPosition, targetDelta);
+ adjustRemainingDeltas(targetPosition, removedIndex, CDOFeatureDelta.NO_INDEX);
+ break;
+ }
+
+ case MOVE:
+ {
+ CDOMoveFeatureDelta targetMoveDelta = (CDOMoveFeatureDelta)targetDelta;
+ int removedIndex = targetMoveDelta.getOldPosition();
+ int addedIndex = targetMoveDelta.getNewPosition();
+
+ targetDeltas.set(targetPosition, null);
+ adjustRemainingDeltas(targetPosition, removedIndex, addedIndex);
+ break;
+ }
+
+ default:
+ throw new IllegalStateException("Illegal source type: " + targetType);
+ }
+ }
+
+ private void processDuplicateValues(CDOFeatureDelta sourceDelta)
+ {
+ if (targetAdditions != null)
+ {
+ Object sourceValue = ((CDOSingleValueFeatureDeltaImpl)sourceDelta).getValue();
+ Integer targetPosition = targetAdditions.get(sourceValue);
+ if (targetPosition != null)
+ {
+ WithIndex targetDelta = (WithIndex)targetDeltas.set(targetPosition, null);
+ Object oldMapping = targetMap.remove(targetDelta);
+
+ int addedIndex = targetDelta.getIndex();
+
+ if (targetDelta instanceof CDOSetFeatureDelta)
+ {
+ CDOSetFeatureDelta targetSetDelta = (CDOSetFeatureDelta)targetDelta;
+
+ CDORemoveFeatureDelta targetRemoveDelta = new CDORemoveFeatureDeltaImpl(targetSetDelta.getFeature(), addedIndex);
+ targetDeltas.set(targetPosition, targetRemoveDelta);
+ targetMap.put(targetRemoveDelta, oldMapping);
+ }
+
+ adjustRemainingDeltas(targetPosition, CDOFeatureDelta.NO_INDEX, addedIndex);
+ }
+ }
+ }
+
+ private void adjustRemainingDeltas(int targetPosition, int removedIndex, int addedIndex)
+ {
+ for (int i = targetPosition + 1; i < targetDeltas.size(); i++)
+ {
+ CDOFeatureDelta remainingDelta = targetDeltas.get(i);
+ if (remainingDelta != null)
+ {
+ WithIndex remainingWithIndex = (WithIndex)remainingDelta;
+
+ if (removedIndex != CDOFeatureDelta.NO_INDEX)
+ {
+ remainingWithIndex.adjustAfterAddition(removedIndex); // Undo the target REMOVE.
+ }
+
+ if (addedIndex != CDOFeatureDelta.NO_INDEX)
+ {
+ remainingWithIndex.adjustAfterRemoval(addedIndex); // Undo the target ADD.
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * If the meaning of this type isn't clear, there really should be more of a description here...
+ *
+ * @author Eike Stepper
+ * @since 4.6
+ */
+ public static class ManyValuedOld extends PerFeature
+ {
+ public ManyValuedOld()
+ {
+ }
+
+ /**
+ * @since 4.2
+ */
+ public ManyValuedOld(ResolutionPreference resolutionPreference)
+ {
+ super(resolutionPreference);
+ }
+
+ /**
+ * @since 4.2
+ */
+ protected boolean treatAsUnique(EStructuralFeature feature)
+ {
+ return feature.isUnique();
+ }
+
+ @Override
+ protected CDOFeatureDelta changedInSourceAndTargetManyValued(EStructuralFeature feature, CDOFeatureDelta targetFeatureDelta,
+ CDOFeatureDelta sourceFeatureDelta)
+ {
+ if (targetFeatureDelta instanceof CDOListFeatureDelta && sourceFeatureDelta instanceof CDOListFeatureDelta)
+ {
// Initialize work lists with virtual elements
int originSize = ((CDOListFeatureDelta)sourceFeatureDelta.copy()).getOriginSize();
BasicEList<Element> ancestorList = new BasicEList<Element>(originSize);
@@ -1209,54 +1660,6 @@ public class DefaultCDOMerger implements CDOMerger
return String.valueOf(ancestorIndex);
}
}
-
- @Deprecated
- protected CDOListFeatureDelta createResult(EStructuralFeature feature)
- {
- throw new UnsupportedOperationException();
- }
-
- @Deprecated
- protected void handleListDelta(List<CDOFeatureDelta> resultList, List<CDOFeatureDelta> listToHandle, List<CDOFeatureDelta> listToAdjust)
- {
- throw new UnsupportedOperationException();
- }
-
- @Deprecated
- protected boolean handleListDeltaAdd(List<CDOFeatureDelta> resultList, CDOAddFeatureDelta addDelta, List<CDOFeatureDelta> listToAdjust)
- {
- throw new UnsupportedOperationException();
- }
-
- @Deprecated
- protected boolean handleListDeltaRemove(List<CDOFeatureDelta> resultList, CDORemoveFeatureDelta removeDelta, List<CDOFeatureDelta> listToAdjust)
- {
- throw new UnsupportedOperationException();
- }
-
- @Deprecated
- protected boolean handleListDeltaMove(List<CDOFeatureDelta> resultList, CDOMoveFeatureDelta moveDelta, List<CDOFeatureDelta> listToAdjust)
- {
- throw new UnsupportedOperationException();
- }
-
- @Deprecated
- public static void adjustAfterAddition(List<CDOFeatureDelta> list, int index)
- {
- throw new UnsupportedOperationException();
- }
-
- @Deprecated
- public static void adjustAfterRemoval(List<CDOFeatureDelta> list, int index)
- {
- throw new UnsupportedOperationException();
- }
-
- @Deprecated
- public static void adjustAfterMove(List<CDOFeatureDelta> list, int oldPosition, int newPosition)
- {
- throw new UnsupportedOperationException();
- }
}
}
}

Back to the top