Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2011-09-19 08:01:12 +0000
committerEike Stepper2011-09-19 08:01:12 +0000
commit410124d25df48bd6d0d58901d990c23ae73f8030 (patch)
tree9de1fd4eebf9e64f26f88c92f34075ef58553e76
parent6332b8403121c9ce93015342b13cb3ab76b364fe (diff)
downloadcdo-410124d25df48bd6d0d58901d990c23ae73f8030.tar.gz
cdo-410124d25df48bd6d0d58901d990c23ae73f8030.tar.xz
cdo-410124d25df48bd6d0d58901d990c23ae73f8030.zip
[352189] PushTransactions construction : reconstructSavepoints==false is troublesome
https://bugs.eclipse.org/bugs/show_bug.cgi?id=352189
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllConfigs.java1
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/PushTransactionTest.java63
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/PushTransactionWithoutReconstructSavepointsTest.java29
3 files changed, 67 insertions, 26 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 091f3cdf41..c098ddcd58 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
@@ -44,6 +44,7 @@ public abstract class AllConfigs extends ConfigTestSuite
testClasses.add(ViewTest.class);
testClasses.add(TransactionTest.class);
testClasses.add(PushTransactionTest.class);
+ testClasses.add(PushTransactionWithoutReconstructSavepointsTest.class);
testClasses.add(CommitInfoTest.class);
testClasses.add(AuditTest.class);
testClasses.add(AuditSameSessionTest.class);
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 402a71efbd..6078055298 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
@@ -28,6 +28,7 @@ import org.eclipse.net4j.util.WrappedException;
import org.eclipse.net4j.util.om.OMPlatform;
import java.io.File;
+import java.io.IOException;
import java.util.Date;
/**
@@ -68,7 +69,7 @@ public class PushTransactionTest extends AbstractCDOTest
msg("Open session & local transaction");
CDOSession session = openSession();
CDOTransaction transaction = session.openTransaction();
- CDOPushTransaction pushTransaction = new CDOPushTransaction(transaction);
+ CDOPushTransaction pushTransaction = openPushTransaction(transaction);
file = pushTransaction.getFile();
CDOResource resource = transaction.getOrCreateResource(getResourcePath(resourcePath));
msg("Make a diff in existing element");
@@ -83,7 +84,7 @@ public class PushTransactionTest extends AbstractCDOTest
msg("Reload previous local session");
CDOSession session = openSession();
CDOTransaction transaction = session.openTransaction();
- CDOPushTransaction pushTransaction = new CDOPushTransaction(transaction, file);
+ CDOPushTransaction pushTransaction = openPushTransaction(transaction, file);
assertEquals(true, transaction.isDirty());
assertEquals(1, transaction.getRevisionDeltas().size());
push(transaction, pushTransaction);
@@ -105,7 +106,7 @@ public class PushTransactionTest extends AbstractCDOTest
msg("Open session & local transaction");
CDOSession session = openSession();
CDOTransaction transaction = session.openTransaction();
- CDOPushTransaction pushTransaction = new CDOPushTransaction(transaction);
+ CDOPushTransaction pushTransaction = openPushTransaction(transaction);
file = pushTransaction.getFile();
CDOResource resource = transaction.getOrCreateResource(getResourcePath(resourcePath));
msg("Remove an existing element");
@@ -120,7 +121,7 @@ public class PushTransactionTest extends AbstractCDOTest
msg("Reload previous local session");
CDOSession session = openSession();
CDOTransaction transaction = session.openTransaction();
- CDOPushTransaction pushTransaction = new CDOPushTransaction(transaction, file);
+ CDOPushTransaction pushTransaction = openPushTransaction(transaction, file);
assertEquals(true, transaction.isDirty());
assertEquals(1, transaction.getRevisionDeltas().size());
push(transaction, pushTransaction);
@@ -139,7 +140,7 @@ public class PushTransactionTest extends AbstractCDOTest
msg("Open session & local transaction");
CDOSession session = openSession();
CDOTransaction transaction = session.openTransaction();
- CDOPushTransaction pushTransaction = new CDOPushTransaction(transaction);
+ CDOPushTransaction pushTransaction = openPushTransaction(transaction);
file = pushTransaction.getFile();
CDOResource resource = transaction.getOrCreateResource(getResourcePath(resourcePath));
msg("Create a new element");
@@ -155,7 +156,7 @@ public class PushTransactionTest extends AbstractCDOTest
msg("Reload previous local session");
CDOSession session = openSession();
CDOTransaction transaction = session.openTransaction();
- CDOPushTransaction pushTransaction = new CDOPushTransaction(transaction, file);
+ CDOPushTransaction pushTransaction = openPushTransaction(transaction, file);
assertEquals(true, transaction.isDirty());
assertEquals(1, transaction.getRevisionDeltas().size());
CDORevisionDelta delta = transaction.getRevisionDeltas().values().iterator().next();
@@ -176,7 +177,7 @@ public class PushTransactionTest extends AbstractCDOTest
msg("Open session & local transaction");
CDOSession session = openSession();
CDOTransaction transaction = session.openTransaction();
- CDOPushTransaction pushTransaction = new CDOPushTransaction(transaction);
+ CDOPushTransaction pushTransaction = openPushTransaction(transaction);
file = pushTransaction.getFile();
CDOResource resource = transaction.getOrCreateResource(getResourcePath(resourcePath));
msg("Create a new element");
@@ -192,7 +193,7 @@ public class PushTransactionTest extends AbstractCDOTest
msg("Reload previous local session");
CDOSession session = openSession();
CDOTransaction transaction = session.openTransaction();
- CDOPushTransaction pushTransaction = new CDOPushTransaction(transaction, file);
+ CDOPushTransaction pushTransaction = openPushTransaction(transaction, file);
assertEquals(true, transaction.isDirty());
assertEquals(1, transaction.getRevisionDeltas().size());
CDORevisionDelta delta = transaction.getRevisionDeltas().values().iterator().next();
@@ -213,7 +214,7 @@ public class PushTransactionTest extends AbstractCDOTest
msg("Open session & local transaction");
CDOSession session = openSession();
CDOTransaction transaction = session.openTransaction();
- CDOPushTransaction pushTransaction = new CDOPushTransaction(transaction);
+ CDOPushTransaction pushTransaction = openPushTransaction(transaction);
file = pushTransaction.getFile();
CDOResource resource = transaction.getOrCreateResource(getResourcePath(resourcePath));
msg("Create a new element");
@@ -229,7 +230,7 @@ public class PushTransactionTest extends AbstractCDOTest
msg("Reload previous local session");
CDOSession session = openSession();
CDOTransaction transaction = session.openTransaction();
- CDOPushTransaction pushTransaction = new CDOPushTransaction(transaction, file);
+ CDOPushTransaction pushTransaction = openPushTransaction(transaction, file);
assertEquals(true, transaction.isDirty());
assertEquals(1, transaction.getRevisionDeltas().size());
CDORevisionDelta delta = transaction.getRevisionDeltas().values().iterator().next();
@@ -258,7 +259,7 @@ public class PushTransactionTest extends AbstractCDOTest
msg("Open session & local transaction");
CDOSession session = openSession();
CDOTransaction transaction = session.openTransaction();
- CDOPushTransaction pushTransaction = new CDOPushTransaction(transaction);
+ CDOPushTransaction pushTransaction = openPushTransaction(transaction);
file = pushTransaction.getFile();
CDOResource resource = transaction.getOrCreateResource(getResourcePath(resourcePath));
msg("Create a new element");
@@ -274,7 +275,7 @@ public class PushTransactionTest extends AbstractCDOTest
msg("Reload previous local session");
CDOSession session = openSession();
CDOTransaction transaction = session.openTransaction();
- CDOPushTransaction pushTransaction = new CDOPushTransaction(transaction, file);
+ CDOPushTransaction pushTransaction = openPushTransaction(transaction, file);
assertEquals(true, transaction.isDirty());
assertEquals(1, transaction.getRevisionDeltas().size());
CDORevisionDelta delta = transaction.getRevisionDeltas().values().iterator().next();
@@ -312,7 +313,7 @@ public class PushTransactionTest extends AbstractCDOTest
msg("Open session & local transaction");
CDOSession session = openSession();
CDOTransaction transaction = session.openTransaction();
- CDOPushTransaction pushTransaction = new CDOPushTransaction(transaction);
+ CDOPushTransaction pushTransaction = openPushTransaction(transaction);
file = pushTransaction.getFile();
CDOResource resource = transaction.getOrCreateResource(getResourcePath(resourcePath));
msg("Create a new resource");
@@ -327,7 +328,7 @@ public class PushTransactionTest extends AbstractCDOTest
msg("Reload previous local session");
CDOSession session = openSession();
CDOTransaction transaction = session.openTransaction();
- CDOPushTransaction pushTransaction = new CDOPushTransaction(transaction, file);
+ CDOPushTransaction pushTransaction = openPushTransaction(transaction, file);
assertEquals(true, transaction.isDirty());
CDOResource resource = transaction.getOrCreateResource(getResourcePath(resourcePath));
CDOResource resource2 = (CDOResource)resource.getContents().get(2);
@@ -354,7 +355,7 @@ public class PushTransactionTest extends AbstractCDOTest
msg("Open session & local transaction");
CDOSession session = openSession();
CDOTransaction transaction = session.openTransaction();
- CDOPushTransaction pushTransaction = new CDOPushTransaction(transaction);
+ CDOPushTransaction pushTransaction = openPushTransaction(transaction);
file = pushTransaction.getFile();
CDOResource resource = transaction.getOrCreateResource(getResourcePath(resourcePath));
msg("Create a new element");
@@ -378,7 +379,7 @@ public class PushTransactionTest extends AbstractCDOTest
msg("Reload previous local session");
CDOSession session = openSession();
CDOTransaction transaction = session.openTransaction();
- CDOPushTransaction pushTransaction = new CDOPushTransaction(transaction, file);
+ CDOPushTransaction pushTransaction = openPushTransaction(transaction, file);
assertEquals(true, transaction.isDirty());
assertEquals(1, transaction.getRevisionDeltas().size());
CDOResource resource = transaction.getOrCreateResource(getResourcePath(resourcePath));
@@ -410,7 +411,7 @@ public class PushTransactionTest extends AbstractCDOTest
msg("Open session & local transaction");
CDOSession session = openSession();
CDOTransaction transaction = session.openTransaction();
- CDOPushTransaction pushTransaction = new CDOPushTransaction(transaction);
+ CDOPushTransaction pushTransaction = openPushTransaction(transaction);
file = pushTransaction.getFile();
CDOResource resource = transaction.getOrCreateResource(getResourcePath(resourcePath));
msg("Create a new elements");
@@ -430,7 +431,7 @@ public class PushTransactionTest extends AbstractCDOTest
msg("Reload previous local session");
CDOSession session = openSession();
CDOTransaction transaction = session.openTransaction();
- CDOPushTransaction pushTransaction = new CDOPushTransaction(transaction, file);
+ CDOPushTransaction pushTransaction = openPushTransaction(transaction, file);
assertEquals(true, transaction.isDirty());
CDOResource resource = transaction.getOrCreateResource(getResourcePath(resourcePath));
assertEquals(supplierName, ((Supplier)resource.getContents().get(1)).getName());
@@ -451,7 +452,7 @@ public class PushTransactionTest extends AbstractCDOTest
msg("Open session & local transaction");
CDOSession session = openSession();
CDOTransaction transaction = session.openTransaction();
- CDOPushTransaction pushTransaction = new CDOPushTransaction(transaction);
+ CDOPushTransaction pushTransaction = openPushTransaction(transaction);
file = pushTransaction.getFile();
CDOResource resource = transaction.getOrCreateResource(getResourcePath(resourcePath));
msg("Create a new elements");
@@ -469,7 +470,7 @@ public class PushTransactionTest extends AbstractCDOTest
msg("Reload previous local session");
CDOSession session = openSession();
CDOTransaction transaction = session.openTransaction();
- CDOPushTransaction pushTransaction = new CDOPushTransaction(transaction, file);
+ CDOPushTransaction pushTransaction = openPushTransaction(transaction, file);
assertEquals(true, transaction.isDirty());
CDOResource resource = transaction.getOrCreateResource(getResourcePath(resourcePath));
assertEquals(0, resource.getContents().size());
@@ -489,7 +490,7 @@ public class PushTransactionTest extends AbstractCDOTest
msg("Open session & local transaction");
CDOSession session = openSession();
CDOTransaction transaction = session.openTransaction();
- CDOPushTransaction pushTransaction = new CDOPushTransaction(transaction);
+ CDOPushTransaction pushTransaction = openPushTransaction(transaction);
file = pushTransaction.getFile();
CDOResource resource = transaction.getOrCreateResource(getResourcePath(resourcePath));
Supplier supplier = (Supplier)resource.getContents().get(0);
@@ -503,7 +504,7 @@ public class PushTransactionTest extends AbstractCDOTest
msg("Reload previous local session");
CDOSession session = openSession();
CDOTransaction transaction = session.openTransaction();
- CDOPushTransaction pushTransaction = new CDOPushTransaction(transaction, file);
+ CDOPushTransaction pushTransaction = openPushTransaction(transaction, file);
assertEquals(true, transaction.isDirty());
CDOResource resource = transaction.getOrCreateResource(getResourcePath(resourcePath));
Supplier supplier = (Supplier)resource.getContents().get(0);
@@ -525,7 +526,7 @@ public class PushTransactionTest extends AbstractCDOTest
msg("Open session & local transaction");
CDOSession session = openSession();
CDOTransaction transaction = session.openTransaction();
- CDOPushTransaction pushTransaction = new CDOPushTransaction(transaction);
+ CDOPushTransaction pushTransaction = openPushTransaction(transaction);
file = pushTransaction.getFile();
CDOResource resource = transaction.getOrCreateResource(getResourcePath(resourcePath));
msg("Make a diff in existing element");
@@ -552,7 +553,7 @@ public class PushTransactionTest extends AbstractCDOTest
try
{
- new CDOPushTransaction(transaction, file);
+ openPushTransaction(transaction, file);
fail("ObjectNotFoundException expected");
}
catch (ObjectNotFoundException expected)
@@ -567,7 +568,7 @@ public class PushTransactionTest extends AbstractCDOTest
msg("Open session & local transaction");
CDOSession session = openSession();
CDOTransaction transaction = session.openTransaction();
- CDOPushTransaction pushTransaction = new CDOPushTransaction(transaction);
+ CDOPushTransaction pushTransaction = openPushTransaction(transaction);
file = pushTransaction.getFile();
CDOResource resource = transaction.getOrCreateResource(getResourcePath(resourcePath));
msg("Make a diff in existing element");
@@ -592,7 +593,7 @@ public class PushTransactionTest extends AbstractCDOTest
msg("Reload previous local session");
CDOSession session = openSession();
CDOTransaction transaction = session.openTransaction();
- CDOPushTransaction pushTransaction = new CDOPushTransaction(transaction, file);
+ CDOPushTransaction pushTransaction = openPushTransaction(transaction, file);
assertEquals(true, transaction.hasConflict());
try
@@ -606,6 +607,16 @@ public class PushTransactionTest extends AbstractCDOTest
}
}
+ protected CDOPushTransaction openPushTransaction(CDOTransaction transaction) throws IOException
+ {
+ return new CDOPushTransaction(transaction);
+ }
+
+ protected CDOPushTransaction openPushTransaction(CDOTransaction transaction, File file) throws IOException
+ {
+ return new CDOPushTransaction(transaction, file);
+ }
+
protected void push(CDOTransaction transaction, CDOPushTransaction pushTransaction) throws CommitException
{
msg("Publish previous modifications");
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/PushTransactionWithoutReconstructSavepointsTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/PushTransactionWithoutReconstructSavepointsTest.java
new file mode 100644
index 0000000000..633cefc30a
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/PushTransactionWithoutReconstructSavepointsTest.java
@@ -0,0 +1,29 @@
+/*
+ * 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;
+
+import org.eclipse.emf.cdo.transaction.CDOPushTransaction;
+import org.eclipse.emf.cdo.transaction.CDOTransaction;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * @author Eike Stepper
+ */
+public class PushTransactionWithoutReconstructSavepointsTest extends PushTransactionTest
+{
+ @Override
+ protected CDOPushTransaction openPushTransaction(CDOTransaction transaction, File file) throws IOException
+ {
+ return new CDOPushTransaction(transaction, file, false);
+ }
+}

Back to the top