Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Rentz-Reichert2011-03-04 07:04:37 -0500
committerHenrik Rentz-Reichert2011-03-04 07:04:37 -0500
commit1ca373ad91c635f9ed5895be8e9b8e601d7500ad (patch)
tree44bc852616d7f06cdc9ef6d60fc19a00de012784
parentbeb62ca5645b91fb0dadaaaaffd76e56981f2ed2 (diff)
downloadorg.eclipse.etrice-1ca373ad91c635f9ed5895be8e9b8e601d7500ad.tar.gz
org.eclipse.etrice-1ca373ad91c635f9ed5895be8e9b8e601d7500ad.tar.xz
org.eclipse.etrice-1ca373ad91c635f9ed5895be8e9b8e601d7500ad.zip
core.room.tests: new test plugin with sample test for model
validation
-rw-r--r--tests/org.eclipse.etrice.core.room.tests/.classpath9
-rw-r--r--tests/org.eclipse.etrice.core.room.tests/.gitignore1
-rw-r--r--tests/org.eclipse.etrice.core.room.tests/.project34
-rw-r--r--tests/org.eclipse.etrice.core.room.tests/.settings/org.eclipse.jdt.core.prefs12
-rw-r--r--tests/org.eclipse.etrice.core.room.tests/META-INF/MANIFEST.MF14
-rw-r--r--tests/org.eclipse.etrice.core.room.tests/about.html28
-rw-r--r--tests/org.eclipse.etrice.core.room.tests/build.properties6
-rw-r--r--tests/org.eclipse.etrice.core.room.tests/models/test.room30
-rw-r--r--tests/org.eclipse.etrice.core.room.tests/org.eclipse.etrice.generator.tests.launch46
-rw-r--r--tests/org.eclipse.etrice.core.room.tests/src/org/eclipse/etrice/core/CoreTestsActivator.java47
-rw-r--r--tests/org.eclipse.etrice.core.room.tests/src/org/eclipse/etrice/core/TestBase.java73
-rw-r--r--tests/org.eclipse.etrice.core.room.tests/src/org/eclipse/etrice/core/TestCases.java75
12 files changed, 375 insertions, 0 deletions
diff --git a/tests/org.eclipse.etrice.core.room.tests/.classpath b/tests/org.eclipse.etrice.core.room.tests/.classpath
new file mode 100644
index 000000000..8eee426c8
--- /dev/null
+++ b/tests/org.eclipse.etrice.core.room.tests/.classpath
@@ -0,0 +1,9 @@
+<?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/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="models"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.etrice.modellib"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/tests/org.eclipse.etrice.core.room.tests/.gitignore b/tests/org.eclipse.etrice.core.room.tests/.gitignore
new file mode 100644
index 000000000..092357e47
--- /dev/null
+++ b/tests/org.eclipse.etrice.core.room.tests/.gitignore
@@ -0,0 +1 @@
+bin
diff --git a/tests/org.eclipse.etrice.core.room.tests/.project b/tests/org.eclipse.etrice.core.room.tests/.project
new file mode 100644
index 000000000..cc8061769
--- /dev/null
+++ b/tests/org.eclipse.etrice.core.room.tests/.project
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.etrice.core.room.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>
+ <buildCommand>
+ <name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
+ </natures>
+</projectDescription>
diff --git a/tests/org.eclipse.etrice.core.room.tests/.settings/org.eclipse.jdt.core.prefs b/tests/org.eclipse.etrice.core.room.tests/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..a206ade29
--- /dev/null
+++ b/tests/org.eclipse.etrice.core.room.tests/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,12 @@
+#Thu Feb 17 23:11:30 CET 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/tests/org.eclipse.etrice.core.room.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.etrice.core.room.tests/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..cff69b649
--- /dev/null
+++ b/tests/org.eclipse.etrice.core.room.tests/META-INF/MANIFEST.MF
@@ -0,0 +1,14 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: eTrice Room Core Tests
+Bundle-SymbolicName: org.eclipse.etrice.core.room.tests
+Bundle-Version: 0.1.0
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-Vendor: eTrice (Incubation)
+Require-Bundle: org.eclipse.etrice.core.room;bundle-version="0.1.0",
+ org.junit;bundle-version="4.8.1",
+ org.eclipse.osgi;bundle-version="3.6.0",
+ org.eclipse.xtext;bundle-version="1.0.0",
+ org.eclipse.core.runtime;bundle-version="3.6.0"
+Bundle-Activator: org.eclipse.etrice.core.CoreTestsActivator
+Bundle-ActivationPolicy: lazy
diff --git a/tests/org.eclipse.etrice.core.room.tests/about.html b/tests/org.eclipse.etrice.core.room.tests/about.html
new file mode 100644
index 000000000..f47dbddbb
--- /dev/null
+++ b/tests/org.eclipse.etrice.core.room.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, 2006</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). 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, &quot;Program&quot; 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 (&quot;Redistributor&quot;) 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> \ No newline at end of file
diff --git a/tests/org.eclipse.etrice.core.room.tests/build.properties b/tests/org.eclipse.etrice.core.room.tests/build.properties
new file mode 100644
index 000000000..4f415d5ce
--- /dev/null
+++ b/tests/org.eclipse.etrice.core.room.tests/build.properties
@@ -0,0 +1,6 @@
+source.. = src/,\
+ models/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ models/
diff --git a/tests/org.eclipse.etrice.core.room.tests/models/test.room b/tests/org.eclipse.etrice.core.room.tests/models/test.room
new file mode 100644
index 000000000..65736f703
--- /dev/null
+++ b/tests/org.eclipse.etrice.core.room.tests/models/test.room
@@ -0,0 +1,30 @@
+RoomModel test {
+ ProtocolClass MyProtocol {
+ incoming {
+ Message in1()
+ }
+ outgoing {
+ }
+ }
+
+ ActorClass A {
+ Interface {
+ Port p: MyProtocol
+ }
+ }
+
+ ActorClass B {
+ Interface {
+ Port p: MyProtocol
+ }
+ }
+
+ ActorClass C {
+ Structure {
+ ActorRef a: A
+ ActorRef b: B
+
+ Binding a.p and b.p
+ }
+ }
+}
diff --git a/tests/org.eclipse.etrice.core.room.tests/org.eclipse.etrice.generator.tests.launch b/tests/org.eclipse.etrice.core.room.tests/org.eclipse.etrice.generator.tests.launch
new file mode 100644
index 000000000..7103ffffe
--- /dev/null
+++ b/tests/org.eclipse.etrice.core.room.tests/org.eclipse.etrice.generator.tests.launch
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<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/pde-junit"/>
+<booleanAttribute key="default" value="false"/>
+<stringAttribute key="deselected_workspace_plugins" value="de.protos.automation.io,org.eclipse.etrice.example.hrr,org.eclipse.graphiti.examples.tutorial,org.eclipse.etrice.ui.behavior.tests,org.eclipse.graphiti.examples.common,org.eclipse.etrice.example,org.eclipse.etrice.integration.tests,de.protos.automation.demos.fischertechnik"/>
+<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.etrice.generator.tests"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="4"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
+<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
+</listAttribute>
+<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=org.eclipse.etrice.generator.tests"/>
+<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.etrice.generator.tests"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms40m -Xmx384m"/>
+<stringAttribute key="pde.version" value="3.3"/>
+<stringAttribute key="product" value="org.eclipse.sdk.ide"/>
+<booleanAttribute key="run_in_ui_thread" value="true"/>
+<stringAttribute key="selected_target_plugins" value="org.eclipse.equinox.p2.artifact.repository@default:default,org.eclipse.update.core.win32@default:false,org.eclipse.debug.core@default:default,org.eclipse.xtend.typesystem.uml2.ui@default:default,org.eclipse.emf.ecore.change*2.5.1.v20100907-1643@default:default,org.eclipse.core.jobs*3.5.1.R36x_v20100824@default:default,org.eclipse.draw2d.doc.isv@default:default,org.eclipse.pde.ua.ui@default:default,org.eclipse.core.runtime.compatibility.registry@default:false,org.apache.commons.lang@default:default,org.eclipse.help@default:default,org.sat4j.core@default:default,org.eclipse.pde.build@default:default,org.eclipse.core.resources@default:default,org.eclipse.osgi.services@default:default,org.eclipse.epp.mpc.core@default:default,org.eclipse.emf.ant@default:default,org.eclipse.emf.compare.doc@default:default,org.eclipse.emf.compare.diff.edit@default:default,org.eclipse.equinox.p2.discovery.compatibility@default:default,org.eclipse.equinox.concurrent@default:default,org.eclipse.ui.workbench.texteditor@default:default,org.eclipse.pde.ds.core@default:default,de.itemis.xtext.antlr@default:default,org.eclipse.emf.java.editor@default:default,org.eclipse.xsd.ecore.exporter@default:default,org.eclipse.xtend.util.stdlib@default:default,org.apache.commons.codec@default:default,org.eclipse.ui.intro@default:default,org.eclipse.emf.mapping.xsd2ecore@default:default,org.eclipse.equinox.simpleconfigurator@1:true,org.apache.jasper@default:default,org.eclipse.equinox.p2.touchpoint.eclipse@default:default,org.eclipse.xtend.profiler@default:default,org.eclipse.equinox.p2.repository*2.0.1.R36x_v20100823@default:default,org.eclipse.emf.examples.generator.validator@default:default,org.eclipse.ui.net@default:default,org.eclipse.uml2.uml.ecore.importer@default:default,org.sat4j.pb@default:default,org.apache.commons.logging*1.0.4.v201005080501@default:default,org.eclipse.emf.mwe2.runtime@default:default,org.eclipse.equinox.p2.updatesite@default:default,org.eclipse.core.runtime.compatibility@default:default,org.eclipse.ui.ide*3.6.1.M20100825-0800@default:default,org.mortbay.jetty.server@default:default,org.eclipse.emf.transaction.doc@default:default,org.eclipse.ui*3.6.1.M20100826-1330@default:default,org.eclipse.ui.externaltools@default:default,org.eclipse.swt*3.6.1.v3655c@default:default,org.eclipse.xpand.doc@default:default,org.eclipse.help.webapp@default:default,org.eclipse.osgi*3.6.1.R36x_v20100806@-1:true,org.eclipse.emf.converter@default:default,org.eclipse.ecf.provider.filetransfer@default:default,org.eclipse.equinox.p2.ui.sdk@default:default,org.eclipse.emf.doc@default:default,org.eclipse.ui.workbench.compatibility@default:false,org.eclipse.emf.mapping.ecore2xml.ui@default:default,org.eclipse.equinox.simpleconfigurator.manipulator@default:default,org.eclipse.core.runtime@default:true,org.eclipse.ecf.provider.filetransfer.httpclient@default:default,org.eclipse.core.filesystem*1.3.1.R36x_v20100727-0745@default:default,org.eclipse.jdt.compiler.tool@default:false,org.eclipse.pde.launching@default:default,org.eclipse.jdt.debug.ui@default:default,org.eclipse.xtend.typesystem.uml2@default:default,org.eclipse.ui.navigator.resources@default:default,org.eclipse.team.core@default:default,org.eclipse.xtext.xbase.ui@default:default,org.eclipse.equinox.p2.director@default:default,org.eclipse.emf.importer.java@default:default,javax.servlet@default:default,org.eclipse.jface.text*3.6.1.r361_v20100825-0800@default:default,org.eclipse.pde.ua.core@default:default,org.eclipse.ui.cheatsheets@default:default,org.eclipse.xtext.xtext.ui@default:default,org.eclipse.uml2.codegen.ecore@default:default,org.eclipse.debug.ui@default:default,org.eclipse.xtend.ui@default:default,org.eclipse.ui.forms*3.5.0.v20100427@default:default,org.apache.commons.logging*1.1.1.v201005080502@default:default,org.eclipse.team.svn.core@default:default,org.eclipse.equinox.p2.ql@default:default,org.eclipse.gef.doc.isv@default:default,org.eclipse.equinox.launcher@default:default,org.eclipse.xtext.xtend@default:default,org.eclipse.emf.mapping.ecore2ecore.editor@default:default,org.eclipse.emf.java@default:default,org.eclipse.emf.databinding@default:default,org.eclipse.xtext.common.types.ui@default:default,org.eclipse.jdt.apt.core@default:default,org.eclipse.core.databinding.beans@default:default,org.eclipse.xsd.cheatsheets@default:default,org.eclipse.emf.examples@default:default,org.eclipse.jdt.doc.user@default:default,org.eclipse.jdt.apt.pluggable.core@default:default,org.eclipse.help.appserver@default:default,org.eclipse.emf.workspace.doc@default:default,org.eclipse.emf.mwe.ui.simpleEditor@default:default,org.eclipse.xtend.typesystem.xsd@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.p2.updatechecker@default:default,org.eclipse.emf.exporter.html@default:default,org.eclipse.update.configurator@3:true,org.eclipse.equinox.http.servlet@default:default,org.eclipse.ecf.provider.filetransfer.ssl@default:false,org.eclipse.emf.workspace@default:default,org.eclipse.emf.databinding.edit@default:default,org.eclipse.xtext.ui@default:default,org.eclipse.jdt.compiler.apt@default:false,org.eclipse.emf.validation@default:default,org.eclipse.emf.examples.library.edit@default:default,org.eclipse.emf.mapping.ecore2xml@default:default,org.eclipse.equinox.p2.extensionlocation@default:default,com.google.collect@default:default,org.eclipse.xsd.ecore.importer@default:default,org.eclipse.equinox.p2.reconciler.dropins@default:default,org.eclipse.ui.views.properties.tabbed@default:default,org.apache.lucene@default:default,org.eclipse.core.externaltools@default:default,org.eclipse.team.svn.help@default:default,org.eclipse.ecf.identity@default:default,org.eclipse.xpand@default:default,org.eclipse.emf.mwe2.language@default:default,org.eclipse.ltk.core.refactoring@default:default,org.eclipse.jdt.junit@default:default,org.eclipse.equinox.ds@1:true,org.eclipse.equinox.p2.engine@default:default,org.eclipse.equinox.p2.publisher@default:default,org.eclipse.xsd.editor@default:default,org.junit4@default:default,org.eclipse.pde.core@default:default,org.eclipse.ui.forms*3.5.2.r36_v20100702@default:default,org.eclipse.jdt.doc.isv@default:default,org.eclipse.emf.examples.library.editor@default:default,org.eclipse.team.cvs.ui@default:default,org.eclipse.xpand.ui@default:default,org.eclipse.xtext.util@default:default,javax.servlet.jsp@default:default,org.eclipse.ecf.ssl@default:false,org.eclipse.equinox.p2.ui@default:default,org.eclipse.help.ui@default:default,org.eclipse.swt.win32.win32.x86@default:false,org.eclipse.emf.edit*2.6.0.v20100914-1218@default:default,org.eclipse.ui.workbench*3.6.1.M20100826-1330@default:default,org.eclipse.equinox.security.win32.x86@default:false,org.eclipse.equinox.p2.director.app@default:default,org.eclipse.jface*3.6.0.I20100601-0800@default:default,org.eclipse.ecf.provider.filetransfer.httpclient.ssl@default:false,org.eclipse.ant.core@default:default,org.eclipse.emf.compare.match@default:default,org.eclipse.equinox.common@2:true,org.apache.lucene.analysis@default:default,org.eclipse.emf.edit.ui*2.6.0.v20100914-1218@default:default,org.eclipse.compare.win32@default:default,org.eclipse.emf.mwe2.language.ui@default:default,org.eclipse.equinox.servletbridge.extensionbundle@default:false,org.eclipse.emf.mapping.ecore2ecore@default:default,org.eclipse.xtext.ui.shared@default:default,org.eclipse.ui.console@default:default,org.eclipse.pde.api.tools@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.platform.doc.isv@default:default,org.eclipse.emf.compare@default:default,org.eclipse.emf.mwe.doc@default:default,org.eclipse.equinox.p2.core*2.0.2.R36x_v20100804@default:default,org.eclipse.core.expressions@default:default,org.eclipse.xpand.activities@default:default,org.eclipse.xtext.xbase@default:default,org.eclipse.equinox.p2.ui.discovery@default:default,org.eclipse.xtend.typesystem.emf@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.jdt.core@default:default,org.eclipse.ltk.ui.refactoring@default:default,org.eclipse.compare.core@default:default,com.google.inject@default:default,org.eclipse.core.net.win32.x86@default:false,org.eclipse.core.filesystem.win32.x86@default:false,org.eclipse.equinox.p2.metadata.generator@default:default,org.eclipse.jdt.junit.runtime@default:default,org.eclipse.jdt.ui@default:default,org.eclipse.equinox.launcher.win32.win32.x86@default:false,org.eclipse.jdt.core.manipulation@default:default,org.eclipse.platform.doc.user@default:default,org.eclipse.emf.compare.diff@default:default,org.eclipse.emf.codegen@default:default,org.eclipse.emf@default:default,org.eclipse.draw2d@default:default,org.eclipse.equinox.p2.metadata.repository@default:default,org.eclipse.emf.transaction.ui@default:default,org.eclipse.pde.runtime@default:default,org.eclipse.emf.generic.editor@default:default,org.eclipse.cvs@default:default,org.eclipse.emf.workspace.ui@default:default,org.eclipse.xtext.xtext.ui.examples@default:default,org.eclipse.jface.text*3.6.0.v20100526-0800@default:default,org.eclipse.ui.win32@default:false,org.eclipse.equinox.p2.console@default:default,org.eclipse.jdt@default:default,org.eclipse.equinox.p2.discovery@default:default,org.eclipse.jface.databinding@default:default,org.eclipse.xsd.edit@default:default,org.eclipse.jsch.core@default:default,org.eclipse.equinox.jsp.jasper@default:default,org.eclipse.rcp@default:default,org.eclipse.equinox.frameworkadmin@default:default,org.eclipse.emf.importer.ecore@default:default,org.eclipse.graphiti.doc@default:default,org.eclipse.update.ui@default:default,org.eclipse.emf.transaction.examples@default:default,org.eclipse.xsd.doc@default:default,org.eclipse.emf.cheatsheets@default:default,org.eclipse.xtext.common.types@default:default,org.eclipse.emf.activities@default:default,org.junit*4.8.1.v4_8_1_v20100427-1100@default:default,org.eclipse.ui.editors@default:default,org.eclipse.ecf.filetransfer@default:default,org.eclipse.emf.ecore.editor@default:default,org.eclipse.emf.mapping.ecore@default:default,org.eclipse.ecf@default:default,org.eclipse.ui.navigator@default:default,org.eclipse.xtext.logging@default:false,org.eclipse.emf.compare.epatch@default:default,org.eclipse.emf.example.installer@default:default,org.eclipse.equinox.p2.ui.sdk.scheduler@default:default,org.eclipse.emf.ecore.xmi@default:default,org.eclipse.emf.mapping@default:default,org.eclipse.emf.mwe.activities@default:default,org.eclipse.xtext.doc@default:default,org.eclipse.equinox.p2.garbagecollector@default:default,org.eclipse.jdt.junit.core@default:default,org.eclipse.emf.mapping.xsd2ecore.editor@default:default,org.eclipse.xtext.activities@default:default,org.eclipse.emf.importer.rose@default:default,org.eclipse.equinox.security.ui@default:default,org.eclipse.emf.ecore.edit*2.6.0.v20100914-1218@default:default,org.apache.commons.cli@default:default,org.eclipse.help.base@default:default,org.eclipse.ui.views@default:default,org.eclipse.xsd.mapping@default:default,org.eclipse.pde.ui.templates@default:default,org.eclipse.xpand.incremental@default:default,org.eclipse.equinox.p2.directorywatcher@default:default,org.eclipse.team.cvs.ssh2@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.uml2.uml@default:default,org.eclipse.compare@default:default,org.eclipse.equinox.p2.metadata@default:default,org.apache.log4j@default:default,org.eclipse.jdt.junit4.runtime@default:default,org.eclipse.ui.ide.application@default:default,org.junit*3.8.2.v3_8_2_v20100427-1100@default:default,org.eclipse.emf.common.ui*2.6.0.v20100914-1218@default:default,com.ibm.icu@default:default,org.eclipse.equinox.p2.jarprocessor@default:default,org.eclipse.xtend.shared.ui@default:default,org.eclipse.equinox.p2.operations@default:default,org.eclipse.core.resources.win32.x86@default:false,org.eclipse.emf.codegen.ecore@default:default,org.eclipse.emf.mwe.core@default:default,org.eclipse.pde.api.tools.ui@default:default,org.eclipse.ui.browser@default:default,org.eclipse.core.net@default:default,org.eclipse.ant.launching@default:default,org.eclipse.ui.intro.universal@default:default,org.eclipse.uml2.uml.resources@default:default,org.eclipse.equinox.p2.touchpoint.natives@default:default,org.eclipse.emf.mapping.ui@default:default,org.eclipse.jface*3.6.1.M20100825-0800@default:default,org.eclipse.emf.mwe.utils@default:default,org.eclipse.xtend.check.ui@default:default,org.apache.commons.el@default:default,org.eclipse.ui.presentations.r21@default:default,org.antlr.gen@default:default,org.eclipse.gef.examples.ui.pde@default:default,org.eclipse.emf.transaction@default:default,org.eclipse.ui.views.log@default:default,org.eclipse.equinox.http.registry@default:default,org.eclipse.text@default:default,org.eclipse.pde.ds.ui@default:default,org.eclipse.emf.exporter@default:default,org.aopalliance@default:default,org.eclipse.search@default:default,org.eclipse.equinox.p2.repository.tools@default:default,org.hamcrest.core@default:default,org.eclipse.emf.compare.ui@default:default,org.mortbay.jetty.util@default:default,org.apache.ant@default:default,org.eclipse.update.core@default:default,org.eclipse.ant.ui@default:default,org.eclipse.core.boot@default:default,org.polarion.eclipse.team.svn.connector.javahl16@default:default,org.eclipse.emf.mwe2.launch@default:default,org.eclipse.core.filebuffers@default:default,org.eclipse.xsd.mapping.editor@default:default,org.eclipse.jdt.debug@default:default,org.eclipse.xsd@default:default,org.eclipse.core.commands@default:default,org.eclipse.xsd.example.installer@default:default,org.eclipse.xtend.typesystem.xsd.ui@default:default,org.eclipse.equinox.event@default:default,org.antlr.runtime@default:default,org.eclipse.equinox.http.jetty@default:default,org.eclipse.osgi.util@default:default,org.eclipse.emf.ecore*2.6.1.v20100914-1218@default:default,org.eclipse.xsd.example@default:default,org.eclipse.xtext.builder@default:default,org.eclipse.xtend@default:default,org.eclipse.emf.codegen.ui@default:default,org.eclipse.pde.junit.runtime@default:default,org.eclipse.team.ui@default:default,org.eclipse.xtext.generator@default:default,org.eclipse.team.svn.ui@default:default,org.eclipse.platform@default:default,org.eclipse.emf.java.edit@default:default,org.eclipse.gef@default:default,org.eclipse.pde.ui@default:default,org.eclipse.jdt.apt.ui@default:default,org.eclipse.epp.mpc.ui@default:default,org.eclipse.emf.mwe.ui@default:default,com.jcraft.jsch@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.jsch.ui@default:default,org.eclipse.xsd.ecore.converter@default:default,org.eclipse.uml2.common@default:default,org.eclipse.emf.ecore.change.edit@default:default,org.eclipse.xtext@default:default,org.eclipse.update.scheduler@default:default,org.eclipse.equinox.jsp.jasper.registry@default:default,org.eclipse.xtext.junit@default:default,org.eclipse.equinox.frameworkadmin.equinox@default:default,org.eclipse.sdk@default:default,org.eclipse.team.svn@default:default,org.polarion.eclipse.team.svn.connector@default:default,org.eclipse.jdt.launching@default:default,org.eclipse.emf.mapping.ecore.editor@default:default,org.eclipse.xtext.ecore@default:default,org.eclipse.xtext.ui.ecore@default:default,org.eclipse.xpand.examples@default:default,org.eclipse.xtend.typesystem.emf.ui@default:default,org.eclipse.emf.examples.library@default:default,org.eclipse.core.databinding@default:default,org.polarion.eclipse.team.svn.connector.svnkit16@default:default,org.eclipse.core.runtime.compatibility.auth@default:default,org.eclipse.equinox.security@default:default,org.eclipse.pde.doc.user@default:default,org.eclipse.equinox.util@default:default,org.eclipse.core.variables@default:default,org.eclipse.emf.importer@default:default,org.eclipse.equinox.app*1.3.1.R36x_v20100803@default:default,org.eclipse.emf.common*2.6.0.v20100914-1218@default:default,org.apache.commons.httpclient@default:default,org.eclipse.emf.codegen.ecore.ui@default:default,org.eclipse.pde@default:default,org.objectweb.asm@default:default,org.eclipse.epp.mpc.help.ui@default:default,org.eclipse.xtext.ui.junit@default:default,org.eclipse.team.cvs.core@default:default"/>
+<stringAttribute key="selected_workspace_plugins" value="org.eclipse.graphiti.mm@default:default,org.eclipse.etrice.core.room@default:default,org.eclipse.etrice.ui.behavior@default:default,org.eclipse.etrice.ui.structure.tests@default:default,org.eclipse.etrice.generator@default:default,org.eclipse.etrice.ui.tests.base@default:default,org.eclipse.graphiti.ui@default:default,org.eclipse.etrice.ui.common@default:default,org.eclipse.graphiti@default:default,org.eclipse.etrice.modellib@default:default,org.eclipse.xtext@default:default,org.eclipse.etrice.core.room.ui@default:default,org.eclipse.etrice.ui.structure@default:default,org.eclipse.etrice.generator.tests@default:default,org.eclipse.graphiti.pattern@default:default,org.eclipse.etrice.generator.java@default:default"/>
+<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="false"/>
+<booleanAttribute key="useProduct" value="true"/>
+</launchConfiguration>
diff --git a/tests/org.eclipse.etrice.core.room.tests/src/org/eclipse/etrice/core/CoreTestsActivator.java b/tests/org.eclipse.etrice.core.room.tests/src/org/eclipse/etrice/core/CoreTestsActivator.java
new file mode 100644
index 000000000..92a9bea90
--- /dev/null
+++ b/tests/org.eclipse.etrice.core.room.tests/src/org/eclipse/etrice/core/CoreTestsActivator.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2011 protos software gmbh (http://www.protos.de).
+ * 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:
+ * Henrik Rentz-Reichert (initial contribution)
+ *
+ *******************************************************************************/
+
+package org.eclipse.etrice.core;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.emf.ecore.util.Diagnostician;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+import com.google.inject.Inject;
+import com.google.inject.Injector;
+
+
+public class CoreTestsActivator extends Plugin implements BundleActivator {
+
+ private static CoreTestsActivator instance = null;
+
+ @Inject
+ private Diagnostician diagnostician;
+
+ public static CoreTestsActivator getInstance() {
+ return instance;
+ }
+
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+
+ instance = this;
+
+ Injector injector = RoomStandaloneSetup.doSetup();
+ injector.injectMembers(this);
+ }
+
+ public Diagnostician getDiagnostician() {
+ return diagnostician;
+ }
+}
diff --git a/tests/org.eclipse.etrice.core.room.tests/src/org/eclipse/etrice/core/TestBase.java b/tests/org.eclipse.etrice.core.room.tests/src/org/eclipse/etrice/core/TestBase.java
new file mode 100644
index 000000000..0f05efbad
--- /dev/null
+++ b/tests/org.eclipse.etrice.core.room.tests/src/org/eclipse/etrice/core/TestBase.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2011 protos software gmbh (http://www.protos.de).
+ * 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:
+ * Henrik Rentz-Reichert (initial contribution)
+ *
+ *******************************************************************************/
+
+package org.eclipse.etrice.core;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.Map;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.emf.common.util.Diagnostic;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EValidator;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.xtext.resource.XtextResource;
+import org.eclipse.xtext.resource.XtextResourceSet;
+import org.eclipse.xtext.util.CancelIndicator;
+import org.eclipse.xtext.validation.CancelableDiagnostician;
+import org.eclipse.xtext.validation.CheckMode;
+import org.eclipse.xtext.validation.impl.ConcreteSyntaxEValidator;
+
+import com.google.common.collect.Maps;
+
+/**
+ * Base class for tests helps with getting diagnostics from a model.
+ *
+ * @author Henrik Rentz-Reichert initial contribution and API
+ *
+ */
+public class TestBase {
+
+ private String basePath;
+
+ protected void prepare() {
+ try {
+ URL modelsDir = CoreTestsActivator.getInstance().getBundle().getEntry("models");
+ URL fileURL = FileLocator.toFileURL(modelsDir);
+ basePath = fileURL.getFile();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ protected Resource getResource(String modelName) {
+ XtextResourceSet rs = new XtextResourceSet();
+ rs.addLoadOption(XtextResource.OPTION_RESOLVE_ALL, Boolean.TRUE);
+ String path = basePath + modelName;
+ URI uri = URI.createFileURI(path);
+ return rs.getResource(uri, true);
+ }
+
+ public Diagnostic getDiag(EObject ele) {
+ Map<Object, Object> options = Maps.newHashMap();
+ options.put(CheckMode.KEY, CheckMode.ALL);
+ options.put(CancelableDiagnostician.CANCEL_INDICATOR, new CancelIndicator.NullImpl());
+ // disable concrete syntax validation, since a semantic model that has been parsed
+ // from the concrete syntax always complies with it - otherwise there are parse errors.
+ options.put(ConcreteSyntaxEValidator.DISABLE_CONCRETE_SYNTAX_EVALIDATOR, Boolean.TRUE);
+ // see EObjectValidator.getRootEValidator(Map<Object, Object>)
+ options.put(EValidator.class, CoreTestsActivator.getInstance().getDiagnostician());
+ return CoreTestsActivator.getInstance().getDiagnostician().validate(ele, options);
+ }
+}
diff --git a/tests/org.eclipse.etrice.core.room.tests/src/org/eclipse/etrice/core/TestCases.java b/tests/org.eclipse.etrice.core.room.tests/src/org/eclipse/etrice/core/TestCases.java
new file mode 100644
index 000000000..a16c22f0c
--- /dev/null
+++ b/tests/org.eclipse.etrice.core.room.tests/src/org/eclipse/etrice/core/TestCases.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2011 protos software gmbh (http://www.protos.de).
+ * 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
+ *******************************************************************************/
+
+package org.eclipse.etrice.core;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.HashMap;
+
+import org.eclipse.emf.common.util.Diagnostic;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Example test to illustrate validation unit tests.
+ *
+ * @author Henrik Rentz-Reichert initial contribution and API
+ *
+ */
+public class TestCases extends TestBase {
+
+ /**
+ *
+ */
+ private static final String MSG1 = "connected sub component ports must be conjugated to each other";
+ private Resource resource;
+
+ @Before
+ public void setUp() {
+ prepare();
+
+ resource = getResource("test.room");
+ }
+
+ @Test
+ public void testSomething() {
+ Diagnostic diag = getDiag(resource.getContents().get(0));
+ HashMap<String, Diagnostic> msg2diag = getMappedDiagnostics(diag);
+ assertEquals("number of problems", 1, msg2diag.size());
+ assertNotNull(MSG1, msg2diag.get(MSG1));
+ }
+
+ /**
+ * @param diag
+ * @return
+ */
+ private HashMap<String, Diagnostic> getMappedDiagnostics(Diagnostic diag) {
+ HashMap<String, Diagnostic> msg2diag = new HashMap<String, Diagnostic>();
+ recursivlyCollectErrors(diag, msg2diag);
+ return msg2diag;
+ }
+
+ /**
+ * @param diag
+ * @param msg2diag
+ */
+ private void recursivlyCollectErrors(Diagnostic diag, HashMap<String, Diagnostic> msg2diag) {
+ for (Diagnostic d : diag.getChildren()) {
+ if ((d.getSeverity() & Diagnostic.ERROR) != 0) {
+ msg2diag.put(d.getMessage(), d);
+ }
+ }
+ for (Diagnostic d : diag.getChildren()) {
+ if (!d.getChildren().isEmpty())
+ recursivlyCollectErrors(d, msg2diag);
+ }
+ }
+}

Back to the top