Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Seifermann2016-09-25 16:17:25 +0000
committerStephan Seifermann2016-09-25 16:17:25 +0000
commit023a17a1a415b2c6272ff1a81f54c0b6f7b4e51a (patch)
treed84389922fac81f6b495df119768611b7211647b /plugins
parentca3dc4959d1439c96e85a1d1c64c8debd8480686 (diff)
downloadcdo-023a17a1a415b2c6272ff1a81f54c0b6f7b4e51a.tar.gz
cdo-023a17a1a415b2c6272ff1a81f54c0b6f7b4e51a.tar.xz
cdo-023a17a1a415b2c6272ff1a81f54c0b6f7b4e51a.zip
[397999] Added tests for new target base specification
https://bugs.eclipse.org/bugs/show_bug.cgi?id=397999 Signed-off-by: Stephan Seifermann <seifermann@fzi.de>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/MergingTest.java76
1 files changed, 76 insertions, 0 deletions
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/MergingTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/MergingTest.java
index 791c8091dc..76e085d73b 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/MergingTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/MergingTest.java
@@ -623,6 +623,82 @@ public class MergingTest extends AbstractCDOTest
assertEquals(false, transaction.isDirty());
}
+ public void testFromBranchWithAdditionsTwoTimes() throws Exception
+ {
+ CDOSession session = openSession();
+ CDOBranch mainBranch = session.getBranchManager().getMainBranch();
+ CDOTransaction transaction = session.openTransaction(mainBranch);
+
+ CDOResource resource = transaction.createResource(getResourcePath("/res"));
+ EList<EObject> contents = resource.getContents();
+ addCompany(contents);
+ addCompany(contents);
+ long time = transaction.commit().getTimeStamp();
+
+ CDOBranch source = mainBranch.createBranch("source", time);
+ CDOTransaction sourceTx = session.openTransaction(source);
+ CDOResource res1 = sourceTx.getResource(getResourcePath("/res"));
+ EList<EObject> sourceContents = res1.getContents();
+ addCompany(sourceContents);
+ long sourceCommit1 = commitAndSync(sourceTx, transaction).getTimeStamp();
+
+ CDOChangeSetData check1 = transaction.merge(source.getHead(), source.getBase(),
+ new DefaultCDOMerger.PerFeature.ManyValued());
+ long mainCommit1 = transaction.commit().getTimeStamp();
+ assertEquals(1, check1.getNewObjects().size());
+ assertEquals(1, check1.getChangedObjects().size());
+ assertTrue(check1.getDetachedObjects().isEmpty());
+ assertEquals(false, transaction.isDirty());
+
+ addCompany(sourceContents);
+ commitAndSync(sourceTx, transaction);
+ sourceTx.close();
+
+ CDOChangeSetData check2 = transaction.merge(source.getHead(), source.getPoint(sourceCommit1),
+ mainBranch.getPoint(mainCommit1), new DefaultCDOMerger.PerFeature.ManyValued());
+ transaction.commit();
+ assertEquals(1, check2.getNewObjects().size());
+ assertEquals(1, check2.getChangedObjects().size());
+ assertTrue(check2.getDetachedObjects().isEmpty());
+ assertEquals(false, transaction.isDirty());
+ }
+
+ public void testRemergeAfterAdditionsInSourceTwoTimes() throws Exception
+ {
+ CDOSession session = openSession();
+ CDOBranch mainBranch = session.getBranchManager().getMainBranch();
+ CDOTransaction transaction = session.openTransaction(mainBranch);
+
+ CDOResource resource = transaction.createResource(getResourcePath("/res"));
+ EList<EObject> contents = resource.getContents();
+ addCompany(contents);
+ addCompany(contents);
+ long time = transaction.commit().getTimeStamp();
+
+ CDOBranch source = mainBranch.createBranch("source", time);
+ CDOTransaction sourceTx = session.openTransaction(source);
+ CDOResource res1 = sourceTx.getResource(getResourcePath("/res"));
+ EList<EObject> sourceContents = res1.getContents();
+ addCompany(sourceContents);
+ long sourceCommit1 = commitAndSync(sourceTx, transaction).getTimeStamp();
+
+ transaction.merge(source.getHead(), source.getBase(), new DefaultCDOMerger.PerFeature.ManyValued());
+ long mainCommit1 = transaction.commit().getTimeStamp();
+
+ addCompany(sourceContents);
+ long sourceCommit2 = commitAndSync(sourceTx).getTimeStamp();
+ sourceTx.close();
+
+ transaction.merge(source.getHead(), source.getPoint(sourceCommit1), mainBranch.getPoint(mainCommit1),
+ new DefaultCDOMerger.PerFeature.ManyValued());
+ long mainCommit2 = transaction.commit().getTimeStamp();
+
+ CDOChangeSetData check = transaction.merge(source.getHead(), source.getPoint(sourceCommit2),
+ mainBranch.getPoint(mainCommit2), new DefaultCDOMerger.PerFeature.ManyValued());
+ assertEquals(true, check.isEmpty());
+ assertEquals(false, transaction.isDirty());
+ }
+
/**
* Bug 309467.
*/

Back to the top