From 2b9e8f72e5094b388ccdf8f811aa9207a392d5c9 Mon Sep 17 00:00:00 2001 From: Ansgar Radermacher Date: Wed, 13 Jan 2016 17:12:02 +0100 Subject: Bug 483542 - [Validation] Papyrus needs test cases for common validation tasks Change-Id: Id09ff0b26a7753ad15c0beb30349409f7b57f44e --- .../org.eclipse.papyrus.tests/META-INF/MANIFEST.MF | 3 +- .../test/org/eclipse/papyrus/tests/AllTests.java | 1 + .../junit/utils/tests/AbstractEditorTest.java | 49 ++- .../.classpath | 8 + .../.project | 28 ++ .../.settings/org.eclipse.jdt.core.prefs | 7 + .../META-INF/MANIFEST.MF | 15 + .../about.html | 28 ++ .../build.properties | 9 + .../plugin.properties | 12 + .../plugin.xml | 38 ++ .../pom.xml | 15 + .../constraints/AlwaysPassiveConstraint.java | 32 ++ .../selectors/AlwaysActiveClientSelector.java | 21 + .../AlwaysActiveMalformedClientSelector.java | 21 + .../selectors/AlwaysPassiveJavaClientSelector.java | 21 + .../genvalidation/selectors/TstClientSelector.java | 21 + .../validation/tests/genvalidation/Activator.java | 50 +++ .../.classpath | 8 + .../.project | 28 ++ .../.settings/org.eclipse.jdt.core.prefs | 7 + .../META-INF/MANIFEST.MF | 22 + .../about.html | 28 ++ .../build.properties | 7 + .../model/active.rule-in-plugin.profile.di | 2 + .../model/active.rule-in-plugin.profile.notation | 236 +++++++++++ .../model/active.rule-in-plugin.profile.uml | 76 ++++ .../model/profile.ecore | 77 ++++ .../model/profile.genmodel | 35 ++ .../plugin.properties | 13 + .../plugin.xml | 35 ++ .../pom.xml | 15 + .../src-gen/profile/AlwaysActive.java | 66 +++ .../src-gen/profile/AlwaysActiveMalformed.java | 66 +++ .../src-gen/profile/AlwaysPassiveJava.java | 66 +++ .../src-gen/profile/ProfileFactory.java | 69 +++ .../src-gen/profile/ProfilePackage.java | 470 +++++++++++++++++++++ .../src-gen/profile/Tst.java | 50 +++ .../src-gen/profile/impl/AlwaysActiveImpl.java | 211 +++++++++ .../profile/impl/AlwaysActiveMalformedImpl.java | 211 +++++++++ .../profile/impl/AlwaysPassiveJavaImpl.java | 211 +++++++++ .../src-gen/profile/impl/ProfileFactoryImpl.java | 128 ++++++ .../src-gen/profile/impl/ProfilePackageImpl.java | 384 +++++++++++++++++ .../src-gen/profile/impl/TstImpl.java | 156 +++++++ .../profile/util/ProfileAdapterFactory.java | 174 ++++++++ .../src-gen/profile/util/ProfileSwitch.java | 173 ++++++++ .../src-gen/profile/util/ProfileValidator.java | 235 +++++++++++ .../validation/tests/staticprofile/Activator.java | 50 +++ .../.classpath | 7 + .../.project | 28 ++ .../.settings/org.eclipse.jdt.core.prefs | 291 +++++++++++++ .../.settings/org.eclipse.jdt.ui.prefs | 68 +++ .../META-INF/MANIFEST.MF | 46 ++ .../about.html | 28 ++ .../build.properties | 10 + .../plugin.properties | 13 + .../pom.xml | 15 + .../resources/ExtraUMLValidation.ocl | 5 + .../resources/UMLValidationTests.di | 2 + .../resources/UMLValidationTests.notation | 192 +++++++++ .../resources/UMLValidationTests.uml | 27 ++ .../resources/active-tst.rule-in-definition.di | 2 + .../active-tst.rule-in-definition.notation | 276 ++++++++++++ .../resources/active-tst.rule-in-definition.uml | 30 ++ .../resources/active-tst.rule-in-plugin.di | 2 + .../resources/active-tst.rule-in-plugin.notation | 238 +++++++++++ .../resources/active-tst.rule-in-plugin.uml | 34 ++ .../resources/active.rule-in-definition.profile.di | 2 + .../active.rule-in-definition.profile.notation | 130 ++++++ .../active.rule-in-definition.profile.uml | 138 ++++++ .../resources/active.rule-in-plugin.profile.di | 2 + .../resources/instanceSpecification.di | 2 + .../resources/instanceSpecification.notation | 100 +++++ .../resources/instanceSpecification.uml | 34 ++ .../resources/simple.di | 2 + .../resources/simple.notation | 53 +++ .../resources/simple.profile.di | 2 + .../resources/simple.profile.notation | 60 +++ .../resources/simple.profile.uml | 43 ++ .../resources/simple.uml | 20 + .../papyrus/uml/validation/tests/Activator.java | 67 +++ .../papyrus/uml/validation/tests/AllTests.java | 69 +++ .../papyrus/uml/validation/tests/Messages.java | 47 +++ .../uml/validation/tests/messages.properties | 15 + .../tests/rules/AbstractValidationEditorTest.java | 81 ++++ .../rules/TestOCLConstraintOnInstanceSpec.java | 77 ++++ .../tests/rules/TestOCLValidationRuleFromFile.java | 116 +++++ .../tests/rules/TestStereotypeValidation.java | 78 ++++ .../tests/rules/TestUMLValidationRules.java | 103 +++++ .../rules/TestValidationRulesInPluginXML.java | 147 +++++++ .../tests/rules/TestValidationRulesInProfile.java | 123 ++++++ 91 files changed, 6505 insertions(+), 8 deletions(-) create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/.classpath create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/.project create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/.settings/org.eclipse.jdt.core.prefs create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/META-INF/MANIFEST.MF create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/about.html create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/build.properties create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/plugin.properties create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/plugin.xml create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/pom.xml create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/src-gen/org/eclipse/papyrus/uml/validation/tests/genvalidation/constraints/AlwaysPassiveConstraint.java create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/src-gen/org/eclipse/papyrus/uml/validation/tests/genvalidation/selectors/AlwaysActiveClientSelector.java create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/src-gen/org/eclipse/papyrus/uml/validation/tests/genvalidation/selectors/AlwaysActiveMalformedClientSelector.java create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/src-gen/org/eclipse/papyrus/uml/validation/tests/genvalidation/selectors/AlwaysPassiveJavaClientSelector.java create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/src-gen/org/eclipse/papyrus/uml/validation/tests/genvalidation/selectors/TstClientSelector.java create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/src/org/eclipse/papyrus/uml/validation/tests/genvalidation/Activator.java create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/.classpath create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/.project create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/.settings/org.eclipse.jdt.core.prefs create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/META-INF/MANIFEST.MF create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/about.html create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/build.properties create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/model/active.rule-in-plugin.profile.di create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/model/active.rule-in-plugin.profile.notation create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/model/active.rule-in-plugin.profile.uml create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/model/profile.ecore create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/model/profile.genmodel create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/plugin.properties create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/plugin.xml create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/pom.xml create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/AlwaysActive.java create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/AlwaysActiveMalformed.java create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/AlwaysPassiveJava.java create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/ProfileFactory.java create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/ProfilePackage.java create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/Tst.java create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/impl/AlwaysActiveImpl.java create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/impl/AlwaysActiveMalformedImpl.java create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/impl/AlwaysPassiveJavaImpl.java create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/impl/ProfileFactoryImpl.java create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/impl/ProfilePackageImpl.java create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/impl/TstImpl.java create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/util/ProfileAdapterFactory.java create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/util/ProfileSwitch.java create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/util/ProfileValidator.java create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src/org/eclipse/papyrus/uml/validation/tests/staticprofile/Activator.java create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/.classpath create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/.project create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/.settings/org.eclipse.jdt.core.prefs create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/.settings/org.eclipse.jdt.ui.prefs create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/META-INF/MANIFEST.MF create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/about.html create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/build.properties create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/plugin.properties create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/pom.xml create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/ExtraUMLValidation.ocl create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/UMLValidationTests.di create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/UMLValidationTests.notation create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/UMLValidationTests.uml create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/active-tst.rule-in-definition.di create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/active-tst.rule-in-definition.notation create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/active-tst.rule-in-definition.uml create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/active-tst.rule-in-plugin.di create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/active-tst.rule-in-plugin.notation create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/active-tst.rule-in-plugin.uml create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/active.rule-in-definition.profile.di create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/active.rule-in-definition.profile.notation create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/active.rule-in-definition.profile.uml create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/active.rule-in-plugin.profile.di create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/instanceSpecification.di create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/instanceSpecification.notation create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/instanceSpecification.uml create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/simple.di create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/simple.notation create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/simple.profile.di create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/simple.profile.notation create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/simple.profile.uml create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/simple.uml create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/src/org/eclipse/papyrus/uml/validation/tests/Activator.java create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/src/org/eclipse/papyrus/uml/validation/tests/AllTests.java create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/src/org/eclipse/papyrus/uml/validation/tests/Messages.java create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/src/org/eclipse/papyrus/uml/validation/tests/messages.properties create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/src/org/eclipse/papyrus/uml/validation/tests/rules/AbstractValidationEditorTest.java create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/src/org/eclipse/papyrus/uml/validation/tests/rules/TestOCLConstraintOnInstanceSpec.java create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/src/org/eclipse/papyrus/uml/validation/tests/rules/TestOCLValidationRuleFromFile.java create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/src/org/eclipse/papyrus/uml/validation/tests/rules/TestStereotypeValidation.java create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/src/org/eclipse/papyrus/uml/validation/tests/rules/TestUMLValidationRules.java create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/src/org/eclipse/papyrus/uml/validation/tests/rules/TestValidationRulesInPluginXML.java create mode 100644 tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/src/org/eclipse/papyrus/uml/validation/tests/rules/TestValidationRulesInProfile.java (limited to 'tests') diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/core/org.eclipse.papyrus.tests/META-INF/MANIFEST.MF index 7d4b0fa1136..d085854059a 100644 --- a/tests/junit/plugins/core/org.eclipse.papyrus.tests/META-INF/MANIFEST.MF +++ b/tests/junit/plugins/core/org.eclipse.papyrus.tests/META-INF/MANIFEST.MF @@ -82,7 +82,8 @@ Require-Bundle: org.eclipse.ui, org.eclipse.xtend.lib;bundle-version="2.8.1", org.eclipse.papyrus.infra.nattable.common.tests;bundle-version="1.2.0", org.eclipse.papyrus.infra.editor.welcome.tests;bundle-version="1.2.0", - org.eclipse.papyrus.infra.gmfdiag.welcome.tests;bundle-version="1.2.0" + org.eclipse.papyrus.infra.gmfdiag.welcome.tests;bundle-version="1.2.0", + org.eclipse.papyrus.uml.validation.tests;bundle-version="1.2.0" Bundle-Vendor: %providerName Bundle-ActivationPolicy: lazy Bundle-Version: 1.2.0.qualifier diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.tests/test/org/eclipse/papyrus/tests/AllTests.java b/tests/junit/plugins/core/org.eclipse.papyrus.tests/test/org/eclipse/papyrus/tests/AllTests.java index 5dad5790078..87f1ea40867 100644 --- a/tests/junit/plugins/core/org.eclipse.papyrus.tests/test/org/eclipse/papyrus/tests/AllTests.java +++ b/tests/junit/plugins/core/org.eclipse.papyrus.tests/test/org/eclipse/papyrus/tests/AllTests.java @@ -114,6 +114,7 @@ public class AllTests { suiteClasses.add(new FragmentTestSuiteClass(org.eclipse.papyrus.uml.profile.Activator.PLUGIN_ID, "org.eclipse.papyrus.uml.profile.tests.AllTests")); suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.decoratormodel.tests.AllTests.class)); suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.decoratormodel.controlmode.tests.AllTests.class)); + suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.validation.tests.AllTests.class)); /* uml diagrams */ suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.diagram.common.tests.tests.AllTests.class)); diff --git a/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/tests/AbstractEditorTest.java b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/tests/AbstractEditorTest.java index b383a22741e..68805b2a4ea 100644 --- a/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/tests/AbstractEditorTest.java +++ b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/tests/AbstractEditorTest.java @@ -69,18 +69,38 @@ public abstract class AbstractEditorTest extends AbstractPapyrusTest { } /** - * Inits this.editor + * Create a new test project + * @param projectName + */ + protected IProject createProject(String projectName) throws Exception { + project = ProjectUtils.createProject(projectName); + return project; + } + + /** + * Initializes this editor * Fails or throws an exception if an error occurs * - * @param bundle - * the source bundle where the model is store * @param projectName - * the project that will created at runtime to execute test + * the project that will be created at runtime to execute the test * @param modelName * the model that will be copied and test executed on. + * @param bundle + * the source bundle where the model is stored */ protected void initModel(String projectName, String modelName, Bundle bundle) throws Exception { - project = ProjectUtils.createProject(projectName); + createProject(projectName); + initModel(modelName, bundle); + } + + /** + * Initializes this editor. Should be called, after a previous invocation of createProject() + * + * @param modelName + * @param bundle + * @throws Exception + */ + protected void initModel(String modelName, Bundle bundle) throws Exception { this.diModelFile = PapyrusProjectUtils.copyPapyrusModel(project, bundle, getSourcePath(), modelName); Display.getDefault().syncExec(new Runnable() { @@ -97,6 +117,21 @@ public abstract class AbstractEditorTest extends AbstractPapyrusTest { Assert.assertNotNull(editor); } + + /** + * copy a model into the workspace, e.g. a profile that is required by the test model + * + * @param projectName + * the project that will be created at runtime to execute the test + * @param modelName + * the model that will be copied and test executed on. + * @param bundle + * the source bundle where the model is stored + */ + protected void copyModel(String modelName, Bundle bundle) throws Exception { + PapyrusProjectUtils.copyPapyrusModel(project, bundle, getSourcePath(), modelName); + } + @After public void dispose() throws Exception { if(editor != null) { @@ -151,14 +186,13 @@ public abstract class AbstractEditorTest extends AbstractPapyrusTest { IModel umlIModel; try { - umlIModel = getModelSet().getModel("org.eclipse.papyrus.infra.core.resource.uml.UmlModel"); + umlIModel = getModelSet().getModel("org.eclipse.papyrus.infra.core.resource.uml.UmlModel"); //$NON-NLS-1$ AbstractBaseModel umlModel = null; if(umlIModel instanceof AbstractBaseModel) { umlModel = (AbstractBaseModel)umlIModel; } - Assert.assertFalse("umlRessource contains nothing", umlModel.getResource().getContents().isEmpty()); Object root = umlModel.getResource().getContents().get(0); Assert.assertFalse("the root of UML model is not a package", root instanceof Package); @@ -167,6 +201,7 @@ public abstract class AbstractEditorTest extends AbstractPapyrusTest { } catch (ServiceException e) { Assert.fail(e.getMessage()); } + // not reachable due to asserts above (no check by caller) return null; } diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/.classpath b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/.classpath new file mode 100644 index 00000000000..f0c55498599 --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/.project b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/.project new file mode 100644 index 00000000000..cacdf4fa9f0 --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/.project @@ -0,0 +1,28 @@ + + + org.eclipse.papyrus.uml.validation.tests.genvalidation + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/.settings/org.eclipse.jdt.core.prefs b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000000..0c68a61dca8 --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/META-INF/MANIFEST.MF b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..f52c71284aa --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/META-INF/MANIFEST.MF @@ -0,0 +1,15 @@ +Manifest-Version: 1.0 +Bundle-SymbolicName: org.eclipse.papyrus.uml.validation.tests.genvalidation;singleton:=true +Bundle-Name: %pluginName +Bundle-Version: 1.2.0.qualifier +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + org.eclipse.emf.validation, + org.eclipse.papyrus.uml.service.validation;bundle-version="1.2.0", + org.eclipse.uml2.uml, + org.eclipse.papyrus.uml.validation.tests.staticprofile;bundle-version="1.2.0" +Bundle-ManifestVersion: 2 +Bundle-Activator: org.eclipse.papyrus.uml.validation.tests.genvalidation.Activator +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-ActivationPolicy: lazy +Bundle-Vendor: %providerName diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/about.html b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/about.html new file mode 100644 index 00000000000..209103075a7 --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/about.html @@ -0,0 +1,28 @@ + + + + +About + + +

About This Content

+ +

November 14, 2008

+

License

+ +

The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise +indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at http://www.eclipse.org/legal/epl-v10.html. +For purposes of the EPL, "Program" will mean the Content.

+ +

If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor's license that was +provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at http://www.eclipse.org.

+ + + \ No newline at end of file diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/build.properties b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/build.properties new file mode 100644 index 00000000000..95c382e812f --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/build.properties @@ -0,0 +1,9 @@ +# +#Thu Dec 10 14:47:20 CET 2015 +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + plugin.properties,\ + about.html +output..=bin/ +source..=src/,src-gen/ diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/plugin.properties b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/plugin.properties new file mode 100644 index 00000000000..1a8acee639b --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/plugin.properties @@ -0,0 +1,12 @@ +################################################################################ +# Copyright (c) 2015 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: +# Ansgar Radermacher (CEA LIST) ansgar.radermacher@cea.fr - initial API and implementation +################################################################################ +pluginName=Generated Papyrus UML validation plugin +pluginProvider=Eclipse Modeling Project diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/plugin.xml b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/plugin.xml new file mode 100644 index 00000000000..bdaf55e5470 --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/plugin.xml @@ -0,0 +1,38 @@ + + + + + + + + + Custom message + + Constraint 'ConstraintAlwaysActiveMF' is violated + + Constraint 'AlwaysPassive' is violated + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/pom.xml b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/pom.xml new file mode 100644 index 00000000000..85b61c9606c --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + + org.eclipse.papyrus + org.eclipse.papyrus.tests.releng + 1.2.0-SNAPSHOT + ../../../../../../releng/main-tests + + org.eclipse.papyrus + org.eclipse.papyrus.uml.validation.tests.genvalidation + 1.2.0-SNAPSHOT + eclipse-test-plugin + diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/src-gen/org/eclipse/papyrus/uml/validation/tests/genvalidation/constraints/AlwaysPassiveConstraint.java b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/src-gen/org/eclipse/papyrus/uml/validation/tests/genvalidation/constraints/AlwaysPassiveConstraint.java new file mode 100644 index 00000000000..a47783d8282 --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/src-gen/org/eclipse/papyrus/uml/validation/tests/genvalidation/constraints/AlwaysPassiveConstraint.java @@ -0,0 +1,32 @@ +/** + * Created by the Papyrus DSML plugin generator + */ + +package org.eclipse.papyrus.uml.validation.tests.genvalidation.constraints; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.emf.validation.AbstractModelConstraint; +import org.eclipse.emf.validation.IValidationContext; +import org.eclipse.emf.ecore.EObject; + +public class AlwaysPassiveConstraint extends AbstractModelConstraint { + + public IStatus validate(IValidationContext ctx) { + EObject target = ctx.getTarget(); + + if (target instanceof profile.AlwaysPassiveJava) { + if (evaluateConstraint((profile.AlwaysPassiveJava) target)) { + return ctx.createSuccessStatus(); + } + else { + return ctx.createFailureStatus(""); //$NON-NLS-1$ failure message is in plugin.xml + } + } + return ctx.createSuccessStatus(); + } + + private boolean evaluateConstraint(profile.AlwaysPassiveJava self) { + return !self.getBase_Class().isActive(); + } + +} diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/src-gen/org/eclipse/papyrus/uml/validation/tests/genvalidation/selectors/AlwaysActiveClientSelector.java b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/src-gen/org/eclipse/papyrus/uml/validation/tests/genvalidation/selectors/AlwaysActiveClientSelector.java new file mode 100644 index 00000000000..db4e878e661 --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/src-gen/org/eclipse/papyrus/uml/validation/tests/genvalidation/selectors/AlwaysActiveClientSelector.java @@ -0,0 +1,21 @@ +/** + * Created by the Papyrus DSML plugin generator + */ + +package org.eclipse.papyrus.uml.validation.tests.genvalidation.selectors; + +import org.eclipse.emf.validation.model.IClientSelector; +import org.eclipse.papyrus.uml.service.validation.StereotypeUtil; + +/** + * This class filters (selects) passed stereotype applications. It returns true, if the + * associated stereotype (or one of its super-stereotypes) has the name '[stereotype.name/]'. + * + * @generated + */ +public class AlwaysActiveClientSelector implements IClientSelector { + + public boolean selects(Object stereoApplicationObj) { + return StereotypeUtil.checkStereoApplication(stereoApplicationObj, "AlwaysActive"); //$NON-NLS-1$ + } +} diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/src-gen/org/eclipse/papyrus/uml/validation/tests/genvalidation/selectors/AlwaysActiveMalformedClientSelector.java b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/src-gen/org/eclipse/papyrus/uml/validation/tests/genvalidation/selectors/AlwaysActiveMalformedClientSelector.java new file mode 100644 index 00000000000..2c6f848718e --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/src-gen/org/eclipse/papyrus/uml/validation/tests/genvalidation/selectors/AlwaysActiveMalformedClientSelector.java @@ -0,0 +1,21 @@ +/** + * Created by the Papyrus DSML plugin generator + */ + +package org.eclipse.papyrus.uml.validation.tests.genvalidation.selectors; + +import org.eclipse.emf.validation.model.IClientSelector; +import org.eclipse.papyrus.uml.service.validation.StereotypeUtil; + +/** + * This class filters (selects) passed stereotype applications. It returns true, if the + * associated stereotype (or one of its super-stereotypes) has the name '[stereotype.name/]'. + * + * @generated + */ +public class AlwaysActiveMalformedClientSelector implements IClientSelector { + + public boolean selects(Object stereoApplicationObj) { + return StereotypeUtil.checkStereoApplication(stereoApplicationObj, "AlwaysActiveMalformed"); //$NON-NLS-1$ + } +} diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/src-gen/org/eclipse/papyrus/uml/validation/tests/genvalidation/selectors/AlwaysPassiveJavaClientSelector.java b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/src-gen/org/eclipse/papyrus/uml/validation/tests/genvalidation/selectors/AlwaysPassiveJavaClientSelector.java new file mode 100644 index 00000000000..585592c5468 --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/src-gen/org/eclipse/papyrus/uml/validation/tests/genvalidation/selectors/AlwaysPassiveJavaClientSelector.java @@ -0,0 +1,21 @@ +/** + * Created by the Papyrus DSML plugin generator + */ + +package org.eclipse.papyrus.uml.validation.tests.genvalidation.selectors; + +import org.eclipse.emf.validation.model.IClientSelector; +import org.eclipse.papyrus.uml.service.validation.StereotypeUtil; + +/** + * This class filters (selects) passed stereotype applications. It returns true, if the + * associated stereotype (or one of its super-stereotypes) has the name '[stereotype.name/]'. + * + * @generated + */ +public class AlwaysPassiveJavaClientSelector implements IClientSelector { + + public boolean selects(Object stereoApplicationObj) { + return StereotypeUtil.checkStereoApplication(stereoApplicationObj, "AlwaysPassiveJava"); //$NON-NLS-1$ + } +} diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/src-gen/org/eclipse/papyrus/uml/validation/tests/genvalidation/selectors/TstClientSelector.java b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/src-gen/org/eclipse/papyrus/uml/validation/tests/genvalidation/selectors/TstClientSelector.java new file mode 100644 index 00000000000..b85f2b3d0f2 --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/src-gen/org/eclipse/papyrus/uml/validation/tests/genvalidation/selectors/TstClientSelector.java @@ -0,0 +1,21 @@ +/** + * Created by the Papyrus DSML plugin generator + */ + +package org.eclipse.papyrus.uml.validation.tests.genvalidation.selectors; + +import org.eclipse.emf.validation.model.IClientSelector; +import org.eclipse.papyrus.uml.service.validation.StereotypeUtil; + +/** + * This class filters (selects) passed stereotype applications. It returns true, if the + * associated stereotype (or one of its super-stereotypes) has the name '[stereotype.name/]'. + * + * @generated + */ +public class TstClientSelector implements IClientSelector { + + public boolean selects(Object stereoApplicationObj) { + return StereotypeUtil.checkStereoApplication(stereoApplicationObj, "Tst"); //$NON-NLS-1$ + } +} diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/src/org/eclipse/papyrus/uml/validation/tests/genvalidation/Activator.java b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/src/org/eclipse/papyrus/uml/validation/tests/genvalidation/Activator.java new file mode 100644 index 00000000000..cd9c5b56c8a --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.genvalidation/src/org/eclipse/papyrus/uml/validation/tests/genvalidation/Activator.java @@ -0,0 +1,50 @@ +package org.eclipse.papyrus.uml.validation.tests.genvalidation; + +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "org.eclipse.papyrus.uml.validation.tests.genvalidation"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + +} diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/.classpath b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/.classpath new file mode 100644 index 00000000000..f0c55498599 --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/.project b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/.project new file mode 100644 index 00000000000..29810290d46 --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/.project @@ -0,0 +1,28 @@ + + + org.eclipse.papyrus.uml.validation.tests.staticprofile + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/.settings/org.eclipse.jdt.core.prefs b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000000..0c68a61dca8 --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/META-INF/MANIFEST.MF b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..4bb78d4cd42 --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/META-INF/MANIFEST.MF @@ -0,0 +1,22 @@ +Manifest-Version: 1.0 +Bundle-SymbolicName: org.eclipse.papyrus.uml.validation.tests.staticprofile;singleton:=true +Export-Package: org.eclipse.papyrus.uml.validation.tests.staticprofile, + profile, + profile.impl, + profile.util +Bundle-Name: %pluginName +Bundle-Version: 1.2.0.qualifier +Bundle-ClassPath: . +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + org.eclipse.emf.common;bundle-version="2.12.0", + org.eclipse.emf.ecore;bundle-version="2.12.0";visibility:=reexport, + org.eclipse.uml2.types;visibility:=reexport, + org.eclipse.uml2.uml;bundle-version="5.1.100";visibility:=reexport, + org.eclipse.papyrus.dsml.validation +Bundle-ManifestVersion: 2 +Bundle-Activator: org.eclipse.papyrus.uml.validation.tests.staticprofile.Activator +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-ActivationPolicy: lazy +Bundle-Vendor: %providerName +Bundle-Localization: plugin diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/about.html b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/about.html new file mode 100644 index 00000000000..209103075a7 --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/about.html @@ -0,0 +1,28 @@ + + + + +About + + +

About This Content

+ +

November 14, 2008

+

License

+ +

The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise +indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at http://www.eclipse.org/legal/epl-v10.html. +For purposes of the EPL, "Program" will mean the Content.

+ +

If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor's license that was +provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at http://www.eclipse.org.

+ + + \ No newline at end of file diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/build.properties b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/build.properties new file mode 100644 index 00000000000..c1b1c5b70fa --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/build.properties @@ -0,0 +1,7 @@ +source.. = src/,src-gen/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + plugin.properties,\ + about.html diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/model/active.rule-in-plugin.profile.di b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/model/active.rule-in-plugin.profile.di new file mode 100644 index 00000000000..bf9abab340f --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/model/active.rule-in-plugin.profile.di @@ -0,0 +1,2 @@ + + diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/model/active.rule-in-plugin.profile.notation b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/model/active.rule-in-plugin.profile.notation new file mode 100644 index 00000000000..aac46fc1fe3 --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/model/active.rule-in-plugin.profile.notation @@ -0,0 +1,236 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/model/active.rule-in-plugin.profile.uml b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/model/active.rule-in-plugin.profile.uml new file mode 100644 index 00000000000..7dac2ce2d05 --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/model/active.rule-in-plugin.profile.uml @@ -0,0 +1,76 @@ + + + + + + + + + + + + + OCL + base_Class.isActive + + + + + + + + + + + + + + + + + + + + + OCL + self.oclAsType(Class).isActive + + + + + + + + + + + + + JAVA + return !self.getBase_Class().isActive(); + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/model/profile.ecore b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/model/profile.ecore new file mode 100644 index 00000000000..6b8fee1f557 --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/model/profile.ecore @@ -0,0 +1,77 @@ + + + + + +
+ + + +
+ + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+ + + + +
+ + + + + + + + + + + + +
+ + + +
+ + + + +
+ + + + + + + + + + diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/model/profile.genmodel b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/model/profile.genmodel new file mode 100644 index 00000000000..cea809bbb8f --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/model/profile.genmodel @@ -0,0 +1,35 @@ + + + profile.ecore + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/plugin.properties b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/plugin.properties new file mode 100644 index 00000000000..0a5674b3c8d --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/plugin.properties @@ -0,0 +1,13 @@ +################################################################################ +# Copyright (c) 2015 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: +# Ansgar Radermacher (CEA LIST) ansgar.radermacher@cea.fr - initial API and implementation +################################################################################ +pluginName=Static profile for Papyrus UML validation tests +pluginProvider=Eclipse Modeling Project +providerName = www.example.org diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/plugin.xml b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/plugin.xml new file mode 100644 index 00000000000..19a6070416f --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/plugin.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/pom.xml b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/pom.xml new file mode 100644 index 00000000000..7abdb98345d --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + + org.eclipse.papyrus + org.eclipse.papyrus.tests.releng + 1.2.0-SNAPSHOT + ../../../../../../releng/main-tests + + org.eclipse.papyrus + org.eclipse.papyrus.uml.validation.tests.staticprofile + 1.2.0-SNAPSHOT + eclipse-test-plugin + diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/AlwaysActive.java b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/AlwaysActive.java new file mode 100644 index 00000000000..1dd3fe5c004 --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/AlwaysActive.java @@ -0,0 +1,66 @@ +/** + */ +package profile; + +import java.util.Map; + +import org.eclipse.emf.common.util.DiagnosticChain; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Always Active'. + * + * + *

+ * The following features are supported: + *

+ *
    + *
  • {@link profile.AlwaysActive#getBase_Class Base Class}
  • + *
+ * + * @see profile.ProfilePackage#getAlwaysActive() + * @model + * @generated + */ +public interface AlwaysActive extends EObject { + /** + * Returns the value of the 'Base Class' reference. + * + *

+ * If the meaning of the 'Base Class' reference isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Base Class' reference. + * @see #setBase_Class(org.eclipse.uml2.uml.Class) + * @see profile.ProfilePackage#getAlwaysActive_Base_Class() + * @model required="true" ordered="false" + * @generated + */ + org.eclipse.uml2.uml.Class getBase_Class(); + + /** + * Sets the value of the '{@link profile.AlwaysActive#getBase_Class Base Class}' reference. + * + * + * @param value the new value of the 'Base Class' reference. + * @see #getBase_Class() + * @generated + */ + void setBase_Class(org.eclipse.uml2.uml.Class value); + + /** + * + * + * + * @param diagnostics The chain of diagnostics to which problems are to be appended. + * @param context The cache of context-specific information. + * + * @model annotation="http://www.eclipse.org/uml2/1.1.0/GenModel body='base_Class.isActive'" + * @generated + */ + boolean ConstraintAlwaysActive(DiagnosticChain diagnostics, Map context); + +} // AlwaysActive diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/AlwaysActiveMalformed.java b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/AlwaysActiveMalformed.java new file mode 100644 index 00000000000..3c6c910e8a1 --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/AlwaysActiveMalformed.java @@ -0,0 +1,66 @@ +/** + */ +package profile; + +import java.util.Map; + +import org.eclipse.emf.common.util.DiagnosticChain; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Always Active Malformed'. + * + * + *

+ * The following features are supported: + *

+ *
    + *
  • {@link profile.AlwaysActiveMalformed#getBase_Class Base Class}
  • + *
+ * + * @see profile.ProfilePackage#getAlwaysActiveMalformed() + * @model + * @generated + */ +public interface AlwaysActiveMalformed extends EObject { + /** + * Returns the value of the 'Base Class' reference. + * + *

+ * If the meaning of the 'Base Class' reference isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Base Class' reference. + * @see #setBase_Class(org.eclipse.uml2.uml.Class) + * @see profile.ProfilePackage#getAlwaysActiveMalformed_Base_Class() + * @model required="true" ordered="false" + * @generated + */ + org.eclipse.uml2.uml.Class getBase_Class(); + + /** + * Sets the value of the '{@link profile.AlwaysActiveMalformed#getBase_Class Base Class}' reference. + * + * + * @param value the new value of the 'Base Class' reference. + * @see #getBase_Class() + * @generated + */ + void setBase_Class(org.eclipse.uml2.uml.Class value); + + /** + * + * + * + * @param diagnostics The chain of diagnostics to which problems are to be appended. + * @param context The cache of context-specific information. + * + * @model annotation="http://www.eclipse.org/uml2/1.1.0/GenModel body='self.oclAsType(Class).isActive'" + * @generated + */ + boolean ConstraintAlwaysActiveMF(DiagnosticChain diagnostics, Map context); + +} // AlwaysActiveMalformed diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/AlwaysPassiveJava.java b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/AlwaysPassiveJava.java new file mode 100644 index 00000000000..ed6af169604 --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/AlwaysPassiveJava.java @@ -0,0 +1,66 @@ +/** + */ +package profile; + +import java.util.Map; + +import org.eclipse.emf.common.util.DiagnosticChain; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Always Passive Java'. + * + * + *

+ * The following features are supported: + *

+ *
    + *
  • {@link profile.AlwaysPassiveJava#getBase_Class Base Class}
  • + *
+ * + * @see profile.ProfilePackage#getAlwaysPassiveJava() + * @model + * @generated + */ +public interface AlwaysPassiveJava extends EObject { + /** + * Returns the value of the 'Base Class' reference. + * + *

+ * If the meaning of the 'Base Class' reference isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Base Class' reference. + * @see #setBase_Class(org.eclipse.uml2.uml.Class) + * @see profile.ProfilePackage#getAlwaysPassiveJava_Base_Class() + * @model required="true" ordered="false" + * @generated + */ + org.eclipse.uml2.uml.Class getBase_Class(); + + /** + * Sets the value of the '{@link profile.AlwaysPassiveJava#getBase_Class Base Class}' reference. + * + * + * @param value the new value of the 'Base Class' reference. + * @see #getBase_Class() + * @generated + */ + void setBase_Class(org.eclipse.uml2.uml.Class value); + + /** + * + * + * + * @param diagnostics The chain of diagnostics to which problems are to be appended. + * @param context The cache of context-specific information. + * + * @model annotation="http://www.eclipse.org/uml2/1.1.0/GenModel body='return !self.getBase_Class().isActive();'" + * @generated + */ + boolean AlwaysPassive(DiagnosticChain diagnostics, Map context); + +} // AlwaysPassiveJava diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/ProfileFactory.java b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/ProfileFactory.java new file mode 100644 index 00000000000..4b4dd195497 --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/ProfileFactory.java @@ -0,0 +1,69 @@ +/** + */ +package profile; + +import org.eclipse.emf.ecore.EFactory; + +/** + * + * The Factory for the model. + * It provides a create method for each non-abstract class of the model. + * + * @see profile.ProfilePackage + * @generated + */ +public interface ProfileFactory extends EFactory { + /** + * The singleton instance of the factory. + * + * + * @generated + */ + ProfileFactory eINSTANCE = profile.impl.ProfileFactoryImpl.init(); + + /** + * Returns a new object of class 'Always Active'. + * + * + * @return a new object of class 'Always Active'. + * @generated + */ + AlwaysActive createAlwaysActive(); + + /** + * Returns a new object of class 'Tst'. + * + * + * @return a new object of class 'Tst'. + * @generated + */ + Tst createTst(); + + /** + * Returns a new object of class 'Always Active Malformed'. + * + * + * @return a new object of class 'Always Active Malformed'. + * @generated + */ + AlwaysActiveMalformed createAlwaysActiveMalformed(); + + /** + * Returns a new object of class 'Always Passive Java'. + * + * + * @return a new object of class 'Always Passive Java'. + * @generated + */ + AlwaysPassiveJava createAlwaysPassiveJava(); + + /** + * Returns the package supported by this factory. + * + * + * @return the package supported by this factory. + * @generated + */ + ProfilePackage getProfilePackage(); + +} //ProfileFactory diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/ProfilePackage.java b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/ProfilePackage.java new file mode 100644 index 00000000000..eb547e71885 --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/ProfilePackage.java @@ -0,0 +1,470 @@ +/** + */ +package profile; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EOperation; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; + +/** + * + * The Package for the model. + * It contains accessors for the meta objects to represent + *
    + *
  • each class,
  • + *
  • each feature of each class,
  • + *
  • each operation of each class,
  • + *
  • each enum,
  • + *
  • and each data type
  • + *
+ * + * @see profile.ProfileFactory + * @model kind="package" + * @generated + */ +public interface ProfilePackage extends EPackage { + /** + * The package name. + * + * + * @generated + */ + String eNAME = "profile"; + + /** + * The package namespace URI. + * + * + * @generated + */ + String eNS_URI = "http://org.eclipse.papyrus/activetest/1"; + + /** + * The package namespace name. + * + * + * @generated + */ + String eNS_PREFIX = "profile"; + + /** + * The singleton instance of the package. + * + * + * @generated + */ + ProfilePackage eINSTANCE = profile.impl.ProfilePackageImpl.init(); + + /** + * The meta object id for the '{@link profile.impl.AlwaysActiveImpl Always Active}' class. + * + * + * @see profile.impl.AlwaysActiveImpl + * @see profile.impl.ProfilePackageImpl#getAlwaysActive() + * @generated + */ + int ALWAYS_ACTIVE = 0; + + /** + * The feature id for the 'Base Class' reference. + * + * + * @generated + * @ordered + */ + int ALWAYS_ACTIVE__BASE_CLASS = 0; + + /** + * The number of structural features of the 'Always Active' class. + * + * + * @generated + * @ordered + */ + int ALWAYS_ACTIVE_FEATURE_COUNT = 1; + + /** + * The operation id for the 'Constraint Always Active' operation. + * + * + * @generated + * @ordered + */ + int ALWAYS_ACTIVE___CONSTRAINT_ALWAYS_ACTIVE__DIAGNOSTICCHAIN_MAP = 0; + + /** + * The number of operations of the 'Always Active' class. + * + * + * @generated + * @ordered + */ + int ALWAYS_ACTIVE_OPERATION_COUNT = 1; + + /** + * The meta object id for the '{@link profile.impl.TstImpl Tst}' class. + * + * + * @see profile.impl.TstImpl + * @see profile.impl.ProfilePackageImpl#getTst() + * @generated + */ + int TST = 1; + + /** + * The feature id for the 'Base Package' reference. + * + * + * @generated + * @ordered + */ + int TST__BASE_PACKAGE = 0; + + /** + * The number of structural features of the 'Tst' class. + * + * + * @generated + * @ordered + */ + int TST_FEATURE_COUNT = 1; + + /** + * The number of operations of the 'Tst' class. + * + * + * @generated + * @ordered + */ + int TST_OPERATION_COUNT = 0; + + /** + * The meta object id for the '{@link profile.impl.AlwaysActiveMalformedImpl Always Active Malformed}' class. + * + * + * @see profile.impl.AlwaysActiveMalformedImpl + * @see profile.impl.ProfilePackageImpl#getAlwaysActiveMalformed() + * @generated + */ + int ALWAYS_ACTIVE_MALFORMED = 2; + + /** + * The feature id for the 'Base Class' reference. + * + * + * @generated + * @ordered + */ + int ALWAYS_ACTIVE_MALFORMED__BASE_CLASS = 0; + + /** + * The number of structural features of the 'Always Active Malformed' class. + * + * + * @generated + * @ordered + */ + int ALWAYS_ACTIVE_MALFORMED_FEATURE_COUNT = 1; + + /** + * The operation id for the 'Constraint Always Active MF' operation. + * + * + * @generated + * @ordered + */ + int ALWAYS_ACTIVE_MALFORMED___CONSTRAINT_ALWAYS_ACTIVE_MF__DIAGNOSTICCHAIN_MAP = 0; + + /** + * The number of operations of the 'Always Active Malformed' class. + * + * + * @generated + * @ordered + */ + int ALWAYS_ACTIVE_MALFORMED_OPERATION_COUNT = 1; + + /** + * The meta object id for the '{@link profile.impl.AlwaysPassiveJavaImpl Always Passive Java}' class. + * + * + * @see profile.impl.AlwaysPassiveJavaImpl + * @see profile.impl.ProfilePackageImpl#getAlwaysPassiveJava() + * @generated + */ + int ALWAYS_PASSIVE_JAVA = 3; + + /** + * The feature id for the 'Base Class' reference. + * + * + * @generated + * @ordered + */ + int ALWAYS_PASSIVE_JAVA__BASE_CLASS = 0; + + /** + * The number of structural features of the 'Always Passive Java' class. + * + * + * @generated + * @ordered + */ + int ALWAYS_PASSIVE_JAVA_FEATURE_COUNT = 1; + + /** + * The operation id for the 'Always Passive' operation. + * + * + * @generated + * @ordered + */ + int ALWAYS_PASSIVE_JAVA___ALWAYS_PASSIVE__DIAGNOSTICCHAIN_MAP = 0; + + /** + * The number of operations of the 'Always Passive Java' class. + * + * + * @generated + * @ordered + */ + int ALWAYS_PASSIVE_JAVA_OPERATION_COUNT = 1; + + + /** + * Returns the meta object for class '{@link profile.AlwaysActive Always Active}'. + * + * + * @return the meta object for class 'Always Active'. + * @see profile.AlwaysActive + * @generated + */ + EClass getAlwaysActive(); + + /** + * Returns the meta object for the reference '{@link profile.AlwaysActive#getBase_Class Base Class}'. + * + * + * @return the meta object for the reference 'Base Class'. + * @see profile.AlwaysActive#getBase_Class() + * @see #getAlwaysActive() + * @generated + */ + EReference getAlwaysActive_Base_Class(); + + /** + * Returns the meta object for the '{@link profile.AlwaysActive#ConstraintAlwaysActive(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) Constraint Always Active}' operation. + * + * + * @return the meta object for the 'Constraint Always Active' operation. + * @see profile.AlwaysActive#ConstraintAlwaysActive(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) + * @generated + */ + EOperation getAlwaysActive__ConstraintAlwaysActive__DiagnosticChain_Map(); + + /** + * Returns the meta object for class '{@link profile.Tst Tst}'. + * + * + * @return the meta object for class 'Tst'. + * @see profile.Tst + * @generated + */ + EClass getTst(); + + /** + * Returns the meta object for the reference '{@link profile.Tst#getBase_Package Base Package}'. + * + * + * @return the meta object for the reference 'Base Package'. + * @see profile.Tst#getBase_Package() + * @see #getTst() + * @generated + */ + EReference getTst_Base_Package(); + + /** + * Returns the meta object for class '{@link profile.AlwaysActiveMalformed Always Active Malformed}'. + * + * + * @return the meta object for class 'Always Active Malformed'. + * @see profile.AlwaysActiveMalformed + * @generated + */ + EClass getAlwaysActiveMalformed(); + + /** + * Returns the meta object for the reference '{@link profile.AlwaysActiveMalformed#getBase_Class Base Class}'. + * + * + * @return the meta object for the reference 'Base Class'. + * @see profile.AlwaysActiveMalformed#getBase_Class() + * @see #getAlwaysActiveMalformed() + * @generated + */ + EReference getAlwaysActiveMalformed_Base_Class(); + + /** + * Returns the meta object for the '{@link profile.AlwaysActiveMalformed#ConstraintAlwaysActiveMF(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) Constraint Always Active MF}' operation. + * + * + * @return the meta object for the 'Constraint Always Active MF' operation. + * @see profile.AlwaysActiveMalformed#ConstraintAlwaysActiveMF(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) + * @generated + */ + EOperation getAlwaysActiveMalformed__ConstraintAlwaysActiveMF__DiagnosticChain_Map(); + + /** + * Returns the meta object for class '{@link profile.AlwaysPassiveJava Always Passive Java}'. + * + * + * @return the meta object for class 'Always Passive Java'. + * @see profile.AlwaysPassiveJava + * @generated + */ + EClass getAlwaysPassiveJava(); + + /** + * Returns the meta object for the reference '{@link profile.AlwaysPassiveJava#getBase_Class Base Class}'. + * + * + * @return the meta object for the reference 'Base Class'. + * @see profile.AlwaysPassiveJava#getBase_Class() + * @see #getAlwaysPassiveJava() + * @generated + */ + EReference getAlwaysPassiveJava_Base_Class(); + + /** + * Returns the meta object for the '{@link profile.AlwaysPassiveJava#AlwaysPassive(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) Always Passive}' operation. + * + * + * @return the meta object for the 'Always Passive' operation. + * @see profile.AlwaysPassiveJava#AlwaysPassive(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) + * @generated + */ + EOperation getAlwaysPassiveJava__AlwaysPassive__DiagnosticChain_Map(); + + /** + * Returns the factory that creates the instances of the model. + * + * + * @return the factory that creates the instances of the model. + * @generated + */ + ProfileFactory getProfileFactory(); + + /** + * + * Defines literals for the meta objects that represent + *
    + *
  • each class,
  • + *
  • each feature of each class,
  • + *
  • each operation of each class,
  • + *
  • each enum,
  • + *
  • and each data type
  • + *
+ * + * @generated + */ + interface Literals { + /** + * The meta object literal for the '{@link profile.impl.AlwaysActiveImpl Always Active}' class. + * + * + * @see profile.impl.AlwaysActiveImpl + * @see profile.impl.ProfilePackageImpl#getAlwaysActive() + * @generated + */ + EClass ALWAYS_ACTIVE = eINSTANCE.getAlwaysActive(); + + /** + * The meta object literal for the 'Base Class' reference feature. + * + * + * @generated + */ + EReference ALWAYS_ACTIVE__BASE_CLASS = eINSTANCE.getAlwaysActive_Base_Class(); + + /** + * The meta object literal for the 'Constraint Always Active' operation. + * + * + * @generated + */ + EOperation ALWAYS_ACTIVE___CONSTRAINT_ALWAYS_ACTIVE__DIAGNOSTICCHAIN_MAP = eINSTANCE.getAlwaysActive__ConstraintAlwaysActive__DiagnosticChain_Map(); + + /** + * The meta object literal for the '{@link profile.impl.TstImpl Tst}' class. + * + * + * @see profile.impl.TstImpl + * @see profile.impl.ProfilePackageImpl#getTst() + * @generated + */ + EClass TST = eINSTANCE.getTst(); + + /** + * The meta object literal for the 'Base Package' reference feature. + * + * + * @generated + */ + EReference TST__BASE_PACKAGE = eINSTANCE.getTst_Base_Package(); + + /** + * The meta object literal for the '{@link profile.impl.AlwaysActiveMalformedImpl Always Active Malformed}' class. + * + * + * @see profile.impl.AlwaysActiveMalformedImpl + * @see profile.impl.ProfilePackageImpl#getAlwaysActiveMalformed() + * @generated + */ + EClass ALWAYS_ACTIVE_MALFORMED = eINSTANCE.getAlwaysActiveMalformed(); + + /** + * The meta object literal for the 'Base Class' reference feature. + * + * + * @generated + */ + EReference ALWAYS_ACTIVE_MALFORMED__BASE_CLASS = eINSTANCE.getAlwaysActiveMalformed_Base_Class(); + + /** + * The meta object literal for the 'Constraint Always Active MF' operation. + * + * + * @generated + */ + EOperation ALWAYS_ACTIVE_MALFORMED___CONSTRAINT_ALWAYS_ACTIVE_MF__DIAGNOSTICCHAIN_MAP = eINSTANCE.getAlwaysActiveMalformed__ConstraintAlwaysActiveMF__DiagnosticChain_Map(); + + /** + * The meta object literal for the '{@link profile.impl.AlwaysPassiveJavaImpl Always Passive Java}' class. + * + * + * @see profile.impl.AlwaysPassiveJavaImpl + * @see profile.impl.ProfilePackageImpl#getAlwaysPassiveJava() + * @generated + */ + EClass ALWAYS_PASSIVE_JAVA = eINSTANCE.getAlwaysPassiveJava(); + + /** + * The meta object literal for the 'Base Class' reference feature. + * + * + * @generated + */ + EReference ALWAYS_PASSIVE_JAVA__BASE_CLASS = eINSTANCE.getAlwaysPassiveJava_Base_Class(); + + /** + * The meta object literal for the 'Always Passive' operation. + * + * + * @generated + */ + EOperation ALWAYS_PASSIVE_JAVA___ALWAYS_PASSIVE__DIAGNOSTICCHAIN_MAP = eINSTANCE.getAlwaysPassiveJava__AlwaysPassive__DiagnosticChain_Map(); + + } + +} //ProfilePackage diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/Tst.java b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/Tst.java new file mode 100644 index 00000000000..649f133bc7d --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/Tst.java @@ -0,0 +1,50 @@ +/** + */ +package profile; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Tst'. + * + * + *

+ * The following features are supported: + *

+ *
    + *
  • {@link profile.Tst#getBase_Package Base Package}
  • + *
+ * + * @see profile.ProfilePackage#getTst() + * @model + * @generated + */ +public interface Tst extends EObject { + /** + * Returns the value of the 'Base Package' reference. + * + *

+ * If the meaning of the 'Base Package' reference isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Base Package' reference. + * @see #setBase_Package(org.eclipse.uml2.uml.Package) + * @see profile.ProfilePackage#getTst_Base_Package() + * @model required="true" ordered="false" + * @generated + */ + org.eclipse.uml2.uml.Package getBase_Package(); + + /** + * Sets the value of the '{@link profile.Tst#getBase_Package Base Package}' reference. + * + * + * @param value the new value of the 'Base Package' reference. + * @see #getBase_Package() + * @generated + */ + void setBase_Package(org.eclipse.uml2.uml.Package value); + +} // Tst diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/impl/AlwaysActiveImpl.java b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/impl/AlwaysActiveImpl.java new file mode 100644 index 00000000000..88801aa6be5 --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/impl/AlwaysActiveImpl.java @@ -0,0 +1,211 @@ +/** + */ +package profile.impl; + +import java.lang.reflect.InvocationTargetException; + +import java.util.Map; + +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.common.util.BasicDiagnostic; +import org.eclipse.emf.common.util.Diagnostic; +import org.eclipse.emf.common.util.DiagnosticChain; +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; + +import org.eclipse.emf.ecore.plugin.EcorePlugin; + +import org.eclipse.emf.ecore.util.EObjectValidator; + +import profile.AlwaysActive; +import profile.ProfilePackage; + +import profile.util.ProfileValidator; + +/** + * + * An implementation of the model object 'Always Active'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link profile.impl.AlwaysActiveImpl#getBase_Class Base Class}
  • + *
+ * + * @generated + */ +public class AlwaysActiveImpl extends MinimalEObjectImpl.Container implements AlwaysActive { + /** + * The cached value of the '{@link #getBase_Class() Base Class}' reference. + * + * + * @see #getBase_Class() + * @generated + * @ordered + */ + protected org.eclipse.uml2.uml.Class base_Class; + + /** + * + * + * @generated + */ + protected AlwaysActiveImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return ProfilePackage.Literals.ALWAYS_ACTIVE; + } + + /** + * + * + * @generated + */ + public org.eclipse.uml2.uml.Class getBase_Class() { + if (base_Class != null && base_Class.eIsProxy()) { + InternalEObject oldBase_Class = (InternalEObject)base_Class; + base_Class = (org.eclipse.uml2.uml.Class)eResolveProxy(oldBase_Class); + if (base_Class != oldBase_Class) { + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.RESOLVE, ProfilePackage.ALWAYS_ACTIVE__BASE_CLASS, oldBase_Class, base_Class)); + } + } + return base_Class; + } + + /** + * + * + * @generated + */ + public org.eclipse.uml2.uml.Class basicGetBase_Class() { + return base_Class; + } + + /** + * + * + * @generated + */ + public void setBase_Class(org.eclipse.uml2.uml.Class newBase_Class) { + org.eclipse.uml2.uml.Class oldBase_Class = base_Class; + base_Class = newBase_Class; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, ProfilePackage.ALWAYS_ACTIVE__BASE_CLASS, oldBase_Class, base_Class)); + } + + /** + * + * + * @generated + */ + public boolean ConstraintAlwaysActive(DiagnosticChain diagnostics, Map context) { + // TODO: implement this method + // -> specify the condition that violates the invariant + // -> verify the details of the diagnostic, including severity and message + // Ensure that you remove @generated or mark it @generated NOT + if (false) { + if (diagnostics != null) { + diagnostics.add + (new BasicDiagnostic + (Diagnostic.ERROR, + ProfileValidator.DIAGNOSTIC_SOURCE, + ProfileValidator.ALWAYS_ACTIVE__CONSTRAINT_ALWAYS_ACTIVE, + EcorePlugin.INSTANCE.getString("_UI_GenericInvariant_diagnostic", new Object[] { "ConstraintAlwaysActive", EObjectValidator.getObjectLabel(this, context) }), + new Object [] { this })); + } + return false; + } + return true; + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case ProfilePackage.ALWAYS_ACTIVE__BASE_CLASS: + if (resolve) return getBase_Class(); + return basicGetBase_Class(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case ProfilePackage.ALWAYS_ACTIVE__BASE_CLASS: + setBase_Class((org.eclipse.uml2.uml.Class)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case ProfilePackage.ALWAYS_ACTIVE__BASE_CLASS: + setBase_Class((org.eclipse.uml2.uml.Class)null); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case ProfilePackage.ALWAYS_ACTIVE__BASE_CLASS: + return base_Class != null; + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + @SuppressWarnings("unchecked") + public Object eInvoke(int operationID, EList arguments) throws InvocationTargetException { + switch (operationID) { + case ProfilePackage.ALWAYS_ACTIVE___CONSTRAINT_ALWAYS_ACTIVE__DIAGNOSTICCHAIN_MAP: + return ConstraintAlwaysActive((DiagnosticChain)arguments.get(0), (Map)arguments.get(1)); + } + return super.eInvoke(operationID, arguments); + } + +} //AlwaysActiveImpl diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/impl/AlwaysActiveMalformedImpl.java b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/impl/AlwaysActiveMalformedImpl.java new file mode 100644 index 00000000000..fed412d4214 --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/impl/AlwaysActiveMalformedImpl.java @@ -0,0 +1,211 @@ +/** + */ +package profile.impl; + +import java.lang.reflect.InvocationTargetException; + +import java.util.Map; + +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.common.util.BasicDiagnostic; +import org.eclipse.emf.common.util.Diagnostic; +import org.eclipse.emf.common.util.DiagnosticChain; +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; + +import org.eclipse.emf.ecore.plugin.EcorePlugin; + +import org.eclipse.emf.ecore.util.EObjectValidator; + +import profile.AlwaysActiveMalformed; +import profile.ProfilePackage; + +import profile.util.ProfileValidator; + +/** + * + * An implementation of the model object 'Always Active Malformed'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link profile.impl.AlwaysActiveMalformedImpl#getBase_Class Base Class}
  • + *
+ * + * @generated + */ +public class AlwaysActiveMalformedImpl extends MinimalEObjectImpl.Container implements AlwaysActiveMalformed { + /** + * The cached value of the '{@link #getBase_Class() Base Class}' reference. + * + * + * @see #getBase_Class() + * @generated + * @ordered + */ + protected org.eclipse.uml2.uml.Class base_Class; + + /** + * + * + * @generated + */ + protected AlwaysActiveMalformedImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return ProfilePackage.Literals.ALWAYS_ACTIVE_MALFORMED; + } + + /** + * + * + * @generated + */ + public org.eclipse.uml2.uml.Class getBase_Class() { + if (base_Class != null && base_Class.eIsProxy()) { + InternalEObject oldBase_Class = (InternalEObject)base_Class; + base_Class = (org.eclipse.uml2.uml.Class)eResolveProxy(oldBase_Class); + if (base_Class != oldBase_Class) { + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.RESOLVE, ProfilePackage.ALWAYS_ACTIVE_MALFORMED__BASE_CLASS, oldBase_Class, base_Class)); + } + } + return base_Class; + } + + /** + * + * + * @generated + */ + public org.eclipse.uml2.uml.Class basicGetBase_Class() { + return base_Class; + } + + /** + * + * + * @generated + */ + public void setBase_Class(org.eclipse.uml2.uml.Class newBase_Class) { + org.eclipse.uml2.uml.Class oldBase_Class = base_Class; + base_Class = newBase_Class; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, ProfilePackage.ALWAYS_ACTIVE_MALFORMED__BASE_CLASS, oldBase_Class, base_Class)); + } + + /** + * + * + * @generated + */ + public boolean ConstraintAlwaysActiveMF(DiagnosticChain diagnostics, Map context) { + // TODO: implement this method + // -> specify the condition that violates the invariant + // -> verify the details of the diagnostic, including severity and message + // Ensure that you remove @generated or mark it @generated NOT + if (false) { + if (diagnostics != null) { + diagnostics.add + (new BasicDiagnostic + (Diagnostic.ERROR, + ProfileValidator.DIAGNOSTIC_SOURCE, + ProfileValidator.ALWAYS_ACTIVE_MALFORMED__CONSTRAINT_ALWAYS_ACTIVE_MF, + EcorePlugin.INSTANCE.getString("_UI_GenericInvariant_diagnostic", new Object[] { "ConstraintAlwaysActiveMF", EObjectValidator.getObjectLabel(this, context) }), + new Object [] { this })); + } + return false; + } + return true; + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case ProfilePackage.ALWAYS_ACTIVE_MALFORMED__BASE_CLASS: + if (resolve) return getBase_Class(); + return basicGetBase_Class(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case ProfilePackage.ALWAYS_ACTIVE_MALFORMED__BASE_CLASS: + setBase_Class((org.eclipse.uml2.uml.Class)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case ProfilePackage.ALWAYS_ACTIVE_MALFORMED__BASE_CLASS: + setBase_Class((org.eclipse.uml2.uml.Class)null); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case ProfilePackage.ALWAYS_ACTIVE_MALFORMED__BASE_CLASS: + return base_Class != null; + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + @SuppressWarnings("unchecked") + public Object eInvoke(int operationID, EList arguments) throws InvocationTargetException { + switch (operationID) { + case ProfilePackage.ALWAYS_ACTIVE_MALFORMED___CONSTRAINT_ALWAYS_ACTIVE_MF__DIAGNOSTICCHAIN_MAP: + return ConstraintAlwaysActiveMF((DiagnosticChain)arguments.get(0), (Map)arguments.get(1)); + } + return super.eInvoke(operationID, arguments); + } + +} //AlwaysActiveMalformedImpl diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/impl/AlwaysPassiveJavaImpl.java b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/impl/AlwaysPassiveJavaImpl.java new file mode 100644 index 00000000000..11471ee8745 --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/impl/AlwaysPassiveJavaImpl.java @@ -0,0 +1,211 @@ +/** + */ +package profile.impl; + +import java.lang.reflect.InvocationTargetException; + +import java.util.Map; + +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.common.util.BasicDiagnostic; +import org.eclipse.emf.common.util.Diagnostic; +import org.eclipse.emf.common.util.DiagnosticChain; +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; + +import org.eclipse.emf.ecore.plugin.EcorePlugin; + +import org.eclipse.emf.ecore.util.EObjectValidator; + +import profile.AlwaysPassiveJava; +import profile.ProfilePackage; + +import profile.util.ProfileValidator; + +/** + * + * An implementation of the model object 'Always Passive Java'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link profile.impl.AlwaysPassiveJavaImpl#getBase_Class Base Class}
  • + *
+ * + * @generated + */ +public class AlwaysPassiveJavaImpl extends MinimalEObjectImpl.Container implements AlwaysPassiveJava { + /** + * The cached value of the '{@link #getBase_Class() Base Class}' reference. + * + * + * @see #getBase_Class() + * @generated + * @ordered + */ + protected org.eclipse.uml2.uml.Class base_Class; + + /** + * + * + * @generated + */ + protected AlwaysPassiveJavaImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return ProfilePackage.Literals.ALWAYS_PASSIVE_JAVA; + } + + /** + * + * + * @generated + */ + public org.eclipse.uml2.uml.Class getBase_Class() { + if (base_Class != null && base_Class.eIsProxy()) { + InternalEObject oldBase_Class = (InternalEObject)base_Class; + base_Class = (org.eclipse.uml2.uml.Class)eResolveProxy(oldBase_Class); + if (base_Class != oldBase_Class) { + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.RESOLVE, ProfilePackage.ALWAYS_PASSIVE_JAVA__BASE_CLASS, oldBase_Class, base_Class)); + } + } + return base_Class; + } + + /** + * + * + * @generated + */ + public org.eclipse.uml2.uml.Class basicGetBase_Class() { + return base_Class; + } + + /** + * + * + * @generated + */ + public void setBase_Class(org.eclipse.uml2.uml.Class newBase_Class) { + org.eclipse.uml2.uml.Class oldBase_Class = base_Class; + base_Class = newBase_Class; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, ProfilePackage.ALWAYS_PASSIVE_JAVA__BASE_CLASS, oldBase_Class, base_Class)); + } + + /** + * + * + * @generated + */ + public boolean AlwaysPassive(DiagnosticChain diagnostics, Map context) { + // TODO: implement this method + // -> specify the condition that violates the invariant + // -> verify the details of the diagnostic, including severity and message + // Ensure that you remove @generated or mark it @generated NOT + if (false) { + if (diagnostics != null) { + diagnostics.add + (new BasicDiagnostic + (Diagnostic.ERROR, + ProfileValidator.DIAGNOSTIC_SOURCE, + ProfileValidator.ALWAYS_PASSIVE_JAVA__ALWAYS_PASSIVE, + EcorePlugin.INSTANCE.getString("_UI_GenericInvariant_diagnostic", new Object[] { "AlwaysPassive", EObjectValidator.getObjectLabel(this, context) }), + new Object [] { this })); + } + return false; + } + return true; + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case ProfilePackage.ALWAYS_PASSIVE_JAVA__BASE_CLASS: + if (resolve) return getBase_Class(); + return basicGetBase_Class(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case ProfilePackage.ALWAYS_PASSIVE_JAVA__BASE_CLASS: + setBase_Class((org.eclipse.uml2.uml.Class)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case ProfilePackage.ALWAYS_PASSIVE_JAVA__BASE_CLASS: + setBase_Class((org.eclipse.uml2.uml.Class)null); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case ProfilePackage.ALWAYS_PASSIVE_JAVA__BASE_CLASS: + return base_Class != null; + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + @SuppressWarnings("unchecked") + public Object eInvoke(int operationID, EList arguments) throws InvocationTargetException { + switch (operationID) { + case ProfilePackage.ALWAYS_PASSIVE_JAVA___ALWAYS_PASSIVE__DIAGNOSTICCHAIN_MAP: + return AlwaysPassive((DiagnosticChain)arguments.get(0), (Map)arguments.get(1)); + } + return super.eInvoke(operationID, arguments); + } + +} //AlwaysPassiveJavaImpl diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/impl/ProfileFactoryImpl.java b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/impl/ProfileFactoryImpl.java new file mode 100644 index 00000000000..d28d40292f6 --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/impl/ProfileFactoryImpl.java @@ -0,0 +1,128 @@ +/** + */ +package profile.impl; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.impl.EFactoryImpl; + +import org.eclipse.emf.ecore.plugin.EcorePlugin; + +import profile.*; + +/** + * + * An implementation of the model Factory. + * + * @generated + */ +public class ProfileFactoryImpl extends EFactoryImpl implements ProfileFactory { + /** + * Creates the default factory implementation. + * + * + * @generated + */ + public static ProfileFactory init() { + try { + ProfileFactory theProfileFactory = (ProfileFactory)EPackage.Registry.INSTANCE.getEFactory(ProfilePackage.eNS_URI); + if (theProfileFactory != null) { + return theProfileFactory; + } + } + catch (Exception exception) { + EcorePlugin.INSTANCE.log(exception); + } + return new ProfileFactoryImpl(); + } + + /** + * Creates an instance of the factory. + * + * + * @generated + */ + public ProfileFactoryImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + public EObject create(EClass eClass) { + switch (eClass.getClassifierID()) { + case ProfilePackage.ALWAYS_ACTIVE: return createAlwaysActive(); + case ProfilePackage.TST: return createTst(); + case ProfilePackage.ALWAYS_ACTIVE_MALFORMED: return createAlwaysActiveMalformed(); + case ProfilePackage.ALWAYS_PASSIVE_JAVA: return createAlwaysPassiveJava(); + default: + throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); + } + } + + /** + * + * + * @generated + */ + public AlwaysActive createAlwaysActive() { + AlwaysActiveImpl alwaysActive = new AlwaysActiveImpl(); + return alwaysActive; + } + + /** + * + * + * @generated + */ + public Tst createTst() { + TstImpl tst = new TstImpl(); + return tst; + } + + /** + * + * + * @generated + */ + public AlwaysActiveMalformed createAlwaysActiveMalformed() { + AlwaysActiveMalformedImpl alwaysActiveMalformed = new AlwaysActiveMalformedImpl(); + return alwaysActiveMalformed; + } + + /** + * + * + * @generated + */ + public AlwaysPassiveJava createAlwaysPassiveJava() { + AlwaysPassiveJavaImpl alwaysPassiveJava = new AlwaysPassiveJavaImpl(); + return alwaysPassiveJava; + } + + /** + * + * + * @generated + */ + public ProfilePackage getProfilePackage() { + return (ProfilePackage)getEPackage(); + } + + /** + * + * + * @deprecated + * @generated + */ + @Deprecated + public static ProfilePackage getPackage() { + return ProfilePackage.eINSTANCE; + } + +} //ProfileFactoryImpl diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/impl/ProfilePackageImpl.java b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/impl/ProfilePackageImpl.java new file mode 100644 index 00000000000..7919f616184 --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/impl/ProfilePackageImpl.java @@ -0,0 +1,384 @@ +/** + */ +package profile.impl; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EGenericType; +import org.eclipse.emf.ecore.EOperation; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.EValidator; + +import org.eclipse.emf.ecore.impl.EPackageImpl; + +import org.eclipse.uml2.uml.UMLPackage; + +import profile.AlwaysActive; +import profile.AlwaysActiveMalformed; +import profile.AlwaysPassiveJava; +import profile.ProfileFactory; +import profile.ProfilePackage; +import profile.Tst; + +import profile.util.ProfileValidator; + +/** + * + * An implementation of the model Package. + * + * @generated + */ +public class ProfilePackageImpl extends EPackageImpl implements ProfilePackage { + /** + * + * + * @generated + */ + private EClass alwaysActiveEClass = null; + + /** + * + * + * @generated + */ + private EClass tstEClass = null; + + /** + * + * + * @generated + */ + private EClass alwaysActiveMalformedEClass = null; + + /** + * + * + * @generated + */ + private EClass alwaysPassiveJavaEClass = null; + + /** + * Creates an instance of the model Package, registered with + * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package + * package URI value. + *

Note: the correct way to create the package is via the static + * factory method {@link #init init()}, which also performs + * initialization of the package, or returns the registered package, + * if one already exists. + * + * + * @see org.eclipse.emf.ecore.EPackage.Registry + * @see profile.ProfilePackage#eNS_URI + * @see #init() + * @generated + */ + private ProfilePackageImpl() { + super(eNS_URI, ProfileFactory.eINSTANCE); + } + + /** + * + * + * @generated + */ + private static boolean isInited = false; + + /** + * Creates, registers, and initializes the Package for this model, and for any others upon which it depends. + * + *

This method is used to initialize {@link ProfilePackage#eINSTANCE} when that field is accessed. + * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. + * + * + * @see #eNS_URI + * @see #createPackageContents() + * @see #initializePackageContents() + * @generated + */ + public static ProfilePackage init() { + if (isInited) return (ProfilePackage)EPackage.Registry.INSTANCE.getEPackage(ProfilePackage.eNS_URI); + + // Obtain or create and register package + ProfilePackageImpl theProfilePackage = (ProfilePackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof ProfilePackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new ProfilePackageImpl()); + + isInited = true; + + // Initialize simple dependencies + UMLPackage.eINSTANCE.eClass(); + + // Create package meta-data objects + theProfilePackage.createPackageContents(); + + // Initialize created meta-data + theProfilePackage.initializePackageContents(); + + // Register package validator + EValidator.Registry.INSTANCE.put + (theProfilePackage, + new EValidator.Descriptor() { + public EValidator getEValidator() { + return ProfileValidator.INSTANCE; + } + }); + + // Mark meta-data to indicate it can't be changed + theProfilePackage.freeze(); + + + // Update the registry and return the package + EPackage.Registry.INSTANCE.put(ProfilePackage.eNS_URI, theProfilePackage); + return theProfilePackage; + } + + /** + * + * + * @generated + */ + public EClass getAlwaysActive() { + return alwaysActiveEClass; + } + + /** + * + * + * @generated + */ + public EReference getAlwaysActive_Base_Class() { + return (EReference)alwaysActiveEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EOperation getAlwaysActive__ConstraintAlwaysActive__DiagnosticChain_Map() { + return alwaysActiveEClass.getEOperations().get(0); + } + + /** + * + * + * @generated + */ + public EClass getTst() { + return tstEClass; + } + + /** + * + * + * @generated + */ + public EReference getTst_Base_Package() { + return (EReference)tstEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EClass getAlwaysActiveMalformed() { + return alwaysActiveMalformedEClass; + } + + /** + * + * + * @generated + */ + public EReference getAlwaysActiveMalformed_Base_Class() { + return (EReference)alwaysActiveMalformedEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EOperation getAlwaysActiveMalformed__ConstraintAlwaysActiveMF__DiagnosticChain_Map() { + return alwaysActiveMalformedEClass.getEOperations().get(0); + } + + /** + * + * + * @generated + */ + public EClass getAlwaysPassiveJava() { + return alwaysPassiveJavaEClass; + } + + /** + * + * + * @generated + */ + public EReference getAlwaysPassiveJava_Base_Class() { + return (EReference)alwaysPassiveJavaEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EOperation getAlwaysPassiveJava__AlwaysPassive__DiagnosticChain_Map() { + return alwaysPassiveJavaEClass.getEOperations().get(0); + } + + /** + * + * + * @generated + */ + public ProfileFactory getProfileFactory() { + return (ProfileFactory)getEFactoryInstance(); + } + + /** + * + * + * @generated + */ + private boolean isCreated = false; + + /** + * Creates the meta-model objects for the package. This method is + * guarded to have no affect on any invocation but its first. + * + * + * @generated + */ + public void createPackageContents() { + if (isCreated) return; + isCreated = true; + + // Create classes and their features + alwaysActiveEClass = createEClass(ALWAYS_ACTIVE); + createEReference(alwaysActiveEClass, ALWAYS_ACTIVE__BASE_CLASS); + createEOperation(alwaysActiveEClass, ALWAYS_ACTIVE___CONSTRAINT_ALWAYS_ACTIVE__DIAGNOSTICCHAIN_MAP); + + tstEClass = createEClass(TST); + createEReference(tstEClass, TST__BASE_PACKAGE); + + alwaysActiveMalformedEClass = createEClass(ALWAYS_ACTIVE_MALFORMED); + createEReference(alwaysActiveMalformedEClass, ALWAYS_ACTIVE_MALFORMED__BASE_CLASS); + createEOperation(alwaysActiveMalformedEClass, ALWAYS_ACTIVE_MALFORMED___CONSTRAINT_ALWAYS_ACTIVE_MF__DIAGNOSTICCHAIN_MAP); + + alwaysPassiveJavaEClass = createEClass(ALWAYS_PASSIVE_JAVA); + createEReference(alwaysPassiveJavaEClass, ALWAYS_PASSIVE_JAVA__BASE_CLASS); + createEOperation(alwaysPassiveJavaEClass, ALWAYS_PASSIVE_JAVA___ALWAYS_PASSIVE__DIAGNOSTICCHAIN_MAP); + } + + /** + * + * + * @generated + */ + private boolean isInitialized = false; + + /** + * Complete the initialization of the package and its meta-model. This + * method is guarded to have no affect on any invocation but its first. + * + * + * @generated + */ + public void initializePackageContents() { + if (isInitialized) return; + isInitialized = true; + + // Initialize package + setName(eNAME); + setNsPrefix(eNS_PREFIX); + setNsURI(eNS_URI); + + // Obtain other dependent packages + UMLPackage theUMLPackage = (UMLPackage)EPackage.Registry.INSTANCE.getEPackage(UMLPackage.eNS_URI); + + // Create type parameters + + // Set bounds for type parameters + + // Add supertypes to classes + + // Initialize classes, features, and operations; add parameters + initEClass(alwaysActiveEClass, AlwaysActive.class, "AlwaysActive", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getAlwaysActive_Base_Class(), theUMLPackage.getClass_(), null, "base_Class", null, 1, 1, AlwaysActive.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED); + + EOperation op = initEOperation(getAlwaysActive__ConstraintAlwaysActive__DiagnosticChain_Map(), ecorePackage.getEBoolean(), "ConstraintAlwaysActive", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, ecorePackage.getEDiagnosticChain(), "diagnostics", 0, 1, IS_UNIQUE, IS_ORDERED); + EGenericType g1 = createEGenericType(ecorePackage.getEMap()); + EGenericType g2 = createEGenericType(ecorePackage.getEJavaObject()); + g1.getETypeArguments().add(g2); + g2 = createEGenericType(ecorePackage.getEJavaObject()); + g1.getETypeArguments().add(g2); + addEParameter(op, g1, "context", 0, 1, IS_UNIQUE, IS_ORDERED); + + initEClass(tstEClass, Tst.class, "Tst", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getTst_Base_Package(), theUMLPackage.getPackage(), null, "base_Package", null, 1, 1, Tst.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED); + + initEClass(alwaysActiveMalformedEClass, AlwaysActiveMalformed.class, "AlwaysActiveMalformed", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getAlwaysActiveMalformed_Base_Class(), theUMLPackage.getClass_(), null, "base_Class", null, 1, 1, AlwaysActiveMalformed.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED); + + op = initEOperation(getAlwaysActiveMalformed__ConstraintAlwaysActiveMF__DiagnosticChain_Map(), ecorePackage.getEBoolean(), "ConstraintAlwaysActiveMF", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, ecorePackage.getEDiagnosticChain(), "diagnostics", 0, 1, IS_UNIQUE, IS_ORDERED); + g1 = createEGenericType(ecorePackage.getEMap()); + g2 = createEGenericType(ecorePackage.getEJavaObject()); + g1.getETypeArguments().add(g2); + g2 = createEGenericType(ecorePackage.getEJavaObject()); + g1.getETypeArguments().add(g2); + addEParameter(op, g1, "context", 0, 1, IS_UNIQUE, IS_ORDERED); + + initEClass(alwaysPassiveJavaEClass, AlwaysPassiveJava.class, "AlwaysPassiveJava", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getAlwaysPassiveJava_Base_Class(), theUMLPackage.getClass_(), null, "base_Class", null, 1, 1, AlwaysPassiveJava.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED); + + op = initEOperation(getAlwaysPassiveJava__AlwaysPassive__DiagnosticChain_Map(), ecorePackage.getEBoolean(), "AlwaysPassive", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, ecorePackage.getEDiagnosticChain(), "diagnostics", 0, 1, IS_UNIQUE, IS_ORDERED); + g1 = createEGenericType(ecorePackage.getEMap()); + g2 = createEGenericType(ecorePackage.getEJavaObject()); + g1.getETypeArguments().add(g2); + g2 = createEGenericType(ecorePackage.getEJavaObject()); + g1.getETypeArguments().add(g2); + addEParameter(op, g1, "context", 0, 1, IS_UNIQUE, IS_ORDERED); + + // Create resource + createResource(eNS_URI); + + // Create annotations + // http://www.eclipse.org/uml2/1.1.0/GenModel + createGenModelAnnotations(); + } + + /** + * Initializes the annotations for http://www.eclipse.org/uml2/1.1.0/GenModel. + * + * + * @generated + */ + protected void createGenModelAnnotations() { + String source = "http://www.eclipse.org/uml2/1.1.0/GenModel"; + addAnnotation + (getAlwaysActive__ConstraintAlwaysActive__DiagnosticChain_Map(), + source, + new String[] { + "body", "base_Class.isActive" + }); + addAnnotation + (getAlwaysActiveMalformed__ConstraintAlwaysActiveMF__DiagnosticChain_Map(), + source, + new String[] { + "body", "self.oclAsType(Class).isActive" + }); + addAnnotation + (getAlwaysPassiveJava__AlwaysPassive__DiagnosticChain_Map(), + source, + new String[] { + "body", "return !self.getBase_Class().isActive();" + }); + } + +} //ProfilePackageImpl diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/impl/TstImpl.java b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/impl/TstImpl.java new file mode 100644 index 00000000000..5b39987d73c --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/impl/TstImpl.java @@ -0,0 +1,156 @@ +/** + */ +package profile.impl; + +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; + +import profile.ProfilePackage; +import profile.Tst; + +/** + * + * An implementation of the model object 'Tst'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link profile.impl.TstImpl#getBase_Package Base Package}
  • + *
+ * + * @generated + */ +public class TstImpl extends MinimalEObjectImpl.Container implements Tst { + /** + * The cached value of the '{@link #getBase_Package() Base Package}' reference. + * + * + * @see #getBase_Package() + * @generated + * @ordered + */ + protected org.eclipse.uml2.uml.Package base_Package; + + /** + * + * + * @generated + */ + protected TstImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return ProfilePackage.Literals.TST; + } + + /** + * + * + * @generated + */ + public org.eclipse.uml2.uml.Package getBase_Package() { + if (base_Package != null && base_Package.eIsProxy()) { + InternalEObject oldBase_Package = (InternalEObject)base_Package; + base_Package = (org.eclipse.uml2.uml.Package)eResolveProxy(oldBase_Package); + if (base_Package != oldBase_Package) { + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.RESOLVE, ProfilePackage.TST__BASE_PACKAGE, oldBase_Package, base_Package)); + } + } + return base_Package; + } + + /** + * + * + * @generated + */ + public org.eclipse.uml2.uml.Package basicGetBase_Package() { + return base_Package; + } + + /** + * + * + * @generated + */ + public void setBase_Package(org.eclipse.uml2.uml.Package newBase_Package) { + org.eclipse.uml2.uml.Package oldBase_Package = base_Package; + base_Package = newBase_Package; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, ProfilePackage.TST__BASE_PACKAGE, oldBase_Package, base_Package)); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case ProfilePackage.TST__BASE_PACKAGE: + if (resolve) return getBase_Package(); + return basicGetBase_Package(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case ProfilePackage.TST__BASE_PACKAGE: + setBase_Package((org.eclipse.uml2.uml.Package)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case ProfilePackage.TST__BASE_PACKAGE: + setBase_Package((org.eclipse.uml2.uml.Package)null); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case ProfilePackage.TST__BASE_PACKAGE: + return base_Package != null; + } + return super.eIsSet(featureID); + } + +} //TstImpl diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/util/ProfileAdapterFactory.java b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/util/ProfileAdapterFactory.java new file mode 100644 index 00000000000..2f4c9374d6f --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/util/ProfileAdapterFactory.java @@ -0,0 +1,174 @@ +/** + */ +package profile.util; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notifier; + +import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; + +import org.eclipse.emf.ecore.EObject; + +import profile.*; + +/** + * + * The Adapter Factory for the model. + * It provides an adapter createXXX method for each class of the model. + * + * @see profile.ProfilePackage + * @generated + */ +public class ProfileAdapterFactory extends AdapterFactoryImpl { + /** + * The cached model package. + * + * + * @generated + */ + protected static ProfilePackage modelPackage; + + /** + * Creates an instance of the adapter factory. + * + * + * @generated + */ + public ProfileAdapterFactory() { + if (modelPackage == null) { + modelPackage = ProfilePackage.eINSTANCE; + } + } + + /** + * Returns whether this factory is applicable for the type of the object. + * + * This implementation returns true if the object is either the model's package or is an instance object of the model. + * + * @return whether this factory is applicable for the type of the object. + * @generated + */ + @Override + public boolean isFactoryForType(Object object) { + if (object == modelPackage) { + return true; + } + if (object instanceof EObject) { + return ((EObject)object).eClass().getEPackage() == modelPackage; + } + return false; + } + + /** + * The switch that delegates to the createXXX methods. + * + * + * @generated + */ + protected ProfileSwitch modelSwitch = + new ProfileSwitch() { + @Override + public Adapter caseAlwaysActive(AlwaysActive object) { + return createAlwaysActiveAdapter(); + } + @Override + public Adapter caseTst(Tst object) { + return createTstAdapter(); + } + @Override + public Adapter caseAlwaysActiveMalformed(AlwaysActiveMalformed object) { + return createAlwaysActiveMalformedAdapter(); + } + @Override + public Adapter caseAlwaysPassiveJava(AlwaysPassiveJava object) { + return createAlwaysPassiveJavaAdapter(); + } + @Override + public Adapter defaultCase(EObject object) { + return createEObjectAdapter(); + } + }; + + /** + * Creates an adapter for the target. + * + * + * @param target the object to adapt. + * @return the adapter for the target. + * @generated + */ + @Override + public Adapter createAdapter(Notifier target) { + return modelSwitch.doSwitch((EObject)target); + } + + + /** + * Creates a new adapter for an object of class '{@link profile.AlwaysActive Always Active}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see profile.AlwaysActive + * @generated + */ + public Adapter createAlwaysActiveAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link profile.Tst Tst}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see profile.Tst + * @generated + */ + public Adapter createTstAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link profile.AlwaysActiveMalformed Always Active Malformed}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see profile.AlwaysActiveMalformed + * @generated + */ + public Adapter createAlwaysActiveMalformedAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link profile.AlwaysPassiveJava Always Passive Java}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see profile.AlwaysPassiveJava + * @generated + */ + public Adapter createAlwaysPassiveJavaAdapter() { + return null; + } + + /** + * Creates a new adapter for the default case. + * + * This default implementation returns null. + * + * @return the new adapter. + * @generated + */ + public Adapter createEObjectAdapter() { + return null; + } + +} //ProfileAdapterFactory diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/util/ProfileSwitch.java b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/util/ProfileSwitch.java new file mode 100644 index 00000000000..2eab23ad54b --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/util/ProfileSwitch.java @@ -0,0 +1,173 @@ +/** + */ +package profile.util; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.util.Switch; + +import profile.*; + +/** + * + * The Switch for the model's inheritance hierarchy. + * It supports the call {@link #doSwitch(EObject) doSwitch(object)} + * to invoke the caseXXX method for each class of the model, + * starting with the actual class of the object + * and proceeding up the inheritance hierarchy + * until a non-null result is returned, + * which is the result of the switch. + * + * @see profile.ProfilePackage + * @generated + */ +public class ProfileSwitch extends Switch { + /** + * The cached model package + * + * + * @generated + */ + protected static ProfilePackage modelPackage; + + /** + * Creates an instance of the switch. + * + * + * @generated + */ + public ProfileSwitch() { + if (modelPackage == null) { + modelPackage = ProfilePackage.eINSTANCE; + } + } + + /** + * Checks whether this is a switch for the given package. + * + * + * @param ePackage the package in question. + * @return whether this is a switch for the given package. + * @generated + */ + @Override + protected boolean isSwitchFor(EPackage ePackage) { + return ePackage == modelPackage; + } + + /** + * Calls caseXXX for each class of the model until one returns a non null result; it yields that result. + * + * + * @return the first non-null result returned by a caseXXX call. + * @generated + */ + @Override + protected T doSwitch(int classifierID, EObject theEObject) { + switch (classifierID) { + case ProfilePackage.ALWAYS_ACTIVE: { + AlwaysActive alwaysActive = (AlwaysActive)theEObject; + T result = caseAlwaysActive(alwaysActive); + if (result == null) result = defaultCase(theEObject); + return result; + } + case ProfilePackage.TST: { + Tst tst = (Tst)theEObject; + T result = caseTst(tst); + if (result == null) result = defaultCase(theEObject); + return result; + } + case ProfilePackage.ALWAYS_ACTIVE_MALFORMED: { + AlwaysActiveMalformed alwaysActiveMalformed = (AlwaysActiveMalformed)theEObject; + T result = caseAlwaysActiveMalformed(alwaysActiveMalformed); + if (result == null) result = defaultCase(theEObject); + return result; + } + case ProfilePackage.ALWAYS_PASSIVE_JAVA: { + AlwaysPassiveJava alwaysPassiveJava = (AlwaysPassiveJava)theEObject; + T result = caseAlwaysPassiveJava(alwaysPassiveJava); + if (result == null) result = defaultCase(theEObject); + return result; + } + default: return defaultCase(theEObject); + } + } + + /** + * Returns the result of interpreting the object as an instance of 'Always Active'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Always Active'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseAlwaysActive(AlwaysActive object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Tst'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Tst'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseTst(Tst object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Always Active Malformed'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Always Active Malformed'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseAlwaysActiveMalformed(AlwaysActiveMalformed object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Always Passive Java'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Always Passive Java'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseAlwaysPassiveJava(AlwaysPassiveJava object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'EObject'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch, but this is the last case anyway. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'EObject'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) + * @generated + */ + @Override + public T defaultCase(EObject object) { + return null; + } + +} //ProfileSwitch diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/util/ProfileValidator.java b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/util/ProfileValidator.java new file mode 100644 index 00000000000..e7cd93c5d18 --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src-gen/profile/util/ProfileValidator.java @@ -0,0 +1,235 @@ +/** + */ +package profile.util; + +import java.util.Map; + +import org.eclipse.emf.common.util.DiagnosticChain; +import org.eclipse.emf.common.util.ResourceLocator; + +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.util.EObjectValidator; + +import profile.*; + +/** + * + * The Validator for the model. + * + * @see profile.ProfilePackage + * @generated + */ +public class ProfileValidator extends EObjectValidator { + /** + * The cached model package + * + * + * @generated + */ + public static final ProfileValidator INSTANCE = new ProfileValidator(); + + /** + * A constant for the {@link org.eclipse.emf.common.util.Diagnostic#getSource() source} of diagnostic {@link org.eclipse.emf.common.util.Diagnostic#getCode() codes} from this package. + * + * + * @see org.eclipse.emf.common.util.Diagnostic#getSource() + * @see org.eclipse.emf.common.util.Diagnostic#getCode() + * @generated + */ + public static final String DIAGNOSTIC_SOURCE = "profile"; + + /** + * The {@link org.eclipse.emf.common.util.Diagnostic#getCode() code} for constraint 'Constraint Always Active' of 'Always Active'. + * + * + * @generated + */ + public static final int ALWAYS_ACTIVE__CONSTRAINT_ALWAYS_ACTIVE = 1; + + /** + * The {@link org.eclipse.emf.common.util.Diagnostic#getCode() code} for constraint 'Constraint Always Active MF' of 'Always Active Malformed'. + * + * + * @generated + */ + public static final int ALWAYS_ACTIVE_MALFORMED__CONSTRAINT_ALWAYS_ACTIVE_MF = 2; + + /** + * The {@link org.eclipse.emf.common.util.Diagnostic#getCode() code} for constraint 'Always Passive' of 'Always Passive Java'. + * + * + * @generated + */ + public static final int ALWAYS_PASSIVE_JAVA__ALWAYS_PASSIVE = 3; + + /** + * A constant with a fixed name that can be used as the base value for additional hand written constants. + * + * + * @generated + */ + private static final int GENERATED_DIAGNOSTIC_CODE_COUNT = 3; + + /** + * A constant with a fixed name that can be used as the base value for additional hand written constants in a derived class. + * + * + * @generated + */ + protected static final int DIAGNOSTIC_CODE_COUNT = GENERATED_DIAGNOSTIC_CODE_COUNT; + + /** + * Creates an instance of the switch. + * + * + * @generated + */ + public ProfileValidator() { + super(); + } + + /** + * Returns the package of this validator switch. + * + * + * @generated + */ + @Override + protected EPackage getEPackage() { + return ProfilePackage.eINSTANCE; + } + + /** + * Calls validateXXX for the corresponding classifier of the model. + * + * + * @generated + */ + @Override + protected boolean validate(int classifierID, Object value, DiagnosticChain diagnostics, Map context) { + switch (classifierID) { + case ProfilePackage.ALWAYS_ACTIVE: + return validateAlwaysActive((AlwaysActive)value, diagnostics, context); + case ProfilePackage.TST: + return validateTst((Tst)value, diagnostics, context); + case ProfilePackage.ALWAYS_ACTIVE_MALFORMED: + return validateAlwaysActiveMalformed((AlwaysActiveMalformed)value, diagnostics, context); + case ProfilePackage.ALWAYS_PASSIVE_JAVA: + return validateAlwaysPassiveJava((AlwaysPassiveJava)value, diagnostics, context); + default: + return true; + } + } + + /** + * + * + * @generated + */ + public boolean validateAlwaysActive(AlwaysActive alwaysActive, DiagnosticChain diagnostics, Map context) { + if (!validate_NoCircularContainment(alwaysActive, diagnostics, context)) return false; + boolean result = validate_EveryMultiplicityConforms(alwaysActive, diagnostics, context); + if (result || diagnostics != null) result &= validate_EveryDataValueConforms(alwaysActive, diagnostics, context); + if (result || diagnostics != null) result &= validate_EveryReferenceIsContained(alwaysActive, diagnostics, context); + if (result || diagnostics != null) result &= validate_EveryBidirectionalReferenceIsPaired(alwaysActive, diagnostics, context); + if (result || diagnostics != null) result &= validate_EveryProxyResolves(alwaysActive, diagnostics, context); + if (result || diagnostics != null) result &= validate_UniqueID(alwaysActive, diagnostics, context); + if (result || diagnostics != null) result &= validate_EveryKeyUnique(alwaysActive, diagnostics, context); + if (result || diagnostics != null) result &= validate_EveryMapEntryUnique(alwaysActive, diagnostics, context); + if (result || diagnostics != null) result &= validateAlwaysActive_ConstraintAlwaysActive(alwaysActive, diagnostics, context); + return result; + } + + /** + * Validates the ConstraintAlwaysActive constraint of 'Always Active'. + * + * + * @generated + */ + public boolean validateAlwaysActive_ConstraintAlwaysActive(AlwaysActive alwaysActive, DiagnosticChain diagnostics, Map context) { + return alwaysActive.ConstraintAlwaysActive(diagnostics, context); + } + + /** + * + * + * @generated + */ + public boolean validateTst(Tst tst, DiagnosticChain diagnostics, Map context) { + return validate_EveryDefaultConstraint(tst, diagnostics, context); + } + + /** + * + * + * @generated + */ + public boolean validateAlwaysActiveMalformed(AlwaysActiveMalformed alwaysActiveMalformed, DiagnosticChain diagnostics, Map context) { + if (!validate_NoCircularContainment(alwaysActiveMalformed, diagnostics, context)) return false; + boolean result = validate_EveryMultiplicityConforms(alwaysActiveMalformed, diagnostics, context); + if (result || diagnostics != null) result &= validate_EveryDataValueConforms(alwaysActiveMalformed, diagnostics, context); + if (result || diagnostics != null) result &= validate_EveryReferenceIsContained(alwaysActiveMalformed, diagnostics, context); + if (result || diagnostics != null) result &= validate_EveryBidirectionalReferenceIsPaired(alwaysActiveMalformed, diagnostics, context); + if (result || diagnostics != null) result &= validate_EveryProxyResolves(alwaysActiveMalformed, diagnostics, context); + if (result || diagnostics != null) result &= validate_UniqueID(alwaysActiveMalformed, diagnostics, context); + if (result || diagnostics != null) result &= validate_EveryKeyUnique(alwaysActiveMalformed, diagnostics, context); + if (result || diagnostics != null) result &= validate_EveryMapEntryUnique(alwaysActiveMalformed, diagnostics, context); + if (result || diagnostics != null) result &= validateAlwaysActiveMalformed_ConstraintAlwaysActiveMF(alwaysActiveMalformed, diagnostics, context); + return result; + } + + /** + * Validates the ConstraintAlwaysActiveMF constraint of 'Always Active Malformed'. + * + * + * @generated + */ + public boolean validateAlwaysActiveMalformed_ConstraintAlwaysActiveMF(AlwaysActiveMalformed alwaysActiveMalformed, DiagnosticChain diagnostics, Map context) { + return alwaysActiveMalformed.ConstraintAlwaysActiveMF(diagnostics, context); + } + + /** + * + * + * @generated + */ + public boolean validateAlwaysPassiveJava(AlwaysPassiveJava alwaysPassiveJava, DiagnosticChain diagnostics, Map context) { + if (!validate_NoCircularContainment(alwaysPassiveJava, diagnostics, context)) return false; + boolean result = validate_EveryMultiplicityConforms(alwaysPassiveJava, diagnostics, context); + if (result || diagnostics != null) result &= validate_EveryDataValueConforms(alwaysPassiveJava, diagnostics, context); + if (result || diagnostics != null) result &= validate_EveryReferenceIsContained(alwaysPassiveJava, diagnostics, context); + if (result || diagnostics != null) result &= validate_EveryBidirectionalReferenceIsPaired(alwaysPassiveJava, diagnostics, context); + if (result || diagnostics != null) result &= validate_EveryProxyResolves(alwaysPassiveJava, diagnostics, context); + if (result || diagnostics != null) result &= validate_UniqueID(alwaysPassiveJava, diagnostics, context); + if (result || diagnostics != null) result &= validate_EveryKeyUnique(alwaysPassiveJava, diagnostics, context); + if (result || diagnostics != null) result &= validate_EveryMapEntryUnique(alwaysPassiveJava, diagnostics, context); + if (result || diagnostics != null) result &= validateAlwaysPassiveJava_AlwaysPassive(alwaysPassiveJava, diagnostics, context); + return result; + } + + /** + * Validates the AlwaysPassive constraint of 'Always Passive Java'. + * + * + * @generated + */ + public boolean validateAlwaysPassiveJava_AlwaysPassive(AlwaysPassiveJava alwaysPassiveJava, DiagnosticChain diagnostics, Map context) { + return alwaysPassiveJava.AlwaysPassive(diagnostics, context); + } + + /** + * Returns the resource locator that will be used to fetch messages for this validator's diagnostics. + * + * + * @generated + */ + @Override + public ResourceLocator getResourceLocator() { + // TODO + // Specialize this to return a resource locator for messages specific to this validator. + // Ensure that you remove @generated or mark it @generated NOT + return super.getResourceLocator(); + } + +} //ProfileValidator diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src/org/eclipse/papyrus/uml/validation/tests/staticprofile/Activator.java b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src/org/eclipse/papyrus/uml/validation/tests/staticprofile/Activator.java new file mode 100644 index 00000000000..982fd2e175d --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests.staticprofile/src/org/eclipse/papyrus/uml/validation/tests/staticprofile/Activator.java @@ -0,0 +1,50 @@ +package org.eclipse.papyrus.uml.validation.tests.staticprofile; + +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "org.eclipse.papyrus.uml.validation.tests.staticprofile"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + +} diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/.classpath b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/.classpath new file mode 100644 index 00000000000..ad32c83a788 --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/.project b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/.project new file mode 100644 index 00000000000..baf5b5828b9 --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/.project @@ -0,0 +1,28 @@ + + + org.eclipse.papyrus.uml.validation.tests + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/.settings/org.eclipse.jdt.core.prefs b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000000..410244d65a6 --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,291 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert +org.eclipse.jdt.core.formatter.comment.line_length=260 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false +org.eclipse.jdt.core.formatter.indentation.size=4 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=260 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=5 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true +org.eclipse.jdt.core.formatter.tabulation.char=tab +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=false +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/.settings/org.eclipse.jdt.ui.prefs b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 00000000000..954281dbc31 --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,68 @@ +cleanup.add_default_serial_version_id=true +cleanup.add_generated_serial_version_id=false +cleanup.add_missing_annotations=true +cleanup.add_missing_deprecated_annotations=true +cleanup.add_missing_methods=false +cleanup.add_missing_nls_tags=false +cleanup.add_missing_override_annotations=true +cleanup.add_missing_override_annotations_interface_methods=true +cleanup.add_serial_version_id=false +cleanup.always_use_blocks=true +cleanup.always_use_parentheses_in_expressions=false +cleanup.always_use_this_for_non_static_field_access=false +cleanup.always_use_this_for_non_static_method_access=false +cleanup.convert_functional_interfaces=false +cleanup.convert_to_enhanced_for_loop=false +cleanup.correct_indentation=false +cleanup.format_source_code=false +cleanup.format_source_code_changes_only=false +cleanup.insert_inferred_type_arguments=false +cleanup.make_local_variable_final=true +cleanup.make_parameters_final=false +cleanup.make_private_fields_final=true +cleanup.make_type_abstract_if_missing_method=false +cleanup.make_variable_declarations_final=false +cleanup.never_use_blocks=false +cleanup.never_use_parentheses_in_expressions=true +cleanup.organize_imports=false +cleanup.qualify_static_field_accesses_with_declaring_class=false +cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +cleanup.qualify_static_member_accesses_with_declaring_class=true +cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.remove_private_constructors=true +cleanup.remove_redundant_type_arguments=true +cleanup.remove_trailing_whitespaces=true +cleanup.remove_trailing_whitespaces_all=true +cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.remove_unnecessary_casts=true +cleanup.remove_unnecessary_nls_tags=true +cleanup.remove_unused_imports=true +cleanup.remove_unused_local_variables=false +cleanup.remove_unused_private_fields=true +cleanup.remove_unused_private_members=false +cleanup.remove_unused_private_methods=true +cleanup.remove_unused_private_types=true +cleanup.sort_members=false +cleanup.sort_members_all=false +cleanup.use_anonymous_class_creation=false +cleanup.use_blocks=true +cleanup.use_blocks_only_for_return_and_throw=false +cleanup.use_lambda=true +cleanup.use_parentheses_in_expressions=false +cleanup.use_this_for_non_static_field_access=false +cleanup.use_this_for_non_static_field_access_only_if_necessary=true +cleanup.use_this_for_non_static_method_access=false +cleanup.use_this_for_non_static_method_access_only_if_necessary=true +cleanup.use_type_arguments=false +cleanup_profile=_Papyrus +cleanup_settings_version=2 +eclipse.preferences.version=1 +formatter_profile=_Papyrus +formatter_settings_version=12 +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates= diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..37bdf767b12 --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/META-INF/MANIFEST.MF @@ -0,0 +1,46 @@ +Manifest-Version: 1.0 +Bundle-Description: Tests for validation rules of the UmlRT profile +Bundle-SymbolicName: org.eclipse.papyrus.uml.validation.tests;singleton:=true +Bundle-Version: 1.2.0.qualifier +Bundle-ClassPath: . +Bundle-Name: %pluginName +Require-Bundle: org.eclipse.papyrus.junit.utils;bundle-version="1.2.0", + org.junit, + org.eclipse.ui.views.properties.tabbed;bundle-version="3.6.0", + org.eclipse.papyrus.uml.tools;bundle-version="1.2.0", + org.eclipse.papyrus.infra.services.validation;bundle-version="1.2.0", + org.eclipse.papyrus.uml.service.validation;bundle-version="1.2.0", + org.eclipse.gmf.runtime.emf.commands.core;bundle-version="1.7.0", + org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.2.0", + org.eclipse.uml2.uml;bundle-version="5.0.0";visibility:=reexport, + org.eclipse.ui.navigator;bundle-version="3.5.400", + org.eclipse.ui.ide;bundle-version="3.10.0", + org.eclipse.ui, + org.eclipse.papyrus.views.modelexplorer;bundle-version="1.2.0", + org.eclipse.papyrus.uml.tools.utils;bundle-version="1.2.0", + org.eclipse.papyrus.junit.framework;bundle-version="1.2.0", + org.eclipse.papyrus.infra.widgets;bundle-version="1.2.0", + org.eclipse.papyrus.infra.emf;bundle-version="1.2.0", + org.eclipse.papyrus.infra.core;bundle-version="1.2.0", + org.eclipse.papyrus.emf.facet.util.core;bundle-version="1.2.0", + org.eclipse.papyrus.emf.facet.custom.core;bundle-version="1.2.0", + org.eclipse.emf.workspace;bundle-version="1.5.1", + org.eclipse.emf.validation, + org.eclipse.emf.transaction;bundle-version="1.8.0", + org.eclipse.emf;bundle-version="2.6.0", + org.eclipse.core.runtime, + org.eclipse.emf.ecore;visibility:=reexport, + org.eclipse.uml2.types;visibility:=reexport, + org.eclipse.core.resources;bundle-version="3.9.0", + org.eclipse.ocl.pivot;bundle-version="1.1.0", + org.eclipse.ocl;bundle-version="3.5.100", + org.eclipse.ocl.xtext.completeocl;bundle-version="1.1.0", + org.eclipse.papyrus.dsml.validation +Bundle-ActivationPolicy: lazy +Bundle-ManifestVersion: 2 +Bundle-Activator: org.eclipse.papyrus.uml.validation.tests.Activator +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-Vendor: %providerName +Bundle-Localization: plugin +Export-Package: org.eclipse.papyrus.uml.validation.tests, + org.eclipse.papyrus.uml.validation.tests.rules diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/about.html b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/about.html new file mode 100644 index 00000000000..209103075a7 --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/about.html @@ -0,0 +1,28 @@ + + + + +About + + +

About This Content

+ +

November 14, 2008

+

License

+ +

The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise +indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at http://www.eclipse.org/legal/epl-v10.html. +For purposes of the EPL, "Program" will mean the Content.

+ +

If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor's license that was +provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at http://www.eclipse.org.

+ + + \ No newline at end of file diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/build.properties b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/build.properties new file mode 100644 index 00000000000..fcf7058002e --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/build.properties @@ -0,0 +1,10 @@ +# + +bin.includes = .,\ + resources/,\ + META-INF/,\ + plugin.properties,\ + about.html +jars.compile.order = . +source.. = src/ +output.. = bin/ diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/plugin.properties b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/plugin.properties new file mode 100644 index 00000000000..07f9a91b3c2 --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/plugin.properties @@ -0,0 +1,13 @@ +################################################################################ +# Copyright (c) 2015 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: +# Ansgar Radermacher (CEA LIST) ansgar.radermacher@cea.fr - initial API and implementation +################################################################################ +pluginName=Papyrus UML validation tests +pluginProvider=Eclipse Modeling Project +providerName = www.example.org diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/pom.xml b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/pom.xml new file mode 100644 index 00000000000..f1dfbdf15f6 --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + + org.eclipse.papyrus + org.eclipse.papyrus.tests.releng + 1.2.0-SNAPSHOT + ../../../../../../releng/main-tests + + org.eclipse.papyrus + org.eclipse.papyrus.uml.validation.tests + 1.2.0-SNAPSHOT + eclipse-test-plugin + diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/ExtraUMLValidation.ocl b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/ExtraUMLValidation.ocl new file mode 100644 index 00000000000..d859fa0da47 --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/ExtraUMLValidation.ocl @@ -0,0 +1,5 @@ +import uml : 'http://www.eclipse.org/uml2/5.0.0/UML#/' + +context uml::Class + +inv CamelCaseName : name.at(1)=name.at(1).toUpperCase() diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/UMLValidationTests.di b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/UMLValidationTests.di new file mode 100644 index 00000000000..bf9abab340f --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/UMLValidationTests.di @@ -0,0 +1,2 @@ + + diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/UMLValidationTests.notation b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/UMLValidationTests.notation new file mode 100644 index 00000000000..b8ee8d5e4d5 --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/UMLValidationTests.notation @@ -0,0 +1,192 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + multiplicity + name + derived + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/UMLValidationTests.uml b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/UMLValidationTests.uml new file mode 100644 index 00000000000..33d49eb1f7e --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/UMLValidationTests.uml @@ -0,0 +1,27 @@ + + + + + Check a simple standard UML constraint: elements in the same namespace must have unique names + + + + + + + The attribute in this class has a non-integer multiplicity. This must not be detected as a failure + + + + + + + + + + + This naming of this class is normally valid. However, the test loads an OCL constraint from a file that checks that all classes start with an upper case letter, i.e. this class violates this constraints. + + + + diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/active-tst.rule-in-definition.di b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/active-tst.rule-in-definition.di new file mode 100644 index 00000000000..bf9abab340f --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/active-tst.rule-in-definition.di @@ -0,0 +1,2 @@ + + diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/active-tst.rule-in-definition.notation b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/active-tst.rule-in-definition.notation new file mode 100644 index 00000000000..bf66ab27ffc --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/active-tst.rule-in-definition.notation @@ -0,0 +1,276 @@ + + + + + +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/active-tst.rule-in-definition.uml b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/active-tst.rule-in-definition.uml new file mode 100644 index 00000000000..14bb7691204 --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/active-tst.rule-in-definition.uml @@ -0,0 +1,30 @@ + + + + + An inactive class with the stereotype AlwaysActive. This stereotype has an OCL constraint that verifies that the class is active. Thus, the class violates the constraints + + + An active class with the stereotype AlwaysActiveMalformed. This stereotype has an OCL constraint which is not well formed. Validation should result in an error reporting the mal-formedness + + + This model applies a profile with constraints embedded into the profile definition. This is currently only possible for OCL constraints + + + An inacitve class with the stereotype AlwaysActive. The stereotype constraint is violated + + + + + + + + + + + + + + + + diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/active-tst.rule-in-plugin.di b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/active-tst.rule-in-plugin.di new file mode 100644 index 00000000000..bf9abab340f --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/active-tst.rule-in-plugin.di @@ -0,0 +1,2 @@ + + diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/active-tst.rule-in-plugin.notation b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/active-tst.rule-in-plugin.notation new file mode 100644 index 00000000000..32e022abd34 --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/active-tst.rule-in-plugin.notation @@ -0,0 +1,238 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/active-tst.rule-in-plugin.uml b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/active-tst.rule-in-plugin.uml new file mode 100644 index 00000000000..02f900b938b --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/active-tst.rule-in-plugin.uml @@ -0,0 +1,34 @@ + + + + + An inactive class with the stereotype AlwaysActive. This stereotype has an OCL constraint that verifies that the class is active. Thus, the class violates the constraints + + + An active class with the stereotype AlwaysActiveMalformed. This stereotype has an OCL constraint which is not well formed. Validation should result in an error reporting the mal-formedness + + + An inactive class with the stereotype AlwaysPassive. This stereotype has a Java constraint that verifies that the class is passive. Thus, this class should not have an error. + + + An active class with the stereotype AlwaysPassive. This stereotype has a Java constraint that verifies that the class is passive. Thus, this class violates the constraint + + + This model applies a profile with OCL and Java constraints embedded into the plugin.xml (using DSML validation). profile definition. + + + + + + + + + + + + + + + + + diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/active.rule-in-definition.profile.di b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/active.rule-in-definition.profile.di new file mode 100644 index 00000000000..bf9abab340f --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/active.rule-in-definition.profile.di @@ -0,0 +1,2 @@ + + diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/active.rule-in-definition.profile.notation b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/active.rule-in-definition.profile.notation new file mode 100644 index 00000000000..34a35d4548b --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/active.rule-in-definition.profile.notation @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/active.rule-in-definition.profile.uml b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/active.rule-in-definition.profile.uml new file mode 100644 index 00000000000..253eeae0e8b --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/active.rule-in-definition.profile.uml @@ -0,0 +1,138 @@ + + + + + + +
+ + +
+
+
+
+
+ + + + + +
+ + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + OCL + base_Class.isActive + + + + + + + + + + + + + + + + + + + + + OCL + self.oclAsType(Class).isActive + + + + + + + + + + + + + + + + + + diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/active.rule-in-plugin.profile.di b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/active.rule-in-plugin.profile.di new file mode 100644 index 00000000000..bf9abab340f --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/active.rule-in-plugin.profile.di @@ -0,0 +1,2 @@ + + diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/instanceSpecification.di b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/instanceSpecification.di new file mode 100644 index 00000000000..bf9abab340f --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/instanceSpecification.di @@ -0,0 +1,2 @@ + + diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/instanceSpecification.notation b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/instanceSpecification.notation new file mode 100644 index 00000000000..43c4a817ca0 --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/instanceSpecification.notation @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/instanceSpecification.uml b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/instanceSpecification.uml new file mode 100644 index 00000000000..e3c51846f3f --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/instanceSpecification.uml @@ -0,0 +1,34 @@ + + + + + Instance specification violates constraint for price attribute +The OCLforUML stereotype guarantees is required to activate OCL validation for this instance specification + + + + + OCL + price > 0 + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/simple.di b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/simple.di new file mode 100644 index 00000000000..bf9abab340f --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/simple.di @@ -0,0 +1,2 @@ + + diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/simple.notation b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/simple.notation new file mode 100644 index 00000000000..611fed1eb43 --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/simple.notation @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/simple.profile.di b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/simple.profile.di new file mode 100644 index 00000000000..bf9abab340f --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/simple.profile.di @@ -0,0 +1,2 @@ + + diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/simple.profile.notation b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/simple.profile.notation new file mode 100644 index 00000000000..e66e12da098 --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/simple.profile.notation @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/simple.profile.uml b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/simple.profile.uml new file mode 100644 index 00000000000..c55944a1f3a --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/simple.profile.uml @@ -0,0 +1,43 @@ + + + + + +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + requiredAttribute : String {unique} + + + + + + + + + + + diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/simple.uml b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/simple.uml new file mode 100644 index 00000000000..1b92aa09a18 --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/resources/simple.uml @@ -0,0 +1,20 @@ + + + + + + +
+
+
+
+
+ + + + + + + + + diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/src/org/eclipse/papyrus/uml/validation/tests/Activator.java b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/src/org/eclipse/papyrus/uml/validation/tests/Activator.java new file mode 100644 index 00000000000..22a8a350e0c --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/src/org/eclipse/papyrus/uml/validation/tests/Activator.java @@ -0,0 +1,67 @@ +/***************************************************************************** + * 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: + * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.validation.tests; + +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "org.eclipse.papyrus.uml.validation.tests"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + @Override + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + @Override + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + +} diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/src/org/eclipse/papyrus/uml/validation/tests/AllTests.java b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/src/org/eclipse/papyrus/uml/validation/tests/AllTests.java new file mode 100644 index 00000000000..e91c950e977 --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/src/org/eclipse/papyrus/uml/validation/tests/AllTests.java @@ -0,0 +1,69 @@ +/***************************************************************************** + * 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: + * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Initial API and implementation + * Ansgar Radermacher (CEA) ansgar.radermacher@cea.fr - Extension to validation test suite + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.validation.tests; + + +import org.eclipse.papyrus.uml.validation.tests.rules.TestOCLConstraintOnInstanceSpec; +import org.eclipse.papyrus.uml.validation.tests.rules.TestOCLValidationRuleFromFile; +import org.eclipse.papyrus.uml.validation.tests.rules.TestStereotypeValidation; +import org.eclipse.papyrus.uml.validation.tests.rules.TestUMLValidationRules; +import org.eclipse.papyrus.uml.validation.tests.rules.TestValidationRulesInPluginXML; +import org.eclipse.papyrus.uml.validation.tests.rules.TestValidationRulesInProfile; +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +/** + * Test suite for validation rules. See suite classes below + */ +@RunWith(Suite.class) +@SuiteClasses({ + + /** + * Model with OCL constraints on class, verified in instance specification + * Model with OCL constraints on redefined attribute of a class. + */ + TestOCLConstraintOnInstanceSpec.class, + + /** + * Verify that custom OCL file contributes to validation, see bug 408215* Sample test for cut in model explorer + */ + TestOCLValidationRuleFromFile.class, + + /** + * Model with OCL and Java constraints in plugin.xml (EMFv) + */ + TestValidationRulesInPluginXML.class, + + /** + * Model with OCL constraints embedded in profile + */ + TestValidationRulesInProfile.class, + + /** + * Model with UML warning (identifiers of same name in package), + * Model/profile. Model applies a stereotype, but does not set the value of a required stereotype attribute + * Model with non-integer multiplicity on attribute (0..MAX) + */ + TestUMLValidationRules.class, + + /** + * Model/profile. Model applies a stereotype, but does not set the value of a required stereotype attribute. + */ + TestStereotypeValidation.class +}) +public class AllTests { + // JUnit for test suite +} diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/src/org/eclipse/papyrus/uml/validation/tests/Messages.java b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/src/org/eclipse/papyrus/uml/validation/tests/Messages.java new file mode 100644 index 00000000000..5fc7ba11b81 --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/src/org/eclipse/papyrus/uml/validation/tests/Messages.java @@ -0,0 +1,47 @@ +/***************************************************************************** + * Copyright (c) 2015 CEA LIST 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: + * CEA LIST - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.validation.tests; + +import org.eclipse.osgi.util.NLS; + +/** + * @author ansgar + * + */ +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.eclipse.papyrus.uml.validation.tests.messages"; //$NON-NLS-1$ + public static String TestOCLConstraintOnInstanceSpec_PriceRule; + public static String TestOCLValidationRuleFromFile_CamelCaseRule; + public static String TestOCLValidationRuleFromFile_CanNotGetEnvFactory; + public static String TestOCLValidationRuleFromFile_OCLCanNotLoadMM; + public static String TestStereotypeValidation_UnsetRequiredAttribute; + public static String TestUMLValidationRules_DetectNameClash; + public static String TestUMLValidationRules_NonStandardMultiplicityMayNotImplyError; + public static String TestValidationRulesInPluginXML_ConstraintIsMissing; + public static String TestValidationRulesInPluginXML_IsActiveShouldNotTriggerIssue; + public static String TestValidationRulesInPluginXML_IsActiveShouldTriggerIssue; + public static String TestValidationRulesInPluginXML_IsPassiveShouldNotTriggerIssue; + public static String TestValidationRulesInPluginXML_IsPassiveShouldTriggerIssue; + public static String TestValidationRulesInProfile_IsActiveMalformedShouldTriggerIssue; + public static String TestValidationRulesInProfile_IsActiveShouldNotTriggerIssue; + public static String TestValidationRulesInProfile_IsActiveShouldTriggerIssue; + + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +} diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/src/org/eclipse/papyrus/uml/validation/tests/messages.properties b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/src/org/eclipse/papyrus/uml/validation/tests/messages.properties new file mode 100644 index 00000000000..0d5b38d5986 --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/src/org/eclipse/papyrus/uml/validation/tests/messages.properties @@ -0,0 +1,15 @@ +TestOCLConstraintOnInstanceSpec_PriceRule=The OCL price rule should trigger an issue for this instance specification +TestOCLValidationRuleFromFile_CamelCaseRule=The rule CamelCaseName in %s should trigger an issue for this class +TestOCLValidationRuleFromFile_CanNotGetEnvFactory=Can not get environment factory +TestOCLValidationRuleFromFile_OCLCanNotLoadMM=OCL: can not load meta-models +TestStereotypeValidation_UnsetRequiredAttribute=The unset required stereotype attribute should trigger an issue for class1 +TestUMLValidationRules_DetectNameClash=The standard UML validation should detect a name clash for class %s +TestUMLValidationRules_NonStandardMultiplicityMayNotImplyError=Non-standard multiplicities as in class %s may not imply an error +TestValidationRulesInPluginXML_ConstraintIsMissing=Constraint is missing +TestValidationRulesInPluginXML_IsActiveShouldNotTriggerIssue=The rule isActive should not trigger an issue for class %s +TestValidationRulesInPluginXML_IsActiveShouldTriggerIssue=The rule isActive should trigger an issue for class %s +TestValidationRulesInPluginXML_IsPassiveShouldNotTriggerIssue=The rule isPassive should trigger an issue for class %s +TestValidationRulesInPluginXML_IsPassiveShouldTriggerIssue=The rule isPassive should not trigger an issue for class %s +TestValidationRulesInProfile_IsActiveMalformedShouldTriggerIssue=The rule isActiveMalformed should trigger an issue for class %s +TestValidationRulesInProfile_IsActiveShouldNotTriggerIssue=The rule isActive should not trigger an issue for class %s +TestValidationRulesInProfile_IsActiveShouldTriggerIssue=The rule isActive should trigger an issue for class %s diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/src/org/eclipse/papyrus/uml/validation/tests/rules/AbstractValidationEditorTest.java b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/src/org/eclipse/papyrus/uml/validation/tests/rules/AbstractValidationEditorTest.java new file mode 100644 index 00000000000..71ec9879cc6 --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/src/org/eclipse/papyrus/uml/validation/tests/rules/AbstractValidationEditorTest.java @@ -0,0 +1,81 @@ +/***************************************************************************** + * 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: + * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.validation.tests.rules; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.emf.common.util.Diagnostic; +import org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest; +import org.eclipse.uml2.uml.Element; + + +/** + * Abstract test for validat + * import org.eclipse.uml2.uml.Element;ion rules + */ +public abstract class AbstractValidationEditorTest extends AbstractEditorTest { + + protected static final String PLATFORM_PLUGIN = "platform:/plugin/"; //$NON-NLS-1$ + + protected static final String VALIDATE_COMMAND_ID = "org.eclipse.papyrus.validation.ValidateModelCommand"; //$NON-NLS-1$ + + protected static final String PROJECT_PREFIX = "org.eclipse.testproject."; //$NON-NLS-1$ + + protected static final String RESOURCES_PATH = "/resources/"; //$NON-NLS-1$ + + protected static final String CAN_NOT_FIND_ELEMENT = "Can not find element %s in model %s"; //$NON-NLS-1$ + + /** validation diagnostic */ + protected Diagnostic globalDiagnostic; + + /** + * find diagnostic by source + * (Should be unique per element if the source is correctly defined) + */ + public List findDiagnosticBySource(Diagnostic diagnostic, String source) { + List foundDiagnostic = new ArrayList(); + List children = diagnostic.getChildren(); + if (source.equals(diagnostic.getSource())) { + foundDiagnostic.add(diagnostic); + } + if (children != null && !children.isEmpty()) { + for (Diagnostic diagnostic2 : children) { + foundDiagnostic.addAll(findDiagnosticBySource(diagnostic2, source)); + } + } + return foundDiagnostic; + } + + public List filterDiagnosticsByElement(List diagnostics, Element element) { + List filteredDiagnostics = new ArrayList(); + for (Diagnostic diagnostic : diagnostics) { + List datas = diagnostic.getData(); + if (datas != null && !datas.isEmpty()) { + // try to get first element. According to Diagnostic#getData() documentation : The first element is typically the object that is the primary source of the problem; + Object o = datas.get(0); + if (element.equals(o)) { + filteredDiagnostics.add(diagnostic); + } + } + } + return filteredDiagnostics; + } + + @Override + protected String getSourcePath() { + return RESOURCES_PATH; + } +} diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/src/org/eclipse/papyrus/uml/validation/tests/rules/TestOCLConstraintOnInstanceSpec.java b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/src/org/eclipse/papyrus/uml/validation/tests/rules/TestOCLConstraintOnInstanceSpec.java new file mode 100644 index 00000000000..aad98f65485 --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/src/org/eclipse/papyrus/uml/validation/tests/rules/TestOCLConstraintOnInstanceSpec.java @@ -0,0 +1,77 @@ +/***************************************************************************** + * 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: + * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Initial API and implementation + * Ansgar Radermacher (CEA) ansgar.radermacher@cea.fr - Extension to validation test suite + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.validation.tests.rules; + +import java.util.List; + +import org.eclipse.emf.common.util.Diagnostic; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.emf.transaction.util.TransactionUtil; +import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper; +import org.eclipse.papyrus.infra.services.validation.commands.ValidateModelCommand; +import org.eclipse.papyrus.uml.validation.tests.Activator; +import org.eclipse.papyrus.uml.validation.tests.Messages; +import org.eclipse.swt.widgets.Display; +import org.eclipse.uml2.uml.InstanceSpecification; +import org.eclipse.uml2.uml.Model; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +/** + * Test suite for validation rules. It tests + * - Model with OCL constraints on class, verified in instance specification + * - Model with OCL constraints on redefined attribute of a class. + */ +public class TestOCLConstraintOnInstanceSpec extends AbstractValidationEditorTest { + + public static final String MODEL_NAME = "instanceSpecification"; //$NON-NLS-1$ + + public final static String INSTANCE_NAME = "instance"; //$NON-NLS-1$ + + /** instance specification with constraint violation */ + protected InstanceSpecification instance; + + @Before + public void initModelForValidationTest() throws Exception { + initModel(PROJECT_PREFIX + MODEL_NAME, MODEL_NAME, Activator.getDefault().getBundle()); + + Model model = (Model) getRootUMLModel(); + + instance = (InstanceSpecification) model.getPackagedElement(INSTANCE_NAME); + Assert.assertNotNull(String.format(CAN_NOT_FIND_ELEMENT, INSTANCE_NAME, model), instance); + + final EditingDomain domain = TransactionUtil.getEditingDomain(model); + final ValidateModelCommand validateModelCommand = new ValidateModelCommand(model); + Display.getDefault().syncExec(new Runnable() { + @Override + public void run() { + domain.getCommandStack().execute(GMFtoEMFCommandWrapper.wrap(validateModelCommand)); + } + }); + + globalDiagnostic = validateModelCommand.getDiagnostic(); + } + + /** + * Validation needs to create an entry for the violated constraint of the instance specification + */ + @Test + public void validateOCLOnInstanceSpec() throws Exception { + // get the diagnostic and check for the given class + List diagnostics = filterDiagnosticsByElement(globalDiagnostic.getChildren(), instance); + Assert.assertEquals(Messages.TestOCLConstraintOnInstanceSpec_PriceRule, 1, diagnostics.size()); + } +} diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/src/org/eclipse/papyrus/uml/validation/tests/rules/TestOCLValidationRuleFromFile.java b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/src/org/eclipse/papyrus/uml/validation/tests/rules/TestOCLValidationRuleFromFile.java new file mode 100644 index 00000000000..e46e1e71a42 --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/src/org/eclipse/papyrus/uml/validation/tests/rules/TestOCLValidationRuleFromFile.java @@ -0,0 +1,116 @@ +/***************************************************************************** + * 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: + * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Initial API and implementation + * Ansgar Radermacher (CEA) ansgar.radermacher@cea.fr - Extension to validation test suite + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.validation.tests.rules; + +import java.util.List; + +import org.eclipse.emf.common.util.Diagnostic; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.emf.transaction.util.TransactionUtil; +import org.eclipse.ocl.pivot.internal.resource.OCLAdapter; +import org.eclipse.ocl.xtext.completeocl.utilities.CompleteOCLLoader; +import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper; +import org.eclipse.papyrus.infra.services.validation.commands.ValidateModelCommand; +import org.eclipse.papyrus.uml.validation.tests.Activator; +import org.eclipse.papyrus.uml.validation.tests.Messages; +import org.eclipse.swt.widgets.Display; +import org.eclipse.uml2.uml.Class; +import org.eclipse.uml2.uml.Model; +import org.eclipse.uml2.uml.Package; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +/** + * Test suite for validation rules: + * Verify that custom OCL file contributes to validation, see bug 408215* Sample test for cut in model explorer + */ +public class TestOCLValidationRuleFromFile extends AbstractValidationEditorTest { + + protected static final String EXTRA_UML_VALIDATION_OCL = "ExtraUMLValidation.ocl"; //$NON-NLS-1$ + + protected static final String CONSTRAINT_ID = "isActiveEntity"; //$NON-NLS-1$ + + protected static final String MODEL_NAME = "UMLValidationTests"; //$NON-NLS-1$ + + protected static final String PKG_OCL_FROM_FILE = "oclFromFile"; //$NON-NLS-1$ + + protected final static String CLASS_LOWER_CASE = "lowerCaseClass"; //$NON-NLS-1$ + + /* class starting with a lower case name (violates constraint in external OCL file) */ + protected Class lowerCaseClass; + + @Before + public void initModelForValidationTest() throws Exception { + initModel(PROJECT_PREFIX + MODEL_NAME, MODEL_NAME, Activator.getDefault().getBundle()); + + Model model = (Model) getRootUMLModel(); + Package pkg = (Package) model.getPackagedElement(PKG_OCL_FROM_FILE); + Assert.assertNotNull(String.format(CAN_NOT_FIND_ELEMENT, PKG_OCL_FROM_FILE, model), pkg); + + lowerCaseClass = (Class) pkg.getPackagedElement(CLASS_LOWER_CASE); + Assert.assertNotNull(String.format(CAN_NOT_FIND_ELEMENT, CLASS_LOWER_CASE, model), lowerCaseClass); + + // Registering OCL components + // + ResourceSet modelResources = model.eResource().getResourceSet(); + OCLAdapter oclAdapter = OCLAdapter.getAdapter(modelResources); + CompleteOCLLoader helper = new CompleteOCLLoader(oclAdapter.getEnvironmentFactory()) { + @Override + protected boolean error(String primaryMessage, String detailMessage) { + Assert.fail(Messages.TestOCLValidationRuleFromFile_CanNotGetEnvFactory); + return false; + } + }; + Assert.assertTrue(Messages.TestOCLValidationRuleFromFile_OCLCanNotLoadMM, helper.loadMetamodels()); + + // load OCL file + URI oclURI = URI.createPlatformPluginURI(Activator.PLUGIN_ID + RESOURCES_PATH + EXTRA_UML_VALIDATION_OCL, false); + try { + if (!helper.loadDocument(oclURI)) { + Assert.fail("Can not load OCL document with URI: " + oclURI.path()); //$NON-NLS-1$ + } + } catch (Throwable e) { + Assert.fail(String.format("Exception %s during loading of OCL document with URI: %s", e.getMessage(), oclURI.path())); //$NON-NLS-1$ + } + helper.installPackages(); + + // it's important to create the validate model command after the OCL file has been loaded + final ValidateModelCommand validateModelCommand = new ValidateModelCommand(model); + + final EditingDomain domain = TransactionUtil.getEditingDomain(model); + Display.getDefault().syncExec(new Runnable() { + @Override + public void run() { + domain.getCommandStack().execute(GMFtoEMFCommandWrapper.wrap(validateModelCommand)); + } + }); + globalDiagnostic = validateModelCommand.getDiagnostic(); + } + + /** + * Failing validation for rule defined in ExtraUMLValidation + */ + @Test + public void validateCamelCaseRule() throws Exception { + // get the diagnostic and check for the given class + List diagnostics = filterDiagnosticsByElement(globalDiagnostic.getChildren(), lowerCaseClass); + Assert.assertEquals(String.format( + Messages.TestOCLValidationRuleFromFile_CamelCaseRule, EXTRA_UML_VALIDATION_OCL), + 1, diagnostics.size()); + } +} diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/src/org/eclipse/papyrus/uml/validation/tests/rules/TestStereotypeValidation.java b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/src/org/eclipse/papyrus/uml/validation/tests/rules/TestStereotypeValidation.java new file mode 100644 index 00000000000..6d287fbfd6f --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/src/org/eclipse/papyrus/uml/validation/tests/rules/TestStereotypeValidation.java @@ -0,0 +1,78 @@ +/***************************************************************************** + * 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: + * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Initial API and implementation + * Ansgar Radermacher (CEA) ansgar.radermacher@cea.fr - Extension to validation test suite + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.validation.tests.rules; + +import java.util.List; + +import org.eclipse.emf.common.util.Diagnostic; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.emf.transaction.util.TransactionUtil; +import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper; +import org.eclipse.papyrus.infra.services.validation.commands.ValidateModelCommand; +import org.eclipse.papyrus.uml.validation.tests.Activator; +import org.eclipse.papyrus.uml.validation.tests.Messages; +import org.eclipse.swt.widgets.Display; +import org.eclipse.uml2.uml.Class; +import org.eclipse.uml2.uml.Model; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +/** + * Test suite for validation rules. It tests + * Model/profile. Model applies a stereotype, but does not set the value of a required stereotype attribute. + */ +public class TestStereotypeValidation extends AbstractValidationEditorTest { + + public static final String MODEL_NAME = "simple"; //$NON-NLS-1$ + + public static final String PROFILE_NAME = "simple.profile"; //$NON-NLS-1$ + + public final static String CLASS1 = "Class1"; //$NON-NLS-1$ + protected Class class1; + + @Before + public void initModelForValidationTest() throws Exception { + createProject(PROJECT_PREFIX + MODEL_NAME); + copyModel(PROFILE_NAME, Activator.getDefault().getBundle()); + initModel(MODEL_NAME, Activator.getDefault().getBundle()); + + Model model = (Model) getRootUMLModel(); + + class1 = (Class) model.getPackagedElement(CLASS1); + Assert.assertNotNull(String.format(CAN_NOT_FIND_ELEMENT, CLASS1, model), class1); + + final EditingDomain domain = TransactionUtil.getEditingDomain(model); + final ValidateModelCommand validateModelCommand = new ValidateModelCommand(model); + Display.getDefault().syncExec(new Runnable() { + @Override + public void run() { + domain.getCommandStack().execute(GMFtoEMFCommandWrapper.wrap(validateModelCommand)); + } + }); + + globalDiagnostic = validateModelCommand.getDiagnostic(); + } + + /** + * Failing validation for stereotype whose required attribute is unset + */ + @Test + public void validateUnsetStereotypeAttribute() throws Exception { + // get the diagnostic and check for the given capsule + List diagnostics = filterDiagnosticsByElement(globalDiagnostic.getChildren(), class1); + Assert.assertEquals(Messages.TestStereotypeValidation_UnsetRequiredAttribute, 1, diagnostics.size()); + } +} diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/src/org/eclipse/papyrus/uml/validation/tests/rules/TestUMLValidationRules.java b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/src/org/eclipse/papyrus/uml/validation/tests/rules/TestUMLValidationRules.java new file mode 100644 index 00000000000..8595ef369f6 --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/src/org/eclipse/papyrus/uml/validation/tests/rules/TestUMLValidationRules.java @@ -0,0 +1,103 @@ +/***************************************************************************** + * 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: + * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Initial API and implementation + * Ansgar Radermacher (CEA) ansgar.radermacher@cea.fr - Extension to validation test suite + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.validation.tests.rules; + +import java.util.List; + +import org.eclipse.emf.common.util.Diagnostic; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.emf.transaction.util.TransactionUtil; +import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper; +import org.eclipse.papyrus.infra.services.validation.commands.ValidateModelCommand; +import org.eclipse.papyrus.uml.validation.tests.Activator; +import org.eclipse.papyrus.uml.validation.tests.Messages; +import org.eclipse.swt.widgets.Display; +import org.eclipse.uml2.uml.Class; +import org.eclipse.uml2.uml.Model; +import org.eclipse.uml2.uml.Package; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +/** + * Test suite for UML validation rules. It tests + * - Model with UML warning (identifiers of same name in package) + * - Model with non-integer multiplicity on attribute (0..MAX) + */ +public class TestUMLValidationRules extends AbstractValidationEditorTest { + + public static final String MODEL_NAME = "UMLValidationTests"; //$NON-NLS-1$ + + public final static String PKG_NAME_CLASH = "nameclash"; //$NON-NLS-1$ + + public final static String CLASS1 = "Class1"; //$NON-NLS-1$ + protected Class class1; + + public final static String PKG_MULTIPLICITY = "multiplicity"; //$NON-NLS-1$ + public final static String NON_STANDARD_MULTIPLICITY = "NonStandardMultiplicity"; //$NON-NLS-1$ + protected Class nonStandardMultiplicity; + + @Before + public void initModelForValidationTest() throws Exception { + initModel(PROJECT_PREFIX + MODEL_NAME, MODEL_NAME, Activator.getDefault().getBundle()); + + // validate the new model + + Assert.assertNotNull("RootModel is null", getRootUMLModel()); //$NON-NLS-1$ + Model model = (Model) getRootUMLModel(); + + Package nameclash = (Package) model.getPackagedElement(PKG_NAME_CLASH); + Assert.assertNotNull(String.format(CAN_NOT_FIND_ELEMENT, PKG_NAME_CLASH, model), nameclash); + class1 = (Class) nameclash.getPackagedElement(CLASS1); + Assert.assertNotNull(String.format(CAN_NOT_FIND_ELEMENT, CLASS1, model), class1); + + Package multiplicty = (Package) model.getPackagedElement(PKG_MULTIPLICITY); + Assert.assertNotNull(String.format(CAN_NOT_FIND_ELEMENT, PKG_MULTIPLICITY, model), multiplicty); + nonStandardMultiplicity = (Class) multiplicty.getPackagedElement(NON_STANDARD_MULTIPLICITY); + Assert.assertNotNull(String.format(CAN_NOT_FIND_ELEMENT, NON_STANDARD_MULTIPLICITY, model), nonStandardMultiplicity); + + final EditingDomain domain = TransactionUtil.getEditingDomain(model); + final ValidateModelCommand validateModelCommand = new ValidateModelCommand(model); + Display.getDefault().syncExec(new Runnable() { + @Override + public void run() { + domain.getCommandStack().execute(GMFtoEMFCommandWrapper.wrap(validateModelCommand)); + } + }); + + globalDiagnostic = validateModelCommand.getDiagnostic(); + } + + /** + * Simple failing validation for IsActiveEntityRule + */ + @Test + public void validateNameClashDetection() throws Exception { + // get the diagnostic and check for the given class + List diagnostics = filterDiagnosticsByElement(globalDiagnostic.getChildren(), class1); + Assert.assertEquals(String.format(Messages.TestUMLValidationRules_DetectNameClash, class1), 1, diagnostics.size()); + } + + /** + * Simple valid validation for IsActiveEntityRule + */ + @Test + public void validateNonStandardMultiplicity() throws Exception { + // get the diagnostic and check for the given class + List diagnostics = filterDiagnosticsByElement(globalDiagnostic.getChildren(), nonStandardMultiplicity); + Assert.assertEquals(String.format(Messages.TestUMLValidationRules_NonStandardMultiplicityMayNotImplyError, nonStandardMultiplicity), 0, diagnostics.size()); + } + +} diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/src/org/eclipse/papyrus/uml/validation/tests/rules/TestValidationRulesInPluginXML.java b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/src/org/eclipse/papyrus/uml/validation/tests/rules/TestValidationRulesInPluginXML.java new file mode 100644 index 00000000000..54f6dc05ada --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/src/org/eclipse/papyrus/uml/validation/tests/rules/TestValidationRulesInPluginXML.java @@ -0,0 +1,147 @@ +/***************************************************************************** + * 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: + * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Initial API and implementation + * Ansgar Radermacher (CEA) ansgar.radermacher@cea.fr - Extension to validation test suite + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.validation.tests.rules; + +import java.util.List; + +import org.eclipse.emf.common.util.Diagnostic; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.emf.transaction.util.TransactionUtil; +import org.eclipse.emf.validation.service.ConstraintRegistry; +import org.eclipse.emf.validation.service.IConstraintDescriptor; +import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper; +import org.eclipse.papyrus.infra.services.validation.commands.ValidateModelCommand; +import org.eclipse.papyrus.junit.framework.classification.FailingTest; +import org.eclipse.papyrus.uml.validation.tests.Activator; +import org.eclipse.papyrus.uml.validation.tests.Messages; +import org.eclipse.swt.widgets.Display; +import org.eclipse.uml2.uml.Class; +import org.eclipse.uml2.uml.Model; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +/** + * Test suite for validation rules. It tests + * Model with OCL constraints in plugin.xml (EMFv) + * Model with Java constraints in plugin.xml (EMFv) + */ +public class TestValidationRulesInPluginXML extends AbstractValidationEditorTest { + + public static final String CONSTRAINT_PLUGIN = "org.eclipse.papyrus.uml.validation.tests.genvalidation"; //$NON-NLS-1$ + + public static final String CONSTRAINT_ID_ALWAYS_ACTIVE = "profile.AlwaysActive.ConstraintAlwaysActive"; //$NON-NLS-1$ + + public static final String MODEL_NAME = "active-tst.rule-in-plugin"; //$NON-NLS-1$ + + /** + * An active class applying a stereotype with an attached OCL constraint requiring that the class is active + */ + public final static String INACTIVE_OCL_NAME = "ActiveOCL"; //$NON-NLS-1$ + protected Class activeOCL; + + /** + * A non active class applying a stereotype with an attached OCL constraint requiring that the class is active + */ + public final static String ACTIVE_OCL_NAME = "InactiveOCL"; //$NON-NLS-1$ + protected Class inactiveOCL; + + /** + * A non active class applying a stereotype with an attached Java constraint requiring that the class is passive + */ + public final static String INACTIVE_JAVA_NAME = "InactiveJava"; //$NON-NLS-1$ + protected Class inactiveJava; + + /** + * An active class applying a stereotype with an attached Java constraint requiring that the class is passive + */ + public final static String ACTIVE_JAVA_NAME = "ActiveJava"; //$NON-NLS-1$ + protected Class activeJava; + + @Before + public void initModelForValidationTest() throws Exception { + initModel(PROJECT_PREFIX + MODEL_NAME, MODEL_NAME, Activator.getDefault().getBundle()); + + Model model = (Model) getRootUMLModel(); + + inactiveOCL = (Class) model.getPackagedElement(INACTIVE_OCL_NAME); + Assert.assertNotNull(String.format(CAN_NOT_FIND_ELEMENT, INACTIVE_OCL_NAME, model), inactiveOCL); + + activeOCL = (Class) model.getPackagedElement(ACTIVE_OCL_NAME); + Assert.assertNotNull(String.format(CAN_NOT_FIND_ELEMENT, ACTIVE_OCL_NAME, model), activeOCL); + + inactiveJava = (Class) model.getPackagedElement(INACTIVE_JAVA_NAME); + Assert.assertNotNull(String.format(CAN_NOT_FIND_ELEMENT, INACTIVE_JAVA_NAME, model), inactiveJava); + + activeJava = (Class) model.getPackagedElement(ACTIVE_JAVA_NAME); + Assert.assertNotNull(String.format(CAN_NOT_FIND_ELEMENT, ACTIVE_JAVA_NAME, model), activeJava); + + final EditingDomain domain = TransactionUtil.getEditingDomain(model); + final ValidateModelCommand validateModelCommand = new ValidateModelCommand(model); + Display.getDefault().syncExec(new Runnable() { + @Override + public void run() { + domain.getCommandStack().execute(GMFtoEMFCommandWrapper.wrap(validateModelCommand)); + } + }); + + // check that the constraint exists + ConstraintRegistry instance = ConstraintRegistry.getInstance(); + IConstraintDescriptor descriptor = instance.getDescriptor(CONSTRAINT_PLUGIN, CONSTRAINT_ID_ALWAYS_ACTIVE); + Assert.assertNotNull(Messages.TestValidationRulesInPluginXML_ConstraintIsMissing, descriptor); + + globalDiagnostic = validateModelCommand.getDiagnostic(); + } + + /** + * Failing validation for IsActiveEntityRule (OCL rule, on inactive class) + */ + @Test + public void validateIsActiveOCLRule_inactiveClass() throws Exception { + // get the diagnostic and check for the given class + List diagnostics = filterDiagnosticsByElement(globalDiagnostic.getChildren(), inactiveOCL); + Assert.assertEquals(String.format(Messages.TestValidationRulesInPluginXML_IsActiveShouldTriggerIssue, inactiveOCL), 1, diagnostics.size()); + } + + /** + * Successful validation for IsActiveEntityRule (OCL rule, on active class) + */ + @FailingTest + public void validateIsActiveOCLRule_activeClass() throws Exception { + // get the diagnostic and check for the given class + List diagnostics = filterDiagnosticsByElement(globalDiagnostic.getChildren(), activeOCL); + Assert.assertEquals(String.format(Messages.TestValidationRulesInPluginXML_IsActiveShouldNotTriggerIssue, activeOCL), 0, diagnostics.size()); + } + + /** + * Successful validation for IsPassiveEntityRule (Java rule, on inactive class) + */ + @Test + public void validateIsPassiveJavaRule_inactiveClass() throws Exception { + // get the diagnostic and check for the given class + List diagnostics = filterDiagnosticsByElement(globalDiagnostic.getChildren(), inactiveJava); + Assert.assertEquals(String.format(Messages.TestValidationRulesInPluginXML_IsPassiveShouldTriggerIssue, inactiveJava), 0, diagnostics.size()); + } + + /** + * Failing validation for IsPassiveEntityRule (Java rule, on active class) + */ + @Test + public void validateIsPassiveJavaRule_activeClass() throws Exception { + // get the diagnostic and check for the given class + List diagnostics = filterDiagnosticsByElement(globalDiagnostic.getChildren(), activeJava); + Assert.assertEquals(String.format(Messages.TestValidationRulesInPluginXML_IsPassiveShouldNotTriggerIssue, activeJava), 1, diagnostics.size()); + } +} diff --git a/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/src/org/eclipse/papyrus/uml/validation/tests/rules/TestValidationRulesInProfile.java b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/src/org/eclipse/papyrus/uml/validation/tests/rules/TestValidationRulesInProfile.java new file mode 100644 index 00000000000..39307091db4 --- /dev/null +++ b/tests/junit/plugins/uml/validation/org.eclipse.papyrus.uml.validation.tests/src/org/eclipse/papyrus/uml/validation/tests/rules/TestValidationRulesInProfile.java @@ -0,0 +1,123 @@ +/***************************************************************************** + * 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: + * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Initial API and implementation + * Ansgar Radermacher (CEA) ansgar.radermacher@cea.fr - Extension to validation test suite + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.validation.tests.rules; + +import java.util.List; + +import org.eclipse.emf.common.util.Diagnostic; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.emf.transaction.util.TransactionUtil; +import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper; +import org.eclipse.papyrus.infra.services.validation.commands.ValidateModelCommand; +import org.eclipse.papyrus.uml.validation.tests.Activator; +import org.eclipse.papyrus.uml.validation.tests.Messages; +import org.eclipse.swt.widgets.Display; +import org.eclipse.uml2.uml.Class; +import org.eclipse.uml2.uml.Model; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +/** + * Test suite for validation rules. It tests + * Model with OCL constraints embedded in profile + */ +public class TestValidationRulesInProfile extends AbstractValidationEditorTest { + + public static final String CONSTRAINT_ID = "isActiveEntity"; //$NON-NLS-1$ + + public static final String PROFILE_NAME = "active.rule-in-definition.profile"; //$NON-NLS-1$ + + public static final String MODEL_NAME = "active-tst.rule-in-definition"; //$NON-NLS-1$ + + /** + * A non active class applying a stereotype with an attached OCL constraint requiring that the class is active + */ + public final static String INACTIVE_NAME = "Inactive"; //$NON-NLS-1$ + protected Class active; + + /** + * An active class applying a stereotype with an attached OCL constraint requiring that the class is active + */ + public final static String ACTIVE_NAME = "Active"; //$NON-NLS-1$ + protected Class inactive; + + /** + * An active class applying a stereotype with a malformed OCL constraint attached + */ + public final static String ACTIVE_MALFORMED_NAME = "ActiveMalformed"; //$NON-NLS-1$ + protected Class activeMalformed; + + @Before + public void initModelForValidationTest() throws Exception { + createProject(PROJECT_PREFIX + MODEL_NAME); + copyModel(PROFILE_NAME, Activator.getDefault().getBundle()); + initModel(MODEL_NAME, Activator.getDefault().getBundle()); + + + // validate the new model + Model model = (Model) getRootUMLModel(); + + active = (Class) model.getPackagedElement(ACTIVE_NAME); + Assert.assertNotNull(String.format(CAN_NOT_FIND_ELEMENT, ACTIVE_NAME, model), active); + + inactive = (Class) model.getPackagedElement(INACTIVE_NAME); + Assert.assertNotNull(String.format(CAN_NOT_FIND_ELEMENT, INACTIVE_NAME, model), inactive); + + activeMalformed = (Class) model.getPackagedElement(ACTIVE_MALFORMED_NAME); + Assert.assertNotNull(String.format(CAN_NOT_FIND_ELEMENT, ACTIVE_MALFORMED_NAME, model), activeMalformed); + + final EditingDomain domain = TransactionUtil.getEditingDomain(model); + final ValidateModelCommand validateModelCommand = new ValidateModelCommand(model); + Display.getDefault().syncExec(new Runnable() { + @Override + public void run() { + domain.getCommandStack().execute(GMFtoEMFCommandWrapper.wrap(validateModelCommand)); + } + }); + + globalDiagnostic = validateModelCommand.getDiagnostic(); + } + + /** + * No errors on active class + */ + @Test + public void validateIsActiveRule_ActiveCapsule() throws Exception { + // get the diagnostic and check for the given class + List diagnostics = filterDiagnosticsByElement(globalDiagnostic.getChildren(), active); + Assert.assertEquals(String.format(Messages.TestValidationRulesInProfile_IsActiveShouldNotTriggerIssue, active), 0, diagnostics.size()); + } + + /** + * One warning on inactive class + */ + @Test + public void validateIsActiveRule_notActiveCapsule() throws Exception { + // get the diagnostic and check for the given class + List diagnostics = filterDiagnosticsByElement(globalDiagnostic.getChildren(), inactive); + Assert.assertEquals(String.format(Messages.TestValidationRulesInProfile_IsActiveShouldTriggerIssue, inactive), 1, diagnostics.size()); + } + + /** + * One error on malformed class + */ + @Test + public void validateMalformedActiveRule_notActiveCapsule() throws Exception { + // get the diagnostic and check for the given class + List diagnostics = filterDiagnosticsByElement(globalDiagnostic.getChildren(), activeMalformed); + Assert.assertEquals(String.format(Messages.TestValidationRulesInProfile_IsActiveMalformedShouldTriggerIssue, activeMalformed), 1, diagnostics.size()); + } +} -- cgit v1.2.3