Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastien Revol2017-09-22 09:11:42 +0000
committervincent lorenzo2017-09-29 08:55:11 +0000
commit2a31b2040ac80b69a8321f160c616f713ce155aa (patch)
tree2df89e65d44016412758b5dc8c28cd5115afd1ab /tests/junit
parentd368b639835790932c19d0c61fd855a23b464ab0 (diff)
downloadorg.eclipse.papyrus-2a31b2040ac80b69a8321f160c616f713ce155aa.tar.gz
org.eclipse.papyrus-2a31b2040ac80b69a8321f160c616f713ce155aa.tar.xz
org.eclipse.papyrus-2a31b2040ac80b69a8321f160c616f713ce155aa.zip
Bug 522631 - [Table] Improve performance of table displaying stereotype
attributes - Manage performances for synchronized tables - Modify the JUnit test to manage resources Change-Id: I0fb976d1a3b2b730f99617269e6c2ff0d8d75a29 Signed-off-by: Sebastien Revol <sebastien.revol@cea.fr> Signed-off-by: Nicolas FAUVERGUE <nicolas.fauvergue@cea.fr>
Diffstat (limited to 'tests/junit')
-rw-r--r--tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.tests/resources/UMLTableUtils/model.di2
-rw-r--r--tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.tests/resources/UMLTableUtils/model.notation2
-rw-r--r--tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.tests/resources/UMLTableUtils/model.profile.di2
-rw-r--r--tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.tests/resources/UMLTableUtils/model.profile.notation2
-rw-r--r--tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.tests/resources/UMLTableUtils/model.profile.uml20
-rw-r--r--tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.tests/resources/UMLTableUtils/model.uml6
-rw-r--r--tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.tests/src/org/eclipse/papyrus/uml/nattable/tests/tests/UMLTableUtilsTest.java41
7 files changed, 69 insertions, 6 deletions
diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.tests/resources/UMLTableUtils/model.di b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.tests/resources/UMLTableUtils/model.di
new file mode 100644
index 00000000000..08128862c28
--- /dev/null
+++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.tests/resources/UMLTableUtils/model.di
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<architecture:ArchitectureDescription xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:architecture="http://www.eclipse.org/papyrus/infra/core/architecture" contextId="org.eclipse.papyrus.infra.services.edit.TypeContext"/>
diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.tests/resources/UMLTableUtils/model.notation b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.tests/resources/UMLTableUtils/model.notation
new file mode 100644
index 00000000000..8634d4c00e0
--- /dev/null
+++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.tests/resources/UMLTableUtils/model.notation
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"/>
diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.tests/resources/UMLTableUtils/model.profile.di b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.tests/resources/UMLTableUtils/model.profile.di
new file mode 100644
index 00000000000..4f26340f8e6
--- /dev/null
+++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.tests/resources/UMLTableUtils/model.profile.di
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<architecture:ArchitectureDescription xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:architecture="http://www.eclipse.org/papyrus/infra/core/architecture" contextId="org.eclipse.papyrus.uml.architecture.Profile"/>
diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.tests/resources/UMLTableUtils/model.profile.notation b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.tests/resources/UMLTableUtils/model.profile.notation
new file mode 100644
index 00000000000..8634d4c00e0
--- /dev/null
+++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.tests/resources/UMLTableUtils/model.profile.notation
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"/>
diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.tests/resources/UMLTableUtils/model.profile.uml b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.tests/resources/UMLTableUtils/model.profile.uml
new file mode 100644
index 00000000000..0172d20c933
--- /dev/null
+++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.tests/resources/UMLTableUtils/model.profile.uml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<uml:Profile xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_QxR48J-YEeeKcbwPMn2SnA" name="ProfileRootElement">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_XnZcMJ-YEeeKcbwPMn2SnA" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <contents xmi:type="ecore:EPackage" xmi:id="_XnaDQJ-YEeeKcbwPMn2SnA" name="ProfileRootElement" nsURI="http:///schemas/ProfileRootElement/_XnYOEJ-YEeeKcbwPMn2SnA/0" nsPrefix="ProfileRootElement">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_Xnb4cJ-YEeeKcbwPMn2SnA" source="PapyrusVersion">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_Xnb4cZ-YEeeKcbwPMn2SnA" key="Version" value="0.0.1"/>
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_Xnb4cp-YEeeKcbwPMn2SnA" key="Comment" value=""/>
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_Xnb4c5-YEeeKcbwPMn2SnA" key="Copyright" value=""/>
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_Xnb4dJ-YEeeKcbwPMn2SnA" key="Date" value="2017-09-22"/>
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_Xnb4dZ-YEeeKcbwPMn2SnA" key="Author" value=""/>
+ </eAnnotations>
+ </contents>
+ </eAnnotations>
+ <packageImport xmi:type="uml:PackageImport" xmi:id="_Q6_1oJ-YEeeKcbwPMn2SnA">
+ <importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
+ </packageImport>
+ <packageImport xmi:type="uml:PackageImport" xmi:id="_Q7CR4J-YEeeKcbwPMn2SnA">
+ <importedPackage xmi:type="uml:Model" href="pathmap://UML_METAMODELS/UML.metamodel.uml#_0"/>
+ </packageImport>
+</uml:Profile>
diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.tests/resources/UMLTableUtils/model.uml b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.tests/resources/UMLTableUtils/model.uml
new file mode 100644
index 00000000000..978b23815c8
--- /dev/null
+++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.tests/resources/UMLTableUtils/model.uml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_aakHYJ-YEeeKcbwPMn2SnA" name="RootElement">
+ <packageImport xmi:type="uml:PackageImport" xmi:id="_afiuAJ-YEeeKcbwPMn2SnA">
+ <importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
+ </packageImport>
+</uml:Model>
diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.tests/src/org/eclipse/papyrus/uml/nattable/tests/tests/UMLTableUtilsTest.java b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.tests/src/org/eclipse/papyrus/uml/nattable/tests/tests/UMLTableUtilsTest.java
index e571228dec4..81047614cb8 100644
--- a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.tests/src/org/eclipse/papyrus/uml/nattable/tests/tests/UMLTableUtilsTest.java
+++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.tests/src/org/eclipse/papyrus/uml/nattable/tests/tests/UMLTableUtilsTest.java
@@ -13,7 +13,15 @@
package org.eclipse.papyrus.uml.nattable.tests.tests;
+import java.io.IOException;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest;
+import org.eclipse.papyrus.junit.utils.rules.HouseKeeper;
+import org.eclipse.papyrus.uml.nattable.tests.Activator;
import org.eclipse.papyrus.uml.nattable.utils.UMLTableUtils;
import org.eclipse.uml2.uml.Model;
import org.eclipse.uml2.uml.NamedElement;
@@ -25,6 +33,7 @@ import org.eclipse.uml2.uml.Stereotype;
import org.eclipse.uml2.uml.UMLFactory;
import org.junit.Assert;
import org.junit.Before;
+import org.junit.Rule;
import org.junit.Test;
/**
@@ -57,7 +66,17 @@ public class UMLTableUtilsTest extends AbstractPapyrusTest {
*/
protected final static String SECOND_PROPERTY_NAME = "MyProperty2"; //$NON-NLS-1$
-
+ /**
+ * The house keeper.
+ */
+ @Rule
+ public final HouseKeeper houseKeeper = new HouseKeeper();
+
+ /**
+ * The resource set containing the needed resources for the test.
+ */
+ private ResourceSet resourceSet;
+
/**
* Reference to the created class in the root element.
*/
@@ -82,12 +101,20 @@ public class UMLTableUtilsTest extends AbstractPapyrusTest {
/**
* This allows to create the models needed for the JUnit tests.
+ *
+ * @throws IOException
*/
@Before
- public void initModel() {
+ public void initModel() throws IOException {
+
+ resourceSet = houseKeeper.createResourceSet();
+ EMFHelper.loadEMFModel(resourceSet, URI.createPlatformPluginURI(Activator.PLUGIN_ID + "/resources/UMLTableUtils/model.profile.di", true)); //$NON-NLS-1$
+ final Resource umlProfileModel = resourceSet.getResource(URI.createPlatformPluginURI(Activator.PLUGIN_ID + "/resources/UMLTableUtils/model.profile.uml", true), true); //$NON-NLS-1$
+
+ //we inits the field of this class
+ final Profile profileRootElement = (Profile) umlProfileModel.getContents().get(0);
+
// Create the profile model
- final Profile profileRootElement = UMLFactory.eINSTANCE.createProfile();
- profileRootElement.setName(PROFILE_ROOT_ELEMENT_NAME);
final Package packageInProfile = UMLFactory.eINSTANCE.createPackage();
packageInProfile.setName(PACKAGE_IN_PROFILE_NAME);
profileRootElement.getPackagedElements().add(packageInProfile);
@@ -101,9 +128,11 @@ public class UMLTableUtilsTest extends AbstractPapyrusTest {
stereotypeInPackage.getOwnedAttributes().add(firstPropertyInStereotype);
stereotypeInPackage.getOwnedAttributes().add(secondPropertyInStereotype);
+ EMFHelper.loadEMFModel(resourceSet, URI.createPlatformPluginURI(Activator.PLUGIN_ID + "/resources/UMLTableUtils/model.di", true)); //$NON-NLS-1$
+ final Resource umlModel = resourceSet.getResource(URI.createPlatformPluginURI(Activator.PLUGIN_ID + "/resources/UMLTableUtils/model.uml", true), true); //$NON-NLS-1$
+
// Create another model
- final Model rootElement = UMLFactory.eINSTANCE.createModel();
- rootElement.setName("RootElement"); //$NON-NLS-1$
+ final Model rootElement = (Model) umlModel.getContents().get(0);
ProfileApplication createdProfileApplication = UMLFactory.eINSTANCE.createProfileApplication();
createdProfileApplication.setAppliedProfile(profileRootElement);
rootElement.getProfileApplications().add(createdProfileApplication);

Back to the top