Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2010-08-08 07:17:19 +0000
committerEike Stepper2010-08-08 07:17:19 +0000
commit0a9bb9a009e242bdb0bb70017dedd1eb0455d0a8 (patch)
tree075bc0257d63082fa97c53350c69f339a23ea1ce
parent8b2f4224bb51b6ef162251a24da646e9243d25a6 (diff)
downloadcdo-0a9bb9a009e242bdb0bb70017dedd1eb0455d0a8.tar.gz
cdo-0a9bb9a009e242bdb0bb70017dedd1eb0455d0a8.tar.xz
cdo-0a9bb9a009e242bdb0bb70017dedd1eb0455d0a8.zip
[320690] Stale references can occur if one of two commits deletes a reference target
https://bugs.eclipse.org/bugs/show_bug.cgi?id=320690
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDORevisionDelta.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDODetachedRevisionDeltaImpl.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDORevisionDeltaImpl.java9
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDOFeatureDeltaVisitorImpl.java32
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/TransactionCommitContext.java327
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/mem/MEMStore.java30
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ContainmentCycleDetectedException.java39
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model3/model/model3.ecore2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/impl/Class1Impl.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/impl/MetaRefImpl.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/impl/Model3PackageImpl.java38
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/impl/NodeAImpl.java37
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/impl/PolygonImpl.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/impl/PolygonWithDuplicatesImpl.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/subpackage/impl/SubpackagePackageImpl.java9
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/subpackage/util/SubpackageSwitch.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/util/Model3Switch.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/Model3Package.java29
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/NodeA.java17
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/impl/Model3PackageImpl.java23
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/impl/NodeAImpl.java12
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/subpackage/impl/SubpackagePackageImpl.java9
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/subpackage/util/SubpackageSwitch.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/util/Model3Switch.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllConfigs.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_316444_Test.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_320690_Test.java (renamed from plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_320690_Tests.java)92
27 files changed, 534 insertions, 221 deletions
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDORevisionDelta.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDORevisionDelta.java
index aa1ee31f73..e0b81247eb 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDORevisionDelta.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDORevisionDelta.java
@@ -19,6 +19,7 @@ import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
import org.eclipse.emf.cdo.internal.common.revision.delta.CDODetachedRevisionDeltaImpl;
import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
import java.util.List;
@@ -59,6 +60,11 @@ public interface CDORevisionDelta extends CDORevisionKey
*/
public CDORevisionDelta copy();
+ /**
+ * @since 4.0
+ */
+ public CDOFeatureDelta getFeatureDelta(EStructuralFeature feature);
+
public List<CDOFeatureDelta> getFeatureDeltas();
/**
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDODetachedRevisionDeltaImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDODetachedRevisionDeltaImpl.java
index 33220a9510..67532a479c 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDODetachedRevisionDeltaImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDODetachedRevisionDeltaImpl.java
@@ -19,6 +19,7 @@ import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDeltaVisitor;
import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
import java.util.List;
@@ -66,6 +67,11 @@ public class CDODetachedRevisionDeltaImpl implements CDORevisionDelta
return this;
}
+ public CDOFeatureDelta getFeatureDelta(EStructuralFeature feature)
+ {
+ throw new UnsupportedOperationException();
+ }
+
public List<CDOFeatureDelta> getFeatureDeltas()
{
throw new UnsupportedOperationException();
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 77e608e033..d2f421d7f4 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
@@ -204,14 +204,19 @@ public class CDORevisionDeltaImpl implements InternalCDORevisionDelta
return featureDeltas.isEmpty();
}
+ public CDORevisionDelta copy()
+ {
+ return new CDORevisionDeltaImpl(this, true);
+ }
+
public Map<EStructuralFeature, CDOFeatureDelta> getFeatureDeltaMap()
{
return featureDeltas;
}
- public CDORevisionDelta copy()
+ public CDOFeatureDelta getFeatureDelta(EStructuralFeature feature)
{
- return new CDORevisionDeltaImpl(this, true);
+ return featureDeltas.get(feature);
}
public List<CDOFeatureDelta> getFeatureDeltas()
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDOFeatureDeltaVisitorImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDOFeatureDeltaVisitorImpl.java
index f30bde00ce..4a71fe1f9b 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDOFeatureDeltaVisitorImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDOFeatureDeltaVisitorImpl.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Simon McDuff - initial API and implementation
* Eike Stepper - maintenance
@@ -48,7 +48,14 @@ public class CDOFeatureDeltaVisitorImpl implements CDOFeatureDeltaVisitor
{
for (CDOFeatureDelta delta : deltas.getListChanges())
{
- delta.accept(this);
+ try
+ {
+ delta.accept(this);
+ }
+ catch (StopVisitException ex)
+ {
+ return;
+ }
}
}
@@ -67,4 +74,25 @@ public class CDOFeatureDeltaVisitorImpl implements CDOFeatureDeltaVisitor
public void visit(CDOUnsetFeatureDelta delta)
{
}
+
+ /**
+ * @since 4.0
+ */
+ protected void stopVisit()
+ {
+ throw new StopVisitException();
+ }
+
+ /**
+ * @author Eike Stepper
+ * @since 4.0
+ */
+ private static final class StopVisitException extends RuntimeException
+ {
+ private static final long serialVersionUID = 1L;
+
+ public StopVisitException()
+ {
+ }
+ }
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/TransactionCommitContext.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/TransactionCommitContext.java
index c9d3c303af..48623ee2b3 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/TransactionCommitContext.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/TransactionCommitContext.java
@@ -28,16 +28,20 @@ import org.eclipse.emf.cdo.common.revision.CDOReferenceAdjuster;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
import org.eclipse.emf.cdo.common.revision.delta.CDOAddFeatureDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDOClearFeatureDelta;
import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDeltaVisitor;
+import org.eclipse.emf.cdo.common.revision.delta.CDORemoveFeatureDelta;
import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
import org.eclipse.emf.cdo.common.revision.delta.CDOSetFeatureDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDOUnsetFeatureDelta;
import org.eclipse.emf.cdo.common.util.CDOCommonUtil;
import org.eclipse.emf.cdo.common.util.CDOQueryInfo;
import org.eclipse.emf.cdo.internal.common.commit.CDOCommitDataImpl;
import org.eclipse.emf.cdo.internal.common.id.CDOIDRevisionDeltaLockWrapper;
import org.eclipse.emf.cdo.internal.common.model.CDOPackageRegistryImpl;
import org.eclipse.emf.cdo.internal.server.bundle.OM;
+import org.eclipse.emf.cdo.server.ContainmentCycleDetectedException;
import org.eclipse.emf.cdo.server.IStoreAccessor;
import org.eclipse.emf.cdo.server.IStoreAccessor.QueryXRefsContext;
import org.eclipse.emf.cdo.server.StoreThreadLocal;
@@ -63,7 +67,6 @@ import org.eclipse.net4j.util.StringUtil;
import org.eclipse.net4j.util.WrappedException;
import org.eclipse.net4j.util.collection.IndexedList;
import org.eclipse.net4j.util.concurrent.IRWLockManager.LockType;
-import org.eclipse.net4j.util.concurrent.TimeoutRuntimeException;
import org.eclipse.net4j.util.om.monitor.OMMonitor;
import org.eclipse.net4j.util.om.trace.ContextTracer;
@@ -570,80 +573,80 @@ public class TransactionCommitContext implements InternalCommitContext
lockedObjects.clear();
lockedTargets = null;
- final boolean supportingBranches = transaction.getRepository().isSupportingBranches();
-
- CDOFeatureDeltaVisitor deltaTargetLocker = null;
- if (ensuringReferentialIntegrity)
+ try
{
- deltaTargetLocker = new CDOFeatureDeltaVisitorImpl()
+ InternalLockManager lockManager = transaction.getRepository().getLockManager();
+ InternalCDORevisionManager revisionManager = transaction.getRepository().getRevisionManager();
+
+ final boolean supportingBranches = transaction.getRepository().isSupportingBranches();
+
+ CDOFeatureDeltaVisitor deltaTargetLocker = null;
+ if (ensuringReferentialIntegrity)
{
- @Override
- public void visit(CDOAddFeatureDelta delta)
+ deltaTargetLocker = new CDOFeatureDeltaVisitorImpl()
{
- lockTarget(delta.getValue(), supportingBranches);
- }
+ @Override
+ public void visit(CDOAddFeatureDelta delta)
+ {
+ lockTarget(delta.getValue(), supportingBranches);
+ }
- @Override
- public void visit(CDOSetFeatureDelta delta)
+ @Override
+ public void visit(CDOSetFeatureDelta delta)
+ {
+ lockTarget(delta.getValue(), supportingBranches);
+ }
+ };
+
+ CDOReferenceAdjuster revisionTargetLocker = new CDOReferenceAdjuster()
{
- lockTarget(delta.getValue(), supportingBranches);
- }
- };
+ public Object adjustReference(Object value)
+ {
+ lockTarget(value, supportingBranches);
+ return value;
+ }
+ };
- CDOReferenceAdjuster revisionTargetLocker = new CDOReferenceAdjuster()
- {
- public Object adjustReference(Object value)
+ for (int i = 0; i < newObjects.length; i++)
{
- lockTarget(value, supportingBranches);
- return value;
+ InternalCDORevision newRevision = newObjects[i];
+ newRevision.adjustReferences(revisionTargetLocker);
}
- };
-
- for (int i = 0; i < newObjects.length; i++)
- {
- InternalCDORevision newRevision = newObjects[i];
- newRevision.adjustReferences(revisionTargetLocker);
}
- }
- InternalLockManager lockManager = transaction.getRepository().getLockManager();
- InternalCDORevisionManager revisionManager = transaction.getRepository().getRevisionManager();
+ for (int i = 0; i < dirtyObjectDeltas.length; i++)
+ {
+ InternalCDORevisionDelta delta = dirtyObjectDeltas[i];
+ CDOID id = delta.getID();
+ Object key = supportingBranches ? CDOIDUtil.createIDAndBranch(id, transaction.getBranch()) : id;
+ lockedObjects.add(new CDOIDRevisionDeltaLockWrapper(key, delta));
- for (int i = 0; i < dirtyObjectDeltas.length; i++)
- {
- InternalCDORevisionDelta delta = dirtyObjectDeltas[i];
- CDOID id = delta.getID();
- Object key = supportingBranches ? CDOIDUtil.createIDAndBranch(id, transaction.getBranch()) : id;
- lockedObjects.add(new CDOIDRevisionDeltaLockWrapper(key, delta));
+ if (hasContainmentChanges(delta))
+ {
+ if (isContainerLocked(delta, revisionManager, lockManager))
+ {
+ throw new ContainmentCycleDetectedException("Parent (" + key
+ + ") is already locked for containment changes");
+ }
+ }
+ }
- if (hasContainmentChanges(delta))
+ for (int i = 0; i < dirtyObjectDeltas.length; i++)
{
- if (isContainerLocked(delta, revisionManager, lockManager))
+ InternalCDORevisionDelta delta = dirtyObjectDeltas[i];
+ if (deltaTargetLocker != null)
{
- lockedObjects.clear();
- throw new ContainmentCycleDetectedException("Parent (" + key + ") is already locked for containment changes");
+ delta.accept(deltaTargetLocker);
}
}
- }
- for (int i = 0; i < dirtyObjectDeltas.length; i++)
- {
- InternalCDORevisionDelta delta = dirtyObjectDeltas[i];
- if (deltaTargetLocker != null)
+ for (int i = 0; i < detachedObjects.length; i++)
{
- delta.accept(deltaTargetLocker);
+ CDOID id = detachedObjects[i];
+ Object key = supportingBranches ? CDOIDUtil.createIDAndBranch(id, transaction.getBranch()) : id;
+ lockedObjects.add(key);
}
- }
-
- for (int i = 0; i < detachedObjects.length; i++)
- {
- CDOID id = detachedObjects[i];
- Object key = supportingBranches ? CDOIDUtil.createIDAndBranch(id, transaction.getBranch()) : id;
- lockedObjects.add(key);
- }
- try
- {
if (!lockedObjects.isEmpty())
{
// First lock all objects (incl. possible ref targets).
@@ -666,10 +669,11 @@ public class TransactionCommitContext implements InternalCommitContext
}
}
}
- catch (TimeoutRuntimeException exception)
+ catch (RuntimeException ex)
{
lockedObjects.clear();
- throw exception;
+ lockedTargets = null;
+ throw ex;
}
}
@@ -750,6 +754,11 @@ public class TransactionCommitContext implements InternalCommitContext
return;
}
+ if (detachedObjectTypes != null && detachedObjectTypes.containsKey(id))
+ {
+ throw new IllegalStateException("This commit deletes object " + id + " and adds a reference at the same time");
+ }
+
// Let this object be locked
Object key = supportingBranches ? CDOIDUtil.createIDAndBranch(id, transaction.getBranch()) : id;
lockedObjects.add(key);
@@ -771,69 +780,12 @@ public class TransactionCommitContext implements InternalCommitContext
return;
}
- final Map<EClass, List<EReference>> sourceCandidates = new HashMap<EClass, List<EReference>>();
- XRefsQueryHandler.collectSourceCandidates(transaction, detachedObjectTypes.values(), sourceCandidates);
-
- final Set<CDOID> xrefs = new HashSet<CDOID>();
- QueryXRefsContext context = new QueryXRefsContext()
- {
- public int compareTo(CDOBranchPoint o)
- {
- throw new UnsupportedOperationException();
- }
-
- public long getTimeStamp()
- {
- return CDOBranchPoint.UNSPECIFIED_DATE;
- }
-
- public CDOBranch getBranch()
- {
- return transaction.getBranch();
- }
-
- public Map<CDOID, EClass> getTargetObjects()
- {
- return detachedObjectTypes;
- }
-
- public EReference[] getSourceReferences()
- {
- return new EReference[0];
- }
-
- public Map<EClass, List<EReference>> getSourceCandidates()
- {
- return sourceCandidates;
- }
-
- public int getMaxResults()
- {
- return CDOQueryInfo.UNLIMITED_RESULTS;
- }
-
- public boolean addXRef(CDOID targetID, CDOID sourceID, EReference sourceReference, int sourceIndex)
- {
- if (!CDOIDUtil.isNull(targetID))
- {
- xrefs.add(sourceID);
- }
-
- return true;
- }
- };
-
- accessor.queryXRefs(context);
-
- for (CDOID id : detachedObjects)
- {
- xrefs.remove(id);
- }
-
- if (!xrefs.isEmpty())
+ XRefContext context = new XRefContext();
+ Set<CDOID> xRefs = context.getXRefs(accessor);
+ if (!xRefs.isEmpty())
{
throw new IllegalStateException(
- "The following objects are still pointing to one or more of the objects to be detached: " + xrefs);
+ "The following objects are still pointing to one or more of the objects to be detached: " + xRefs);
}
}
@@ -1131,27 +1083,148 @@ public class TransactionCommitContext implements InternalCommitContext
/**
* @author Eike Stepper
*/
- public static class ContainmentCycleDetectedException extends IllegalStateException
+ private final class XRefContext implements QueryXRefsContext
{
- private static final long serialVersionUID = 1L;
+ private Map<EClass, List<EReference>> sourceCandidates = new HashMap<EClass, List<EReference>>();
+
+ private Map<CDOID, InternalCDORevisionDelta> revisionDeltas = new HashMap<CDOID, InternalCDORevisionDelta>();
+
+ private Set<CDOID> xRefs = new HashSet<CDOID>();
+
+ public XRefContext()
+ {
+ XRefsQueryHandler.collectSourceCandidates(transaction, detachedObjectTypes.values(), sourceCandidates);
+ for (InternalCDORevisionDelta revisionDelta : dirtyObjectDeltas)
+ {
+ revisionDeltas.put(revisionDelta.getID(), revisionDelta);
+ }
+ }
+
+ public Set<CDOID> getXRefs(IStoreAccessor accessor)
+ {
+ accessor.queryXRefs(this);
+ for (CDOID id : detachedObjects)
+ {
+ xRefs.remove(id);
+ }
- public ContainmentCycleDetectedException()
+ return xRefs;
+ }
+
+ public int compareTo(CDOBranchPoint o)
{
+ throw new UnsupportedOperationException();
}
- public ContainmentCycleDetectedException(String message, Throwable cause)
+ public long getTimeStamp()
{
- super(message, cause);
+ return CDOBranchPoint.UNSPECIFIED_DATE;
}
- public ContainmentCycleDetectedException(String s)
+ public CDOBranch getBranch()
{
- super(s);
+ return transaction.getBranch();
}
- public ContainmentCycleDetectedException(Throwable cause)
+ public Map<CDOID, EClass> getTargetObjects()
{
- super(cause);
+ return detachedObjectTypes;
+ }
+
+ public EReference[] getSourceReferences()
+ {
+ return new EReference[0];
+ }
+
+ public Map<EClass, List<EReference>> getSourceCandidates()
+ {
+ return sourceCandidates;
+ }
+
+ public int getMaxResults()
+ {
+ return CDOQueryInfo.UNLIMITED_RESULTS;
+ }
+
+ public boolean addXRef(CDOID targetID, CDOID sourceID, EReference sourceReference, int sourceIndex)
+ {
+ if (CDOIDUtil.isNull(targetID))
+ {
+ return true;
+ }
+
+ InternalCDORevisionDelta revisionDelta = revisionDeltas.get(sourceID);
+ if (revisionDelta != null)
+ {
+ CDOFeatureDelta featureDelta = revisionDelta.getFeatureDelta(sourceReference);
+ if (featureDelta != null)
+ {
+ XRefExcluder excluder = new XRefExcluder(targetID, sourceIndex);
+ if (excluder.isExcluded(featureDelta))
+ {
+ return true;
+ }
+ }
+ }
+
+ xRefs.add(sourceID);
+ return true;
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ private static final class XRefExcluder extends CDOFeatureDeltaVisitorImpl
+ {
+ private CDOID targetID;
+
+ private int sourceIndex;
+
+ private boolean excluded;
+
+ public XRefExcluder(CDOID targetID, int sourceIndex)
+ {
+ this.targetID = targetID;
+ this.sourceIndex = sourceIndex;
+ }
+
+ public boolean isExcluded(CDOFeatureDelta featureDelta)
+ {
+ featureDelta.accept(this);
+ return excluded;
+ }
+
+ @Override
+ public void visit(CDOSetFeatureDelta delta)
+ {
+ if (!targetID.equals(delta.getValue()))
+ {
+ excluded = true;
+ }
+ }
+
+ @Override
+ public void visit(CDOUnsetFeatureDelta delta)
+ {
+ excluded = true;
+ }
+
+ @Override
+ public void visit(CDOClearFeatureDelta delta)
+ {
+ excluded = true;
+ stopVisit();
+ }
+
+ @Override
+ public void visit(CDORemoveFeatureDelta delta)
+ {
+ if (sourceIndex == delta.getIndex())
+ {
+ excluded = true;
+ stopVisit();
+ }
}
}
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/mem/MEMStore.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/mem/MEMStore.java
index 4c63c465b4..8dd778d445 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/mem/MEMStore.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/mem/MEMStore.java
@@ -567,26 +567,28 @@ public class MEMStore extends LongIDStore implements IMEMStore, BranchLoader
for (EReference eReference : eReferences)
{
Object value = revision.getValue(eReference);
-
- if (eReference.isMany())
+ if (value != null)
{
- @SuppressWarnings("unchecked")
- List<CDOID> ids = (List<CDOID>)value;
- int index = 0;
- for (CDOID id : ids)
+ if (eReference.isMany())
{
- if (!queryXRefs(context, targetIDs, id, sourceID, eReference, index++))
+ @SuppressWarnings("unchecked")
+ List<CDOID> ids = (List<CDOID>)value;
+ int index = 0;
+ for (CDOID id : ids)
{
- return;
+ if (!queryXRefs(context, targetIDs, id, sourceID, eReference, index++))
+ {
+ return;
+ }
}
}
- }
- else
- {
- CDOID id = (CDOID)value;
- if (!queryXRefs(context, targetIDs, id, sourceID, eReference, 0))
+ else
{
- return;
+ CDOID id = (CDOID)value;
+ if (!queryXRefs(context, targetIDs, id, sourceID, eReference, 0))
+ {
+ return;
+ }
}
}
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ContainmentCycleDetectedException.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ContainmentCycleDetectedException.java
new file mode 100644
index 0000000000..a58919a795
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ContainmentCycleDetectedException.java
@@ -0,0 +1,39 @@
+/**
+ * Copyright (c) 2004 - 2010 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.emf.cdo.server;
+
+/**
+ * @author Eike Stepper
+ * @since 4.0
+ */
+public class ContainmentCycleDetectedException extends IllegalStateException
+{
+ private static final long serialVersionUID = 1L;
+
+ public ContainmentCycleDetectedException()
+ {
+ }
+
+ public ContainmentCycleDetectedException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+
+ public ContainmentCycleDetectedException(String s)
+ {
+ super(s);
+ }
+
+ public ContainmentCycleDetectedException(Throwable cause)
+ {
+ super(cause);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.tests.model3/model/model3.ecore b/plugins/org.eclipse.emf.cdo.tests.model3/model/model3.ecore
index 0c28dc808a..c75b28da81 100644
--- a/plugins/org.eclipse.emf.cdo.tests.model3/model/model3.ecore
+++ b/plugins/org.eclipse.emf.cdo.tests.model3/model/model3.ecore
@@ -23,6 +23,8 @@
<eStructuralFeatures xsi:type="ecore:EReference" name="children" upperBound="-1"
eType="#//NodeA" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="otherNodes" upperBound="-1"
+ eType="#//NodeA"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="NodeB">
<eStructuralFeatures xsi:type="ecore:EReference" name="children" upperBound="-1"
diff --git a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/impl/Class1Impl.java b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/impl/Class1Impl.java
index 60637a1e00..6837d39b32 100644
--- a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/impl/Class1Impl.java
+++ b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/impl/Class1Impl.java
@@ -92,9 +92,7 @@ public class Class1Impl extends EObjectImpl implements Class1
public void unsetClass2()
{
if (class2 != null)
- {
((InternalEList.Unsettable<?>)class2).unset();
- }
}
/**
diff --git a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/impl/MetaRefImpl.java b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/impl/MetaRefImpl.java
index f5ead76799..34596e57e4 100644
--- a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/impl/MetaRefImpl.java
+++ b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/impl/MetaRefImpl.java
@@ -78,10 +78,8 @@ public class MetaRefImpl extends EObjectImpl implements MetaRef
if (ePackageRef != oldEPackageRef)
{
if (eNotificationRequired())
- {
eNotify(new ENotificationImpl(this, Notification.RESOLVE, Model3Package.META_REF__EPACKAGE_REF,
oldEPackageRef, ePackageRef));
- }
}
}
return ePackageRef;
@@ -107,10 +105,8 @@ public class MetaRefImpl extends EObjectImpl implements MetaRef
EPackage oldEPackageRef = ePackageRef;
ePackageRef = newEPackageRef;
if (eNotificationRequired())
- {
eNotify(new ENotificationImpl(this, Notification.SET, Model3Package.META_REF__EPACKAGE_REF, oldEPackageRef,
ePackageRef));
- }
}
/**
@@ -125,9 +121,7 @@ public class MetaRefImpl extends EObjectImpl implements MetaRef
{
case Model3Package.META_REF__EPACKAGE_REF:
if (resolve)
- {
return getEPackageRef();
- }
return basicGetEPackageRef();
}
return super.eGet(featureID, resolve, coreType);
diff --git a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/impl/Model3PackageImpl.java b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/impl/Model3PackageImpl.java
index 5eaa188140..f0d7c65de6 100644
--- a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/impl/Model3PackageImpl.java
+++ b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/impl/Model3PackageImpl.java
@@ -126,14 +126,11 @@ public class Model3PackageImpl extends EPackageImpl implements Model3Package
public static Model3Package init()
{
if (isInited)
- {
return (Model3Package)EPackage.Registry.INSTANCE.getEPackage(Model3Package.eNS_URI);
- }
// Obtain or create and register package
Model3PackageImpl theModel3Package = (Model3PackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof Model3PackageImpl ? EPackage.Registry.INSTANCE
- .get(eNS_URI)
- : new Model3PackageImpl());
+ .get(eNS_URI) : new Model3PackageImpl());
isInited = true;
@@ -276,6 +273,16 @@ public class Model3PackageImpl extends EPackageImpl implements Model3Package
*
* @generated
*/
+ public EReference getNodeA_OtherNodes()
+ {
+ return (EReference)nodeAEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
public EClass getNodeB()
{
return nodeBEClass;
@@ -347,9 +354,7 @@ public class Model3PackageImpl extends EPackageImpl implements Model3Package
public void createPackageContents()
{
if (isCreated)
- {
return;
- }
isCreated = true;
// Create classes and their features
@@ -368,6 +373,7 @@ public class Model3PackageImpl extends EPackageImpl implements Model3Package
nodeAEClass = createEClass(NODE_A);
createEReference(nodeAEClass, NODE_A__CHILDREN);
createEAttribute(nodeAEClass, NODE_A__NAME);
+ createEReference(nodeAEClass, NODE_A__OTHER_NODES);
nodeBEClass = createEClass(NODE_B);
createEReference(nodeBEClass, NODE_B__CHILDREN);
@@ -394,9 +400,7 @@ public class Model3PackageImpl extends EPackageImpl implements Model3Package
public void initializePackageContents()
{
if (isInitialized)
- {
return;
- }
isInitialized = true;
// Initialize package
@@ -430,26 +434,30 @@ public class Model3PackageImpl extends EPackageImpl implements Model3Package
IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(polygonEClass, Polygon.class, "Polygon", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getPolygon_Points(), getPoint(), "points", null, 1, -1, Polygon.class, !IS_TRANSIENT, !IS_VOLATILE,
- IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getPolygon_Points(), this.getPoint(), "points", null, 1, -1, Polygon.class, !IS_TRANSIENT,
+ !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(polygonWithDuplicatesEClass, PolygonWithDuplicates.class, "PolygonWithDuplicates", !IS_ABSTRACT,
!IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getPolygonWithDuplicates_Points(), getPoint(), "points", null, 1, -1, PolygonWithDuplicates.class,
- !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getPolygonWithDuplicates_Points(), this.getPoint(), "points", null, 1, -1,
+ PolygonWithDuplicates.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE,
+ !IS_DERIVED, IS_ORDERED);
initEClass(nodeAEClass, NodeA.class, "NodeA", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEReference(getNodeA_Children(), getNodeA(), null, "children", null, 0, -1, NodeA.class, !IS_TRANSIENT,
+ initEReference(getNodeA_Children(), this.getNodeA(), null, "children", null, 0, -1, NodeA.class, !IS_TRANSIENT,
!IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED,
IS_ORDERED);
initEAttribute(getNodeA_Name(), theEcorePackage.getEString(), "name", null, 0, 1, NodeA.class, !IS_TRANSIENT,
!IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getNodeA_OtherNodes(), this.getNodeA(), null, "otherNodes", null, 0, -1, NodeA.class, !IS_TRANSIENT,
+ !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED,
+ IS_ORDERED);
initEClass(nodeBEClass, NodeB.class, "NodeB", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEReference(getNodeB_Children(), getNodeB(), getNodeB_Parent(), "children", null, 0, -1, NodeB.class,
+ initEReference(getNodeB_Children(), this.getNodeB(), this.getNodeB_Parent(), "children", null, 0, -1, NodeB.class,
!IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE,
!IS_DERIVED, IS_ORDERED);
- initEReference(getNodeB_Parent(), getNodeB(), getNodeB_Children(), "parent", null, 0, 1, NodeB.class,
+ initEReference(getNodeB_Parent(), this.getNodeB(), this.getNodeB_Children(), "parent", null, 0, 1, NodeB.class,
!IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE,
!IS_DERIVED, IS_ORDERED);
initEAttribute(getNodeB_Name(), theEcorePackage.getEString(), "name", null, 0, 1, NodeB.class, !IS_TRANSIENT,
diff --git a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/impl/NodeAImpl.java b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/impl/NodeAImpl.java
index 69559b5553..06fb1c8655 100644
--- a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/impl/NodeAImpl.java
+++ b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/impl/NodeAImpl.java
@@ -21,6 +21,7 @@ import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
+import org.eclipse.emf.ecore.util.EObjectResolvingEList;
import org.eclipse.emf.ecore.util.InternalEList;
import java.util.Collection;
@@ -32,6 +33,7 @@ import java.util.Collection;
* <ul>
* <li>{@link org.eclipse.emf.cdo.tests.legacy.model3.impl.NodeAImpl#getChildren <em>Children</em>}</li>
* <li>{@link org.eclipse.emf.cdo.tests.legacy.model3.impl.NodeAImpl#getName <em>Name</em>}</li>
+ * <li>{@link org.eclipse.emf.cdo.tests.legacy.model3.impl.NodeAImpl#getOtherNodes <em>Other Nodes</em>}</li>
* </ul>
* </p>
*
@@ -69,6 +71,16 @@ public class NodeAImpl extends EObjectImpl implements NodeA
protected String name = NAME_EDEFAULT;
/**
+ * The cached value of the '{@link #getOtherNodes() <em>Other Nodes</em>}' reference list. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @see #getOtherNodes()
+ * @generated
+ * @ordered
+ */
+ protected EList<NodeA> otherNodes;
+
+ /**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
@@ -131,6 +143,20 @@ public class NodeAImpl extends EObjectImpl implements NodeA
*
* @generated
*/
+ public EList<NodeA> getOtherNodes()
+ {
+ if (otherNodes == null)
+ {
+ otherNodes = new EObjectResolvingEList<NodeA>(NodeA.class, this, Model3Package.NODE_A__OTHER_NODES);
+ }
+ return otherNodes;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
@@ -156,6 +182,8 @@ public class NodeAImpl extends EObjectImpl implements NodeA
return getChildren();
case Model3Package.NODE_A__NAME:
return getName();
+ case Model3Package.NODE_A__OTHER_NODES:
+ return getOtherNodes();
}
return super.eGet(featureID, resolve, coreType);
}
@@ -178,6 +206,10 @@ public class NodeAImpl extends EObjectImpl implements NodeA
case Model3Package.NODE_A__NAME:
setName((String)newValue);
return;
+ case Model3Package.NODE_A__OTHER_NODES:
+ getOtherNodes().clear();
+ getOtherNodes().addAll((Collection<? extends NodeA>)newValue);
+ return;
}
super.eSet(featureID, newValue);
}
@@ -198,6 +230,9 @@ public class NodeAImpl extends EObjectImpl implements NodeA
case Model3Package.NODE_A__NAME:
setName(NAME_EDEFAULT);
return;
+ case Model3Package.NODE_A__OTHER_NODES:
+ getOtherNodes().clear();
+ return;
}
super.eUnset(featureID);
}
@@ -216,6 +251,8 @@ public class NodeAImpl extends EObjectImpl implements NodeA
return children != null && !children.isEmpty();
case Model3Package.NODE_A__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
+ case Model3Package.NODE_A__OTHER_NODES:
+ return otherNodes != null && !otherNodes.isEmpty();
}
return super.eIsSet(featureID);
}
diff --git a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/impl/PolygonImpl.java b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/impl/PolygonImpl.java
index daa4a6fd61..db6b4af643 100644
--- a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/impl/PolygonImpl.java
+++ b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/impl/PolygonImpl.java
@@ -156,9 +156,7 @@ public class PolygonImpl extends EObjectImpl implements Polygon
public String toString()
{
if (eIsProxy())
- {
return super.toString();
- }
StringBuffer result = new StringBuffer(super.toString());
result.append(" (points: ");
diff --git a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/impl/PolygonWithDuplicatesImpl.java b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/impl/PolygonWithDuplicatesImpl.java
index 38dfd4acb9..9d066d95e3 100644
--- a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/impl/PolygonWithDuplicatesImpl.java
+++ b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/impl/PolygonWithDuplicatesImpl.java
@@ -157,9 +157,7 @@ public class PolygonWithDuplicatesImpl extends EObjectImpl implements PolygonWit
public String toString()
{
if (eIsProxy())
- {
return super.toString();
- }
StringBuffer result = new StringBuffer(super.toString());
result.append(" (points: ");
diff --git a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/subpackage/impl/SubpackagePackageImpl.java b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/subpackage/impl/SubpackagePackageImpl.java
index 660011cb18..1c3f85cfe8 100644
--- a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/subpackage/impl/SubpackagePackageImpl.java
+++ b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/subpackage/impl/SubpackagePackageImpl.java
@@ -76,14 +76,11 @@ public class SubpackagePackageImpl extends EPackageImpl implements SubpackagePac
public static SubpackagePackage init()
{
if (isInited)
- {
return (SubpackagePackage)EPackage.Registry.INSTANCE.getEPackage(SubpackagePackage.eNS_URI);
- }
// Obtain or create and register package
SubpackagePackageImpl theSubpackagePackage = (SubpackagePackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof SubpackagePackageImpl ? EPackage.Registry.INSTANCE
- .get(eNS_URI)
- : new SubpackagePackageImpl());
+ .get(eNS_URI) : new SubpackagePackageImpl());
isInited = true;
@@ -157,9 +154,7 @@ public class SubpackagePackageImpl extends EPackageImpl implements SubpackagePac
public void createPackageContents()
{
if (isCreated)
- {
return;
- }
isCreated = true;
// Create classes and their features
@@ -183,9 +178,7 @@ public class SubpackagePackageImpl extends EPackageImpl implements SubpackagePac
public void initializePackageContents()
{
if (isInitialized)
- {
return;
- }
isInitialized = true;
// Initialize package
diff --git a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/subpackage/util/SubpackageSwitch.java b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/subpackage/util/SubpackageSwitch.java
index 0998561008..173208ba4f 100644
--- a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/subpackage/util/SubpackageSwitch.java
+++ b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/subpackage/util/SubpackageSwitch.java
@@ -97,9 +97,7 @@ public class SubpackageSwitch<T>
Class2 class2 = (Class2)theEObject;
T result = caseClass2(class2);
if (result == null)
- {
result = defaultCase(theEObject);
- }
return result;
}
default:
diff --git a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/util/Model3Switch.java b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/util/Model3Switch.java
index d4a8d9edbe..7d9aacf449 100644
--- a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/util/Model3Switch.java
+++ b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/util/Model3Switch.java
@@ -102,9 +102,7 @@ public class Model3Switch<T>
Class1 class1 = (Class1)theEObject;
T result = caseClass1(class1);
if (result == null)
- {
result = defaultCase(theEObject);
- }
return result;
}
case Model3Package.META_REF:
@@ -112,9 +110,7 @@ public class Model3Switch<T>
MetaRef metaRef = (MetaRef)theEObject;
T result = caseMetaRef(metaRef);
if (result == null)
- {
result = defaultCase(theEObject);
- }
return result;
}
case Model3Package.POLYGON:
@@ -122,9 +118,7 @@ public class Model3Switch<T>
Polygon polygon = (Polygon)theEObject;
T result = casePolygon(polygon);
if (result == null)
- {
result = defaultCase(theEObject);
- }
return result;
}
case Model3Package.POLYGON_WITH_DUPLICATES:
@@ -132,9 +126,7 @@ public class Model3Switch<T>
PolygonWithDuplicates polygonWithDuplicates = (PolygonWithDuplicates)theEObject;
T result = casePolygonWithDuplicates(polygonWithDuplicates);
if (result == null)
- {
result = defaultCase(theEObject);
- }
return result;
}
case Model3Package.NODE_A:
diff --git a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/Model3Package.java b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/Model3Package.java
index cb11ab92df..6b3ba686fc 100644
--- a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/Model3Package.java
+++ b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/Model3Package.java
@@ -193,12 +193,20 @@ public interface Model3Package extends EPackage
int NODE_A__NAME = 1;
/**
+ * The feature id for the '<em><b>Other Nodes</b></em>' reference list. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int NODE_A__OTHER_NODES = 2;
+
+ /**
* The number of structural features of the '<em>Node A</em>' class. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
* @ordered
*/
- int NODE_A_FEATURE_COUNT = 2;
+ int NODE_A_FEATURE_COUNT = 3;
/**
* The meta object id for the '{@link org.eclipse.emf.cdo.tests.model3.impl.NodeBImpl <em>Node B</em>}' class. <!--
@@ -371,6 +379,17 @@ public interface Model3Package extends EPackage
EAttribute getNodeA_Name();
/**
+ * Returns the meta object for the reference list '{@link org.eclipse.emf.cdo.tests.model3.NodeA#getOtherNodes
+ * <em>Other Nodes</em>}'. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the meta object for the reference list '<em>Other Nodes</em>'.
+ * @see org.eclipse.emf.cdo.tests.model3.NodeA#getOtherNodes()
+ * @see #getNodeA()
+ * @generated
+ */
+ EReference getNodeA_OtherNodes();
+
+ /**
* Returns the meta object for class '{@link org.eclipse.emf.cdo.tests.model3.NodeB <em>Node B</em>}'. <!--
* begin-user-doc --> <!-- end-user-doc -->
*
@@ -546,6 +565,14 @@ public interface Model3Package extends EPackage
EAttribute NODE_A__NAME = eINSTANCE.getNodeA_Name();
/**
+ * The meta object literal for the '<em><b>Other Nodes</b></em>' reference list feature. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ EReference NODE_A__OTHER_NODES = eINSTANCE.getNodeA_OtherNodes();
+
+ /**
* The meta object literal for the '{@link org.eclipse.emf.cdo.tests.model3.impl.NodeBImpl <em>Node B</em>}' class.
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
diff --git a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/NodeA.java b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/NodeA.java
index fa60d47253..e719db9c4b 100644
--- a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/NodeA.java
+++ b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/NodeA.java
@@ -20,6 +20,7 @@ import org.eclipse.emf.ecore.EObject;
* <ul>
* <li>{@link org.eclipse.emf.cdo.tests.model3.NodeA#getChildren <em>Children</em>}</li>
* <li>{@link org.eclipse.emf.cdo.tests.model3.NodeA#getName <em>Name</em>}</li>
+ * <li>{@link org.eclipse.emf.cdo.tests.model3.NodeA#getOtherNodes <em>Other Nodes</em>}</li>
* </ul>
* </p>
*
@@ -71,4 +72,20 @@ public interface NodeA extends EObject
*/
void setName(String value);
+ /**
+ * Returns the value of the '<em><b>Other Nodes</b></em>' reference list. The list contents are of type
+ * {@link org.eclipse.emf.cdo.tests.model3.NodeA}. <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Other Nodes</em>' reference list isn't clear, there really should be more of a
+ * description here...
+ * </p>
+ * <!-- end-user-doc -->
+ *
+ * @return the value of the '<em>Other Nodes</em>' reference list.
+ * @see org.eclipse.emf.cdo.tests.model3.Model3Package#getNodeA_OtherNodes()
+ * @model
+ * @generated
+ */
+ EList<NodeA> getOtherNodes();
+
} // NodeA
diff --git a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/impl/Model3PackageImpl.java b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/impl/Model3PackageImpl.java
index eedcbb2d28..39842e3a4a 100644
--- a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/impl/Model3PackageImpl.java
+++ b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/impl/Model3PackageImpl.java
@@ -126,14 +126,11 @@ public class Model3PackageImpl extends EPackageImpl implements Model3Package
public static Model3Package init()
{
if (isInited)
- {
return (Model3Package)EPackage.Registry.INSTANCE.getEPackage(Model3Package.eNS_URI);
- }
// Obtain or create and register package
Model3PackageImpl theModel3Package = (Model3PackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof Model3PackageImpl ? EPackage.Registry.INSTANCE
- .get(eNS_URI)
- : new Model3PackageImpl());
+ .get(eNS_URI) : new Model3PackageImpl());
isInited = true;
@@ -276,6 +273,16 @@ public class Model3PackageImpl extends EPackageImpl implements Model3Package
*
* @generated
*/
+ public EReference getNodeA_OtherNodes()
+ {
+ return (EReference)nodeAEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
public EClass getNodeB()
{
return nodeBEClass;
@@ -347,9 +354,7 @@ public class Model3PackageImpl extends EPackageImpl implements Model3Package
public void createPackageContents()
{
if (isCreated)
- {
return;
- }
isCreated = true;
// Create classes and their features
@@ -368,6 +373,7 @@ public class Model3PackageImpl extends EPackageImpl implements Model3Package
nodeAEClass = createEClass(NODE_A);
createEReference(nodeAEClass, NODE_A__CHILDREN);
createEAttribute(nodeAEClass, NODE_A__NAME);
+ createEReference(nodeAEClass, NODE_A__OTHER_NODES);
nodeBEClass = createEClass(NODE_B);
createEReference(nodeBEClass, NODE_B__CHILDREN);
@@ -394,9 +400,7 @@ public class Model3PackageImpl extends EPackageImpl implements Model3Package
public void initializePackageContents()
{
if (isInitialized)
- {
return;
- }
isInitialized = true;
// Initialize package
@@ -445,6 +449,9 @@ public class Model3PackageImpl extends EPackageImpl implements Model3Package
IS_ORDERED);
initEAttribute(getNodeA_Name(), theEcorePackage.getEString(), "name", null, 0, 1, NodeA.class, !IS_TRANSIENT,
!IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getNodeA_OtherNodes(), this.getNodeA(), null, "otherNodes", null, 0, -1, NodeA.class, !IS_TRANSIENT,
+ !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED,
+ IS_ORDERED);
initEClass(nodeBEClass, NodeB.class, "NodeB", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(getNodeB_Children(), this.getNodeB(), this.getNodeB_Parent(), "children", null, 0, -1, NodeB.class,
diff --git a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/impl/NodeAImpl.java b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/impl/NodeAImpl.java
index 6390769042..2e1dd9b65c 100644
--- a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/impl/NodeAImpl.java
+++ b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/impl/NodeAImpl.java
@@ -25,6 +25,7 @@ import org.eclipse.emf.ecore.EClass;
* <ul>
* <li>{@link org.eclipse.emf.cdo.tests.model3.impl.NodeAImpl#getChildren <em>Children</em>}</li>
* <li>{@link org.eclipse.emf.cdo.tests.model3.impl.NodeAImpl#getName <em>Name</em>}</li>
+ * <li>{@link org.eclipse.emf.cdo.tests.model3.impl.NodeAImpl#getOtherNodes <em>Other Nodes</em>}</li>
* </ul>
* </p>
*
@@ -95,4 +96,15 @@ public class NodeAImpl extends CDOObjectImpl implements NodeA
eSet(Model3Package.Literals.NODE_A__NAME, newName);
}
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ public EList<NodeA> getOtherNodes()
+ {
+ return (EList<NodeA>)eGet(Model3Package.Literals.NODE_A__OTHER_NODES, true);
+ }
+
} // NodeAImpl
diff --git a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/subpackage/impl/SubpackagePackageImpl.java b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/subpackage/impl/SubpackagePackageImpl.java
index 946cba6e12..aca6da147e 100644
--- a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/subpackage/impl/SubpackagePackageImpl.java
+++ b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/subpackage/impl/SubpackagePackageImpl.java
@@ -76,14 +76,11 @@ public class SubpackagePackageImpl extends EPackageImpl implements SubpackagePac
public static SubpackagePackage init()
{
if (isInited)
- {
return (SubpackagePackage)EPackage.Registry.INSTANCE.getEPackage(SubpackagePackage.eNS_URI);
- }
// Obtain or create and register package
SubpackagePackageImpl theSubpackagePackage = (SubpackagePackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof SubpackagePackageImpl ? EPackage.Registry.INSTANCE
- .get(eNS_URI)
- : new SubpackagePackageImpl());
+ .get(eNS_URI) : new SubpackagePackageImpl());
isInited = true;
@@ -157,9 +154,7 @@ public class SubpackagePackageImpl extends EPackageImpl implements SubpackagePac
public void createPackageContents()
{
if (isCreated)
- {
return;
- }
isCreated = true;
// Create classes and their features
@@ -183,9 +178,7 @@ public class SubpackagePackageImpl extends EPackageImpl implements SubpackagePac
public void initializePackageContents()
{
if (isInitialized)
- {
return;
- }
isInitialized = true;
// Initialize package
diff --git a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/subpackage/util/SubpackageSwitch.java b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/subpackage/util/SubpackageSwitch.java
index 85810e7186..868ca1f276 100644
--- a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/subpackage/util/SubpackageSwitch.java
+++ b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/subpackage/util/SubpackageSwitch.java
@@ -97,9 +97,7 @@ public class SubpackageSwitch<T>
Class2 class2 = (Class2)theEObject;
T result = caseClass2(class2);
if (result == null)
- {
result = defaultCase(theEObject);
- }
return result;
}
default:
diff --git a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/util/Model3Switch.java b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/util/Model3Switch.java
index 5a6aab4955..90f2a73bc6 100644
--- a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/util/Model3Switch.java
+++ b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/util/Model3Switch.java
@@ -102,9 +102,7 @@ public class Model3Switch<T>
Class1 class1 = (Class1)theEObject;
T result = caseClass1(class1);
if (result == null)
- {
result = defaultCase(theEObject);
- }
return result;
}
case Model3Package.META_REF:
@@ -112,9 +110,7 @@ public class Model3Switch<T>
MetaRef metaRef = (MetaRef)theEObject;
T result = caseMetaRef(metaRef);
if (result == null)
- {
result = defaultCase(theEObject);
- }
return result;
}
case Model3Package.POLYGON:
@@ -122,9 +118,7 @@ public class Model3Switch<T>
Polygon polygon = (Polygon)theEObject;
T result = casePolygon(polygon);
if (result == null)
- {
result = defaultCase(theEObject);
- }
return result;
}
case Model3Package.POLYGON_WITH_DUPLICATES:
@@ -132,9 +126,7 @@ public class Model3Switch<T>
PolygonWithDuplicates polygonWithDuplicates = (PolygonWithDuplicates)theEObject;
T result = casePolygonWithDuplicates(polygonWithDuplicates);
if (result == null)
- {
result = defaultCase(theEObject);
- }
return result;
}
case Model3Package.NODE_A:
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 41c15fa63d..90ff5e3361 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
@@ -84,7 +84,7 @@ import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_318844_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_318876_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_318998_Tests;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_319836_Test;
-import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_320690_Tests;
+import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_320690_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_320837_Test;
import org.eclipse.emf.cdo.tests.config.impl.ConfigTest;
import org.eclipse.emf.cdo.tests.config.impl.ConfigTestSuite;
@@ -234,7 +234,7 @@ public abstract class AllConfigs extends ConfigTestSuite
testClasses.add(Bugzilla_318876_Test.class);
testClasses.add(Bugzilla_318998_Tests.class);
testClasses.add(Bugzilla_319836_Test.class);
- testClasses.add(Bugzilla_320690_Tests.class);
+ testClasses.add(Bugzilla_320690_Test.class);
testClasses.add(Bugzilla_320837_Test.class);
// TODO testClasses.add(NonCDOResourceTest.class);
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_316444_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_316444_Test.java
index b43e805e49..6adcf91ac0 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_316444_Test.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_316444_Test.java
@@ -12,8 +12,8 @@ package org.eclipse.emf.cdo.tests.bugzilla;
import org.eclipse.emf.cdo.internal.server.Repository;
import org.eclipse.emf.cdo.internal.server.TransactionCommitContext;
-import org.eclipse.emf.cdo.internal.server.TransactionCommitContext.ContainmentCycleDetectedException;
import org.eclipse.emf.cdo.net4j.CDOSession;
+import org.eclipse.emf.cdo.server.ContainmentCycleDetectedException;
import org.eclipse.emf.cdo.server.IRepository;
import org.eclipse.emf.cdo.spi.server.InternalCommitContext;
import org.eclipse.emf.cdo.spi.server.InternalRepository;
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_320690_Tests.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_320690_Test.java
index 7419c6a342..5a3b3e2679 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_320690_Tests.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_320690_Test.java
@@ -14,17 +14,19 @@ import org.eclipse.emf.cdo.eresource.CDOResource;
import org.eclipse.emf.cdo.server.IRepository;
import org.eclipse.emf.cdo.session.CDOSession;
import org.eclipse.emf.cdo.tests.AbstractCDOTest;
+import org.eclipse.emf.cdo.tests.model3.NodeA;
import org.eclipse.emf.cdo.tests.model4.ContainedElementNoOpposite;
import org.eclipse.emf.cdo.tests.model4.RefSingleContainedNPL;
import org.eclipse.emf.cdo.tests.model4.RefSingleNonContainedNPL;
import org.eclipse.emf.cdo.transaction.CDOTransaction;
+import org.eclipse.emf.cdo.util.CommitException;
import java.util.Map;
/**
* @author Eike Stepper
*/
-public class Bugzilla_320690_Tests extends AbstractCDOTest
+public class Bugzilla_320690_Test extends AbstractCDOTest
{
@Override
public synchronized Map<String, Object> getTestProperties()
@@ -80,4 +82,92 @@ public class Bugzilla_320690_Tests extends AbstractCDOTest
dumpAllRevisions(getRepository().getStore());
}
+
+ public void testDeleteTarget() throws Exception
+ {
+ NodeA a = getModel3Factory().createNodeA();
+ NodeA b = getModel3Factory().createNodeA();
+ NodeA c = getModel3Factory().createNodeA();
+
+ a.getChildren().add(c);
+ b.getOtherNodes().add(c);
+
+ CDOSession session = openSession();
+ CDOTransaction transaction = session.openTransaction();
+ CDOResource resource = transaction.createResource("/test");
+
+ resource.getContents().add(a);
+ resource.getContents().add(b);
+ transaction.commit();
+
+ a.getChildren().remove(c);
+
+ try
+ {
+ transaction.commit();
+ fail("CommitException expected");
+ }
+ catch (CommitException ex)
+ {
+ // SUCCESS
+ }
+ }
+
+ public void testDeleteTargetAndReferenceAtOnce() throws Exception
+ {
+ NodeA a = getModel3Factory().createNodeA();
+ NodeA b = getModel3Factory().createNodeA();
+ NodeA c = getModel3Factory().createNodeA();
+
+ a.getChildren().add(c);
+ b.getOtherNodes().add(c);
+
+ CDOSession session = openSession();
+ CDOTransaction transaction = session.openTransaction();
+ CDOResource resource = transaction.createResource("/test");
+
+ resource.getContents().add(a);
+ resource.getContents().add(b);
+ transaction.commit();
+ dumpAllRevisions(getRepository().getStore());
+
+ a.getChildren().remove(c);
+ b.getOtherNodes().remove(c);
+
+ // Must not fail:
+ transaction.commit();
+ }
+
+ public void testDeleteTargetRemoveAndAddReference() throws Exception
+ {
+ NodeA a = getModel3Factory().createNodeA();
+ NodeA b = getModel3Factory().createNodeA();
+ NodeA c = getModel3Factory().createNodeA();
+
+ a.getChildren().add(c);
+ b.getOtherNodes().add(c);
+
+ CDOSession session = openSession();
+ CDOTransaction transaction = session.openTransaction();
+ CDOResource resource = transaction.createResource("/test");
+
+ resource.getContents().add(a);
+ resource.getContents().add(b);
+ transaction.commit();
+ dumpAllRevisions(getRepository().getStore());
+
+ a.getChildren().remove(c);
+ b.getOtherNodes().remove(c);
+ b.getOtherNodes().add(c);
+
+ try
+ {
+ transaction.commit();
+ fail("CommitException expected");
+ }
+ catch (CommitException ex)
+ {
+ // SUCCESS
+ }
+ }
}

Back to the top