summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2008-01-05 15:46:52 (EST)
committerEike Stepper2008-01-05 15:46:52 (EST)
commit6be7763b64860c7db5755f28731426a2e9c67f6a (patch)
treedc2b8e768d6e72762380e3bd70a79c3e5a239aba
parentc82f6a98dcad0356f5d6a25e3ff2da0adec6b0bd (diff)
downloadcdo-6be7763b64860c7db5755f28731426a2e9c67f6a.zip
cdo-6be7763b64860c7db5755f28731426a2e9c67f6a.tar.gz
cdo-6be7763b64860c7db5755f28731426a2e9c67f6a.tar.bz2
[214431] CDOView.getRevision() does not work for transactions/dirty objects
https://bugs.eclipse.org/bugs/show_bug.cgi?id=214431
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/RevisionDeltaTest.java22
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOView.java6
2 files changed, 28 insertions, 0 deletions
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 8cc6b30..aac0c56 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
@@ -131,6 +131,28 @@ public class RevisionDeltaTest extends AbstractCDOTest
session.close();
}
+ /**
+ * CDOView.getRevision() does not work for transactions/dirty objects (INVALID)
+ *
+ * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=214431
+ */
+ public void testBugzilla214431() throws Exception
+ {
+ CDOSession session = openModel1Session();
+ CDOTransaction transaction = session.openTransaction();
+ CDOResource resource = transaction.createResource("/test1");
+
+ SalesOrder salesOrder = Model1Factory.eINSTANCE.createSalesOrder();
+ resource.getContents().add(salesOrder);
+ transaction.commit();
+
+ salesOrder.setId(4711);
+ assertNotSame(salesOrder.cdoRevision(), transaction.getRevision(salesOrder.cdoID()));
+ assertEquals(salesOrder.cdoRevision(), transaction.getDirtyObjects().get(salesOrder.cdoID()).cdoRevision());
+ transaction.close();
+ session.close();
+ }
+
private CDORevisionImpl getCopyCDORevision(Object object)
{
return new CDORevisionImpl((CDORevisionImpl)((InternalCDOObject)object).cdoRevision());
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOView.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOView.java
index 5e57ae6..bdb28e3 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOView.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOView.java
@@ -50,6 +50,12 @@ public interface CDOView extends INotifier
public void setLoadRevisionCollectionChunkSize(int loadRevisionCollectionChunkSize);
+ /**
+ * Returns the {@link CDORevision} that is stored in the {@link CDORevisionManager} associated with this view and that
+ * is mapped for the given id. Note that, if this method is called in the context of a {@link CDOTransaction} and the
+ * object with the given id is dirty, it returns the base revision of the session and not the dirty revision of the
+ * transaction!
+ */
public CDORevision getRevision(CDOID id);
/**