Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'tests/org.eclipse.etrice.core.genmodel.tests')
-rw-r--r--tests/org.eclipse.etrice.core.genmodel.tests/.classpath14
-rw-r--r--tests/org.eclipse.etrice.core.genmodel.tests/.gitignore2
-rw-r--r--tests/org.eclipse.etrice.core.genmodel.tests/.project68
-rw-r--r--tests/org.eclipse.etrice.core.genmodel.tests/.settings/org.eclipse.jdt.core.prefs16
-rw-r--r--tests/org.eclipse.etrice.core.genmodel.tests/META-INF/MANIFEST.MF28
-rw-r--r--tests/org.eclipse.etrice.core.genmodel.tests/about.html54
-rw-r--r--tests/org.eclipse.etrice.core.genmodel.tests/build.properties10
-rw-r--r--tests/org.eclipse.etrice.core.genmodel.tests/models/code_inheritance.room214
-rw-r--r--tests/org.eclipse.etrice.core.genmodel.tests/models/compound.room272
-rw-r--r--tests/org.eclipse.etrice.core.genmodel.tests/models/connected_ports.room160
-rw-r--r--tests/org.eclipse.etrice.core.genmodel.tests/models/cpmult.room242
-rw-r--r--tests/org.eclipse.etrice.core.genmodel.tests/models/fanning_relay.room132
-rw-r--r--tests/org.eclipse.etrice.core.genmodel.tests/models/hierarchy.room50
-rw-r--r--tests/org.eclipse.etrice.core.genmodel.tests/models/layers.room272
-rw-r--r--tests/org.eclipse.etrice.core.genmodel.tests/models/ports.room44
-rw-r--r--tests/org.eclipse.etrice.core.genmodel.tests/models/replicated_actors.room892
-rw-r--r--tests/org.eclipse.etrice.core.genmodel.tests/models/states.room216
-rw-r--r--tests/org.eclipse.etrice.core.genmodel.tests/models/states_inheritance.room498
-rw-r--r--tests/org.eclipse.etrice.core.genmodel.tests/models/states_triggers.room352
-rw-r--r--tests/org.eclipse.etrice.core.genmodel.tests/models/structure_inheritance.room416
-rw-r--r--tests/org.eclipse.etrice.core.genmodel.tests/models/test.room60
-rw-r--r--tests/org.eclipse.etrice.core.genmodel.tests/org.eclipse.etrice.core.genmodel.tests.launch80
-rw-r--r--tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/GenmodelTestsActivator.java44
-rw-r--r--tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestCodeInheritance.java248
-rw-r--r--tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestCompoundProtocol.java184
-rw-r--r--tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestConnectedPorts.java180
-rw-r--r--tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestFanningRelayPorts.java182
-rw-r--r--tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestHierarchy.java114
-rw-r--r--tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestInstanceModelBuilderBase.java318
-rw-r--r--tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestLayers.java146
-rw-r--r--tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestMultipleConnectedChoicepoint.java314
-rw-r--r--tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestPorts.java116
-rw-r--r--tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestReplicatedActors.java418
-rw-r--r--tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestStates.java240
-rw-r--r--tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestStatesAndTriggers.java288
-rw-r--r--tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestStatesInheritance.java288
-rw-r--r--tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestStructureInheritance.java348
37 files changed, 3760 insertions, 3760 deletions
diff --git a/tests/org.eclipse.etrice.core.genmodel.tests/.classpath b/tests/org.eclipse.etrice.core.genmodel.tests/.classpath
index 8a8f1668c..ad32c83a7 100644
--- a/tests/org.eclipse.etrice.core.genmodel.tests/.classpath
+++ b/tests/org.eclipse.etrice.core.genmodel.tests/.classpath
@@ -1,7 +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>
+<?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.core.genmodel.tests/.gitignore b/tests/org.eclipse.etrice.core.genmodel.tests/.gitignore
index 092357e47..ba077a403 100644
--- a/tests/org.eclipse.etrice.core.genmodel.tests/.gitignore
+++ b/tests/org.eclipse.etrice.core.genmodel.tests/.gitignore
@@ -1 +1 @@
-bin
+bin
diff --git a/tests/org.eclipse.etrice.core.genmodel.tests/.project b/tests/org.eclipse.etrice.core.genmodel.tests/.project
index 18f8f7647..7f7ca4f3c 100644
--- a/tests/org.eclipse.etrice.core.genmodel.tests/.project
+++ b/tests/org.eclipse.etrice.core.genmodel.tests/.project
@@ -1,34 +1,34 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.etrice.core.genmodel.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>
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.etrice.core.genmodel.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.genmodel.tests/.settings/org.eclipse.jdt.core.prefs b/tests/org.eclipse.etrice.core.genmodel.tests/.settings/org.eclipse.jdt.core.prefs
index f4c6d898b..58a8efbec 100644
--- a/tests/org.eclipse.etrice.core.genmodel.tests/.settings/org.eclipse.jdt.core.prefs
+++ b/tests/org.eclipse.etrice.core.genmodel.tests/.settings/org.eclipse.jdt.core.prefs
@@ -1,8 +1,8 @@
-#Tue May 22 09:38:05 CEST 2012
-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
+#Tue May 22 09:38:05 CEST 2012
+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.core.genmodel.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.etrice.core.genmodel.tests/META-INF/MANIFEST.MF
index 9470db1c8..5db644ff6 100644
--- a/tests/org.eclipse.etrice.core.genmodel.tests/META-INF/MANIFEST.MF
+++ b/tests/org.eclipse.etrice.core.genmodel.tests/META-INF/MANIFEST.MF
@@ -1,14 +1,14 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Tests
-Bundle-SymbolicName: org.eclipse.etrice.core.genmodel.tests
-Bundle-Version: 0.3.0.qualifier
-Bundle-Vendor: Eclipse eTrice (Incubation)
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Require-Bundle: org.eclipse.etrice.core.room;bundle-version="0.3.0",
- org.eclipse.etrice.core.genmodel;bundle-version="0.3.0",
- org.junit;bundle-version="4.8.1",
- org.eclipse.xtext;bundle-version="2.1.1",
- org.eclipse.core.runtime;bundle-version="3.7.0"
-Bundle-Activator: org.eclipse.etrice.core.genmodel.GenmodelTestsActivator
-Bundle-ActivationPolicy: lazy
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Tests
+Bundle-SymbolicName: org.eclipse.etrice.core.genmodel.tests
+Bundle-Version: 0.3.0.qualifier
+Bundle-Vendor: Eclipse eTrice (Incubation)
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Require-Bundle: org.eclipse.etrice.core.room;bundle-version="0.3.0",
+ org.eclipse.etrice.core.genmodel;bundle-version="0.3.0",
+ org.junit;bundle-version="4.8.1",
+ org.eclipse.xtext;bundle-version="2.1.1",
+ org.eclipse.core.runtime;bundle-version="3.7.0"
+Bundle-Activator: org.eclipse.etrice.core.genmodel.GenmodelTestsActivator
+Bundle-ActivationPolicy: lazy
diff --git a/tests/org.eclipse.etrice.core.genmodel.tests/about.html b/tests/org.eclipse.etrice.core.genmodel.tests/about.html
index f47dbddbb..c258ef55d 100644
--- a/tests/org.eclipse.etrice.core.genmodel.tests/about.html
+++ b/tests/org.eclipse.etrice.core.genmodel.tests/about.html
@@ -1,28 +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>
+<!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.genmodel.tests/build.properties b/tests/org.eclipse.etrice.core.genmodel.tests/build.properties
index b338525ec..0e8e5eda9 100644
--- a/tests/org.eclipse.etrice.core.genmodel.tests/build.properties
+++ b/tests/org.eclipse.etrice.core.genmodel.tests/build.properties
@@ -1,5 +1,5 @@
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- models/
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ models/
diff --git a/tests/org.eclipse.etrice.core.genmodel.tests/models/code_inheritance.room b/tests/org.eclipse.etrice.core.genmodel.tests/models/code_inheritance.room
index a76304627..eb4226526 100644
--- a/tests/org.eclipse.etrice.core.genmodel.tests/models/code_inheritance.room
+++ b/tests/org.eclipse.etrice.core.genmodel.tests/models/code_inheritance.room
@@ -1,108 +1,108 @@
-RoomModel code_inheritance {
-
- SubSystemClass Main {
- ActorRef appl: Deriv
- }
-
- ActorClass Deriv extends Base {
- Structure { }
- Behavior {
- StateMachine {
- RefinedState BaseEntryExit {
- entry {
- "// derived entry"
- }
- }
- RefinedState Base {
- exit {
- "// derived exit"
- }
- subgraph {
- Transition init: initial -> state0 { }
- State state0
- }
- }
- RefinedState BaseSub {
- entry {
- "// derived entry"
- }
- }
- }
- }
- }
-
- ActorClass Base {
- Interface {
- Port p0: PC
- }
- Structure {
- external Port p0
- }
- Behavior {
- StateMachine {
- Transition init: initial -> BaseEntryExit {
- action {
- "// base init"
- }
- }
- Transition tr0: BaseEntryExit -> Base {
- triggers {
- <m1: p0>
- }
- action {
- "// base"
- }
- }
- Transition tr1: Base -> BaseSub {
- triggers {
- <m1: p0>
- }
- action {
- "// base"
- }
- }
- Transition tr2: BaseSub -> BaseEntryExitSub {
- triggers {
- <m1: p0>
- }
- action {
- "// base"
- }
- }
- State BaseEntryExit {
- entry {
- "// base entry"
- }
- exit {
- "// base exit"
- }
- }
- State Base
- State BaseSub {
- subgraph {
- Transition init: initial -> state0 { }
- State state0
- }
- }
- State BaseEntryExitSub {
- entry {
- "// base entry"
- }
- exit {
- "// base exit"
- }
- subgraph {
- Transition init: initial -> state0 { }
- State state0
- }
- }
- }
- }
- }
-
- ProtocolClass PC {
- incoming {
- Message m1()
- }
- }
+RoomModel code_inheritance {
+
+ SubSystemClass Main {
+ ActorRef appl: Deriv
+ }
+
+ ActorClass Deriv extends Base {
+ Structure { }
+ Behavior {
+ StateMachine {
+ RefinedState BaseEntryExit {
+ entry {
+ "// derived entry"
+ }
+ }
+ RefinedState Base {
+ exit {
+ "// derived exit"
+ }
+ subgraph {
+ Transition init: initial -> state0 { }
+ State state0
+ }
+ }
+ RefinedState BaseSub {
+ entry {
+ "// derived entry"
+ }
+ }
+ }
+ }
+ }
+
+ ActorClass Base {
+ Interface {
+ Port p0: PC
+ }
+ Structure {
+ external Port p0
+ }
+ Behavior {
+ StateMachine {
+ Transition init: initial -> BaseEntryExit {
+ action {
+ "// base init"
+ }
+ }
+ Transition tr0: BaseEntryExit -> Base {
+ triggers {
+ <m1: p0>
+ }
+ action {
+ "// base"
+ }
+ }
+ Transition tr1: Base -> BaseSub {
+ triggers {
+ <m1: p0>
+ }
+ action {
+ "// base"
+ }
+ }
+ Transition tr2: BaseSub -> BaseEntryExitSub {
+ triggers {
+ <m1: p0>
+ }
+ action {
+ "// base"
+ }
+ }
+ State BaseEntryExit {
+ entry {
+ "// base entry"
+ }
+ exit {
+ "// base exit"
+ }
+ }
+ State Base
+ State BaseSub {
+ subgraph {
+ Transition init: initial -> state0 { }
+ State state0
+ }
+ }
+ State BaseEntryExitSub {
+ entry {
+ "// base entry"
+ }
+ exit {
+ "// base exit"
+ }
+ subgraph {
+ Transition init: initial -> state0 { }
+ State state0
+ }
+ }
+ }
+ }
+ }
+
+ ProtocolClass PC {
+ incoming {
+ Message m1()
+ }
+ }
} \ No newline at end of file
diff --git a/tests/org.eclipse.etrice.core.genmodel.tests/models/compound.room b/tests/org.eclipse.etrice.core.genmodel.tests/models/compound.room
index 2ce768b05..763c0a958 100644
--- a/tests/org.eclipse.etrice.core.genmodel.tests/models/compound.room
+++ b/tests/org.eclipse.etrice.core.genmodel.tests/models/compound.room
@@ -1,137 +1,137 @@
-RoomModel compound {
-
- SubSystemClass Main {
- ActorRef appl: Appl
- }
-
- ActorClass Appl {
- Structure {
- ActorRef wrap: DeepWrapper
- ActorRef ref0: AC1
- ActorRef reg: Reg
- ActorRef conj: Conj
- Binding wrap.rel sub extra and ref0.extra
- Binding wrap.rel sub suppl and ref0.suppl
- Binding wrap.rel sub red and ref0.red
- Binding wrap.rel sub green and ref0.green
- Binding wrap.rel sub blue and ref0.blue
- Binding reg.p0 and conj.p0
- }
- Behavior { }
- }
-
- ActorClass AC1 {
- Interface {
- conjugated Port red: PC1
- conjugated Port green: PC1
- conjugated Port blue: PC1
- conjugated Port extra: PC2
- conjugated Port suppl: PC3
- }
- Structure {
- external Port red
- external Port green
- external Port blue
- external Port extra
- external Port suppl
- }
- Behavior { }
- }
-
- ActorClass DeepWrapper {
- Interface {
- Port rel: CPC
- }
- Structure {
- ActorRef ref0: Wrapper
- Binding rel and ref0.rel
- }
- Behavior { }
- }
-
-
- ActorClass Wrapper {
- Interface {
- Port rel: CPC
- }
- Structure {
- ActorRef ref0: AC2
- Binding rel sub suppl and ref0.suppl
- Binding rel sub extra and ref0.extra
- Binding rel sub red and ref0.red
- Binding rel sub green and ref0.green
- Binding rel sub blue and ref0.blue
- }
- Behavior { }
- }
-
- ActorClass AC2 {
- Interface {
- Port red: PC1
- Port green: PC1
- Port blue: PC1
- Port extra: PC2
- Port suppl: PC3
- }
- Structure {
- external Port red
- external Port green
- external Port blue
- external Port extra
- external Port suppl
- }
- Behavior { }
- }
-
- ActorClass Reg {
- Interface {
- Port p0: PC1
- }
- Structure {
- external Port p0
- }
- Behavior { }
- }
- ActorClass Conj {
- Interface {
- conjugated Port p0: PC1
- }
- Structure {
- external Port p0
- }
- Behavior { }
- }
-
- ProtocolClass PC1 {
- incoming {
- Message m1()
- }
- }
-
- ProtocolClass PC2 {
- incoming {
- Message m1()
- }
- }
-
- ProtocolClass PC3 {
- incoming {
- Message m1()
- }
- }
-
- CompoundProtocolClass CPC {
- SubProtocol red: PC1
- SubProtocol green: PC1
- SubProtocol blue: PC1
-
- SubProtocol extra: PC2
- SubProtocol suppl: PC3
- }
-
- CompoundProtocolClass CPC3 {
- SubProtocol red: PC1
- SubProtocol green: PC1
- SubProtocol blue: PC1
- }
+RoomModel compound {
+
+ SubSystemClass Main {
+ ActorRef appl: Appl
+ }
+
+ ActorClass Appl {
+ Structure {
+ ActorRef wrap: DeepWrapper
+ ActorRef ref0: AC1
+ ActorRef reg: Reg
+ ActorRef conj: Conj
+ Binding wrap.rel sub extra and ref0.extra
+ Binding wrap.rel sub suppl and ref0.suppl
+ Binding wrap.rel sub red and ref0.red
+ Binding wrap.rel sub green and ref0.green
+ Binding wrap.rel sub blue and ref0.blue
+ Binding reg.p0 and conj.p0
+ }
+ Behavior { }
+ }
+
+ ActorClass AC1 {
+ Interface {
+ conjugated Port red: PC1
+ conjugated Port green: PC1
+ conjugated Port blue: PC1
+ conjugated Port extra: PC2
+ conjugated Port suppl: PC3
+ }
+ Structure {
+ external Port red
+ external Port green
+ external Port blue
+ external Port extra
+ external Port suppl
+ }
+ Behavior { }
+ }
+
+ ActorClass DeepWrapper {
+ Interface {
+ Port rel: CPC
+ }
+ Structure {
+ ActorRef ref0: Wrapper
+ Binding rel and ref0.rel
+ }
+ Behavior { }
+ }
+
+
+ ActorClass Wrapper {
+ Interface {
+ Port rel: CPC
+ }
+ Structure {
+ ActorRef ref0: AC2
+ Binding rel sub suppl and ref0.suppl
+ Binding rel sub extra and ref0.extra
+ Binding rel sub red and ref0.red
+ Binding rel sub green and ref0.green
+ Binding rel sub blue and ref0.blue
+ }
+ Behavior { }
+ }
+
+ ActorClass AC2 {
+ Interface {
+ Port red: PC1
+ Port green: PC1
+ Port blue: PC1
+ Port extra: PC2
+ Port suppl: PC3
+ }
+ Structure {
+ external Port red
+ external Port green
+ external Port blue
+ external Port extra
+ external Port suppl
+ }
+ Behavior { }
+ }
+
+ ActorClass Reg {
+ Interface {
+ Port p0: PC1
+ }
+ Structure {
+ external Port p0
+ }
+ Behavior { }
+ }
+ ActorClass Conj {
+ Interface {
+ conjugated Port p0: PC1
+ }
+ Structure {
+ external Port p0
+ }
+ Behavior { }
+ }
+
+ ProtocolClass PC1 {
+ incoming {
+ Message m1()
+ }
+ }
+
+ ProtocolClass PC2 {
+ incoming {
+ Message m1()
+ }
+ }
+
+ ProtocolClass PC3 {
+ incoming {
+ Message m1()
+ }
+ }
+
+ CompoundProtocolClass CPC {
+ SubProtocol red: PC1
+ SubProtocol green: PC1
+ SubProtocol blue: PC1
+
+ SubProtocol extra: PC2
+ SubProtocol suppl: PC3
+ }
+
+ CompoundProtocolClass CPC3 {
+ SubProtocol red: PC1
+ SubProtocol green: PC1
+ SubProtocol blue: PC1
+ }
} \ No newline at end of file
diff --git a/tests/org.eclipse.etrice.core.genmodel.tests/models/connected_ports.room b/tests/org.eclipse.etrice.core.genmodel.tests/models/connected_ports.room
index c22a49143..d00db7656 100644
--- a/tests/org.eclipse.etrice.core.genmodel.tests/models/connected_ports.room
+++ b/tests/org.eclipse.etrice.core.genmodel.tests/models/connected_ports.room
@@ -1,80 +1,80 @@
-RoomModel connected_ports {
- ProtocolClass PTest {
- incoming {
- Message in1 ()
- }
- outgoing {
- Message out1 ()
- }
- }
-
- SubSystemClass CMain {
- ActorRef test_a1 : ATestA
- ActorRef test_a2 : ATestA
- ActorRef test_a3 : ATestA
- ActorRef test_b : ATestB
-
- Binding test_b.plain and test_a1.relay
- Binding test_a1.ext_end and test_b.repl
- Binding test_b.repl and test_a2.ext_end
- Binding test_b.repl and test_a3.ext_end
- Binding test_b.repl_relay and test_a2.relay
- Binding test_b.repl_relay and test_a3.relay
- }
-
- ActorClass ATestA {
- Interface {
- Port relay : PTest
- Port ext_end : PTest
- }
- Structure {
- external Port ext_end
- conjugated Port int_end : PTest
- ActorRef subact : ASub
- Binding subact.p1 and relay
- Binding subact.p2 and int_end
- }
- Behavior {
- }
- }
-
- ActorClass ATestB {
- Interface {
- conjugated Port plain : PTest
- conjugated Port repl [3] : PTest
- conjugated Port repl_relay [3] : PTest
- }
- Structure {
- external Port plain
- external Port repl
- ActorRef sub1 : ASubB
- Binding repl_relay and sub1.p
- }
- Behavior {
- }
- }
-
- ActorClass ASub {
- Interface {
- Port p1 : PTest
- Port p2 : PTest
- }
- Structure {
- external Port p1
- external Port p2
- }
- Behavior {
- }
- }
-
- ActorClass ASubB {
- Interface {
- conjugated Port p [3] : PTest
- }
- Structure {
- external Port p
- }
- Behavior {
- }
- }
-}
+RoomModel connected_ports {
+ ProtocolClass PTest {
+ incoming {
+ Message in1 ()
+ }
+ outgoing {
+ Message out1 ()
+ }
+ }
+
+ SubSystemClass CMain {
+ ActorRef test_a1 : ATestA
+ ActorRef test_a2 : ATestA
+ ActorRef test_a3 : ATestA
+ ActorRef test_b : ATestB
+
+ Binding test_b.plain and test_a1.relay
+ Binding test_a1.ext_end and test_b.repl
+ Binding test_b.repl and test_a2.ext_end
+ Binding test_b.repl and test_a3.ext_end
+ Binding test_b.repl_relay and test_a2.relay
+ Binding test_b.repl_relay and test_a3.relay
+ }
+
+ ActorClass ATestA {
+ Interface {
+ Port relay : PTest
+ Port ext_end : PTest
+ }
+ Structure {
+ external Port ext_end
+ conjugated Port int_end : PTest
+ ActorRef subact : ASub
+ Binding subact.p1 and relay
+ Binding subact.p2 and int_end
+ }
+ Behavior {
+ }
+ }
+
+ ActorClass ATestB {
+ Interface {
+ conjugated Port plain : PTest
+ conjugated Port repl [3] : PTest
+ conjugated Port repl_relay [3] : PTest
+ }
+ Structure {
+ external Port plain
+ external Port repl
+ ActorRef sub1 : ASubB
+ Binding repl_relay and sub1.p
+ }
+ Behavior {
+ }
+ }
+
+ ActorClass ASub {
+ Interface {
+ Port p1 : PTest
+ Port p2 : PTest
+ }
+ Structure {
+ external Port p1
+ external Port p2
+ }
+ Behavior {
+ }
+ }
+
+ ActorClass ASubB {
+ Interface {
+ conjugated Port p [3] : PTest
+ }
+ Structure {
+ external Port p
+ }
+ Behavior {
+ }
+ }
+}
diff --git a/tests/org.eclipse.etrice.core.genmodel.tests/models/cpmult.room b/tests/org.eclipse.etrice.core.genmodel.tests/models/cpmult.room
index 318cd741f..ffbc47c24 100644
--- a/tests/org.eclipse.etrice.core.genmodel.tests/models/cpmult.room
+++ b/tests/org.eclipse.etrice.core.genmodel.tests/models/cpmult.room
@@ -1,122 +1,122 @@
-RoomModel cpmult {
- import room.basic.types.* from "../../org.eclipse.etrice.modellib.java/models/Types.room"
-
- SubSystemClass Main {
- ActorRef appl: CPMult
- }
-
- ActorClass CPMult {
- Interface {
- Port p0: PC
- }
- Structure {
- external Port p0
- }
- Behavior {
- StateMachine {
- Transition init: initial -> state0 { }
- Transition tr0: state0 -> cp cp0 {
- triggers {
- <m1: p0>
- }
- action {
- "// left"
- }
- }
- Transition tr1: state0 -> tp0 of state1 {
- triggers {
- <m2: p0>
- }
- }
- Transition tr3: cp cp0 -> state2 {
- action {
- "// dflt branch"
- }
- }
- Transition tr4: cp cp0 -> state3 {
- cond {
- "data.x>0"
- }
- action {
- "// false branch"
- }
- }
- Transition tr2: tp1 of state1 -> cp cp0 {
- action {
- "// right"
- }
- }
- ChoicePoint cp0
- State state0
- State state1 {
- subgraph {
- Transition tr0: my tp0 -> state0
- Transition tr1: state0 -> state1 {
- triggers {
- <m0: p0>
- }
- }
- Transition tr2: state0 -> my tp1 {
- triggers {
- <m1: p0>
- }
- action {
- "//state1/tr2"
- }
- }
- Transition tr3: state1 -> my tp1 {
- triggers {
- <m3: p0>
- }
- action {
- "//state1/tr3"
- }
- }
- EntryPoint tp0
- ExitPoint tp1
- State state0
- State state1
- }
- }
- State state2
- State state3
- }
- }
- }
-
- ProtocolClass PC {
- incoming {
- Message m0()
- Message m1(data: DC2)
- Message m2(data: DC3)
- Message m3(data: DC4)
- }
- outgoing {
- Message m1()
- }
- }
-
- DataClass DC {
- Attribute x: int32
- }
-
- DataClass DC1 {
- Attribute a: int32
- Attribute b: int32
- Attribute c: int32
- }
-
- DataClass DC2 extends DC {
- Attribute y: int32
- Attribute r: DC1
- }
-
- DataClass DC3 extends DC {
- Attribute z: int32
- }
-
- DataClass DC4 extends DC3 {
- Attribute w: int32
- }
-
+RoomModel cpmult {
+ import room.basic.types.* from "../../org.eclipse.etrice.modellib.java/models/Types.room"
+
+ SubSystemClass Main {
+ ActorRef appl: CPMult
+ }
+
+ ActorClass CPMult {
+ Interface {
+ Port p0: PC
+ }
+ Structure {
+ external Port p0
+ }
+ Behavior {
+ StateMachine {
+ Transition init: initial -> state0 { }
+ Transition tr0: state0 -> cp cp0 {
+ triggers {
+ <m1: p0>
+ }
+ action {
+ "// left"
+ }
+ }
+ Transition tr1: state0 -> tp0 of state1 {
+ triggers {
+ <m2: p0>
+ }
+ }
+ Transition tr3: cp cp0 -> state2 {
+ action {
+ "// dflt branch"
+ }
+ }
+ Transition tr4: cp cp0 -> state3 {
+ cond {
+ "data.x>0"
+ }
+ action {
+ "// false branch"
+ }
+ }
+ Transition tr2: tp1 of state1 -> cp cp0 {
+ action {
+ "// right"
+ }
+ }
+ ChoicePoint cp0
+ State state0
+ State state1 {
+ subgraph {
+ Transition tr0: my tp0 -> state0
+ Transition tr1: state0 -> state1 {
+ triggers {
+ <m0: p0>
+ }
+ }
+ Transition tr2: state0 -> my tp1 {
+ triggers {
+ <m1: p0>
+ }
+ action {
+ "//state1/tr2"
+ }
+ }
+ Transition tr3: state1 -> my tp1 {
+ triggers {
+ <m3: p0>
+ }
+ action {
+ "//state1/tr3"
+ }
+ }
+ EntryPoint tp0
+ ExitPoint tp1
+ State state0
+ State state1
+ }
+ }
+ State state2
+ State state3
+ }
+ }
+ }
+
+ ProtocolClass PC {
+ incoming {
+ Message m0()
+ Message m1(data: DC2)
+ Message m2(data: DC3)
+ Message m3(data: DC4)
+ }
+ outgoing {
+ Message m1()
+ }
+ }
+
+ DataClass DC {
+ Attribute x: int32
+ }
+
+ DataClass DC1 {
+ Attribute a: int32
+ Attribute b: int32
+ Attribute c: int32
+ }
+
+ DataClass DC2 extends DC {
+ Attribute y: int32
+ Attribute r: DC1
+ }
+
+ DataClass DC3 extends DC {
+ Attribute z: int32
+ }
+
+ DataClass DC4 extends DC3 {
+ Attribute w: int32
+ }
+
} \ No newline at end of file
diff --git a/tests/org.eclipse.etrice.core.genmodel.tests/models/fanning_relay.room b/tests/org.eclipse.etrice.core.genmodel.tests/models/fanning_relay.room
index 774f77923..314f21911 100644
--- a/tests/org.eclipse.etrice.core.genmodel.tests/models/fanning_relay.room
+++ b/tests/org.eclipse.etrice.core.genmodel.tests/models/fanning_relay.room
@@ -1,67 +1,67 @@
-RoomModel relay {
- SubSystemClass Main {
- ActorRef c1: Comp
- ActorRef c2: Comp
- ActorRef cont: Cont
- ActorRef c3: Comp
- ActorRef c4: Comp
- Binding c1.port and cont.port
- Binding c2.port and cont.port
- Binding cont.port and c3.port
- Binding c4.port and cont.port
- }
-
- ActorClass Comp {
- Interface {
- conjugated Port port: PC
- }
- Structure {
- external Port port
- }
- Behavior { }
- }
-
- ActorClass Cont {
- Interface {
- Port port [4]: PC
- }
- Structure {
- ActorRef s1: Sub
- ActorRef s2: Sub
- ActorRef c1: Cont2
- Binding port and s2.port
- Binding port and s1.port
- Binding port and c1.fct
- }
- Behavior { }
- }
-
- ActorClass Cont2 {
- Interface {
- Port fct [*]: PC
- }
- Structure {
- ActorRef ss1: Sub
- ActorRef ss2: Sub
- Binding fct and ss1.port
- Binding fct and ss2.port
- }
- Behavior { }
- }
-
- ActorClass Sub {
- Interface {
- Port port: PC
- }
- Structure {
- external Port port
- }
- Behavior { }
- }
-
- ProtocolClass PC {
- incoming {
- Message in1()
- }
- }
+RoomModel relay {
+ SubSystemClass Main {
+ ActorRef c1: Comp
+ ActorRef c2: Comp
+ ActorRef cont: Cont
+ ActorRef c3: Comp
+ ActorRef c4: Comp
+ Binding c1.port and cont.port
+ Binding c2.port and cont.port
+ Binding cont.port and c3.port
+ Binding c4.port and cont.port
+ }
+
+ ActorClass Comp {
+ Interface {
+ conjugated Port port: PC
+ }
+ Structure {
+ external Port port
+ }
+ Behavior { }
+ }
+
+ ActorClass Cont {
+ Interface {
+ Port port [4]: PC
+ }
+ Structure {
+ ActorRef s1: Sub
+ ActorRef s2: Sub
+ ActorRef c1: Cont2
+ Binding port and s2.port
+ Binding port and s1.port
+ Binding port and c1.fct
+ }
+ Behavior { }
+ }
+
+ ActorClass Cont2 {
+ Interface {
+ Port fct [*]: PC
+ }
+ Structure {
+ ActorRef ss1: Sub
+ ActorRef ss2: Sub
+ Binding fct and ss1.port
+ Binding fct and ss2.port
+ }
+ Behavior { }
+ }
+
+ ActorClass Sub {
+ Interface {
+ Port port: PC
+ }
+ Structure {
+ external Port port
+ }
+ Behavior { }
+ }
+
+ ProtocolClass PC {
+ incoming {
+ Message in1()
+ }
+ }
} \ No newline at end of file
diff --git a/tests/org.eclipse.etrice.core.genmodel.tests/models/hierarchy.room b/tests/org.eclipse.etrice.core.genmodel.tests/models/hierarchy.room
index 0d4bb03c2..6e95e7253 100644
--- a/tests/org.eclipse.etrice.core.genmodel.tests/models/hierarchy.room
+++ b/tests/org.eclipse.etrice.core.genmodel.tests/models/hierarchy.room
@@ -1,25 +1,25 @@
-RoomModel hierarchy {
-
- SubSystemClass CMain {
- ActorRef l1a : ALevel1
- ActorRef l1b : ALevel1
- }
-
- ActorClass ALevel1 {
- Structure {
- ActorRef l2a : ALevel2
- ActorRef l2b : ALevel2
- }
- }
-
- ActorClass ALevel2 {
- Structure {
- ActorRef l3a : ALevel3
- ActorRef l3b : ALevel3
- ActorRef l3c : ALevel3
- }
- }
-
- ActorClass ALevel3 {
- }
-}
+RoomModel hierarchy {
+
+ SubSystemClass CMain {
+ ActorRef l1a : ALevel1
+ ActorRef l1b : ALevel1
+ }
+
+ ActorClass ALevel1 {
+ Structure {
+ ActorRef l2a : ALevel2
+ ActorRef l2b : ALevel2
+ }
+ }
+
+ ActorClass ALevel2 {
+ Structure {
+ ActorRef l3a : ALevel3
+ ActorRef l3b : ALevel3
+ ActorRef l3c : ALevel3
+ }
+ }
+
+ ActorClass ALevel3 {
+ }
+}
diff --git a/tests/org.eclipse.etrice.core.genmodel.tests/models/layers.room b/tests/org.eclipse.etrice.core.genmodel.tests/models/layers.room
index 900edc528..ad1edc530 100644
--- a/tests/org.eclipse.etrice.core.genmodel.tests/models/layers.room
+++ b/tests/org.eclipse.etrice.core.genmodel.tests/models/layers.room
@@ -1,136 +1,136 @@
-RoomModel layers {
-
- ProtocolClass PServiceA {
- incoming {
- Message in1 ()
- }
- outgoing {
- Message out1 ()
- }
- }
-
- ProtocolClass PServiceB {
- incoming {
- Message in2 ()
- }
- outgoing {
- Message out2 ()
- }
- }
-
- ProtocolClass PServiceC {
- incoming {
- Message in3 ()
- }
- outgoing {
- Message out3 ()
- }
- }
-
- SubSystemClass CMain {
- ActorRef app : AApplication
- ActorRef services : AServices
-
- LayerConnection ref app satisfied_by services.serviceA
- LayerConnection ref app satisfied_by services.serviceB
- }
-
- ActorClass AApplication {
- Structure {
- ActorRef subsysA : ASubSysA
- ActorRef subsysB : ASubSysB
- }
- }
-
- ActorClass ASubSysA {
- Structure {
- ActorRef userX : AServiceUser1
- ActorRef userY : AServiceUser2
- ActorRef userZ : AServiceUser2
- }
- }
-
- ActorClass ASubSysB {
- Interface {
- SPP service : PServiceC
- }
- Structure {
- ActorRef userX : AServiceUser1
- ActorRef userY : AServiceUser1
- ActorRef userZ : AServiceUser3
- ActorRef svcC : AServiceC
-
- LayerConnection relay_sap service satisfied_by svcC.service
- }
- }
-
- ActorClass AServiceUser1 {
- Structure {
- SAP sap : PServiceA
- }
- }
-
- ActorClass AServiceUser2 {
- Structure {
- SAP sap : PServiceB
- }
- }
-
- ActorClass AServiceUser3 {
- Structure {
- SAP sap : PServiceC
- }
- }
-
- ActorClass AServices {
- Interface {
- SPP serviceA : PServiceA
- SPP serviceB : PServiceB
- }
- Structure {
- ActorRef svcA : AServiceA
- ActorRef svcB : AServiceB
-
- LayerConnection relay_sap serviceA satisfied_by svcA.service
- LayerConnection relay_sap serviceB satisfied_by svcB.service
- }
- }
-
- ActorClass AServiceA {
- Interface {
- SPP service : PServiceA
- }
- Structure {
- ServiceImplementation of service
- }
- }
-
- ActorClass AServiceB {
- Interface {
- SPP service : PServiceB
- }
- Structure {
- ActorRef impl : AServiceBImpl
- LayerConnection relay_sap service satisfied_by impl.service
- }
- }
-
- ActorClass AServiceBImpl {
- Interface {
- SPP service : PServiceB
- }
- Structure {
- ServiceImplementation of service
- }
- }
-
- ActorClass AServiceC {
- Interface {
- SPP service : PServiceC
- }
- Structure {
- ServiceImplementation of service
- }
- }
-
-}
+RoomModel layers {
+
+ ProtocolClass PServiceA {
+ incoming {
+ Message in1 ()
+ }
+ outgoing {
+ Message out1 ()
+ }
+ }
+
+ ProtocolClass PServiceB {
+ incoming {
+ Message in2 ()
+ }
+ outgoing {
+ Message out2 ()
+ }
+ }
+
+ ProtocolClass PServiceC {
+ incoming {
+ Message in3 ()
+ }
+ outgoing {
+ Message out3 ()
+ }
+ }
+
+ SubSystemClass CMain {
+ ActorRef app : AApplication
+ ActorRef services : AServices
+
+ LayerConnection ref app satisfied_by services.serviceA
+ LayerConnection ref app satisfied_by services.serviceB
+ }
+
+ ActorClass AApplication {
+ Structure {
+ ActorRef subsysA : ASubSysA
+ ActorRef subsysB : ASubSysB
+ }
+ }
+
+ ActorClass ASubSysA {
+ Structure {
+ ActorRef userX : AServiceUser1
+ ActorRef userY : AServiceUser2
+ ActorRef userZ : AServiceUser2
+ }
+ }
+
+ ActorClass ASubSysB {
+ Interface {
+ SPP service : PServiceC
+ }
+ Structure {
+ ActorRef userX : AServiceUser1
+ ActorRef userY : AServiceUser1
+ ActorRef userZ : AServiceUser3
+ ActorRef svcC : AServiceC
+
+ LayerConnection relay_sap service satisfied_by svcC.service
+ }
+ }
+
+ ActorClass AServiceUser1 {
+ Structure {
+ SAP sap : PServiceA
+ }
+ }
+
+ ActorClass AServiceUser2 {
+ Structure {
+ SAP sap : PServiceB
+ }
+ }
+
+ ActorClass AServiceUser3 {
+ Structure {
+ SAP sap : PServiceC
+ }
+ }
+
+ ActorClass AServices {
+ Interface {
+ SPP serviceA : PServiceA
+ SPP serviceB : PServiceB
+ }
+ Structure {
+ ActorRef svcA : AServiceA
+ ActorRef svcB : AServiceB
+
+ LayerConnection relay_sap serviceA satisfied_by svcA.service
+ LayerConnection relay_sap serviceB satisfied_by svcB.service
+ }
+ }
+
+ ActorClass AServiceA {
+ Interface {
+ SPP service : PServiceA
+ }
+ Structure {
+ ServiceImplementation of service
+ }
+ }
+
+ ActorClass AServiceB {
+ Interface {
+ SPP service : PServiceB
+ }
+ Structure {
+ ActorRef impl : AServiceBImpl
+ LayerConnection relay_sap service satisfied_by impl.service
+ }
+ }
+
+ ActorClass AServiceBImpl {
+ Interface {
+ SPP service : PServiceB
+ }
+ Structure {
+ ServiceImplementation of service
+ }
+ }
+
+ ActorClass AServiceC {
+ Interface {
+ SPP service : PServiceC
+ }
+ Structure {
+ ServiceImplementation of service
+ }
+ }
+
+}
diff --git a/tests/org.eclipse.etrice.core.genmodel.tests/models/ports.room b/tests/org.eclipse.etrice.core.genmodel.tests/models/ports.room
index e273cc978..4406f8ccd 100644
--- a/tests/org.eclipse.etrice.core.genmodel.tests/models/ports.room
+++ b/tests/org.eclipse.etrice.core.genmodel.tests/models/ports.room
@@ -1,22 +1,22 @@
-RoomModel base {
- ProtocolClass PTest {
- incoming {
- Message msg()
- }
- }
-
- SubSystemClass CMain {
- ActorRef test: ATest
- }
-
- ActorClass ATest {
- Interface {
- Port relay: PTest
- Port externalEnd: PTest
- }
- Structure {
- Port internalEnd: PTest
- external Port externalEnd
- }
- }
-}
+RoomModel base {
+ ProtocolClass PTest {
+ incoming {
+ Message msg()
+ }
+ }
+
+ SubSystemClass CMain {
+ ActorRef test: ATest
+ }
+
+ ActorClass ATest {
+ Interface {
+ Port relay: PTest
+ Port externalEnd: PTest
+ }
+ Structure {
+ Port internalEnd: PTest
+ external Port externalEnd
+ }
+ }
+}
diff --git a/tests/org.eclipse.etrice.core.genmodel.tests/models/replicated_actors.room b/tests/org.eclipse.etrice.core.genmodel.tests/models/replicated_actors.room
index 3846c345b..6cbf96cf0 100644
--- a/tests/org.eclipse.etrice.core.genmodel.tests/models/replicated_actors.room
+++ b/tests/org.eclipse.etrice.core.genmodel.tests/models/replicated_actors.room
@@ -1,446 +1,446 @@
-RoomModel replact {
-
- SubSystemClass Main {
- ActorRef appl1: AC1_Appl
- ActorRef appl2: AC2_Appl
- ActorRef appl3: AC3_Appl
- ActorRef appl4: AC4_Appl
- ActorRef appl5: ApplicationTop
- }
-
- // example 1: regular port of replicated actor connected to regular ports
- ActorClass AC1_Appl {
- Structure {
- conjugated Port intp1: PC
- conjugated Port intp2: PC
- conjugated Port intp3: PC
- ActorRef ac1repl [ 3 ]: AC1_1
- Binding ac1repl.ac1p and intp1
- Binding intp2 and ac1repl.ac1p
- Binding intp3 and ac1repl.ac1p
- }
- Behavior {
- StateMachine {
- Transition init: initial -> WaitAnswer {
- action {
- "intp1.ping(\"ping from \"+getInstancePath()+\"/intp1\");"
- "intp2.ping(\"ping from \"+getInstancePath()+\"/intp2\");"
- "intp3.ping(\"ping from \"+getInstancePath()+\"/intp3\");"
- }
- }
- Transition tr0: WaitAnswer -> WaitAnswer {
- triggers {
- <reply: intp1|reply: intp2|reply: intp3>
- }
- action {
- "System.out.println(\"received \"+msg);"
- }
- }
- State WaitAnswer
- }
- }
- }
-
- ActorClass AC1_1 {
- Interface {
- Port ac1p: PC
- }
- Structure {
- external Port ac1p
- }
- Behavior {
- StateMachine {
- Transition init: initial -> WaitForPing { }
- Transition tr0: WaitForPing -> WaitForPing {
- triggers {
- <ping: ac1p>
- }
- action {
- "ac1p.reply(\"answer from \"+getInstancePath()+\" to \"+msg);"
- }
- }
- State WaitForPing
- }
- }
- }
-
- // example 2: regular port of replicated actor connected to regular port of replicated actor
- ActorClass AC2_Appl {
- Structure {
- ActorRef ac1repl [ 3 ]: AC2_1
- ActorRef ac2repl [ 3 ]: AC2_2
- Binding ac2repl.ac2p and ac1repl.ac1p
- }
- }
-
- ActorClass AC2_1 {
- Interface {
- Port ac1p: PC
- }
- Structure {
- external Port ac1p
- }
- Behavior {
- StateMachine {
- Transition init: initial -> WaitForPing { }
- Transition tr0: WaitForPing -> WaitForPing {
- triggers {
- <ping: ac1p>
- }
- action {
- "ac1p.reply(\"answer from \"+getInstancePath()+\" to \"+msg);"
- }
- }
- State WaitForPing
- }
- }
- }
- ActorClass AC2_2 {
- Interface {
- conjugated Port ac2p: PC
- }
- Structure {
- external Port ac2p
- }
- Behavior {
- StateMachine {
- Transition init: initial -> WaitAnswer {
- action {
- "ac2p.ping(\"ping from \"+getInstancePath());"
- }
- }
- Transition tr0: WaitAnswer -> WaitAnswer {
- triggers {
- <reply: ac2p>
- }
- action {
- "System.out.println(\"received \"+msg);"
- }
- }
- State WaitAnswer
- }
- }
- }
-
- // example 3: regular port of replicated actor connected to replicated port
- ActorClass AC3_Appl {
- Structure {
- conjugated Port intrep [3]: PC
- ActorRef ac1repl [ 3 ]: AC3_1
- Binding ac1repl.ac1p and intrep
- }
- Behavior {
- StateMachine {
- Transition init: initial -> WaitAnswer {
- action {
- "intrep.ping(\"ping from \"+getInstancePath());"
- }
- }
- Transition tr0: WaitAnswer -> WaitAnswer {
- triggers {
- <reply: intrep>
- }
- action {
- "System.out.println(\"received \"+msg);"
- }
- }
- State WaitAnswer
- }
- }
- }
-
- ActorClass AC3_1 {
- Interface {
- Port ac1p: PC
- }
- Structure {
- external Port ac1p
- }
- Behavior {
- StateMachine {
- Transition init: initial -> WaitForPing { }
- Transition tr0: WaitForPing -> WaitForPing {
- triggers {
- <ping: ac1p>
- }
- action {
- "ac1p.reply(\"answer from \"+getInstancePath()+\" to \"+msg);"
- }
- }
- State WaitForPing
- }
- }
- }
-
- // example 4: regular port of replicated actor connected to replicated port of replicated actor
- ActorClass AC4_Appl {
- Structure {
- ActorRef ac1repl [ 2 ]: AC4_1
- ActorRef ac2repl [ 4 ]: AC4_2
- Binding ac2repl.ac2p and ac1repl.ac1p
- }
- }
-
- ActorClass AC4_1 {
- Interface {
- Port ac1p[2]: PC
- }
- Structure {
- external Port ac1p
- }
- Behavior {
- StateMachine {
- Transition init: initial -> WaitForPing { }
- Transition tr0: WaitForPing -> WaitForPing {
- triggers {
- <ping: ac1p>
- }
- action {
- "ac1p.reply(\"answer from \"+getInstancePath()+\" to \"+msg);"
- }
- }
- State WaitForPing
- }
- }
- }
- ActorClass AC4_2 {
- Interface {
- conjugated Port ac2p: PC
- }
- Structure {
- external Port ac2p
- }
- Behavior {
- StateMachine {
- Transition init: initial -> WaitAnswer {
- action {
- "ac2p.ping(\"ping from \"+getInstancePath());"
- }
- }
- Transition tr0: WaitAnswer -> WaitAnswer {
- triggers {
- <reply: ac2p>
- }
- action {
- "System.out.println(\"received \"+msg);"
- }
- }
- State WaitAnswer
- }
- }
- }
-
- // example 5: regular port of replicated actor connected to replicated port of sub actor
- ActorClass ApplicationTop {
- Structure {
- ActorRef testDriver: TestDriver
- ActorRef ref0 [ 8 ]: Channel
- Binding testDriver.testee and ref0.test
- }
- Behavior { }
- }
-
- ActorClass TestDriver {
- Interface {
- conjugated Port testee [8]: PTestDriver
- }
- Structure {
- external Port testee
- Attribute counter : int32 = "0"
- Attribute startTime : int64
- }
- Behavior {
- StateMachine {
- Transition init: initial -> TestRunning {
- action {
- "testee.start();"
- "System.out.println(\"Repl=\"+testee.getReplication());"
- "startTime = System.currentTimeMillis();"
- }
- }
- Transition tr0: TestRunning -> cp cp0 {
- triggers {
- <done: testee>
- }
- action {
- "counter++;"
- }
- }
- Transition tr1: cp cp0 -> TestRunning
- Transition tr2: cp cp0 -> TestDone {
- cond {
- "counter>=testee.getReplication()"
- }
- action {
- "long endTime = System.currentTimeMillis();"
- "//System.out.println(\"time in ms: \"+ (endTime-startTime));"
- }
- }
- ChoicePoint cp0
- State TestRunning
- State TestDone {
- entry {
- "System.out.println(\"Test Done\");"
- }
- }
- }
- }
- }
-
- ActorClass Channel {
- Interface {
- Port test: PTestDriver
- }
- Structure {
- ActorRef stack : ProtocolStack
- ActorRef tester : TestSender
- ActorRef mirror : Mirror
- Binding tester.stack and stack.sender
- Binding stack.receiver and mirror.stack
- Binding test and tester.test
- }
- Behavior { }
- }
-
- ActorClass TestSender {
- Interface {
- conjugated Port stack: CommunicationProtocol
- Port test: PTestDriver
- }
- Structure {
- external Port stack
- external Port test
- Attribute counter : int32 = "0"
- }
- Behavior {
- StateMachine {
- Transition init: initial -> idle { }
- Transition tr0: SendData -> cp cp0 {
- triggers {
- <receivedData: stack>
- }
- action {
- "counter++;"
- }
- }
- Transition tr1: cp cp0 -> SendData
- Transition tr2: cp cp0 -> TheEnd {
- cond {
- "counter>=1"
- }
- action {
- "test.done();"
- }
- }
- Transition tr3: idle -> SendData {
- triggers {
- <start: test>
- }
- action {
- "System.out.println(\"Channel Test Start\");"
- }
- }
- ChoicePoint cp0
- State SendData {
- entry {
- "stack.sendData(counter);"
- }
- }
- State TheEnd {
- entry {
- "System.out.println(\"Channel Test End\");"
- }
- }
- State idle
- }
- }
- }
-
- ActorClass Mirror {
- Interface {
- Port stack: CommunicationProtocol
- }
- Structure {
- external Port stack
- }
- Behavior {
- StateMachine {
- Transition init: initial -> mirror { }
- Transition tr0: mirror -> mirror {
- triggers {
- <sendData: stack>
- }
- action {
- "stack.receivedData();"
- }
- }
- State mirror
- }
- }
- }
-
- ActorClass ProtocolStack{
- Interface {
- Port sender: CommunicationProtocol
- conjugated Port receiver: CommunicationProtocol
- }
- Structure {
- external Port sender
- external Port receiver
- }
- Behavior {
- StateMachine {
- Transition init: initial -> idle { }
- Transition tr0: idle -> WaitingForReceive {
- triggers {
- <sendData: sender>
- }
- action {
- "receiver.sendData(data);"
- }
- }
- Transition tr1: WaitingForReceive -> idle {
- triggers {
- <receivedData: receiver>
- }
- action {
- "sender.receivedData();"
- }
- }
- State idle
- State WaitingForReceive
- }
- }
- }
-
- ProtocolClass PTestDriver {
- incoming {
- Message start()
- }
- outgoing {
- Message done()
- }
- }
-
- ProtocolClass CommunicationProtocol {
- incoming {
- Message sendData(data: int32)
- }
- outgoing {
- Message receivedData()
- }
- }
-
- ProtocolClass PC {
- incoming {
- Message ping(msg: string)
- }
- outgoing {
- Message reply(msg: string)
- }
- }
-
- PrimitiveType string: ptCharacter -> String (String) default "\"\""
- PrimitiveType int32: ptCharacter -> int (Integer) default "0"
- PrimitiveType int64: ptCharacter -> long (Long) default "0"
-}
+RoomModel replact {
+
+ SubSystemClass Main {
+ ActorRef appl1: AC1_Appl
+ ActorRef appl2: AC2_Appl
+ ActorRef appl3: AC3_Appl
+ ActorRef appl4: AC4_Appl
+ ActorRef appl5: ApplicationTop
+ }
+
+ // example 1: regular port of replicated actor connected to regular ports
+ ActorClass AC1_Appl {
+ Structure {
+ conjugated Port intp1: PC
+ conjugated Port intp2: PC
+ conjugated Port intp3: PC
+ ActorRef ac1repl [ 3 ]: AC1_1
+ Binding ac1repl.ac1p and intp1
+ Binding intp2 and ac1repl.ac1p
+ Binding intp3 and ac1repl.ac1p
+ }
+ Behavior {
+ StateMachine {
+ Transition init: initial -> WaitAnswer {
+ action {
+ "intp1.ping(\"ping from \"+getInstancePath()+\"/intp1\");"
+ "intp2.ping(\"ping from \"+getInstancePath()+\"/intp2\");"
+ "intp3.ping(\"ping from \"+getInstancePath()+\"/intp3\");"
+ }
+ }
+ Transition tr0: WaitAnswer -> WaitAnswer {
+ triggers {
+ <reply: intp1|reply: intp2|reply: intp3>
+ }
+ action {
+ "System.out.println(\"received \"+msg);"
+ }
+ }
+ State WaitAnswer
+ }
+ }
+ }
+
+ ActorClass AC1_1 {
+ Interface {
+ Port ac1p: PC
+ }
+ Structure {
+ external Port ac1p
+ }
+ Behavior {
+ StateMachine {
+ Transition init: initial -> WaitForPing { }
+ Transition tr0: WaitForPing -> WaitForPing {
+ triggers {
+ <ping: ac1p>
+ }
+ action {
+ "ac1p.reply(\"answer from \"+getInstancePath()+\" to \"+msg);"
+ }
+ }
+ State WaitForPing
+ }
+ }
+ }
+
+ // example 2: regular port of replicated actor connected to regular port of replicated actor
+ ActorClass AC2_Appl {
+ Structure {
+ ActorRef ac1repl [ 3 ]: AC2_1
+ ActorRef ac2repl [ 3 ]: AC2_2
+ Binding ac2repl.ac2p and ac1repl.ac1p
+ }
+ }
+
+ ActorClass AC2_1 {
+ Interface {
+ Port ac1p: PC
+ }
+ Structure {
+ external Port ac1p
+ }
+ Behavior {
+ StateMachine {
+ Transition init: initial -> WaitForPing { }
+ Transition tr0: WaitForPing -> WaitForPing {
+ triggers {
+ <ping: ac1p>
+ }
+ action {
+ "ac1p.reply(\"answer from \"+getInstancePath()+\" to \"+msg);"
+ }
+ }
+ State WaitForPing
+ }
+ }
+ }
+ ActorClass AC2_2 {
+ Interface {
+ conjugated Port ac2p: PC
+ }
+ Structure {
+ external Port ac2p
+ }
+ Behavior {
+ StateMachine {
+ Transition init: initial -> WaitAnswer {
+ action {
+ "ac2p.ping(\"ping from \"+getInstancePath());"
+ }
+ }
+ Transition tr0: WaitAnswer -> WaitAnswer {
+ triggers {
+ <reply: ac2p>
+ }
+ action {
+ "System.out.println(\"received \"+msg);"
+ }
+ }
+ State WaitAnswer
+ }
+ }
+ }
+
+ // example 3: regular port of replicated actor connected to replicated port
+ ActorClass AC3_Appl {
+ Structure {
+ conjugated Port intrep [3]: PC
+ ActorRef ac1repl [ 3 ]: AC3_1
+ Binding ac1repl.ac1p and intrep
+ }
+ Behavior {
+ StateMachine {
+ Transition init: initial -> WaitAnswer {
+ action {
+ "intrep.ping(\"ping from \"+getInstancePath());"
+ }
+ }
+ Transition tr0: WaitAnswer -> WaitAnswer {
+ triggers {
+ <reply: intrep>
+ }
+ action {
+ "System.out.println(\"received \"+msg);"
+ }
+ }
+ State WaitAnswer
+ }
+ }
+ }
+
+ ActorClass AC3_1 {
+ Interface {
+ Port ac1p: PC
+ }
+ Structure {
+ external Port ac1p
+ }
+ Behavior {
+ StateMachine {
+ Transition init: initial -> WaitForPing { }
+ Transition tr0: WaitForPing -> WaitForPing {
+ triggers {
+ <ping: ac1p>
+ }
+ action {
+ "ac1p.reply(\"answer from \"+getInstancePath()+\" to \"+msg);"
+ }
+ }
+ State WaitForPing
+ }
+ }
+ }
+
+ // example 4: regular port of replicated actor connected to replicated port of replicated actor
+ ActorClass AC4_Appl {
+ Structure {
+ ActorRef ac1repl [ 2 ]: AC4_1
+ ActorRef ac2repl [ 4 ]: AC4_2
+ Binding ac2repl.ac2p and ac1repl.ac1p
+ }
+ }
+
+ ActorClass AC4_1 {
+ Interface {
+ Port ac1p[2]: PC
+ }
+ Structure {
+ external Port ac1p
+ }
+ Behavior {
+ StateMachine {
+ Transition init: initial -> WaitForPing { }
+ Transition tr0: WaitForPing -> WaitForPing {
+ triggers {
+ <ping: ac1p>
+ }
+ action {
+ "ac1p.reply(\"answer from \"+getInstancePath()+\" to \"+msg);"
+ }
+ }
+ State WaitForPing
+ }
+ }
+ }
+ ActorClass AC4_2 {
+ Interface {
+ conjugated Port ac2p: PC
+ }
+ Structure {
+ external Port ac2p
+ }
+ Behavior {
+ StateMachine {
+ Transition init: initial -> WaitAnswer {
+ action {
+ "ac2p.ping(\"ping from \"+getInstancePath());"
+ }
+ }
+ Transition tr0: WaitAnswer -> WaitAnswer {
+ triggers {
+ <reply: ac2p>
+ }
+ action {
+ "System.out.println(\"received \"+msg);"
+ }
+ }
+ State WaitAnswer
+ }
+ }
+ }
+
+ // example 5: regular port of replicated actor connected to replicated port of sub actor
+ ActorClass ApplicationTop {
+ Structure {
+ ActorRef testDriver: TestDriver
+ ActorRef ref0 [ 8 ]: Channel
+ Binding testDriver.testee and ref0.test
+ }
+ Behavior { }
+ }
+
+ ActorClass TestDriver {
+ Interface {
+ conjugated Port testee [8]: PTestDriver
+ }
+ Structure {
+ external Port testee
+ Attribute counter : int32 = "0"
+ Attribute startTime : int64
+ }
+ Behavior {
+ StateMachine {
+ Transition init: initial -> TestRunning {
+ action {
+ "testee.start();"
+ "System.out.println(\"Repl=\"+testee.getReplication());"
+ "startTime = System.currentTimeMillis();"
+ }
+ }
+ Transition tr0: TestRunning -> cp cp0 {
+ triggers {
+ <done: testee>
+ }
+ action {
+ "counter++;"
+ }
+ }
+ Transition tr1: cp cp0 -> TestRunning
+ Transition tr2: cp cp0 -> TestDone {
+ cond {
+ "counter>=testee.getReplication()"
+ }
+ action {
+ "long endTime = System.currentTimeMillis();"
+ "//System.out.println(\"time in ms: \"+ (endTime-startTime));"
+ }
+ }
+ ChoicePoint cp0
+ State TestRunning
+ State TestDone {
+ entry {
+ "System.out.println(\"Test Done\");"
+ }
+ }
+ }
+ }
+ }
+
+ ActorClass Channel {
+ Interface {
+ Port test: PTestDriver
+ }
+ Structure {
+ ActorRef stack : ProtocolStack
+ ActorRef tester : TestSender
+ ActorRef mirror : Mirror
+ Binding tester.stack and stack.sender
+ Binding stack.receiver and mirror.stack
+ Binding test and tester.test
+ }
+ Behavior { }
+ }
+
+ ActorClass TestSender {
+ Interface {
+ conjugated Port stack: CommunicationProtocol
+ Port test: PTestDriver
+ }
+ Structure {
+ external Port stack
+ external Port test
+ Attribute counter : int32 = "0"
+ }
+ Behavior {
+ StateMachine {
+ Transition init: initial -> idle { }
+ Transition tr0: SendData -> cp cp0 {
+ triggers {
+ <receivedData: stack>
+ }
+ action {
+ "counter++;"
+ }
+ }
+ Transition tr1: cp cp0 -> SendData
+ Transition tr2: cp cp0 -> TheEnd {
+ cond {
+ "counter>=1"
+ }
+ action {
+ "test.done();"
+ }
+ }
+ Transition tr3: idle -> SendData {
+ triggers {
+ <start: test>
+ }
+ action {
+ "System.out.println(\"Channel Test Start\");"
+ }
+ }
+ ChoicePoint cp0
+ State SendData {
+ entry {
+ "stack.sendData(counter);"
+ }
+ }
+ State TheEnd {
+ entry {
+ "System.out.println(\"Channel Test End\");"
+ }
+ }
+ State idle
+ }
+ }
+ }
+
+ ActorClass Mirror {
+ Interface {
+ Port stack: CommunicationProtocol
+ }
+ Structure {
+ external Port stack
+ }
+ Behavior {
+ StateMachine {
+ Transition init: initial -> mirror { }
+ Transition tr0: mirror -> mirror {
+ triggers {
+ <sendData: stack>
+ }
+ action {
+ "stack.receivedData();"
+ }
+ }
+ State mirror
+ }
+ }
+ }
+
+ ActorClass ProtocolStack{
+ Interface {
+ Port sender: CommunicationProtocol
+ conjugated Port receiver: CommunicationProtocol
+ }
+ Structure {
+ external Port sender
+ external Port receiver
+ }
+ Behavior {
+ StateMachine {
+ Transition init: initial -> idle { }
+ Transition tr0: idle -> WaitingForReceive {
+ triggers {
+ <sendData: sender>
+ }
+ action {
+ "receiver.sendData(data);"
+ }
+ }
+ Transition tr1: WaitingForReceive -> idle {
+ triggers {
+ <receivedData: receiver>
+ }
+ action {
+ "sender.receivedData();"
+ }
+ }
+ State idle
+ State WaitingForReceive
+ }
+ }
+ }
+
+ ProtocolClass PTestDriver {
+ incoming {
+ Message start()
+ }
+ outgoing {
+ Message done()
+ }
+ }
+
+ ProtocolClass CommunicationProtocol {
+ incoming {
+ Message sendData(data: int32)
+ }
+ outgoing {
+ Message receivedData()
+ }
+ }
+
+ ProtocolClass PC {
+ incoming {
+ Message ping(msg: string)
+ }
+ outgoing {
+ Message reply(msg: string)
+ }
+ }
+
+ PrimitiveType string: ptCharacter -> String (String) default "\"\""
+ PrimitiveType int32: ptCharacter -> int (Integer) default "0"
+ PrimitiveType int64: ptCharacter -> long (Long) default "0"
+}
diff --git a/tests/org.eclipse.etrice.core.genmodel.tests/models/states.room b/tests/org.eclipse.etrice.core.genmodel.tests/models/states.room
index 6c23eb7e8..22ba965f2 100644
--- a/tests/org.eclipse.etrice.core.genmodel.tests/models/states.room
+++ b/tests/org.eclipse.etrice.core.genmodel.tests/models/states.room
@@ -1,108 +1,108 @@
-RoomModel states {
-
- PrimitiveType int32: ptInteger -> int32 (Integer) default "0"
-
- ProtocolClass PTest1 {
- incoming {
- Message a ()
- Message b (x : int32)
- Message c ()
- }
- outgoing {
- Message x ()
- }
- }
-
- SubSystemClass CMain {
- ActorRef test : ATest
- }
-
- ActorClass ATest {
- Interface {
- Port fct : PTest1
- }
- Structure {
- external Port fct
- }
- Behavior {
- StateMachine {
- State State1 {}
- State State2 {}
- State State3 {
- subgraph {
- State State1 {}
- State State2 {}
- State State3 {}
- EntryPoint tp1
- TransitionPoint tp2
- ExitPoint tp3
- Transition tr0: initial -> State1 {}
- Transition tr1: my tp1 -> State3 {}
- Transition tr2: State1 -> State2 {
- triggers {
- <b:fct>
- }
- }
- Transition tr3: State2 -> State3 {
- triggers {
- <c:fct>
- }
- }
- Transition tr4: State3 -> State1 {
- triggers {
- <a:fct>
- }
- }
- Transition tr5: my tp2 -> State3 {
- triggers {
- <b:fct>
- }
- }
- Transition tr6: State3 -> my tp3 {
- triggers {
- <c:fct>
- }
- }
- }
- }
- State State4 {}
- TransitionPoint tp0
- ChoicePoint CP1
- Transition tr0: initial -> State1 {}
- Transition tr1: State1 -> State2 {
- triggers {
- <a:fct>
- }
- }
- Transition tr2: State2 -> cp CP1 {
- triggers {
- <b:fct>
- }
- }
- Transition tr3: cp CP1 -> State1 {}
- Transition tr4: cp CP1 -> State3 {
- cond {
- "x==2"
- }
- }
- Transition tr5: my tp0 -> tp1 of State3 {
- triggers {
- <a:fct>
- }
- }
- Transition tr6: cp CP1 -> State4 {
- cond {
- "x==3"
- }
- }
- Transition tr7: tp3 of State3 -> State2 {}
- Transition tr8: State3 -> State2 {
- triggers {
- <c:fct>
- }
- }
- }
- }
- }
-
-}
+RoomModel states {
+
+ PrimitiveType int32: ptInteger -> int32 (Integer) default "0"
+
+ ProtocolClass PTest1 {
+ incoming {
+ Message a ()
+ Message b (x : int32)
+ Message c ()
+ }
+ outgoing {
+ Message x ()
+ }
+ }
+
+ SubSystemClass CMain {
+ ActorRef test : ATest
+ }
+
+ ActorClass ATest {
+ Interface {
+ Port fct : PTest1
+ }
+ Structure {
+ external Port fct
+ }
+ Behavior {
+ StateMachine {
+ State State1 {}
+ State State2 {}
+ State State3 {
+ subgraph {
+ State State1 {}
+ State State2 {}
+ State State3 {}
+ EntryPoint tp1
+ TransitionPoint tp2
+ ExitPoint tp3
+ Transition tr0: initial -> State1 {}
+ Transition tr1: my tp1 -> State3 {}
+ Transition tr2: State1 -> State2 {
+ triggers {
+ <b:fct>
+ }
+ }
+ Transition tr3: State2 -> State3 {
+ triggers {
+ <c:fct>
+ }
+ }
+ Transition tr4: State3 -> State1 {
+ triggers {
+ <a:fct>
+ }
+ }
+ Transition tr5: my tp2 -> State3 {
+ triggers {
+ <b:fct>
+ }
+ }
+ Transition tr6: State3 -> my tp3 {
+ triggers {
+ <c:fct>
+ }
+ }
+ }
+ }
+ State State4 {}
+ TransitionPoint tp0
+ ChoicePoint CP1
+ Transition tr0: initial -> State1 {}
+ Transition tr1: State1 -> State2 {
+ triggers {
+ <a:fct>
+ }
+ }
+ Transition tr2: State2 -> cp CP1 {
+ triggers {
+ <b:fct>
+ }
+ }
+ Transition tr3: cp CP1 -> State1 {}
+ Transition tr4: cp CP1 -> State3 {
+ cond {
+ "x==2"
+ }
+ }
+ Transition tr5: my tp0 -> tp1 of State3 {
+ triggers {
+ <a:fct>
+ }
+ }
+ Transition tr6: cp CP1 -> State4 {
+ cond {
+ "x==3"
+ }
+ }
+ Transition tr7: tp3 of State3 -> State2 {}
+ Transition tr8: State3 -> State2 {
+ triggers {
+ <c:fct>
+ }
+ }
+ }
+ }
+ }
+
+}
diff --git a/tests/org.eclipse.etrice.core.genmodel.tests/models/states_inheritance.room b/tests/org.eclipse.etrice.core.genmodel.tests/models/states_inheritance.room
index 586fcee06..5d9a4d00b 100644
--- a/tests/org.eclipse.etrice.core.genmodel.tests/models/states_inheritance.room
+++ b/tests/org.eclipse.etrice.core.genmodel.tests/models/states_inheritance.room
@@ -1,249 +1,249 @@
-RoomModel states_inheritance.t {
-
- PrimitiveType int32: ptInteger -> int32 (Integer) default "0"
-
- ProtocolClass PTimer {
- incoming {
- Message start (time_ms : int32)
- Message kill ()
- }
- outgoing {
- Message timerTick ()
- }
- }
-
- ProtocolClass PTimeout {
- incoming {
- Message start (time_ms : int32)
- Message kill ()
- }
- outgoing {
- Message timeoutTick ()
- }
- }
-
- ActorClass ATimingService {
- Interface {
- SPP timerSPP: PTimer
- SPP timeoutSPP: PTimeout
- }
- Structure {
- ServiceImplementation of timerSPP
- ServiceImplementation of timeoutSPP
- }
- }
-
- ProtocolClass PTest1 {
- incoming {
- Message a ()
- Message b (x : int32)
- Message c ()
- }
- outgoing {
- Message x ()
- }
- }
-
- ProtocolClass PTest2 {
- incoming {
- Message x ()
- Message y ()
- Message z ()
- }
- outgoing {
- Message a ()
- }
- }
-
- ProtocolClass PTest3 {
- incoming {
- Message a ()
- }
- outgoing {
- Message b ()
- }
- }
-
- SubSystemClass CMain {
- ActorRef application : AApplication_CMain
- ActorRef timingService : ATimingService
-
- LayerConnection ref application satisfied_by timingService.timerSPP
- LayerConnection ref application satisfied_by timingService.timeoutSPP
- }
-
- // automatically inserted AApplication_CMain
- ActorClass AApplication_CMain {
- Structure {
- ActorRef test : ADerived
- }
- }
-
- ActorClass ATest {
- Interface {
- Port fct : PTest1
- }
- Structure {
- external Port fct
- Port subp : PTest2
- SAP timer: PTimer
- SAP timeout: PTimeout
- }
- Behavior {
- StateMachine {
- State State1 {}
- State State2 {}
- State State3 {
- subgraph {
- State State1 {}
- State State2 {}
- State State3 {}
- EntryPoint tp1
- TransitionPoint tp2
- ExitPoint tp3
- handler TransitionPoint tp5
- Transition tr0: initial -> State1 {}
- Transition tr1: my tp1 -> State3 {}
- Transition tr2: State1 -> State2 {
- triggers {
- <b:fct>
- }
- }
- Transition tr3: State2 -> State3 {
- triggers {
- <c:fct>
- }
- }
- Transition tr4: State3 -> State1 {
- triggers {
- <a:fct>
- }
- }
- Transition tr5: my tp2 -> State3 {
- triggers {
- <b:fct>
- }
- }
- Transition tr6: State3 -> my tp3 {
- triggers {
- <c:fct>
- }
- }
- Transition tr7: my tp5 -> my tp5 {
- triggers {
- <timeoutTick:timeout>
- }
- }
- }
- }
- State State4 {}
- TransitionPoint tp0
- TransitionPoint tp1
- ChoicePoint CP1
- Transition tr0: initial -> State1 {}
- Transition tr1: State1 -> State2 {
- triggers {
- <a:fct>
- }
- }
- Transition tr2: State2 -> cp CP1 {
- triggers {
- <b:fct>
- }
- }
- Transition tr3: cp CP1 -> State1 {}
- Transition tr4: cp CP1 -> State3 {
- cond {
- "data==2"
- }
- }
- Transition tr5: my tp0 -> tp1 of State3 {
- triggers {
- <a:fct>
- }
- }
- Transition tr6: cp CP1 -> State4 {
- cond {
- "data==3"
- }
- }
- Transition tr7: tp3 of State3 -> State2 {}
- Transition tr8: State3 -> State2 {
- triggers {
- <c:fct>
- }
- }
- Transition tr9: my tp1 -> State2 {
- triggers {
- <timerTick:timer>
- }
- }
- }
- }
- }
-
- ActorClass ADerived extends ATest {
- Interface {
- Port port : PTest3
- }
- Structure {
- external Port port
- }
- Behavior {
- StateMachine {
- RefinedState State3 {
- subgraph {
- State State4 {}
- EntryPoint tp6
- TransitionPoint tp7
- Transition tr8: my tp6 -> State2 {}
- Transition tr9: my tp7 -> my tp7 {
- triggers {
- <z:subp>
- }
- }
- Transition tr10a: State2 -> State4 {
- triggers {
- <y:subp>
- }
- }
- Transition tr11a: State4 -> my tp3 {
- triggers {
- <z:subp>
- }
- }
- }
- }
- RefinedState State4 {
- subgraph {
- State State1 {}
- State State2 {}
- Transition tr0: initial -> State1 {}
- Transition tr1: State1 -> State2 {
- triggers {
- <a:port>
- }
- }
- }
- }
- State State5 {}
- Transition tr10: State1 -> State5 {
- triggers {
- <a:port>
- }
- }
- Transition tr11: cp CP1 -> State5 {
- cond {
- "data==4"
- }
- }
- Transition tr12: State5 -> tp6 of State3 {
- triggers {
- <a:port>
- }
- }
- }
- }
- }
-
-}
+RoomModel states_inheritance.t {
+
+ PrimitiveType int32: ptInteger -> int32 (Integer) default "0"
+
+ ProtocolClass PTimer {
+ incoming {
+ Message start (time_ms : int32)
+ Message kill ()
+ }
+ outgoing {
+ Message timerTick ()
+ }
+ }
+
+ ProtocolClass PTimeout {
+ incoming {
+ Message start (time_ms : int32)
+ Message kill ()
+ }
+ outgoing {
+ Message timeoutTick ()
+ }
+ }
+
+ ActorClass ATimingService {
+ Interface {
+ SPP timerSPP: PTimer
+ SPP timeoutSPP: PTimeout
+ }
+ Structure {
+ ServiceImplementation of timerSPP
+ ServiceImplementation of timeoutSPP
+ }
+ }
+
+ ProtocolClass PTest1 {
+ incoming {
+ Message a ()
+ Message b (x : int32)
+ Message c ()
+ }
+ outgoing {
+ Message x ()
+ }
+ }
+
+ ProtocolClass PTest2 {
+ incoming {
+ Message x ()
+ Message y ()
+ Message z ()
+ }
+ outgoing {
+ Message a ()
+ }
+ }
+
+ ProtocolClass PTest3 {
+ incoming {
+ Message a ()
+ }
+ outgoing {
+ Message b ()
+ }
+ }
+
+ SubSystemClass CMain {
+ ActorRef application : AApplication_CMain
+ ActorRef timingService : ATimingService
+
+ LayerConnection ref application satisfied_by timingService.timerSPP
+ LayerConnection ref application satisfied_by timingService.timeoutSPP
+ }
+
+ // automatically inserted AApplication_CMain
+ ActorClass AApplication_CMain {
+ Structure {
+ ActorRef test : ADerived
+ }
+ }
+
+ ActorClass ATest {
+ Interface {
+ Port fct : PTest1
+ }
+ Structure {
+ external Port fct
+ Port subp : PTest2
+ SAP timer: PTimer
+ SAP timeout: PTimeout
+ }
+ Behavior {
+ StateMachine {
+ State State1 {}
+ State State2 {}
+ State State3 {
+ subgraph {
+ State State1 {}
+ State State2 {}
+ State State3 {}
+ EntryPoint tp1
+ TransitionPoint tp2
+ ExitPoint tp3
+ handler TransitionPoint tp5
+ Transition tr0: initial -> State1 {}
+ Transition tr1: my tp1 -> State3 {}
+ Transition tr2: State1 -> State2 {
+ triggers {
+ <b:fct>
+ }
+ }
+ Transition tr3: State2 -> State3 {
+ triggers {
+ <c:fct>
+ }
+ }
+ Transition tr4: State3 -> State1 {
+ triggers {
+ <a:fct>
+ }
+ }
+ Transition tr5: my tp2 -> State3 {
+ triggers {
+ <b:fct>
+ }
+ }
+ Transition tr6: State3 -> my tp3 {
+ triggers {
+ <c:fct>
+ }
+ }
+ Transition tr7: my tp5 -> my tp5 {
+ triggers {
+ <timeoutTick:timeout>
+ }
+ }
+ }
+ }
+ State State4 {}
+ TransitionPoint tp0
+ TransitionPoint tp1
+ ChoicePoint CP1
+ Transition tr0: initial -> State1 {}
+ Transition tr1: State1 -> State2 {
+ triggers {
+ <a:fct>
+ }
+ }
+ Transition tr2: State2 -> cp CP1 {
+ triggers {
+ <b:fct>
+ }
+ }
+ Transition tr3: cp CP1 -> State1 {}
+ Transition tr4: cp CP1 -> State3 {
+ cond {
+ "data==2"
+ }
+ }
+ Transition tr5: my tp0 -> tp1 of State3 {
+ triggers {
+ <a:fct>
+ }
+ }
+ Transition tr6: cp CP1 -> State4 {
+ cond {
+ "data==3"
+ }
+ }
+ Transition tr7: tp3 of State3 -> State2 {}
+ Transition tr8: State3 -> State2 {
+ triggers {
+ <c:fct>
+ }
+ }
+ Transition tr9: my tp1 -> State2 {
+ triggers {
+ <timerTick:timer>
+ }
+ }
+ }
+ }
+ }
+
+ ActorClass ADerived extends ATest {
+ Interface {
+ Port port : PTest3
+ }
+ Structure {
+ external Port port
+ }
+ Behavior {
+ StateMachine {
+ RefinedState State3 {
+ subgraph {
+ State State4 {}
+ EntryPoint tp6
+ TransitionPoint tp7
+ Transition tr8: my tp6 -> State2 {}
+ Transition tr9: my tp7 -> my tp7 {
+ triggers {
+ <z:subp>
+ }
+ }
+ Transition tr10a: State2 -> State4 {
+ triggers {
+ <y:subp>
+ }
+ }
+ Transition tr11a: State4 -> my tp3 {
+ triggers {
+ <z:subp>
+ }
+ }
+ }
+ }
+ RefinedState State4 {
+ subgraph {
+ State State1 {}
+ State State2 {}
+ Transition tr0: initial -> State1 {}
+ Transition tr1: State1 -> State2 {
+ triggers {
+ <a:port>
+ }
+ }
+ }
+ }
+ State State5 {}
+ Transition tr10: State1 -> State5 {
+ triggers {
+ <a:port>
+ }
+ }
+ Transition tr11: cp CP1 -> State5 {
+ cond {
+ "data==4"
+ }
+ }
+ Transition tr12: State5 -> tp6 of State3 {
+ triggers {
+ <a:port>
+ }
+ }
+ }
+ }
+ }
+
+}
diff --git a/tests/org.eclipse.etrice.core.genmodel.tests/models/states_triggers.room b/tests/org.eclipse.etrice.core.genmodel.tests/models/states_triggers.room
index 63b581c04..9d61c910c 100644
--- a/tests/org.eclipse.etrice.core.genmodel.tests/models/states_triggers.room
+++ b/tests/org.eclipse.etrice.core.genmodel.tests/models/states_triggers.room
@@ -1,176 +1,176 @@
-RoomModel states_trigers {
-
- PrimitiveType int32: ptInteger -> int32 (Integer) default "0"
-
- ProtocolClass PTimer {
- incoming {
- Message start (time_ms : int32)
- Message kill ()
- }
- outgoing {
- Message timerTick ()
- }
- }
-
- ProtocolClass PTimeout {
- incoming {
- Message start (time_ms : int32)
- Message kill ()
- }
- outgoing {
- Message timeoutTick ()
- }
- }
-
- ActorClass ATimingService {
- Interface {
- SPP timerSPP: PTimer
- SPP timeoutSPP: PTimeout
- }
- Structure {
- ServiceImplementation of timerSPP
- ServiceImplementation of timeoutSPP
- }
- }
-
- ProtocolClass PTest1 {
- incoming {
- Message a ()
- Message b (x : int32)
- Message c ()
- }
- outgoing {
- Message x ()
- }
- }
-
- ProtocolClass PTest2 {
- incoming {
- Message x ()
- Message y ()
- Message z ()
- }
- outgoing {
- Message a ()
- }
- }
-
- SubSystemClass CMain {
- ActorRef application : AApplication_CMain
- ActorRef timingService : ATimingService
-
- LayerConnection ref application satisfied_by timingService.timerSPP
- LayerConnection ref application satisfied_by timingService.timeoutSPP
- }
-
- // automatically inserted AApplication_CMain
- ActorClass AApplication_CMain {
- Structure {
- ActorRef test : ATest
- }
- }
-
- ActorClass ATest {
- Interface {
- Port fct : PTest1
- }
- Structure {
- external Port fct
- Port subp : PTest2
- SAP timer: PTimer
- SAP timeout: PTimeout
- }
- Behavior {
- StateMachine {
- State State1 {}
- State State2 {}
- State State3 {
- subgraph {
- State State1 {}
- State State2 {}
- State State3 {}
- EntryPoint tp1
- TransitionPoint tp2
- ExitPoint tp3
- handler TransitionPoint tp5
- Transition tr0: initial -> State1 {}
- Transition tr1: my tp1 -> State3 {}
- Transition tr2: State1 -> State2 {
- triggers {
- <b:fct>
- }
- }
- Transition tr3: State2 -> State3 {
- triggers {
- <x:subp>
- }
- }
- Transition tr4: State3 -> State1 {
- triggers {
- <a:fct>
- }
- }
- Transition tr5: my tp2 -> State3 {
- triggers {
- <b:fct>
- }
- }
- Transition tr6: State3 -> my tp3 {
- triggers {
- <y:subp>
- }
- }
- Transition tr7: my tp5 -> my tp5 {
- triggers {
- <timeoutTick:timeout>
- }
- }
- }
- }
- State State4 {}
- TransitionPoint tp0
- TransitionPoint tp1
- ChoicePoint CP1
- Transition tr0: initial -> State1 {}
- Transition tr1: State1 -> State2 {
- triggers {
- <a:fct>
- }
- }
- Transition tr2: State2 -> cp CP1 {
- triggers {
- <b:fct>
- }
- }
- Transition tr3: cp CP1 -> State1 {}
- Transition tr4: cp CP1 -> State3 {
- cond {
- "data==2"
- }
- }
- Transition tr5: my tp0 -> tp1 of State3 {
- triggers {
- <a:fct>
- }
- }
- Transition tr6: cp CP1 -> State4 {
- cond {
- "data==3"
- }
- }
- Transition tr7: tp3 of State3 -> State2 {}
- Transition tr8: State3 -> State2 {
- triggers {
- <c:fct>
- }
- }
- Transition tr9: my tp1 -> State2 {
- triggers {
- <timerTick:timer>
- }
- }
- }
- }
- }
-
-}
+RoomModel states_trigers {
+
+ PrimitiveType int32: ptInteger -> int32 (Integer) default "0"
+
+ ProtocolClass PTimer {
+ incoming {
+ Message start (time_ms : int32)
+ Message kill ()
+ }
+ outgoing {
+ Message timerTick ()
+ }
+ }
+
+ ProtocolClass PTimeout {
+ incoming {
+ Message start (time_ms : int32)
+ Message kill ()
+ }
+ outgoing {
+ Message timeoutTick ()
+ }
+ }
+
+ ActorClass ATimingService {
+ Interface {
+ SPP timerSPP: PTimer
+ SPP timeoutSPP: PTimeout
+ }
+ Structure {
+ ServiceImplementation of timerSPP
+ ServiceImplementation of timeoutSPP
+ }
+ }
+
+ ProtocolClass PTest1 {
+ incoming {
+ Message a ()
+ Message b (x : int32)
+ Message c ()
+ }
+ outgoing {
+ Message x ()
+ }
+ }
+
+ ProtocolClass PTest2 {
+ incoming {
+ Message x ()
+ Message y ()
+ Message z ()
+ }
+ outgoing {
+ Message a ()
+ }
+ }
+
+ SubSystemClass CMain {
+ ActorRef application : AApplication_CMain
+ ActorRef timingService : ATimingService
+
+ LayerConnection ref application satisfied_by timingService.timerSPP
+ LayerConnection ref application satisfied_by timingService.timeoutSPP
+ }
+
+ // automatically inserted AApplication_CMain
+ ActorClass AApplication_CMain {
+ Structure {
+ ActorRef test : ATest
+ }
+ }
+
+ ActorClass ATest {
+ Interface {
+ Port fct : PTest1
+ }
+ Structure {
+ external Port fct
+ Port subp : PTest2
+ SAP timer: PTimer
+ SAP timeout: PTimeout
+ }
+ Behavior {
+ StateMachine {
+ State State1 {}
+ State State2 {}
+ State State3 {
+ subgraph {
+ State State1 {}
+ State State2 {}
+ State State3 {}
+ EntryPoint tp1
+ TransitionPoint tp2
+ ExitPoint tp3
+ handler TransitionPoint tp5
+ Transition tr0: initial -> State1 {}
+ Transition tr1: my tp1 -> State3 {}
+ Transition tr2: State1 -> State2 {
+ triggers {
+ <b:fct>
+ }
+ }
+ Transition tr3: State2 -> State3 {
+ triggers {
+ <x:subp>
+ }
+ }
+ Transition tr4: State3 -> State1 {
+ triggers {
+ <a:fct>
+ }
+ }
+ Transition tr5: my tp2 -> State3 {
+ triggers {
+ <b:fct>
+ }
+ }
+ Transition tr6: State3 -> my tp3 {
+ triggers {
+ <y:subp>
+ }
+ }
+ Transition tr7: my tp5 -> my tp5 {
+ triggers {
+ <timeoutTick:timeout>
+ }
+ }
+ }
+ }
+ State State4 {}
+ TransitionPoint tp0
+ TransitionPoint tp1
+ ChoicePoint CP1
+ Transition tr0: initial -> State1 {}
+ Transition tr1: State1 -> State2 {
+ triggers {
+ <a:fct>
+ }
+ }
+ Transition tr2: State2 -> cp CP1 {
+ triggers {
+ <b:fct>
+ }
+ }
+ Transition tr3: cp CP1 -> State1 {}
+ Transition tr4: cp CP1 -> State3 {
+ cond {
+ "data==2"
+ }
+ }
+ Transition tr5: my tp0 -> tp1 of State3 {
+ triggers {
+ <a:fct>
+ }
+ }
+ Transition tr6: cp CP1 -> State4 {
+ cond {
+ "data==3"
+ }
+ }
+ Transition tr7: tp3 of State3 -> State2 {}
+ Transition tr8: State3 -> State2 {
+ triggers {
+ <c:fct>
+ }
+ }
+ Transition tr9: my tp1 -> State2 {
+ triggers {
+ <timerTick:timer>
+ }
+ }
+ }
+ }
+ }
+
+}
diff --git a/tests/org.eclipse.etrice.core.genmodel.tests/models/structure_inheritance.room b/tests/org.eclipse.etrice.core.genmodel.tests/models/structure_inheritance.room
index 126b16259..c10b681c5 100644
--- a/tests/org.eclipse.etrice.core.genmodel.tests/models/structure_inheritance.room
+++ b/tests/org.eclipse.etrice.core.genmodel.tests/models/structure_inheritance.room
@@ -1,208 +1,208 @@
-RoomModel structure_inherit {
-
- PrimitiveType int32: ptInteger -> int32 (Integer) default "0"
-
- ProtocolClass PTimer {
- incoming {
- Message start (time_ms : int32)
- Message kill ()
- }
- outgoing {
- Message timerTick ()
- }
- }
-
- ProtocolClass PTimeout {
- incoming {
- Message start (time_ms : int32)
- Message kill ()
- }
- outgoing {
- Message timeoutTick ()
- }
- }
-
- ActorClass ATimingService {
- Interface {
- SPP timerSPP: PTimer
- SPP timeoutSPP: PTimeout
- }
- Structure {
- ServiceImplementation of timerSPP
- ServiceImplementation of timeoutSPP
- }
- }
-
- ProtocolClass PBase {
- incoming {
- Message a ()
- Message b ()
- }
- outgoing {
- Message x ()
- Message y ()
- }
- }
-
- ProtocolClass PFunctionA {
- incoming {
- Message d ()
- Message e ()
- }
- outgoing {
- Message r ()
- Message s ()
- }
- }
-
- ProtocolClass PControl {
- incoming {
- Message c ()
- }
- outgoing {
- Message d ()
- }
- }
-
- ProtocolClass PFunctionB {
- incoming {
- Message h ()
- }
- outgoing {
- Message i ()
- }
- }
-
- SubSystemClass CMain {
- ActorRef application : AApplication_CMain
- ActorRef timingService : ATimingService
-
- LayerConnection ref application satisfied_by timingService.timerSPP
- LayerConnection ref application satisfied_by timingService.timeoutSPP
- }
-
- // automatically inserted AApplication_CMain
- ActorClass AApplication_CMain {
- Structure {
- ActorRef controller : AController
- ActorRef fcta : AFunctionA
- ActorRef fctb : AFunctionB
- ActorRef client : AClient
- Binding controller.base and fcta.base
- Binding controller.ctrl and fcta.ctrl
- Binding controller.base and fctb.base
- Binding controller.ctrl and fctb.ctrl
- Binding controller.base and client.base
- Binding controller.ctrl and client.ctrl
- Binding fcta.fct1 and client.pa1
- Binding fctb.fct and client.pb
- Binding client.pa2 and fcta.fct2
- }
- }
-
- ActorClass ACommonBase {
- Interface {
- Port base : PBase
- }
- Structure {
- external Port base
- conjugated Port subbase [10] : PBase
- }
- Behavior {
- }
- }
-
- ActorClass AControl extends ACommonBase {
- Interface {
- Port ctrl : PControl
- }
- Structure {
- external Port ctrl
- conjugated Port subctrl [10] : PControl
- SAP ctrltimeout: PTimeout
- }
- Behavior {
- }
- }
-
- ActorClass ABaseController {
- Interface {
- conjugated Port base [10] : PBase
- }
- Structure {
- external Port base
- }
- Behavior {
- }
- }
-
- ActorClass AController extends ABaseController {
- Interface {
- conjugated Port ctrl [10] : PControl
- }
- Structure {
- external Port ctrl
- }
- Behavior {
- }
- }
-
- ActorClass ASubA extends AControl {
- Interface {
- Port fct : PFunctionA
- }
- Structure {
- external Port fct
- SAP timeout: PTimeout
- }
- Behavior {
- }
- }
-
- ActorClass AFunctionA extends AControl {
- Interface {
- Port fct1 : PFunctionA
- Port fct2 : PFunctionA
- }
- Structure {
- SAP timeout: PTimeout
- ActorRef sub1 : ASubA
- ActorRef sub2 : ASubA
- Binding subbase and sub1.base
- Binding subctrl and sub1.ctrl
- Binding subbase and sub2.base
- Binding subctrl and sub2.ctrl
- Binding fct1 and sub2.fct
- Binding fct2 and sub1.fct
- }
- Behavior {
- }
- }
-
- ActorClass AFunctionB extends AControl {
- Interface {
- Port fct : PFunctionB
- }
- Structure {
- external Port fct
- }
- Behavior {
- }
- }
-
- ActorClass AClient extends AControl {
- Interface {
- conjugated Port pa1 : PFunctionA
- conjugated Port pb : PFunctionB
- conjugated Port pa2 : PFunctionA
- }
- Structure {
- external Port pa1
- external Port pb
- external Port pa2
- }
- Behavior {
- }
- }
-
-}
+RoomModel structure_inherit {
+
+ PrimitiveType int32: ptInteger -> int32 (Integer) default "0"
+
+ ProtocolClass PTimer {
+ incoming {
+ Message start (time_ms : int32)
+ Message kill ()
+ }
+ outgoing {
+ Message timerTick ()
+ }
+ }
+
+ ProtocolClass PTimeout {
+ incoming {
+ Message start (time_ms : int32)
+ Message kill ()
+ }
+ outgoing {
+ Message timeoutTick ()
+ }
+ }
+
+ ActorClass ATimingService {
+ Interface {
+ SPP timerSPP: PTimer
+ SPP timeoutSPP: PTimeout
+ }
+ Structure {
+ ServiceImplementation of timerSPP
+ ServiceImplementation of timeoutSPP
+ }
+ }
+
+ ProtocolClass PBase {
+ incoming {
+ Message a ()
+ Message b ()
+ }
+ outgoing {
+ Message x ()
+ Message y ()
+ }
+ }
+
+ ProtocolClass PFunctionA {
+ incoming {
+ Message d ()
+ Message e ()
+ }
+ outgoing {
+ Message r ()
+ Message s ()
+ }
+ }
+
+ ProtocolClass PControl {
+ incoming {
+ Message c ()
+ }
+ outgoing {
+ Message d ()
+ }
+ }
+
+ ProtocolClass PFunctionB {
+ incoming {
+ Message h ()
+ }
+ outgoing {
+ Message i ()
+ }
+ }
+
+ SubSystemClass CMain {
+ ActorRef application : AApplication_CMain
+ ActorRef timingService : ATimingService
+
+ LayerConnection ref application satisfied_by timingService.timerSPP
+ LayerConnection ref application satisfied_by timingService.timeoutSPP
+ }
+
+ // automatically inserted AApplication_CMain
+ ActorClass AApplication_CMain {
+ Structure {
+ ActorRef controller : AController
+ ActorRef fcta : AFunctionA
+ ActorRef fctb : AFunctionB
+ ActorRef client : AClient
+ Binding controller.base and fcta.base
+ Binding controller.ctrl and fcta.ctrl
+ Binding controller.base and fctb.base
+ Binding controller.ctrl and fctb.ctrl
+ Binding controller.base and client.base
+ Binding controller.ctrl and client.ctrl
+ Binding fcta.fct1 and client.pa1
+ Binding fctb.fct and client.pb
+ Binding client.pa2 and fcta.fct2
+ }
+ }
+
+ ActorClass ACommonBase {
+ Interface {
+ Port base : PBase
+ }
+ Structure {
+ external Port base
+ conjugated Port subbase [10] : PBase
+ }
+ Behavior {
+ }
+ }
+
+ ActorClass AControl extends ACommonBase {
+ Interface {
+ Port ctrl : PControl
+ }
+ Structure {
+ external Port ctrl
+ conjugated Port subctrl [10] : PControl
+ SAP ctrltimeout: PTimeout
+ }
+ Behavior {
+ }
+ }
+
+ ActorClass ABaseController {
+ Interface {
+ conjugated Port base [10] : PBase
+ }
+ Structure {
+ external Port base
+ }
+ Behavior {
+ }
+ }
+
+ ActorClass AController extends ABaseController {
+ Interface {
+ conjugated Port ctrl [10] : PControl
+ }
+ Structure {
+ external Port ctrl
+ }
+ Behavior {
+ }
+ }
+
+ ActorClass ASubA extends AControl {
+ Interface {
+ Port fct : PFunctionA
+ }
+ Structure {
+ external Port fct
+ SAP timeout: PTimeout
+ }
+ Behavior {
+ }
+ }
+
+ ActorClass AFunctionA extends AControl {
+ Interface {
+ Port fct1 : PFunctionA
+ Port fct2 : PFunctionA
+ }
+ Structure {
+ SAP timeout: PTimeout
+ ActorRef sub1 : ASubA
+ ActorRef sub2 : ASubA
+ Binding subbase and sub1.base
+ Binding subctrl and sub1.ctrl
+ Binding subbase and sub2.base
+ Binding subctrl and sub2.ctrl
+ Binding fct1 and sub2.fct
+ Binding fct2 and sub1.fct
+ }
+ Behavior {
+ }
+ }
+
+ ActorClass AFunctionB extends AControl {
+ Interface {
+ Port fct : PFunctionB
+ }
+ Structure {
+ external Port fct
+ }
+ Behavior {
+ }
+ }
+
+ ActorClass AClient extends AControl {
+ Interface {
+ conjugated Port pa1 : PFunctionA
+ conjugated Port pb : PFunctionB
+ conjugated Port pa2 : PFunctionA
+ }
+ Structure {
+ external Port pa1
+ external Port pb
+ external Port pa2
+ }
+ Behavior {
+ }
+ }
+
+}
diff --git a/tests/org.eclipse.etrice.core.genmodel.tests/models/test.room b/tests/org.eclipse.etrice.core.genmodel.tests/models/test.room
index 6a608fc09..0e0549f18 100644
--- a/tests/org.eclipse.etrice.core.genmodel.tests/models/test.room
+++ b/tests/org.eclipse.etrice.core.genmodel.tests/models/test.room
@@ -1,30 +1,30 @@
-RoomModel test {
- ProtocolClass MyProtocol {
- incoming {
- Message in1()
- }
- outgoing {
- }
- }
-
- ActorClass Base {
- Interface {
- Port p: MyProtocol
- }
- Behavior {
- StateMachine {
- State sBase {}
- }
- }
- }
-
- ActorClass Derived extends Base {
- Behavior {
- StateMachine {
- State s {}
- State y {}
- RefinedState sBase {}
- }
- }
- }
-}
+RoomModel test {
+ ProtocolClass MyProtocol {
+ incoming {
+ Message in1()
+ }
+ outgoing {
+ }
+ }
+
+ ActorClass Base {
+ Interface {
+ Port p: MyProtocol
+ }
+ Behavior {
+ StateMachine {
+ State sBase {}
+ }
+ }
+ }
+
+ ActorClass Derived extends Base {
+ Behavior {
+ StateMachine {
+ State s {}
+ State y {}
+ RefinedState sBase {}
+ }
+ }
+ }
+}
diff --git a/tests/org.eclipse.etrice.core.genmodel.tests/org.eclipse.etrice.core.genmodel.tests.launch b/tests/org.eclipse.etrice.core.genmodel.tests/org.eclipse.etrice.core.genmodel.tests.launch
index 5d321c2ce..b571ac0d3 100644
--- a/tests/org.eclipse.etrice.core.genmodel.tests/org.eclipse.etrice.core.genmodel.tests.launch
+++ b/tests/org.eclipse.etrice.core.genmodel.tests/org.eclipse.etrice.core.genmodel.tests.launch
@@ -1,40 +1,40 @@
-<?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="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.etrice.core.genmodel.tests"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="4"/>
-</listAttribute>
-<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=org.eclipse.etrice.core.genmodel.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.core.genmodel.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="-ea&#13;&#10;-Xmx512m&#13;&#10;-Xms128m&#13;&#10;-XX:PermSize=32m&#13;&#10;-XX:MaxPermSize=256m&#13;&#10;-Dfile.encoding=UTF-8&#13;&#10;-Dosgi.requiredJavaVersion=1.5"/>
-<stringAttribute key="pde.version" value="3.3"/>
-<stringAttribute key="product" value="org.eclipse.sdk.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="false"/>
-<booleanAttribute key="useProduct" value="true"/>
-</launchConfiguration>
+<?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="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.etrice.core.genmodel.tests"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="4"/>
+</listAttribute>
+<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=org.eclipse.etrice.core.genmodel.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.core.genmodel.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="-ea&#13;&#10;-Xmx512m&#13;&#10;-Xms128m&#13;&#10;-XX:PermSize=32m&#13;&#10;-XX:MaxPermSize=256m&#13;&#10;-Dfile.encoding=UTF-8&#13;&#10;-Dosgi.requiredJavaVersion=1.5"/>
+<stringAttribute key="pde.version" value="3.3"/>
+<stringAttribute key="product" value="org.eclipse.sdk.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="false"/>
+<booleanAttribute key="useProduct" value="true"/>
+</launchConfiguration>
diff --git a/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/GenmodelTestsActivator.java b/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/GenmodelTestsActivator.java
index 481455cb1..4525da47a 100644
--- a/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/GenmodelTestsActivator.java
+++ b/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/GenmodelTestsActivator.java
@@ -1,22 +1,22 @@
-package org.eclipse.etrice.core.genmodel;
-
-import org.eclipse.core.runtime.Plugin;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-
-public class GenmodelTestsActivator extends Plugin implements BundleActivator {
-
- private static GenmodelTestsActivator instance = null;
-
- public static GenmodelTestsActivator getInstance() {
- return instance;
- }
-
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
-
- instance = this;
- }
-
-}
+package org.eclipse.etrice.core.genmodel;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class GenmodelTestsActivator extends Plugin implements BundleActivator {
+
+ private static GenmodelTestsActivator instance = null;
+
+ public static GenmodelTestsActivator getInstance() {
+ return instance;
+ }
+
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+
+ instance = this;
+ }
+
+}
diff --git a/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestCodeInheritance.java b/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestCodeInheritance.java
index 111c99145..14ab0a1b8 100644
--- a/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestCodeInheritance.java
+++ b/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestCodeInheritance.java
@@ -1,124 +1,124 @@
-/*******************************************************************************
- * Copyright (c) 2012 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.genmodel;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.etrice.core.genmodel.etricegen.ETriceGenPackage;
-import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass;
-import org.eclipse.etrice.core.genmodel.etricegen.ExpandedRefinedState;
-import org.eclipse.etrice.core.genmodel.etricegen.Root;
-import org.eclipse.etrice.core.room.RoomPackage;
-import org.eclipse.etrice.core.room.State;
-import org.eclipse.etrice.core.room.util.RoomHelpers;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * @author Henrik Rentz-Reichert
- *
- */
-public class TestCodeInheritance extends TestInstanceModelBuilderBase {
-
- private Root root;
- private HashMap<EClass, ArrayList<EObject>> baseInstances;
- private HashMap<EClass, ArrayList<EObject>> derivedInstances;
- private ExpandedActorClass base;
- private ExpandedActorClass derived;
-
- @Before
- public void setUp() {
- prepare();
-
- root = buildInstanceModel("code_inheritance.room");
- base = getActor("Base");
- derived = getActor("Deriv");
- baseInstances = collectInstances(base);
- derivedInstances = collectInstances(derived);
- }
-
- private ExpandedActorClass getActor(String name) {
- for (ExpandedActorClass xpac : root.getXpActorClasses()) {
- if (xpac.getActorClass().getName().equals(name))
- return xpac;
- }
- return null;
- }
-
- private State getState(ExpandedActorClass xpac, String name) {
- for (State s : xpac.getStateMachine().getStates()) {
- if (s.getName().equals(name))
- return s;
- }
- return null;
- }
-
- @Test
- public void testNumbers() {
- assertEquals("number of states", 6, baseInstances.get(RoomPackage.eINSTANCE.getSimpleState()).size());
- assertNull("number of choice points", baseInstances.get(RoomPackage.eINSTANCE.getChoicePoint()));
- assertNull("number of transition points", baseInstances.get(RoomPackage.eINSTANCE.getTransitionPoint()));
- assertNull("number of entry points", baseInstances.get(RoomPackage.eINSTANCE.getEntryPoint()));
- assertNull("number of exit points", baseInstances.get(RoomPackage.eINSTANCE.getExitPoint()));
- assertEquals("number of initial transitions", 3, baseInstances.get(RoomPackage.eINSTANCE.getInitialTransition()).size());
- assertEquals("number of triggered transitions", 3, baseInstances.get(RoomPackage.eINSTANCE.getTriggeredTransition()).size());
- assertNull("number of continuation transitions", baseInstances.get(RoomPackage.eINSTANCE.getContinuationTransition()));
- assertNull("number of branch transitions", baseInstances.get(RoomPackage.eINSTANCE.getCPBranchTransition()));
-
- assertEquals("number of states", 4, derivedInstances.get(RoomPackage.eINSTANCE.getSimpleState()).size());
- assertEquals("number of states", 3, derivedInstances.get(ETriceGenPackage.eINSTANCE.getExpandedRefinedState()).size());
- assertNull("number of choice points", derivedInstances.get(RoomPackage.eINSTANCE.getChoicePoint()));
- assertNull("number of transition points", derivedInstances.get(RoomPackage.eINSTANCE.getTransitionPoint()));
- assertNull("number of entry points", derivedInstances.get(RoomPackage.eINSTANCE.getEntryPoint()));
- assertNull("number of exit points", derivedInstances.get(RoomPackage.eINSTANCE.getExitPoint()));
- assertEquals("number of initial transitions", 4, derivedInstances.get(RoomPackage.eINSTANCE.getInitialTransition()).size());
- assertEquals("number of triggered transitions", 3, derivedInstances.get(RoomPackage.eINSTANCE.getTriggeredTransition()).size());
- assertNull("number of continuation transitions", derivedInstances.get(RoomPackage.eINSTANCE.getContinuationTransition()));
- assertNull("number of branch transitions", derivedInstances.get(RoomPackage.eINSTANCE.getCPBranchTransition()));
- }
-
- @Test
- public void testActionCodes() {
- State s = getState(derived, "BaseEntryExit");
- assertTrue("is ExpandedRefinedState", s instanceof ExpandedRefinedState);
- ExpandedRefinedState rs = (ExpandedRefinedState) s;
- assertEquals("entry code", "// derived entry\n", RoomHelpers.getDetailCode(rs.getEntryCode()));
- assertNull("exit code", rs.getExitCode());
- assertEquals("inherited entry", "// base entry\n", RoomHelpers.getDetailCode(rs.getInheritedEntry()));
- assertEquals("inherited exit", "// base exit\n", RoomHelpers.getDetailCode(rs.getInheritedExit()));
-
- s = getState(derived, "Base");
- assertTrue("is ExpandedRefinedState", s instanceof ExpandedRefinedState);
- rs = (ExpandedRefinedState) s;
- assertNull("entry code", rs.getEntryCode());
- assertEquals("exit code", "// derived exit\n", RoomHelpers.getDetailCode(rs.getExitCode()));
- assertEquals("inherited entry", "", RoomHelpers.getDetailCode(rs.getInheritedEntry()));
- assertEquals("inherited exit", "", RoomHelpers.getDetailCode(rs.getInheritedExit()));
-
- s = getState(derived, "BaseSub");
- assertTrue("is ExpandedRefinedState", s instanceof ExpandedRefinedState);
- rs = (ExpandedRefinedState) s;
- assertEquals("entry code", "// derived entry\n", RoomHelpers.getDetailCode(rs.getEntryCode()));
- assertNull("exit code", rs.getExitCode());
- assertEquals("inherited entry", "", RoomHelpers.getDetailCode(rs.getInheritedEntry()));
- assertEquals("inherited exit", "", RoomHelpers.getDetailCode(rs.getInheritedExit()));
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2012 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.genmodel;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.etrice.core.genmodel.etricegen.ETriceGenPackage;
+import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass;
+import org.eclipse.etrice.core.genmodel.etricegen.ExpandedRefinedState;
+import org.eclipse.etrice.core.genmodel.etricegen.Root;
+import org.eclipse.etrice.core.room.RoomPackage;
+import org.eclipse.etrice.core.room.State;
+import org.eclipse.etrice.core.room.util.RoomHelpers;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * @author Henrik Rentz-Reichert
+ *
+ */
+public class TestCodeInheritance extends TestInstanceModelBuilderBase {
+
+ private Root root;
+ private HashMap<EClass, ArrayList<EObject>> baseInstances;
+ private HashMap<EClass, ArrayList<EObject>> derivedInstances;
+ private ExpandedActorClass base;
+ private ExpandedActorClass derived;
+
+ @Before
+ public void setUp() {
+ prepare();
+
+ root = buildInstanceModel("code_inheritance.room");
+ base = getActor("Base");
+ derived = getActor("Deriv");
+ baseInstances = collectInstances(base);
+ derivedInstances = collectInstances(derived);
+ }
+
+ private ExpandedActorClass getActor(String name) {
+ for (ExpandedActorClass xpac : root.getXpActorClasses()) {
+ if (xpac.getActorClass().getName().equals(name))
+ return xpac;
+ }
+ return null;
+ }
+
+ private State getState(ExpandedActorClass xpac, String name) {
+ for (State s : xpac.getStateMachine().getStates()) {
+ if (s.getName().equals(name))
+ return s;
+ }
+ return null;
+ }
+
+ @Test
+ public void testNumbers() {
+ assertEquals("number of states", 6, baseInstances.get(RoomPackage.eINSTANCE.getSimpleState()).size());
+ assertNull("number of choice points", baseInstances.get(RoomPackage.eINSTANCE.getChoicePoint()));
+ assertNull("number of transition points", baseInstances.get(RoomPackage.eINSTANCE.getTransitionPoint()));
+ assertNull("number of entry points", baseInstances.get(RoomPackage.eINSTANCE.getEntryPoint()));
+ assertNull("number of exit points", baseInstances.get(RoomPackage.eINSTANCE.getExitPoint()));
+ assertEquals("number of initial transitions", 3, baseInstances.get(RoomPackage.eINSTANCE.getInitialTransition()).size());
+ assertEquals("number of triggered transitions", 3, baseInstances.get(RoomPackage.eINSTANCE.getTriggeredTransition()).size());
+ assertNull("number of continuation transitions", baseInstances.get(RoomPackage.eINSTANCE.getContinuationTransition()));
+ assertNull("number of branch transitions", baseInstances.get(RoomPackage.eINSTANCE.getCPBranchTransition()));
+
+ assertEquals("number of states", 4, derivedInstances.get(RoomPackage.eINSTANCE.getSimpleState()).size());
+ assertEquals("number of states", 3, derivedInstances.get(ETriceGenPackage.eINSTANCE.getExpandedRefinedState()).size());
+ assertNull("number of choice points", derivedInstances.get(RoomPackage.eINSTANCE.getChoicePoint()));
+ assertNull("number of transition points", derivedInstances.get(RoomPackage.eINSTANCE.getTransitionPoint()));
+ assertNull("number of entry points", derivedInstances.get(RoomPackage.eINSTANCE.getEntryPoint()));
+ assertNull("number of exit points", derivedInstances.get(RoomPackage.eINSTANCE.getExitPoint()));
+ assertEquals("number of initial transitions", 4, derivedInstances.get(RoomPackage.eINSTANCE.getInitialTransition()).size());
+ assertEquals("number of triggered transitions", 3, derivedInstances.get(RoomPackage.eINSTANCE.getTriggeredTransition()).size());
+ assertNull("number of continuation transitions", derivedInstances.get(RoomPackage.eINSTANCE.getContinuationTransition()));
+ assertNull("number of branch transitions", derivedInstances.get(RoomPackage.eINSTANCE.getCPBranchTransition()));
+ }
+
+ @Test
+ public void testActionCodes() {
+ State s = getState(derived, "BaseEntryExit");
+ assertTrue("is ExpandedRefinedState", s instanceof ExpandedRefinedState);
+ ExpandedRefinedState rs = (ExpandedRefinedState) s;
+ assertEquals("entry code", "// derived entry\n", RoomHelpers.getDetailCode(rs.getEntryCode()));
+ assertNull("exit code", rs.getExitCode());
+ assertEquals("inherited entry", "// base entry\n", RoomHelpers.getDetailCode(rs.getInheritedEntry()));
+ assertEquals("inherited exit", "// base exit\n", RoomHelpers.getDetailCode(rs.getInheritedExit()));
+
+ s = getState(derived, "Base");
+ assertTrue("is ExpandedRefinedState", s instanceof ExpandedRefinedState);
+ rs = (ExpandedRefinedState) s;
+ assertNull("entry code", rs.getEntryCode());
+ assertEquals("exit code", "// derived exit\n", RoomHelpers.getDetailCode(rs.getExitCode()));
+ assertEquals("inherited entry", "", RoomHelpers.getDetailCode(rs.getInheritedEntry()));
+ assertEquals("inherited exit", "", RoomHelpers.getDetailCode(rs.getInheritedExit()));
+
+ s = getState(derived, "BaseSub");
+ assertTrue("is ExpandedRefinedState", s instanceof ExpandedRefinedState);
+ rs = (ExpandedRefinedState) s;
+ assertEquals("entry code", "// derived entry\n", RoomHelpers.getDetailCode(rs.getEntryCode()));
+ assertNull("exit code", rs.getExitCode());
+ assertEquals("inherited entry", "", RoomHelpers.getDetailCode(rs.getInheritedEntry()));
+ assertEquals("inherited exit", "", RoomHelpers.getDetailCode(rs.getInheritedExit()));
+ }
+
+}
diff --git a/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestCompoundProtocol.java b/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestCompoundProtocol.java
index ef0b4899c..fb4bb2b59 100644
--- a/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestCompoundProtocol.java
+++ b/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestCompoundProtocol.java
@@ -1,92 +1,92 @@
-/*******************************************************************************
- * Copyright (c) 2012 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.genmodel;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.HashMap;
-
-import org.eclipse.emf.common.util.TreeIterator;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.etrice.core.genmodel.etricegen.InstanceBase;
-import org.eclipse.etrice.core.genmodel.etricegen.PortInstance;
-import org.eclipse.etrice.core.genmodel.etricegen.Root;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * @author Henrik Rentz-Reichert
- *
- */
-public class TestCompoundProtocol extends TestInstanceModelBuilderBase {
-
- private Root root;
- private HashMap<String, InstanceBase> path2inst = new HashMap<String, InstanceBase>();
-
- @Before
- public void setUp() {
- prepare();
-
- root = buildInstanceModel("compound.room");
-
- TreeIterator<EObject> it = root.eAllContents();
- while (it.hasNext()) {
- EObject obj = it.next();
- if (obj instanceof InstanceBase)
- path2inst.put(((InstanceBase) obj).getPath(), (InstanceBase) obj);
- }
- }
-
- private PortInstance getPort(String path) {
- return (PortInstance) path2inst.get(path);
- }
-
- @Test
- public void checkPeers() {
- PortInstance pi = getPort("/Main/appl/reg/p0");
- assertEquals("port peers of "+pi.getPath(), 1, pi.getPeers().size());
-
- pi = getPort("/Main/appl/conj/p0");
- assertEquals("port peers of "+pi.getPath(), 1, pi.getPeers().size());
-
- pi = getPort("/Main/appl/ref0/red");
- assertEquals("port peers of "+pi.getPath(), 1, pi.getPeers().size());
-
- pi = getPort("/Main/appl/ref0/green");
- assertEquals("port peers of "+pi.getPath(), 1, pi.getPeers().size());
-
- pi = getPort("/Main/appl/ref0/blue");
- assertEquals("port peers of "+pi.getPath(), 1, pi.getPeers().size());
-
- pi = getPort("/Main/appl/ref0/extra");
- assertEquals("port peers of "+pi.getPath(), 1, pi.getPeers().size());
-
- pi = getPort("/Main/appl/ref0/suppl");
- assertEquals("port peers of "+pi.getPath(), 1, pi.getPeers().size());
-
- pi = getPort("/Main/appl/wrap/ref0/ref0/red");
- assertEquals("port peers of "+pi.getPath(), 1, pi.getPeers().size());
-
- pi = getPort("/Main/appl/wrap/ref0/ref0/green");
- assertEquals("port peers of "+pi.getPath(), 1, pi.getPeers().size());
-
- pi = getPort("/Main/appl/wrap/ref0/ref0/blue");
- assertEquals("port peers of "+pi.getPath(), 1, pi.getPeers().size());
-
- pi = getPort("/Main/appl/wrap/ref0/ref0/extra");
- assertEquals("port peers of "+pi.getPath(), 1, pi.getPeers().size());
-
- pi = getPort("/Main/appl/wrap/ref0/ref0/suppl");
- assertEquals("port peers of "+pi.getPath(), 1, pi.getPeers().size());
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 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.genmodel;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.HashMap;
+
+import org.eclipse.emf.common.util.TreeIterator;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.etrice.core.genmodel.etricegen.InstanceBase;
+import org.eclipse.etrice.core.genmodel.etricegen.PortInstance;
+import org.eclipse.etrice.core.genmodel.etricegen.Root;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * @author Henrik Rentz-Reichert
+ *
+ */
+public class TestCompoundProtocol extends TestInstanceModelBuilderBase {
+
+ private Root root;
+ private HashMap<String, InstanceBase> path2inst = new HashMap<String, InstanceBase>();
+
+ @Before
+ public void setUp() {
+ prepare();
+
+ root = buildInstanceModel("compound.room");
+
+ TreeIterator<EObject> it = root.eAllContents();
+ while (it.hasNext()) {
+ EObject obj = it.next();
+ if (obj instanceof InstanceBase)
+ path2inst.put(((InstanceBase) obj).getPath(), (InstanceBase) obj);
+ }
+ }
+
+ private PortInstance getPort(String path) {
+ return (PortInstance) path2inst.get(path);
+ }
+
+ @Test
+ public void checkPeers() {
+ PortInstance pi = getPort("/Main/appl/reg/p0");
+ assertEquals("port peers of "+pi.getPath(), 1, pi.getPeers().size());
+
+ pi = getPort("/Main/appl/conj/p0");
+ assertEquals("port peers of "+pi.getPath(), 1, pi.getPeers().size());
+
+ pi = getPort("/Main/appl/ref0/red");
+ assertEquals("port peers of "+pi.getPath(), 1, pi.getPeers().size());
+
+ pi = getPort("/Main/appl/ref0/green");
+ assertEquals("port peers of "+pi.getPath(), 1, pi.getPeers().size());
+
+ pi = getPort("/Main/appl/ref0/blue");
+ assertEquals("port peers of "+pi.getPath(), 1, pi.getPeers().size());
+
+ pi = getPort("/Main/appl/ref0/extra");
+ assertEquals("port peers of "+pi.getPath(), 1, pi.getPeers().size());
+
+ pi = getPort("/Main/appl/ref0/suppl");
+ assertEquals("port peers of "+pi.getPath(), 1, pi.getPeers().size());
+
+ pi = getPort("/Main/appl/wrap/ref0/ref0/red");
+ assertEquals("port peers of "+pi.getPath(), 1, pi.getPeers().size());
+
+ pi = getPort("/Main/appl/wrap/ref0/ref0/green");
+ assertEquals("port peers of "+pi.getPath(), 1, pi.getPeers().size());
+
+ pi = getPort("/Main/appl/wrap/ref0/ref0/blue");
+ assertEquals("port peers of "+pi.getPath(), 1, pi.getPeers().size());
+
+ pi = getPort("/Main/appl/wrap/ref0/ref0/extra");
+ assertEquals("port peers of "+pi.getPath(), 1, pi.getPeers().size());
+
+ pi = getPort("/Main/appl/wrap/ref0/ref0/suppl");
+ assertEquals("port peers of "+pi.getPath(), 1, pi.getPeers().size());
+ }
+}
diff --git a/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestConnectedPorts.java b/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestConnectedPorts.java
index 40033a586..eea8ec529 100644
--- a/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestConnectedPorts.java
+++ b/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestConnectedPorts.java
@@ -1,90 +1,90 @@
-/*******************************************************************************
- * 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.core.genmodel;
-
-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.ArrayList;
-import java.util.HashMap;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.etrice.core.genmodel.etricegen.ETriceGenPackage;
-import org.eclipse.etrice.core.genmodel.etricegen.PortInstance;
-import org.eclipse.etrice.core.genmodel.etricegen.PortKind;
-import org.eclipse.etrice.core.genmodel.etricegen.Root;
-import org.junit.Before;
-import org.junit.Test;
-
-
-public class TestConnectedPorts extends TestInstanceModelBuilderBase {
-
- private Root root;
- private HashMap<EClass, ArrayList<EObject>> instances;
-
- @Before
- public void setUp() {
- prepare();
-
- root = buildInstanceModel("connected_ports.room");
- instances = collectInstances(root);
- }
-
- @Test
- public void testPortNumbers() {
- ArrayList<EObject> ports = instances.get(ETriceGenPackage.eINSTANCE.getPortInstance());
- assertEquals("Number of PortInstances", 19, ports.size());
- }
-
- @Test
- public void testRelayPort() {
- ArrayList<EObject> ports = instances.get(ETriceGenPackage.eINSTANCE.getPortInstance());
-
- PortInstance p = (PortInstance) getInstance(ports, "/CMain/test_a1/relay");
- assertNotNull("port expected", p);
- assertEquals("relay port expected", PortKind.RELAY, p.getKind());
- assertFalse("no conjuagted port expected", p.getPort().isConjugated());
- }
-
- @Test
- public void testInternalEndPort() {
- ArrayList<EObject> ports = instances.get(ETriceGenPackage.eINSTANCE.getPortInstance());
-
- PortInstance p = (PortInstance) getInstance(ports, "/CMain/test_a2/int_end");
- assertNotNull("port expected", p);
- assertEquals("internal port expected", PortKind.INTERNAL, p.getKind());
- assertTrue("conjuagted port expected", p.getPort().isConjugated());
- assertEquals("port connected once", 1, p.getPeers().size());
- PortInstance peer = (PortInstance) getInstance(p.getPeers(), "/CMain/test_a2/subact/p2");
- assertNotNull("peer expected", peer);
- PortInstance start = (PortInstance) getInstance(peer.getPeers(), "/CMain/test_a2/int_end");
- assertNotNull("peer expected", start);
- assertEquals("peer of peer is start", p, start);
- }
-
- @Test
- public void testExternalEndPortConnectedToRelayPort() {
- ArrayList<EObject> ports = instances.get(ETriceGenPackage.eINSTANCE.getPortInstance());
-
- PortInstance p = (PortInstance) getInstance(ports, "/CMain/test_a2/subact/p1");
- assertNotNull("port expected", p);
- assertEquals("external port expected", PortKind.EXTERNAL, p.getKind());
- assertEquals("port connected once", 1, p.getPeers().size());
- PortInstance peer = (PortInstance) getInstance(p.getPeers(), "/CMain/test_b/sub1/p");
- assertEquals("port connected twice", 2, peer.getPeers().size());
- }
-
-}
+/*******************************************************************************
+ * 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.core.genmodel;
+
+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.ArrayList;
+import java.util.HashMap;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.etrice.core.genmodel.etricegen.ETriceGenPackage;
+import org.eclipse.etrice.core.genmodel.etricegen.PortInstance;
+import org.eclipse.etrice.core.genmodel.etricegen.PortKind;
+import org.eclipse.etrice.core.genmodel.etricegen.Root;
+import org.junit.Before;
+import org.junit.Test;
+
+
+public class TestConnectedPorts extends TestInstanceModelBuilderBase {
+
+ private Root root;
+ private HashMap<EClass, ArrayList<EObject>> instances;
+
+ @Before
+ public void setUp() {
+ prepare();
+
+ root = buildInstanceModel("connected_ports.room");
+ instances = collectInstances(root);
+ }
+
+ @Test
+ public void testPortNumbers() {
+ ArrayList<EObject> ports = instances.get(ETriceGenPackage.eINSTANCE.getPortInstance());
+ assertEquals("Number of PortInstances", 19, ports.size());
+ }
+
+ @Test
+ public void testRelayPort() {
+ ArrayList<EObject> ports = instances.get(ETriceGenPackage.eINSTANCE.getPortInstance());
+
+ PortInstance p = (PortInstance) getInstance(ports, "/CMain/test_a1/relay");
+ assertNotNull("port expected", p);
+ assertEquals("relay port expected", PortKind.RELAY, p.getKind());
+ assertFalse("no conjuagted port expected", p.getPort().isConjugated());
+ }
+
+ @Test
+ public void testInternalEndPort() {
+ ArrayList<EObject> ports = instances.get(ETriceGenPackage.eINSTANCE.getPortInstance());
+
+ PortInstance p = (PortInstance) getInstance(ports, "/CMain/test_a2/int_end");
+ assertNotNull("port expected", p);
+ assertEquals("internal port expected", PortKind.INTERNAL, p.getKind());
+ assertTrue("conjuagted port expected", p.getPort().isConjugated());
+ assertEquals("port connected once", 1, p.getPeers().size());
+ PortInstance peer = (PortInstance) getInstance(p.getPeers(), "/CMain/test_a2/subact/p2");
+ assertNotNull("peer expected", peer);
+ PortInstance start = (PortInstance) getInstance(peer.getPeers(), "/CMain/test_a2/int_end");
+ assertNotNull("peer expected", start);
+ assertEquals("peer of peer is start", p, start);
+ }
+
+ @Test
+ public void testExternalEndPortConnectedToRelayPort() {
+ ArrayList<EObject> ports = instances.get(ETriceGenPackage.eINSTANCE.getPortInstance());
+
+ PortInstance p = (PortInstance) getInstance(ports, "/CMain/test_a2/subact/p1");
+ assertNotNull("port expected", p);
+ assertEquals("external port expected", PortKind.EXTERNAL, p.getKind());
+ assertEquals("port connected once", 1, p.getPeers().size());
+ PortInstance peer = (PortInstance) getInstance(p.getPeers(), "/CMain/test_b/sub1/p");
+ assertEquals("port connected twice", 2, peer.getPeers().size());
+ }
+
+}
diff --git a/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestFanningRelayPorts.java b/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestFanningRelayPorts.java
index c67d7af87..93cbebb55 100644
--- a/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestFanningRelayPorts.java
+++ b/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestFanningRelayPorts.java
@@ -1,91 +1,91 @@
-/*******************************************************************************
- * Copyright (c) 2012 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.genmodel;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.util.HashMap;
-import java.util.HashSet;
-
-import org.eclipse.emf.common.util.TreeIterator;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.etrice.core.genmodel.etricegen.InstanceBase;
-import org.eclipse.etrice.core.genmodel.etricegen.InterfaceItemInstance;
-import org.eclipse.etrice.core.genmodel.etricegen.PortInstance;
-import org.eclipse.etrice.core.genmodel.etricegen.Root;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * @author Henrik Rentz-Reichert
- *
- */
-public class TestFanningRelayPorts extends TestInstanceModelBuilderBase {
-
- private Root root;
- private HashMap<String, InstanceBase> path2inst = new HashMap<String, InstanceBase>();
-
- @Before
- public void setUp() {
- prepare();
-
- root = buildInstanceModel("fanning_relay.room");
-
- TreeIterator<EObject> it = root.eAllContents();
- while (it.hasNext()) {
- EObject obj = it.next();
- if (obj instanceof InstanceBase)
- path2inst.put(((InstanceBase) obj).getPath(), (InstanceBase) obj);
- }
- }
-
- private PortInstance getPort(String path) {
- return (PortInstance) path2inst.get(path);
- }
-
- /*
- * TODO: investigate port connection algorithm for fanning relay ports
- *
- * CAUTION: it is crucial that the relay port of ActorClass Cont has multiplicity>=4.
- * Otherwise not all ports will be connected/connected wrong.
- */
- @Test
- public void checkConnections() {
- PortInstance pil1 = getPort("/Main/c1/port");
- PortInstance pil2 = getPort("/Main/c2/port");
- PortInstance pil3 = getPort("/Main/c3/port");
- PortInstance pil4 = getPort("/Main/c4/port");
-
- assertEquals("number of peers of "+pil1.getPath(), 1, pil1.getPeers().size());
- assertEquals("number of peers of "+pil2.getPath(), 1, pil2.getPeers().size());
- assertEquals("number of peers of "+pil3.getPath(), 1, pil3.getPeers().size());
- assertEquals("number of peers of "+pil4.getPath(), 1, pil4.getPeers().size());
-
- HashSet<InterfaceItemInstance> peers = new HashSet<InterfaceItemInstance>();
- peers.add(pil1.getPeers().get(0));
- peers.add(pil2.getPeers().get(0));
- peers.add(pil3.getPeers().get(0));
- peers.add(pil4.getPeers().get(0));
-
- PortInstance pir1 = getPort("/Main/cont/s1/port");
- PortInstance pir2 = getPort("/Main/cont/s2/port");
- PortInstance pir3 = getPort("/Main/cont/c1/ss1/port");
- PortInstance pir4 = getPort("/Main/cont/c1/ss2/port");
-
- assertTrue("connected "+pir1.getPath(), peers.contains(pir1));
- assertTrue("connected "+pir2.getPath(), peers.contains(pir2));
- assertTrue("connected "+pir3.getPath(), peers.contains(pir3));
- assertTrue("connected "+pir4.getPath(), peers.contains(pir4));
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 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.genmodel;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.HashMap;
+import java.util.HashSet;
+
+import org.eclipse.emf.common.util.TreeIterator;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.etrice.core.genmodel.etricegen.InstanceBase;
+import org.eclipse.etrice.core.genmodel.etricegen.InterfaceItemInstance;
+import org.eclipse.etrice.core.genmodel.etricegen.PortInstance;
+import org.eclipse.etrice.core.genmodel.etricegen.Root;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * @author Henrik Rentz-Reichert
+ *
+ */
+public class TestFanningRelayPorts extends TestInstanceModelBuilderBase {
+
+ private Root root;
+ private HashMap<String, InstanceBase> path2inst = new HashMap<String, InstanceBase>();
+
+ @Before
+ public void setUp() {
+ prepare();
+
+ root = buildInstanceModel("fanning_relay.room");
+
+ TreeIterator<EObject> it = root.eAllContents();
+ while (it.hasNext()) {
+ EObject obj = it.next();
+ if (obj instanceof InstanceBase)
+ path2inst.put(((InstanceBase) obj).getPath(), (InstanceBase) obj);
+ }
+ }
+
+ private PortInstance getPort(String path) {
+ return (PortInstance) path2inst.get(path);
+ }
+
+ /*
+ * TODO: investigate port connection algorithm for fanning relay ports
+ *
+ * CAUTION: it is crucial that the relay port of ActorClass Cont has multiplicity>=4.
+ * Otherwise not all ports will be connected/connected wrong.
+ */
+ @Test
+ public void checkConnections() {
+ PortInstance pil1 = getPort("/Main/c1/port");
+ PortInstance pil2 = getPort("/Main/c2/port");
+ PortInstance pil3 = getPort("/Main/c3/port");
+ PortInstance pil4 = getPort("/Main/c4/port");
+
+ assertEquals("number of peers of "+pil1.getPath(), 1, pil1.getPeers().size());
+ assertEquals("number of peers of "+pil2.getPath(), 1, pil2.getPeers().size());
+ assertEquals("number of peers of "+pil3.getPath(), 1, pil3.getPeers().size());
+ assertEquals("number of peers of "+pil4.getPath(), 1, pil4.getPeers().size());
+
+ HashSet<InterfaceItemInstance> peers = new HashSet<InterfaceItemInstance>();
+ peers.add(pil1.getPeers().get(0));
+ peers.add(pil2.getPeers().get(0));
+ peers.add(pil3.getPeers().get(0));
+ peers.add(pil4.getPeers().get(0));
+
+ PortInstance pir1 = getPort("/Main/cont/s1/port");
+ PortInstance pir2 = getPort("/Main/cont/s2/port");
+ PortInstance pir3 = getPort("/Main/cont/c1/ss1/port");
+ PortInstance pir4 = getPort("/Main/cont/c1/ss2/port");
+
+ assertTrue("connected "+pir1.getPath(), peers.contains(pir1));
+ assertTrue("connected "+pir2.getPath(), peers.contains(pir2));
+ assertTrue("connected "+pir3.getPath(), peers.contains(pir3));
+ assertTrue("connected "+pir4.getPath(), peers.contains(pir4));
+ }
+}
diff --git a/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestHierarchy.java b/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestHierarchy.java
index a102fadba..5de106aa7 100644
--- a/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestHierarchy.java
+++ b/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestHierarchy.java
@@ -1,57 +1,57 @@
-/*******************************************************************************
- * 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.core.genmodel;
-
-import static org.junit.Assert.*;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.etrice.core.genmodel.etricegen.ActorInstance;
-import org.eclipse.etrice.core.genmodel.etricegen.ETriceGenPackage;
-import org.eclipse.etrice.core.genmodel.etricegen.Root;
-import org.junit.Before;
-import org.junit.Test;
-
-
-public class TestHierarchy extends TestInstanceModelBuilderBase {
-
- private Root root;
-
- @Before
- public void setUp() {
- prepare();
-
- root = buildInstanceModel("hierarchy.room");
- }
-
- @Test
- public void testInstances() {
-
- HashMap<EClass,ArrayList<EObject>> instances = collectInstances(root);
-
- assertEquals("Number of ComponentInstances", 1, instances.get(ETriceGenPackage.eINSTANCE.getSubSystemInstance()).size());
- assertEquals("Number of ActorInstances", 18, instances.get(ETriceGenPackage.eINSTANCE.getActorInstance()).size());
-
- ActorInstance ai = root.getSubSystemInstances().get(0).getInstances().get(0);
- assertEquals("Instance Path", "/CMain/l1a", ai.getPath());
-
- ai = ai.getInstances().get(1);
- assertEquals("Instance Path", "/CMain/l1a/l2b", ai.getPath());
-
- ai = ai.getInstances().get(2);
- assertEquals("Instance Path", "/CMain/l1a/l2b/l3c", ai.getPath());
- }
-}
+/*******************************************************************************
+ * 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.core.genmodel;
+
+import static org.junit.Assert.*;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.etrice.core.genmodel.etricegen.ActorInstance;
+import org.eclipse.etrice.core.genmodel.etricegen.ETriceGenPackage;
+import org.eclipse.etrice.core.genmodel.etricegen.Root;
+import org.junit.Before;
+import org.junit.Test;
+
+
+public class TestHierarchy extends TestInstanceModelBuilderBase {
+
+ private Root root;
+
+ @Before
+ public void setUp() {
+ prepare();
+
+ root = buildInstanceModel("hierarchy.room");
+ }
+
+ @Test
+ public void testInstances() {
+
+ HashMap<EClass,ArrayList<EObject>> instances = collectInstances(root);
+
+ assertEquals("Number of ComponentInstances", 1, instances.get(ETriceGenPackage.eINSTANCE.getSubSystemInstance()).size());
+ assertEquals("Number of ActorInstances", 18, instances.get(ETriceGenPackage.eINSTANCE.getActorInstance()).size());
+
+ ActorInstance ai = root.getSubSystemInstances().get(0).getInstances().get(0);
+ assertEquals("Instance Path", "/CMain/l1a", ai.getPath());
+
+ ai = ai.getInstances().get(1);
+ assertEquals("Instance Path", "/CMain/l1a/l2b", ai.getPath());
+
+ ai = ai.getInstances().get(2);
+ assertEquals("Instance Path", "/CMain/l1a/l2b/l3c", ai.getPath());
+ }
+}
diff --git a/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestInstanceModelBuilderBase.java b/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestInstanceModelBuilderBase.java
index cb2f988db..c9d05a25e 100644
--- a/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestInstanceModelBuilderBase.java
+++ b/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestInstanceModelBuilderBase.java
@@ -1,159 +1,159 @@
-/*******************************************************************************
- * 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.core.genmodel;
-
-import static org.junit.Assert.fail;
-
-import java.io.IOException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.emf.common.util.TreeIterator;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.etrice.core.genmodel.etricegen.IDiagnostician;
-import org.eclipse.etrice.core.genmodel.etricegen.InstanceBase;
-import org.eclipse.etrice.core.genmodel.etricegen.Root;
-import org.eclipse.etrice.core.naming.RoomNameProvider;
-import org.eclipse.xtext.resource.XtextResource;
-import org.eclipse.xtext.resource.XtextResourceSet;
-
-import org.eclipse.etrice.core.room.RoomModel;
-import org.eclipse.etrice.core.room.StateGraphItem;
-import org.eclipse.etrice.core.genmodel.base.ILogger;
-import org.eclipse.etrice.core.genmodel.builder.GeneratorModelBuilder;
-
-public class TestInstanceModelBuilderBase {
-
- class Logger implements ILogger {
-
- @Override
- public void logInfo(String text) {
- }
-
- @Override
- public void logError(String text, EObject obj) {
- }
-
- }
-
- class Diagnostician implements IDiagnostician {
-
- @Override
- public void warning(String msg, EObject source, EStructuralFeature feature) {
- }
-
- @Override
- public void warning(String msg, EObject source, EStructuralFeature feature, int index) {
- }
-
- @Override
- public void error(String msg, EObject source, EStructuralFeature feature) {
- fail(msg+RoomNameProvider.getLocation(source));
- }
-
- @Override
- public void error(String msg, EObject source, EStructuralFeature feature, int index) {
- fail(msg+RoomNameProvider.getLocation(source));
- }
-
- @Override
- public boolean isFailed() {
- return false;
- }
-
- }
-
- private String basePath;
-
- protected void prepare() {
- try {
- URL modelsDir = GenmodelTestsActivator.getInstance().getBundle().getEntry("models");
- URL fileURL = FileLocator.toFileURL(modelsDir);
- basePath = fileURL.getFile();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- protected LinkedList<RoomModel> getModels(String modelName) {
- LinkedList<RoomModel> models = new LinkedList<RoomModel>();
- 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");
-
- return models;
- }
-
- protected Root buildInstanceModel(String modelName) {
- GeneratorModelBuilder builder = new GeneratorModelBuilder(new Logger(), new Diagnostician());
- LinkedList<RoomModel> models = getModels(modelName);
- Root root = builder.createGeneratorModel(models, false);
- return root;
- }
-
- protected HashMap<EClass, ArrayList<EObject>> collectInstances(EObject root) {
- HashMap<EClass, ArrayList<EObject>> result = new HashMap<EClass, ArrayList<EObject>>();
-
- TreeIterator<EObject> it = root.eAllContents();
- while (it.hasNext()) {
- EObject obj = it.next();
- EClass ecl = obj.eClass();
- ArrayList<EObject> instances = result.get(ecl);
- if (instances==null) {
- instances = new ArrayList<EObject>();
- result.put(ecl, instances);
- }
- instances.add(obj);
- }
-
- return result;
- }
-
- protected InstanceBase getInstance(List<? extends EObject> objects, String path) {
- for (EObject obj : objects) {
- if (obj instanceof InstanceBase) {
- InstanceBase inst = (InstanceBase) obj;
- if (inst.getPath().equals(path))
- return inst;
- }
- }
- return null;
- }
-
- protected StateGraphItem getStateGraphItem(List<? extends EObject> objects, String path) {
- for (EObject obj : objects) {
- if (obj instanceof StateGraphItem) {
- StateGraphItem item = (StateGraphItem) obj;
- if (RoomNameProvider.getFullPath(item).equals(path))
- return item;
- }
- }
- return null;
- }
-
-}
+/*******************************************************************************
+ * 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.core.genmodel;
+
+import static org.junit.Assert.fail;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.emf.common.util.TreeIterator;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.etrice.core.genmodel.etricegen.IDiagnostician;
+import org.eclipse.etrice.core.genmodel.etricegen.InstanceBase;
+import org.eclipse.etrice.core.genmodel.etricegen.Root;
+import org.eclipse.etrice.core.naming.RoomNameProvider;
+import org.eclipse.xtext.resource.XtextResource;
+import org.eclipse.xtext.resource.XtextResourceSet;
+
+import org.eclipse.etrice.core.room.RoomModel;
+import org.eclipse.etrice.core.room.StateGraphItem;
+import org.eclipse.etrice.core.genmodel.base.ILogger;
+import org.eclipse.etrice.core.genmodel.builder.GeneratorModelBuilder;
+
+public class TestInstanceModelBuilderBase {
+
+ class Logger implements ILogger {
+
+ @Override
+ public void logInfo(String text) {
+ }
+
+ @Override
+ public void logError(String text, EObject obj) {
+ }
+
+ }
+
+ class Diagnostician implements IDiagnostician {
+
+ @Override
+ public void warning(String msg, EObject source, EStructuralFeature feature) {
+ }
+
+ @Override
+ public void warning(String msg, EObject source, EStructuralFeature feature, int index) {
+ }
+
+ @Override
+ public void error(String msg, EObject source, EStructuralFeature feature) {
+ fail(msg+RoomNameProvider.getLocation(source));
+ }
+
+ @Override
+ public void error(String msg, EObject source, EStructuralFeature feature, int index) {
+ fail(msg+RoomNameProvider.getLocation(source));
+ }
+
+ @Override
+ public boolean isFailed() {
+ return false;
+ }
+
+ }
+
+ private String basePath;
+
+ protected void prepare() {
+ try {
+ URL modelsDir = GenmodelTestsActivator.getInstance().getBundle().getEntry("models");
+ URL fileURL = FileLocator.toFileURL(modelsDir);
+ basePath = fileURL.getFile();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ protected LinkedList<RoomModel> getModels(String modelName) {
+ LinkedList<RoomModel> models = new LinkedList<RoomModel>();
+ 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");
+
+ return models;
+ }
+
+ protected Root buildInstanceModel(String modelName) {
+ GeneratorModelBuilder builder = new GeneratorModelBuilder(new Logger(), new Diagnostician());
+ LinkedList<RoomModel> models = getModels(modelName);
+ Root root = builder.createGeneratorModel(models, false);
+ return root;
+ }
+
+ protected HashMap<EClass, ArrayList<EObject>> collectInstances(EObject root) {
+ HashMap<EClass, ArrayList<EObject>> result = new HashMap<EClass, ArrayList<EObject>>();
+
+ TreeIterator<EObject> it = root.eAllContents();
+ while (it.hasNext()) {
+ EObject obj = it.next();
+ EClass ecl = obj.eClass();
+ ArrayList<EObject> instances = result.get(ecl);
+ if (instances==null) {
+ instances = new ArrayList<EObject>();
+ result.put(ecl, instances);
+ }
+ instances.add(obj);
+ }
+
+ return result;
+ }
+
+ protected InstanceBase getInstance(List<? extends EObject> objects, String path) {
+ for (EObject obj : objects) {
+ if (obj instanceof InstanceBase) {
+ InstanceBase inst = (InstanceBase) obj;
+ if (inst.getPath().equals(path))
+ return inst;
+ }
+ }
+ return null;
+ }
+
+ protected StateGraphItem getStateGraphItem(List<? extends EObject> objects, String path) {
+ for (EObject obj : objects) {
+ if (obj instanceof StateGraphItem) {
+ StateGraphItem item = (StateGraphItem) obj;
+ if (RoomNameProvider.getFullPath(item).equals(path))
+ return item;
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestLayers.java b/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestLayers.java
index d41ca068e..3cadf6ed6 100644
--- a/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestLayers.java
+++ b/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestLayers.java
@@ -1,73 +1,73 @@
-/*******************************************************************************
- * 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.core.genmodel;
-
-import static org.junit.Assert.*;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.etrice.core.genmodel.etricegen.ETriceGenPackage;
-import org.eclipse.etrice.core.genmodel.etricegen.InterfaceItemInstance;
-import org.eclipse.etrice.core.genmodel.etricegen.Root;
-import org.eclipse.etrice.core.genmodel.etricegen.SAPInstance;
-import org.eclipse.etrice.core.genmodel.etricegen.ServiceImplInstance;
-import org.junit.Before;
-import org.junit.Test;
-
-
-public class TestLayers extends TestInstanceModelBuilderBase {
-
- private Root root;
- private HashMap<EClass, ArrayList<EObject>> instances;
-
- @Before
- public void setUp() {
- prepare();
-
- root = buildInstanceModel("layers.room");
- instances = collectInstances(root);
- }
-
- @Test
- public void testInstanceNumbers() {
- ArrayList<EObject> saps = instances.get(ETriceGenPackage.eINSTANCE.getSAPInstance());
- assertEquals("Number of SAPInstances", 6, saps.size());
-
- ArrayList<EObject> spps = instances.get(ETriceGenPackage.eINSTANCE.getSPPInstance());
- assertEquals("Number of SPPInstances", 7, spps.size());
-
- ArrayList<EObject> svcs = instances.get(ETriceGenPackage.eINSTANCE.getServiceImplInstance());
- assertEquals("Number of ServiceImplInstances", 3, svcs.size());
- }
-
- @Test
- public void testLayerConnections() {
- ArrayList<EObject> saps = instances.get(ETriceGenPackage.eINSTANCE.getSAPInstance());
-
- for (EObject obj : saps) {
- assertEquals("SAP has one peer", 1, ((SAPInstance)obj).getPeers().size());
- }
-
- SAPInstance sap = (SAPInstance) getInstance(saps, "/CMain/app/subsysA/userX/sap");
- assertNotNull("sap expected", sap);
- InterfaceItemInstance peer = ((SAPInstance)sap).getPeers().get(0);
- assertTrue("peer is a service", (peer instanceof ServiceImplInstance));
- ServiceImplInstance svc = (ServiceImplInstance) peer;
- assertEquals("number of serviceA peers", 3, svc.getPeers().size());
- assertEquals("sap and service have same protocol", sap.getSap().getProtocol(), svc.getSvcImpl().getSpp().getProtocol());
- }
-
-}
+/*******************************************************************************
+ * 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.core.genmodel;
+
+import static org.junit.Assert.*;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.etrice.core.genmodel.etricegen.ETriceGenPackage;
+import org.eclipse.etrice.core.genmodel.etricegen.InterfaceItemInstance;
+import org.eclipse.etrice.core.genmodel.etricegen.Root;
+import org.eclipse.etrice.core.genmodel.etricegen.SAPInstance;
+import org.eclipse.etrice.core.genmodel.etricegen.ServiceImplInstance;
+import org.junit.Before;
+import org.junit.Test;
+
+
+public class TestLayers extends TestInstanceModelBuilderBase {
+
+ private Root root;
+ private HashMap<EClass, ArrayList<EObject>> instances;
+
+ @Before
+ public void setUp() {
+ prepare();
+
+ root = buildInstanceModel("layers.room");
+ instances = collectInstances(root);
+ }
+
+ @Test
+ public void testInstanceNumbers() {
+ ArrayList<EObject> saps = instances.get(ETriceGenPackage.eINSTANCE.getSAPInstance());
+ assertEquals("Number of SAPInstances", 6, saps.size());
+
+ ArrayList<EObject> spps = instances.get(ETriceGenPackage.eINSTANCE.getSPPInstance());
+ assertEquals("Number of SPPInstances", 7, spps.size());
+
+ ArrayList<EObject> svcs = instances.get(ETriceGenPackage.eINSTANCE.getServiceImplInstance());
+ assertEquals("Number of ServiceImplInstances", 3, svcs.size());
+ }
+
+ @Test
+ public void testLayerConnections() {
+ ArrayList<EObject> saps = instances.get(ETriceGenPackage.eINSTANCE.getSAPInstance());
+
+ for (EObject obj : saps) {
+ assertEquals("SAP has one peer", 1, ((SAPInstance)obj).getPeers().size());
+ }
+
+ SAPInstance sap = (SAPInstance) getInstance(saps, "/CMain/app/subsysA/userX/sap");
+ assertNotNull("sap expected", sap);
+ InterfaceItemInstance peer = ((SAPInstance)sap).getPeers().get(0);
+ assertTrue("peer is a service", (peer instanceof ServiceImplInstance));
+ ServiceImplInstance svc = (ServiceImplInstance) peer;
+ assertEquals("number of serviceA peers", 3, svc.getPeers().size());
+ assertEquals("sap and service have same protocol", sap.getSap().getProtocol(), svc.getSvcImpl().getSpp().getProtocol());
+ }
+
+}
diff --git a/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestMultipleConnectedChoicepoint.java b/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestMultipleConnectedChoicepoint.java
index 288532aef..0692da401 100644
--- a/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestMultipleConnectedChoicepoint.java
+++ b/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestMultipleConnectedChoicepoint.java
@@ -1,157 +1,157 @@
-/*******************************************************************************
- * Copyright (c) 2012 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.genmodel;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass;
-import org.eclipse.etrice.core.genmodel.etricegen.Root;
-import org.eclipse.etrice.core.genmodel.etricegen.TransitionChain;
-import org.eclipse.etrice.core.naming.RoomNameProvider;
-import org.eclipse.etrice.core.room.CPBranchTransition;
-import org.eclipse.etrice.core.room.ChoicePoint;
-import org.eclipse.etrice.core.room.ContinuationTransition;
-import org.eclipse.etrice.core.room.DataClass;
-import org.eclipse.etrice.core.room.RoomPackage;
-import org.eclipse.etrice.core.room.State;
-import org.eclipse.etrice.core.room.Transition;
-import org.eclipse.etrice.core.room.TriggeredTransition;
-import org.eclipse.etrice.core.room.VarDecl;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * @author Henrik Rentz-Reichert
- *
- */
-public class TestMultipleConnectedChoicepoint extends
- TestInstanceModelBuilderBase {
-
- private Root root;
- private HashMap<EClass, ArrayList<EObject>> instances;
- private ExpandedActorClass xpac;
-
- @Before
- public void setUp() {
- prepare();
-
- root = buildInstanceModel("cpmult.room");
- xpac = getTestee();
- instances = collectInstances(xpac);
- }
-
- private ExpandedActorClass getTestee() {
- for (ExpandedActorClass xpac : root.getXpActorClasses()) {
- if (xpac.getActorClass().getName().equals("CPMult"))
- return xpac;
- }
- return null;
- }
-
- private Transition getTransition(String name) {
- for (Transition tr : xpac.getStateMachine().getTransitions()) {
- if (tr.getName().equals(name))
- return tr;
- }
- return null;
- }
-
- private Transition getState1Transition(String name) {
- for (State s : xpac.getStateMachine().getStates()) {
- if (s.getName().equals("state1")) {
- for (Transition tr : s.getSubgraph().getTransitions()) {
- if (tr.getName().equals(name))
- return tr;
- }
- }
- }
- return null;
- }
-
- @Test
- public void testNumbers() {
- assertEquals("number of states", 6, instances.get(RoomPackage.eINSTANCE.getSimpleState()).size());
- assertEquals("number of choice points", 1, instances.get(RoomPackage.eINSTANCE.getChoicePoint()).size());
- assertNull("number of transition points", instances.get(RoomPackage.eINSTANCE.getTransitionPoint()));
- assertEquals("number of entry points", 1, instances.get(RoomPackage.eINSTANCE.getEntryPoint()).size());
- assertEquals("number of exit points", 1, instances.get(RoomPackage.eINSTANCE.getExitPoint()).size());
- assertEquals("number of initial transitions", 1, instances.get(RoomPackage.eINSTANCE.getInitialTransition()).size());
- assertEquals("number of triggered transitions", 5, instances.get(RoomPackage.eINSTANCE.getTriggeredTransition()).size());
- assertEquals("number of continuation transitions", 3, instances.get(RoomPackage.eINSTANCE.getContinuationTransition()).size());
- assertEquals("number of branch transitions", 1, instances.get(RoomPackage.eINSTANCE.getCPBranchTransition()).size());
- }
-
- @Test
- public void testXPACGeneral() {
- EList<TransitionChain> chains = xpac.getTransitionChains();
- assertEquals("number of chains", 6, chains.size());
- assertEquals("number of triggers", 4, xpac.getTriggers().size());
- }
-
- @Test
- public void testGraph() {
- ArrayList<EObject> cps = instances.get(RoomPackage.eINSTANCE.getChoicePoint());
- ChoicePoint cp = (ChoicePoint) cps.get(0);
- assertEquals("choicepoint name", "cp0", RoomNameProvider.getFullPath(cp));
- assertEquals("number of incoming transitions", 2, xpac.getIncomingTransitions(cp).size());
- assertEquals("number of outgoing transitions", 2, xpac.getOutgoingTransitions(cp).size());
- }
-
- @Test
- public void testData() {
- Transition tr = getTransition("tr0");
- VarDecl data = xpac.getData(tr);
- assertTrue("transition is TriggeredTransition", tr instanceof TriggeredTransition);
- assertTrue("data is DataClass", data.getRefType().getType() instanceof DataClass);
- assertEquals("data of "+tr.getName(), "DC2", data.getRefType().getType().getName());
-
- tr = getState1Transition("tr2");
- data = xpac.getData(tr);
- assertTrue("transition is TriggeredTransition", tr instanceof TriggeredTransition);
- assertTrue("data is DataClass", data.getRefType().getType() instanceof DataClass);
- assertEquals("data of "+tr.getName(), "DC2", data.getRefType().getType().getName());
-
- tr = getState1Transition("tr3");
- data = xpac.getData(tr);
- assertTrue("transition is TriggeredTransition", tr instanceof TriggeredTransition);
- assertTrue("data is DataClass", data.getRefType().getType() instanceof DataClass);
- assertEquals("data of "+tr.getName(), "DC4", data.getRefType().getType().getName());
-
- tr = getTransition("tr1");
- data = xpac.getData(tr);
- assertTrue("transition is TriggeredTransition", tr instanceof TriggeredTransition);
- assertTrue("data is DataClass", data.getRefType().getType() instanceof DataClass);
- assertEquals("data of "+tr.getName(), "DC3", data.getRefType().getType().getName());
-
- tr = getTransition("tr3");
- data = xpac.getData(tr);
- assertTrue("transition is ContinuationTransition", tr instanceof ContinuationTransition);
- assertTrue("data is DataClass", data.getRefType().getType() instanceof DataClass);
- assertEquals("data of "+tr.getName(), "DC", data.getRefType().getType().getName());
-
- tr = getTransition("tr4");
- data = xpac.getData(tr);
- assertTrue("transition is CPBranchTransition", tr instanceof CPBranchTransition);
- assertTrue("data is DataClass", data.getRefType().getType() instanceof DataClass);
- assertEquals("data of "+tr.getName(), "DC", data.getRefType().getType().getName());
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2012 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.genmodel;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass;
+import org.eclipse.etrice.core.genmodel.etricegen.Root;
+import org.eclipse.etrice.core.genmodel.etricegen.TransitionChain;
+import org.eclipse.etrice.core.naming.RoomNameProvider;
+import org.eclipse.etrice.core.room.CPBranchTransition;
+import org.eclipse.etrice.core.room.ChoicePoint;
+import org.eclipse.etrice.core.room.ContinuationTransition;
+import org.eclipse.etrice.core.room.DataClass;
+import org.eclipse.etrice.core.room.RoomPackage;
+import org.eclipse.etrice.core.room.State;
+import org.eclipse.etrice.core.room.Transition;
+import org.eclipse.etrice.core.room.TriggeredTransition;
+import org.eclipse.etrice.core.room.VarDecl;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * @author Henrik Rentz-Reichert
+ *
+ */
+public class TestMultipleConnectedChoicepoint extends
+ TestInstanceModelBuilderBase {
+
+ private Root root;
+ private HashMap<EClass, ArrayList<EObject>> instances;
+ private ExpandedActorClass xpac;
+
+ @Before
+ public void setUp() {
+ prepare();
+
+ root = buildInstanceModel("cpmult.room");
+ xpac = getTestee();
+ instances = collectInstances(xpac);
+ }
+
+ private ExpandedActorClass getTestee() {
+ for (ExpandedActorClass xpac : root.getXpActorClasses()) {
+ if (xpac.getActorClass().getName().equals("CPMult"))
+ return xpac;
+ }
+ return null;
+ }
+
+ private Transition getTransition(String name) {
+ for (Transition tr : xpac.getStateMachine().getTransitions()) {
+ if (tr.getName().equals(name))
+ return tr;
+ }
+ return null;
+ }
+
+ private Transition getState1Transition(String name) {
+ for (State s : xpac.getStateMachine().getStates()) {
+ if (s.getName().equals("state1")) {
+ for (Transition tr : s.getSubgraph().getTransitions()) {
+ if (tr.getName().equals(name))
+ return tr;
+ }
+ }
+ }
+ return null;
+ }
+
+ @Test
+ public void testNumbers() {
+ assertEquals("number of states", 6, instances.get(RoomPackage.eINSTANCE.getSimpleState()).size());
+ assertEquals("number of choice points", 1, instances.get(RoomPackage.eINSTANCE.getChoicePoint()).size());
+ assertNull("number of transition points", instances.get(RoomPackage.eINSTANCE.getTransitionPoint()));
+ assertEquals("number of entry points", 1, instances.get(RoomPackage.eINSTANCE.getEntryPoint()).size());
+ assertEquals("number of exit points", 1, instances.get(RoomPackage.eINSTANCE.getExitPoint()).size());
+ assertEquals("number of initial transitions", 1, instances.get(RoomPackage.eINSTANCE.getInitialTransition()).size());
+ assertEquals("number of triggered transitions", 5, instances.get(RoomPackage.eINSTANCE.getTriggeredTransition()).size());
+ assertEquals("number of continuation transitions", 3, instances.get(RoomPackage.eINSTANCE.getContinuationTransition()).size());
+ assertEquals("number of branch transitions", 1, instances.get(RoomPackage.eINSTANCE.getCPBranchTransition()).size());
+ }
+
+ @Test
+ public void testXPACGeneral() {
+ EList<TransitionChain> chains = xpac.getTransitionChains();
+ assertEquals("number of chains", 6, chains.size());
+ assertEquals("number of triggers", 4, xpac.getTriggers().size());
+ }
+
+ @Test
+ public void testGraph() {
+ ArrayList<EObject> cps = instances.get(RoomPackage.eINSTANCE.getChoicePoint());
+ ChoicePoint cp = (ChoicePoint) cps.get(0);
+ assertEquals("choicepoint name", "cp0", RoomNameProvider.getFullPath(cp));
+ assertEquals("number of incoming transitions", 2, xpac.getIncomingTransitions(cp).size());
+ assertEquals("number of outgoing transitions", 2, xpac.getOutgoingTransitions(cp).size());
+ }
+
+ @Test
+ public void testData() {
+ Transition tr = getTransition("tr0");
+ VarDecl data = xpac.getData(tr);
+ assertTrue("transition is TriggeredTransition", tr instanceof TriggeredTransition);
+ assertTrue("data is DataClass", data.getRefType().getType() instanceof DataClass);
+ assertEquals("data of "+tr.getName(), "DC2", data.getRefType().getType().getName());
+
+ tr = getState1Transition("tr2");
+ data = xpac.getData(tr);
+ assertTrue("transition is TriggeredTransition", tr instanceof TriggeredTransition);
+ assertTrue("data is DataClass", data.getRefType().getType() instanceof DataClass);
+ assertEquals("data of "+tr.getName(), "DC2", data.getRefType().getType().getName());
+
+ tr = getState1Transition("tr3");
+ data = xpac.getData(tr);
+ assertTrue("transition is TriggeredTransition", tr instanceof TriggeredTransition);
+ assertTrue("data is DataClass", data.getRefType().getType() instanceof DataClass);
+ assertEquals("data of "+tr.getName(), "DC4", data.getRefType().getType().getName());
+
+ tr = getTransition("tr1");
+ data = xpac.getData(tr);
+ assertTrue("transition is TriggeredTransition", tr instanceof TriggeredTransition);
+ assertTrue("data is DataClass", data.getRefType().getType() instanceof DataClass);
+ assertEquals("data of "+tr.getName(), "DC3", data.getRefType().getType().getName());
+
+ tr = getTransition("tr3");
+ data = xpac.getData(tr);
+ assertTrue("transition is ContinuationTransition", tr instanceof ContinuationTransition);
+ assertTrue("data is DataClass", data.getRefType().getType() instanceof DataClass);
+ assertEquals("data of "+tr.getName(), "DC", data.getRefType().getType().getName());
+
+ tr = getTransition("tr4");
+ data = xpac.getData(tr);
+ assertTrue("transition is CPBranchTransition", tr instanceof CPBranchTransition);
+ assertTrue("data is DataClass", data.getRefType().getType() instanceof DataClass);
+ assertEquals("data of "+tr.getName(), "DC", data.getRefType().getType().getName());
+ }
+
+}
diff --git a/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestPorts.java b/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestPorts.java
index e2e846d1a..133b152ef 100644
--- a/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestPorts.java
+++ b/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestPorts.java
@@ -1,58 +1,58 @@
-/*******************************************************************************
- * 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.core.genmodel;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.etrice.core.genmodel.etricegen.ETriceGenPackage;
-import org.eclipse.etrice.core.genmodel.etricegen.PortInstance;
-import org.eclipse.etrice.core.genmodel.etricegen.Root;
-import org.junit.Before;
-import org.junit.Test;
-
-
-public class TestPorts extends TestInstanceModelBuilderBase {
-
- private Root root;
-
- @Before
- public void setUp() {
- prepare();
-
- root = buildInstanceModel("ports.room");
- }
-
- @Test
- public void testPortNumbers() {
- HashMap<EClass, ArrayList<EObject>> instances = collectInstances(root);
- assertEquals("Number of PortInstances", 3, instances.get(ETriceGenPackage.eINSTANCE.getPortInstance()).size());
- }
-
- @Test
- public void testPortInstancePaths() {
- PortInstance pi = root.getSubSystemInstances().get(0).getInstances().get(0).getPorts().get(0);
- assertEquals("Port Name", "/CMain/test/externalEnd", pi.getPath());
-
- pi = root.getSubSystemInstances().get(0).getInstances().get(0).getPorts().get(1);
- assertEquals("Port Name", "/CMain/test/internalEnd", pi.getPath());
-
- pi = root.getSubSystemInstances().get(0).getInstances().get(0).getPorts().get(2);
- assertEquals("Port Name", "/CMain/test/relay", pi.getPath());
- }
-
-}
+/*******************************************************************************
+ * 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.core.genmodel;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.etrice.core.genmodel.etricegen.ETriceGenPackage;
+import org.eclipse.etrice.core.genmodel.etricegen.PortInstance;
+import org.eclipse.etrice.core.genmodel.etricegen.Root;
+import org.junit.Before;
+import org.junit.Test;
+
+
+public class TestPorts extends TestInstanceModelBuilderBase {
+
+ private Root root;
+
+ @Before
+ public void setUp() {
+ prepare();
+
+ root = buildInstanceModel("ports.room");
+ }
+
+ @Test
+ public void testPortNumbers() {
+ HashMap<EClass, ArrayList<EObject>> instances = collectInstances(root);
+ assertEquals("Number of PortInstances", 3, instances.get(ETriceGenPackage.eINSTANCE.getPortInstance()).size());
+ }
+
+ @Test
+ public void testPortInstancePaths() {
+ PortInstance pi = root.getSubSystemInstances().get(0).getInstances().get(0).getPorts().get(0);
+ assertEquals("Port Name", "/CMain/test/externalEnd", pi.getPath());
+
+ pi = root.getSubSystemInstances().get(0).getInstances().get(0).getPorts().get(1);
+ assertEquals("Port Name", "/CMain/test/internalEnd", pi.getPath());
+
+ pi = root.getSubSystemInstances().get(0).getInstances().get(0).getPorts().get(2);
+ assertEquals("Port Name", "/CMain/test/relay", pi.getPath());
+ }
+
+}
diff --git a/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestReplicatedActors.java b/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestReplicatedActors.java
index dd9c4b332..b9623d035 100644
--- a/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestReplicatedActors.java
+++ b/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestReplicatedActors.java
@@ -1,209 +1,209 @@
-/*******************************************************************************
- * Copyright (c) 2012 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.genmodel;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.util.HashMap;
-import java.util.HashSet;
-
-import org.eclipse.emf.common.util.TreeIterator;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.etrice.core.genmodel.etricegen.InstanceBase;
-import org.eclipse.etrice.core.genmodel.etricegen.InterfaceItemInstance;
-import org.eclipse.etrice.core.genmodel.etricegen.PortInstance;
-import org.eclipse.etrice.core.genmodel.etricegen.Root;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * @author Henrik Rentz-Reichert
- *
- */
-public class TestReplicatedActors extends TestInstanceModelBuilderBase {
-
- private Root root;
- private HashMap<String, InstanceBase> path2inst = new HashMap<String, InstanceBase>();
-
- @Before
- public void setUp() {
- prepare();
-
- root = buildInstanceModel("replicated_actors.room");
-
- TreeIterator<EObject> it = root.eAllContents();
- while (it.hasNext()) {
- EObject obj = it.next();
- if (obj instanceof InstanceBase) {
- String path = ((InstanceBase) obj).getPath();
- path2inst.put(path, (InstanceBase) obj);
- System.out.println(path);
- }
- }
- }
-
- private PortInstance getPort(String path) {
- return (PortInstance) path2inst.get(path);
- }
-
- // example 1: regular port of replicated actor connected to regular ports
- @Test
- public void checkExample1() {
- PortInstance intp1 = getPort("/Main/appl1/intp1");
- PortInstance intp2 = getPort("/Main/appl1/intp2");
- PortInstance intp3 = getPort("/Main/appl1/intp3");
- PortInstance ac1_0p = getPort("/Main/appl1/ac1repl_0/ac1p");
- PortInstance ac1_1p = getPort("/Main/appl1/ac1repl_1/ac1p");
- PortInstance ac1_2p = getPort("/Main/appl1/ac1repl_2/ac1p");
-
- assertEquals("number of peers of "+intp1.getName(), 1, intp1.getPeers().size());
- assertEquals("number of peers of "+intp2.getName(), 1, intp2.getPeers().size());
- assertEquals("number of peers of "+intp3.getName(), 1, intp3.getPeers().size());
- assertEquals("number of peers of "+ac1_0p.getName(), 1, ac1_0p.getPeers().size());
- assertEquals("number of peers of "+ac1_1p.getName(), 1, ac1_1p.getPeers().size());
- assertEquals("number of peers of "+ac1_2p.getName(), 1, ac1_2p.getPeers().size());
-
- HashSet<InterfaceItemInstance> peers = new HashSet<InterfaceItemInstance>();
- peers.add(intp1);
- peers.add(intp2);
- peers.add(intp3);
-
- assertTrue(ac1_0p.getPeers().get(0).getName()+" contained in peers ", peers.remove(ac1_0p.getPeers().get(0)));
- assertTrue(ac1_1p.getPeers().get(0).getName()+" contained in peers ", peers.remove(ac1_1p.getPeers().get(0)));
- assertTrue(ac1_2p.getPeers().get(0).getName()+" contained in peers ", peers.remove(ac1_2p.getPeers().get(0)));
- assertTrue("peers complete ", peers.isEmpty());
- }
-
- // example 2: regular port of replicated actor connected to regular port of replicated actor
- @Test
- public void checkExample2() {
- PortInstance ac1_0p = getPort("/Main/appl2/ac1repl_0/ac1p");
- PortInstance ac1_1p = getPort("/Main/appl2/ac1repl_1/ac1p");
- PortInstance ac1_2p = getPort("/Main/appl2/ac1repl_2/ac1p");
- PortInstance ac2_0p = getPort("/Main/appl2/ac2repl_0/ac2p");
- PortInstance ac2_1p = getPort("/Main/appl2/ac2repl_1/ac2p");
- PortInstance ac2_2p = getPort("/Main/appl2/ac2repl_2/ac2p");
-
- assertEquals("number of peers of "+ac1_0p.getName(), 1, ac1_0p.getPeers().size());
- assertEquals("number of peers of "+ac1_1p.getName(), 1, ac1_1p.getPeers().size());
- assertEquals("number of peers of "+ac1_2p.getName(), 1, ac1_2p.getPeers().size());
- assertEquals("number of peers of "+ac2_0p.getName(), 1, ac2_0p.getPeers().size());
- assertEquals("number of peers of "+ac2_1p.getName(), 1, ac2_1p.getPeers().size());
- assertEquals("number of peers of "+ac2_2p.getName(), 1, ac2_2p.getPeers().size());
-
- HashSet<InterfaceItemInstance> peers = new HashSet<InterfaceItemInstance>();
- peers.add(ac1_0p);
- peers.add(ac1_1p);
- peers.add(ac1_2p);
-
- assertTrue(ac2_0p.getPeers().get(0).getName()+" contained in peers ", peers.remove(ac2_0p.getPeers().get(0)));
- assertTrue(ac2_1p.getPeers().get(0).getName()+" contained in peers ", peers.remove(ac2_1p.getPeers().get(0)));
- assertTrue(ac2_2p.getPeers().get(0).getName()+" contained in peers ", peers.remove(ac2_2p.getPeers().get(0)));
- assertTrue("peers complete ", peers.isEmpty());
- }
-
- // example 3: regular port of replicated actor connected to replicated port
- @Test
- public void checkExample3() {
- PortInstance ac1_0p = getPort("/Main/appl3/ac1repl_0/ac1p");
- PortInstance ac1_1p = getPort("/Main/appl3/ac1repl_1/ac1p");
- PortInstance ac1_2p = getPort("/Main/appl3/ac1repl_2/ac1p");
- PortInstance intrep = getPort("/Main/appl3/intrep");
-
- assertEquals("number of peers of "+ac1_0p.getName(), 1, ac1_0p.getPeers().size());
- assertEquals("number of peers of "+ac1_1p.getName(), 1, ac1_1p.getPeers().size());
- assertEquals("number of peers of "+ac1_2p.getName(), 1, ac1_2p.getPeers().size());
- assertEquals("number of peers of "+intrep.getName(), 3, intrep.getPeers().size());
-
- assertEquals(ac1_0p.getName()+" peer is intrep ", ac1_0p.getPeers().get(0), intrep);
- assertEquals(ac1_1p.getName()+" peer is intrep ", ac1_1p.getPeers().get(0), intrep);
- assertEquals(ac1_2p.getName()+" peer is intrep ", ac1_2p.getPeers().get(0), intrep);
- }
-
- // example 4: regular port of replicated actor connected to replicated port of replicated actor
- @Test
- public void checkExample4() {
- PortInstance ac1_0p = getPort("/Main/appl4/ac1repl_0/ac1p");
- PortInstance ac1_1p = getPort("/Main/appl4/ac1repl_1/ac1p");
- PortInstance ac2_0p = getPort("/Main/appl4/ac2repl_0/ac2p");
- PortInstance ac2_1p = getPort("/Main/appl4/ac2repl_1/ac2p");
- PortInstance ac2_2p = getPort("/Main/appl4/ac2repl_2/ac2p");
- PortInstance ac2_3p = getPort("/Main/appl4/ac2repl_3/ac2p");
-
- assertEquals("number of peers of "+ac1_0p.getName(), 2, ac1_0p.getPeers().size());
- assertEquals("number of peers of "+ac1_1p.getName(), 2, ac1_1p.getPeers().size());
- assertEquals("number of peers of "+ac2_0p.getName(), 1, ac2_0p.getPeers().size());
- assertEquals("number of peers of "+ac2_1p.getName(), 1, ac2_1p.getPeers().size());
- assertEquals("number of peers of "+ac2_2p.getName(), 1, ac2_2p.getPeers().size());
- assertEquals("number of peers of "+ac2_3p.getName(), 1, ac2_3p.getPeers().size());
-
- HashSet<InterfaceItemInstance> peers = new HashSet<InterfaceItemInstance>();
- peers.add(ac2_0p);
- peers.add(ac2_1p);
- peers.add(ac2_2p);
- peers.add(ac2_3p);
-
- assertTrue(ac1_0p.getPeers().get(0).getName()+" contained in peers ", peers.remove(ac1_0p.getPeers().get(0)));
- assertTrue(ac1_0p.getPeers().get(1).getName()+" contained in peers ", peers.remove(ac1_0p.getPeers().get(1)));
- assertTrue(ac1_1p.getPeers().get(0).getName()+" contained in peers ", peers.remove(ac1_1p.getPeers().get(0)));
- assertTrue(ac1_1p.getPeers().get(1).getName()+" contained in peers ", peers.remove(ac1_1p.getPeers().get(1)));
- assertTrue("peers complete ", peers.isEmpty());
- }
-
- // example 5: regular port of replicated actor connected to replicated port of sub actor
- // TODO: testee [8] works fine but testee [*] will be connected only with the first port
- @Test
- public void checkExample5() {
- PortInstance testee = getPort("/Main/appl5/testDriver/testee");
- PortInstance ref0_0p = getPort("/Main/appl5/ref0_0/tester/test");
- PortInstance ref0_1p = getPort("/Main/appl5/ref0_1/tester/test");
- PortInstance ref0_2p = getPort("/Main/appl5/ref0_2/tester/test");
- PortInstance ref0_3p = getPort("/Main/appl5/ref0_3/tester/test");
- PortInstance ref0_4p = getPort("/Main/appl5/ref0_4/tester/test");
- PortInstance ref0_5p = getPort("/Main/appl5/ref0_5/tester/test");
- PortInstance ref0_6p = getPort("/Main/appl5/ref0_6/tester/test");
- PortInstance ref0_7p = getPort("/Main/appl5/ref0_7/tester/test");
-
- assertEquals("number of peers of "+testee.getName(), 8, testee.getPeers().size());
- assertEquals("number of peers of "+ref0_0p.getName(), 1, ref0_0p.getPeers().size());
- assertEquals("number of peers of "+ref0_1p.getName(), 1, ref0_1p.getPeers().size());
- assertEquals("number of peers of "+ref0_2p.getName(), 1, ref0_2p.getPeers().size());
- assertEquals("number of peers of "+ref0_3p.getName(), 1, ref0_3p.getPeers().size());
- assertEquals("number of peers of "+ref0_4p.getName(), 1, ref0_4p.getPeers().size());
- assertEquals("number of peers of "+ref0_5p.getName(), 1, ref0_5p.getPeers().size());
- assertEquals("number of peers of "+ref0_6p.getName(), 1, ref0_6p.getPeers().size());
- assertEquals("number of peers of "+ref0_7p.getName(), 1, ref0_7p.getPeers().size());
-
- HashSet<InterfaceItemInstance> peers = new HashSet<InterfaceItemInstance>();
- peers.add(ref0_0p);
- peers.add(ref0_1p);
- peers.add(ref0_2p);
- peers.add(ref0_3p);
- peers.add(ref0_4p);
- peers.add(ref0_5p);
- peers.add(ref0_6p);
- peers.add(ref0_7p);
-
- assertTrue(testee.getPeers().get(0).getName()+" contained in peers ", peers.remove(testee.getPeers().get(0)));
- assertTrue(testee.getPeers().get(1).getName()+" contained in peers ", peers.remove(testee.getPeers().get(1)));
- assertTrue(testee.getPeers().get(2).getName()+" contained in peers ", peers.remove(testee.getPeers().get(2)));
- assertTrue(testee.getPeers().get(3).getName()+" contained in peers ", peers.remove(testee.getPeers().get(3)));
- assertTrue(testee.getPeers().get(4).getName()+" contained in peers ", peers.remove(testee.getPeers().get(4)));
- assertTrue(testee.getPeers().get(5).getName()+" contained in peers ", peers.remove(testee.getPeers().get(5)));
- assertTrue(testee.getPeers().get(6).getName()+" contained in peers ", peers.remove(testee.getPeers().get(6)));
- assertTrue(testee.getPeers().get(7).getName()+" contained in peers ", peers.remove(testee.getPeers().get(7)));
- assertTrue("peers complete ", peers.isEmpty());
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2012 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.genmodel;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.HashMap;
+import java.util.HashSet;
+
+import org.eclipse.emf.common.util.TreeIterator;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.etrice.core.genmodel.etricegen.InstanceBase;
+import org.eclipse.etrice.core.genmodel.etricegen.InterfaceItemInstance;
+import org.eclipse.etrice.core.genmodel.etricegen.PortInstance;
+import org.eclipse.etrice.core.genmodel.etricegen.Root;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * @author Henrik Rentz-Reichert
+ *
+ */
+public class TestReplicatedActors extends TestInstanceModelBuilderBase {
+
+ private Root root;
+ private HashMap<String, InstanceBase> path2inst = new HashMap<String, InstanceBase>();
+
+ @Before
+ public void setUp() {
+ prepare();
+
+ root = buildInstanceModel("replicated_actors.room");
+
+ TreeIterator<EObject> it = root.eAllContents();
+ while (it.hasNext()) {
+ EObject obj = it.next();
+ if (obj instanceof InstanceBase) {
+ String path = ((InstanceBase) obj).getPath();
+ path2inst.put(path, (InstanceBase) obj);
+ System.out.println(path);
+ }
+ }
+ }
+
+ private PortInstance getPort(String path) {
+ return (PortInstance) path2inst.get(path);
+ }
+
+ // example 1: regular port of replicated actor connected to regular ports
+ @Test
+ public void checkExample1() {
+ PortInstance intp1 = getPort("/Main/appl1/intp1");
+ PortInstance intp2 = getPort("/Main/appl1/intp2");
+ PortInstance intp3 = getPort("/Main/appl1/intp3");
+ PortInstance ac1_0p = getPort("/Main/appl1/ac1repl_0/ac1p");
+ PortInstance ac1_1p = getPort("/Main/appl1/ac1repl_1/ac1p");
+ PortInstance ac1_2p = getPort("/Main/appl1/ac1repl_2/ac1p");
+
+ assertEquals("number of peers of "+intp1.getName(), 1, intp1.getPeers().size());
+ assertEquals("number of peers of "+intp2.getName(), 1, intp2.getPeers().size());
+ assertEquals("number of peers of "+intp3.getName(), 1, intp3.getPeers().size());
+ assertEquals("number of peers of "+ac1_0p.getName(), 1, ac1_0p.getPeers().size());
+ assertEquals("number of peers of "+ac1_1p.getName(), 1, ac1_1p.getPeers().size());
+ assertEquals("number of peers of "+ac1_2p.getName(), 1, ac1_2p.getPeers().size());
+
+ HashSet<InterfaceItemInstance> peers = new HashSet<InterfaceItemInstance>();
+ peers.add(intp1);
+ peers.add(intp2);
+ peers.add(intp3);
+
+ assertTrue(ac1_0p.getPeers().get(0).getName()+" contained in peers ", peers.remove(ac1_0p.getPeers().get(0)));
+ assertTrue(ac1_1p.getPeers().get(0).getName()+" contained in peers ", peers.remove(ac1_1p.getPeers().get(0)));
+ assertTrue(ac1_2p.getPeers().get(0).getName()+" contained in peers ", peers.remove(ac1_2p.getPeers().get(0)));
+ assertTrue("peers complete ", peers.isEmpty());
+ }
+
+ // example 2: regular port of replicated actor connected to regular port of replicated actor
+ @Test
+ public void checkExample2() {
+ PortInstance ac1_0p = getPort("/Main/appl2/ac1repl_0/ac1p");
+ PortInstance ac1_1p = getPort("/Main/appl2/ac1repl_1/ac1p");
+ PortInstance ac1_2p = getPort("/Main/appl2/ac1repl_2/ac1p");
+ PortInstance ac2_0p = getPort("/Main/appl2/ac2repl_0/ac2p");
+ PortInstance ac2_1p = getPort("/Main/appl2/ac2repl_1/ac2p");
+ PortInstance ac2_2p = getPort("/Main/appl2/ac2repl_2/ac2p");
+
+ assertEquals("number of peers of "+ac1_0p.getName(), 1, ac1_0p.getPeers().size());
+ assertEquals("number of peers of "+ac1_1p.getName(), 1, ac1_1p.getPeers().size());
+ assertEquals("number of peers of "+ac1_2p.getName(), 1, ac1_2p.getPeers().size());
+ assertEquals("number of peers of "+ac2_0p.getName(), 1, ac2_0p.getPeers().size());
+ assertEquals("number of peers of "+ac2_1p.getName(), 1, ac2_1p.getPeers().size());
+ assertEquals("number of peers of "+ac2_2p.getName(), 1, ac2_2p.getPeers().size());
+
+ HashSet<InterfaceItemInstance> peers = new HashSet<InterfaceItemInstance>();
+ peers.add(ac1_0p);
+ peers.add(ac1_1p);
+ peers.add(ac1_2p);
+
+ assertTrue(ac2_0p.getPeers().get(0).getName()+" contained in peers ", peers.remove(ac2_0p.getPeers().get(0)));
+ assertTrue(ac2_1p.getPeers().get(0).getName()+" contained in peers ", peers.remove(ac2_1p.getPeers().get(0)));
+ assertTrue(ac2_2p.getPeers().get(0).getName()+" contained in peers ", peers.remove(ac2_2p.getPeers().get(0)));
+ assertTrue("peers complete ", peers.isEmpty());
+ }
+
+ // example 3: regular port of replicated actor connected to replicated port
+ @Test
+ public void checkExample3() {
+ PortInstance ac1_0p = getPort("/Main/appl3/ac1repl_0/ac1p");
+ PortInstance ac1_1p = getPort("/Main/appl3/ac1repl_1/ac1p");
+ PortInstance ac1_2p = getPort("/Main/appl3/ac1repl_2/ac1p");
+ PortInstance intrep = getPort("/Main/appl3/intrep");
+
+ assertEquals("number of peers of "+ac1_0p.getName(), 1, ac1_0p.getPeers().size());
+ assertEquals("number of peers of "+ac1_1p.getName(), 1, ac1_1p.getPeers().size());
+ assertEquals("number of peers of "+ac1_2p.getName(), 1, ac1_2p.getPeers().size());
+ assertEquals("number of peers of "+intrep.getName(), 3, intrep.getPeers().size());
+
+ assertEquals(ac1_0p.getName()+" peer is intrep ", ac1_0p.getPeers().get(0), intrep);
+ assertEquals(ac1_1p.getName()+" peer is intrep ", ac1_1p.getPeers().get(0), intrep);
+ assertEquals(ac1_2p.getName()+" peer is intrep ", ac1_2p.getPeers().get(0), intrep);
+ }
+
+ // example 4: regular port of replicated actor connected to replicated port of replicated actor
+ @Test
+ public void checkExample4() {
+ PortInstance ac1_0p = getPort("/Main/appl4/ac1repl_0/ac1p");
+ PortInstance ac1_1p = getPort("/Main/appl4/ac1repl_1/ac1p");
+ PortInstance ac2_0p = getPort("/Main/appl4/ac2repl_0/ac2p");
+ PortInstance ac2_1p = getPort("/Main/appl4/ac2repl_1/ac2p");
+ PortInstance ac2_2p = getPort("/Main/appl4/ac2repl_2/ac2p");
+ PortInstance ac2_3p = getPort("/Main/appl4/ac2repl_3/ac2p");
+
+ assertEquals("number of peers of "+ac1_0p.getName(), 2, ac1_0p.getPeers().size());
+ assertEquals("number of peers of "+ac1_1p.getName(), 2, ac1_1p.getPeers().size());
+ assertEquals("number of peers of "+ac2_0p.getName(), 1, ac2_0p.getPeers().size());
+ assertEquals("number of peers of "+ac2_1p.getName(), 1, ac2_1p.getPeers().size());
+ assertEquals("number of peers of "+ac2_2p.getName(), 1, ac2_2p.getPeers().size());
+ assertEquals("number of peers of "+ac2_3p.getName(), 1, ac2_3p.getPeers().size());
+
+ HashSet<InterfaceItemInstance> peers = new HashSet<InterfaceItemInstance>();
+ peers.add(ac2_0p);
+ peers.add(ac2_1p);
+ peers.add(ac2_2p);
+ peers.add(ac2_3p);
+
+ assertTrue(ac1_0p.getPeers().get(0).getName()+" contained in peers ", peers.remove(ac1_0p.getPeers().get(0)));
+ assertTrue(ac1_0p.getPeers().get(1).getName()+" contained in peers ", peers.remove(ac1_0p.getPeers().get(1)));
+ assertTrue(ac1_1p.getPeers().get(0).getName()+" contained in peers ", peers.remove(ac1_1p.getPeers().get(0)));
+ assertTrue(ac1_1p.getPeers().get(1).getName()+" contained in peers ", peers.remove(ac1_1p.getPeers().get(1)));
+ assertTrue("peers complete ", peers.isEmpty());
+ }
+
+ // example 5: regular port of replicated actor connected to replicated port of sub actor
+ // TODO: testee [8] works fine but testee [*] will be connected only with the first port
+ @Test
+ public void checkExample5() {
+ PortInstance testee = getPort("/Main/appl5/testDriver/testee");
+ PortInstance ref0_0p = getPort("/Main/appl5/ref0_0/tester/test");
+ PortInstance ref0_1p = getPort("/Main/appl5/ref0_1/tester/test");
+ PortInstance ref0_2p = getPort("/Main/appl5/ref0_2/tester/test");
+ PortInstance ref0_3p = getPort("/Main/appl5/ref0_3/tester/test");
+ PortInstance ref0_4p = getPort("/Main/appl5/ref0_4/tester/test");
+ PortInstance ref0_5p = getPort("/Main/appl5/ref0_5/tester/test");
+ PortInstance ref0_6p = getPort("/Main/appl5/ref0_6/tester/test");
+ PortInstance ref0_7p = getPort("/Main/appl5/ref0_7/tester/test");
+
+ assertEquals("number of peers of "+testee.getName(), 8, testee.getPeers().size());
+ assertEquals("number of peers of "+ref0_0p.getName(), 1, ref0_0p.getPeers().size());
+ assertEquals("number of peers of "+ref0_1p.getName(), 1, ref0_1p.getPeers().size());
+ assertEquals("number of peers of "+ref0_2p.getName(), 1, ref0_2p.getPeers().size());
+ assertEquals("number of peers of "+ref0_3p.getName(), 1, ref0_3p.getPeers().size());
+ assertEquals("number of peers of "+ref0_4p.getName(), 1, ref0_4p.getPeers().size());
+ assertEquals("number of peers of "+ref0_5p.getName(), 1, ref0_5p.getPeers().size());
+ assertEquals("number of peers of "+ref0_6p.getName(), 1, ref0_6p.getPeers().size());
+ assertEquals("number of peers of "+ref0_7p.getName(), 1, ref0_7p.getPeers().size());
+
+ HashSet<InterfaceItemInstance> peers = new HashSet<InterfaceItemInstance>();
+ peers.add(ref0_0p);
+ peers.add(ref0_1p);
+ peers.add(ref0_2p);
+ peers.add(ref0_3p);
+ peers.add(ref0_4p);
+ peers.add(ref0_5p);
+ peers.add(ref0_6p);
+ peers.add(ref0_7p);
+
+ assertTrue(testee.getPeers().get(0).getName()+" contained in peers ", peers.remove(testee.getPeers().get(0)));
+ assertTrue(testee.getPeers().get(1).getName()+" contained in peers ", peers.remove(testee.getPeers().get(1)));
+ assertTrue(testee.getPeers().get(2).getName()+" contained in peers ", peers.remove(testee.getPeers().get(2)));
+ assertTrue(testee.getPeers().get(3).getName()+" contained in peers ", peers.remove(testee.getPeers().get(3)));
+ assertTrue(testee.getPeers().get(4).getName()+" contained in peers ", peers.remove(testee.getPeers().get(4)));
+ assertTrue(testee.getPeers().get(5).getName()+" contained in peers ", peers.remove(testee.getPeers().get(5)));
+ assertTrue(testee.getPeers().get(6).getName()+" contained in peers ", peers.remove(testee.getPeers().get(6)));
+ assertTrue(testee.getPeers().get(7).getName()+" contained in peers ", peers.remove(testee.getPeers().get(7)));
+ assertTrue("peers complete ", peers.isEmpty());
+ }
+
+}
diff --git a/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestStates.java b/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestStates.java
index db17542ea..aa9fb4936 100644
--- a/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestStates.java
+++ b/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestStates.java
@@ -1,120 +1,120 @@
-/*******************************************************************************
- * 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.core.genmodel;
-
-import static org.junit.Assert.*;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass;
-import org.eclipse.etrice.core.genmodel.etricegen.Root;
-import org.eclipse.etrice.core.genmodel.etricegen.TransitionChain;
-import org.eclipse.etrice.core.naming.RoomNameProvider;
-import org.junit.Before;
-import org.junit.Test;
-
-import org.eclipse.etrice.core.room.ChoicePoint;
-import org.eclipse.etrice.core.room.ContinuationTransition;
-import org.eclipse.etrice.core.room.RoomPackage;
-import org.eclipse.etrice.core.room.State;
-import org.eclipse.etrice.core.room.Transition;
-
-public class TestStates extends TestInstanceModelBuilderBase {
-
- private Root root;
- private HashMap<EClass, ArrayList<EObject>> instances;
-
- @Before
- public void setUp() {
- prepare();
-
- root = buildInstanceModel("states.room");
- instances = collectInstances(root.getXpActorClasses().get(0));
- }
-
- @Test
- public void testNumbers() {
- assertEquals("number of states", 7, instances.get(RoomPackage.eINSTANCE.getSimpleState()).size());
- assertEquals("number of choice points", 1, instances.get(RoomPackage.eINSTANCE.getChoicePoint()).size());
- assertEquals("number of transition points", 2, instances.get(RoomPackage.eINSTANCE.getTransitionPoint()).size());
- assertEquals("number of entry points", 1, instances.get(RoomPackage.eINSTANCE.getEntryPoint()).size());
- assertEquals("number of exit points", 1, instances.get(RoomPackage.eINSTANCE.getExitPoint()).size());
- assertEquals("number of initial transitions", 2, instances.get(RoomPackage.eINSTANCE.getInitialTransition()).size());
- assertEquals("number of triggered transitions", 9, instances.get(RoomPackage.eINSTANCE.getTriggeredTransition()).size());
- assertEquals("number of continuation transitions", 3, instances.get(RoomPackage.eINSTANCE.getContinuationTransition()).size());
- assertEquals("number of branch transitions", 2, instances.get(RoomPackage.eINSTANCE.getCPBranchTransition()).size());
- }
-
- @Test
- public void testXPACGeneral() {
- ExpandedActorClass xpac = root.getXpActorClasses().get(0);
- assertEquals("actor class", xpac.getActorClass().getName(), "ATest");
- EList<TransitionChain> chains = xpac.getTransitionChains();
- assertEquals("number of chains", 11, chains.size());
- assertEquals("numer of triggers", 3, xpac.getTriggers().size());
- }
-
- @Test
- public void testGraph() {
- ArrayList<EObject> states = instances.get(RoomPackage.eINSTANCE.getSimpleState());
-// for (EObject obj : states) {
-// LogicalSystem.out.println("state "+RoomNameProvider.getFullPath((StateGraphItem) obj));
-// }
-
- ExpandedActorClass xpac = root.getXpActorClasses().get(0);
-
- State s = (State) getStateGraphItem(states, "State3_State3");
- assertNotNull("state exists", s);
- assertEquals("number of incoming transitions", 3, xpac.getIncomingTransitions(s).size());
- assertEquals("number of outgoing transitions", 2, xpac.getOutgoingTransitions(s).size());
-
- assertEquals("active triggers", 3, xpac.getActiveTriggers(s).size());
-
- s = (State) getStateGraphItem(states, "State2");
- assertNotNull("state exists", s);
- assertEquals("number of incoming transitions", 3, xpac.getIncomingTransitions(s).size());
- assertEquals("number of outgoing transitions", 1, xpac.getOutgoingTransitions(s).size());
-
- assertEquals("active triggers", 2, xpac.getActiveTriggers(s).size());
-
- ArrayList<EObject> cps = instances.get(RoomPackage.eINSTANCE.getChoicePoint());
-
- ChoicePoint cp = (ChoicePoint) cps.get(0);
- assertEquals("choicepoint name", "CP1", RoomNameProvider.getFullPath(cp));
- assertEquals("number of incoming transitions", 1, xpac.getIncomingTransitions(cp).size());
- assertEquals("number of outgoing transitions", 3, xpac.getOutgoingTransitions(cp).size());
-
- ContinuationTransition dflt = xpac.getDefaultBranch(xpac.getOutgoingTransitions(cp));
- assertNotNull("default branch", dflt);
- }
-
- @Test
- public void testChains() {
- ArrayList<EObject> cts = instances.get(RoomPackage.eINSTANCE.getContinuationTransition());
-// for (EObject obj : cts) {
-// LogicalSystem.out.println("ct "+RoomNameProvider.getFullPath((StateGraphItem) obj));
-// }
-
- Transition t = (Transition) getStateGraphItem(cts, "State3_TRANS_tr1_FROM_tp1_TO_State3");
- assertNotNull("transition", t);
-
- ExpandedActorClass xpac = root.getXpActorClasses().get(0);
- TransitionChain chain = xpac.getChain(t);
- assertNotNull("chain", chain);
- assertEquals("chain name", "TRANS_tr5_FROM_tp0_TO_State3_tp1_BY_afct", RoomNameProvider.getFullPath(chain.getTransition()));
- }
-}
+/*******************************************************************************
+ * 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.core.genmodel;
+
+import static org.junit.Assert.*;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass;
+import org.eclipse.etrice.core.genmodel.etricegen.Root;
+import org.eclipse.etrice.core.genmodel.etricegen.TransitionChain;
+import org.eclipse.etrice.core.naming.RoomNameProvider;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.eclipse.etrice.core.room.ChoicePoint;
+import org.eclipse.etrice.core.room.ContinuationTransition;
+import org.eclipse.etrice.core.room.RoomPackage;
+import org.eclipse.etrice.core.room.State;
+import org.eclipse.etrice.core.room.Transition;
+
+public class TestStates extends TestInstanceModelBuilderBase {
+
+ private Root root;
+ private HashMap<EClass, ArrayList<EObject>> instances;
+
+ @Before
+ public void setUp() {
+ prepare();
+
+ root = buildInstanceModel("states.room");
+ instances = collectInstances(root.getXpActorClasses().get(0));
+ }
+
+ @Test
+ public void testNumbers() {
+ assertEquals("number of states", 7, instances.get(RoomPackage.eINSTANCE.getSimpleState()).size());
+ assertEquals("number of choice points", 1, instances.get(RoomPackage.eINSTANCE.getChoicePoint()).size());
+ assertEquals("number of transition points", 2, instances.get(RoomPackage.eINSTANCE.getTransitionPoint()).size());
+ assertEquals("number of entry points", 1, instances.get(RoomPackage.eINSTANCE.getEntryPoint()).size());
+ assertEquals("number of exit points", 1, instances.get(RoomPackage.eINSTANCE.getExitPoint()).size());
+ assertEquals("number of initial transitions", 2, instances.get(RoomPackage.eINSTANCE.getInitialTransition()).size());
+ assertEquals("number of triggered transitions", 9, instances.get(RoomPackage.eINSTANCE.getTriggeredTransition()).size());
+ assertEquals("number of continuation transitions", 3, instances.get(RoomPackage.eINSTANCE.getContinuationTransition()).size());
+ assertEquals("number of branch transitions", 2, instances.get(RoomPackage.eINSTANCE.getCPBranchTransition()).size());
+ }
+
+ @Test
+ public void testXPACGeneral() {
+ ExpandedActorClass xpac = root.getXpActorClasses().get(0);
+ assertEquals("actor class", xpac.getActorClass().getName(), "ATest");
+ EList<TransitionChain> chains = xpac.getTransitionChains();
+ assertEquals("number of chains", 11, chains.size());
+ assertEquals("numer of triggers", 3, xpac.getTriggers().size());
+ }
+
+ @Test
+ public void testGraph() {
+ ArrayList<EObject> states = instances.get(RoomPackage.eINSTANCE.getSimpleState());
+// for (EObject obj : states) {
+// LogicalSystem.out.println("state "+RoomNameProvider.getFullPath((StateGraphItem) obj));
+// }
+
+ ExpandedActorClass xpac = root.getXpActorClasses().get(0);
+
+ State s = (State) getStateGraphItem(states, "State3_State3");
+ assertNotNull("state exists", s);
+ assertEquals("number of incoming transitions", 3, xpac.getIncomingTransitions(s).size());
+ assertEquals("number of outgoing transitions", 2, xpac.getOutgoingTransitions(s).size());
+
+ assertEquals("active triggers", 3, xpac.getActiveTriggers(s).size());
+
+ s = (State) getStateGraphItem(states, "State2");
+ assertNotNull("state exists", s);
+ assertEquals("number of incoming transitions", 3, xpac.getIncomingTransitions(s).size());
+ assertEquals("number of outgoing transitions", 1, xpac.getOutgoingTransitions(s).size());
+
+ assertEquals("active triggers", 2, xpac.getActiveTriggers(s).size());
+
+ ArrayList<EObject> cps = instances.get(RoomPackage.eINSTANCE.getChoicePoint());
+
+ ChoicePoint cp = (ChoicePoint) cps.get(0);
+ assertEquals("choicepoint name", "CP1", RoomNameProvider.getFullPath(cp));
+ assertEquals("number of incoming transitions", 1, xpac.getIncomingTransitions(cp).size());
+ assertEquals("number of outgoing transitions", 3, xpac.getOutgoingTransitions(cp).size());
+
+ ContinuationTransition dflt = xpac.getDefaultBranch(xpac.getOutgoingTransitions(cp));
+ assertNotNull("default branch", dflt);
+ }
+
+ @Test
+ public void testChains() {
+ ArrayList<EObject> cts = instances.get(RoomPackage.eINSTANCE.getContinuationTransition());
+// for (EObject obj : cts) {
+// LogicalSystem.out.println("ct "+RoomNameProvider.getFullPath((StateGraphItem) obj));
+// }
+
+ Transition t = (Transition) getStateGraphItem(cts, "State3_TRANS_tr1_FROM_tp1_TO_State3");
+ assertNotNull("transition", t);
+
+ ExpandedActorClass xpac = root.getXpActorClasses().get(0);
+ TransitionChain chain = xpac.getChain(t);
+ assertNotNull("chain", chain);
+ assertEquals("chain name", "TRANS_tr5_FROM_tp0_TO_State3_tp1_BY_afct", RoomNameProvider.getFullPath(chain.getTransition()));
+ }
+}
diff --git a/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestStatesAndTriggers.java b/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestStatesAndTriggers.java
index 196f07189..0161fbe31 100644
--- a/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestStatesAndTriggers.java
+++ b/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestStatesAndTriggers.java
@@ -1,144 +1,144 @@
-/*******************************************************************************
- * 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.core.genmodel;
-
-import static org.junit.Assert.*;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass;
-import org.eclipse.etrice.core.genmodel.etricegen.Root;
-import org.eclipse.etrice.core.genmodel.etricegen.TransitionChain;
-import org.eclipse.etrice.core.naming.RoomNameProvider;
-import org.junit.Before;
-import org.junit.Test;
-
-import org.eclipse.etrice.core.room.ChoicePoint;
-import org.eclipse.etrice.core.room.ContinuationTransition;
-import org.eclipse.etrice.core.room.Port;
-import org.eclipse.etrice.core.room.RoomPackage;
-import org.eclipse.etrice.core.room.SAPRef;
-import org.eclipse.etrice.core.room.State;
-import org.eclipse.etrice.core.room.Transition;
-
-public class TestStatesAndTriggers extends TestInstanceModelBuilderBase {
-
- private Root root;
- private ExpandedActorClass xpac;
- private HashMap<EClass, ArrayList<EObject>> instances;
-
- @Before
- public void setUp() {
- prepare();
-
- root = buildInstanceModel("states_triggers.room");
- xpac = getTestee();
- instances = collectInstances(xpac);
- }
-
- private ExpandedActorClass getTestee() {
- for (ExpandedActorClass xpac : root.getXpActorClasses()) {
- if (xpac.getActorClass().getName().equals("ATest"))
- return xpac;
- }
- return null;
- }
-
- @Test
- public void testNumbers() {
- assertEquals("number of states", 7, instances.get(RoomPackage.eINSTANCE.getSimpleState()).size());
- assertEquals("number of choice points", 1, instances.get(RoomPackage.eINSTANCE.getChoicePoint()).size());
- assertEquals("number of transition points", 4, instances.get(RoomPackage.eINSTANCE.getTransitionPoint()).size());
- assertEquals("number of entry points", 1, instances.get(RoomPackage.eINSTANCE.getEntryPoint()).size());
- assertEquals("number of exit points", 1, instances.get(RoomPackage.eINSTANCE.getExitPoint()).size());
- assertEquals("number of initial transitions", 2, instances.get(RoomPackage.eINSTANCE.getInitialTransition()).size());
- assertEquals("number of triggered transitions", 11, instances.get(RoomPackage.eINSTANCE.getTriggeredTransition()).size());
- assertEquals("number of continuation transitions", 3, instances.get(RoomPackage.eINSTANCE.getContinuationTransition()).size());
- assertEquals("number of branch transitions", 2, instances.get(RoomPackage.eINSTANCE.getCPBranchTransition()).size());
- }
-
- @Test
- public void testXPACGeneral() {
- EList<TransitionChain> chains = xpac.getTransitionChains();
- assertEquals("number of chains", 13, chains.size());
- assertEquals("numer of triggers", 7, xpac.getTriggers().size());
- }
-
- @Test
- public void testGraph() {
- ArrayList<EObject> states = instances.get(RoomPackage.eINSTANCE.getSimpleState());
-// for (EObject obj : states) {
-// LogicalSystem.out.println("state "+RoomNameProvider.getFullPath((StateGraphItem) obj));
-// }
-
- State s = (State) getStateGraphItem(states, "State3_State3");
- assertNotNull("state exists", s);
- assertEquals("number of incoming transitions", 3, xpac.getIncomingTransitions(s).size());
- assertEquals("number of outgoing transitions", 2, xpac.getOutgoingTransitions(s).size());
-
- assertEquals("active triggers", 6, xpac.getActiveTriggers(s).size());
-
- s = (State) getStateGraphItem(states, "State2");
- assertNotNull("state exists", s);
- assertEquals("number of incoming transitions", 4, xpac.getIncomingTransitions(s).size());
- assertEquals("number of outgoing transitions", 1, xpac.getOutgoingTransitions(s).size());
-
- assertEquals("active triggers", 3, xpac.getActiveTriggers(s).size());
-
- ArrayList<EObject> cps = instances.get(RoomPackage.eINSTANCE.getChoicePoint());
-
- ChoicePoint cp = (ChoicePoint) cps.get(0);
- assertEquals("choicepoint name", "CP1", RoomNameProvider.getFullPath(cp));
- assertEquals("number of incoming transitions", 1, xpac.getIncomingTransitions(cp).size());
- assertEquals("number of outgoing transitions", 3, xpac.getOutgoingTransitions(cp).size());
-
- ContinuationTransition dflt = xpac.getDefaultBranch(xpac.getOutgoingTransitions(cp));
- assertNotNull("default branch", dflt);
- }
-
- @Test
- public void testChains() {
- ArrayList<EObject> cts = instances.get(RoomPackage.eINSTANCE.getContinuationTransition());
-// for (EObject obj : cts) {
-// LogicalSystem.out.println("ct "+RoomNameProvider.getFullPath((StateGraphItem) obj));
-// }
-
- Transition t = (Transition) getStateGraphItem(cts, "State3_TRANS_tr1_FROM_tp1_TO_State3");
- assertNotNull("transition", t);
-
- TransitionChain chain = xpac.getChain(t);
- assertNotNull("chain", chain);
- assertEquals("chain name", "TRANS_tr5_FROM_tp0_TO_State3_tp1_BY_afct", RoomNameProvider.getFullPath(chain.getTransition()));
- }
-
- @Test
- public void testIfItems() {
- Port fct = xpac.getActorClass().getIfPorts().get(0);
- Port sub = xpac.getActorClass().getIntPorts().get(0);
- SAPRef timer = xpac.getActorClass().getStrSAPs().get(0);
- SAPRef timeout = xpac.getActorClass().getStrSAPs().get(1);
-
- assertEquals("port name", "fct", fct.getName());
- assertEquals("port name", "subp", sub.getName());
- assertEquals("sap name", "timer", timer.getName());
- assertEquals("sap name", "timeout", timeout.getName());
-
- assertEquals("port local id", 0, xpac.getInterfaceItemLocalId(fct));
- assertEquals("port local id", 1, xpac.getInterfaceItemLocalId(sub));
- assertEquals("sap local id", 2, xpac.getInterfaceItemLocalId(timer));
- assertEquals("sap local id", 3, xpac.getInterfaceItemLocalId(timeout));
- }
-}
+/*******************************************************************************
+ * 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.core.genmodel;
+
+import static org.junit.Assert.*;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass;
+import org.eclipse.etrice.core.genmodel.etricegen.Root;
+import org.eclipse.etrice.core.genmodel.etricegen.TransitionChain;
+import org.eclipse.etrice.core.naming.RoomNameProvider;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.eclipse.etrice.core.room.ChoicePoint;
+import org.eclipse.etrice.core.room.ContinuationTransition;
+import org.eclipse.etrice.core.room.Port;
+import org.eclipse.etrice.core.room.RoomPackage;
+import org.eclipse.etrice.core.room.SAPRef;
+import org.eclipse.etrice.core.room.State;
+import org.eclipse.etrice.core.room.Transition;
+
+public class TestStatesAndTriggers extends TestInstanceModelBuilderBase {
+
+ private Root root;
+ private ExpandedActorClass xpac;
+ private HashMap<EClass, ArrayList<EObject>> instances;
+
+ @Before
+ public void setUp() {
+ prepare();
+
+ root = buildInstanceModel("states_triggers.room");
+ xpac = getTestee();
+ instances = collectInstances(xpac);
+ }
+
+ private ExpandedActorClass getTestee() {
+ for (ExpandedActorClass xpac : root.getXpActorClasses()) {
+ if (xpac.getActorClass().getName().equals("ATest"))
+ return xpac;
+ }
+ return null;
+ }
+
+ @Test
+ public void testNumbers() {
+ assertEquals("number of states", 7, instances.get(RoomPackage.eINSTANCE.getSimpleState()).size());
+ assertEquals("number of choice points", 1, instances.get(RoomPackage.eINSTANCE.getChoicePoint()).size());
+ assertEquals("number of transition points", 4, instances.get(RoomPackage.eINSTANCE.getTransitionPoint()).size());
+ assertEquals("number of entry points", 1, instances.get(RoomPackage.eINSTANCE.getEntryPoint()).size());
+ assertEquals("number of exit points", 1, instances.get(RoomPackage.eINSTANCE.getExitPoint()).size());
+ assertEquals("number of initial transitions", 2, instances.get(RoomPackage.eINSTANCE.getInitialTransition()).size());
+ assertEquals("number of triggered transitions", 11, instances.get(RoomPackage.eINSTANCE.getTriggeredTransition()).size());
+ assertEquals("number of continuation transitions", 3, instances.get(RoomPackage.eINSTANCE.getContinuationTransition()).size());
+ assertEquals("number of branch transitions", 2, instances.get(RoomPackage.eINSTANCE.getCPBranchTransition()).size());
+ }
+
+ @Test
+ public void testXPACGeneral() {
+ EList<TransitionChain> chains = xpac.getTransitionChains();
+ assertEquals("number of chains", 13, chains.size());
+ assertEquals("numer of triggers", 7, xpac.getTriggers().size());
+ }
+
+ @Test
+ public void testGraph() {
+ ArrayList<EObject> states = instances.get(RoomPackage.eINSTANCE.getSimpleState());
+// for (EObject obj : states) {
+// LogicalSystem.out.println("state "+RoomNameProvider.getFullPath((StateGraphItem) obj));
+// }
+
+ State s = (State) getStateGraphItem(states, "State3_State3");
+ assertNotNull("state exists", s);
+ assertEquals("number of incoming transitions", 3, xpac.getIncomingTransitions(s).size());
+ assertEquals("number of outgoing transitions", 2, xpac.getOutgoingTransitions(s).size());
+
+ assertEquals("active triggers", 6, xpac.getActiveTriggers(s).size());
+
+ s = (State) getStateGraphItem(states, "State2");
+ assertNotNull("state exists", s);
+ assertEquals("number of incoming transitions", 4, xpac.getIncomingTransitions(s).size());
+ assertEquals("number of outgoing transitions", 1, xpac.getOutgoingTransitions(s).size());
+
+ assertEquals("active triggers", 3, xpac.getActiveTriggers(s).size());
+
+ ArrayList<EObject> cps = instances.get(RoomPackage.eINSTANCE.getChoicePoint());
+
+ ChoicePoint cp = (ChoicePoint) cps.get(0);
+ assertEquals("choicepoint name", "CP1", RoomNameProvider.getFullPath(cp));
+ assertEquals("number of incoming transitions", 1, xpac.getIncomingTransitions(cp).size());
+ assertEquals("number of outgoing transitions", 3, xpac.getOutgoingTransitions(cp).size());
+
+ ContinuationTransition dflt = xpac.getDefaultBranch(xpac.getOutgoingTransitions(cp));
+ assertNotNull("default branch", dflt);
+ }
+
+ @Test
+ public void testChains() {
+ ArrayList<EObject> cts = instances.get(RoomPackage.eINSTANCE.getContinuationTransition());
+// for (EObject obj : cts) {
+// LogicalSystem.out.println("ct "+RoomNameProvider.getFullPath((StateGraphItem) obj));
+// }
+
+ Transition t = (Transition) getStateGraphItem(cts, "State3_TRANS_tr1_FROM_tp1_TO_State3");
+ assertNotNull("transition", t);
+
+ TransitionChain chain = xpac.getChain(t);
+ assertNotNull("chain", chain);
+ assertEquals("chain name", "TRANS_tr5_FROM_tp0_TO_State3_tp1_BY_afct", RoomNameProvider.getFullPath(chain.getTransition()));
+ }
+
+ @Test
+ public void testIfItems() {
+ Port fct = xpac.getActorClass().getIfPorts().get(0);
+ Port sub = xpac.getActorClass().getIntPorts().get(0);
+ SAPRef timer = xpac.getActorClass().getStrSAPs().get(0);
+ SAPRef timeout = xpac.getActorClass().getStrSAPs().get(1);
+
+ assertEquals("port name", "fct", fct.getName());
+ assertEquals("port name", "subp", sub.getName());
+ assertEquals("sap name", "timer", timer.getName());
+ assertEquals("sap name", "timeout", timeout.getName());
+
+ assertEquals("port local id", 0, xpac.getInterfaceItemLocalId(fct));
+ assertEquals("port local id", 1, xpac.getInterfaceItemLocalId(sub));
+ assertEquals("sap local id", 2, xpac.getInterfaceItemLocalId(timer));
+ assertEquals("sap local id", 3, xpac.getInterfaceItemLocalId(timeout));
+ }
+}
diff --git a/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestStatesInheritance.java b/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestStatesInheritance.java
index def604fe6..fac0f12b4 100644
--- a/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestStatesInheritance.java
+++ b/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestStatesInheritance.java
@@ -1,144 +1,144 @@
-/*******************************************************************************
- * 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.core.genmodel;
-
-import static org.junit.Assert.*;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass;
-import org.eclipse.etrice.core.genmodel.etricegen.Root;
-import org.eclipse.etrice.core.genmodel.etricegen.TransitionChain;
-import org.eclipse.etrice.core.naming.RoomNameProvider;
-import org.junit.Before;
-import org.junit.Test;
-
-import org.eclipse.etrice.core.room.ChoicePoint;
-import org.eclipse.etrice.core.room.ContinuationTransition;
-import org.eclipse.etrice.core.room.RoomPackage;
-import org.eclipse.etrice.core.room.State;
-import org.eclipse.etrice.core.room.Transition;
-
-public class TestStatesInheritance extends TestInstanceModelBuilderBase {
-
- private Root root;
- private HashMap<EClass, ArrayList<EObject>> instances;
- private ExpandedActorClass xpac;
-
- @Before
- public void setUp() {
- prepare();
-
- root = buildInstanceModel("states_inheritance.room");
- xpac = getTestee();
- instances = collectInstances(xpac);
- }
-
- private ExpandedActorClass getTestee() {
- for (ExpandedActorClass xpac : root.getXpActorClasses()) {
- if (xpac.getActorClass().getName().equals("ADerived"))
- return xpac;
- }
- return null;
- }
-
-// private void assertEquals(String msg, int exp, int is) {
-// LogicalSystem.out.println(msg+" exp:"+exp+" is:"+is);
-// }
-//
-// private void assertEquals(String msg, String exp, String is) {
-// LogicalSystem.out.println(msg+" exp:"+exp+" is:"+is);
-// }
-//
-// private void assertEquals(String msg, EObject exp, EObject is) {
-// LogicalSystem.out.println(msg+" exp:"+exp+" is:"+is);
-// }
-
- @Test
- public void testNumbers() {
- assertEquals("number of states", 9, instances.get(RoomPackage.eINSTANCE.getSimpleState()).size());
- assertEquals("number of choice points", 1, instances.get(RoomPackage.eINSTANCE.getChoicePoint()).size());
- assertEquals("number of transition points", 5, instances.get(RoomPackage.eINSTANCE.getTransitionPoint()).size());
- assertEquals("number of entry points", 2, instances.get(RoomPackage.eINSTANCE.getEntryPoint()).size());
- assertEquals("number of exit points", 1, instances.get(RoomPackage.eINSTANCE.getExitPoint()).size());
- assertEquals("number of initial transitions", 3, instances.get(RoomPackage.eINSTANCE.getInitialTransition()).size());
- assertEquals("number of triggered transitions", 17, instances.get(RoomPackage.eINSTANCE.getTriggeredTransition()).size());
- assertEquals("number of continuation transitions", 4, instances.get(RoomPackage.eINSTANCE.getContinuationTransition()).size());
- assertEquals("number of branch transitions", 3, instances.get(RoomPackage.eINSTANCE.getCPBranchTransition()).size());
- }
-
- @Test
- public void testXPACGeneral() {
- EList<TransitionChain> chains = xpac.getTransitionChains();
- assertEquals("number of chains", 20, chains.size());
- assertEquals("numer of triggers", 8, xpac.getTriggers().size());
- }
-
- @Test
- public void testGraph() {
- ArrayList<EObject> states = instances.get(RoomPackage.eINSTANCE.getSimpleState());
-// for (EObject obj : states) {
-// LogicalSystem.out.println("state "+RoomNameProvider.getFullPath((StateGraphItem) obj));
-// }
-
- State s = (State) getStateGraphItem(states, "State3_State3");
- assertNotNull("state exists", s);
- assertEquals("number of incoming transitions", 3, xpac.getIncomingTransitions(s).size());
- assertEquals("number of outgoing transitions", 2, xpac.getOutgoingTransitions(s).size());
-
- assertEquals("active triggers", 6, xpac.getActiveTriggers(s).size());
-
- s = (State) getStateGraphItem(states, "State2");
- assertNotNull("state exists", s);
- assertEquals("number of incoming transitions", 4, xpac.getIncomingTransitions(s).size());
- assertEquals("number of outgoing transitions", 1, xpac.getOutgoingTransitions(s).size());
-
- assertEquals("active triggers", 3, xpac.getActiveTriggers(s).size());
-
- ArrayList<EObject> cps = instances.get(RoomPackage.eINSTANCE.getChoicePoint());
-
- ChoicePoint cp = (ChoicePoint) cps.get(0);
- assertEquals("choicepoint name", "CP1", RoomNameProvider.getFullPath(cp));
- assertEquals("number of incoming transitions", 1, xpac.getIncomingTransitions(cp).size());
- assertEquals("number of outgoing transitions", 4, xpac.getOutgoingTransitions(cp).size());
-
- ContinuationTransition dflt = xpac.getDefaultBranch(xpac.getOutgoingTransitions(cp));
- assertNotNull("default branch", dflt);
- }
-
- @Test
- public void testChains() {
- ArrayList<EObject> cts = instances.get(RoomPackage.eINSTANCE.getContinuationTransition());
-// for (EObject obj : cts) {
-// LogicalSystem.out.println("ct "+RoomNameProvider.getFullPath((StateGraphItem) obj));
-// }
-
- Transition t = (Transition) getStateGraphItem(cts, "State3_TRANS_tr1_FROM_tp1_TO_State3");
- assertNotNull("transition", t);
-
- TransitionChain chain = xpac.getChain(t);
- assertNotNull("chain", chain);
- assertEquals("chain name", "TRANS_tr5_FROM_tp0_TO_State3_tp1_BY_afct", RoomNameProvider.getFullPath(chain.getTransition()));
-
- t = (Transition) getStateGraphItem(cts, "State3_TRANS_tr8_FROM_tp6_TO_State2");
- assertNotNull("transition", t);
-
- chain = xpac.getChain(t);
- assertNotNull("chain", chain);
- assertEquals("chain name", "TRANS_tr12_FROM_State5_TO_State3_tp6_BY_aport", RoomNameProvider.getFullPath(chain.getTransition()));
- }
-}
+/*******************************************************************************
+ * 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.core.genmodel;
+
+import static org.junit.Assert.*;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass;
+import org.eclipse.etrice.core.genmodel.etricegen.Root;
+import org.eclipse.etrice.core.genmodel.etricegen.TransitionChain;
+import org.eclipse.etrice.core.naming.RoomNameProvider;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.eclipse.etrice.core.room.ChoicePoint;
+import org.eclipse.etrice.core.room.ContinuationTransition;
+import org.eclipse.etrice.core.room.RoomPackage;
+import org.eclipse.etrice.core.room.State;
+import org.eclipse.etrice.core.room.Transition;
+
+public class TestStatesInheritance extends TestInstanceModelBuilderBase {
+
+ private Root root;
+ private HashMap<EClass, ArrayList<EObject>> instances;
+ private ExpandedActorClass xpac;
+
+ @Before
+ public void setUp() {
+ prepare();
+
+ root = buildInstanceModel("states_inheritance.room");
+ xpac = getTestee();
+ instances = collectInstances(xpac);
+ }
+
+ private ExpandedActorClass getTestee() {
+ for (ExpandedActorClass xpac : root.getXpActorClasses()) {
+ if (xpac.getActorClass().getName().equals("ADerived"))
+ return xpac;
+ }
+ return null;
+ }
+
+// private void assertEquals(String msg, int exp, int is) {
+// LogicalSystem.out.println(msg+" exp:"+exp+" is:"+is);
+// }
+//
+// private void assertEquals(String msg, String exp, String is) {
+// LogicalSystem.out.println(msg+" exp:"+exp+" is:"+is);
+// }
+//
+// private void assertEquals(String msg, EObject exp, EObject is) {
+// LogicalSystem.out.println(msg+" exp:"+exp+" is:"+is);
+// }
+
+ @Test
+ public void testNumbers() {
+ assertEquals("number of states", 9, instances.get(RoomPackage.eINSTANCE.getSimpleState()).size());
+ assertEquals("number of choice points", 1, instances.get(RoomPackage.eINSTANCE.getChoicePoint()).size());
+ assertEquals("number of transition points", 5, instances.get(RoomPackage.eINSTANCE.getTransitionPoint()).size());
+ assertEquals("number of entry points", 2, instances.get(RoomPackage.eINSTANCE.getEntryPoint()).size());
+ assertEquals("number of exit points", 1, instances.get(RoomPackage.eINSTANCE.getExitPoint()).size());
+ assertEquals("number of initial transitions", 3, instances.get(RoomPackage.eINSTANCE.getInitialTransition()).size());
+ assertEquals("number of triggered transitions", 17, instances.get(RoomPackage.eINSTANCE.getTriggeredTransition()).size());
+ assertEquals("number of continuation transitions", 4, instances.get(RoomPackage.eINSTANCE.getContinuationTransition()).size());
+ assertEquals("number of branch transitions", 3, instances.get(RoomPackage.eINSTANCE.getCPBranchTransition()).size());
+ }
+
+ @Test
+ public void testXPACGeneral() {
+ EList<TransitionChain> chains = xpac.getTransitionChains();
+ assertEquals("number of chains", 20, chains.size());
+ assertEquals("numer of triggers", 8, xpac.getTriggers().size());
+ }
+
+ @Test
+ public void testGraph() {
+ ArrayList<EObject> states = instances.get(RoomPackage.eINSTANCE.getSimpleState());
+// for (EObject obj : states) {
+// LogicalSystem.out.println("state "+RoomNameProvider.getFullPath((StateGraphItem) obj));
+// }
+
+ State s = (State) getStateGraphItem(states, "State3_State3");
+ assertNotNull("state exists", s);
+ assertEquals("number of incoming transitions", 3, xpac.getIncomingTransitions(s).size());
+ assertEquals("number of outgoing transitions", 2, xpac.getOutgoingTransitions(s).size());
+
+ assertEquals("active triggers", 6, xpac.getActiveTriggers(s).size());
+
+ s = (State) getStateGraphItem(states, "State2");
+ assertNotNull("state exists", s);
+ assertEquals("number of incoming transitions", 4, xpac.getIncomingTransitions(s).size());
+ assertEquals("number of outgoing transitions", 1, xpac.getOutgoingTransitions(s).size());
+
+ assertEquals("active triggers", 3, xpac.getActiveTriggers(s).size());
+
+ ArrayList<EObject> cps = instances.get(RoomPackage.eINSTANCE.getChoicePoint());
+
+ ChoicePoint cp = (ChoicePoint) cps.get(0);
+ assertEquals("choicepoint name", "CP1", RoomNameProvider.getFullPath(cp));
+ assertEquals("number of incoming transitions", 1, xpac.getIncomingTransitions(cp).size());
+ assertEquals("number of outgoing transitions", 4, xpac.getOutgoingTransitions(cp).size());
+
+ ContinuationTransition dflt = xpac.getDefaultBranch(xpac.getOutgoingTransitions(cp));
+ assertNotNull("default branch", dflt);
+ }
+
+ @Test
+ public void testChains() {
+ ArrayList<EObject> cts = instances.get(RoomPackage.eINSTANCE.getContinuationTransition());
+// for (EObject obj : cts) {
+// LogicalSystem.out.println("ct "+RoomNameProvider.getFullPath((StateGraphItem) obj));
+// }
+
+ Transition t = (Transition) getStateGraphItem(cts, "State3_TRANS_tr1_FROM_tp1_TO_State3");
+ assertNotNull("transition", t);
+
+ TransitionChain chain = xpac.getChain(t);
+ assertNotNull("chain", chain);
+ assertEquals("chain name", "TRANS_tr5_FROM_tp0_TO_State3_tp1_BY_afct", RoomNameProvider.getFullPath(chain.getTransition()));
+
+ t = (Transition) getStateGraphItem(cts, "State3_TRANS_tr8_FROM_tp6_TO_State2");
+ assertNotNull("transition", t);
+
+ chain = xpac.getChain(t);
+ assertNotNull("chain", chain);
+ assertEquals("chain name", "TRANS_tr12_FROM_State5_TO_State3_tp6_BY_aport", RoomNameProvider.getFullPath(chain.getTransition()));
+ }
+}
diff --git a/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestStructureInheritance.java b/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestStructureInheritance.java
index 1772f7dd1..2c0b3b5bb 100644
--- a/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestStructureInheritance.java
+++ b/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestStructureInheritance.java
@@ -1,174 +1,174 @@
-/*******************************************************************************
- * 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.core.genmodel;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.fail;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.junit.Before;
-import org.junit.Test;
-
-import org.eclipse.etrice.core.genmodel.etricegen.ETriceGenPackage;
-import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass;
-import org.eclipse.etrice.core.genmodel.etricegen.InterfaceItemInstance;
-import org.eclipse.etrice.core.genmodel.etricegen.PortInstance;
-import org.eclipse.etrice.core.genmodel.etricegen.PortKind;
-import org.eclipse.etrice.core.genmodel.etricegen.Root;
-import org.eclipse.etrice.core.genmodel.etricegen.SAPInstance;
-import org.eclipse.etrice.core.genmodel.etricegen.ServiceImplInstance;
-import org.eclipse.etrice.core.room.ActorClass;
-import org.eclipse.etrice.core.room.Port;
-import org.eclipse.etrice.core.room.SAPRef;
-
-public class TestStructureInheritance extends TestInstanceModelBuilderBase {
-
- private Root root;
- private ExpandedActorClass xpac;
- private HashMap<EClass, ArrayList<EObject>> instances;
-
- @Before
- public void setUp() {
- prepare();
-
- root = buildInstanceModel("structure_inheritance.room");
- xpac = getTestee();
- instances = collectInstances(root);
- }
-
- private ExpandedActorClass getTestee() {
- for (ExpandedActorClass xpac : root.getXpActorClasses()) {
- if (xpac.getActorClass().getName().equals("AFunctionA"))
- return xpac;
- }
- return null;
- }
-
-// private void assertEquals(String msg, int exp, int is) {
-// LogicalSystem.out.println(msg+" exp:"+exp+" is:"+is);
-// }
-//
-// private void assertEquals(String msg, EObject exp, EObject is) {
-// LogicalSystem.out.println(msg+" exp:"+exp+" is:"+is);
-// }
-
- @Test
- public void testInstanceNumbers() {
- ArrayList<EObject> actors = instances.get(ETriceGenPackage.eINSTANCE.getActorInstance());
- assertEquals("Number of ActorInstances", 8, actors.size());
-
- ArrayList<EObject> ports = instances.get(ETriceGenPackage.eINSTANCE.getPortInstance());
- assertEquals("Number of PortInstances", 30, ports.size());
-
- ArrayList<EObject> saps = instances.get(ETriceGenPackage.eINSTANCE.getSAPInstance());
- assertEquals("Number of SAPInstances", 8, saps.size());
-
- ArrayList<EObject> spps = instances.get(ETriceGenPackage.eINSTANCE.getSPPInstance());
- assertEquals("Number of SPPInstances", 2, spps.size());
-
- ArrayList<EObject> svcs = instances.get(ETriceGenPackage.eINSTANCE.getServiceImplInstance());
- assertEquals("Number of ServiceImplInstances", 2, svcs.size());
- }
-
- @Test
- public void testLayerConnections() {
- ArrayList<EObject> saps = instances.get(ETriceGenPackage.eINSTANCE.getSAPInstance());
-
- for (EObject obj : saps) {
- assertEquals("SAP has one peer", 1, ((SAPInstance)obj).getPeers().size());
- }
-
- SAPInstance sap = (SAPInstance) getInstance(saps, "/CMain/application/fcta/sub2/timeout");
- assertNotNull("sap expected", sap);
- InterfaceItemInstance peer = ((SAPInstance)sap).getPeers().get(0);
- assertTrue("peer is a service", (peer instanceof ServiceImplInstance));
- ServiceImplInstance svc = (ServiceImplInstance) peer;
- assertEquals("number of serviceA peers", 8, svc.getPeers().size());
- assertEquals("sap and service have same protocol", sap.getSap().getProtocol(), svc.getSvcImpl().getSpp().getProtocol());
- }
-
- private Port getPort(ActorClass ac, String name) {
- for (Port p : ac.getIfPorts()) {
- if (p.getName().equals(name))
- return p;
- }
- for (Port p : ac.getIntPorts()) {
- if (p.getName().equals(name))
- return p;
- }
-
- if (ac.getBase()!=null)
- return getPort(ac.getBase(), name);
-
- fail("port "+name+" not found");
- return null;
- }
-
- private SAPRef getSAP(ActorClass ac, String name) {
- for (SAPRef sap : ac.getStrSAPs()) {
- if (sap.getName().equals(name))
- return sap;
- }
-
- if (ac.getBase()!=null)
- return getSAP(ac.getBase(), name);
-
- fail("sap "+name+" not found");
- return null;
- }
-
- @Test
- public void testIfItems() {
- Port base = getPort(xpac.getActorClass(), "base");
- Port subbase = getPort(xpac.getActorClass(), "subbase");
- Port ctrl = getPort(xpac.getActorClass(), "ctrl");
- Port subctrl = getPort(xpac.getActorClass(), "subctrl");
- Port fct1 = getPort(xpac.getActorClass(), "fct1");
- Port fct2 = getPort(xpac.getActorClass(), "fct2");
- SAPRef ctrltimeout = getSAP(xpac.getActorClass(), "ctrltimeout");
- SAPRef timeout = getSAP(xpac.getActorClass(), "timeout");
-
- int lid = 0;
- assertEquals("port local id", lid++, xpac.getInterfaceItemLocalId(base));
- assertEquals("port local id", lid++, xpac.getInterfaceItemLocalId(subbase));
- assertEquals("port local id", lid++, xpac.getInterfaceItemLocalId(ctrl));
- assertEquals("port local id", lid++, xpac.getInterfaceItemLocalId(subctrl));
- assertEquals("sap local id", lid++, xpac.getInterfaceItemLocalId(ctrltimeout));
- assertEquals("sap local id", lid++, xpac.getInterfaceItemLocalId(timeout));
- assertEquals("relay port local id", -1, xpac.getInterfaceItemLocalId(fct1));
- assertEquals("relay port local id", -1, xpac.getInterfaceItemLocalId(fct2));
- }
-
- @Test
- public void testPortConnection() {
- ArrayList<EObject> ports = instances.get(ETriceGenPackage.eINSTANCE.getPortInstance());
-
- PortInstance p = (PortInstance) getInstance(ports, "/CMain/application/fcta/sub2/fct");
- assertNotNull("port expected", p);
- assertEquals("external port expected", PortKind.EXTERNAL.getValue(), p.getKind().getValue());
- assertFalse("no conjuagted port expected", p.getPort().isConjugated());
- assertEquals("port connected once", 1, p.getPeers().size());
- PortInstance peer = (PortInstance) getInstance(p.getPeers(), "/CMain/application/client/pa1");
- assertNotNull("peer expected", peer);
- peer = (PortInstance) getInstance(peer.getPeers(), "/CMain/application/fcta/sub2/fct");
- assertNotNull("peer expected", peer);
- assertEquals("peer of peer is start", p, peer);
- }
-}
+/*******************************************************************************
+ * 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.core.genmodel;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.fail;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.eclipse.etrice.core.genmodel.etricegen.ETriceGenPackage;
+import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass;
+import org.eclipse.etrice.core.genmodel.etricegen.InterfaceItemInstance;
+import org.eclipse.etrice.core.genmodel.etricegen.PortInstance;
+import org.eclipse.etrice.core.genmodel.etricegen.PortKind;
+import org.eclipse.etrice.core.genmodel.etricegen.Root;
+import org.eclipse.etrice.core.genmodel.etricegen.SAPInstance;
+import org.eclipse.etrice.core.genmodel.etricegen.ServiceImplInstance;
+import org.eclipse.etrice.core.room.ActorClass;
+import org.eclipse.etrice.core.room.Port;
+import org.eclipse.etrice.core.room.SAPRef;
+
+public class TestStructureInheritance extends TestInstanceModelBuilderBase {
+
+ private Root root;
+ private ExpandedActorClass xpac;
+ private HashMap<EClass, ArrayList<EObject>> instances;
+
+ @Before
+ public void setUp() {
+ prepare();
+
+ root = buildInstanceModel("structure_inheritance.room");
+ xpac = getTestee();
+ instances = collectInstances(root);
+ }
+
+ private ExpandedActorClass getTestee() {
+ for (ExpandedActorClass xpac : root.getXpActorClasses()) {
+ if (xpac.getActorClass().getName().equals("AFunctionA"))
+ return xpac;
+ }
+ return null;
+ }
+
+// private void assertEquals(String msg, int exp, int is) {
+// LogicalSystem.out.println(msg+" exp:"+exp+" is:"+is);
+// }
+//
+// private void assertEquals(String msg, EObject exp, EObject is) {
+// LogicalSystem.out.println(msg+" exp:"+exp+" is:"+is);
+// }
+
+ @Test
+ public void testInstanceNumbers() {
+ ArrayList<EObject> actors = instances.get(ETriceGenPackage.eINSTANCE.getActorInstance());
+ assertEquals("Number of ActorInstances", 8, actors.size());
+
+ ArrayList<EObject> ports = instances.get(ETriceGenPackage.eINSTANCE.getPortInstance());
+ assertEquals("Number of PortInstances", 30, ports.size());
+
+ ArrayList<EObject> saps = instances.get(ETriceGenPackage.eINSTANCE.getSAPInstance());
+ assertEquals("Number of SAPInstances", 8, saps.size());
+
+ ArrayList<EObject> spps = instances.get(ETriceGenPackage.eINSTANCE.getSPPInstance());
+ assertEquals("Number of SPPInstances", 2, spps.size());
+
+ ArrayList<EObject> svcs = instances.get(ETriceGenPackage.eINSTANCE.getServiceImplInstance());
+ assertEquals("Number of ServiceImplInstances", 2, svcs.size());
+ }
+
+ @Test
+ public void testLayerConnections() {
+ ArrayList<EObject> saps = instances.get(ETriceGenPackage.eINSTANCE.getSAPInstance());
+
+ for (EObject obj : saps) {
+ assertEquals("SAP has one peer", 1, ((SAPInstance)obj).getPeers().size());
+ }
+
+ SAPInstance sap = (SAPInstance) getInstance(saps, "/CMain/application/fcta/sub2/timeout");
+ assertNotNull("sap expected", sap);
+ InterfaceItemInstance peer = ((SAPInstance)sap).getPeers().get(0);
+ assertTrue("peer is a service", (peer instanceof ServiceImplInstance));
+ ServiceImplInstance svc = (ServiceImplInstance) peer;
+ assertEquals("number of serviceA peers", 8, svc.getPeers().size());
+ assertEquals("sap and service have same protocol", sap.getSap().getProtocol(), svc.getSvcImpl().getSpp().getProtocol());
+ }
+
+ private Port getPort(ActorClass ac, String name) {
+ for (Port p : ac.getIfPorts()) {
+ if (p.getName().equals(name))
+ return p;
+ }
+ for (Port p : ac.getIntPorts()) {
+ if (p.getName().equals(name))
+ return p;
+ }
+
+ if (ac.getBase()!=null)
+ return getPort(ac.getBase(), name);
+
+ fail("port "+name+" not found");
+ return null;
+ }
+
+ private SAPRef getSAP(ActorClass ac, String name) {
+ for (SAPRef sap : ac.getStrSAPs()) {
+ if (sap.getName().equals(name))
+ return sap;
+ }
+
+ if (ac.getBase()!=null)
+ return getSAP(ac.getBase(), name);
+
+ fail("sap "+name+" not found");
+ return null;
+ }
+
+ @Test
+ public void testIfItems() {
+ Port base = getPort(xpac.getActorClass(), "base");
+ Port subbase = getPort(xpac.getActorClass(), "subbase");
+ Port ctrl = getPort(xpac.getActorClass(), "ctrl");
+ Port subctrl = getPort(xpac.getActorClass(), "subctrl");
+ Port fct1 = getPort(xpac.getActorClass(), "fct1");
+ Port fct2 = getPort(xpac.getActorClass(), "fct2");
+ SAPRef ctrltimeout = getSAP(xpac.getActorClass(), "ctrltimeout");
+ SAPRef timeout = getSAP(xpac.getActorClass(), "timeout");
+
+ int lid = 0;
+ assertEquals("port local id", lid++, xpac.getInterfaceItemLocalId(base));
+ assertEquals("port local id", lid++, xpac.getInterfaceItemLocalId(subbase));
+ assertEquals("port local id", lid++, xpac.getInterfaceItemLocalId(ctrl));
+ assertEquals("port local id", lid++, xpac.getInterfaceItemLocalId(subctrl));
+ assertEquals("sap local id", lid++, xpac.getInterfaceItemLocalId(ctrltimeout));
+ assertEquals("sap local id", lid++, xpac.getInterfaceItemLocalId(timeout));
+ assertEquals("relay port local id", -1, xpac.getInterfaceItemLocalId(fct1));
+ assertEquals("relay port local id", -1, xpac.getInterfaceItemLocalId(fct2));
+ }
+
+ @Test
+ public void testPortConnection() {
+ ArrayList<EObject> ports = instances.get(ETriceGenPackage.eINSTANCE.getPortInstance());
+
+ PortInstance p = (PortInstance) getInstance(ports, "/CMain/application/fcta/sub2/fct");
+ assertNotNull("port expected", p);
+ assertEquals("external port expected", PortKind.EXTERNAL.getValue(), p.getKind().getValue());
+ assertFalse("no conjuagted port expected", p.getPort().isConjugated());
+ assertEquals("port connected once", 1, p.getPeers().size());
+ PortInstance peer = (PortInstance) getInstance(p.getPeers(), "/CMain/application/client/pa1");
+ assertNotNull("peer expected", peer);
+ peer = (PortInstance) getInstance(peer.getPeers(), "/CMain/application/fcta/sub2/fct");
+ assertNotNull("peer expected", peer);
+ assertEquals("peer of peer is start", p, peer);
+ }
+}

Back to the top