diff options
Diffstat (limited to 'tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile.tests/src/org/eclipse/papyrus/uml')
5 files changed, 214 insertions, 214 deletions
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile.tests/src/org/eclipse/papyrus/uml/diagram/profile/custom/commands/tests/DefineProfileCommandTest.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile.tests/src/org/eclipse/papyrus/uml/diagram/profile/custom/commands/tests/DefineProfileCommandTest.java index 076b9404a90..45d9d2f8065 100644 --- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile.tests/src/org/eclipse/papyrus/uml/diagram/profile/custom/commands/tests/DefineProfileCommandTest.java +++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile.tests/src/org/eclipse/papyrus/uml/diagram/profile/custom/commands/tests/DefineProfileCommandTest.java @@ -1,98 +1,98 @@ -/*****************************************************************************
- * Copyright (c) 2014 Christian W. Damus 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:
- * Christian W. Damus - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.uml.diagram.profile.custom.commands.tests;
-
-import static org.hamcrest.CoreMatchers.hasItem;
-import static org.hamcrest.CoreMatchers.notNullValue;
-import static org.hamcrest.CoreMatchers.nullValue;
-import static org.hamcrest.MatcherAssert.assertThat;
-
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.ecore.ENamedElement;
-import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper;
-import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest;
-import org.eclipse.papyrus.junit.utils.rules.ModelSetFixture;
-import org.eclipse.papyrus.junit.utils.rules.PluginResource;
-import org.eclipse.papyrus.uml.diagram.profile.custom.commands.DefineProfileCommand;
-import org.eclipse.papyrus.uml.tools.profile.definition.PapyrusDefinitionAnnotation;
-import org.eclipse.papyrus.uml.tools.profile.definition.Version;
-import org.eclipse.uml2.uml.Profile;
-import org.junit.Rule;
-import org.junit.Test;
-
-/**
- * Test suite for the {@code DefineProfileCommand} class.
- */
-public class DefineProfileCommandTest extends AbstractPapyrusTest {
-
- @Rule
- public final ModelSetFixture modelSet = new ModelSetFixture();
-
- /**
- * Initializes me.
- */
- public DefineProfileCommandTest() {
- super();
- }
-
- @Test
- @PluginResource("resource/profile_simple/simple.profile.di")
- public void testDefineSimpleProfile() {
- Profile rootProfile = (Profile) modelSet.getModel();
-
- executeDefineCommand(rootProfile, "0.0.1");
-
- EAnnotation annotation = getUMLAnnotation(rootProfile.getDefinition());
- assertThat(annotation, nullValue()); // Don't need the annotation for a simple self-contained profile
- }
-
- @Test
- @PluginResource("resource/profile_dependencies/datatypes.profile.di")
- public void testDefineNestedProfileWithDependencies() {
- Profile rootProfile = (Profile) modelSet.getModel();
-
- executeDefineCommand(rootProfile, "0.0.1");
-
- Profile profile1 = (Profile) rootProfile.getNestedPackage("Profile1");
- Profile profile2 = (Profile) rootProfile.getNestedPackage("Profile2");
-
- EAnnotation annotation = getUMLAnnotation(profile1.getDefinition());
- assertThat(annotation, notNullValue());
- assertThat(annotation.getReferences(), hasItem(profile2.getDefinition()));
- }
-
- //
- // Test framework
- //
-
- void executeDefineCommand(Profile profile, String version) {
- PapyrusDefinitionAnnotation annotation = new PapyrusDefinitionAnnotation(Version.parseVersion(version), "", "", "", "");
- DefineProfileCommand command = new DefineProfileCommand(modelSet.getEditingDomain(), annotation, profile, true);
- modelSet.getEditingDomain().getCommandStack().execute(GMFtoEMFCommandWrapper.wrap(command));
- }
-
- static EAnnotation getUMLAnnotation(ENamedElement namedElement) {
- EAnnotation result = null;
-
- for (EAnnotation next : namedElement.getEAnnotations()) {
- String source = next.getSource();
- if ((source != null) && source.startsWith("http://www.eclipse.org/uml2/")) {
- result = next;
- break;
- }
- }
-
- return result;
- }
-}
+/***************************************************************************** + * Copyright (c) 2014 Christian W. Damus 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: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.diagram.profile.custom.commands.tests; + +import static org.hamcrest.CoreMatchers.hasItem; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.hamcrest.CoreMatchers.nullValue; +import static org.hamcrest.MatcherAssert.assertThat; + +import org.eclipse.emf.ecore.EAnnotation; +import org.eclipse.emf.ecore.ENamedElement; +import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper; +import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest; +import org.eclipse.papyrus.junit.utils.rules.ModelSetFixture; +import org.eclipse.papyrus.junit.utils.rules.PluginResource; +import org.eclipse.papyrus.uml.diagram.profile.custom.commands.DefineProfileCommand; +import org.eclipse.papyrus.uml.tools.profile.definition.PapyrusDefinitionAnnotation; +import org.eclipse.papyrus.uml.tools.profile.definition.Version; +import org.eclipse.uml2.uml.Profile; +import org.junit.Rule; +import org.junit.Test; + +/** + * Test suite for the {@code DefineProfileCommand} class. + */ +public class DefineProfileCommandTest extends AbstractPapyrusTest { + + @Rule + public final ModelSetFixture modelSet = new ModelSetFixture(); + + /** + * Initializes me. + */ + public DefineProfileCommandTest() { + super(); + } + + @Test + @PluginResource("resource/profile_simple/simple.profile.di") + public void testDefineSimpleProfile() { + Profile rootProfile = (Profile) modelSet.getModel(); + + executeDefineCommand(rootProfile, "0.0.1"); + + EAnnotation annotation = getUMLAnnotation(rootProfile.getDefinition()); + assertThat(annotation, nullValue()); // Don't need the annotation for a simple self-contained profile + } + + @Test + @PluginResource("resource/profile_dependencies/datatypes.profile.di") + public void testDefineNestedProfileWithDependencies() { + Profile rootProfile = (Profile) modelSet.getModel(); + + executeDefineCommand(rootProfile, "0.0.1"); + + Profile profile1 = (Profile) rootProfile.getNestedPackage("Profile1"); + Profile profile2 = (Profile) rootProfile.getNestedPackage("Profile2"); + + EAnnotation annotation = getUMLAnnotation(profile1.getDefinition()); + assertThat(annotation, notNullValue()); + assertThat(annotation.getReferences(), hasItem(profile2.getDefinition())); + } + + // + // Test framework + // + + void executeDefineCommand(Profile profile, String version) { + PapyrusDefinitionAnnotation annotation = new PapyrusDefinitionAnnotation(Version.parseVersion(version), "", "", "", ""); + DefineProfileCommand command = new DefineProfileCommand(modelSet.getEditingDomain(), annotation, profile, true); + modelSet.getEditingDomain().getCommandStack().execute(GMFtoEMFCommandWrapper.wrap(command)); + } + + static EAnnotation getUMLAnnotation(ENamedElement namedElement) { + EAnnotation result = null; + + for (EAnnotation next : namedElement.getEAnnotations()) { + String source = next.getSource(); + if ((source != null) && source.startsWith("http://www.eclipse.org/uml2/")) { + result = next; + break; + } + } + + return result; + } +} diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile.tests/src/org/eclipse/papyrus/uml/diagram/profile/tests/Activator.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile.tests/src/org/eclipse/papyrus/uml/diagram/profile/tests/Activator.java index b08d188c732..289f7bdb474 100644 --- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile.tests/src/org/eclipse/papyrus/uml/diagram/profile/tests/Activator.java +++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile.tests/src/org/eclipse/papyrus/uml/diagram/profile/tests/Activator.java @@ -1,30 +1,30 @@ -package org.eclipse.papyrus.uml.diagram.profile.tests;
-
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-
-public class Activator implements BundleActivator {
-
- private static BundleContext context;
-
- static BundleContext getContext() {
- return context;
- }
-
- /*
- * (non-Javadoc)
- * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext bundleContext) throws Exception {
- Activator.context = bundleContext;
- }
-
- /*
- * (non-Javadoc)
- * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext bundleContext) throws Exception {
- Activator.context = null;
- }
-
-}
+package org.eclipse.papyrus.uml.diagram.profile.tests; + +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; + +public class Activator implements BundleActivator { + + private static BundleContext context; + + static BundleContext getContext() { + return context; + } + + /* + * (non-Javadoc) + * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext bundleContext) throws Exception { + Activator.context = bundleContext; + } + + /* + * (non-Javadoc) + * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext bundleContext) throws Exception { + Activator.context = null; + } + +} diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile.tests/src/org/eclipse/papyrus/uml/diagram/profile/tests/AllTests.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile.tests/src/org/eclipse/papyrus/uml/diagram/profile/tests/AllTests.java index ecba0442871..69a93d2a42c 100644 --- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile.tests/src/org/eclipse/papyrus/uml/diagram/profile/tests/AllTests.java +++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile.tests/src/org/eclipse/papyrus/uml/diagram/profile/tests/AllTests.java @@ -1,33 +1,33 @@ -/*****************************************************************************
- * Copyright (c) 2014, 2015 CEA LIST, Christian W. Damus, 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:
- * Thibault Le Ouay (Sherpa Engineering) t.leouay@sherpa-eng.com - Initial API and implementation
- * Christian W. Damus - bug 451613
- * Christian W. Damus - bug 464647
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.profile.tests;
-
-import org.eclipse.papyrus.junit.framework.classification.ClassificationSuite;
-import org.eclipse.papyrus.junit.framework.classification.ClassificationSuite.DynamicClasses;
-import org.eclipse.papyrus.uml.diagram.profile.custom.commands.tests.AllCustomCommandTests;
-import org.eclipse.papyrus.uml.diagram.profile.tests.canonical.AllCanonicalTests;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite.SuiteClasses;
-
-
-@RunWith(ClassificationSuite.class)
-@SuiteClasses({
- AllCustomCommandTests.class,
- AllCanonicalTests.class,
-})
-@DynamicClasses("org.eclipse.papyrus.uml.diagram.profile.tests.AllGenTests")
-public class AllTests {
- // Test suite
-}
+/***************************************************************************** + * Copyright (c) 2014, 2015 CEA LIST, Christian W. Damus, 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: + * Thibault Le Ouay (Sherpa Engineering) t.leouay@sherpa-eng.com - Initial API and implementation + * Christian W. Damus - bug 451613 + * Christian W. Damus - bug 464647 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.profile.tests; + +import org.eclipse.papyrus.junit.framework.classification.ClassificationSuite; +import org.eclipse.papyrus.junit.framework.classification.ClassificationSuite.DynamicClasses; +import org.eclipse.papyrus.uml.diagram.profile.custom.commands.tests.AllCustomCommandTests; +import org.eclipse.papyrus.uml.diagram.profile.tests.canonical.AllCanonicalTests; +import org.junit.runner.RunWith; +import org.junit.runners.Suite.SuiteClasses; + + +@RunWith(ClassificationSuite.class) +@SuiteClasses({ + AllCustomCommandTests.class, + AllCanonicalTests.class, +}) +@DynamicClasses("org.eclipse.papyrus.uml.diagram.profile.tests.AllGenTests") +public class AllTests { + // Test suite +} diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile.tests/src/org/eclipse/papyrus/uml/diagram/profile/tests/IProfileDiagramTestsConstants.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile.tests/src/org/eclipse/papyrus/uml/diagram/profile/tests/IProfileDiagramTestsConstants.java index 3490d6e4eb0..dc66eaf4d2a 100644 --- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile.tests/src/org/eclipse/papyrus/uml/diagram/profile/tests/IProfileDiagramTestsConstants.java +++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile.tests/src/org/eclipse/papyrus/uml/diagram/profile/tests/IProfileDiagramTestsConstants.java @@ -1,25 +1,25 @@ -/*****************************************************************************
- * Copyright (c) 2014, 2015 CEA LIST, Christian W. Damus, 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:
- * Thibault Le Ouay (Sherpa Engineering) t.leouay@sherpa-eng.com - Initial API and implementation
- * Christian W. Damus - bug 464647
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.profile.tests;
-
-
-/**
- * Repository of string constants used throughout the Profile Diagram tests.
- */
-public abstract interface IProfileDiagramTestsConstants {
-
- public static final String PROJECT_NAME = "ProfileDiagramTestProject";
-
- public static final String FILE_NAME = "ProfileDiagramTest.profile.di";
-}
+/***************************************************************************** + * Copyright (c) 2014, 2015 CEA LIST, Christian W. Damus, 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: + * Thibault Le Ouay (Sherpa Engineering) t.leouay@sherpa-eng.com - Initial API and implementation + * Christian W. Damus - bug 464647 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.profile.tests; + + +/** + * Repository of string constants used throughout the Profile Diagram tests. + */ +public abstract interface IProfileDiagramTestsConstants { + + public static final String PROJECT_NAME = "ProfileDiagramTestProject"; + + public static final String FILE_NAME = "ProfileDiagramTest.profile.di"; +} diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile.tests/src/org/eclipse/papyrus/uml/diagram/profile/tests/canonical/AllCanonicalTests.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile.tests/src/org/eclipse/papyrus/uml/diagram/profile/tests/canonical/AllCanonicalTests.java index 642658f2e35..194cc360b8b 100644 --- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile.tests/src/org/eclipse/papyrus/uml/diagram/profile/tests/canonical/AllCanonicalTests.java +++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile.tests/src/org/eclipse/papyrus/uml/diagram/profile/tests/canonical/AllCanonicalTests.java @@ -1,28 +1,28 @@ -/*****************************************************************************
- * Copyright (c) 2014 CEA LIST.
- *
- * 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:
- * Thibault Le Ouay (Sherpa Engineering) t.leouay@sherpa-eng.com - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.profile.tests.canonical;
-
-
-import org.eclipse.papyrus.junit.framework.classification.ClassificationSuite;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite.SuiteClasses;
-
-@RunWith(ClassificationSuite.class)
-@SuiteClasses({
- TestProfileDiagramTopNode.class,
- TestProfileDiagramChildNode.class,
- TestProfileDiagramLink.class,
- TestImportMetaClass.class,
- TestProfileDiagramExtension.class,
- TestProfileDiagramContextLink.class })
-public class AllCanonicalTests {
-}
+/***************************************************************************** + * Copyright (c) 2014 CEA LIST. + * + * 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: + * Thibault Le Ouay (Sherpa Engineering) t.leouay@sherpa-eng.com - Initial API and implementation + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.profile.tests.canonical; + + +import org.eclipse.papyrus.junit.framework.classification.ClassificationSuite; +import org.junit.runner.RunWith; +import org.junit.runners.Suite.SuiteClasses; + +@RunWith(ClassificationSuite.class) +@SuiteClasses({ + TestProfileDiagramTopNode.class, + TestProfileDiagramChildNode.class, + TestProfileDiagramLink.class, + TestImportMetaClass.class, + TestProfileDiagramExtension.class, + TestProfileDiagramContextLink.class }) +public class AllCanonicalTests { +} |