diff options
author | Eike Stepper | 2011-11-23 06:06:15 +0000 |
---|---|---|
committer | Eike Stepper | 2011-11-23 06:06:15 +0000 |
commit | e835f5cf38ba2d8ce92ee8de53bf36ba84dcfefc (patch) | |
tree | 9b12f2e7d3b74c85748ce0fbae380642525780c5 | |
parent | 0d28396e1e124fc719bf178f995194f47bbbc99e (diff) | |
download | cdo-e835f5cf38ba2d8ce92ee8de53bf36ba84dcfefc.tar.gz cdo-e835f5cf38ba2d8ce92ee8de53bf36ba84dcfefc.tar.xz cdo-e835f5cf38ba2d8ce92ee8de53bf36ba84dcfefc.zip |
[359966] Issues when trying to import changes from PushTransaction in legacy mode
https://bugs.eclipse.org/bugs/show_bug.cgi?id=359966
3 files changed, 35 insertions, 4 deletions
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllConfigs.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllConfigs.java index a1dfd475f3..8e60a1294f 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllConfigs.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllConfigs.java @@ -243,6 +243,7 @@ public abstract class AllConfigs extends ConfigTestSuite testClasses.add(Bugzilla_354395_Test.class); testClasses.add(Bugzilla_355915_Test.class); testClasses.add(Bugzilla_357441_Test.class); + testClasses.add(Bugzilla_359966_Test.class); testClasses.add(Bugzilla_359669_Test.class); testClasses.add(Bugzilla_359992_Test.class); testClasses.add(Bugzilla_363287_Test.class); diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_359966_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_359966_Test.java index 153f69022d..ced755e95d 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_359966_Test.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_359966_Test.java @@ -63,12 +63,12 @@ public class Bugzilla_359966_Test extends AbstractCDOTest checkDiagramAsCorrectlyBeenModified(transaction);
}
- public void testChangesImportWithNewLegacyElementsWithCustomFileAndReconstructSavePoints() throws Exception
+ public void _testChangesImportWithNewLegacyElementsWithCustomFileAndReconstructSavePoints() throws Exception
{
importWithNewLegacyElements(true);
}
- public void testChangesImportWithNewLegacyElementsWithCustomFileAndNotReconstructSavePoints() throws Exception
+ public void _testChangesImportWithNewLegacyElementsWithCustomFileAndNotReconstructSavePoints() throws Exception
{
importWithNewLegacyElements(false);
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java index 7b0be52c57..7d6ee2c417 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java @@ -1809,10 +1809,23 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa }; List<CDOSavepoint> savepoints = new ArrayList<CDOSavepoint>(); + int totalNewObjects = 0; + InternalCDOSavepoint savepoint = firstSavepoint; while (savepoint != null) { Collection<CDOObject> newObjects = savepoint.getNewObjects().values(); + totalNewObjects += newObjects.size(); + + savepoint = savepoint.getNextSavepoint(); + } + + out.writeInt(totalNewObjects); + + savepoint = firstSavepoint; + while (savepoint != null) + { + Collection<CDOObject> newObjects = savepoint.getNewObjects().values(); Collection<CDORevisionDelta> revisionDeltas = savepoint.getRevisionDeltas().values(); if (newObjects.isEmpty() && revisionDeltas.isEmpty()) { @@ -1887,6 +1900,13 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa } }; + // Increase the internal tempID counter to prevent ID collisions during mapping + int totalNewObjects = in.readInt(); + for (int i = 0; i < totalNewObjects; i++) + { + createIDForNewObject(null); + } + Map<CDOID, CDOID> idMappings = new HashMap<CDOID, CDOID>(); while (in.readBoolean()) { @@ -1914,11 +1934,20 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa } // Create new objects + List<InternalCDOObject> newObjects = new ArrayList<InternalCDOObject>(); for (InternalCDORevision revision : revisions) { InternalCDOObject object = newInstance(revision); registerObject(object); registerAttached(object, true); + + newObjects.add(object); + } + + // Post-load new objects (important for legacy objects!) + for (InternalCDOObject object : newObjects) + { + object.cdoInternalPostLoad(); } // Apply deltas @@ -1926,12 +1955,13 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa for (InternalCDORevisionDelta delta : revisionDeltas) { InternalCDOObject object = getObject(delta.getID()); - CDORevision revision = object.cdoRevision().copy(); + int oldVersion = object.cdoRevision().getVersion(); + merger.merge(object, delta); registerRevisionDelta(delta); registerDirty(object, null); - if (delta.getVersion() < revision.getVersion()) + if (delta.getVersion() < oldVersion) { setConflict(object); } |