Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAxel Richard2015-02-24 15:51:05 +0000
committerLaurent Goubet2015-03-04 13:24:48 +0000
commit0cd4336875072986b52723da20b0baadf7d893b7 (patch)
tree3082ceb94d568f72f3f45643782e7640e18243be /plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests
parent3d32d091390278ccdafa12537bc7b9affb794186 (diff)
downloadorg.eclipse.emf.compare-0cd4336875072986b52723da20b0baadf7d893b7.tar.gz
org.eclipse.emf.compare-0cd4336875072986b52723da20b0baadf7d893b7.tar.xz
org.eclipse.emf.compare-0cd4336875072986b52723da20b0baadf7d893b7.zip
[458963] EMFCompare object doesn't use EMFCompareRCP registries
EMFCompareBuilderConfigurator wasn't called everywhere it should be. Add tests. Bug: 458963 Change-Id: Iff41881d47a16c9a8f6624941dd5aacd33c00fad Signed-off-by: Axel Richard <axel.richard@obeo.fr>
Diffstat (limited to 'plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests')
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/rcp/MatchEngineFactoryRegistryWrapperTest.java45
1 files changed, 44 insertions, 1 deletions
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/rcp/MatchEngineFactoryRegistryWrapperTest.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/rcp/MatchEngineFactoryRegistryWrapperTest.java
index 46f5e6005..cb356f409 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/rcp/MatchEngineFactoryRegistryWrapperTest.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/rcp/MatchEngineFactoryRegistryWrapperTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2014 Obeo.
+ * Copyright (c) 2014, 2015 Obeo.
* 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
@@ -11,6 +11,7 @@
package org.eclipse.emf.compare.tests.rcp;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
@@ -24,6 +25,7 @@ import java.util.Collections;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.emf.compare.EMFCompare;
import org.eclipse.emf.compare.match.IMatchEngine;
import org.eclipse.emf.compare.match.IMatchEngine.Factory;
import org.eclipse.emf.compare.match.impl.MatchEngineFactoryImpl;
@@ -284,6 +286,36 @@ public class MatchEngineFactoryRegistryWrapperTest {
}
+ @Test
+ public void testEMFCompareBuilder() throws IOException {
+ IMatchEngine.Factory factory = new MockMatchEngineFactory1();
+ factory.setRanking(10);
+ registryWrapper.add(factory);
+
+ IMatchEngine.Factory factory2 = new MockMatchEngineFactory2();
+ factory2.setRanking(20);
+ registryWrapper.add(factory2);
+
+ IMatchEngine.Factory factory3 = new MockMatchEngineFactory3();
+ factory3.setRanking(30);
+ registryWrapper.add(factory3);
+
+ MockBuilder mockBuilder = new MockBuilder();
+ mockBuilder.build();
+
+ IMatchEngine.Factory.Registry builderMatchEngineFactoryRegistry = mockBuilder
+ .getMatchEngineFactoryRegistry();
+
+ assertNotSame(registryWrapper, builderMatchEngineFactoryRegistry);
+
+ mockBuilder.setMatchEngineFactoryRegistry(registryWrapper);
+ mockBuilder.build();
+ builderMatchEngineFactoryRegistry = mockBuilder.getMatchEngineFactoryRegistry();
+
+ assertSame(registryWrapper, builderMatchEngineFactoryRegistry);
+
+ }
+
/**
* Disables engine in preferences.
*
@@ -353,4 +385,15 @@ public class MatchEngineFactoryRegistryWrapperTest {
*/
private static class MockMatchEngineFactory3 extends MatchEngineFactoryImpl {
}
+
+ /**
+ * Mock {@link EMFCompare.Builder} in order to access matchEngineFactoryRegistry field.
+ *
+ * @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
+ */
+ private static class MockBuilder extends EMFCompare.Builder {
+ public IMatchEngine.Factory.Registry getMatchEngineFactoryRegistry() {
+ return this.matchEngineFactoryRegistry;
+ }
+ }
}

Back to the top