diff --git a/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/resources/test_stacks.rossystem b/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/resources/test_stacks.rossystem
new file mode 100644
index 000000000..4dd350c61
--- /dev/null
+++ b/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/resources/test_stacks.rossystem
@@ -0,0 +1,43 @@
+RosSystem { Name 'test_stacks'
+ RosComponentStacks (
+ ComponentStack {
+ name stack1
+ RosComponents (
+ ComponentInterface { name test_node
+ FromRosNode "test_pkg.test_node.test_node"
+ RosPublishers{ RosPublisher "scan" { RefPublisher "test_pkg.test_node.test_node.scan"} }
+ RosSubscribers{ RosSubscriber "power_state" { RefSubscriber "test_pkg.test_node.test_node.power_state"} }
+ RosSrvServers{ RosServiceServer "setBool" { RefServer "test_pkg.test_node.test_node.setBool"} }
+ RosSrvClients{ RosServiceClient "init" { RefClient "test_pkg.test_node.test_node.init"} }
+ RosParameters{ RosParameter "string_test" { RefParameter "test_pkg.test_node.test_node.string_test"},
+ RosParameter "bool_tets" { RefParameter "test_pkg.test_node.test_node.bool_tets"},
+ RosParameter "array_tets" { RefParameter "test_pkg.test_node.test_node.array_tets"},
+ RosParameter "base64_test" { RefParameter "test_pkg.test_node.test_node.base64_test"},
+ RosParameter "double_test" { RefParameter "test_pkg.test_node.test_node.double_test"},
+ RosParameter "int_test" { RefParameter "test_pkg.test_node.test_node.int_test"},
+ RosParameter "list_test" { RefParameter "test_pkg.test_node.test_node.list_test"}}},
+ ComponentInterface { name test_node2 NameSpace test2
+ FromRosNode "test_pkg.test_node.test_node"
+ RosPublishers { RosPublisher "scan" { RefPublisher "test_pkg.test_node.test_node.scan" } }
+ RosSubscribers { RosSubscriber "power_state" { RefSubscriber "test_pkg.test_node.test_node.power_state" } }
+ RosSrvServers { RosServiceServer "setBool" { RefServer "test_pkg.test_node.test_node.setBool" } }
+ RosSrvClients { RosServiceClient "init" { RefClient "test_pkg.test_node.test_node.init" } }
+ RosParameters { RosParameter "string_test" { RefParameter "test_pkg.test_node.test_node.string_test" } ,
+ RosParameter "bool_tets" { RefParameter "test_pkg.test_node.test_node.bool_tets" } ,
+ RosParameter "array_tets" { RefParameter "test_pkg.test_node.test_node.array_tets" } ,
+ RosParameter "base64_test" { RefParameter "test_pkg.test_node.test_node.base64_test" } ,
+ RosParameter "double_test" { RefParameter "test_pkg.test_node.test_node.double_test" } ,
+ RosParameter "int_test" { RefParameter "test_pkg.test_node.test_node.int_test" } ,
+ RosParameter "list_test" { RefParameter "test_pkg.test_node.test_node.list_test" }}})},
+ ComponentStack {
+ name stack2
+ RosComponents (
+ ComponentInterface { name test_nodea
+ RosPublishers { RosPublisher power_state { RefPublisher "test_pkg.test_node.test_node.power_state" } }
+ RosSubscribers { RosSubscriber scan { RefSubscriber "test_pkg.test_node.test_node.scan" } }
+ RosSrvServers { RosServiceServer init { RefServer "test_pkg.test_node.test_node.init" } }
+ RosSrvClients { RosServiceClient SetBool { RefClient "test_pkg.test_node.test_node.SetBool" }}}
+ )
+ }
+ )
+}
diff --git a/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/resources/test_stacks/docker-compose.yml b/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/resources/test_stacks/docker-compose.yml
new file mode 100644
index 000000000..0d9170954
--- /dev/null
+++ b/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/resources/test_stacks/docker-compose.yml
@@ -0,0 +1,35 @@
+version: "3.3"
+networks:
+ ros:
+ driver: bridge
+
+services:
+ ros-master:
+ image: ros:melodic-ros-core
+ command: stdbuf -o L roscore
+ networks:
+ - ros
+
+ test_stacks_stack1:
+ image: "test_stacks_stack1:latest"
+ depends_on:
+ - ros-master
+ environment:
+ - "ROS_MASTER_URI=http://ros-master:11311"
+ - "ROS_HOSTNAME=stack1"
+ networks:
+ - ros
+ command: stdbuf -o L roslaunch test_stacks_stack1 stack1.launch --wait
+
+ test_stacks_stack2:
+ image: "test_stacks_stack2:latest"
+ depends_on:
+ - ros-master
+ environment:
+ - "ROS_MASTER_URI=http://ros-master:11311"
+ - "ROS_HOSTNAME=stack2"
+ networks:
+ - ros
+ command: stdbuf -o L roslaunch test_stacks_stack2 stack2.launch --wait
+
+
diff --git a/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/resources/test_stacks/test_stacks_stack1/CMakeLists.txt b/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/resources/test_stacks/test_stacks_stack1/CMakeLists.txt
new file mode 100644
index 000000000..493de8ca0
--- /dev/null
+++ b/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/resources/test_stacks/test_stacks_stack1/CMakeLists.txt
@@ -0,0 +1,12 @@
+cmake_minimum_required(VERSION 2.8.3)
+project(test_stacks_stack1)
+
+find_package(catkin REQUIRED)
+
+catkin_package()
+
+
+### INSTALL ###
+install(DIRECTORY launch
+ DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
+)
\ No newline at end of file
diff --git a/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/resources/test_stacks/test_stacks_stack1/Dockerfile b/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/resources/test_stacks/test_stacks_stack1/Dockerfile
new file mode 100644
index 000000000..5a9b7f3b8
--- /dev/null
+++ b/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/resources/test_stacks/test_stacks_stack1/Dockerfile
@@ -0,0 +1,40 @@
+# syntax=docker/dockerfile:experimental
+ARG SUFFIX=
+ARG PREFIX=
+FROM ros:melodic-ros-core as base
+FROM ${PREFIX}builder${SUFFIX} as builder
+
+FROM base as build
+COPY . /root/ws/src/test_stacks_stack1/
+RUN --mount=type=bind,from=builder,target=/builder \
+ apt-get update -qq && \
+ /builder/workspace.bash build_workspace /root/ws && \
+ rm -rf /var/lib/apt/lists/*
+
+FROM build as test
+RUN --mount=type=bind,from=builder,target=/builder \
+ apt-get update -qq && \
+ /builder/workspace.bash test_workspace /root/ws && \
+ rm -rf /var/lib/apt/lists/*
+
+FROM build as install
+RUN --mount=type=bind,from=builder,target=/builder \
+ apt-get update -qq && \
+ /builder/workspace.bash install_workspace /root/ws && \
+ rm -rf /var/lib/apt/lists/*
+
+FROM install as full
+RUN --mount=type=bind,from=builder,target=/builder \
+ apt-get update -qq && \
+ /builder/workspace.bash install_depends /root/ws && \
+ rm -rf /var/lib/apt/lists/*
+
+FROM base as deploy
+RUN --mount=type=bind,from=builder,target=/builder --mount=type=bind,target=/root/ws,from=install,source=/root/ws \
+ apt-get update -qq && \
+ /builder/workspace.bash install_depends /root/ws && \
+ rm -rf /var/lib/apt/lists/*
+COPY --from=install /opt/ros/$ROS_DISTRO /opt/ros/$ROS_DISTRO
+
+FROM deploy as launch
+CMD ["roslaunch", "test_stacks_stack1", "stack1.launch"]
diff --git a/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/resources/test_stacks/test_stacks_stack1/launch/stack1.launch b/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/resources/test_stacks/test_stacks_stack1/launch/stack1.launch
new file mode 100644
index 000000000..fd24f7daf
--- /dev/null
+++ b/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/resources/test_stacks/test_stacks_stack1/launch/stack1.launch
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/resources/test_stacks/test_stacks_stack1/package.xml b/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/resources/test_stacks/test_stacks_stack1/package.xml
new file mode 100644
index 000000000..2814b204a
--- /dev/null
+++ b/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/resources/test_stacks/test_stacks_stack1/package.xml
@@ -0,0 +1,18 @@
+
+ test_stacks_stack1
+ 0.0.1
+ This package provides launch file for operating test_stacks_stack1
+
+ Apache 2.0
+
+ http://wiki.ros.org/
+
+
+ Jane Doe
+ Jane Doe
+
+ catkin
+ test_pkg
+
+
+
\ No newline at end of file
diff --git a/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/resources/test_stacks/test_stacks_stack2/CMakeLists.txt b/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/resources/test_stacks/test_stacks_stack2/CMakeLists.txt
new file mode 100644
index 000000000..a3a73d166
--- /dev/null
+++ b/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/resources/test_stacks/test_stacks_stack2/CMakeLists.txt
@@ -0,0 +1,12 @@
+cmake_minimum_required(VERSION 2.8.3)
+project(test_stacks_stack2)
+
+find_package(catkin REQUIRED)
+
+catkin_package()
+
+
+### INSTALL ###
+install(DIRECTORY launch
+ DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
+)
\ No newline at end of file
diff --git a/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/resources/test_stacks/test_stacks_stack2/Dockerfile b/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/resources/test_stacks/test_stacks_stack2/Dockerfile
new file mode 100644
index 000000000..6892540ed
--- /dev/null
+++ b/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/resources/test_stacks/test_stacks_stack2/Dockerfile
@@ -0,0 +1,40 @@
+# syntax=docker/dockerfile:experimental
+ARG SUFFIX=
+ARG PREFIX=
+FROM ros:melodic-ros-core as base
+FROM ${PREFIX}builder${SUFFIX} as builder
+
+FROM base as build
+COPY . /root/ws/src/test_stacks_stack2/
+RUN --mount=type=bind,from=builder,target=/builder \
+ apt-get update -qq && \
+ /builder/workspace.bash build_workspace /root/ws && \
+ rm -rf /var/lib/apt/lists/*
+
+FROM build as test
+RUN --mount=type=bind,from=builder,target=/builder \
+ apt-get update -qq && \
+ /builder/workspace.bash test_workspace /root/ws && \
+ rm -rf /var/lib/apt/lists/*
+
+FROM build as install
+RUN --mount=type=bind,from=builder,target=/builder \
+ apt-get update -qq && \
+ /builder/workspace.bash install_workspace /root/ws && \
+ rm -rf /var/lib/apt/lists/*
+
+FROM install as full
+RUN --mount=type=bind,from=builder,target=/builder \
+ apt-get update -qq && \
+ /builder/workspace.bash install_depends /root/ws && \
+ rm -rf /var/lib/apt/lists/*
+
+FROM base as deploy
+RUN --mount=type=bind,from=builder,target=/builder --mount=type=bind,target=/root/ws,from=install,source=/root/ws \
+ apt-get update -qq && \
+ /builder/workspace.bash install_depends /root/ws && \
+ rm -rf /var/lib/apt/lists/*
+COPY --from=install /opt/ros/$ROS_DISTRO /opt/ros/$ROS_DISTRO
+
+FROM deploy as launch
+CMD ["roslaunch", "test_stacks_stack2", "stack2.launch"]
diff --git a/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/resources/test_stacks/test_stacks_stack2/launch/stack2.launch b/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/resources/test_stacks/test_stacks_stack2/launch/stack2.launch
new file mode 100644
index 000000000..324e36bb9
--- /dev/null
+++ b/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/resources/test_stacks/test_stacks_stack2/launch/stack2.launch
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/resources/test_stacks/test_stacks_stack2/package.xml b/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/resources/test_stacks/test_stacks_stack2/package.xml
new file mode 100644
index 000000000..539c9688c
--- /dev/null
+++ b/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/resources/test_stacks/test_stacks_stack2/package.xml
@@ -0,0 +1,18 @@
+
+ test_stacks_stack2
+ 0.0.1
+ This package provides launch file for operating test_stacks_stack2
+
+ Apache 2.0
+
+ http://wiki.ros.org/
+
+
+ Jane Doe
+ Jane Doe
+
+ catkin
+ test_pkg
+
+
+
\ No newline at end of file
diff --git a/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/resources/test_system/launch/test_system.launch b/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/resources/test_system/launch/test_system.launch
index 03e62025f..243c77819 100644
--- a/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/resources/test_system/launch/test_system.launch
+++ b/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/resources/test_system/launch/test_system.launch
@@ -1,13 +1,13 @@
-
- [1,2,a]
- [1,3]
-
+
+[1,2,a]
+[1,3]
+
first_element: 8
third_element: dsd
-
-
+
+
diff --git a/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/resources/test_system/package.xml b/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/resources/test_system/package.xml
index 51b2bddac..6adbbed74 100644
--- a/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/resources/test_system/package.xml
+++ b/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/resources/test_system/package.xml
@@ -11,7 +11,6 @@
Jane Doe
Jane Doe
-
catkin
test_pkg
diff --git a/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/src/de/fraunhofer/ipa/rossystem/tests/RosSystemGeneratorTest.xtend b/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/src/de/fraunhofer/ipa/rossystem/tests/RosSystemGeneratorTest.xtend
index 9fbe509b3..7cc4459da 100644
--- a/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/src/de/fraunhofer/ipa/rossystem/tests/RosSystemGeneratorTest.xtend
+++ b/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/src/de/fraunhofer/ipa/rossystem/tests/RosSystemGeneratorTest.xtend
@@ -25,13 +25,13 @@ class RosSystemGeneratorTest {
@Inject
ParseHelper parseHelper
-
+
@Inject
Provider resourceSetProvider
- @Inject
+ @Inject
RosSystemGenerator generator
-
+
String RESOURCES_BASE_DIR = 'resources'
@Test
@@ -43,16 +43,16 @@ class RosSystemGeneratorTest {
ros_model.load(new StringInputStream( '''
PackageSet {
CatkinPackage test_pkg {
- Artifact test_node { Node { name test_node
+ Artifact test_node { Node { name test_node
ServiceServers {
ServiceServer {name setBool service "std_srvs.SetBool"}}
- Publishers {
+ Publishers {
Publisher { name scan message "sensor_msgs.LaserScan" }}
Subscribers {
Subscriber { name power_state message "sensor_msgs.BatteryState"}}
ServiceClients {
ServiceClient { name init service "std_srvs.Trigger"}}
- Parameters {
+ Parameters {
Parameter { name string_test type String default test},
Parameter { name bool_tets type Boolean },
Parameter { name array_tets type Array {type String}},
@@ -60,25 +60,25 @@ class RosSystemGeneratorTest {
Parameter { name double_test type Double},
Parameter {name int_test type Integer},
Parameter {name list_test type List {Integer,Integer,String}},
- Parameter {name struc_test type Struct
+ Parameter {name struc_test type Struct
{first_element Integer ,
second_element List { Integer, String},
third_element String ,
last_element Struct { hola Integer, what String}}
}
}}}},
- CatkinPackage test_pkg {
- Artifact test_node { Node { name test_node
+ CatkinPackage test_pkg {
+ Artifact test_node { Node { name test_node
ServiceServers {
ServiceServer {name init service "std_srvs.Trigger"}}
- Publishers {
+ Publishers {
Publisher { name power_state message "sensor_msgs.BatteryState"}}
Subscribers {
Subscriber { name scan message "sensor_msgs.LaserScan" }}
ServiceClients {
ServiceClient { name SetBool service "std_srvs.SetBool"}}
}}},
- CatkinPackage sensor_msgs{ Specs {
+ CatkinPackage sensor_msgs{ Specs {
TopicSpec LaserScan{ message { Header header float32 angle_min float32 angle_max float32 angle_increment float32 time_increment float32 scan_time float32 range_min float32 range_max float32[] ranges float32[] intensities }},
TopicSpec BatteryState{ message { uint8 POWER_SUPPLY_STATUS_UNKNOWN=0 uint8 POWER_SUPPLY_STATUS_CHARGING=1 uint8 POWER_SUPPLY_STATUS_DISCHARGING=2 uint8 POWER_SUPPLY_STATUS_NOT_CHARGING=3 uint8 POWER_SUPPLY_STATUS_FULL=4 uint8 POWER_SUPPLY_HEALTH_UNKNOWN=0 uint8 POWER_SUPPLY_HEALTH_GOOD=1 uint8 POWER_SUPPLY_HEALTH_OVERHEAT=2 uint8 POWER_SUPPLY_HEALTH_DEAD=3 uint8 POWER_SUPPLY_HEALTH_OVERVOLTAGE=4 uint8 POWER_SUPPLY_HEALTH_UNSPEC_FAILURE=5 uint8 POWER_SUPPLY_HEALTH_COLD=6 uint8 POWER_SUPPLY_HEALTH_WATCHDOG_TIMER_EXPIRE=7 uint8 POWER_SUPPLY_HEALTH_SAFETY_TIMER_EXPIRE=8 uint8 POWER_SUPPLY_TECHNOLOGY_UNKNOWN=0 uint8 POWER_SUPPLY_TECHNOLOGY_NIMH=1 uint8 POWER_SUPPLY_TECHNOLOGY_LION=2 uint8 POWER_SUPPLY_TECHNOLOGY_LIPO=3 uint8 POWER_SUPPLY_TECHNOLOGY_LIFE=4 uint8 POWER_SUPPLY_TECHNOLOGY_NICD=5 uint8 POWER_SUPPLY_TECHNOLOGY_LIMN=6 Header header float32 voltage float32 current float32 charge float32 capacity float32 design_capacity float32 percentage uint8 power_supply_status uint8 power_supply_health uint8 power_supply_technology bool present float32[] cell_voltage string location string serial_number }}}},
CatkinPackage std_srvs{ Specs {
@@ -87,33 +87,75 @@ class RosSystemGeneratorTest {
}
'''), emptyMap)
val fileContent = new String(Files.readAllBytes(Paths.get(RESOURCES_BASE_DIR, 'test.rossystem')))
-
+
val model = parseHelper.parse(fileContent, resourceSet)
val fsa = new InMemoryFileSystemAccess
-
+
generator.doGenerate(model.eResource, fsa, new GeneratorContext)
-
- // Assert that all necessary files exist
+
+ // Assert that all necessary files exist
Assert.assertTrue(fsa.textFiles.containsKey(CustomOutputProvider::DEFAULT_OUTPUT + "test_system/launch/test_system.launch"))
Assert.assertTrue(fsa.textFiles.containsKey(CustomOutputProvider::DEFAULT_OUTPUT + "test_system/package.xml"))
Assert.assertTrue(fsa.textFiles.containsKey(CustomOutputProvider::DEFAULT_OUTPUT + "test_system/CMakeLists.txt"))
Assert.assertTrue(fsa.textFiles.containsKey(CustomOutputProvider::CM_CONFIGURATION + "test_system.componentinterface"))
-
+
// Test the generated launch file
Assert.assertEquals(new String(Files.readAllBytes(Paths.get(RESOURCES_BASE_DIR+'/test_system/launch/', 'test_system.launch'))).trim,
fsa.textFiles.get(CustomOutputProvider::DEFAULT_OUTPUT+'test_system/launch/test_system.launch').toString.trim)
-
+
// Test the generated package.xml file
Assert.assertEquals(new String(Files.readAllBytes(Paths.get(RESOURCES_BASE_DIR+'/test_system/', 'package.xml'))).trim,
fsa.textFiles.get(CustomOutputProvider::DEFAULT_OUTPUT+'test_system/package.xml').toString.trim)
-
+
// Test the generated CMakeLists.txt file
Assert.assertEquals(new String(Files.readAllBytes(Paths.get(RESOURCES_BASE_DIR+'/test_system/', 'CMakeLists.txt'))).trim,
fsa.textFiles.get(CustomOutputProvider::DEFAULT_OUTPUT+'test_system/CMakeLists.txt').toString.trim)
- // Test the generated component interface
+ // Test the generated component interface
Assert.assertEquals(new String(Files.readAllBytes(Paths.get(RESOURCES_BASE_DIR+'/test_system.componentinterface'))).trim,
fsa.textFiles.get(CustomOutputProvider::CM_CONFIGURATION + "test_system.componentinterface").toString.trim)
+
+ //STACKS
+ val system_name = new String('test_stacks')
+ val stcak_names = newArrayList('stack1', 'stack2')
+ val gen_system_prefix = new String(String.format("%s%s", CustomOutputProvider::DEFAULT_OUTPUT,system_name))
+ val system_prefix = new String(String.format("%s/%s",RESOURCES_BASE_DIR, system_name))
+
+ val fileContent_stack = new String(Files.readAllBytes(Paths.get(RESOURCES_BASE_DIR, String.format("%s.rossystem",system_name ))))
+ val model_stack = parseHelper.parse(fileContent_stack, resourceSet)
+
+ generator.doGenerate(model_stack.eResource, fsa, new GeneratorContext)
+
+ for (String name : stcak_names) {
+ val gen_stack_prefix = new String(String.format("%s/%s_%s", gen_system_prefix, system_name, name))
+ val stack_prefix = new String(String.format("%s/%s_%s", system_prefix, system_name, name))
+
+ // Assert that all necessary files exist
+ Assert.assertTrue(fsa.textFiles.containsKey(String.format("%s/launch/%s.launch", gen_stack_prefix, name)))
+ Assert.assertTrue(fsa.textFiles.containsKey(String.format("%s/package.xml", gen_stack_prefix)))
+ Assert.assertTrue(fsa.textFiles.containsKey(String.format("%s/CMakeLists.txt", gen_stack_prefix)))
+ Assert.assertTrue(fsa.textFiles.containsKey(String.format("%s/Dockerfile", gen_stack_prefix)))
+
+ // Test the generated launch file
+ Assert.assertEquals(new String(Files.readAllBytes(Paths.get(String.format("%s/launch/%s.launch", stack_prefix, name)))).trim,
+ fsa.textFiles.get(String.format("%s/launch/%s.launch", gen_stack_prefix, name)).toString.trim)
+
+ // Test the generated package.xml file
+ Assert.assertEquals(new String(Files.readAllBytes(Paths.get(stack_prefix, 'package.xml'))).trim,
+ fsa.textFiles.get(String.format("%s/package.xml", gen_stack_prefix)).toString.trim)
+
+ // Test the generated CMakeLists.txt file
+ Assert.assertEquals(new String(Files.readAllBytes(Paths.get(stack_prefix, 'CMakeLists.txt'))).trim,
+ fsa.textFiles.get(String.format("%s/CMakeLists.txt", gen_stack_prefix)).toString.trim)
+
+ // Test the generated component interface
+ Assert.assertEquals(new String(Files.readAllBytes(Paths.get(stack_prefix, 'Dockerfile'))).trim,
+ fsa.textFiles.get(String.format("%s/Dockerfile", gen_stack_prefix)).toString.trim)
+
+ }
+ Assert.assertTrue(fsa.textFiles.containsKey(String.format("%s/docker-compose.yml", gen_system_prefix)))
+ Assert.assertEquals(new String(Files.readAllBytes(Paths.get(system_prefix, 'docker-compose.yml'))).trim,
+ fsa.textFiles.get(String.format("%s/docker-compose.yml", gen_system_prefix)).toString.trim)
}
}
diff --git a/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/src/de/fraunhofer/ipa/rossystem/tests/RosSystemParsingTest.xtend b/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/src/de/fraunhofer/ipa/rossystem/tests/RosSystemParsingTest.xtend
index 1f1f3e83b..446d96483 100644
--- a/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/src/de/fraunhofer/ipa/rossystem/tests/RosSystemParsingTest.xtend
+++ b/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/src/de/fraunhofer/ipa/rossystem/tests/RosSystemParsingTest.xtend
@@ -31,6 +31,16 @@ class RosSystemParsingTest {
val errors = model.eResource.errors
Assert.assertTrue('''Unexpected errors: «errors.join(", ")»''', errors.isEmpty)
}
+
+ @Test
+ def void loadModel_stack() {
+ val fileContent = new String(Files.readAllBytes(Paths.get(RESOURCES_BASE_DIR, 'test_stacks.rossystem')))
+ val model = parseHelper.parse(fileContent)
+
+ Assert.assertNotNull(model)
+ val errors = model.eResource.errors
+ Assert.assertTrue('''Unexpected errors: «errors.join(", ")»''', errors.isEmpty)
+ }
@Test
@@ -51,6 +61,20 @@ class RosSystemParsingTest {
val ToTopic = model.topicConnections.get(0).to.get(0).name
val Subscriber = model.rosComponent.get(2).rossubscriber.get(0).name
Assert.assertEquals(ToTopic, Subscriber)
-
+ }
+
+ @Test
+ def void parseDomainmodel_stacks() {
+ val fileContent = new String(Files.readAllBytes(Paths.get(RESOURCES_BASE_DIR, 'test_stacks.rossystem')))
+ val model = parseHelper.parse(fileContent)
+
+ val ComponentStackName = model.componentStack.get(0).name
+ Assert.assertEquals("stack1", ComponentStackName)
+
+ val ComponentStackName2 = model.componentStack.get(1).name
+ Assert.assertEquals("stack2", ComponentStackName2)
+
+ val ComponentName = model.componentStack.get(0).rosComponent.get(0).name
+ Assert.assertEquals("test_node", ComponentName)
}
}
diff --git a/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/src/de/fraunhofer/ipa/rossystem/tests/RosSystemValidationTest.xtend b/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/src/de/fraunhofer/ipa/rossystem/tests/RosSystemValidationTest.xtend
index 47bdf1ec6..91b7c90fe 100644
--- a/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/src/de/fraunhofer/ipa/rossystem/tests/RosSystemValidationTest.xtend
+++ b/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/src/de/fraunhofer/ipa/rossystem/tests/RosSystemValidationTest.xtend
@@ -68,8 +68,7 @@ class RosSystemValidationTest {
third_element String ,
last_element Struct { hola Integer, what String}}
}
- }}}},
- CatkinPackage test_pkg {
+ }}},
Artifact test_node { Node { name test_node
ServiceServers {
ServiceServer {name init service "std_srvs.Trigger"}}
@@ -87,6 +86,7 @@ class RosSystemValidationTest {
ServiceSpec SetBool{ request { bool data } response { bool success string message } },
ServiceSpec Trigger{ request { } response { bool success string message }}}}
}
+
'''), emptyMap)
val fileContent = new String(Files.readAllBytes(Paths.get(RESOURCES_BASE_DIR, 'test.rossystem')))
val model = parseHelper.parse(fileContent, resourceSet)