Skip to main content
summaryrefslogtreecommitdiffstats
blob: bcda76055db8b0dbadc24bc821e2afcc7bb63788 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package org.eclipse.emf.compare.uml2.tests;

import org.eclipse.emf.common.EMFPlugin;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.compare.uml2.profile.test.uml2comparetestprofile.UML2CompareTestProfilePackage;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.uml2.uml.UMLPlugin;
import org.junit.AfterClass;
import org.junit.BeforeClass;

public abstract class AbstractDynamicProfileTest extends AbstractUMLProfileTest {

	static URI registeredURI;

	static Object registeredPackage;

	@BeforeClass
	public static void initEPackageNsURIToProfileLocationMap() {
		if (!EMFPlugin.IS_ECLIPSE_RUNNING) {
			// It is required to link the EPackage to the UML package of the UML Profile
			UMLPlugin
					.getEPackageNsURIToProfileLocationMap()
					.put("http://www.eclipse.org/emf/compare/uml2/1.0.0/testprofile",
							URI.createURI("pathmap://UML_COMPARE_TESTS_PROFILE/uml2.compare.testprofile.profile.uml#_hZFTgIwkEeC_FYHMbTTxXw")); //$NON-NLS-1$
		} else {
			registeredURI = UMLPlugin.getEPackageNsURIToProfileLocationMap().remove(
					UML2CompareTestProfilePackage.eNS_URI);
			registeredPackage = EPackage.Registry.INSTANCE.remove(UML2CompareTestProfilePackage.eNS_URI);
		}
	}

	@AfterClass
	public static void resetEPackageNsURIToProfileLocationMap() {
		if (!EMFPlugin.IS_ECLIPSE_RUNNING) {
			UMLPlugin.getEPackageNsURIToProfileLocationMap().remove(
					"http://www.eclipse.org/emf/compare/uml2/1.0.0/testprofile");
		} else {
			UMLPlugin.getEPackageNsURIToProfileLocationMap().put(UML2CompareTestProfilePackage.eNS_URI,
					registeredURI);
			EPackage.Registry.INSTANCE.put(UML2CompareTestProfilePackage.eNS_URI, registeredPackage);
		}
	}
}

Back to the top