diff options
author | Camille Letavernier | 2014-03-14 17:35:18 +0000 |
---|---|---|
committer | Camille Letavernier | 2014-03-14 17:36:53 +0000 |
commit | cf6ade33c5735bb55f8125a2fe0ab17bffed41e8 (patch) | |
tree | aaae6035ff71965f3a5abe236d07f6656386516e /deprecated | |
parent | 4e72c1a2ccf1063454a65ee60bd4f0d4c18db875 (diff) | |
download | org.eclipse.papyrus-cf6ade33c5735bb55f8125a2fe0ab17bffed41e8.tar.gz org.eclipse.papyrus-cf6ade33c5735bb55f8125a2fe0ab17bffed41e8.tar.xz org.eclipse.papyrus-cf6ade33c5735bb55f8125a2fe0ab17bffed41e8.zip |
[Releng] Move the *.core.queries.* test plug-ins to the deprecated
folder
Diffstat (limited to 'deprecated')
65 files changed, 2571 insertions, 0 deletions
diff --git a/deprecated/org.eclipse.papyrus.core.queries.configuration.tests/.classpath b/deprecated/org.eclipse.papyrus.core.queries.configuration.tests/.classpath new file mode 100644 index 00000000000..f6e5811e42c --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.configuration.tests/.classpath @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/deprecated/org.eclipse.papyrus.core.queries.configuration.tests/.project b/deprecated/org.eclipse.papyrus.core.queries.configuration.tests/.project new file mode 100644 index 00000000000..1ea070c1cb1 --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.configuration.tests/.project @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.core.queries.configuration.tests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ </natures>
+</projectDescription>
diff --git a/deprecated/org.eclipse.papyrus.core.queries.configuration.tests/META-INF/MANIFEST.MF b/deprecated/org.eclipse.papyrus.core.queries.configuration.tests/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..bfc42fda765 --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.configuration.tests/META-INF/MANIFEST.MF @@ -0,0 +1,22 @@ +Manifest-Version: 1.0
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.papyrus.infra.queries.core.configuration;bundle-version="1.0.0";visibility:=reexport,
+ org.eclipse.emf.ecore;visibility:=reexport,
+ org.eclipse.emf.facet.infra.query;visibility:=reexport,
+ org.eclipse.emf.ecore.xmi;visibility:=reexport,
+ org.eclipse.papyrus.infra.queries.core;bundle-version="1.0.0",
+ org.eclipse.papyrus.core.queries.test;bundle-version="1.0.0",
+ org.eclipse.uml2.uml,
+ org.eclipse.emf.facet.infra.query.core,
+ org.junit;bundle-version="4.10.0"
+Bundle-Vendor: %providerName
+Bundle-ActivationPolicy: lazy
+Bundle-ClassPath: .
+Bundle-Version: 1.0.0.qualifier
+Bundle-Name: %pluginName
+Bundle-Localization: plugin
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.papyrus.core.queries.configuration.te
+ sts;singleton:=true
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+
diff --git a/deprecated/org.eclipse.papyrus.core.queries.configuration.tests/about.html b/deprecated/org.eclipse.papyrus.core.queries.configuration.tests/about.html new file mode 100644 index 00000000000..82d49bf5f81 --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.configuration.tests/about.html @@ -0,0 +1,28 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2007</p>
+<h3>License</h3>
+
+<p>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 <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>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 <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/deprecated/org.eclipse.papyrus.core.queries.configuration.tests/build.properties b/deprecated/org.eclipse.papyrus.core.queries.configuration.tests/build.properties new file mode 100644 index 00000000000..b5b64632427 --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.configuration.tests/build.properties @@ -0,0 +1,6 @@ +bin.includes = .,\
+ META-INF/,\
+ plugin.properties,\
+ plugin.xml,\
+ about.html,\
+ resource/
diff --git a/deprecated/org.eclipse.papyrus.core.queries.configuration.tests/plugin.properties b/deprecated/org.eclipse.papyrus.core.queries.configuration.tests/plugin.properties new file mode 100644 index 00000000000..153470243c9 --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.configuration.tests/plugin.properties @@ -0,0 +1,8 @@ +
+# <copyright>
+# </copyright>
+#
+# $Id$
+
+pluginName = QueryConfiguration Tests (Incubation)
+providerName = Eclipse Modeling Project
diff --git a/deprecated/org.eclipse.papyrus.core.queries.configuration.tests/plugin.xml b/deprecated/org.eclipse.papyrus.core.queries.configuration.tests/plugin.xml new file mode 100644 index 00000000000..786991d95b2 --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.configuration.tests/plugin.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?eclipse version="3.4"?> +<plugin> + <extension point="org.eclipse.emf.facet.infra.query.registration"> + <modelqueryset file="resource/CoreQueriesConfigurationSet.querySet"/> + </extension> +</plugin> diff --git a/deprecated/org.eclipse.papyrus.core.queries.configuration.tests/resource/CoreQueriesConfigurationSet.querySet b/deprecated/org.eclipse.papyrus.core.queries.configuration.tests/resource/CoreQueriesConfigurationSet.querySet new file mode 100644 index 00000000000..c44b3eab993 --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.configuration.tests/resource/CoreQueriesConfigurationSet.querySet @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<query:ModelQuerySet xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:query="http://www.eclipse.org/EmfFacet/infra/query/0.8.incubation" name="CoreQueriesConfigurationSet" description="Query Set for testing plugin core queries configuration">
+ <associatedMetamodels href="http://www.eclipse.org/uml2/4.0.0/UML#/"/>
+ <associatedMetamodels href="http://www.eclipse.org/uml2/4.0.0/Types#/"/>
+ <queries xsi:type="query:JavaModelQuery" name="IsNamed" description="test - test if the name of the element is equal to the specified name" implementationClassName="org.eclipse.papyrus.core.queries.test.modisco.queries.IsNamed">
+ <returnType xsi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/4.0.0/Types#//Boolean"/>
+ <scope href="http://www.eclipse.org/uml2/4.0.0/UML#//NamedElement"/>
+ <parameters name="name">
+ <type xsi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/4.0.0/Types#//String"/>
+ </parameters>
+ </queries>
+</query:ModelQuerySet>
diff --git a/deprecated/org.eclipse.papyrus.core.queries.configuration.tests/resource/Test1.configuration b/deprecated/org.eclipse.papyrus.core.queries.configuration.tests/resource/Test1.configuration new file mode 100644 index 00000000000..b3a1cee35e0 --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.configuration.tests/resource/Test1.configuration @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<configuration:ModiscoQueryConfiguration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:configuration="http://www.eclipse.org/papyrus/core/queries/0.7" xmlns:query="http://www.eclipse.org/EmfFacet/infra/query/0.8.incubation" xmlns:uml="http://www.eclipse.org/uml2/3.0.0/UML" query="query:JavaModelQuery CoreQueriesConfigurationSet.querySet#IsNamed">
+ <parameterValues parameter="CoreQueriesConfigurationSet.querySet#name">
+ <valueInstance xsi:type="uml:LiteralString" name="TestModel"/>
+ </parameterValues>
+</configuration:ModiscoQueryConfiguration>
diff --git a/deprecated/org.eclipse.papyrus.core.queries.configuration.tests/resource/TestModel.uml b/deprecated/org.eclipse.papyrus.core.queries.configuration.tests/resource/TestModel.uml new file mode 100644 index 00000000000..a8dc6187e2b --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.configuration.tests/resource/TestModel.uml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<uml:Package xmi:version="2.1" xmlns:xmi="http://schema.omg.org/spec/XMI/2.1" xmlns:uml="http://www.eclipse.org/uml2/3.0.0/UML" xmi:id="_MAhnwdFqEd-ebcflpb1o4w" name="TestModel">
+ <packagedElement xmi:type="uml:Class" xmi:id="_OXxL8NFqEd-ebcflpb1o4w" name="TestClass"/>
+</uml:Package>
diff --git a/deprecated/org.eclipse.papyrus.core.queries.test/.classpath b/deprecated/org.eclipse.papyrus.core.queries.test/.classpath new file mode 100644 index 00000000000..2d1a4302f04 --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.test/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/deprecated/org.eclipse.papyrus.core.queries.test/.project b/deprecated/org.eclipse.papyrus.core.queries.test/.project new file mode 100644 index 00000000000..067347a2311 --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.test/.project @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.core.queries.test</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/deprecated/org.eclipse.papyrus.core.queries.test/.settings/org.eclipse.core.resources.prefs b/deprecated/org.eclipse.papyrus.core.queries.test/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 00000000000..290533da739 --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.test/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,5 @@ +#Mon Oct 04 15:09:11 CEST 2010
+eclipse.preferences.version=1
+encoding//resources/basic.ecore=UTF-8
+encoding//resources/basic.ecorediag=UTF-8
+encoding//src/org/eclipse/papyrus/core/queries/test/modisco/messages.properties=ISO-8859-1
diff --git a/deprecated/org.eclipse.papyrus.core.queries.test/.settings/org.eclipse.jdt.core.prefs b/deprecated/org.eclipse.papyrus.core.queries.test/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000000..4c7133a63e1 --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.test/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Mon Oct 04 11:44:28 CEST 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/deprecated/org.eclipse.papyrus.core.queries.test/META-INF/MANIFEST.MF b/deprecated/org.eclipse.papyrus.core.queries.test/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..ed116d991ef --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.test/META-INF/MANIFEST.MF @@ -0,0 +1,25 @@ +Manifest-Version: 1.0
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.papyrus.infra.queries.core;bundle-version="1.0.0",
+ org.eclipse.emf.facet.infra.query;bundle-version="0.1.0",
+ org.eclipse.emf.facet.infra.query.core;bundle-version="0.1.0",
+ org.eclipse.emf.facet.infra.common.core;bundle-version="0.1.0",
+ org.eclipse.uml2.uml,
+ org.eclipse.papyrus.infra.queries.core.configuration;bundle-version="1.0.0",
+ org.eclipse.emf.ecore,
+ org.junit;bundle-version="4.10.0"
+Export-Package: org.eclipse.papyrus.core.queries.test,
+ org.eclipse.papyrus.core.queries.test.modisco,
+ org.eclipse.papyrus.core.queries.test.modisco.queries
+Bundle-Vendor: %providerName
+Bundle-ActivationPolicy: lazy
+Bundle-Version: 1.0.0.qualifier
+Bundle-Name: %pluginName
+Bundle-Localization: plugin
+Bundle-Activator: org.eclipse.papyrus.core.queries.test.Activator
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.papyrus.core.queries.test;singleton:=
+ true
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+
diff --git a/deprecated/org.eclipse.papyrus.core.queries.test/about.html b/deprecated/org.eclipse.papyrus.core.queries.test/about.html new file mode 100644 index 00000000000..82d49bf5f81 --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.test/about.html @@ -0,0 +1,28 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2007</p>
+<h3>License</h3>
+
+<p>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 <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>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 <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/deprecated/org.eclipse.papyrus.core.queries.test/build.properties b/deprecated/org.eclipse.papyrus.core.queries.test/build.properties new file mode 100644 index 00000000000..53926ef8f40 --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.test/build.properties @@ -0,0 +1,8 @@ +output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.properties,\
+ plugin.xml,\
+ resources/,\
+ about.html
+source.. = src/
diff --git a/deprecated/org.eclipse.papyrus.core.queries.test/org.eclipse.papyrus.core.queries.test.launch b/deprecated/org.eclipse.papyrus.core.queries.test/org.eclipse.papyrus.core.queries.test.launch new file mode 100644 index 00000000000..5898e5a0bcb --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.test/org.eclipse.papyrus.core.queries.test.launch @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig">
+<booleanAttribute key="append.args" value="true"/>
+<booleanAttribute key="askclear" value="false"/>
+<booleanAttribute key="automaticAdd" value="true"/>
+<booleanAttribute key="automaticValidate" value="false"/>
+<stringAttribute key="bootstrap" value=""/>
+<stringAttribute key="checked" value="[NONE]"/>
+<booleanAttribute key="clearConfig" value="true"/>
+<booleanAttribute key="clearws" value="true"/>
+<booleanAttribute key="clearwslog" value="false"/>
+<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/org.eclipse.papyrus.core.queries.test"/>
+<booleanAttribute key="default" value="true"/>
+<booleanAttribute key="includeOptional" value="true"/>
+<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/org.eclipse.papyrus.core.queries.test"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="4"/>
+</listAttribute>
+<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=org.eclipse.papyrus.core.queries.test"/>
+<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
+<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
+<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value=""/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.papyrus.core.queries.test"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dosgi.requiredJavaVersion=1.5 -Xms40m -Xmx512m"/>
+<stringAttribute key="pde.version" value="3.3"/>
+<stringAttribute key="product" value="org.eclipse.platform.ide"/>
+<booleanAttribute key="run_in_ui_thread" value="true"/>
+<booleanAttribute key="show_selected_only" value="false"/>
+<booleanAttribute key="tracing" value="false"/>
+<booleanAttribute key="useCustomFeatures" value="false"/>
+<booleanAttribute key="useDefaultConfig" value="true"/>
+<booleanAttribute key="useDefaultConfigArea" value="true"/>
+<booleanAttribute key="useProduct" value="true"/>
+</launchConfiguration>
diff --git a/deprecated/org.eclipse.papyrus.core.queries.test/plugin.properties b/deprecated/org.eclipse.papyrus.core.queries.test/plugin.properties new file mode 100644 index 00000000000..943221ff355 --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.test/plugin.properties @@ -0,0 +1,16 @@ +#################################################################################
+# Copyright (c) 2010 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:
+# Remi Schnekenburger remi.schnekenburger@cea.fr - Initial API and implementation
+##################################################################################
+pluginName=Papyrus Core Queries Test Plugin (Incubation)
+providerName=Eclipse Modeling Project
+
+
+
+
diff --git a/deprecated/org.eclipse.papyrus.core.queries.test/plugin.xml b/deprecated/org.eclipse.papyrus.core.queries.test/plugin.xml new file mode 100644 index 00000000000..9fd0f8803b4 --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.test/plugin.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+
+<plugin>
+ <extension point="org.eclipse.emf.facet.infra.query.registration">
+ <modelqueryset file="resources/CoreQueriesTest.querySet"/>
+ </extension> +</plugin>
diff --git a/deprecated/org.eclipse.papyrus.core.queries.test/resources/AndConfiguration.configuration b/deprecated/org.eclipse.papyrus.core.queries.test/resources/AndConfiguration.configuration new file mode 100644 index 00000000000..4d0b6436b0b --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.test/resources/AndConfiguration.configuration @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<configuration:ModiscoQueryConfiguration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:configuration="http://www.eclipse.org/papyrus/core/queries/0.7" xmlns:query="http://www.eclipse.org/EmfFacet/infra/query/0.8.incubation" name="ANDConfiguration" query="query:JavaModelQuery CoreQueriesTest.querySet#AND">
+ <parameterValues xsi:type="configuration:QueryExecutionValue" parameter="CoreQueriesTest.querySet#AND_leftOperand" configuration="configuration:ModiscoQueryConfiguration IsNamedQueryConfiguration.configuration#/"/>
+ <parameterValues xsi:type="configuration:QueryExecutionValue" parameter="CoreQueriesTest.querySet#AND_rightOperand" configuration="configuration:ModiscoQueryConfiguration IsNameLongerThanQueryConfiguration1.configuration#/"/>
+</configuration:ModiscoQueryConfiguration>
diff --git a/deprecated/org.eclipse.papyrus.core.queries.test/resources/CoreQueriesTest.querySet b/deprecated/org.eclipse.papyrus.core.queries.test/resources/CoreQueriesTest.querySet new file mode 100644 index 00000000000..1b7a30de950 --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.test/resources/CoreQueriesTest.querySet @@ -0,0 +1,106 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<query:ModelQuerySet xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:query="http://www.eclipse.org/EmfFacet/infra/query/0.8.incubation" name="CoreQueriesTest" description="Set of Queries for test only">
+ <associatedMetamodels href="http://www.eclipse.org/uml2/4.0.0/UML#/"/>
+ <associatedMetamodels href="http://www.eclipse.org/uml2/4.0.0/Types#/"/>
+ <queries xsi:type="query:JavaModelQuery" name="BooleanTest_NoParameters" description="test - boolean return value - no parameters" implementationClassName="org.eclipse.papyrus.core.queries.test.modisco.queries.BooleanTest_NoParameters">
+ <returnType xsi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/4.0.0/Types#//Boolean"/>
+ <scope href="http://www.eclipse.org/uml2/4.0.0/UML#//Element"/>
+ </queries>
+ <queries xsi:type="query:JavaModelQuery" name="StringTest_NoParameters" description="test - string return value - no parameters" implementationClassName="org.eclipse.papyrus.core.queries.test.modisco.queries.StringTest_NoParameters">
+ <returnType xsi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/4.0.0/Types#//String"/>
+ <scope href="http://www.eclipse.org/uml2/4.0.0/UML#//Element"/>
+ </queries>
+ <queries xsi:type="query:JavaModelQuery" name="StringMultipleTest_NoParameters" description="test - string return multiple values - no parameters" upperBound="-1" implementationClassName="org.eclipse.papyrus.core.queries.test.modisco.queries.StringMultipleTest_NoParameters">
+ <returnType xsi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/4.0.0/Types#//String"/>
+ <scope href="http://www.eclipse.org/uml2/4.0.0/UML#//Element"/>
+ </queries>
+ <queries xsi:type="query:JavaModelQuery" name="BooleanMultipleTest_NoParameters" description="test - boolean return multiple values - no parameters" upperBound="-1" implementationClassName="org.eclipse.papyrus.core.queries.test.modisco.queries.BooleanMultipleTest_NoParameters">
+ <returnType xsi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/4.0.0/Types#//Boolean"/>
+ <scope href="http://www.eclipse.org/uml2/4.0.0/UML#//Element"/>
+ </queries>
+ <queries xsi:type="query:JavaModelQuery" name="BooleanTest_String_1" description="test - boolean return value - String[1]" implementationClassName="org.eclipse.papyrus.core.queries.test.modisco.queries.BooleanTest_String_1">
+ <returnType xsi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/4.0.0/Types#//Boolean"/>
+ <scope href="http://www.eclipse.org/uml2/4.0.0/UML#//Element"/>
+ <parameters name="paramString">
+ <type xsi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/4.0.0/Types#//String"/>
+ </parameters>
+ </queries>
+ <queries xsi:type="query:JavaModelQuery" name="BooleanTest_String_3" description="test - boolean return value - String[3]" implementationClassName="org.eclipse.papyrus.core.queries.test.modisco.queries.BooleanTest_String_3">
+ <returnType xsi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/4.0.0/Types#//Boolean"/>
+ <scope href="http://www.eclipse.org/uml2/4.0.0/UML#//Element"/>
+ <parameters name="paramString3" upperBound="3">
+ <type xsi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/4.0.0/Types#//String"/>
+ </parameters>
+ </queries>
+ <queries xsi:type="query:JavaModelQuery" name="BooleanTest_String_Star" description="test - boolean return value - String[-1]" implementationClassName="org.eclipse.papyrus.core.queries.test.modisco.queries.BooleanTest_String_Star">
+ <returnType xsi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/4.0.0/Types#//Boolean"/>
+ <scope href="http://www.eclipse.org/uml2/4.0.0/UML#//Element"/>
+ <parameters name="paramStringStar" upperBound="-1">
+ <type xsi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/4.0.0/Types#//String"/>
+ </parameters>
+ </queries>
+ <queries xsi:type="query:JavaModelQuery" name="BooleanTest_Boolean_1_Integer_1" description="test - boolean return value - Boolean[1], Integer[1]" implementationClassName="org.eclipse.papyrus.core.queries.test.modisco.queries.BooleanTest_Boolean_1_Integer_1">
+ <returnType xsi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/4.0.0/Types#//Boolean"/>
+ <scope href="http://www.eclipse.org/uml2/4.0.0/UML#//Element"/>
+ <parameters name="paramBoolean">
+ <type xsi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/4.0.0/Types#//Boolean"/>
+ </parameters>
+ <parameters name="paramInteger">
+ <type xsi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/4.0.0/Types#//Integer"/>
+ </parameters>
+ </queries>
+ <queries xsi:type="query:JavaModelQuery" name="BooleanTest_Enum_1" description="test - boolean return value - Enum[1]" implementationClassName="org.eclipse.papyrus.core.queries.test.modisco.queries.BooleanTest_Enum_1">
+ <returnType xsi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/4.0.0/Types#//Boolean"/>
+ <scope href="http://www.eclipse.org/uml2/4.0.0/UML#//Element"/>
+ <parameters name="paramEnum">
+ <type xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//EEnum"/>
+ </parameters>
+ </queries>
+ <queries xsi:type="query:JavaModelQuery" name="IsNamed" description="test - test if the name of the element is equal to the specified name" implementationClassName="org.eclipse.papyrus.core.queries.test.modisco.queries.IsNamed">
+ <returnType xsi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/4.0.0/Types#//Boolean"/>
+ <scope href="http://www.eclipse.org/uml2/4.0.0/UML#//NamedElement"/>
+ <parameters name="name">
+ <type xsi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/4.0.0/Types#//String"/>
+ </parameters>
+ </queries>
+ <queries xsi:type="query:JavaModelQuery" name="IsNameLongerThan" description="test - check if the element's name is longer than the specified number. The booelan indicates if it is tru when length is equal." implementationClassName="org.eclipse.papyrus.core.queries.test.modisco.queries.IsNameLongerThan">
+ <returnType xsi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/4.0.0/Types#//Boolean"/>
+ <scope href="http://www.eclipse.org/uml2/4.0.0/UML#//NamedElement"/>
+ <parameters name="isTrueWhenEqual">
+ <type xsi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/4.0.0/Types#//Boolean"/>
+ </parameters>
+ <parameters name="length">
+ <type xsi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/4.0.0/Types#//Integer"/>
+ </parameters>
+ </queries>
+ <queries xsi:type="query:JavaModelQuery" name="AND" description="test - AND query" implementationClassName="org.eclipse.papyrus.core.queries.test.modisco.queries.AND">
+ <returnType xsi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/4.0.0/Types#//Boolean"/>
+ <scope href="http://www.eclipse.org/uml2/4.0.0/UML#//NamedElement"/>
+ <parameters name="AND_leftOperand" lowerBound="1">
+ <type xsi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/4.0.0/Types#//Boolean"/>
+ </parameters>
+ <parameters name="AND_rightOperand" lowerBound="1">
+ <type xsi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/4.0.0/Types#//Boolean"/>
+ </parameters>
+ </queries>
+ <queries xsi:type="query:JavaModelQuery" name="ListElementsWithName" description="test - return a list of named elements for whicv name contains basic" upperBound="-1" implementationClassName="org.eclipse.papyrus.core.queries.test.modisco.queries.ListElementsWithName">
+ <returnType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/4.0.0/UML#//NamedElement"/>
+ <scope href="http://www.eclipse.org/uml2/4.0.0/UML#//Package"/>
+ <parameters name="containedString">
+ <type xsi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/4.0.0/Types#//String"/>
+ </parameters>
+ </queries>
+ <queries xsi:type="query:JavaModelQuery" name="ListElementsInstanceofClassifiers" description="test - list the elements given as parameters that are instanceof Classifiers" upperBound="-1" implementationClassName="org.eclipse.papyrus.core.queries.test.modisco.queries.ListElementsInstanceofClassifiers">
+ <returnType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/4.0.0/UML#//Classifier"/>
+ <scope href="http://www.eclipse.org/uml2/4.0.0/UML#//Element"/>
+ <parameters name="elementList" upperBound="-1">
+ <type xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/4.0.0/UML#//NamedElement"/>
+ </parameters>
+ </queries>
+ <queries xsi:type="query:JavaModelQuery" name="isStrictInstanceOf" description="test - test if an element is strict type of given value" implementationClassName="org.eclipse.papyrus.core.queries.test.modisco.queries.IsStrictInstanceOf">
+ <returnType xsi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/4.0.0/Types#//Boolean"/>
+ <parameters name="typeName" lowerBound="1">
+ <type xsi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/4.0.0/Types#//String"/>
+ </parameters>
+ </queries>
+</query:ModelQuerySet>
diff --git a/deprecated/org.eclipse.papyrus.core.queries.test/resources/IsNameLongerThanQueryConfiguration1.configuration b/deprecated/org.eclipse.papyrus.core.queries.test/resources/IsNameLongerThanQueryConfiguration1.configuration new file mode 100644 index 00000000000..b1339e16508 --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.test/resources/IsNameLongerThanQueryConfiguration1.configuration @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<configuration:ModiscoQueryConfiguration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:configuration="http://www.eclipse.org/papyrus/core/queries/0.7" xmlns:query="http://www.eclipse.org/EmfFacet/infra/query/0.8.incubation" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML" name="IsNameLongerThanQueryConfiguration1" query="query:JavaModelQuery CoreQueriesTest.querySet#IsNameLongerThan">
+ <parameterValues xsi:type="configuration:ConstantParameterValue" parameter="CoreQueriesTest.querySet#isTrueWhenEqual">
+ <valueInstance xsi:type="uml:LiteralBoolean" name=""/>
+ </parameterValues>
+ <parameterValues xsi:type="configuration:ConstantParameterValue" parameter="CoreQueriesTest.querySet#length">
+ <valueInstance xsi:type="uml:LiteralInteger" value="5"/>
+ </parameterValues>
+</configuration:ModiscoQueryConfiguration>
diff --git a/deprecated/org.eclipse.papyrus.core.queries.test/resources/IsNameLongerThanQueryConfiguration2.configuration b/deprecated/org.eclipse.papyrus.core.queries.test/resources/IsNameLongerThanQueryConfiguration2.configuration new file mode 100644 index 00000000000..db9558dcacb --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.test/resources/IsNameLongerThanQueryConfiguration2.configuration @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<configuration:ModiscoQueryConfiguration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:configuration="http://www.eclipse.org/papyrus/core/queries/0.7" xmlns:query="http://www.eclipse.org/EmfFacet/infra/query/0.8.incubation" xmlns:uml="http://www.eclipse.org/uml2/3.0.0/UML" name="IsNameLongerThanQueryConfiguration2" query="query:JavaModelQuery CoreQueriesTest.querySet#IsNameLongerThan">
+ <parameterValues xsi:type="configuration:ConstantParameterValue" parameter="CoreQueriesTest.querySet#isTrueWhenEqual">
+ <valueInstance xsi:type="uml:LiteralBoolean" name=""/>
+ </parameterValues>
+ <parameterValues xsi:type="configuration:ConstantParameterValue" parameter="CoreQueriesTest.querySet#length">
+ <valueInstance xsi:type="uml:LiteralInteger" value="10"/>
+ </parameterValues>
+</configuration:ModiscoQueryConfiguration>
diff --git a/deprecated/org.eclipse.papyrus.core.queries.test/resources/IsNamedQueryConfiguration.configuration b/deprecated/org.eclipse.papyrus.core.queries.test/resources/IsNamedQueryConfiguration.configuration new file mode 100644 index 00000000000..b850be270dd --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.test/resources/IsNamedQueryConfiguration.configuration @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<configuration:ModiscoQueryConfiguration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:configuration="http://www.eclipse.org/papyrus/core/queries/0.7" xmlns:query="http://www.eclipse.org/EmfFacet/infra/query/0.8.incubation" xmlns:uml="http://www.eclipse.org/uml2/3.0.0/UML" name="IsNamedQueryConfiguration" query="query:JavaModelQuery CoreQueriesTest.querySet#IsNamed">
+ <parameterValues xsi:type="configuration:ConstantParameterValue" parameter="CoreQueriesTest.querySet#name">
+ <valueInstance xsi:type="uml:LiteralString" name="Basic" value="Basic"/>
+ </parameterValues>
+</configuration:ModiscoQueryConfiguration>
diff --git a/deprecated/org.eclipse.papyrus.core.queries.test/resources/IsStrictInstanceOfModel.configuration b/deprecated/org.eclipse.papyrus.core.queries.test/resources/IsStrictInstanceOfModel.configuration new file mode 100644 index 00000000000..11d985c29c3 --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.test/resources/IsStrictInstanceOfModel.configuration @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<configuration:ModiscoQueryConfiguration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:configuration="http://www.eclipse.org/papyrus/core/queries/0.7" xmlns:query="http://www.eclipse.org/EmfFacet/infra/query/0.8.incubation" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML" name="isStrictInstanceOfModel" query="query:JavaModelQuery CoreQueriesTest.querySet#isStrictInstanceOf">
+ <parameterValues xsi:type="configuration:ConstantParameterValue" parameter="CoreQueriesTest.querySet#typeName">
+ <valueInstance xsi:type="uml:LiteralString" name="" value="org.eclipse.uml2.uml.Model"/>
+ </parameterValues>
+</configuration:ModiscoQueryConfiguration>
diff --git a/deprecated/org.eclipse.papyrus.core.queries.test/resources/IsStrictInstanceOfPackage.configuration b/deprecated/org.eclipse.papyrus.core.queries.test/resources/IsStrictInstanceOfPackage.configuration new file mode 100644 index 00000000000..2ced6113451 --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.test/resources/IsStrictInstanceOfPackage.configuration @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<configuration:ModiscoQueryConfiguration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:configuration="http://www.eclipse.org/papyrus/core/queries/0.7" xmlns:query="http://www.eclipse.org/EmfFacet/infra/query/0.8.incubation" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML" name="isStrictInstanceOfPackage" query="query:JavaModelQuery CoreQueriesTest.querySet#isStrictInstanceOf">
+ <parameterValues xsi:type="configuration:ConstantParameterValue" parameter="CoreQueriesTest.querySet#typeName">
+ <valueInstance xsi:type="uml:LiteralString" name="" value="org.eclipse.uml2.uml.Package"/>
+ </parameterValues>
+</configuration:ModiscoQueryConfiguration>
diff --git a/deprecated/org.eclipse.papyrus.core.queries.test/resources/ListElementsInstanceofClassifiersWithNameContainingBasic.configuration b/deprecated/org.eclipse.papyrus.core.queries.test/resources/ListElementsInstanceofClassifiersWithNameContainingBasic.configuration new file mode 100644 index 00000000000..8388e815a0b --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.test/resources/ListElementsInstanceofClassifiersWithNameContainingBasic.configuration @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<configuration:ModiscoQueryConfiguration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:configuration="http://www.eclipse.org/papyrus/core/queries/0.7" xmlns:query="http://www.eclipse.org/EmfFacet/infra/query/0.8.incubation" name="ListElementsInstanceofClassifiersWithNameContainingBasic" query="query:JavaModelQuery CoreQueriesTest.querySet#ListElementsInstanceofClassifiers">
+ <parameterValues xsi:type="configuration:QueryExecutionValue" parameter="CoreQueriesTest.querySet#elementList" configuration="configuration:ModiscoQueryConfiguration ListElementsWithNameBasic.configuration#/"/>
+</configuration:ModiscoQueryConfiguration>
diff --git a/deprecated/org.eclipse.papyrus.core.queries.test/resources/ListElementsWithNameBasic.configuration b/deprecated/org.eclipse.papyrus.core.queries.test/resources/ListElementsWithNameBasic.configuration new file mode 100644 index 00000000000..a37170c5cfd --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.test/resources/ListElementsWithNameBasic.configuration @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<configuration:ModiscoQueryConfiguration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:configuration="http://www.eclipse.org/papyrus/core/queries/0.7" xmlns:query="http://www.eclipse.org/EmfFacet/infra/query/0.8.incubation" xmlns:uml="http://www.eclipse.org/uml2/3.0.0/UML" name="ListElementsWithNameBasic" query="query:JavaModelQuery CoreQueriesTest.querySet#ListElementsWithName">
+ <parameterValues xsi:type="configuration:ConstantParameterValue" parameter="CoreQueriesTest.querySet#containedString">
+ <valueInstance xsi:type="uml:LiteralString" value="Basic"/>
+ </parameterValues>
+</configuration:ModiscoQueryConfiguration>
diff --git a/deprecated/org.eclipse.papyrus.core.queries.test/resources/basic.ecore b/deprecated/org.eclipse.papyrus.core.queries.test/resources/basic.ecore new file mode 100644 index 00000000000..7bd632c4640 --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.test/resources/basic.ecore @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<ecore:EPackage xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="basic"
+ nsURI="http://basic/1.0" nsPrefix="basic">
+ <eClassifiers xsi:type="ecore:EClass" name="TestEClass">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="StringAttribute" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eClassifiers>
+</ecore:EPackage>
diff --git a/deprecated/org.eclipse.papyrus.core.queries.test/resources/basic.ecorediag b/deprecated/org.eclipse.papyrus.core.queries.test/resources/basic.ecorediag new file mode 100644 index 00000000000..18f4d5ffb77 --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.test/resources/basic.ecorediag @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<notation:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmi:id="_lAuvEM-4Ed-U3ZF7RVMhSQ" type="EcoreTools" name="basic" measurementUnit="Pixel">
+ <children xmi:type="notation:Node" xmi:id="_mNePAM-4Ed-U3ZF7RVMhSQ" type="1001">
+ <children xmi:type="notation:Node" xmi:id="_mNePA8-4Ed-U3ZF7RVMhSQ" type="4001"/>
+ <children xmi:type="notation:Node" xmi:id="_mNoAAM-4Ed-U3ZF7RVMhSQ" type="5001">
+ <children xmi:type="notation:Node" xmi:id="_nmIrEM-4Ed-U3ZF7RVMhSQ" type="2001">
+ <element xmi:type="ecore:EAttribute" href="basic.ecore#//TestEClass/StringAttribute"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_nmIrEc-4Ed-U3ZF7RVMhSQ"/>
+ </children>
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_mNoAAc-4Ed-U3ZF7RVMhSQ"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_mNoAAs-4Ed-U3ZF7RVMhSQ"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_mNoAA8-4Ed-U3ZF7RVMhSQ"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_mNoABM-4Ed-U3ZF7RVMhSQ" type="5002">
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_mNoABc-4Ed-U3ZF7RVMhSQ"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_mNoABs-4Ed-U3ZF7RVMhSQ"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_mNoAB8-4Ed-U3ZF7RVMhSQ"/>
+ </children>
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_mNePAc-4Ed-U3ZF7RVMhSQ" fontColor="4210752" fontHeight="10" fillColor="13761016" lineColor="8421504"/>
+ <element xmi:type="ecore:EClass" href="basic.ecore#//TestEClass"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_mNePAs-4Ed-U3ZF7RVMhSQ" x="240" y="170" width="181" height="201"/>
+ </children>
+ <styles xmi:type="notation:DiagramStyle" xmi:id="_lAuvEc-4Ed-U3ZF7RVMhSQ"/>
+ <element xmi:type="ecore:EPackage" href="basic.ecore#/"/>
+</notation:Diagram>
diff --git a/deprecated/org.eclipse.papyrus.core.queries.test/resources/basic.uml b/deprecated/org.eclipse.papyrus.core.queries.test/resources/basic.uml new file mode 100644 index 00000000000..c9475e049e1 --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.test/resources/basic.uml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<uml:Model xmi:version="2.1" xmlns:xmi="http://schema.omg.org/spec/XMI/2.1" xmlns:uml="http://www.eclipse.org/uml2/3.0.0/UML" xmi:id="_VkWgoc-4Ed-U3ZF7RVMhSQ" name="Basic">
+ <packagedElement xmi:type="uml:Class" xmi:id="_Lu5-EdLwEd-6TavSQh_bww" name="BasicClass"/>
+ <packagedElement xmi:type="uml:Class" xmi:id="_MTK9sdaeEd-FMq7PqN83sg" name="SecondClass"/>
+ <packagedElement xmi:type="uml:Class" xmi:id="_zPKCoNbJEd-FMq7PqN83sg" name="ThirdBasicClass"/>
+</uml:Model>
diff --git a/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/Activator.java b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/Activator.java new file mode 100644 index 00000000000..586e124ec84 --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/Activator.java @@ -0,0 +1,50 @@ +package org.eclipse.papyrus.core.queries.test;
+
+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.core.queries.test"; //$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/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/ANDTests.java b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/ANDTests.java new file mode 100644 index 00000000000..dbca9a6dbd6 --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/ANDTests.java @@ -0,0 +1,86 @@ +/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.core.queries.test.modisco;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
+import org.eclipse.emf.facet.infra.query.ModelQuery;
+import org.eclipse.papyrus.core.queries.test.Activator;
+import org.eclipse.papyrus.infra.queries.core.configuration.ModiscoQueryConfiguration;
+import org.eclipse.papyrus.infra.queries.core.modisco.QueryUtil;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+
+/**
+ * Test class for {@link AND} query
+ */
+public class ANDTests extends AbstractQueryUtilTest implements IQueryNames {
+
+ /** query on which tests are based */
+ protected static ModelQuery andQuery;
+
+ /** model query configuration model */
+ protected static ModiscoQueryConfiguration configuration;
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ // retrieve the query
+ andQuery = QueryUtil.retrieveModelQuery(AND_Boolean_1_Boolean_1, IQueryNames.CoreQueriesSet_Name);
+ assertNotNull("Query " + AND_Boolean_1_Boolean_1 + " was not found.", andQuery);
+
+ // retrieve the configuration
+ configuration = TestUtil.loadQueryConfiguration(Activator.PLUGIN_ID, IQueryNames.ANDConfiguration_Path);
+ assertNotNull("Configuration " + IQueryNames.ANDConfiguration_Path + " was not found.", configuration);
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Override
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Override
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ /**
+ * Test method for
+ * {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#evaluateBooleanQuery(org.eclipse.emf.ecore.EObject, org.eclipse.papyrus.core.queries.configuration.QueryConfiguration)}
+ * .
+ */
+ @Test
+ public final void testEvaluateBooleanQueryEObjectQueryConfiguration() {
+ // test if no exception is thrown
+ boolean result = false;
+ try {
+ result = QueryUtil.evaluateBooleanQuery(umlPackage, configuration);
+ } catch (Exception e) {
+ fail(e.getMessage());
+ }
+ assertFalse("Query result should be false", result);
+ }
+
+}
diff --git a/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/AbstractQueryUtilTest.java b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/AbstractQueryUtilTest.java new file mode 100644 index 00000000000..2e9c13be42e --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/AbstractQueryUtilTest.java @@ -0,0 +1,87 @@ +/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.core.queries.test.modisco;
+
+import static org.junit.Assert.assertNotNull;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.papyrus.core.queries.test.Activator;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.Package;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+
+
+/**
+ * Abstract class for all tests
+ */
+public abstract class AbstractQueryUtilTest implements IQueryNames {
+
+ /** path to the uml model to load */
+ public static final String BASIC_UML_MODEL = "/resources/basic.uml";
+
+ /** path to the ecore model to load */
+ public static final String BASIC_ECORE_MODEL = "/resources/basic.ecore";
+
+ /** main uml model */
+ protected static EObject umlPackage;
+
+ /** sub class: basicClass */
+ protected static Class umlClass;
+
+
+ /** main ecore package */
+ protected static EObject ecorePackage;
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @BeforeClass
+ public static void setUpBeforeAbstractClass() throws Exception {
+ umlPackage = TestUtil.loadModel(Activator.PLUGIN_ID, BASIC_UML_MODEL);
+ assertNotNull("test model was not found.", umlPackage);
+
+ // retrieve the UML class
+ if(umlPackage instanceof Package) {
+ umlClass = (Class)((Package)umlPackage).getOwnedMember(UML_CLASS_NAME);
+ }
+ assertNotNull("test class was not found.", umlClass);
+
+ ecorePackage = TestUtil.loadModel(Activator.PLUGIN_ID, BASIC_ECORE_MODEL);
+ assertNotNull("test model was not found.", ecorePackage);
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @AfterClass
+ public static void tearDownAfterAbstractClass() throws Exception {
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @After
+ public void tearDown() throws Exception {
+ }
+
+
+}
diff --git a/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/BooleanMultipleTest_NoParametersTests.java b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/BooleanMultipleTest_NoParametersTests.java new file mode 100644 index 00000000000..4268608f477 --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/BooleanMultipleTest_NoParametersTests.java @@ -0,0 +1,107 @@ +/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.core.queries.test.modisco;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.facet.infra.query.ModelQuery;
+import org.eclipse.emf.facet.infra.query.runtime.ModelQueryParameterValue;
+import org.eclipse.papyrus.infra.queries.core.modisco.QueryUtil;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+
+/**
+ * Tests cases for {@link BooleanTest_NoParameters}
+ */
+public class BooleanMultipleTest_NoParametersTests extends AbstractQueryUtilTest {
+
+ /** query on which tests are based */
+ protected static ModelQuery booleanMultipleQuery;
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ booleanMultipleQuery = QueryUtil.retrieveModelQuery(Messages.QueryUtilTest_TestName_BooleanMultipleTest_NoParameters, Messages.QueryUtilTest_QuerySetName_CoreQueriesTest);
+ assertNotNull("Query " + Messages.QueryUtilTest_TestName_BooleanMultipleTest_NoParameters + " was not found.", booleanMultipleQuery);
+ }
+
+ /**
+ * Test method for {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#retrieveModelQuery(java.lang.String, java.lang.String)}.
+ */
+ @Test
+ public final void testRetrieveModelQuery_BooleanTest_NoParameters() {
+ assertNotNull("Query " + Messages.QueryUtilTest_TestName_BooleanMultipleTest_NoParameters + " was not found.", booleanMultipleQuery);
+ }
+
+ /**
+ * Test method for {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#isValidQuery(org.eclipse.emf.facet.infra.query.ModelQuery)}.
+ */
+ @Test
+ public final void testIsValidQuery_BooleanTest_NoParameters() {
+ IStatus status = QueryUtil.isValidBooleanQuery(booleanMultipleQuery);
+ assertFalse("Query " + Messages.QueryUtilTest_TestName_BooleanMultipleTest_NoParameters + " should not be a valid query, as it returns many booleans. Current Status: " + status.getMessage(), status.isOK());
+
+ status = QueryUtil.isValidQuery(booleanMultipleQuery);
+ assertTrue("Query should be a valid query. Current Status: " + status.getMessage(), status.isOK());
+ }
+
+ /**
+ * Test method for
+ * {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#evaluateBooleanQuery(org.eclipse.emf.facet.infra.query.ModelQuery, org.eclipse.emf.ecore.EObject, java.util.List)}
+ * .
+ */
+ @Test
+ public final void testEvaluateBooleanQueryBooleanTest_NoParameters() {
+ boolean exceptionThrown = false;
+ boolean result = false;
+
+ // test with not an element context
+ try {
+ result = QueryUtil.evaluateBooleanQuery(booleanMultipleQuery, ecorePackage, new ArrayList<ModelQueryParameterValue>());
+ assertFalse("The query should not be valid, as the query is not valid", result);
+ } catch (Exception e) {
+ exceptionThrown = true;
+ }
+ assertTrue("An Exception should be thrown", exceptionThrown);
+
+ // test with not an element context
+ exceptionThrown = false;
+ result = false;
+ try {
+ result = QueryUtil.evaluateBooleanQuery(booleanMultipleQuery, ecorePackage, new ArrayList<ModelQueryParameterValue>());
+ assertFalse("The query should not be valid, as the query is not valid", result);
+ } catch (Exception e) {
+ exceptionThrown = true;
+ }
+ assertTrue("An exception should be thrown", exceptionThrown);
+
+ // test with not an element context
+ exceptionThrown = false;
+ result = false;
+ try {
+ result = QueryUtil.evaluateBooleanQuery(booleanMultipleQuery, ecorePackage, new ArrayList<ModelQueryParameterValue>());
+ } catch (Exception e) {
+ exceptionThrown = true;
+ }
+ assertFalse("The query should not be valid, as the query is not valid", result);
+ // assertTrue("An exception should be thrown", exceptionThrown);
+ }
+
+}
diff --git a/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/BooleanTest_NoParametersTests.java b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/BooleanTest_NoParametersTests.java new file mode 100644 index 00000000000..bc25ff4ad97 --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/BooleanTest_NoParametersTests.java @@ -0,0 +1,106 @@ +/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.core.queries.test.modisco;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.facet.infra.query.ModelQuery;
+import org.eclipse.emf.facet.infra.query.runtime.ModelQueryParameterValue;
+import org.eclipse.papyrus.infra.queries.core.modisco.QueryUtil;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+
+/**
+ * Tests cases for {@link BooleanTest_NoParameters}
+ */
+public class BooleanTest_NoParametersTests extends AbstractQueryUtilTest {
+
+ /** query on which tests are based */
+ protected static ModelQuery booleanQuery;
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ booleanQuery = QueryUtil.retrieveModelQuery(Messages.QueryUtilTest_TestName_BooleanTest_NoParameters, Messages.QueryUtilTest_QuerySetName_CoreQueriesTest);
+ assertNotNull("Query " + Messages.QueryUtilTest_TestName_BooleanTest_NoParameters + " was not found.", booleanQuery);
+ }
+
+ /**
+ * Test method for {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#retrieveModelQuery(java.lang.String, java.lang.String)}.
+ */
+ @Test
+ public final void testRetrieveModelQuery_BooleanTest_NoParameters() {
+ assertNotNull("Query " + Messages.QueryUtilTest_TestName_BooleanTest_NoParameters + " was not found.", booleanQuery);
+ }
+
+ /**
+ * Test method for {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#isValidQuery(org.eclipse.emf.facet.infra.query.ModelQuery)}.
+ */
+ @Test
+ public final void testIsValidQuery_BooleanTest_NoParameters() {
+ IStatus status = QueryUtil.isValidQuery(booleanQuery);
+ assertTrue("Query " + Messages.QueryUtilTest_TestName_BooleanTest_NoParameters + " should be a valid query. Current Status: " + status.getMessage(), status.isOK());
+ }
+
+ /**
+ * Test method for
+ * {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#evaluateBooleanQuery(org.eclipse.emf.facet.infra.query.ModelQuery, org.eclipse.emf.ecore.EObject, java.util.List)}
+ * .
+ */
+ @Test
+ public final void testEvaluateBooleanQueryBooleanTest_NoParameters() {
+ boolean exceptionThrown;
+ boolean result;
+
+ // test with null as parameter
+ exceptionThrown = false;
+ result = false;
+ try {
+ result = QueryUtil.evaluateBooleanQuery(booleanQuery, umlPackage, new ArrayList<ModelQueryParameterValue>());
+ } catch (Exception e) {
+ exceptionThrown = true;
+ }
+ assertTrue(result);
+ assertFalse("No Exception should be thrown", exceptionThrown);
+
+ // test with an empty array list
+ exceptionThrown = false;
+ result = false;
+ try {
+ result = QueryUtil.evaluateBooleanQuery(booleanQuery, umlPackage, new ArrayList<ModelQueryParameterValue>());
+ } catch (Exception e) {
+ exceptionThrown = true;
+ }
+ assertTrue(result);
+ assertFalse("No Exception should be thrown", exceptionThrown);
+
+ // test with not an element context
+ exceptionThrown = false;
+ result = false;
+ try {
+ result = QueryUtil.evaluateBooleanQuery(booleanQuery, ecorePackage, new ArrayList<ModelQueryParameterValue>());
+ } catch (Exception e) {
+ exceptionThrown = true;
+ }
+ assertFalse("The query should not be valid, as the element is not a UML Element", result);
+ // assertTrue("An exception should be thrown", exceptionThrown);
+ }
+
+}
diff --git a/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/IQueryNames.java b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/IQueryNames.java new file mode 100644 index 00000000000..2ece8ece34b --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/IQueryNames.java @@ -0,0 +1,96 @@ +/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.core.queries.test.modisco;
+
+
+/**
+ * Interface that contains all query names available in the test query set
+ */
+public interface IQueryNames {
+
+ /** query set: configurationTestQuerySet */
+ public static final String CoreQueriesConfigurationSet_Name = "CoreQueriesConfigurationSet";
+
+ /** query set for queries */
+ public static final String CoreQueriesSet_Name = "CoreQueriesTest";
+
+ /** configuration name for IsNamed query test */
+ public static final String IsNamedQueryConfiguration_Path = "/resources/IsNamedQueryConfiguration.configuration";
+
+ /** query isNamed (String[1]) : boolean */
+ public final static String IsNamed_String_1 = "IsNamed";
+
+ /** query isNameLongerThan (boolean[1], Integer[1) : boolean */
+ public static String isNameLongerThan_Boolean_1_Integer_1 = "IsNameLongerThan";
+
+ /** query ListelementWithName */
+ public static String ListElementsWithName_String_1 = "ListElementsWithName";
+
+ /** query ListelementWithName */
+ public static String ListElementsInstanceofClassifiers = "ListElementsInstanceofClassifiers";
+
+ /** configuration name for ListElementsInstanceofClassifiersWithNameContainingBasic query test */
+ public static final String ListElementsInstanceofClassifiersWithNameContainingBasic_path = "/resources/ListElementsInstanceofClassifiersWithNameContainingBasic.configuration";
+
+ /** configuration name for ListElementWithName query test */
+ public static final String ListElementsWithNameQueryConfiguration_Path = "/resources/ListElementsWithNameBasic.configuration";
+
+ /** query AND (boolean[1], booelan[1) : boolean */
+ public static String AND_Boolean_1_Boolean_1 = "AND";
+
+ /** configuration 1 name for IsNamed query test */
+ public static final String IsNameLongerThanConfiguration1_Path = "/resources/IsNameLongerThanQueryConfiguration1.configuration";
+
+ /** configuration 2 name for IsNamed query test */
+ public static final String IsNameLongerThanConfiguration2_Path = "/resources/IsNameLongerThanQueryConfiguration2.configuration";
+
+ /** configuration name for and query test */
+ public static final String ANDConfiguration_Path = "/resources/AndConfiguration.configuration";
+
+ /** Query: BooleanTest_String_1(String[1]) : boolean */
+ public final static String BooleanTest_String_1 = "BooleanTest_String_1";
+
+ /** parameter name */
+ public final static String BooleanTest_String_1_StringParamName = "paramString";
+
+ /** Query: BooleanTest_Boolean_1_Integer_1(Boolean[1], Integer[1]) : boolean */
+ public final static String BooleanTest_Boolean_1_Integer_1 = "BooleanTest_Boolean_1_Integer_1";
+
+ /** parameter name */
+ public final static String BooleanTest_Boolean_1_Integer_1_BooleanParamName = "paramBoolean";
+
+ /** parameter name */
+ public final static String BooleanTest_Boolean_1_Integer_1_IntegetParamName = "paramInteger";
+
+ /** Query: BooleanTest_Enum_1(Enum[1]) : boolean */
+ public final static String BooleanTest_Enum_1 = "BooleanTest_Enum_1";
+
+ /** parameter name */
+ public final static String BooleanTest_Enum_1_EnumParamName = "paramEnum";
+
+ /** Query: BooleanTest_String_3(String[3]) : boolean */
+ public final static String BooleanTest_String_3 = "BooleanTest_String_3";
+
+ /** parameter name */
+ public final static String BooleanTest_String_3_StringParamName = "paramString3";
+
+ /** Query: BooleanTest_String_Star(String[*]) : boolean */
+ public final static String BooleanTest_String_Star = "BooleanTest_String_Star";
+
+ /** parameter name */
+ public final static String BooleanTest_String_Star_StringParamName = "paramStringStar";
+
+ /** name of the class in the test model */
+ public static final String UML_CLASS_NAME = "BasicClass";
+
+}
+
diff --git a/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/IsNameLongerThanTests.java b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/IsNameLongerThanTests.java new file mode 100644 index 00000000000..e6f9243b45c --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/IsNameLongerThanTests.java @@ -0,0 +1,155 @@ +/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.core.queries.test.modisco;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import org.eclipse.emf.facet.infra.query.ModelQuery;
+import org.eclipse.papyrus.core.queries.test.Activator;
+import org.eclipse.papyrus.infra.queries.core.configuration.ModiscoQueryConfiguration;
+import org.eclipse.papyrus.infra.queries.core.modisco.QueryUtil;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+
+/**
+ * Test class for boolean and integer parameters for queries
+ */
+public class IsNameLongerThanTests extends AbstractQueryUtilTest implements IQueryNames {
+
+ /** query on which tests are based */
+ protected static ModelQuery isNameLongerThanQuery;
+
+ /** model query configuration model n°1 */
+ protected static ModiscoQueryConfiguration configuration1;
+
+ /** model query configuration model n°2 */
+ protected static ModiscoQueryConfiguration configuration2;
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ // retrieve the query
+ isNameLongerThanQuery = QueryUtil.retrieveModelQuery(isNameLongerThan_Boolean_1_Integer_1, IQueryNames.CoreQueriesSet_Name);
+ assertNotNull("Query " + isNameLongerThan_Boolean_1_Integer_1 + " was not found.", isNameLongerThanQuery);
+
+ // retrieve the configuration
+ configuration1 = TestUtil.loadQueryConfiguration(Activator.PLUGIN_ID, IQueryNames.IsNameLongerThanConfiguration1_Path);
+ assertNotNull("Configuration " + IQueryNames.IsNameLongerThanConfiguration1_Path + " was not found.", configuration1);
+
+ // retrieve the configuration
+ configuration2 = TestUtil.loadQueryConfiguration(Activator.PLUGIN_ID, IQueryNames.IsNameLongerThanConfiguration2_Path);
+ assertNotNull("Configuration " + IQueryNames.IsNameLongerThanConfiguration2_Path + " was not found.", configuration2);
+
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Override
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Override
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ /**
+ * Test method for
+ * {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#evaluateBooleanQuery(org.eclipse.emf.ecore.EObject, org.eclipse.papyrus.core.queries.configuration.ModiscoQueryConfiguration)}
+ * .
+ */
+ @Test
+ public final void testEvaluateBooleanQueryEObjectModiscoQueryConfigurationPackage1() {
+ // test if no exception is thrown
+ boolean result = false;
+ try {
+ result = QueryUtil.evaluateBooleanQuery(umlPackage, configuration1);
+ } catch (Exception e) {
+ fail(e.getMessage());
+ }
+ assertFalse("Query result should be false", result);
+ }
+
+ /**
+ * Test method for
+ * {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#evaluateBooleanQuery(org.eclipse.emf.ecore.EObject, org.eclipse.papyrus.core.queries.configuration.ModiscoQueryConfiguration)}
+ * .
+ */
+ @Test
+ public final void testEvaluateBooleanQueryEObjectModiscoQueryConfigurationClass1() {
+ // test if no exception is thrown
+ boolean result = false;
+ try {
+ result = QueryUtil.evaluateBooleanQuery(umlClass, configuration1);
+ } catch (Exception e) {
+ fail(e.getMessage());
+ }
+ assertTrue("Query result should be true", result);
+ }
+
+ /**
+ * Test method for
+ * {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#evaluateBooleanQuery(org.eclipse.emf.ecore.EObject, org.eclipse.papyrus.core.queries.configuration.ModiscoQueryConfiguration)}
+ * .
+ */
+ @Test
+ public final void testEvaluateBooleanQueryEObjectModiscoQueryConfigurationPackage2() {
+ // test if no exception is thrown
+ boolean result = false;
+ try {
+ result = QueryUtil.evaluateBooleanQuery(umlPackage, configuration2);
+ } catch (Exception e) {
+ fail(e.getMessage());
+ }
+ assertFalse("Query result should be true", result);
+ }
+
+ /**
+ * Test method for
+ * {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#evaluateBooleanQuery(org.eclipse.emf.ecore.EObject, org.eclipse.papyrus.core.queries.configuration.ModiscoQueryConfiguration)}
+ * .
+ */
+ @Test
+ public final void testEvaluateBooleanQueryEObjectModiscoQueryConfigurationClass2() {
+ // test if no exception is thrown
+ boolean result = false;
+ try {
+ result = QueryUtil.evaluateBooleanQuery(umlClass, configuration2);
+ } catch (Exception e) {
+ fail(e.getMessage());
+ }
+ assertFalse("Query result should be false", result);
+ }
+
+
+}
diff --git a/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/IsNamedTests.java b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/IsNamedTests.java new file mode 100644 index 00000000000..472d97cfa77 --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/IsNamedTests.java @@ -0,0 +1,114 @@ +/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.core.queries.test.modisco;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import org.eclipse.emf.facet.infra.query.ModelQuery;
+import org.eclipse.papyrus.core.queries.test.Activator;
+import org.eclipse.papyrus.infra.queries.core.configuration.ModiscoQueryConfiguration;
+import org.eclipse.papyrus.infra.queries.core.modisco.QueryUtil;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+
+/**
+ * test class for the configuration evaluation for string parameters
+ */
+public class IsNamedTests extends AbstractQueryUtilTest implements IQueryNames {
+
+ /** query on which tests are based */
+ protected static ModelQuery isNamedQuery;
+
+ /** model query configuration model */
+ protected static ModiscoQueryConfiguration configuration;
+
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ // retrieve the query
+ isNamedQuery = QueryUtil.retrieveModelQuery(IsNamed_String_1, IQueryNames.CoreQueriesSet_Name);
+ assertNotNull("Query " + IsNamed_String_1 + " was not found.", isNamedQuery);
+
+ // retrieve the configuration
+ configuration = TestUtil.loadQueryConfiguration(Activator.PLUGIN_ID, IQueryNames.IsNamedQueryConfiguration_Path);
+ assertNotNull("Configuration " + IQueryNames.IsNamedQueryConfiguration_Path + " was not found.", configuration);
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Override
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Override
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ /**
+ * Test method for
+ * {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#evaluateBooleanQuery(org.eclipse.emf.facet.infra.query.ModelQuery, org.eclipse.emf.ecore.EObject, org.eclipse.papyrus.core.queries.configuration.ModiscoQueryConfiguration)}
+ * .
+ */
+ @Test
+ public final void testEvaluateBooleanQueryModelQueryEObjectModiscoQueryConfigurationValid() {
+ // test if no exception is thrown
+ boolean result = false;
+ try {
+ result = QueryUtil.evaluateBooleanQuery(umlPackage, configuration);
+ } catch (Exception e) {
+ fail(e.getMessage());
+ }
+ assertTrue("Query result should be true", result);
+
+ }
+
+ /**
+ * Test method for
+ * {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#evaluateBooleanQuery(org.eclipse.emf.facet.infra.query.ModelQuery, org.eclipse.emf.ecore.EObject, org.eclipse.papyrus.core.queries.configuration.ModiscoQueryConfiguration)}
+ */
+ @Test
+ public final void testEvaluateBooleanQueryModelQueryEObjectModiscoQueryConfigurationNotValid() {
+ // test if no exception is thrown
+ boolean result = false;
+ try {
+ result = QueryUtil.evaluateBooleanQuery(umlPackage.eContents().get(0), configuration);
+ } catch (Exception e) {
+ fail(e.getMessage());
+ }
+ assertFalse("Query result should be false", result);
+
+ }
+
+}
diff --git a/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/ListElementsInstanceofClassifiersWithNameContainingBasicTests.java b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/ListElementsInstanceofClassifiersWithNameContainingBasicTests.java new file mode 100644 index 00000000000..8c1d7874891 --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/ListElementsInstanceofClassifiersWithNameContainingBasicTests.java @@ -0,0 +1,71 @@ +/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.core.queries.test.modisco;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.util.List;
+
+import org.eclipse.emf.facet.infra.query.ModelQuery;
+import org.eclipse.papyrus.core.queries.test.Activator;
+import org.eclipse.papyrus.infra.queries.core.configuration.ModiscoQueryConfiguration;
+import org.eclipse.papyrus.infra.queries.core.modisco.QueryUtil;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+
+/**
+ * Test class for query chaining, with list of elements given from one list to another
+ */
+public class ListElementsInstanceofClassifiersWithNameContainingBasicTests extends AbstractQueryUtilTest implements IQueryNames {
+
+ /** query on which tests are based */
+ protected static ModelQuery query;
+
+ /** model query configuration model */
+ protected static ModiscoQueryConfiguration configuration;
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ // retrieve the query
+ query = QueryUtil.retrieveModelQuery(ListElementsInstanceofClassifiers, IQueryNames.CoreQueriesSet_Name);
+ assertNotNull("Query " + ListElementsInstanceofClassifiers + " was not found.", query);
+
+ // retrieve the configuration
+ configuration = TestUtil.loadQueryConfiguration(Activator.PLUGIN_ID, IQueryNames.ListElementsInstanceofClassifiersWithNameContainingBasic_path);
+ assertNotNull("Configuration " + IQueryNames.ListElementsInstanceofClassifiersWithNameContainingBasic_path + " was not found.", configuration);
+ }
+
+ /**
+ * Test method for {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#evaluateQuery(org.eclipse.emf.ecore.EObject, org.eclipse.papyrus.core.queries.configuration.QueryConfiguration)}.
+ */
+ @Test
+ public final void testEvaluateQueryEObjectQueryConfiguration() {
+ // test if no exception is thrown
+ Object result = false;
+ try {
+ result = QueryUtil.evaluateQuery(umlPackage, configuration);
+ } catch (Exception e) {
+ fail(e.getMessage());
+ }
+ assertNotNull("Query result should not be null", result);
+ assertTrue("Result should be of type list, but is: " + result, result instanceof List<?>);
+ assertTrue("There should be 2 elements in the result list - root package and one class. Currently: " + ((List<Object>)result).size(), ((List<Object>)result).size() == 2);
+
+ }
+
+}
diff --git a/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/ListElementsWithNameTest.java b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/ListElementsWithNameTest.java new file mode 100644 index 00000000000..64025d548e4 --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/ListElementsWithNameTest.java @@ -0,0 +1,92 @@ +/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.core.queries.test.modisco;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.util.List;
+
+import org.eclipse.emf.facet.infra.query.ModelQuery;
+import org.eclipse.papyrus.core.queries.test.Activator;
+import org.eclipse.papyrus.infra.queries.core.configuration.ModiscoQueryConfiguration;
+import org.eclipse.papyrus.infra.queries.core.modisco.QueryUtil;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+
+/**
+ * Test Case for List Element
+ */
+public class ListElementsWithNameTest extends AbstractQueryUtilTest implements IQueryNames {
+
+ /** query on which tests are based */
+ protected static ModelQuery query;
+
+ /** model query configuration model */
+ protected static ModiscoQueryConfiguration configuration;
+
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ // retrieve the query
+ query = QueryUtil.retrieveModelQuery(ListElementsWithName_String_1, IQueryNames.CoreQueriesSet_Name);
+ assertNotNull("Query " + ListElementsWithName_String_1 + " was not found.", query);
+
+ // retrieve the configuration
+ configuration = TestUtil.loadQueryConfiguration(Activator.PLUGIN_ID, IQueryNames.ListElementsWithNameQueryConfiguration_Path);
+ assertNotNull("Configuration " + IQueryNames.ListElementsWithNameQueryConfiguration_Path + " was not found.", configuration);
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Override
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Override
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ /**
+ * Test method for
+ * {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#evaluateBooleanQuery(org.eclipse.emf.ecore.EObject, org.eclipse.papyrus.core.queries.configuration.ModiscoQueryConfiguration)}
+ * .
+ */
+ @SuppressWarnings("unchecked")
+ @Test
+ public final void testEvaluateBooleanQueryEObjectModiscoQueryConfiguration() {
+ // test if no exception is thrown
+ Object result = false;
+ try {
+ result = QueryUtil.evaluateQuery(umlPackage, configuration);
+ } catch (Exception e) {
+ fail(e.getMessage());
+ }
+ assertNotNull("Query result should not be null", result);
+ assertTrue("Result should be of type list, but is: " + result, result instanceof List<?>);
+ assertTrue("There should be 3 elements in the result list - root package and 2 owned class. Currently: " + ((List<Object>)result).size(), ((List<Object>)result).size() == 3);
+ }
+
+}
diff --git a/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/Messages.java b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/Messages.java new file mode 100644 index 00000000000..565011b1863 --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/Messages.java @@ -0,0 +1,41 @@ +package org.eclipse.papyrus.core.queries.test.modisco;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+
+ private static final String BUNDLE_NAME = "org.eclipse.papyrus.core.queries.test.modisco.messages"; //$NON-NLS-1$
+
+ public static String QueryUtilTest_Error_CatalogIsNull;
+
+ public static String QueryUtilTest_Error_Exceptionthrown_QueryShouldNotBeFound;
+
+ public static String QueryUtilTest_Error_NoExceptionThrown_QuerySetNotFound;
+
+ public static String QueryUtilTest_Error_NoExceptionThrown_UnfoundableQuery;
+
+ public static String QueryUtilTest_Error_NotNull_UnfoundableQuery;
+
+ public static String QueryUtilTest_Error_NotNull_UnfoundableQuerySet;
+
+ public static String QueryUtilTest_NotFoundQuery;
+
+ public static String QueryUtilTest_NotFoundQuerySet;
+
+ public static String QueryUtilTest_QuerySetName_CoreQueriesTest;
+
+ public static String QueryUtilTest_TestName_BooleanTest_NoParameters;
+
+ public static String QueryUtilTest_TestName_StringTest_NoParameters;
+
+ public static String QueryUtilTest_TestName_StringMultipleTest_NoParameters;
+
+ public static String QueryUtilTest_TestName_BooleanMultipleTest_NoParameters;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/QueryUtilBasicTests.java b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/QueryUtilBasicTests.java new file mode 100644 index 00000000000..7fb77e77264 --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/QueryUtilBasicTests.java @@ -0,0 +1,129 @@ +/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.core.queries.test.modisco;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import org.eclipse.emf.facet.infra.query.ModelQuery;
+import org.eclipse.emf.facet.infra.query.core.ModelQuerySetCatalog;
+import org.eclipse.papyrus.infra.queries.core.modisco.ModelQueryNotFoundException;
+import org.eclipse.papyrus.infra.queries.core.modisco.ModelQuerySetNotFoundException;
+import org.eclipse.papyrus.infra.queries.core.modisco.QueryUtil;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+
+/**
+ * Test class for {@link QueryUtil}
+ */
+public class QueryUtilBasicTests {
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ /**
+ * Test method for {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#QueryUtil()}.
+ */
+ @Test
+ public final void testQueryUtil() {
+ ModelQuerySetCatalog catalog = ModelQuerySetCatalog.getSingleton();
+ assertNotNull(Messages.QueryUtilTest_Error_CatalogIsNull, catalog);
+ }
+
+ /**
+ * Test method for {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#retrieveModelQuery(java.lang.String, java.lang.String)}.
+ */
+ @Test
+ public final void testRetrieveModelQuery_NoQuerySet() {
+ // do not retrieve the query set
+ boolean exceptionThrown = false;
+ ModelQuery queryNoSet = null;
+ try {
+ queryNoSet = QueryUtil.retrieveModelQuery(Messages.QueryUtilTest_NotFoundQuery, Messages.QueryUtilTest_NotFoundQuerySet);
+ } catch (ModelQuerySetNotFoundException e) {
+ exceptionThrown = true;
+ }
+ assertTrue(Messages.QueryUtilTest_Error_NoExceptionThrown_QuerySetNotFound, exceptionThrown);
+ assertNull(Messages.QueryUtilTest_Error_NotNull_UnfoundableQuerySet, queryNoSet);
+ }
+
+ /**
+ * Test method for {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#retrieveModelQuery(java.lang.String, java.lang.String)}.
+ */
+ @Test
+ public final void testRetrieveModelQuery_NoQuery() {
+ // do not retrieve the query
+ boolean exceptionThrown = false;
+ ModelQuery queryNoQuery = null;
+ try {
+ queryNoQuery = QueryUtil.retrieveModelQuery(Messages.QueryUtilTest_NotFoundQuery, Messages.QueryUtilTest_QuerySetName_CoreQueriesTest);
+ } catch (ModelQueryNotFoundException e) {
+ exceptionThrown = true;
+ } catch (ModelQuerySetNotFoundException e) {
+ exceptionThrown = true;
+ }
+ assertTrue(Messages.QueryUtilTest_Error_NoExceptionThrown_UnfoundableQuery, exceptionThrown);
+ assertNull(Messages.QueryUtilTest_Error_NotNull_UnfoundableQuery, queryNoQuery);
+ }
+
+ /**
+ * Test method for {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#retrieveModelQuery(java.lang.String, java.lang.String)}.
+ */
+ @Test
+ public final void testRetrieveModelQuery_QueryFound() {
+ // retrieve a query
+ boolean exceptionThrown = false;
+ ModelQuery queryBooleanTest_NoParameters = null;
+ try {
+ queryBooleanTest_NoParameters = QueryUtil.retrieveModelQuery(Messages.QueryUtilTest_TestName_BooleanTest_NoParameters, Messages.QueryUtilTest_QuerySetName_CoreQueriesTest);
+ } catch (ModelQueryNotFoundException e) {
+ exceptionThrown = true;
+ } catch (ModelQuerySetNotFoundException e) {
+ exceptionThrown = true;
+ }
+ assertFalse(Messages.QueryUtilTest_Error_Exceptionthrown_QueryShouldNotBeFound, exceptionThrown);
+ Assert.assertNotNull(queryBooleanTest_NoParameters != null);
+ }
+
+}
diff --git a/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/QueryUtil_Parameters.java b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/QueryUtil_Parameters.java new file mode 100644 index 00000000000..b242d26dc93 --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/QueryUtil_Parameters.java @@ -0,0 +1,192 @@ +/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.core.queries.test.modisco;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.facet.infra.query.ModelQuery;
+import org.eclipse.papyrus.infra.queries.core.modisco.QueryUtil;
+import org.eclipse.uml2.uml.VisibilityKind;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+
+/**
+ * Test Class for {@link QueryUtil#isValidParameterSet(org.eclipse.emf.facet.infra.query.ModelQuery, java.util.Map)}
+ */
+public class QueryUtil_Parameters extends AbstractQueryUtilTest {
+
+ /** queries on which tests are based */
+ protected static ModelQuery queryBooleanTest_String_1, queryBooleanTest_Boolean_1_Integer_1, queryBooleanTest_Enum_1, queryBooleanTest_String_3, queryBooleanTest_String_Star;
+
+ // list of possible values to test
+ /** value: String */
+ protected static String paramStringValue = "string";
+
+ /** value: Integer */
+ protected static int paramIntValue = 1;
+
+ /** value: boolean */
+ protected static boolean paramBooleanValue = true;
+
+ /** value: Enumeration */
+ protected static VisibilityKind paramEnumValue = VisibilityKind.PUBLIC_LITERAL;
+
+ /** list of Strings */
+ protected static List<String> paramStringList2Value = Arrays.asList("string1", "String2");
+
+ /** list of Strings */
+ protected static List<String> paramStringList4Value = Arrays.asList("string1", "String2", "string3", "String4");
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ queryBooleanTest_String_1 = QueryUtil.retrieveModelQuery(BooleanTest_String_1, Messages.QueryUtilTest_QuerySetName_CoreQueriesTest);
+ assertNotNull("Query " + BooleanTest_String_1 + " was not found.", queryBooleanTest_String_1);
+
+ queryBooleanTest_Boolean_1_Integer_1 = QueryUtil.retrieveModelQuery(BooleanTest_Boolean_1_Integer_1, Messages.QueryUtilTest_QuerySetName_CoreQueriesTest);
+ assertNotNull("Query " + BooleanTest_Boolean_1_Integer_1 + " was not found.", queryBooleanTest_Boolean_1_Integer_1);
+
+ queryBooleanTest_Enum_1 = QueryUtil.retrieveModelQuery(BooleanTest_Enum_1, Messages.QueryUtilTest_QuerySetName_CoreQueriesTest);
+ assertNotNull("Query " + BooleanTest_Enum_1 + " was not found.", queryBooleanTest_Enum_1);
+
+ queryBooleanTest_String_3 = QueryUtil.retrieveModelQuery(BooleanTest_String_3, Messages.QueryUtilTest_QuerySetName_CoreQueriesTest);
+ assertNotNull("Query " + BooleanTest_String_3 + " was not found.", queryBooleanTest_String_3);
+
+ queryBooleanTest_String_Star = QueryUtil.retrieveModelQuery(BooleanTest_String_Star, Messages.QueryUtilTest_QuerySetName_CoreQueriesTest);
+ assertNotNull("Query " + BooleanTest_String_Star + " was not found.", queryBooleanTest_String_Star);
+ }
+
+ /**
+ * Test method for {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#isValidParameterSet(org.eclipse.emf.facet.infra.query.ModelQuery, java.util.Map)}.
+ */
+ @Test
+ public final void testIsValidParameterSet_String_Valid() {
+ // public static final IStatus isValidParameterSet(ModelQuery query, Map<String, Object> parameters);
+ HashMap<String, Object> validParamSet = new HashMap<String, Object>();
+ validParamSet.put(BooleanTest_String_1_StringParamName, paramStringValue);
+ IStatus status = QueryUtil.isValidParameterSet(queryBooleanTest_String_1, validParamSet);
+
+ assertTrue("Status should be OK: " + status, status.isOK());
+ }
+
+ /**
+ * Test method for
+ * {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#isValidParameterSet(org.eclipse.emf.facet.infra.query.ModelQuery, java.util.Map)}.
+ */
+ @Test
+ public final void testIsValidParameterSet_String_WrongName() {
+ // public static final IStatus isValidParameterSet(ModelQuery query, Map<String, Object> parameters);
+ HashMap<String, Object> validParamSet = new HashMap<String, Object>();
+ validParamSet.put(BooleanTest_String_1_StringParamName + "NotValid", paramStringValue);
+ IStatus status = QueryUtil.isValidParameterSet(queryBooleanTest_String_1, validParamSet);
+
+ assertTrue("Status should be ERROR: " + status, status.getSeverity() == IStatus.ERROR);
+ }
+
+ /**
+ * Test method for
+ * {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#isValidParameterSet(org.eclipse.emf.facet.infra.query.ModelQuery, java.util.Map)}.
+ */
+ @Test
+ public final void testIsValidParameterSet_String_WrongSize() {
+ // public static final IStatus isValidParameterSet(ModelQuery query, Map<String, Object> parameters);
+ HashMap<String, Object> validParamSet = new HashMap<String, Object>();
+ validParamSet.put(BooleanTest_String_1_StringParamName, paramStringValue);
+ validParamSet.put(BooleanTest_String_1_StringParamName + "NotValid", paramStringValue);
+ IStatus status = QueryUtil.isValidParameterSet(queryBooleanTest_String_1, validParamSet);
+
+ assertTrue("Status should be ERROR: " + status, status.getSeverity() == IStatus.ERROR);
+ }
+
+ /**
+ * Test method for
+ * {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#isValidParameterSet(org.eclipse.emf.facet.infra.query.ModelQuery, java.util.Map)}.
+ */
+ @Test
+ public final void testIsValidParameterSet_String_WrongType() {
+ // public static final IStatus isValidParameterSet(ModelQuery query, Map<String, Object> parameters);
+ HashMap<String, Object> validParamSet = new HashMap<String, Object>();
+ validParamSet.put(BooleanTest_String_1_StringParamName, paramBooleanValue);
+ IStatus status = QueryUtil.isValidParameterSet(queryBooleanTest_String_1, validParamSet);
+ System.err.println("warning, no test is currently run for type: " + status);
+ // FIXME: warning, no test is currently run for type
+ // assertTrue("Status should be ERROR: " + status, status.getSeverity() == IStatus.ERROR);
+ }
+
+ /**
+ * Test method for
+ * {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#isValidParameterSet(org.eclipse.emf.facet.infra.query.ModelQuery, java.util.Map)}.
+ */
+ @Test
+ public final void testIsValidParameterSet_BooleanInteger_WrongSize() {
+ // public static final IStatus isValidParameterSet(ModelQuery query, Map<String, Object> parameters);
+ HashMap<String, Object> validParamSet = new HashMap<String, Object>();
+ validParamSet.put(BooleanTest_String_1_StringParamName, paramStringValue);
+ IStatus status = QueryUtil.isValidParameterSet(queryBooleanTest_Boolean_1_Integer_1, validParamSet);
+
+ assertTrue("Status should be ERROR: " + status, status.getSeverity() == IStatus.ERROR);
+ }
+
+ /**
+ * Test method for
+ * {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil# evaluateBooleanQuery(org.eclipse.emf.facet.infra.query.ModelQuery, org.eclipse.emf.ecore.EObject, java.util.Map)}
+ * .
+ */
+ @Test
+ public final void testEvaluateBooleanQuery_BooleanTest_String_1_Valid() {
+ // public static final IStatus isValidParameterSet(ModelQuery query, Map<String, Object> parameters);
+ HashMap<String, Object> validParamSet = new HashMap<String, Object>();
+ validParamSet.put(BooleanTest_String_1_StringParamName, paramStringValue);
+ boolean exceptionThrown = false;
+ boolean result = false;
+ try {
+ result = QueryUtil.evaluateBooleanQuery(queryBooleanTest_String_1, umlPackage, validParamSet);
+ } catch (Exception e) {
+ exceptionThrown = true;
+ }
+ assertTrue("result should be valid.", result);
+ assertFalse("No Exception should be thrown", exceptionThrown);
+ }
+
+ /**
+ * Test method for
+ * {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil# evaluateBooleanQuery(org.eclipse.emf.facet.infra.query.ModelQuery, org.eclipse.emf.ecore.EObject, java.util.Map)}
+ * .
+ */
+ @Test
+ public final void testEvaluateBooleanQuery_BooleanTest_String_1_NotValid() {
+ // public static final IStatus isValidParameterSet(ModelQuery query, Map<String, Object> parameters);
+ HashMap<String, Object> validParamSet = new HashMap<String, Object>();
+ validParamSet.put(BooleanTest_String_1_StringParamName, paramBooleanValue);
+ @SuppressWarnings("unused")
+ boolean exceptionThrown = false;
+ boolean result = false;
+ try {
+ result = QueryUtil.evaluateBooleanQuery(queryBooleanTest_String_1, umlPackage, validParamSet);
+ } catch (Exception e) {
+ exceptionThrown = true;
+ }
+ assertFalse("result should not be valid, as the value given is a boolean", result);
+ // assertTrue("An exception should be thrown", exceptionThrown);
+ }
+
+}
diff --git a/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/StringMultipleTest_NoParametersTests.java b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/StringMultipleTest_NoParametersTests.java new file mode 100644 index 00000000000..550373d19ba --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/StringMultipleTest_NoParametersTests.java @@ -0,0 +1,110 @@ +/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.core.queries.test.modisco;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.facet.infra.query.ModelQuery;
+import org.eclipse.emf.facet.infra.query.runtime.ModelQueryParameterValue;
+import org.eclipse.papyrus.infra.queries.core.modisco.QueryUtil;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+
+/**
+ * Tests cases for {@link BooleanTest_NoParameters}
+ */
+public class StringMultipleTest_NoParametersTests extends AbstractQueryUtilTest {
+
+ /** query on which tests are based */
+ protected static ModelQuery stringsQuery;
+
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ stringsQuery = QueryUtil.retrieveModelQuery(Messages.QueryUtilTest_TestName_StringMultipleTest_NoParameters, Messages.QueryUtilTest_QuerySetName_CoreQueriesTest);
+ assertNotNull("Query " + Messages.QueryUtilTest_TestName_StringMultipleTest_NoParameters + " was not found.", stringsQuery);
+ }
+
+ /**
+ * Test method for {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#retrieveModelQuery(java.lang.String, java.lang.String)}.
+ */
+ @Test
+ public final void testRetrieveModelQuery_StringMultipleTest_NoParameters() {
+ assertNotNull("Query " + Messages.QueryUtilTest_TestName_StringMultipleTest_NoParameters + " was not found.", stringsQuery);
+ }
+
+ /**
+ * Test method for {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#isValidQuery(org.eclipse.emf.facet.infra.query.ModelQuery)}.
+ */
+ @Test
+ public final void testIsValidQuery_StringMultipleTest_NoParameters() {
+ IStatus status = QueryUtil.isValidBooleanQuery(stringsQuery);
+ assertFalse("Query " + Messages.QueryUtilTest_TestName_StringMultipleTest_NoParameters + " should not be a valid query, as it returns several Strings. Current Status: " + status.getMessage(), status.isOK());
+
+ status = QueryUtil.isValidQuery(stringsQuery);
+ assertTrue("Query should be a valid query. Current Status: " + status.getMessage(), status.isOK());
+ }
+
+ /**
+ * Test method for
+ * {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#evaluateBooleanQuery(org.eclipse.emf.facet.infra.query.ModelQuery, org.eclipse.emf.ecore.EObject, java.util.List)}
+ * .
+ */
+ @Test
+ public final void testEvaluateBooleanQuery_StringMultipleTest_NoParameters() {
+ boolean exceptionThrown = false;
+ boolean result = false;
+
+
+ // test with null as parameter
+ exceptionThrown = false;
+ result = false;
+ try {
+ result = QueryUtil.evaluateBooleanQuery(stringsQuery, umlPackage, new ArrayList<ModelQueryParameterValue>());
+ } catch (Exception e) {
+ exceptionThrown = true;
+ }
+ assertFalse("The query should not be true, as it returns a string, not a boolean", result);
+ assertFalse("No Exception should be thrown", exceptionThrown);
+
+ // test with an empty array list
+ exceptionThrown = false;
+ result = false;
+ try {
+ result = QueryUtil.evaluateBooleanQuery(stringsQuery, umlPackage, new ArrayList<ModelQueryParameterValue>());
+ } catch (Exception e) {
+ exceptionThrown = true;
+ }
+ assertFalse("The query should not be true, as it returns a string, not a boolean", result);
+ assertFalse("No Exception should be thrown", exceptionThrown);
+
+ // test with not an element context
+ exceptionThrown = false;
+ result = false;
+ try {
+ result = QueryUtil.evaluateBooleanQuery(stringsQuery, ecorePackage, new ArrayList<ModelQueryParameterValue>());
+ } catch (Exception e) {
+ exceptionThrown = true;
+ }
+ assertFalse("The query should not be true, as it returns a string, not a boolean", result);
+ // assertTrue("An exception should be thrown", exceptionThrown);
+ }
+}
diff --git a/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/StringTest_NoParametersTests.java b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/StringTest_NoParametersTests.java new file mode 100644 index 00000000000..cb0094e4d28 --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/StringTest_NoParametersTests.java @@ -0,0 +1,112 @@ +/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.core.queries.test.modisco;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.facet.infra.query.ModelQuery;
+import org.eclipse.emf.facet.infra.query.runtime.ModelQueryParameterValue;
+import org.eclipse.papyrus.infra.queries.core.modisco.QueryUtil;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+
+/**
+ * Tests cases for {@link BooleanTest_NoParameters}
+ */
+public class StringTest_NoParametersTests extends AbstractQueryUtilTest {
+
+ /** query on which tests are based */
+ protected static ModelQuery stringQuery;
+
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ stringQuery = QueryUtil.retrieveModelQuery(Messages.QueryUtilTest_TestName_StringTest_NoParameters, Messages.QueryUtilTest_QuerySetName_CoreQueriesTest);
+ assertNotNull("Query " + Messages.QueryUtilTest_TestName_StringTest_NoParameters + " was not found.", stringQuery);
+ }
+
+ /**
+ * Test method for {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#retrieveModelQuery(java.lang.String, java.lang.String)}.
+ */
+ @Test
+ public final void testRetrieveModelQuery_StringTest_NoParameters() {
+ assertNotNull("Query " + Messages.QueryUtilTest_TestName_StringTest_NoParameters + " was not found.", stringQuery);
+ }
+
+ /**
+ * Test method for {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#isValidQuery(org.eclipse.emf.facet.infra.query.ModelQuery)}.
+ */
+ @Test
+ public final void testIsValidQuery_StringTest_NoParameters() {
+ IStatus status = QueryUtil.isValidBooleanQuery(stringQuery);
+ assertFalse("Query " + Messages.QueryUtilTest_TestName_StringTest_NoParameters + " should not be a valid query, as it returns a String. Current Status: " + status.getMessage(), status.isOK());
+
+ status = QueryUtil.isValidQuery(stringQuery);
+ assertTrue("Query should be a valid query. Current Status: " + status.getMessage(), status.isOK());
+
+ }
+
+ /**
+ * Test method for
+ * {@link org.eclipse.papyrus.core.queries.modisco.QueryUtil#evaluateBooleanQuery(org.eclipse.emf.facet.infra.query.ModelQuery, org.eclipse.emf.ecore.EObject, java.util.List)}
+ * .
+ */
+ @Test
+ public final void testEvaluateBooleanQuery_StringTest_NoParameters() {
+ boolean exceptionThrown = false;
+ boolean result = false;
+
+
+ // test with null as parameter
+ exceptionThrown = false;
+ result = false;
+ try {
+ // test with null as parameter
+ result = QueryUtil.evaluateBooleanQuery(stringQuery, umlPackage, new ArrayList<ModelQueryParameterValue>());
+ } catch (Exception e) {
+ exceptionThrown = true;
+ }
+ assertFalse("The query should not be true, as it returns a string, not a boolean", result);
+ assertFalse("No Exception should be thrown", exceptionThrown);
+
+ // test with an empty array list
+ exceptionThrown = false;
+ result = false;
+ try {
+ result = QueryUtil.evaluateBooleanQuery(stringQuery, umlPackage, new ArrayList<ModelQueryParameterValue>());
+ } catch (Exception e) {
+ exceptionThrown = true;
+ }
+ assertFalse("No Exception should be thrown", exceptionThrown);
+ assertFalse("The query should not be true, as it returns a string, not a boolean", result);
+
+ // test with not an element context
+ exceptionThrown = false;
+ result = false;
+ try {
+ result = QueryUtil.evaluateBooleanQuery(stringQuery, ecorePackage, new ArrayList<ModelQueryParameterValue>());
+ } catch (Exception e) {
+ exceptionThrown = true;
+ }
+ // assertTrue("An exception should be thrown", exceptionThrown);
+ assertFalse("The query should not be true, as it returns a string, not a boolean", result);
+ }
+}
diff --git a/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/TestUtil.java b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/TestUtil.java new file mode 100644 index 00000000000..5f608e8ffcb --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/TestUtil.java @@ -0,0 +1,68 @@ +/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.core.queries.test.modisco;
+
+import java.io.IOException;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.papyrus.infra.queries.core.configuration.ModiscoQueryConfiguration;
+
+
+/**
+ * Utility class for tests
+ */
+public class TestUtil {
+
+ /**
+ * Loads a model and returns the main element
+ *
+ * @param pluginPath
+ * the identifier of the test plugin
+ * @param localPath
+ * the path to the file
+ * @return the model loaded
+ */
+ public static EObject loadModel(String pluginPath, String localPath) {
+ ResourceSet resourceSet = new ResourceSetImpl();
+ Resource resource = resourceSet.createResource(URI.createPlatformPluginURI("/" + pluginPath + localPath, true));
+ try {
+ resource.load(null);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return resource.getContents().get(0);
+ }
+
+ /**
+ * Loads a model and returns the contained model configuration element
+ *
+ * @param pluginPath
+ * the identifier of the test plugin
+ * @param localPath
+ * the path to the file
+ * @return the model loaded
+ */
+ public static ModiscoQueryConfiguration loadQueryConfiguration(String pluginPath, String localPath) {
+ ResourceSet resourceSet = new ResourceSetImpl();
+ Resource resource = resourceSet.createResource(URI.createPlatformPluginURI("/" + pluginPath + localPath, true));
+ try {
+ resource.load(null);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return (ModiscoQueryConfiguration)resource.getContents().get(0);
+ }
+}
diff --git a/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/messages.properties b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/messages.properties new file mode 100644 index 00000000000..839db70c4a9 --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/messages.properties @@ -0,0 +1,18 @@ +# Query set Names
+QueryUtilTest_NotFoundQuerySet=NotFoundQuerySet
+QueryUtilTest_QuerySetName_CoreQueriesTest=CoreQueriesTest
+
+# Query Names
+QueryUtilTest_NotFoundQuery=NotFoundQuery
+QueryUtilTest_TestName_BooleanTest_NoParameters=BooleanTest_NoParameters
+QueryUtilTest_TestName_BooleanMultipleTest_NoParameters=BooleanMultipleTest_NoParameters
+QueryUtilTest_TestName_StringTest_NoParameters=StringTest_NoParameters
+QueryUtilTest_TestName_StringMultipleTest_NoParameters=StringMultipleTest_NoParameters
+
+# Errors
+QueryUtilTest_Error_CatalogIsNull=Catalog singleton should not be null
+QueryUtilTest_Error_Exceptionthrown_QueryShouldNotBeFound=Exception thrown whereas query should be found
+QueryUtilTest_Error_NoExceptionThrown_QuerySetNotFound=No Exception thrown whereas query Set was not found
+QueryUtilTest_Error_NoExceptionThrown_UnfoundableQuery=No Exception thrown whereas query was not found
+QueryUtilTest_Error_NotNull_UnfoundableQuery=Non existing Query should be null
+QueryUtilTest_Error_NotNull_UnfoundableQuerySet=Non existing QuerySet should be null
\ No newline at end of file diff --git a/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/AND.java b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/AND.java new file mode 100644 index 00000000000..372ac3939db --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/AND.java @@ -0,0 +1,22 @@ +package org.eclipse.papyrus.core.queries.test.modisco.queries; +import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException; +import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery; +import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList; +import org.eclipse.uml2.uml.NamedElement; + +/** test - AND query */ +public class AND implements IJavaModelQuery<NamedElement, Boolean> { + + /** + * {@inheritDoc} + */ + public Boolean evaluate(final NamedElement context, final ParameterValueList parameterValues) + throws ModelQueryExecutionException { + // retrieve operand left + boolean leftValue = (Boolean)parameterValues.getValueByParameterName("AND_leftOperand"); + // retrieve operand right + boolean rightValue = (Boolean)parameterValues.getValueByParameterName("AND_rightOperand"); + // return value + return (leftValue && rightValue); + } +} diff --git a/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/BooleanMultipleTest_NoParameters.java b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/BooleanMultipleTest_NoParameters.java new file mode 100644 index 00000000000..2b453f63916 --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/BooleanMultipleTest_NoParameters.java @@ -0,0 +1,34 @@ +/***************************************************************************** + * Copyright (c) 2010 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: + * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.core.queries.test.modisco.queries; + +import java.util.Arrays; +import java.util.Collection; + +import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException; +import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery; +import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList; +import org.eclipse.uml2.uml.Element; + +/** test - boolean return multiple values - no parameters */ +public class BooleanMultipleTest_NoParameters implements IJavaModelQuery<Element, Collection<Boolean>> { + + /** + * {@inheritDoc} + */ + public Collection<Boolean> evaluate(final Element context, final ParameterValueList parameterValues) + throws ModelQueryExecutionException { + return Arrays.asList(true, false, true); + } +} diff --git a/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/BooleanTest_Boolean_1_Integer_1.java b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/BooleanTest_Boolean_1_Integer_1.java new file mode 100644 index 00000000000..3a2fe753106 --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/BooleanTest_Boolean_1_Integer_1.java @@ -0,0 +1,17 @@ +package org.eclipse.papyrus.core.queries.test.modisco.queries; +import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException; +import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery; +import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList; +import org.eclipse.uml2.uml.Element; + +/** test - boolean return value - Boolean[1], Integer[1] */ +public class BooleanTest_Boolean_1_Integer_1 implements IJavaModelQuery<Element, Boolean> { + + /** + * {@inheritDoc} + */ + public Boolean evaluate(final Element context, final ParameterValueList parameterValues) + throws ModelQueryExecutionException { + return true; + } +} diff --git a/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/BooleanTest_Enum_1.java b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/BooleanTest_Enum_1.java new file mode 100644 index 00000000000..546bb68085d --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/BooleanTest_Enum_1.java @@ -0,0 +1,17 @@ +package org.eclipse.papyrus.core.queries.test.modisco.queries; +import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException; +import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery; +import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList; +import org.eclipse.uml2.uml.Element; + +/** test - boolean return value - Enum[1] */ +public class BooleanTest_Enum_1 implements IJavaModelQuery<Element, Boolean> { + + /** + * {@inheritDoc} + */ + public Boolean evaluate(final Element context, final ParameterValueList parameterValues) + throws ModelQueryExecutionException { + return true; + } +} diff --git a/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/BooleanTest_NoParameters.java b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/BooleanTest_NoParameters.java new file mode 100644 index 00000000000..6b8d0062a0c --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/BooleanTest_NoParameters.java @@ -0,0 +1,31 @@ +/***************************************************************************** + * Copyright (c) 2010 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: + * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.core.queries.test.modisco.queries; + +import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException; +import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery; +import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList; +import org.eclipse.uml2.uml.Element; + +/** test - boolean return value - no parameters */ +public class BooleanTest_NoParameters implements IJavaModelQuery<Element, Boolean> { + + /** + * {@inheritDoc} + */ + public Boolean evaluate(final Element context, final ParameterValueList parameterValues) + throws ModelQueryExecutionException { + return (context instanceof Element); + } +} diff --git a/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/BooleanTest_String_1.java b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/BooleanTest_String_1.java new file mode 100644 index 00000000000..d4aaf417b0a --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/BooleanTest_String_1.java @@ -0,0 +1,19 @@ +package org.eclipse.papyrus.core.queries.test.modisco.queries; + +import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException; +import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery; +import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList; +import org.eclipse.papyrus.core.queries.test.modisco.IQueryNames; +import org.eclipse.uml2.uml.Element; + +/** test - boolean return value - String[1] */ +public class BooleanTest_String_1 implements IJavaModelQuery<Element, Boolean> { + + /** + * {@inheritDoc} + */ + public Boolean evaluate(final Element context, final ParameterValueList parameterValues) + throws ModelQueryExecutionException { + return (parameterValues.getValueByParameterName(IQueryNames.BooleanTest_String_1_StringParamName) instanceof String); + } +} diff --git a/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/BooleanTest_String_3.java b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/BooleanTest_String_3.java new file mode 100644 index 00000000000..4de555ad4e6 --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/BooleanTest_String_3.java @@ -0,0 +1,17 @@ +package org.eclipse.papyrus.core.queries.test.modisco.queries; +import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException; +import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery; +import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList; +import org.eclipse.uml2.uml.Element; + +/** test - boolean return value - String[3] */ +public class BooleanTest_String_3 implements IJavaModelQuery<Element, Boolean> { + + /** + * {@inheritDoc} + */ + public Boolean evaluate(final Element context, final ParameterValueList parameterValues) + throws ModelQueryExecutionException { + return true; + } +} diff --git a/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/BooleanTest_String_Star.java b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/BooleanTest_String_Star.java new file mode 100644 index 00000000000..12d1e0da49d --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/BooleanTest_String_Star.java @@ -0,0 +1,17 @@ +package org.eclipse.papyrus.core.queries.test.modisco.queries; +import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException; +import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery; +import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList; +import org.eclipse.uml2.uml.Element; + +/** test - boolean return value - String[-1] */ +public class BooleanTest_String_Star implements IJavaModelQuery<Element, Boolean> { + + /** + * {@inheritDoc} + */ + public Boolean evaluate(final Element context, final ParameterValueList parameterValues) + throws ModelQueryExecutionException { + return true; + } +} diff --git a/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/CopyOfIsNamed.java b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/CopyOfIsNamed.java new file mode 100644 index 00000000000..900f94da7fb --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/CopyOfIsNamed.java @@ -0,0 +1,33 @@ +package org.eclipse.papyrus.core.queries.test.modisco.queries; + +import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException; +import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery; +import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList; +import org.eclipse.uml2.uml.LiteralString; +import org.eclipse.uml2.uml.NamedElement; + +/** test - test if the name of the element is equal to the specified name */ +public class CopyOfIsNamed implements IJavaModelQuery<NamedElement, Boolean> { + + /** + * {@inheritDoc} + */ + public Boolean evaluate(final NamedElement context, final ParameterValueList parameterValues) + throws ModelQueryExecutionException { + // retrieve the parameter name + Object value = parameterValues.getParameterValueByName("name"); + if(value == null) { + throw new ModelQueryExecutionException("The parameter name has no values"); + } + if(!(value instanceof LiteralString)) { + throw new ModelQueryExecutionException("The parameter name does not have a String value"); + } + + if(context == null) { + throw new ModelQueryExecutionException("The context is null, should be a NamedElement"); + } + + return ((LiteralString)value).stringValue().equalsIgnoreCase(context.getName()); + + } +} diff --git a/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/IsNameLongerThan.java b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/IsNameLongerThan.java new file mode 100644 index 00000000000..75981cdc3e8 --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/IsNameLongerThan.java @@ -0,0 +1,36 @@ +package org.eclipse.papyrus.core.queries.test.modisco.queries; +import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException; +import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery; +import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList; +import org.eclipse.uml2.uml.NamedElement; + +/** test - check if the element's name is longer than the specified number. The booelan indicates if it is tru when length is equal. */ +public class IsNameLongerThan implements IJavaModelQuery<NamedElement, Boolean> { + + /** + * {@inheritDoc} + */ + public Boolean evaluate(final NamedElement context, final ParameterValueList parameterValues) + throws ModelQueryExecutionException { + // retrieve the 2 values for the query + boolean isTrueWhenEqual = (Boolean)parameterValues.getValueByParameterName("isTrueWhenEqual"); + int length = (Integer)parameterValues.getValueByParameterName("length"); + + if(!(context instanceof NamedElement)) { + throw new ModelQueryExecutionException("context is null or is not a Named Element"); + } + + String name = context.getName(); + if(name == null) { + return false; + } + + if(name.length() == length) { + return isTrueWhenEqual; + } else if(name.length() > length) { + return true; + } + return false; + + } +} diff --git a/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/IsNamed.java b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/IsNamed.java new file mode 100644 index 00000000000..d3be1d98827 --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/IsNamed.java @@ -0,0 +1,30 @@ +package org.eclipse.papyrus.core.queries.test.modisco.queries; +import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException; +import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery; +import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList; +import org.eclipse.uml2.uml.NamedElement; + +/** test - test if the name of the element is equal to the specified name */ +public class IsNamed implements IJavaModelQuery<NamedElement, Boolean> { + + /** + * {@inheritDoc} + */ + public Boolean evaluate(final NamedElement context, final ParameterValueList parameterValues) + throws ModelQueryExecutionException { + // retrieve the parameter name + Object value = parameterValues.getValueByParameterName("name"); + if(value == null) { + throw new ModelQueryExecutionException("The parameter name has no values"); + } + if(!(value instanceof String)) { + throw new ModelQueryExecutionException("The parameter name does not have a String value"); + } + + if(context == null) { + throw new ModelQueryExecutionException("The context is null, should be a NamedElement"); + } + + return ((String)value).equalsIgnoreCase(context.getName()); + } +} diff --git a/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/IsStrictInstanceOf.java b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/IsStrictInstanceOf.java new file mode 100644 index 00000000000..d48d4257d6e --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/IsStrictInstanceOf.java @@ -0,0 +1,21 @@ +package org.eclipse.papyrus.core.queries.test.modisco.queries; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException; +import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery; +import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList; + +/** test - test if an element is strict type of given value */ +public class IsStrictInstanceOf implements IJavaModelQuery<EObject, Boolean> { + + /** + * {@inheritDoc} + */ + public Boolean evaluate(final EObject context, final ParameterValueList parameterValues) + throws ModelQueryExecutionException { + + String eObjectTypeName = context.eClass().getInstanceTypeName(); + String typeName = parameterValues.getValueByParameterName("typeName").toString(); + + return eObjectTypeName.equals(typeName); + } +} diff --git a/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/ListElementsInstanceofClassifiers.java b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/ListElementsInstanceofClassifiers.java new file mode 100644 index 00000000000..b8a0e48eefe --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/ListElementsInstanceofClassifiers.java @@ -0,0 +1,34 @@ +package org.eclipse.papyrus.core.queries.test.modisco.queries; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException; +import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery; +import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList; +import org.eclipse.uml2.uml.Classifier; +import org.eclipse.uml2.uml.NamedElement; + +/** test - list the elements given as parameters that are instanceof Classifiers */ +public class ListElementsInstanceofClassifiers implements IJavaModelQuery<EObject, Collection<Classifier>> { + + /** + * {@inheritDoc} + */ + @SuppressWarnings("unchecked") + public Collection<Classifier> evaluate(final EObject context, final ParameterValueList parameterValues) + throws ModelQueryExecutionException { + // retrieve the list of elements + List<NamedElement> elements = (List<NamedElement>)parameterValues.getValueByParameterName("elementList"); + + List<Classifier> classifiers = new ArrayList<Classifier>(); + for(NamedElement element : elements) { + if(element instanceof Classifier) { + classifiers.add((Classifier)element); + } + } + return classifiers; + } +} diff --git a/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/ListElementsWithName.java b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/ListElementsWithName.java new file mode 100644 index 00000000000..9e08001426e --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/ListElementsWithName.java @@ -0,0 +1,47 @@ +package org.eclipse.papyrus.core.queries.test.modisco.queries; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException; +import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery; +import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList; +import org.eclipse.uml2.uml.NamedElement; +import org.eclipse.uml2.uml.Package; +import org.eclipse.uml2.uml.UMLPackage; + +/** test - return a list of named elements for whicv name contains basic */ +public class ListElementsWithName implements IJavaModelQuery<Package, Collection<NamedElement>> { + + /** + * {@inheritDoc} + */ + public Collection<NamedElement> evaluate(final Package context, final ParameterValueList parameterValues) + throws ModelQueryExecutionException { + + String containedString = (String)parameterValues.getValueByParameterName("containedString"); + + Collection<Object> namedElements = EcoreUtil.getObjectsByType(context.allOwnedElements(), UMLPackage.eINSTANCE.getNamedElement()); + List<NamedElement> elements = new ArrayList<NamedElement>(); + + + // add the element itself if required + if(context instanceof NamedElement) { + String name = ((NamedElement)context).getName(); + if(name != null && name.indexOf(containedString) != -1) { + elements.add((NamedElement)context); + } + } + + // check all contained elements + for(Object namedElement : namedElements) { + String name = ((NamedElement)namedElement).getName(); + if(name != null && name.indexOf(containedString) != -1) { + elements.add((NamedElement)namedElement); + } + } + return elements; + } +} diff --git a/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/StringMultipleTest_NoParameters.java b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/StringMultipleTest_NoParameters.java new file mode 100644 index 00000000000..a9f3a8f6f83 --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/StringMultipleTest_NoParameters.java @@ -0,0 +1,35 @@ +/***************************************************************************** + * Copyright (c) 2010 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: + * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.core.queries.test.modisco.queries; + +import java.util.Arrays; +import java.util.Collection; + +import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException; +import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery; +import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList; +import org.eclipse.uml2.uml.Element; + +/** test - string return multiple values - no parameters */ +public class StringMultipleTest_NoParameters implements IJavaModelQuery<Element, Collection<String>> { + + /** + * {@inheritDoc} + */ + public Collection<String> evaluate(final Element context, final ParameterValueList parameterValues) + throws ModelQueryExecutionException { + // TODO Auto-generated method stub + return Arrays.asList("Test1", "Test2"); + } +} diff --git a/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/StringTest_NoParameters.java b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/StringTest_NoParameters.java new file mode 100644 index 00000000000..60e1dc0be08 --- /dev/null +++ b/deprecated/org.eclipse.papyrus.core.queries.test/src/org/eclipse/papyrus/core/queries/test/modisco/queries/StringTest_NoParameters.java @@ -0,0 +1,30 @@ +/***************************************************************************** + * Copyright (c) 2010 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: + * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.core.queries.test.modisco.queries; +import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException; +import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery; +import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList; +import org.eclipse.uml2.uml.Element; + +/** test - string return value - no parameters */ +public class StringTest_NoParameters implements IJavaModelQuery<Element, String> { + + /** + * {@inheritDoc} + */ + public String evaluate(final Element context, final ParameterValueList parameterValues) + throws ModelQueryExecutionException { + return "Test"; + } +} |