Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2013-05-21 06:45:34 -0400
committerEike Stepper2013-05-21 06:45:34 -0400
commit7360d35d7920ce876d25505a58082dfb41962be1 (patch)
tree3e4ea995afab5e52b71aab8a704f268053a4d577
parentffcb70d4a9c57a83eeddb30375f81210d4aeb5cc (diff)
downloadcdo-7360d35d7920ce876d25505a58082dfb41962be1.tar.gz
cdo-7360d35d7920ce876d25505a58082dfb41962be1.tar.xz
cdo-7360d35d7920ce876d25505a58082dfb41962be1.zip
[396804] CDOMergingConflictResolver tests
https://bugs.eclipse.org/bugs/show_bug.cgi?id=396804
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ConflictResolverMergingTest.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/MergingTest.java9
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_316887_Test.java136
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_383370_Test.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/IConfig.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/Scenario.java1
6 files changed, 15 insertions, 140 deletions
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ConflictResolverMergingTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ConflictResolverMergingTest.java
index 2e00573f0a..f6e8ffbec6 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ConflictResolverMergingTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ConflictResolverMergingTest.java
@@ -12,6 +12,7 @@
package org.eclipse.emf.cdo.tests;
import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.tests.config.IConfig;
import org.eclipse.emf.cdo.tests.model1.OrderDetail;
import org.eclipse.emf.cdo.tests.model1.SalesOrder;
import org.eclipse.emf.cdo.transaction.CDOConflictResolver;
@@ -67,6 +68,7 @@ public class ConflictResolverMergingTest extends ConflictResolverTest
commitAndSync(transaction2, transaction1);
}
+ @Skips(IConfig.EFFORT_MERGING)
public void testMergeLocalChangesPerFeature_Bug2() throws Exception
{
msg("Opening session");
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 31c5e46762..5f5eb12db0 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
@@ -18,6 +18,7 @@ import org.eclipse.emf.cdo.common.commit.CDOCommitInfo;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.eresource.CDOResource;
import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.tests.config.IConfig;
import org.eclipse.emf.cdo.tests.config.IRepositoryConfig;
import org.eclipse.emf.cdo.tests.config.impl.ConfigTest.Requires;
import org.eclipse.emf.cdo.tests.model1.Company;
@@ -142,8 +143,8 @@ public class MergingTest extends AbstractCDOTest
assertEquals(1, ((CDORevision)commitInfo1.getNewObjects().get(1)).getVersion());
}
+ @Skips(IConfig.EFFORT_MERGING)
@SuppressWarnings("unused")
- @Deprecated
public void testRemergeAfterAdditionsInSource() throws Exception
{
CDOSession session = openSession();
@@ -190,8 +191,8 @@ public class MergingTest extends AbstractCDOTest
assertEquals(false, transaction.isDirty());
}
+ @Skips(IConfig.EFFORT_MERGING)
@SuppressWarnings("unused")
- @Deprecated
public void testRemergeAfterAdditionsInSource2() throws Exception
{
CDOSession session = openSession();
@@ -265,7 +266,7 @@ public class MergingTest extends AbstractCDOTest
assertEquals(false, transaction.isDirty());
}
- @Deprecated
+ @Skips(IConfig.EFFORT_MERGING)
public void testAdditionsInSourceAndTarget() throws Exception
{
CDOSession session = openSession();
@@ -336,7 +337,7 @@ public class MergingTest extends AbstractCDOTest
assertEquals(false, transaction.isDirty());
}
- @Deprecated
+ @Skips(IConfig.EFFORT_MERGING)
public void testRemergeAfterAdditionsInSourceAndTarget() throws Exception
{
CDOSession session = openSession();
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_316887_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_316887_Test.java
deleted file mode 100644
index 59fc4423c4..0000000000
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_316887_Test.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Copyright (c) 2010-2012 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.revision.CDORevision;
-import org.eclipse.emf.cdo.common.revision.delta.CDOListFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOMoveFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDORemoveFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
-import org.eclipse.emf.cdo.eresource.CDOResource;
-import org.eclipse.emf.cdo.session.CDOSession;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDOFeatureDelta.WithIndex;
-import org.eclipse.emf.cdo.tests.AbstractCDOTest;
-import org.eclipse.emf.cdo.tests.model2.Task;
-import org.eclipse.emf.cdo.tests.model2.TaskContainer;
-import org.eclipse.emf.cdo.tests.util.TestAdapter;
-import org.eclipse.emf.cdo.transaction.CDOTransaction;
-
-import org.eclipse.emf.internal.cdo.view.CDOStateMachine;
-
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.spi.cdo.InternalCDOObject;
-
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * Databinding & CDO Notifications.
- * <p>
- * See bug 316887
- *
- * @author Cyril Jaquier
- * @since 4.0
- */
-public class Bugzilla_316887_Test extends AbstractCDOTest
-{
- /**
- * @deprecated AbstractObjectConflictResolver is deprecated
- */
- @Deprecated
- public void testResolveConflictWithAdjustedNotifcations() throws Exception
- {
- // setup transaction.
- final CDOSession session = openSession();
- final CDOTransaction tr1 = session.openTransaction();
-
- final CDOResource resource = tr1.createResource(getResourcePath("/test1"));
- TaskContainer container = getModel2Factory().createTaskContainer();
- resource.getContents().add(container);
-
- for (int i = 0; i < 7; i++)
- {
- Task task = getModel2Factory().createTask();
- task.setDescription(Integer.toString(i));
- container.getTasks().add(task);
- }
-
- tr1.commit();
-
- sleep(500);
-
- final CDOTransaction tr2 = session.openTransaction();
-
- // Adds a conflict resolver.
- tr2.options().addConflictResolver(new org.eclipse.emf.spi.cdo.AbstractObjectConflictResolver()
- {
- @Deprecated
- @Override
- protected void resolveConflict(CDOObject conflict, CDORevision oldRemoteRevision, CDORevisionDelta localDelta,
- CDORevisionDelta remoteDelta, List<CDORevisionDelta> allRemoteDeltas)
- {
- CDOStateMachine.INSTANCE.rollback((InternalCDOObject)conflict);
-
- // Adjusts the local delta
- CDOListFeatureDelta list = (CDOListFeatureDelta)localDelta.getFeatureDeltas().get(0);
- CDORemoveFeatureDelta remove = (CDORemoveFeatureDelta)list.getListChanges().get(0);
- ((WithIndex)remove).adjustAfterRemoval(0);
-
- changeObject(conflict, localDelta);
-
- // Adjusts the "notifications"
- CDORevisionDelta delta = allRemoteDeltas.get(0);
- list = (CDOListFeatureDelta)delta.getFeatureDeltas().get(0);
- CDOMoveFeatureDelta move = (CDOMoveFeatureDelta)list.getListChanges().get(0);
- ((WithIndex)move).adjustAfterRemoval(0);
- }
- });
-
- TaskContainer otherContainer = tr2.getObject(container);
- assertNotNull(otherContainer);
-
- //
- TestAdapter adapter = new TestAdapter();
- otherContainer.eAdapters().add(adapter);
-
- // Move in transaction 1.
- container.getTasks().move(6, 0);
-
- // Remove in transaction 2.
- otherContainer.getTasks().remove(2);
-
- tr1.commit();
-
- sleep(500);
-
- assertEquals(2, adapter.getNotifications().length);
- assertEquals(Notification.REMOVE, adapter.getNotifications()[0].getEventType());
- assertEquals(Notification.MOVE, adapter.getNotifications()[1].getEventType());
- assertEquals(5, adapter.getNotifications()[1].getPosition());
-
- tr2.commit();
-
- sleep(500);
-
- // At this point, both transactions must have an similar list.
- assertEquals(container.getTasks().size(), otherContainer.getTasks().size());
-
- Iterator<Task> i1 = container.getTasks().iterator();
- Iterator<Task> i2 = otherContainer.getTasks().iterator();
- while (i1.hasNext())
- {
- Task task1 = i1.next();
- Task task2 = i2.next();
- assertEquals(task1.getDescription(), task2.getDescription());
- }
- }
-}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_383370_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_383370_Test.java
index 7b039826b6..333e6a9f70 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_383370_Test.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_383370_Test.java
@@ -13,6 +13,7 @@ package org.eclipse.emf.cdo.tests.bugzilla;
import org.eclipse.emf.cdo.eresource.CDOResource;
import org.eclipse.emf.cdo.session.CDOSession;
import org.eclipse.emf.cdo.tests.AbstractCDOTest;
+import org.eclipse.emf.cdo.tests.config.IConfig;
import org.eclipse.emf.cdo.tests.model1.Category;
import org.eclipse.emf.cdo.tests.model1.Company;
import org.eclipse.emf.cdo.transaction.CDOTransaction;
@@ -29,6 +30,7 @@ import org.eclipse.emf.ecore.EObject;
*/
public class Bugzilla_383370_Test extends AbstractCDOTest
{
+ @Skips(IConfig.EFFORT_MERGING)
public void testTopLevel() throws Exception
{
Category category = getModel1Factory().createCategory();
@@ -52,6 +54,7 @@ public class Bugzilla_383370_Test extends AbstractCDOTest
assertEquals(resource, category.eResource());
}
+ @Skips(IConfig.EFFORT_MERGING)
public void testTopLevelWithChildren() throws Exception
{
Category category = getModel1Factory().createCategory();
@@ -80,6 +83,7 @@ public class Bugzilla_383370_Test extends AbstractCDOTest
assertEquals(category, child.eContainer());
}
+ @Skips(IConfig.EFFORT_MERGING)
public void testSecondLevel() throws Exception
{
Company company = getModel1Factory().createCompany();
@@ -105,6 +109,7 @@ public class Bugzilla_383370_Test extends AbstractCDOTest
assertEquals(company, category.eContainer());
}
+ @Skips(IConfig.EFFORT_MERGING)
public void testSecondLevelWithChildren() throws Exception
{
Company company = getModel1Factory().createCompany();
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/IConfig.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/IConfig.java
index 12671d28dc..55398a5214 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/IConfig.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/IConfig.java
@@ -23,6 +23,8 @@ public interface IConfig extends ITestLifecycle, Serializable
public static final String CAPABILITY_UNAVAILABLE = "___UNAVAILABLE___";
+ public static final String EFFORT_MERGING = "___MERGING___";
+
public String getName();
public Map<String, Object> getTestProperties();
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/Scenario.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/Scenario.java
index af61bd958a..c32617fc2c 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/Scenario.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/Scenario.java
@@ -158,6 +158,7 @@ public class Scenario implements IScenario
{
Set<String> capabilities = new CaseInsensitiveStringSet();
capabilities.add(IConfig.CAPABILITY_ALL);
+ capabilities.add(IConfig.EFFORT_MERGING); // TODO Remove when effort merging done!
containerConfig.initCapabilities(capabilities);
repositoryConfig.initCapabilities(capabilities);

Back to the top