Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorHenrik Rentz-Reichert2011-02-11 03:03:48 -0500
committerHenrik Rentz-Reichert2011-02-11 03:03:48 -0500
commitbb38c965a800aebb95bd61c22897f22a1523888a (patch)
treea70b23c1a14c92b462319db2f3f9860602085f87 /tests
parent0b36b81d6de2487730925bc4bb459ae1d807b74b (diff)
downloadorg.eclipse.etrice-bb38c965a800aebb95bd61c22897f22a1523888a.tar.gz
org.eclipse.etrice-bb38c965a800aebb95bd61c22897f22a1523888a.tar.xz
org.eclipse.etrice-bb38c965a800aebb95bd61c22897f22a1523888a.zip
created new ui.tests.base
Diffstat (limited to 'tests')
-rw-r--r--tests/org.eclipse.etrice.tests.base/src/org/eclipse/etrice/tests/base/TestBase.java (renamed from tests/org.eclipse.etrice.ui.structure.tests/src/org/eclipse/etrice/ui/structure/commands/TestBase.java)154
-rw-r--r--tests/org.eclipse.etrice.ui.behavior.tests/META-INF/MANIFEST.MF17
-rw-r--r--tests/org.eclipse.etrice.ui.behavior.tests/bin/org/eclipse/etrice/ui/behavior/BehaviorActivator.classbin0 -> 964 bytes
-rw-r--r--tests/org.eclipse.etrice.ui.behavior.tests/build.properties4
-rw-r--r--tests/org.eclipse.etrice.ui.behavior.tests/models/FlatStateMachine.room67
-rw-r--r--tests/org.eclipse.etrice.ui.behavior.tests/org.eclipse.etrice.ui.behavior.tests.launch47
-rw-r--r--tests/org.eclipse.etrice.ui.behavior.tests/src/org/eclipse/etrice/ui/behavior/BehaviorActivator.java50
-rw-r--r--tests/org.eclipse.etrice.ui.behavior.tests/src/org/eclipse/etrice/ui/behavior/BehaviorTestActivator.java50
-rw-r--r--tests/org.eclipse.etrice.ui.behavior.tests/src/org/eclipse/etrice/ui/behavior/commands/TestFlatStateMachine.java93
-rw-r--r--tests/org.eclipse.etrice.ui.behavior.tests/src/org/eclipse/etrice/ui/behavior/commands/TestStateMachineBase.java151
-rw-r--r--tests/org.eclipse.etrice.ui.tests.base/.classpath7
-rw-r--r--tests/org.eclipse.etrice.ui.tests.base/.project28
-rw-r--r--tests/org.eclipse.etrice.ui.tests.base/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--tests/org.eclipse.etrice.ui.tests.base/META-INF/MANIFEST.MF14
-rw-r--r--tests/org.eclipse.etrice.ui.tests.base/bin/org/eclipse/etrice/tests/base/TestBase.classbin0 -> 3899 bytes
-rw-r--r--tests/org.eclipse.etrice.ui.tests.base/build.properties4
-rw-r--r--tests/org.eclipse.etrice.ui.tests.base/src/org/eclipse/etrice/tests/base/TestBase.java89
17 files changed, 706 insertions, 77 deletions
diff --git a/tests/org.eclipse.etrice.ui.structure.tests/src/org/eclipse/etrice/ui/structure/commands/TestBase.java b/tests/org.eclipse.etrice.tests.base/src/org/eclipse/etrice/tests/base/TestBase.java
index 57ef7e0fa..04ed1b596 100644
--- a/tests/org.eclipse.etrice.ui.structure.tests/src/org/eclipse/etrice/ui/structure/commands/TestBase.java
+++ b/tests/org.eclipse.etrice.tests.base/src/org/eclipse/etrice/tests/base/TestBase.java
@@ -1,77 +1,77 @@
-/*******************************************************************************
- * Copyright (c) 2010 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:
- * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution)
- *
- *******************************************************************************/
-
-package org.eclipse.etrice.ui.structure.commands;
-
-import static org.junit.Assert.fail;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URL;
-import java.util.LinkedList;
-
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.etrice.core.room.RoomModel;
-import org.eclipse.etrice.ui.structure.StructureTestActivator;
-import org.eclipse.xtext.resource.XtextResource;
-import org.eclipse.xtext.resource.XtextResourceSet;
-
-public abstract class TestBase {
-
- private String basePath;
- private LinkedList<RoomModel> models = new LinkedList<RoomModel>();
-
- protected void loadModelFile() {
- try {
- URL modelsDir = StructureTestActivator.getInstance().getBundle().getEntry("models");
- URL fileURL = FileLocator.toFileURL(modelsDir);
- basePath = fileURL.getFile();
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- loadModels(getModelFileName());
- }
-
- protected void removeDiagramsDirectory() {
- File diagDir = new File(basePath+File.separator+"diagrams");
- if (diagDir.isDirectory()) {
- File[] files = diagDir.listFiles();
- if (files!=null)
- for (int i = 0; i < files.length; i++) {
- files[i].delete();
- }
- diagDir.delete();
- }
- }
-
- private void loadModels(String modelName) {
- XtextResourceSet rs = new XtextResourceSet();
- rs.addLoadOption(XtextResource.OPTION_RESOLVE_ALL, Boolean.TRUE);
- String path = basePath + modelName;
- URI uri = URI.createFileURI(path);
- Resource resource = rs.getResource(uri, true);
- Object root = resource.getContents().get(0);
- if (root instanceof RoomModel)
- models.add((RoomModel) root);
- else
- fail("File contains no RoomModel as root object");
- }
-
- public LinkedList<RoomModel> getModels() {
- return models;
- }
-
- protected abstract String getModelFileName();
-}
+/*******************************************************************************
+ * Copyright (c) 2010 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:
+ * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution)
+ *
+ *******************************************************************************/
+
+package org.eclipse.etrice.tests.base;
+
+import static org.junit.Assert.fail;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.util.LinkedList;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.etrice.core.room.RoomModel;
+import org.eclipse.xtext.resource.XtextResource;
+import org.eclipse.xtext.resource.XtextResourceSet;
+
+public abstract class TestBase {
+
+ private String basePath;
+ private LinkedList<RoomModel> models = new LinkedList<RoomModel>();
+
+ protected void loadModelFile() {
+ try {
+ URL modelsDir = getModelsDirectoy();
+ URL fileURL = FileLocator.toFileURL(modelsDir);
+ basePath = fileURL.getFile();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ loadModels(getModelFileName());
+ }
+
+ protected void removeDiagramsDirectory() {
+ File diagDir = new File(basePath+File.separator+"diagrams");
+ if (diagDir.isDirectory()) {
+ File[] files = diagDir.listFiles();
+ if (files!=null)
+ for (int i = 0; i < files.length; i++) {
+ files[i].delete();
+ }
+ diagDir.delete();
+ }
+ }
+
+ private void loadModels(String modelName) {
+ XtextResourceSet rs = new XtextResourceSet();
+ rs.addLoadOption(XtextResource.OPTION_RESOLVE_ALL, Boolean.TRUE);
+ String path = basePath + modelName;
+ URI uri = URI.createFileURI(path);
+ Resource resource = rs.getResource(uri, true);
+ Object root = resource.getContents().get(0);
+ if (root instanceof RoomModel)
+ models.add((RoomModel) root);
+ else
+ fail("File contains no RoomModel as root object");
+ }
+
+ public LinkedList<RoomModel> getModels() {
+ return models;
+ }
+
+ protected abstract String getModelFileName();
+ protected abstract URL getModelsDirectoy();
+}
diff --git a/tests/org.eclipse.etrice.ui.behavior.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.etrice.ui.behavior.tests/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..8ff672976
--- /dev/null
+++ b/tests/org.eclipse.etrice.ui.behavior.tests/META-INF/MANIFEST.MF
@@ -0,0 +1,17 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: eTrice Behavior Diagram Tests
+Bundle-SymbolicName: org.eclipse.etrice.ui.behavior.tests
+Bundle-Version: 0.1.0
+Bundle-Activator: org.eclipse.etrice.ui.behavior.BehaviorActivator
+Bundle-Vendor: eTrice (Incubation)
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.junit;bundle-version="4.8.1",
+ org.eclipse.etrice.core.room;bundle-version="0.1.0",
+ org.eclipse.etrice.ui.behavior;bundle-version="0.1.0",
+ org.eclipse.xtext;bundle-version="1.0.1",
+ org.eclipse.graphiti;bundle-version="0.7.0",
+ org.eclipse.etrice.ui.common;bundle-version="0.1.0"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy
diff --git a/tests/org.eclipse.etrice.ui.behavior.tests/bin/org/eclipse/etrice/ui/behavior/BehaviorActivator.class b/tests/org.eclipse.etrice.ui.behavior.tests/bin/org/eclipse/etrice/ui/behavior/BehaviorActivator.class
new file mode 100644
index 000000000..17a8733da
--- /dev/null
+++ b/tests/org.eclipse.etrice.ui.behavior.tests/bin/org/eclipse/etrice/ui/behavior/BehaviorActivator.class
Binary files differ
diff --git a/tests/org.eclipse.etrice.ui.behavior.tests/build.properties b/tests/org.eclipse.etrice.ui.behavior.tests/build.properties
new file mode 100644
index 000000000..34d2e4d2d
--- /dev/null
+++ b/tests/org.eclipse.etrice.ui.behavior.tests/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/tests/org.eclipse.etrice.ui.behavior.tests/models/FlatStateMachine.room b/tests/org.eclipse.etrice.ui.behavior.tests/models/FlatStateMachine.room
new file mode 100644
index 000000000..f76f61e7c
--- /dev/null
+++ b/tests/org.eclipse.etrice.ui.behavior.tests/models/FlatStateMachine.room
@@ -0,0 +1,67 @@
+RoomModel ActorClassWithPorts {
+ ActorClass MyActorClass {
+ Interface {
+ Port ip : MyProtocol
+ Port xp : MyProtocol
+ }
+ Structure {
+ external Port xp
+ conjugated Port sp : MyProtocol
+ }
+ Behavior {
+ StateMachine {
+ Transition init: initial -> state1 {
+ action {
+ "//initial"
+ }
+ }
+ Transition tr0: my tp -> my tp {
+ triggers {
+ <in2: xp>
+ }
+ }
+ Transition tr1: state1 -> cp cp0 {
+ triggers {
+ <out1: sp>
+ }
+ }
+ Transition tr2: cp cp0 -> elseState {
+ }
+ Transition tr3: cp cp0 -> ifState {
+ cond {
+ "true"
+ }
+ }
+ Transition tr4: state1 -> ifState {
+ triggers {
+ <in1: xp>
+ }
+ }
+ ChoicePoint cp0
+ TransitionPoint tp
+ State state1 {
+ entry {
+ "//entry"
+ }
+ exit {
+ "//exit"
+ }
+ }
+ State elseState {
+ }
+ State ifState {
+ }
+ }
+ }
+ }
+
+ ProtocolClass MyProtocol {
+ incoming {
+ Message in1 ()
+ Message in2 ()
+ }
+ outgoing {
+ Message out1 ()
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/org.eclipse.etrice.ui.behavior.tests/org.eclipse.etrice.ui.behavior.tests.launch b/tests/org.eclipse.etrice.ui.behavior.tests/org.eclipse.etrice.ui.behavior.tests.launch
new file mode 100644
index 000000000..e8c0fde13
--- /dev/null
+++ b/tests/org.eclipse.etrice.ui.behavior.tests/org.eclipse.etrice.ui.behavior.tests.launch
@@ -0,0 +1,47 @@
+<?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="bad_container_name" value="\org.eclipse.etrice.ui..tests"/>
+<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.graphiti.pattern,org.eclipse.etrice.integration.tests,org.eclipse.etrice.ui.structure.tests,de.protos.automation.demos.fischertechnik,org.eclipse.etrice.generator.tests,org.eclipse.etrice.example.hrr,org.eclipse.graphiti.examples.tutorial,org.eclipse.etrice.modellib,generator.cartridge.UmlConnector,org.eclipse.graphiti.examples.common,org.eclipse.etrice.example,org.eclipse.etrice.generator.java"/>
+<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.ui.behavior.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.ui.behavior.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.ui.behavior.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.xtend.typesystem.emf.ui@default:default,org.eclipse.sdk@default:default,org.eclipse.xtext.doc@default:default,org.eclipse.swt.win32.win32.x86@default:false,org.eclipse.xtext.logging@default:false,org.eclipse.emf.mapping.ecore2ecore.editor@default:default,org.eclipse.emf.transaction.ui@default:default,org.eclipse.equinox.frameworkadmin.equinox@default:default,org.eclipse.xtext@default:default,org.eclipse.jdt.ui@default:default,org.eclipse.ant.launching@default:default,org.eclipse.ui.forms*3.5.2.r36_v20100702@default:default,org.eclipse.ui.ide.application@default:default,org.junit4@default:default,com.google.inject@default:default,org.eclipse.core.filesystem.win32.x86@default:false,org.eclipse.update.scheduler@default:default,org.apache.log4j@default:default,org.eclipse.uml2.common@default:default,org.eclipse.emf.ecore.xmi@default:default,org.eclipse.emf.mwe2.language@default:default,org.eclipse.pde.ui.templates@default:default,org.eclipse.ui.presentations.r21@default:default,org.apache.commons.logging*1.1.1.v201005080502@default:default,org.eclipse.core.resources.win32.x86@default:false,org.eclipse.xtext.ui.ecore@default:default,org.eclipse.equinox.p2.ui.sdk@default:default,org.eclipse.core.runtime.compatibility.registry@default:false,org.eclipse.equinox.security.win32.x86@default:false,org.eclipse.xtend.ui@default:default,org.eclipse.ecf.provider.filetransfer@default:default,org.eclipse.emf.mwe.utils@default:default,org.apache.commons.codec@default:default,org.eclipse.emf.ecore*2.6.1.v20100914-1218@default:default,org.apache.lucene.analysis@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.help.webapp@default:default,org.eclipse.xsd.doc@default:default,org.aopalliance@default:default,org.eclipse.emf.mapping.ecore.editor@default:default,org.eclipse.team.ui@default:default,org.eclipse.xtext.ecore@default:default,org.eclipse.equinox.launcher.win32.win32.x86@default:false,org.eclipse.draw2d.doc.isv@default:default,org.eclipse.equinox.simpleconfigurator@1:true,org.eclipse.emf.doc@default:default,org.antlr.runtime@default:default,org.eclipse.xsd@default:default,org.eclipse.emf.transaction.doc@default:default,org.eclipse.xtend.shared.ui@default:default,org.eclipse.equinox.p2.repository.tools@default:default,org.eclipse.equinox.p2.ui.discovery@default:default,org.eclipse.core.expressions@default:default,org.eclipse.emf.ecore.editor@default:default,org.eclipse.jdt.launching@default:default,org.eclipse.ui.views.log@default:default,org.eclipse.team.svn.help@default:default,org.eclipse.equinox.p2.ui@default:default,org.eclipse.equinox.frameworkadmin@default:default,org.eclipse.pde.build@default:default,org.eclipse.emf.mwe.ui@default:default,org.apache.jasper@default:default,org.eclipse.xtext.common.types.ui@default:default,org.eclipse.emf.example.installer@default:default,org.eclipse.jdt.debug.ui@default:default,org.eclipse.text@default:default,org.eclipse.xsd.ecore.exporter@default:default,org.eclipse.team.cvs.ui@default:default,org.eclipse.ui*3.6.1.M20100826-1330@default:default,org.eclipse.equinox.registry@default:default,com.ibm.icu@default:default,org.eclipse.xtend.typesystem.xsd.ui@default:default,org.apache.lucene@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.emf.java.editor@default:default,org.eclipse.core.commands@default:default,org.eclipse.xtext.util@default:default,org.eclipse.jdt.junit@default:default,org.eclipse.emf.importer.ecore@default:default,org.eclipse.xtend.typesystem.emf@default:default,org.eclipse.swt*3.6.1.v3655c@default:default,org.eclipse.jdt.junit.core@default:default,org.eclipse.update.configurator@3:true,org.eclipse.emf.compare.diff.edit@default:default,org.mortbay.jetty.server@default:default,org.eclipse.platform.doc.isv@default:default,org.eclipse.ui.editors@default:default,org.eclipse.xtext.xbase.ui@default:default,org.eclipse.emf.workspace.ui@default:default,org.junit*4.8.1.v4_8_1_v20100427-1100@default:default,org.junit*3.8.2.v3_8_2_v20100427-1100@default:default,org.eclipse.emf.edit*2.6.0.v20100914-1218@default:default,org.eclipse.xsd.mapping@default:default,org.polarion.eclipse.team.svn.connector.javahl16@default:default,org.eclipse.emf.mwe.activities@default:default,org.eclipse.team.cvs.core@default:default,org.eclipse.emf.examples@default:default,org.apache.commons.el@default:default,org.eclipse.ui.win32@default:false,org.eclipse.graphiti.examples.tutorial@default:default,org.eclipse.equinox.p2.touchpoint.natives@default:default,org.eclipse.jdt.compiler.tool@default:false,org.eclipse.equinox.p2.discovery.compatibility@default:default,org.eclipse.emf.codegen.ecore.ui@default:default,org.eclipse.emf.java@default:default,org.eclipse.emf.exporter.html@default:default,org.eclipse.ecf@default:default,org.sat4j.core@default:default,org.eclipse.xtext.ui@default:default,org.eclipse.emf.importer.java@default:default,org.eclipse.xtend.check.ui@default:default,org.eclipse.xpand.ui@default:default,org.eclipse.uml2.uml.resources@default:default,org.eclipse.emf.examples.generator.validator@default:default,org.eclipse.pde.runtime@default:default,org.eclipse.emf.common.ui*2.6.0.v20100914-1218@default:default,org.eclipse.equinox.common@2:true,org.eclipse.xpand.doc@default:default,org.eclipse.emf.workspace@default:default,org.eclipse.pde.ui@default:default,org.eclipse.emf.mapping.ecore2ecore@default:default,org.hamcrest.core@default:default,org.objectweb.asm@default:default,org.eclipse.pde.ua.core@default:default,org.eclipse.gef@default:default,org.eclipse.emf.converter@default:default,org.eclipse.equinox.simpleconfigurator.manipulator@default:default,org.eclipse.ant.ui@default:default,org.eclipse.team.core@default:default,org.eclipse.emf.mapping.xsd2ecore@default:default,org.eclipse.emf.mwe2.launch@default:default,org.eclipse.emf.edit.ui*2.6.0.v20100914-1218@default:default,org.eclipse.compare.core@default:default,org.eclipse.core.filebuffers@default:default,org.eclipse.xpand.incremental@default:default,org.eclipse.pde.api.tools@default:default,org.eclipse.equinox.p2.publisher@default:default,org.eclipse.uml2.codegen.ecore@default:default,org.eclipse.emf.ecore.edit*2.6.0.v20100914-1218@default:default,org.eclipse.equinox.p2.metadata@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.equinox.p2.extensionlocation@default:default,org.eclipse.equinox.ds@default:true,org.eclipse.equinox.p2.repository*2.0.1.R36x_v20100823@default:default,org.eclipse.emf.mapping.ecore2xml@default:default,org.eclipse.xtext.activities@default:default,org.eclipse.ltk.ui.refactoring@default:default,org.eclipse.jdt.core@default:default,org.eclipse.ui.net@default:default,org.eclipse.emf.activities@default:default,org.eclipse.equinox.security.ui@default:default,org.eclipse.equinox.p2.updatechecker@default:default,org.eclipse.xtext.common.types@default:default,org.eclipse.emf.transaction.examples@default:default,org.eclipse.emf.mwe.doc@default:default,org.eclipse.equinox.p2.touchpoint.eclipse@default:default,org.eclipse.graphiti.ui@default:default,org.eclipse.emf.compare.diff@default:default,org.eclipse.emf.mwe2.language.ui@default:default,org.eclipse.pde@default:default,org.eclipse.pde.ua.ui@default:default,org.eclipse.uml2.uml.ecore.importer@default:default,org.eclipse.search@default:default,org.eclipse.xpand.activities@default:default,org.eclipse.emf.compare@default:default,org.eclipse.team.cvs.ssh2@default:default,org.eclipse.jdt.junit.runtime@default:default,org.apache.commons.httpclient@default:default,org.eclipse.core.databinding@default:default,org.eclipse.emf.ant@default:default,org.eclipse.osgi.util@default:default,org.eclipse.ant.core@default:default,org.eclipse.xtext.xbase@default:default,org.eclipse.xsd.example.installer@default:default,org.eclipse.emf.ecore.change*2.5.1.v20100907-1643@default:default,org.eclipse.ecf.provider.filetransfer.ssl@default:false,org.sat4j.pb@default:default,org.eclipse.debug.core@default:default,org.eclipse.xtend.typesystem.uml2@default:default,org.eclipse.xsd.editor@default:default,org.eclipse.compare@default:default,org.eclipse.platform@default:default,org.eclipse.emf.common*2.6.0.v20100914-1218@default:default,org.eclipse.emf.mwe.ui.simpleEditor@default:default,org.eclipse.ui.ide*3.6.1.M20100825-0800@default:default,org.apache.ant@default:default,org.eclipse.xtext.xtext.ui.examples@default:default,org.eclipse.jsch.ui@default:default,org.eclipse.help.base@default:default,org.eclipse.emf.compare.ui@default:default,org.polarion.eclipse.team.svn.connector@default:default,org.eclipse.pde.core@default:default,com.jcraft.jsch@default:default,org.eclipse.uml2.uml@default:default,org.eclipse.graphiti.pattern@default:default,org.eclipse.emf.codegen.ecore@default:default,org.eclipse.ui.views@default:default,org.eclipse.core.boot@default:default,org.eclipse.emf.mwe.core@default:default,org.eclipse.equinox.servletbridge.extensionbundle@default:false,org.eclipse.emf.compare.doc@default:default,org.eclipse.ecf.ssl@default:false,org.eclipse.emf.workspace.doc@default:default,org.eclipse.equinox.p2.updatesite@default:default,org.eclipse.emf.codegen@default:default,org.eclipse.pde.ds.core@default:default,org.eclipse.emf.importer@default:default,org.eclipse.emf.compare.epatch@default:default,org.eclipse.equinox.preferences@default:default,com.google.collect@default:default,org.eclipse.equinox.http.jetty@default:default,org.eclipse.ui.browser@default:default,org.eclipse.xsd.cheatsheets@default:default,org.eclipse.equinox.event@default:default,org.eclipse.update.core@default:default,org.eclipse.equinox.app*1.3.1.R36x_v20100803@default:default,org.eclipse.jface*3.6.1.M20100825-0800@default:default,org.eclipse.jface.databinding@default:default,org.eclipse.core.runtime.compatibility@default:default,org.eclipse.ui.forms*3.5.0.v20100427@default:default,org.eclipse.graphiti.mm@default:default,org.eclipse.equinox.jsp.jasper@default:default,de.itemis.xtext.antlr@default:default,org.eclipse.equinox.p2.directorywatcher@default:default,org.eclipse.emf.java.edit@default:default,org.eclipse.core.externaltools@default:default,org.eclipse.graphiti.examples.common@default:default,org.eclipse.team.svn.ui@default:default,org.eclipse.epp.mpc.help.ui@default:default,org.eclipse.core.runtime@default:true,org.eclipse.pde.api.tools.ui@default:default,org.eclipse.core.filesystem*1.3.1.R36x_v20100727-0745@default:default,org.eclipse.ecf.filetransfer@default:default,org.eclipse.emf.mwe2.runtime@default:default,org.eclipse.xtext.xtend@default:default,org.eclipse.equinox.jsp.jasper.registry@default:default,org.eclipse.equinox.http.servlet@default:default,org.eclipse.core.databinding.beans@default:default,org.eclipse.team.svn.core@default:default,org.eclipse.team.svn@default:default,org.eclipse.emf.mapping.ecore@default:default,org.eclipse.graphiti.doc@default:default,org.eclipse.xtend.profiler@default:default,org.eclipse.equinox.p2.reconciler.dropins@default:default,org.eclipse.emf.compare.match@default:default,org.eclipse.debug.ui@default:default,org.eclipse.equinox.p2.metadata.repository@default:default,org.eclipse.equinox.p2.console@default:default,org.eclipse.emf.exporter@default:default,org.eclipse.core.resources@default:default,org.eclipse.ltk.core.refactoring@default:default,org.eclipse.core.net.win32.x86@default:false,org.eclipse.equinox.util@default:default,org.eclipse.ui.console@default:default,org.eclipse.pde.ds.ui@default:default,org.eclipse.ui.views.properties.tabbed@default:default,org.eclipse.jface.text*3.6.1.r361_v20100825-0800@default:default,org.eclipse.equinox.p2.jarprocessor@default:default,org.eclipse.equinox.p2.ui.sdk.scheduler@default:default,org.eclipse.graphiti@default:default,org.eclipse.pde.junit.runtime@default:default,org.eclipse.help@default:default,org.eclipse.cvs@default:default,org.eclipse.core.variables@default:default,org.eclipse.emf.databinding@default:default,org.eclipse.emf.ecore.change.edit@default:default,org.eclipse.equinox.p2.garbagecollector@default:default,org.eclipse.xpand@default:default,org.eclipse.core.jobs*3.5.1.R36x_v20100824@default:default,org.antlr.gen@default:default,org.eclipse.emf.mapping@default:default,javax.servlet.jsp@default:default,org.eclipse.jdt.debug@default:default,org.eclipse.jdt.compiler.apt@default:false,org.apache.commons.cli@default:default,org.eclipse.xsd.ecore.converter@default:default,org.eclipse.equinox.p2.metadata.generator@default:default,org.eclipse.xtend.typesystem.uml2.ui@default:default,org.eclipse.core.net@default:default,org.eclipse.jface.text*3.6.0.v20100526-0800@default:default,org.eclipse.emf.databinding.edit@default:default,org.eclipse.emf.examples.library.edit@default:default,org.eclipse.ecf.identity@default:default,org.eclipse.emf.mapping.xsd2ecore.editor@default:default,org.eclipse.pde.launching@default:default,org.eclipse.gef.examples.ui.pde@default:default,org.eclipse.xtend.typesystem.xsd@default:default,org.apache.commons.logging*1.0.4.v201005080501@default:default,org.eclipse.compare.win32@default:default,org.eclipse.equinox.p2.director@default:default,org.eclipse.osgi.services@default:default,org.eclipse.emf.transaction@default:default,org.eclipse.ui.intro@default:default,org.eclipse.xtend.util.stdlib@default:default,org.eclipse.rcp@default:default,org.eclipse.ui.navigator@default:default,org.eclipse.ui.workbench.texteditor@default:default,org.eclipse.equinox.p2.core*2.0.2.R36x_v20100804@default:default,org.eclipse.emf@default:default,org.eclipse.emf.examples.library.editor@default:default,org.eclipse.equinox.p2.ql@default:default,org.eclipse.xtext.junit@default:default,org.eclipse.jsch.core@default:default,org.eclipse.xtext.ui.junit@default:default,org.eclipse.update.ui@default:default,org.eclipse.equinox.p2.operations@default:default,org.eclipse.xsd.ecore.importer@default:default,org.mortbay.jetty.util@default:default,org.eclipse.emf.codegen.ui@default:default,org.eclipse.ui.navigator.resources@default:default,org.eclipse.draw2d@default:default,org.eclipse.update.core.win32@default:false,org.eclipse.epp.mpc.ui@default:default,javax.servlet@default:default,org.polarion.eclipse.team.svn.connector.svnkit16@default:default,org.eclipse.epp.mpc.core@default:default,org.eclipse.ui.intro.universal@default:default,org.eclipse.emf.examples.library@default:default,org.eclipse.emf.importer.rose@default:default,org.eclipse.pde.doc.user@default:default,org.eclipse.equinox.p2.artifact.repository@default:default,org.eclipse.xpand.examples@default:default,org.eclipse.equinox.concurrent@default:default,org.eclipse.ui.cheatsheets@default:default,org.eclipse.xtext.xtext.ui@default:default,org.eclipse.equinox.p2.director.app@default:default,org.eclipse.jdt.core.manipulation@default:default,org.eclipse.xsd.edit@default:default,org.eclipse.emf.mapping.ecore2xml.ui@default:default,org.eclipse.emf.validation@default:default,org.eclipse.ui.workbench*3.6.1.M20100826-1330@default:default,org.apache.commons.lang@default:default,org.eclipse.emf.generic.editor@default:default,org.eclipse.xtend@default:default,org.eclipse.equinox.p2.discovery@default:default,org.eclipse.help.ui@default:default,org.eclipse.xsd.example@default:default,org.eclipse.help.appserver@default:default,org.eclipse.jface*3.6.0.I20100601-0800@default:default,org.eclipse.emf.cheatsheets@default:default,org.eclipse.core.runtime.compatibility.auth@default:default,org.eclipse.ui.externaltools@default:default,org.eclipse.ui.workbench.compatibility@default:false,org.eclipse.emf.mapping.ui@default:default,org.eclipse.equinox.http.registry@default:default,org.eclipse.xtext.generator@default:default,org.eclipse.xtext.ui.shared@default:default,org.eclipse.equinox.launcher@default:default,org.eclipse.xsd.mapping.editor@default:default,org.eclipse.gef.doc.isv@default:default,org.eclipse.platform.doc.user@default:default,org.eclipse.equinox.security@default:default,org.eclipse.osgi*3.6.1.R36x_v20100806@-1:true,org.eclipse.xtext.builder@default:default,org.eclipse.equinox.p2.engine@default:default"/>
+<stringAttribute key="selected_workspace_plugins" value="org.eclipse.etrice.generator@default:default,org.eclipse.etrice.core.room@default:default,org.eclipse.etrice.ui.behavior@default:default,org.eclipse.etrice.ui.behavior.tests@default:default,org.eclipse.etrice.tests.base*0.1.0@default:default,org.eclipse.graphiti.mm@default:default,org.eclipse.graphiti.ui@default:default,org.eclipse.graphiti@default:default,org.eclipse.etrice.ui.structure@default:default,org.eclipse.xtext@default:default,org.eclipse.etrice.ui.common@default:default,org.eclipse.etrice.core.room.ui@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.ui.behavior.tests/src/org/eclipse/etrice/ui/behavior/BehaviorActivator.java b/tests/org.eclipse.etrice.ui.behavior.tests/src/org/eclipse/etrice/ui/behavior/BehaviorActivator.java
new file mode 100644
index 000000000..3ce9ca9ac
--- /dev/null
+++ b/tests/org.eclipse.etrice.ui.behavior.tests/src/org/eclipse/etrice/ui/behavior/BehaviorActivator.java
@@ -0,0 +1,50 @@
+package org.eclipse.etrice.ui.behavior;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class BehaviorActivator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.etrice.ui.behavior.tests"; //$NON-NLS-1$
+
+ // The shared instance
+ private static BehaviorActivator plugin;
+
+ /**
+ * The constructor
+ */
+ public BehaviorActivator() {
+ }
+
+ /*
+ * (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 BehaviorActivator getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/tests/org.eclipse.etrice.ui.behavior.tests/src/org/eclipse/etrice/ui/behavior/BehaviorTestActivator.java b/tests/org.eclipse.etrice.ui.behavior.tests/src/org/eclipse/etrice/ui/behavior/BehaviorTestActivator.java
new file mode 100644
index 000000000..021561a69
--- /dev/null
+++ b/tests/org.eclipse.etrice.ui.behavior.tests/src/org/eclipse/etrice/ui/behavior/BehaviorTestActivator.java
@@ -0,0 +1,50 @@
+package org.eclipse.etrice.ui.behavior;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class BehaviorTestActivator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.etrice.ui.behavior.tests"; //$NON-NLS-1$
+
+ // The shared instance
+ private static BehaviorTestActivator plugin;
+
+ /**
+ * The constructor
+ */
+ public BehaviorTestActivator() {
+ }
+
+ /*
+ * (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 BehaviorTestActivator getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/tests/org.eclipse.etrice.ui.behavior.tests/src/org/eclipse/etrice/ui/behavior/commands/TestFlatStateMachine.java b/tests/org.eclipse.etrice.ui.behavior.tests/src/org/eclipse/etrice/ui/behavior/commands/TestFlatStateMachine.java
new file mode 100644
index 000000000..0c4f2a66b
--- /dev/null
+++ b/tests/org.eclipse.etrice.ui.behavior.tests/src/org/eclipse/etrice/ui/behavior/commands/TestFlatStateMachine.java
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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:
+ * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution)
+ *
+ *******************************************************************************/
+
+package org.eclipse.etrice.ui.behavior.commands;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.net.URL;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.etrice.core.room.ActorClass;
+import org.eclipse.etrice.core.room.StateGraph;
+import org.eclipse.etrice.ui.behavior.BehaviorTestActivator;
+import org.eclipse.etrice.ui.behavior.DiagramAccess;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+import org.eclipse.graphiti.mm.pictograms.Diagram;
+import org.eclipse.graphiti.mm.pictograms.Shape;
+import org.eclipse.graphiti.services.Graphiti;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * test of a flat state machine (defined by FlatStateMachine.room)
+ *
+ * @author Henrik Rentz-Reichert initial contribution and API
+ *
+ */
+public class TestFlatStateMachine extends TestStateMachineBase {
+
+ @Before
+ public void setUp() {
+ loadModelFile();
+ }
+
+ @After
+ public void tearDown() {
+ removeDiagramsDirectory();
+ }
+
+ @Override
+ protected String getModelFileName() {
+ return "FlatStateMachine.room";
+ }
+
+ @Test
+ public void checkModel() {
+ assertEquals("models read", 1, getModels().size());
+ assertEquals("actor classes in our model", 1, getModels().get(0).getActorClasses().size());
+ }
+
+ @Test
+ public void testActorClass() {
+ ActorClass ac = getModels().get(0).getActorClasses().get(0);
+ Diagram diagram = new DiagramAccess().getDiagram(ac);
+
+ assertEquals("diagram children", 1, diagram.getChildren().size());
+
+ Shape shape = diagram.getChildren().get(0);
+ assertTrue("top level shape is container shape", shape instanceof ContainerShape);
+
+ EObject bo = Graphiti.getLinkService().getBusinessObjectForLinkedPictogramElement(shape);
+ assertTrue("top level business object is StateGraph", bo instanceof StateGraph);
+ }
+
+ @Test
+ public void testSGItems() {
+ ActorClass ac = getModels().get(0).getActorClasses().get(0);
+ Diagram diagram = new DiagramAccess().getDiagram(ac);
+
+ Shape shape = diagram.getChildren().get(0);
+ StateGraph sg = (StateGraph) Graphiti.getLinkService().getBusinessObjectForLinkedPictogramElement(shape);
+ testStateGraph(diagram, sg);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.etrice.tests.base.TestBase#getModelsDirectoy()
+ */
+ @Override
+ protected URL getModelsDirectoy() {
+ return BehaviorTestActivator.getDefault().getBundle().getEntry("models");
+ }
+}
diff --git a/tests/org.eclipse.etrice.ui.behavior.tests/src/org/eclipse/etrice/ui/behavior/commands/TestStateMachineBase.java b/tests/org.eclipse.etrice.ui.behavior.tests/src/org/eclipse/etrice/ui/behavior/commands/TestStateMachineBase.java
new file mode 100644
index 000000000..88e473fb5
--- /dev/null
+++ b/tests/org.eclipse.etrice.ui.behavior.tests/src/org/eclipse/etrice/ui/behavior/commands/TestStateMachineBase.java
@@ -0,0 +1,151 @@
+/*******************************************************************************
+ * 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.ui.behavior.commands;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.etrice.core.room.ActorClass;
+import org.eclipse.etrice.core.room.ChoicePoint;
+import org.eclipse.etrice.core.room.InitialTransition;
+import org.eclipse.etrice.core.room.State;
+import org.eclipse.etrice.core.room.StateGraph;
+import org.eclipse.etrice.core.room.StateGraphItem;
+import org.eclipse.etrice.core.room.TrPoint;
+import org.eclipse.etrice.core.room.Transition;
+import org.eclipse.etrice.tests.base.TestBase;
+import org.eclipse.etrice.ui.behavior.support.StateSupport;
+import org.eclipse.etrice.ui.behavior.support.TrPointSupport;
+import org.eclipse.graphiti.mm.algorithms.Ellipse;
+import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm;
+import org.eclipse.graphiti.mm.algorithms.Rectangle;
+import org.eclipse.graphiti.mm.algorithms.RoundedRectangle;
+import org.eclipse.graphiti.mm.pictograms.Diagram;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.graphiti.mm.pictograms.Shape;
+import org.eclipse.graphiti.services.Graphiti;
+
+/**
+ * base class for state machine tests
+ *
+ * @author Henrik Rentz-Reichert - API and initial contribution
+ */
+public abstract class TestStateMachineBase extends TestBase {
+
+ /**
+ * test general conditions for state graphs
+ * @param diagram the diagram
+ * @param sg the state graph to test
+ */
+ protected void testStateGraph(Diagram diagram, StateGraph sg) {
+ EObject bo = Graphiti.getLinkService().getBusinessObjectForLinkedPictogramElement(diagram);
+ assertTrue("diagram bo is actor class", bo instanceof ActorClass);
+
+ ActorClass ac = (ActorClass) bo;
+
+ boolean hasInitialTransition = false;
+ for (Transition trans : sg.getTransitions()) {
+ if (trans instanceof InitialTransition) {
+ hasInitialTransition = true;
+ break;
+ }
+ }
+ List<PictogramElement> elements = Graphiti.getLinkService().getPictogramElements(diagram, sg);
+ assertEquals("PEs for our state graph: sg and initial point", hasInitialTransition? 2:1, elements.size());
+
+ for (State s : sg.getStates()) {
+ elements = Graphiti.getLinkService().getPictogramElements(diagram, s);
+ assertEquals("PEs for our state", 1, elements.size());
+ assertTrue("PE is shape", elements.get(0) instanceof Shape);
+ checkStateGAs(ac, s, (Shape) elements.get(0));
+ }
+
+ for (ChoicePoint cp : sg.getChPoints()) {
+ elements = Graphiti.getLinkService().getPictogramElements(diagram, cp);
+ assertEquals("PEs for our cp", 1, elements.size());
+ assertTrue("PE is shape", elements.get(0) instanceof Shape);
+ }
+
+ for (TrPoint tp : sg.getTrPoints()) {
+ elements = Graphiti.getLinkService().getPictogramElements(diagram, tp);
+ assertEquals("PEs for our tp", 1, elements.size());
+ assertTrue("PE is shape", elements.get(0) instanceof Shape);
+ checkTrpGAs(ac, tp, (Shape) elements.get(0));
+ }
+
+ for (Transition trans : sg.getTransitions()) {
+ elements = Graphiti.getLinkService().getPictogramElements(diagram, trans);
+ assertEquals("PEs for our transition", 1, elements.size());
+ }
+ }
+
+ /**
+ * test general conditions for states
+ *
+ * @param ac actor class
+ * @param s the state to test
+ * @param shape the state's shape
+ */
+ private void checkStateGAs(ActorClass ac, State s, Shape shape) {
+ assertNotNull("ga is there (invisible rectangle)", shape.getGraphicsAlgorithm());
+ assertTrue("ga is rounded rectangle", shape.getGraphicsAlgorithm() instanceof Rectangle);
+ assertFalse("ga is invisible", shape.getGraphicsAlgorithm().getFilled());
+ assertFalse("ga is invisible", shape.getGraphicsAlgorithm().getLineVisible());
+ assertEquals("border rect", 1, shape.getGraphicsAlgorithm().getGraphicsAlgorithmChildren().size());
+ GraphicsAlgorithm borderRect = shape.getGraphicsAlgorithm().getGraphicsAlgorithmChildren().get(0);
+ assertTrue("border rect is rounded rectangle", borderRect instanceof RoundedRectangle);
+ if (isInherited(ac,s))
+ assertTrue("border rect background", isEqual(borderRect.getForeground(), StateSupport.INHERITED_COLOR));
+ else
+ assertTrue("border rect background", isEqual(borderRect.getForeground(), StateSupport.LINE_COLOR));
+ }
+
+ /**
+ * test general conditions for transition points
+ *
+ * @param ac actor class
+ * @param tp the transition point to test
+ * @param shape the state's shape
+ */
+ private void checkTrpGAs(ActorClass ac, TrPoint tp, Shape shape) {
+ assertNotNull("ga is there (invisible rectangle)", shape.getGraphicsAlgorithm());
+ assertTrue("ga is ellipse", shape.getGraphicsAlgorithm() instanceof Rectangle);
+ assertFalse("ga is invisible", shape.getGraphicsAlgorithm().getFilled());
+ assertFalse("ga is invisible", shape.getGraphicsAlgorithm().getLineVisible());
+ assertEquals("border rect", 1, shape.getGraphicsAlgorithm().getGraphicsAlgorithmChildren().size());
+ GraphicsAlgorithm borderRect = shape.getGraphicsAlgorithm().getGraphicsAlgorithmChildren().get(0);
+ assertTrue("border rect is rounded rectangle", borderRect instanceof Ellipse);
+ if (isInherited(ac,tp))
+ assertTrue("border rect background", isEqual(borderRect.getForeground(), TrPointSupport.INHERITED_COLOR));
+ else
+ assertTrue("border rect background", isEqual(borderRect.getForeground(), TrPointSupport.DARK_COLOR));
+ }
+
+ /**
+ * compute inheritance
+ *
+ * @param ac actor class
+ * @param item state graph item
+ * @return true if state graph item is not owned by the given actor class
+ */
+ private boolean isInherited(ActorClass ac, StateGraphItem item) {
+ EObject owner = item.eContainer();
+ while (owner!=null) {
+ if (owner instanceof ActorClass)
+ break;
+ owner = owner.eContainer();
+ }
+ return ac!=owner;
+ }
+}
diff --git a/tests/org.eclipse.etrice.ui.tests.base/.classpath b/tests/org.eclipse.etrice.ui.tests.base/.classpath
new file mode 100644
index 000000000..ad32c83a7
--- /dev/null
+++ b/tests/org.eclipse.etrice.ui.tests.base/.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/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/tests/org.eclipse.etrice.ui.tests.base/.project b/tests/org.eclipse.etrice.ui.tests.base/.project
new file mode 100644
index 000000000..ebe0323d9
--- /dev/null
+++ b/tests/org.eclipse.etrice.ui.tests.base/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.etrice.ui.tests.base</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/tests/org.eclipse.etrice.ui.tests.base/.settings/org.eclipse.jdt.core.prefs b/tests/org.eclipse.etrice.ui.tests.base/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..00cf6ec9e
--- /dev/null
+++ b/tests/org.eclipse.etrice.ui.tests.base/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Thu Feb 10 12:03:48 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.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/tests/org.eclipse.etrice.ui.tests.base/META-INF/MANIFEST.MF b/tests/org.eclipse.etrice.ui.tests.base/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..2aac5d08c
--- /dev/null
+++ b/tests/org.eclipse.etrice.ui.tests.base/META-INF/MANIFEST.MF
@@ -0,0 +1,14 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: eTrice Diagram Test Base Classes
+Bundle-SymbolicName: org.eclipse.etrice.ui.tests.base
+Bundle-Version: 0.1.0
+Require-Bundle: org.junit;bundle-version="4.8.1",
+ org.eclipse.core.runtime,
+ org.eclipse.etrice.core.room;bundle-version="0.1.0",
+ org.eclipse.etrice.ui.structure;bundle-version="0.1.0",
+ org.eclipse.xtext;bundle-version="1.0.1",
+ org.eclipse.graphiti;bundle-version="0.7.0"
+Bundle-Vendor: eTrice (Incubation)
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Export-Package: org.eclipse.etrice.tests.base
diff --git a/tests/org.eclipse.etrice.ui.tests.base/bin/org/eclipse/etrice/tests/base/TestBase.class b/tests/org.eclipse.etrice.ui.tests.base/bin/org/eclipse/etrice/tests/base/TestBase.class
new file mode 100644
index 000000000..f0be5e099
--- /dev/null
+++ b/tests/org.eclipse.etrice.ui.tests.base/bin/org/eclipse/etrice/tests/base/TestBase.class
Binary files differ
diff --git a/tests/org.eclipse.etrice.ui.tests.base/build.properties b/tests/org.eclipse.etrice.ui.tests.base/build.properties
new file mode 100644
index 000000000..34d2e4d2d
--- /dev/null
+++ b/tests/org.eclipse.etrice.ui.tests.base/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/tests/org.eclipse.etrice.ui.tests.base/src/org/eclipse/etrice/tests/base/TestBase.java b/tests/org.eclipse.etrice.ui.tests.base/src/org/eclipse/etrice/tests/base/TestBase.java
new file mode 100644
index 000000000..73a95af74
--- /dev/null
+++ b/tests/org.eclipse.etrice.ui.tests.base/src/org/eclipse/etrice/tests/base/TestBase.java
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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:
+ * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution)
+ *
+ *******************************************************************************/
+
+package org.eclipse.etrice.tests.base;
+
+import static org.junit.Assert.fail;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.util.LinkedList;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.etrice.core.room.RoomModel;
+import org.eclipse.graphiti.mm.algorithms.styles.Color;
+import org.eclipse.graphiti.util.IColorConstant;
+import org.eclipse.xtext.resource.XtextResource;
+import org.eclipse.xtext.resource.XtextResourceSet;
+
+public abstract class TestBase {
+
+ private String basePath;
+ private LinkedList<RoomModel> models = new LinkedList<RoomModel>();
+
+ protected void loadModelFile() {
+ try {
+ URL modelsDir = getModelsDirectoy();
+ URL fileURL = FileLocator.toFileURL(modelsDir);
+ basePath = fileURL.getFile();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ loadModels(getModelFileName());
+ }
+
+ protected void removeDiagramsDirectory() {
+ File diagDir = new File(basePath+File.separator+"diagrams");
+ if (diagDir.isDirectory()) {
+ File[] files = diagDir.listFiles();
+ if (files!=null)
+ for (int i = 0; i < files.length; i++) {
+ files[i].delete();
+ }
+ diagDir.delete();
+ }
+ }
+
+ private void loadModels(String modelName) {
+ XtextResourceSet rs = new XtextResourceSet();
+ rs.addLoadOption(XtextResource.OPTION_RESOLVE_ALL, Boolean.TRUE);
+ String path = basePath + modelName;
+ URI uri = URI.createFileURI(path);
+ Resource resource = rs.getResource(uri, true);
+ Object root = resource.getContents().get(0);
+ if (root instanceof RoomModel)
+ models.add((RoomModel) root);
+ else
+ fail("File contains no RoomModel as root object");
+ }
+
+ public LinkedList<RoomModel> getModels() {
+ return models;
+ }
+
+ protected abstract String getModelFileName();
+ protected abstract URL getModelsDirectoy();
+
+ protected boolean isEqual(Color c, IColorConstant cc) {
+ if (c.getRed()!=cc.getRed())
+ return false;
+ if (c.getGreen()!=cc.getGreen())
+ return false;
+ if (c.getBlue()!=cc.getBlue())
+ return false;
+ return true;
+ }
+}

Back to the top