summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEgidijus Vaishnora2011-01-10 04:40:07 (EST)
committerEgidijus Vaishnora2011-01-10 04:40:07 (EST)
commitb70a7f1dc3a4ece52c90ee982487d99eedd8f687 (patch)
tree7567a72c1b2357601344ef0bc17a1b05399e1155
parentf21e8ae2c58c7f32c40079cb22809095bd466dd4 (diff)
downloadcdo-b70a7f1dc3a4ece52c90ee982487d99eedd8f687.zip
cdo-b70a7f1dc3a4ece52c90ee982487d99eedd8f687.tar.gz
cdo-b70a7f1dc3a4ece52c90ee982487d99eedd8f687.tar.bz2
[333670] Bug fix https://bugs.eclipse.org/bugs/show_bug.cgi?id=333670
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/DetachedCDORevision.java19
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/RevisionInfo.java36
-rw-r--r--plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadRevisionByVersionRequest.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBRevisionHandler.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java10
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalAuditClassMapping.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalBranchingClassMapping.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/LoadRevisionByVersionIndication.java10
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllConfigs.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_315043_Test.java133
10 files changed, 204 insertions, 19 deletions
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/DetachedCDORevision.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/DetachedCDORevision.java
index 2d13419..ed640b4 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/DetachedCDORevision.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/DetachedCDORevision.java
@@ -27,11 +27,22 @@ public class DetachedCDORevision extends SyntheticCDORevision
private long timeStamp;
+ private long revised;
+
public DetachedCDORevision(EClass eClass, CDOID id, CDOBranch branch, int version, long timeStamp)
{
+ this(eClass, id, branch, version, timeStamp, UNSPECIFIED_DATE);
+ }
+
+ /**
+ * @since 4.0
+ */
+ public DetachedCDORevision(EClass eClass, CDOID id, CDOBranch branch, int version, long timeStamp, long revised)
+ {
super(eClass, id, branch);
this.version = version;
this.timeStamp = timeStamp;
+ this.revised = revised;
}
@Override
@@ -49,7 +60,13 @@ public class DetachedCDORevision extends SyntheticCDORevision
@Override
public long getRevised()
{
- return UNSPECIFIED_DATE;
+ return revised;
+ }
+
+ @Override
+ public void setRevised(long revised)
+ {
+ this.revised = revised;
}
@Override
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/RevisionInfo.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/RevisionInfo.java
index 20abd5c..5ace5c7 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/RevisionInfo.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/RevisionInfo.java
@@ -10,6 +10,7 @@
*/
package org.eclipse.emf.cdo.spi.common.revision;
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
import org.eclipse.emf.cdo.common.id.CDOID;
@@ -136,13 +137,13 @@ public abstract class RevisionInfo
public void writeResult(CDODataOutput out, int referenceChunk) throws IOException
{
writeRevision(out, referenceChunk);
- doWriteResult(out, synthetic, referenceChunk);
+ writeResult(out, synthetic, referenceChunk);
}
public void readResult(CDODataInput in) throws IOException
{
readRevision(in);
- synthetic = (SyntheticCDORevision)doReadResult(in);
+ synthetic = (SyntheticCDORevision)readResult(in, getID(), requestedBranchPoint.getBranch());
}
public void processResult(InternalCDORevisionManager revisionManager, List<CDORevision> results,
@@ -192,7 +193,11 @@ public abstract class RevisionInfo
result = (InternalCDORevision)in.readCDORevision();
}
- protected void doWriteResult(CDODataOutput out, InternalCDORevision revision, int referenceChunk) throws IOException
+ /**
+ * @since 4.0
+ */
+ public static void writeResult(CDODataOutput out, InternalCDORevision revision, int referenceChunk)
+ throws IOException
{
if (revision == null)
{
@@ -208,7 +213,7 @@ public abstract class RevisionInfo
CDOBranchVersion target = pointer.getTarget();
if (target instanceof InternalCDORevision)
{
- doWriteResult(out, (InternalCDORevision)target, referenceChunk);
+ writeResult(out, (InternalCDORevision)target, referenceChunk);
}
else
{
@@ -221,6 +226,7 @@ public abstract class RevisionInfo
out.writeByte(DETACHED_RESULT);
out.writeCDOClassifierRef(detached.getEClass());
out.writeLong(detached.getTimeStamp());
+ out.writeLong(detached.getRevised());
out.writeInt(detached.getVersion());
}
else
@@ -230,7 +236,10 @@ public abstract class RevisionInfo
}
}
- protected InternalCDORevision doReadResult(CDODataInput in) throws IOException
+ /**
+ * @since 4.0
+ */
+ public static InternalCDORevision readResult(CDODataInput in, CDOID id, CDOBranch branch) throws IOException
{
byte type = in.readByte();
switch (type)
@@ -242,16 +251,17 @@ public abstract class RevisionInfo
{
EClassifier classifier = in.readCDOClassifierRefAndResolve();
long revised = in.readLong();
- InternalCDORevision target = doReadResult(in);
- return new PointerCDORevision((EClass)classifier, id, requestedBranchPoint.getBranch(), revised, target);
+ InternalCDORevision target = readResult(in, id, branch);
+ return new PointerCDORevision((EClass)classifier, id, branch, revised, target);
}
case DETACHED_RESULT:
{
EClassifier classifier = in.readCDOClassifierRefAndResolve();
long timeStamp = in.readLong();
+ long revised = in.readLong();
int version = in.readInt();
- return new DetachedCDORevision((EClass)classifier, id, requestedBranchPoint.getBranch(), version, timeStamp);
+ return new DetachedCDORevision((EClass)classifier, id, branch, version, timeStamp, revised);
}
case NORMAL_RESULT:
@@ -262,6 +272,16 @@ public abstract class RevisionInfo
}
}
+ protected void doWriteResult(CDODataOutput out, InternalCDORevision revision, int referenceChunk) throws IOException
+ {
+ writeResult(out, revision, referenceChunk);
+ }
+
+ protected InternalCDORevision doReadResult(CDODataInput in) throws IOException
+ {
+ return readResult(in, id, requestedBranchPoint.getBranch());
+ }
+
/**
* @author Eike Stepper
* @since 3.0
diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadRevisionByVersionRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadRevisionByVersionRequest.java
index 3d5cfd0..36a2c8b 100644
--- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadRevisionByVersionRequest.java
+++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadRevisionByVersionRequest.java
@@ -17,6 +17,7 @@ import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
import org.eclipse.emf.cdo.internal.net4j.bundle.OM;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
+import org.eclipse.emf.cdo.spi.common.revision.RevisionInfo;
import org.eclipse.net4j.util.om.trace.ContextTracer;
@@ -71,7 +72,7 @@ public class LoadRevisionByVersionRequest extends CDOClientRequest<InternalCDORe
@Override
protected InternalCDORevision confirming(CDODataInput in) throws IOException
{
- return (InternalCDORevision)in.readCDORevision();
+ return RevisionInfo.readResult(in, id, branchVersion.getBranch());
}
@Override
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBRevisionHandler.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBRevisionHandler.java
index d5b7eb8..d47db43 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBRevisionHandler.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBRevisionHandler.java
@@ -32,7 +32,7 @@ public class DBRevisionHandler implements CDORevisionHandler
if (revision.getVersion() < CDOBranchVersion.FIRST_VERSION - 1)
{
revision = new DetachedCDORevision(revision.getEClass(), revision.getID(), revision.getBranch(),
- -revision.getVersion(), revision.getTimeStamp());
+ -revision.getVersion(), revision.getTimeStamp(), revision.getRevised());
}
return delegate.handleRevision(revision);
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java
index 744b305..8cc4dc3 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java
@@ -214,7 +214,8 @@ public class DBStoreAccessor extends LongIDStoreAccessor implements IDBStoreAcce
int version = revision.getVersion();
if (version < CDOBranchVersion.FIRST_VERSION - 1)
{
- return new DetachedCDORevision(eClass, id, revision.getBranch(), -version, revision.getTimeStamp());
+ return new DetachedCDORevision(eClass, id, revision.getBranch(), -version, revision.getTimeStamp(),
+ revision.getRevised());
}
return revision;
@@ -248,6 +249,13 @@ public class DBStoreAccessor extends LongIDStoreAccessor implements IDBStoreAcce
// if audit support is present, just use the audit method
success = ((IClassMappingAuditSupport)mapping).readRevisionByVersion(this, revision, listChunk);
+ if (success && revision.getVersion() < CDOBranchVersion.FIRST_VERSION - 1)
+ {
+ // it is detached revision
+ revision = new DetachedCDORevision(eClass, id, revision.getBranch(), -revision.getVersion(),
+ revision.getTimeStamp(), revision.getRevised());
+
+ }
}
else
{
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalAuditClassMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalAuditClassMapping.java
index 95be60d..58c5511 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalAuditClassMapping.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalAuditClassMapping.java
@@ -16,6 +16,7 @@ package org.eclipse.emf.cdo.server.internal.db.mapping.horizontal;
import org.eclipse.emf.cdo.common.branch.CDOBranch;
import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
+import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.id.CDOIDUtil;
import org.eclipse.emf.cdo.common.revision.CDOList;
@@ -166,8 +167,9 @@ public class HorizontalAuditClassMapping extends AbstractHorizontalClassMapping
builder = new StringBuilder(sqlSelectAttributesPrefix);
+ builder.append("ABS(");
builder.append(CDODBSchema.ATTRIBUTES_VERSION);
- builder.append("=?)"); //$NON-NLS-1$
+ builder.append(")=?)"); //$NON-NLS-1$
sqlSelectAttributesByVersion = builder.toString();
@@ -289,7 +291,7 @@ public class HorizontalAuditClassMapping extends AbstractHorizontalClassMapping
boolean success = readValuesFromStatement(pstmt, revision, accessor);
// Read multival tables only if revision exists
- if (success)
+ if (success && revision.getVersion() >= CDOBranchVersion.FIRST_VERSION)
{
readLists(accessor, revision, listChunk);
}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalBranchingClassMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalBranchingClassMapping.java
index 603902d..1a52479 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalBranchingClassMapping.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalBranchingClassMapping.java
@@ -437,7 +437,7 @@ public class HorizontalBranchingClassMapping extends AbstractHorizontalClassMapp
boolean success = readValuesFromStatement(pstmt, revision, accessor);
// Read multival tables only if revision exists
- if (success)
+ if (success && revision.getVersion() >= CDOBranchVersion.FIRST_VERSION)
{
readLists(accessor, revision, listChunk);
}
diff --git a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/LoadRevisionByVersionIndication.java b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/LoadRevisionByVersionIndication.java
index 39447c2..a0a5bd0 100644
--- a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/LoadRevisionByVersionIndication.java
+++ b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/LoadRevisionByVersionIndication.java
@@ -15,8 +15,10 @@ import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.protocol.CDODataInput;
import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.server.internal.net4j.bundle.OM;
+import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
+import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionManager;
+import org.eclipse.emf.cdo.spi.common.revision.RevisionInfo;
import org.eclipse.net4j.util.om.trace.ContextTracer;
@@ -66,8 +68,8 @@ public class LoadRevisionByVersionIndication extends CDOReadIndication
@Override
protected void responding(CDODataOutput out) throws IOException
{
- CDORevision revision = getRepository().getRevisionManager().getRevisionByVersion(id, branchVersion, referenceChunk,
- true);
- out.writeCDORevision(revision, referenceChunk);
+ InternalCDORevisionManager revisionManager = getRepository().getRevisionManager();
+ InternalCDORevision revision = revisionManager.getRevisionByVersion(id, branchVersion, referenceChunk, true);
+ RevisionInfo.writeResult(out, revision, referenceChunk);
}
}
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 d781261..34bf81a 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
@@ -73,6 +73,7 @@ import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_308895_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_310574_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_314186_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_314264_Test;
+import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_315043_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_316145_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_316273_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_316434_Test;
@@ -283,6 +284,7 @@ public abstract class AllConfigs extends ConfigTestSuite
testClasses.add(Bugzilla_331619_Test.class);
testClasses.add(Bugzilla_333157_Test.class);
testClasses.add(Bugzilla_333299_Test.class);
+ testClasses.add(Bugzilla_315043_Test.class);
// TODO testClasses.add(NonCDOResourceTest.class);
// TODO testClasses.add(GeneratedEcoreTest.class);
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_315043_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_315043_Test.java
new file mode 100644
index 0000000..0fdcea2
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_315043_Test.java
@@ -0,0 +1,133 @@
+/**
+ * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.emf.cdo.tests.bugzilla;
+
+import org.eclipse.emf.cdo.CDOObject;
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
+import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.common.revision.CDORevisionManager;
+import org.eclipse.emf.cdo.eresource.CDOResource;
+import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.spi.common.revision.DetachedCDORevision;
+import org.eclipse.emf.cdo.tests.AbstractCDOTest;
+import org.eclipse.emf.cdo.tests.model1.Company;
+import org.eclipse.emf.cdo.transaction.CDOTransaction;
+import org.eclipse.emf.cdo.util.CDOUtil;
+
+import org.eclipse.emf.common.util.TreeIterator;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * @author Eike Stepper
+ */
+public class Bugzilla_315043_Test extends AbstractCDOTest
+{
+ public void testReloadingRevisions() throws Exception
+ {
+ skipUnlessAuditing();
+
+ final String RESOURCE_NAME = "resource";
+
+ Set<CDOID> ids = new HashSet<CDOID>();
+ long timeStampOfHoleCommit;
+
+ CDOSession initialSession = openSession();
+ {
+ // create model history
+ CDOTransaction openTransaction = initialSession.openTransaction();
+ CDOResource resource = openTransaction.getOrCreateResource(RESOURCE_NAME);
+
+ // creating initial commit
+ Company createdCompany = getModel1Factory().createCompany();
+ createdCompany.setName("CompanyTesting");
+ createdCompany.setCity("City");
+ createdCompany.setStreet("Street");
+
+ resource.getContents().add(createdCompany);
+
+ openTransaction.commit();
+
+ // collect id's
+ for (TreeIterator<EObject> allContents = resource.getAllContents(); allContents.hasNext();)
+ {
+ CDOObject next = CDOUtil.getCDOObject(allContents.next());
+ ids.add(next.cdoID());
+ }
+
+ // making holes - detaching
+ List<EObject> contents = new ArrayList<EObject>(resource.getContents());
+ for (int i = 0; i < contents.size(); i++)
+ {
+ EcoreUtil.delete(contents.get(i), true);
+ }
+
+ timeStampOfHoleCommit = openTransaction.commit().getTimeStamp();
+ }
+
+ // check when locally cached elements are availabe
+ checkRevisionsOnGivenSession(ids, timeStampOfHoleCommit, 2, initialSession);
+
+ // turn of revision download by timestamp
+ checkRevisionsOnGivenSession(ids, -1, 2, initialSession);
+ initialSession.close();
+
+ checkRevisions(ids, timeStampOfHoleCommit, 2);
+
+ // turn of revision download by timestamp
+ checkRevisions(ids, -1, 2);
+
+ // clear caches
+ clearCache(getRepository().getRevisionManager());
+ checkRevisions(ids, timeStampOfHoleCommit, 2);
+
+ // turn of revision download by timestamp
+ clearCache(getRepository().getRevisionManager());
+ checkRevisions(ids, -1, 2);
+ }
+
+ private void checkRevisions(Set<CDOID> ids, long timeStampOfHoleCommit, int version)
+ {
+ CDOSession session = openSession();
+ checkRevisionsOnGivenSession(ids, timeStampOfHoleCommit, version, session);
+ session.close();
+ }
+
+ private void checkRevisionsOnGivenSession(Set<CDOID> ids, long timeStampOfHoleCommit, int version, CDOSession session)
+ {
+ CDORevisionManager revisionManager = session.getRevisionManager();
+ CDOBranch mainBranch = session.getBranchManager().getMainBranch();
+ CDOBranchPoint branchPoint = mainBranch.getPoint(timeStampOfHoleCommit);
+ CDOBranchVersion branchVersion = mainBranch.getVersion(version);
+
+ for (Iterator<CDOID> it = ids.iterator(); it.hasNext();)
+ {
+ CDOID next = it.next();
+ if (timeStampOfHoleCommit != -1)
+ {
+ CDORevision revision = revisionManager.getRevision(next, branchPoint, CDORevision.DEPTH_NONE, 0, true);
+ assertNull(revision);
+ }
+
+ CDORevision revision = revisionManager.getRevisionByVersion(next, branchVersion, CDORevision.DEPTH_NONE, true);
+ assertInstanceOf(DetachedCDORevision.class, revision);
+ }
+ }
+}