Skip to content

Commit efee9e6

Browse files
committed
Update tests case to proof the new grammar of the models
1 parent 537bc03 commit efee9e6

File tree

8 files changed

+84
-86
lines changed

8 files changed

+84
-86
lines changed

plugins/de.fraunhofer.ipa.ros.xtext.tests/resources/basic_msgs/common_msgs.ros

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
PackageSet{package{
2-
Package geometry_msgs{ spec {
1+
PackageSet{
2+
Package geometry_msgs{ Specs {
33
TopicSpec Accel{ message { Vector3 linear Vector3 angular }},
44
TopicSpec AccelStamped{ message { Header header Accel accel }},
55
TopicSpec AccelWithCovariance{ message { Accel accel float64[] covariance }},
@@ -116,5 +116,4 @@ PackageSet{package{
116116
TopicSpec MarkerArray{ message { Marker[] markers }},
117117
TopicSpec MenuEntry{ message { uint32 id uint32 parent_id string title string command uint8 FEEDBACK=0 uint8 ROSRUN=1 uint8 ROSLAUNCH=2 uint8 command_type }}
118118
}}
119-
}
120119
}

plugins/de.fraunhofer.ipa.ros.xtext.tests/resources/basic_msgs/ros_core.ros

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
PackageSet{package{
2-
Package std_msgs{ spec {
1+
PackageSet{
2+
Package std_msgs{ Specs {
33
TopicSpec Bool{ message { bool data }},
44
TopicSpec Byte{ message { byte data }},
55
TopicSpec ByteMultiArray{ message { MultiArrayLayout layout byte[] data }},
@@ -37,5 +37,4 @@ PackageSet{package{
3737
ServiceSpec SetBool{ request { bool data } response { bool success string message } },
3838
ServiceSpec Trigger{ request { } response { bool success string message } }
3939
}}
40-
}
4140
}
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
PackageSet { package {
2-
CatkinPackage test_pkg { artifact {
3-
Artifact test_node { node Node { name test_node
4-
serviceserver {
1+
PackageSet {
2+
CatkinPackage test_pkg {
3+
Artifact test_node { Node { name test_node
4+
ServiceServers {
55
ServiceServer {name setBool service "std_srvs.SetBool"}}
6-
publisher {
6+
Publishers {
77
Publisher { name scan message "sensor_msgs.LaserScan" }}
8-
subscriber {
8+
Subscribers {
99
Subscriber { name power_state message "sensor_msgs.BatteryState"}}
10-
serviceclient {
10+
ServiceClients {
1111
ServiceClient { name init service "std_srvs.Trigger"}}
12-
parameter {
12+
Parameters {
1313
Parameter { name string_test type String {default test}},
1414
Parameter { name bool_tets type Boolean },
1515
Parameter { name array_tets type Array {type String}},
@@ -24,4 +24,4 @@ PackageSet { package {
2424
last_element Struc { hola Integer, what String}}
2525
}
2626
}}
27-
}}}}}
27+
}}}
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
PackageSet { package {
2-
CatkinPackage test_pkg { artifact {
3-
Artifact testNode { node Node { name testNode
4-
serviceserver {
1+
PackageSet {
2+
CatkinPackage test_pkg {
3+
Artifact testNode { Node { name testNode
4+
ServiceServers {
55
ServiceServer {name setBool service "std_srvs.SetBool"}}
6-
publisher {
6+
Publishers {
77
Publisher { name scan message "sensor_msgs.LaserScan" }}
8-
subscriber {
8+
Subscribers {
99
Subscriber { name power_state message "sensor_msgs.BatteryState"}}
10-
serviceclient {
10+
ServiceClients {
1111
ServiceClient { name init service "std_srvs.Trigger"}}
12-
parameter {
12+
Parameters {
1313
Parameter { name string_test type String {default test}},
1414
Parameter { name bool_tets type Boolean },
1515
Parameter { name array_tets type Array {type String}},
@@ -24,4 +24,4 @@ PackageSet { package {
2424
last_element Struc { hola Integer, what String}}
2525
}
2626
}}
27-
}}}}}
27+
}}}

plugins/de.fraunhofer.ipa.ros.xtext.tests/src/de/fraunhofer/ipa/ros/tests/RosTestingUtils.xtend

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,16 @@ class RosTestingUtils {
2525
val fileContent_common_msgs = new String(Files.readAllBytes(Paths.get(RESOURCES_BASE_DIR, 'basic_msgs', 'common_msgs.ros')))
2626

2727
val messages = resourceSet.createResource(URI.createURI("msgs.ros"))
28-
messages.load(new StringInputStream('''PackageSet{package{
29-
Package sensor_msgs{ spec {
28+
messages.load(new StringInputStream('''PackageSet{
29+
Package sensor_msgs{ Specs {
3030
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 }},
3131
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 }}
3232
3333
}},
34-
Package std_srvs{ spec {
34+
Package std_srvs{ Specs {
3535
ServiceSpec SetBool{ request { bool data } response { bool success string message } },
3636
ServiceSpec Trigger{ request { } response { bool success string message } }
3737
}}
38-
}
3938
}'''), emptyMap)
4039
messages.load(new StringInputStream(fileContent_common_msgs), emptyMap)
4140
messages.load(new StringInputStream(fileContent_core_msgs), emptyMap)
Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
PackageSet { package {
2-
CatkinPackage test_pkg { artifact {
3-
Artifact test_node { node Node { name test_node
4-
serviceserver {
1+
PackageSet {
2+
CatkinPackage test_pkg {
3+
Artifact test_node {
4+
Node { name test_node
5+
ServiceServers {
56
ServiceServer {name setBool service "std_srvs.SetBool"}}
6-
publisher {
7+
Publishers {
78
Publisher { name scan message "sensor_msgs.LaserScan" }}
8-
subscriber {
9+
Subscribers {
910
Subscriber { name power_state message "sensor_msgs.BatteryState"}}
10-
serviceclient {
11+
ServiceClients {
1112
ServiceClient { name init service "std_srvs.Trigger"}}
12-
parameter {
13+
Parameters {
1314
Parameter { name string_test type String {default test}},
1415
Parameter { name bool_tets type Boolean },
1516
Parameter { name array_tets type Array {type String}},
@@ -23,4 +24,4 @@ PackageSet { package {
2324
third_element String ,
2425
last_element Struc { hola Integer, what String}}
2526
}
26-
}}}}}}}
27+
}}}}}
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
PackageSet { package {
2-
CatkinPackage test_pkg { artifact {
3-
Artifact test_node { node Node { name test_node
4-
serviceserver {
1+
PackageSet {
2+
CatkinPackage test_pkg {
3+
Artifact test_node { Node { name test_node
4+
ServiceServers {
55
ServiceServer {name init service "std_srvs.Trigger"}}
6-
publisher {
6+
Publishers {
77
Publisher { name power_state message "sensor_msgs.BatteryState"}}
8-
subscriber {
8+
Subscribers {
99
Subscriber { name scan message "sensor_msgs.LaserScan" }}
10-
serviceclient {
10+
ServiceClients {
1111
ServiceClient { name SetBool service "std_srvs.SetBool"}}
12-
}}}}}}
12+
}}}}

plugins/de.fraunhofer.ipa.rossystem.xtext.tests/src/de/fraunhofer/ipa/rossystem/tests/RosSystemValidationTest.xtend

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,18 @@ class RosSystemValidationTest {
4343
val ros_model = resourceSet.createResource(URI.createURI("resources.ros"))
4444

4545
ros_model.load(new StringInputStream( '''
46-
PackageSet { package {
47-
CatkinPackage test_pkg { artifact {
48-
Artifact test_node { node Node { name test_node
49-
serviceserver {
46+
PackageSet {
47+
CatkinPackage test_pkg {
48+
Artifact test_node { Node { name test_node
49+
ServiceServers {
5050
ServiceServer {name setBool service "std_srvs.SetBool"}}
51-
publisher {
51+
Publishers {
5252
Publisher { name scan message "sensor_msgs.LaserScan" }}
53-
subscriber {
53+
Subscribers {
5454
Subscriber { name power_state message "sensor_msgs.BatteryState"}}
55-
serviceclient {
55+
ServiceClients {
5656
ServiceClient { name init service "std_srvs.Trigger"}}
57-
parameter {
57+
Parameters {
5858
Parameter { name string_test type String {default test}},
5959
Parameter { name bool_tets type Boolean },
6060
Parameter { name array_tets type Array {type String}},
@@ -68,24 +68,24 @@ class RosSystemValidationTest {
6868
third_element String ,
6969
last_element Struc { hola Integer, what String}}
7070
}
71-
}}}}},
72-
CatkinPackage test_pkg { artifact {
73-
Artifact test_node { node Node { name test_node
74-
serviceserver {
71+
}}}},
72+
CatkinPackage test_pkg {
73+
Artifact test_node { Node { name test_node
74+
ServiceServers {
7575
ServiceServer {name init service "std_srvs.Trigger"}}
76-
publisher {
76+
Publishers {
7777
Publisher { name power_state message "sensor_msgs.BatteryState"}}
78-
subscriber {
78+
Subscribers {
7979
Subscriber { name scan message "sensor_msgs.LaserScan" }}
80-
serviceclient {
80+
ServiceClients {
8181
ServiceClient { name SetBool service "std_srvs.SetBool"}}
82-
}}}},
83-
CatkinPackage sensor_msgs{ spec {
82+
}}},
83+
CatkinPackage sensor_msgs{ Specs {
8484
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 }},
85-
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 }}}},
86-
CatkinPackage std_srvs{ spec {
85+
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}}}},
86+
CatkinPackage std_srvs{ Specs {
8787
ServiceSpec SetBool{ request { bool data } response { bool success string message } },
88-
ServiceSpec Trigger{ request { } response { bool success string message }}}}}
88+
ServiceSpec Trigger{ request { } response { bool success string message }}}}
8989
}
9090
'''), emptyMap)
9191
val fileContent = new String(Files.readAllBytes(Paths.get(RESOURCES_BASE_DIR, 'test.rossystem')))
@@ -100,18 +100,18 @@ class RosSystemValidationTest {
100100
val ros_model = resourceSet.createResource(URI.createURI("resources.ros"))
101101

102102
ros_model.load(new StringInputStream( '''
103-
PackageSet { package {
104-
CatkinPackage test_pkg { artifact {
105-
Artifact test_node { node Node { name test_node
106-
serviceserver {
103+
PackageSet {
104+
CatkinPackage test_pkg {
105+
Artifact test_node { Node { name test_node
106+
ServiceServers {
107107
ServiceServer {name setBool service "std_srvs.SetBool"}}
108-
publisher {
108+
Publishers {
109109
Publisher { name scan message "sensor_msgs.LaserScan" }}
110-
subscriber {
110+
Subscribers {
111111
Subscriber { name power_state message "sensor_msgs.BatteryState"}}
112-
serviceclient {
112+
ServiceClients {
113113
ServiceClient { name init service "std_srvs.Trigger"}}
114-
parameter {
114+
Parameters {
115115
Parameter { name string_test type String {default test}},
116116
Parameter { name bool_tets type Boolean },
117117
Parameter { name array_tets type Array {type String}},
@@ -125,25 +125,25 @@ class RosSystemValidationTest {
125125
third_element String ,
126126
last_element Struc { hola Integer, what String}}
127127
}
128-
}}}}},
129-
CatkinPackage test_pkg { artifact {
130-
Artifact test_node { node Node { name test_node
131-
serviceserver {
128+
}}}},
129+
CatkinPackage test_pkg {
130+
Artifact test_node { Node { name test_node
131+
ServiceServers {
132132
ServiceServer {name init service "std_srvs.Trigger"}}
133-
publisher {
133+
Publishers {
134134
Publisher { name power_state message "sensor_msgs.BatteryState"}}
135-
subscriber {
135+
Subscribers {
136136
Subscriber { name scan message "sensor_msgs.LaserScan" }}
137-
serviceclient {
137+
ServiceClients {
138138
ServiceClient { name SetBool service "std_srvs.SetBool"}}
139-
}}}},
140-
CatkinPackage sensor_msgs{ spec {
139+
}}},
140+
CatkinPackage sensor_msgs{ Specs {
141141
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 }},
142142
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 }}}},
143-
CatkinPackage std_srvs{ spec {
143+
CatkinPackage std_srvs{ Specs {
144144
ServiceSpec SetBool{ request { bool data } response { bool success string message } },
145-
ServiceSpec Trigger{ request { } response { bool success string message }}}}}
146-
}
145+
ServiceSpec Trigger{ request { } response { bool success string message }}}
146+
}}
147147
'''), emptyMap)
148148
val fileContent = new String(Files.readAllBytes(Paths.get(RESOURCES_BASE_DIR, 'test_error.rossystem')))
149149
val model = parseHelper.parse(fileContent, resourceSet)
@@ -155,4 +155,4 @@ class RosSystemValidationTest {
155155
validationTester.assertError(model, RossystemPackage.Literals.SERVICE_CONNECTION, RosSystemValidator.NOT_MATCHED_TYPE)
156156
}
157157

158-
}
158+
}

0 commit comments

Comments
 (0)