Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJuergen Haug2012-12-12 15:04:49 +0000
committerJuergen Haug2012-12-12 15:04:49 +0000
commit72802f3f5250f6632ed0a4e6dc3bedcb9c5ffee4 (patch)
tree82752da439d361c9701506d895362c4110b523d9 /tests
parent13e48a31dba2985660abdbf3120ef2ca93557f69 (diff)
downloadorg.eclipse.etrice-72802f3f5250f6632ed0a4e6dc3bedcb9c5ffee4.tar.gz
org.eclipse.etrice-72802f3f5250f6632ed0a4e6dc3bedcb9c5ffee4.tar.xz
org.eclipse.etrice-72802f3f5250f6632ed0a4e6dc3bedcb9c5ffee4.zip
[config, generator, tests] static and dynamic config test + fixes
Diffstat (limited to 'tests')
-rw-r--r--tests/org.eclipse.etrice.generator.c.tests/make.xml15
-rw-r--r--tests/org.eclipse.etrice.generator.common.tests/models/DynamicConfigTest_Java.config117
-rw-r--r--tests/org.eclipse.etrice.generator.common.tests/models/DynamicConfigTest_Java.room204
-rw-r--r--tests/org.eclipse.etrice.generator.common.tests/models/DynamicConfigTest_Java.rt-config20
-rw-r--r--tests/org.eclipse.etrice.generator.common.tests/models/StaticConfigTest.config15
-rw-r--r--tests/org.eclipse.etrice.generator.common.tests/models/StaticConfigTest_C.room38
-rw-r--r--tests/org.eclipse.etrice.generator.common.tests/models/StaticConfigTest_Java.room42
-rw-r--r--tests/org.eclipse.etrice.generator.common.tests/models/subSystemConfigTest.rt-config13
-rw-r--r--tests/org.eclipse.etrice.generator.java.tests/make.xml16
-rw-r--r--tests/org.eclipse.etrice.generator.java.tests/src/DynamicConfigTest/ConfigSourceTestInstance.java16
10 files changed, 432 insertions, 64 deletions
diff --git a/tests/org.eclipse.etrice.generator.c.tests/make.xml b/tests/org.eclipse.etrice.generator.c.tests/make.xml
index 98c6b1ec1..81aeab4da 100644
--- a/tests/org.eclipse.etrice.generator.c.tests/make.xml
+++ b/tests/org.eclipse.etrice.generator.c.tests/make.xml
@@ -10,7 +10,7 @@
@author Henrik Rentz-Reichert
-->
-<project name="project">
+<project name="project" default="all">
<property name="c.tests.model.path" value="./models"/>
<property name="modellib.path" value="../../runtime/org.eclipse.etrice.modellib.c"/>
@@ -55,8 +55,9 @@
<!--
clean: deletes all folders created by this script
-->
- <target name="clean" depends="set_tr">
+ <target name="clean" depends="set_tr,set_rp">
<delete dir="${bin.path}"/>
+ <delete dir="${c-runtime.path}/bin"/>
<delete dir="models"/>
<delete dir="${output}"/>
<delete dir="${test.results}"/>
@@ -198,7 +199,7 @@
<arg value="../../src-gen/HandlerTest/TestProtocol.c"/>
</exec>
<exec dir="bin/HandlerTest" executable="gcc" failonerror="true" output="${output}/build.txt" append="true">
- <arg value="-L../../../../runtime/org.eclipse.etrice.runtime.c/bin"/>
+ <arg value="-L${c-runtime.path}/bin"/>
<arg value="-oHandlerTest.exe"/>
<arg value="HandlerTest_Top.o"/>
<arg value="HandlerUser.o"/>
@@ -233,7 +234,7 @@
<arg value="../../src-gen/ChoicePointTest/TestProtocol.c"/>
</exec>
<exec dir="bin/ChoicePointTest" executable="gcc" failonerror="true" output="${output}/build.txt" append="true">
- <arg value="-L../../../../runtime/org.eclipse.etrice.runtime.c/bin"/>
+ <arg value="-L${c-runtime.path}/bin"/>
<arg value="-oChoicePointTest.exe"/>
<arg value="CPTest_Top.o"/>
<arg value="CPTester.o"/>
@@ -271,7 +272,7 @@
<arg value="../../src-gen/SendingDataTestC/SubSys_SendingData_Runner.c"/>
</exec>
<exec dir="bin/SendingDataTestC" executable="gcc" failonerror="true" output="${output}/build.txt" append="true">
- <arg value="-L../../../../runtime/org.eclipse.etrice.runtime.c/bin"/>
+ <arg value="-L${c-runtime.path}/bin"/>
<arg value="-oSendingDataTestC.exe"/>
<arg value="MrPing.o"/>
<arg value="MrPong.o"/>
@@ -309,7 +310,7 @@
<arg value="../../src-gen/StaticConfigTest/Data_Super1_dc.c"/>
<arg value="../../src-gen/StaticConfigTest/Data_2_dc.c"/>
<arg value="../../src-gen/StaticConfigTest/Data_3_dc.c"/>
- <arg value="../../src-gen/StaticConfigTest/TestProtocol.c"/>
+ <arg value="../../src-gen/StaticConfigTest/TestProtocolAttributes.c"/>
<arg value="../../src-gen/StaticConfigTest/TestProtocolWithDataClass.c"/>
<arg value="../../src-gen/StaticConfigTest/Top_ac.c"/>
<arg value="../../src-gen/StaticConfigTest/SubSystem_StaticConfigTest.c"/>
@@ -326,7 +327,7 @@
<arg value="Data_Super1_dc.o"/>
<arg value="Data_2_dc.o"/>
<arg value="Data_3_dc.o"/>
- <arg value="TestProtocol.o"/>
+ <arg value="TestProtocolAttributes.o"/>
<arg value="TestProtocolWithDataClass.o"/>
<arg value="Top_ac.o"/>
<arg value="SubSystem_StaticConfigTest.o"/>
diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/DynamicConfigTest_Java.config b/tests/org.eclipse.etrice.generator.common.tests/models/DynamicConfigTest_Java.config
new file mode 100644
index 000000000..96332ddb0
--- /dev/null
+++ b/tests/org.eclipse.etrice.generator.common.tests/models/DynamicConfigTest_Java.config
@@ -0,0 +1,117 @@
+ConfigModel DynamicTestConfig {
+ import DynamicConfigTest.* from "DynamicConfigTest_Java.room"
+ SubSystemConfig System_DynConfigTest / subSystem {
+ dynamic configuration {
+ user import "" user constructor "ConfigSourceTestInstance.getInstance()" polling timer [ms] 200
+ }
+ }
+
+ ActorClassConfig Testee_ac {
+ Attr aBool = false
+ Attr aInt8 = 0 {
+ min = -1 max = 59
+ }
+ Attr aInt16 = 0 {
+ min = -1 max = 59
+ }
+ Attr aInt32 = 0 {
+ min = -1 max = 59
+ }
+ Attr aInt64 = 0 {
+ min = -1 max = 59
+ }
+ Attr aFloat32 = 0. {
+ min = -1. max = 59.
+ }
+ Attr aFloat64 = 0. {
+ min = -1. max = 59.
+ }
+ Attr aChar = ''
+ Attr aString = ""
+ Attr aBool_array = false
+ Attr aInt8_array = 0 {
+ min = -1 max = 59
+ }
+ Attr aInt16_array = 0 {
+ min = -1 max = 59
+ }
+ Attr aInt32_array = 0 {
+ min = -1 max = 59
+ }
+ Attr aInt64_array = 0 {
+ min = -1 max = 59
+ }
+ Attr aFloat32_array = 0.0 {
+ min = -1.0 max = 59.0
+ }
+ Attr aFloat64_array = 0.0 {
+ min = -1.0 max = 59.0
+ }
+ Attr aChar_array
+ Attr dc {
+ Attr nested {
+ Attr aInt32 = 0 {
+ min = -1 max = 59
+ }
+ }
+ }
+ }
+
+ ActorInstanceConfig System_DynConfigTest / subSystem / testee {
+ Attr aInt8 {
+ dynamic configuration read
+ }
+ Attr aInt16 {
+ dynamic configuration read
+ }
+ Attr aInt32 {
+ dynamic configuration read
+ }
+ Attr aInt64 {
+ dynamic configuration read
+ }
+ Attr aFloat32 {
+ dynamic configuration read
+ }
+ Attr aFloat64 {
+ dynamic configuration read
+ }
+ Attr aBool {
+ dynamic configuration read
+ }
+ Attr aChar {
+ dynamic configuration read
+ }
+ Attr aString {
+ dynamic configuration read
+ }
+ Attr aInt8_array {
+ dynamic configuration read
+ }
+ Attr aInt16_array {
+ dynamic configuration read
+ }
+ Attr aInt32_array {
+ dynamic configuration read
+ }
+ Attr aInt64_array {
+ dynamic configuration read
+ }
+ Attr aFloat32_array {
+ dynamic configuration read
+ }
+ Attr aFloat64_array {
+ dynamic configuration read
+ }
+ Attr aBool_array {
+ dynamic configuration read
+ }
+ Attr aChar_array {
+ dynamic configuration read
+ }
+ Attr dc {
+ dynamic configuration read
+ }
+ }
+
+} \ No newline at end of file
diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/DynamicConfigTest_Java.room b/tests/org.eclipse.etrice.generator.common.tests/models/DynamicConfigTest_Java.room
new file mode 100644
index 000000000..58351a8f3
--- /dev/null
+++ b/tests/org.eclipse.etrice.generator.common.tests/models/DynamicConfigTest_Java.room
@@ -0,0 +1,204 @@
+RoomModel DynamicConfigTest {
+
+ import room.basic.types.* from "Types.room"
+
+ import room.basic.service.timing.* from "TimingService.room"
+
+ LogicalSystem System_DynConfigTest {
+ SubSystemRef subSystem: SubSystem
+ }
+
+ SubSystemClass SubSystem {
+ ActorRef testee: Testee_ac
+ ActorRef timingService: ATimingService
+ LayerConnection ref testee satisfied_by timingService.timer
+ LogicalThread dflt_thread
+ }
+
+ ActorClass Testee_ac {
+ Structure {
+ usercode1 {
+ "import java.util.HashMap;"
+ "import java.util.Map;"
+ "import org.eclipse.etrice.runtime.java.config.IConfigSource;"
+ }
+ SAP timer: PTimer
+ Attribute caseId: int32
+ Attribute testId: int32 = "1"
+
+ // no dynConfig
+ Attribute sString: string
+
+ // dynConfig
+ Attribute aInt8: int8
+ Attribute aInt16: int16
+ Attribute aInt32: int32
+ Attribute aInt64: int64
+ Attribute aBool: boolean
+ Attribute aFloat32: float32
+ Attribute aFloat64: float64
+ Attribute aChar: char
+ Attribute aString: string
+ Attribute aInt8_array [ 2 ]: int8
+ Attribute aInt16_array [ 2 ]: int16
+ Attribute aInt32_array [ 2 ]: int32
+ Attribute aInt64_array [ 2 ]: int64
+ Attribute aBool_array [ 2 ]: boolean
+ Attribute aFloat32_array [ 2 ]: float32
+ Attribute aFloat64_array [ 2 ]: float64
+ Attribute aChar_array [ 2 ]: char
+ Attribute dc: Data_dc
+ }
+ Behavior {
+ Operation Testee_ac() {
+ "etUnit_open(\"tmp\", \"DynamicConfigTest\");"
+ "etUnit_openTestSuite(\"org.eclipse.etrice.generator.common.tests.DynamicConfigTest\");"
+ "caseId = etUnit_openTestCase(\"DynamicConfigTest_case_Testee_ac\");"
+ }
+ Operation ~Testee_ac() {
+ "etUnit_closeTestCase(caseId);"
+ "etUnit_closeTestSuite();"
+ "etUnit_close();"
+ }
+ StateMachine {
+ Transition t0: initial -> ChangeConfigValid { }
+ Transition t1: ChangeConfigValid -> Test {
+ triggers {
+ <timeout: timer>
+ }
+ action {
+ "testId++;"
+ }
+ }
+ Transition t2: Test -> ChangeConfigInvalid {
+ triggers {
+ <timeout: timer guard {
+ "testId==2"
+ }>
+ }
+ }
+ Transition t3: ChangeConfigInvalid -> Test {
+ triggers {
+ <timeout: timer>
+ }
+ action {
+ "testId++;"
+ }
+ }
+ Transition t4: Test -> Done {
+ triggers {
+ <timeout: timer guard {
+ "testId==4"
+ }>
+ }
+ }
+ Transition tr0: Test -> ChangeConfigValid {
+ triggers {
+ <timeout: timer guard {
+ "testId==3"
+ }>
+ }
+ }
+ State ChangeConfigValid {
+ entry {
+ "IConfigSource source = ConfigSourceTestInstance.getInstance();"
+ "String path = this.getInstancePath();"
+ "Map<String, Object> testValues = new HashMap<String, Object>();"
+ "testValues.put(path+\"/aInt8\", 50);"
+ "testValues.put(path+\"/aInt16\", 51);"
+ "testValues.put(path+\"/aInt32\", 52);"
+ "testValues.put(path+\"/aInt64\", 53);"
+ "testValues.put(path+\"/aFloat32\", 5.4f);"
+ "testValues.put(path+\"/aFloat64\", 5.5);"
+ "testValues.put(path+\"/aChar\", 'B');"
+ "testValues.put(path+\"/aString\", \"Do-NOT-UPDATE-me\");"
+ "testValues.put(path+\"/aBool\", true);"
+ "testValues.put(path+\"/dc/nested/aInt32\", 56);"
+ "testValues.put(path+\"/dc/aString\", \"Okay\");"
+ "testValues.put(path+\"/aInt8_array\", new Byte[]{50,40});"
+ "testValues.put(path+\"/aInt16_array\", new Short[]{51,41});"
+ "testValues.put(path+\"/aInt32_array\", new Integer[]{52,42});"
+ "testValues.put(path+\"/aInt64_array\", new Long[]{53L,43L});"
+ "testValues.put(path+\"/aFloat32_array\", new Float[]{5.4f, 4.4f});"
+ "testValues.put(path+\"/aFloat64_array\", new Double[]{5.5, 4.5});"
+ "testValues.put(path+\"/aChar_array\", \"BB\");"
+ "testValues.put(path+\"/aBool_array\", new Boolean[]{true, false});"
+ "source.writeValues(testValues);"
+ "timer.startTimer(400);"
+ }
+ }
+ State ChangeConfigInvalid {
+ entry {
+ // do not update aString
+ "getAStringLock().forbidUpdate();"
+
+ "IConfigSource source = ConfigSourceTestInstance.getInstance();"
+ "String path = this.getInstancePath();"
+ "Map<String, Object> testValues = new HashMap<String, Object>();"
+ "testValues.put(path+\"/aInt8\", 128);"
+ "testValues.put(path+\"/aInt16\", 61);"
+ "testValues.put(path+\"/aInt32\", -2);"
+ "testValues.put(path+\"/aInt64\", Long.MAX_VALUE);"
+ "testValues.put(path+\"/aFloat32\", -100f);"
+ "testValues.put(path+\"/aFloat64\", 100d);"
+ "testValues.put(path+\"/aChar\", \"string\");"
+ "testValues.put(path+\"/aString\", \"VALID-String\");"
+ "testValues.put(path+\"/aBool\", \"true\");"
+ "testValues.put(path+\"/dc/aString\", 0.89898);"
+ "testValues.put(path+\"/dc/nested/aInt32\", 62);"
+ "testValues.put(path+\"/aInt8_array\", 128);"
+ "testValues.put(path+\"/aInt16_array\", new Short[]{-1,-2});"
+ "testValues.put(path+\"/aInt32_array\", new Integer[]{60,59});"
+ "testValues.put(path+\"/aInt64_array\", new Long[]{60000L,60000L});"
+ "testValues.put(path+\"/aFloat32_array\", new Float[]{0f, -2f});"
+ "testValues.put(path+\"/aFloat64_array\", \"string\");"
+ "testValues.put(path+\"/aChar_array\", \"BBB\");"
+ "testValues.put(path+\"/aBool_array\", 500);"
+ "source.writeValues(testValues);"
+ "timer.startTimer(400);"
+ }
+ }
+ State Test {
+ entry {
+ "EXPECT_EQUAL_INT8(caseId, \"1:Testee_ac\", (byte)50, getAInt8());"
+ "EXPECT_EQUAL_INT16(caseId, \"2:Testee_ac\", (short)51, getAInt16());"
+ "EXPECT_EQUAL_INT32(caseId, \"3:Testee_ac\", 52, getAInt32());"
+ "EXPECT_TRUE(caseId, \"4:Testee_ac\", getAInt64() == 53L);"
+ "EXPECT_EQUAL_FLOAT32(caseId, \"5:Testee_ac\", 5.4f, getAFloat32(), 0.1f);"
+ "EXPECT_TRUE(caseId, \"6:Testee_ac\", getAFloat64() == 5.5);"
+ "EXPECT_TRUE(caseId, \"7:Testee_ac\", getAChar() == 'B');"
+ "EXPECT_TRUE(caseId, \"8:Testee_ac\", \"Do-NOT-UPDATE-me\".equals(getAString()));"
+ "EXPECT_TRUE(caseId, \"9:Testee_ac\", getABool() == true);"
+ "EXPECT_TRUE(caseId, \"10:Testee_ac\", getAInt8_array()[0] == 50 && getAInt8_array()[1] == 40);"
+ "EXPECT_TRUE(caseId, \"11:Testee_ac\", getAInt16_array()[0] == 51 && getAInt16_array()[1] == 41);"
+ "EXPECT_TRUE(caseId, \"12:Testee_ac\", getAInt32_array()[0] == 52 && getAInt32_array()[1] == 42);"
+ "EXPECT_TRUE(caseId, \"13:Testee_ac\", getAInt64_array()[0] == 53L && getAInt64_array()[1] == 43L);"
+ "EXPECT_EQUAL_FLOAT32(caseId, \"14.1:Testee_ac\", 5.4f, getAFloat32_array()[0], 0.1f);"
+ "EXPECT_EQUAL_FLOAT32(caseId, \"14.2:Testee_ac\", 4.4f, getAFloat32_array()[1], 0.1f);"
+ "EXPECT_TRUE(caseId, \"15:Testee_ac\", getAFloat64_array()[0] == 5.5 && getAFloat64_array()[1] == 4.5);"
+ "EXPECT_TRUE(caseId, \"16:Testee_ac\", String.valueOf(getAChar_array()).equals(\"BB\"));"
+ "EXPECT_TRUE(caseId, \"18:Testee_ac\", getABool_array()[0] == true && getABool_array()[1] == false);"
+ "EXPECT_TRUE(caseId, \"19:Testee_ac\", \"Okay\".equals(getDc().getAString()));"
+ "EXPECT_TRUE(caseId, \"20:Testee_ac\", getDc().getNested().getAInt32() == 56);"
+ "timer.startTimer(1);"
+ }
+ }
+ State Done {
+ entry {
+ "\tetUnit_testFinished(caseId);"
+ }
+ }
+ }
+ }
+ }
+
+ DataClass Data_dc {
+ Attribute aString:string
+ Attribute nested: Data_nested_dc
+ }
+
+ DataClass Data_nested_dc {
+ Attribute aInt32: int32
+ }
+
+} \ No newline at end of file
diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/DynamicConfigTest_Java.rt-config b/tests/org.eclipse.etrice.generator.common.tests/models/DynamicConfigTest_Java.rt-config
new file mode 100644
index 000000000..dbf93da01
--- /dev/null
+++ b/tests/org.eclipse.etrice.generator.common.tests/models/DynamicConfigTest_Java.rt-config
@@ -0,0 +1,20 @@
+/System_DynConfigTest/subSystem/testee/aBool=true
+/System_DynConfigTest/subSystem/testee/aBool_array={ true,false }
+/System_DynConfigTest/subSystem/testee/aChar="B"
+/System_DynConfigTest/subSystem/testee/aChar_array="BB"
+/System_DynConfigTest/subSystem/testee/aFloat32=5.4
+/System_DynConfigTest/subSystem/testee/aFloat32_array={ 5.4,4.4 }
+/System_DynConfigTest/subSystem/testee/aFloat64=5.5
+/System_DynConfigTest/subSystem/testee/aFloat64_array={ 5.5,4.5 }
+/System_DynConfigTest/subSystem/testee/aInt16=51
+/System_DynConfigTest/subSystem/testee/aInt16_array={ 51,41 }
+/System_DynConfigTest/subSystem/testee/aInt32=52
+/System_DynConfigTest/subSystem/testee/aInt32_array={ 52,42 }
+/System_DynConfigTest/subSystem/testee/aInt64=53
+/System_DynConfigTest/subSystem/testee/aInt64_array={ 53,43 }
+/System_DynConfigTest/subSystem/testee/aInt8=50
+/System_DynConfigTest/subSystem/testee/aInt8_array={ 50,40 }
+/System_DynConfigTest/subSystem/testee/aString="Do-NOT-UPDATE-me"
+/System_DynConfigTest/subSystem/testee/dc/aString="Okay"
+/System_DynConfigTest/subSystem/testee/dc/nested/aInt32=56
+polling_timer[ms]=200
diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/StaticConfigTest.config b/tests/org.eclipse.etrice.generator.common.tests/models/StaticConfigTest.config
index 8aa41d32e..4663baf55 100644
--- a/tests/org.eclipse.etrice.generator.common.tests/models/StaticConfigTest.config
+++ b/tests/org.eclipse.etrice.generator.common.tests/models/StaticConfigTest.config
@@ -1,4 +1,4 @@
-ConfigModel AttrTestConfig {
+ConfigModel StaticTestConfig {
import StaticConfigTest.* from "StaticConfigTest.room"
ActorClassConfig Tester_ac {
@@ -36,9 +36,10 @@ ConfigModel AttrTestConfig {
Attr int32_array_i = 96, 192
Attr int64_array_c = 192, 384
Attr int64_array_i = 192, 384
- Attr float32_array_c = 9.6, 19.2
- Attr float32_array_i = 9.6, 19.2
- Attr float64_array_c = 19.2, 38.4
+ Attr float32_array_c = 9.6
+ Attr float32_array_i = 9.6
+ Attr float64_array_c = 19.2
+ Attr float64_array_i = 19.2
Attr char_array_c = "Claz"
Attr char_array_i = "Claz"
@@ -59,7 +60,7 @@ ConfigModel AttrTestConfig {
Attr int32_own_i = 12
}
- ProtocolClassConfig TestProtocol {
+ ProtocolClassConfig TestProtocolAttributes {
regular Port{
Attr float_c = 3.0
Attr float_i = 3.0
@@ -100,8 +101,8 @@ ConfigModel AttrTestConfig {
Attr int16_array_i = 4, 12
Attr int32_array_i = 8, 24
Attr int64_array_i = 16, 48
- Attr float32_array_i = 1.6, 4.8
- Attr float64_array_i = 5, 15
+ Attr float32_array_i = 1.6
+ Attr float64_array_i = 3.2
Attr char_array_i = "Inst"
Attr data_2 {
diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/StaticConfigTest_C.room b/tests/org.eclipse.etrice.generator.common.tests/models/StaticConfigTest_C.room
index 3bbbd8d51..ee2ad8c2b 100644
--- a/tests/org.eclipse.etrice.generator.common.tests/models/StaticConfigTest_C.room
+++ b/tests/org.eclipse.etrice.generator.common.tests/models/StaticConfigTest_C.room
@@ -62,7 +62,7 @@ RoomModel StaticConfigTest {
ActorClass Testee_1_ac {
Interface {
- conjugated Port conj_port: TestProtocol
+ conjugated Port conj_port: TestProtocolAttributes
}
Structure {
usercode1 {
@@ -111,27 +111,27 @@ RoomModel StaticConfigTest {
"EXPECT_TRUE(caseId,\"testee_1:data_1:21\", data_1.int16_array_c[0] == 48 && data_1.int16_array_c[1] == 96);"
"EXPECT_TRUE(caseId,\"testee_1:data_1:22\", data_1.int32_array_c[0] == 96 && data_1.int32_array_c[1] == 192);"
"EXPECT_TRUE(caseId,\"testee_1:data_1:23\", data_1.int64_array_c[0] == 192 && data_1.int64_array_c[1] == 384);"
- "EXPECT_TRUE(caseId,\"testee_1:data_1:24\", data_1.float32_array_c[0] == 9.6f && data_1.float32_array_c[1] == 19.2f);"
- "EXPECT_TRUE(caseId,\"testee_1:data_1:25\", data_1.float64_array_c[0] == 19.2 && data_1.float64_array_c[1] == 38.4);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:24\", data_1.float32_array_c[0] == 9.6f && data_1.float32_array_c[1] == 9.6f);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:25\", data_1.float64_array_c[0] == 19.2 && data_1.float64_array_c[1] == 19.2);"
"EXPECT_TRUE(caseId,\"testee_1:data_1:26\", strcmp(data_1.char_array_c, \"Claz\") == 0);"
"EXPECT_TRUE(caseId,\"testee_1:data_1:27\", data_1.bool_array_i[0] == TRUE && data_1.bool_array_i[1] == TRUE);"
"EXPECT_TRUE(caseId,\"testee_1:data_1:28\", data_1.int8_array_i[0] == 2 && data_1.int8_array_i[1] == 6);"
"EXPECT_TRUE(caseId,\"testee_1:data_1:29\", data_1.int16_array_i[0] == 4 && data_1.int16_array_i[1] == 12);"
"EXPECT_TRUE(caseId,\"testee_1:data_1:30\", data_1.int32_array_i[0] == 8 && data_1.int32_array_i[1] == 24);"
"EXPECT_TRUE(caseId,\"testee_1:data_1:31\", data_1.int64_array_i[0] == 16 && data_1.int64_array_i[1] == 48);"
- "EXPECT_TRUE(caseId,\"testee_1:data_1:32\", data_1.float32_array_i[0] == 1.6f && data_1.float32_array_i[1] == 4.8f);"
- "EXPECT_TRUE(caseId,\"testee_1:data_1:33\", data_1.float64_array_i[0] == 5 && data_1.float64_array_i[1] == 15);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:32\", data_1.float32_array_i[0] == 1.6f && data_1.float32_array_i[1] == 1.6f);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:33\", data_1.float64_array_i[0] == 3.2 && data_1.float64_array_i[1] == 3.2);"
"EXPECT_TRUE(caseId,\"testee_1:data_1:34\", strcmp(data_1.char_array_i, \"Inst\") == 0);"
"EXPECT_TRUE(caseId,\"testee_1:data_1:35\", data_1.data_2.int32_c == 42);"
"EXPECT_TRUE(caseId,\"testee_1:data_1:36\", data_1.data_2.int32_i == 43);"
// conj_port
- "EXPECT_TRUE(caseId,\"testee_1:conj_port:36\", ((TestProtocolConjPort_var*)self->constData->conj_port.varData)->array2_r[0] == 11);"
- "EXPECT_TRUE(caseId,\"testee_1:conj_port:37\", ((TestProtocolConjPort_var*)self->constData->conj_port.varData)->array2_r[1] == 22);"
- "EXPECT_TRUE(caseId,\"testee_1:conj_port:38\", ((TestProtocolConjPort_var*)self->constData->conj_port.varData)->array2_c[0] == 16);"
- "EXPECT_TRUE(caseId,\"testee_1:conj_port:39\", ((TestProtocolConjPort_var*)self->constData->conj_port.varData)->array2_c[1] == 32);"
- "EXPECT_TRUE(caseId,\"testee_1:conj_port:40\", ((TestProtocolConjPort_var*)self->constData->conj_port.varData)->array2_i[0] == 1);"
- "EXPECT_TRUE(caseId,\"testee_1:conj_port:41\", ((TestProtocolConjPort_var*)self->constData->conj_port.varData)->array2_i[1] == 2);"
+ "EXPECT_TRUE(caseId,\"testee_1:conj_port:36\", ((TestProtocolAttributesConjPort_var*)self->constData->conj_port.varData)->array2_r[0] == 11);"
+ "EXPECT_TRUE(caseId,\"testee_1:conj_port:37\", ((TestProtocolAttributesConjPort_var*)self->constData->conj_port.varData)->array2_r[1] == 22);"
+ "EXPECT_TRUE(caseId,\"testee_1:conj_port:38\", ((TestProtocolAttributesConjPort_var*)self->constData->conj_port.varData)->array2_c[0] == 16);"
+ "EXPECT_TRUE(caseId,\"testee_1:conj_port:39\", ((TestProtocolAttributesConjPort_var*)self->constData->conj_port.varData)->array2_c[1] == 32);"
+ "EXPECT_TRUE(caseId,\"testee_1:conj_port:40\", ((TestProtocolAttributesConjPort_var*)self->constData->conj_port.varData)->array2_i[0] == 1);"
+ "EXPECT_TRUE(caseId,\"testee_1:conj_port:41\", ((TestProtocolAttributesConjPort_var*)self->constData->conj_port.varData)->array2_i[1] == 2);"
"etUnit_testFinished(caseId);"
}
}
@@ -141,7 +141,7 @@ RoomModel StaticConfigTest {
ActorClass Testee_Super2_ac {
Interface {
- Port reg_port: TestProtocol
+ Port reg_port: TestProtocolAttributes
}
Structure {
usercode1 {
@@ -164,9 +164,9 @@ RoomModel StaticConfigTest {
"EXPECT_TRUE(caseId, \"Testee_Super2_ac:3\", float64_super_i == 3.3);"
// reg_port
- "EXPECT_EQUAL_FLOAT32(caseId, \"Testee_Super2_ac:5\", 4.0f, ((TestProtocolPort_var*) self->constData->reg_port.varData)->float_r, 0.1f);"
- "EXPECT_EQUAL_FLOAT32(caseId, \"Testee_Super2_ac:6\", 3.0f, ((TestProtocolPort_var*) self->constData->reg_port.varData)->float_c, 0.1f);"
- "EXPECT_EQUAL_FLOAT32(caseId, \"Testee_Super2_ac:7\", 25.0f, ((TestProtocolPort_var*) self->constData->reg_port.varData)->float_i, 0.1f);"
+ "EXPECT_EQUAL_FLOAT32(caseId, \"Testee_Super2_ac:5\", 4.0f, ((TestProtocolAttributesPort_var*) self->constData->reg_port.varData)->float_r, 0.1f);"
+ "EXPECT_EQUAL_FLOAT32(caseId, \"Testee_Super2_ac:6\", 3.0f, ((TestProtocolAttributesPort_var*) self->constData->reg_port.varData)->float_c, 0.1f);"
+ "EXPECT_EQUAL_FLOAT32(caseId, \"Testee_Super2_ac:7\", 25.0f, ((TestProtocolAttributesPort_var*) self->constData->reg_port.varData)->float_i, 0.1f);"
}
Operation ~Testee_Super2_ac() {
"etUnit_closeTestCase(caseId);"
@@ -201,9 +201,9 @@ RoomModel StaticConfigTest {
"EXPECT_TRUE(caseId, \"Testee_2_ac:5\", int32_own_i == 13);"
// reg_port
- "EXPECT_EQUAL_FLOAT32(caseId, \"Testee_2_ac:6\", 4.0f, ((TestProtocolPort_var*) self->constData->reg_port.varData)->float_r, 0.1f);"
- "EXPECT_EQUAL_FLOAT32(caseId, \"Testee_2_ac:7\", 3.0f, ((TestProtocolPort_var*) self->constData->reg_port.varData)->float_c, 0.1f);"
- "EXPECT_EQUAL_FLOAT32(caseId, \"Testee_2_ac:9\", 50.0f, ((TestProtocolPort_var*) self->constData->reg_port.varData)->float_i, 0.1f);"
+ "EXPECT_EQUAL_FLOAT32(caseId, \"Testee_2_ac:6\", 4.0f, ((TestProtocolAttributesPort_var*) self->constData->reg_port.varData)->float_r, 0.1f);"
+ "EXPECT_EQUAL_FLOAT32(caseId, \"Testee_2_ac:7\", 3.0f, ((TestProtocolAttributesPort_var*) self->constData->reg_port.varData)->float_c, 0.1f);"
+ "EXPECT_EQUAL_FLOAT32(caseId, \"Testee_2_ac:9\", 50.0f, ((TestProtocolAttributesPort_var*) self->constData->reg_port.varData)->float_i, 0.1f);"
// sap
"Data_3_dc_varCheck3(&(((TestProtocolWithDataClassConjPort_var*)self->constData->sap.varData)->sap_data_3), caseId);"
@@ -217,7 +217,7 @@ RoomModel StaticConfigTest {
}
}
- ProtocolClass TestProtocol {
+ ProtocolClass TestProtocolAttributes {
incoming {
Message dummy()
}
diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/StaticConfigTest_Java.room b/tests/org.eclipse.etrice.generator.common.tests/models/StaticConfigTest_Java.room
index 28e0ac434..77f6e2f1f 100644
--- a/tests/org.eclipse.etrice.generator.common.tests/models/StaticConfigTest_Java.room
+++ b/tests/org.eclipse.etrice.generator.common.tests/models/StaticConfigTest_Java.room
@@ -55,7 +55,7 @@ RoomModel StaticConfigTest {
entry {
"data_3.varCheck3(caseId);"
"SubSystemClassBase subSystem = (SubSystemClassBase) ((ActorClassBase)getParent()).getParent();"
- "Testee_Super2_ac testee_super2 = (Testee_Super2_ac) subSystem.getInstance(\"/subSystem/top/tester/testee_super2\");"
+ "Testee_Super2_ac testee_super2 = (Testee_Super2_ac) subSystem.getInstance(\"/System_StaticConfigTest/subSystem/top/tester/testee_super2\");"
"int caseId_2 = testee_super2.getCaseId();"
"testee_super2.getReg_port().varCheck(caseId_2);"
"EXPECT_TRUE(caseId_2, \"Tester_ac:1\", testee_super2.getFloat64_super_r() == 1.1);"
@@ -70,7 +70,7 @@ RoomModel StaticConfigTest {
ActorClass Testee_1_ac {
Interface {
- conjugated Port conj_port: TestProtocol
+ conjugated Port conj_port: TestProtocolAttributes
}
Structure {
external Port conj_port
@@ -117,16 +117,16 @@ RoomModel StaticConfigTest {
"EXPECT_TRUE(caseId,\"testee_1:data_1:21\", getData_1().getInt16_array_c()[0] == 48 && getData_1().getInt16_array_c()[1] == 96);"
"EXPECT_TRUE(caseId,\"testee_1:data_1:22\", getData_1().getInt32_array_c()[0] == 96 && getData_1().getInt32_array_c()[1] == 192);"
"EXPECT_TRUE(caseId,\"testee_1:data_1:23\", getData_1().getInt64_array_c()[0] == 192 && getData_1().getInt64_array_c()[1] == 384);"
- "EXPECT_TRUE(caseId,\"testee_1:data_1:24\", getData_1().getFloat32_array_c()[0] == 9.6f && getData_1().getFloat32_array_c()[1] == 19.2f);"
- "EXPECT_TRUE(caseId,\"testee_1:data_1:25\", getData_1().getFloat64_array_c()[0] == 19.2 && getData_1().getFloat64_array_c()[1] == 38.4);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:24\", getData_1().getFloat32_array_c()[0] == 9.6f && getData_1().getFloat32_array_c()[1] == 9.6f);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:25\", getData_1().getFloat64_array_c()[0] == 19.2 && getData_1().getFloat64_array_c()[1] == 19.2);"
"EXPECT_TRUE(caseId,\"testee_1:data_1:26\", String.valueOf(getData_1().getChar_array_c()).equals(\"Claz\"));"
"EXPECT_TRUE(caseId,\"testee_1:data_1:27\", getData_1().getBool_array_i()[0] == true && getData_1().getBool_array_i()[1] == true);"
"EXPECT_TRUE(caseId,\"testee_1:data_1:28\", getData_1().getInt8_array_i()[0] == 2 && getData_1().getInt8_array_i()[1] == 6);"
"EXPECT_TRUE(caseId,\"testee_1:data_1:29\", getData_1().getInt16_array_i()[0] == 4 && getData_1().getInt16_array_i()[1] == 12);"
"EXPECT_TRUE(caseId,\"testee_1:data_1:30\", getData_1().getInt32_array_i()[0] == 8 && getData_1().getInt32_array_i()[1] == 24);"
"EXPECT_TRUE(caseId,\"testee_1:data_1:31\", getData_1().getInt64_array_i()[0] == 16 && getData_1().getInt64_array_i()[1] == 48);"
- "EXPECT_TRUE(caseId,\"testee_1:data_1:32\", getData_1().getFloat32_array_i()[0] == 1.6f && getData_1().getFloat32_array_i()[1] == 4.8f);"
- "EXPECT_TRUE(caseId,\"testee_1:data_1:33\", getData_1().getFloat64_array_i()[0] == 5 && getData_1().getFloat64_array_i()[1] == 15);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:32\", getData_1().getFloat32_array_i()[0] == 1.6f && getData_1().getFloat32_array_i()[1] == 1.6f);"
+ "EXPECT_TRUE(caseId,\"testee_1:data_1:33\", getData_1().getFloat64_array_i()[0] == 3.2 && getData_1().getFloat64_array_i()[1] == 3.2);"
"EXPECT_TRUE(caseId,\"testee_1:data_1:34\", String.valueOf(getData_1().getChar_array_i()).equals(\"Inst\"));"
"EXPECT_TRUE(caseId,\"testee_1:data_1:35\", getData_1().getData_2().getInt32_c() == 42);"
"EXPECT_TRUE(caseId,\"testee_1:data_1:36\", getData_1().getData_2().getInt32_i() == 43);"
@@ -139,7 +139,7 @@ RoomModel StaticConfigTest {
ActorClass Testee_Super2_ac {
Interface {
- Port reg_port: TestProtocol
+ Port reg_port: TestProtocolAttributes
}
Structure {
external Port reg_port
@@ -182,7 +182,6 @@ RoomModel StaticConfigTest {
entry {
"sap.varCheck(caseId);"
"reg_port.varCheck(caseId);"
-
"EXPECT_TRUE(caseId, \"Testee_2_ac:1\", float64_super_c == 2.2);"
"EXPECT_TRUE(caseId, \"Testee_2_ac:2\", float64_super_i == 4.4);"
"EXPECT_TRUE(caseId, \"Testee_2_ac:3\", int32_own_r == 11);"
@@ -196,7 +195,7 @@ RoomModel StaticConfigTest {
}
}
- ProtocolClass TestProtocol {
+ ProtocolClass TestProtocolAttributes {
incoming {
Message dummy()
}
@@ -206,8 +205,8 @@ RoomModel StaticConfigTest {
Attribute float_c: float32 = "16"
Attribute float_i: float32 = "256"
Operation varCheck(caseId: int32): void {
- "EXPECT_EQUAL_FLOAT32(caseId,\"TestProtocol:1\", 4.f, float_r, 0.1f);"
- "EXPECT_EQUAL_FLOAT32(caseId,\"TestProtocol:2\", 3.f, float_c, 0.1f);"
+ "EXPECT_EQUAL_FLOAT32(caseId,\"TestProtocolAttributes:1\", 4.f, float_r, 0.1f);"
+ "EXPECT_EQUAL_FLOAT32(caseId,\"TestProtocolAttributes:2\", 3.f, float_c, 0.1f);"
}
}
conjugate PortClass
@@ -271,7 +270,6 @@ RoomModel StaticConfigTest {
}
DataClass Data_1_dc extends Data_Super1_dc {
-
Attribute int16_r: int16 = "16"
Attribute int16_c: int16 = "16"
Attribute int16_i: int16 = "16"
@@ -361,13 +359,23 @@ RoomModel StaticConfigTest {
Attribute ext_type_array [ 2 ]: extType
Attribute ext_type_ref: extType ref
Attribute ext_type_ref_array [ 2 ]: extType ref
+ Attribute primitive_array_ref [ 2 ]: int8 ref
+ Attribute string_ref: string ref
+
+ // no check at all
+ Attribute primitive1_ref: int8 ref
+ Attribute primitive3_ref: char ref
Operation varCheck3(caseId: int32): void {
- //TODO dataClass_array
"EXPECT_TRUE(caseId, \"Data_3_dc:1\", dataClass_ref == null);"
- "EXPECT_TRUE(caseId, \"Data_3_dc:1\", dataClass_ref_array[0] == null && dataClass_ref_array[1] == null);"
- "EXPECT_TRUE(caseId, \"Data_3_dc:1\", ext_type instanceof External_Type_Test);"
- "EXPECT_TRUE(caseId, \"Data_3_dc:1\", ext_type_array[0] instanceof External_Type_Test && ext_type_array[1] instanceof External_Type_Test);"
- "EXPECT_TRUE(caseId, \"Data_3_dc:1\", ext_type_ref_array[0] == null && ext_type_ref_array[1] == null);"
+ "EXPECT_TRUE(caseId, \"Data_3_dc:2\", dataClass_array[0].getInt32_r() == 1);"
+ "EXPECT_TRUE(caseId, \"Data_3_dc:3\", dataClass_array[1].getInt32_c() == 1);"
+ "EXPECT_TRUE(caseId, \"Data_3_dc:4\", dataClass_ref_array[0] == null && dataClass_ref_array[1] == null);"
+ "EXPECT_TRUE(caseId, \"Data_3_dc:5\", ext_type instanceof External_Type_Test);"
+ "EXPECT_TRUE(caseId, \"Data_3_dc:6\", ext_type_array[0] instanceof External_Type_Test && ext_type_array[1] instanceof External_Type_Test);"
+ "EXPECT_TRUE(caseId, \"Data_3_dc:7\", ext_type_ref == null);"
+ "EXPECT_TRUE(caseId, \"Data_3_dc:8\", ext_type_ref_array[0] == null && ext_type_ref_array[1] == null);"
+ "EXPECT_TRUE(caseId, \"Data_3_dc:9\", primitive_array_ref instanceof byte[]);"
+ "EXPECT_TRUE(caseId, \"Data_3_dc:10\", string_ref == null);"
}
}
diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/subSystemConfigTest.rt-config b/tests/org.eclipse.etrice.generator.common.tests/models/subSystemConfigTest.rt-config
deleted file mode 100644
index 060e2151e..000000000
--- a/tests/org.eclipse.etrice.generator.common.tests/models/subSystemConfigTest.rt-config
+++ /dev/null
@@ -1,13 +0,0 @@
-/SubSystemConfigTest/top/testee2/blockMe=0
-/SubSystemConfigTest/top/testee2/blocker=false
-/SubSystemConfigTest/top/testee2/dc_dump/dc_i/char_i="dummy out"
-/SubSystemConfigTest/top/testee2/dc_dump/dc_i/double_i=0.0
-/SubSystemConfigTest/top/testee2/dc_dump/int_i=123
-/SubSystemConfigTest/top/testee2/dc_dump/long_array_i={ 1000 }
-/SubSystemConfigTest/top/testee2/dc_i/dc_i/char_i="instance4"
-/SubSystemConfigTest/top/testee2/dc_i/dc_i/double_i=0.404
-/SubSystemConfigTest/top/testee2/dc_i/int_i=402
-/SubSystemConfigTest/top/testee2/dc_i/long_array_i={ 403 }
-/SubSystemConfigTest/top/testee2/int_dump=888
-/SubSystemConfigTest/top/testee2/int_i=401
-polling_timer[ms]=4000
diff --git a/tests/org.eclipse.etrice.generator.java.tests/make.xml b/tests/org.eclipse.etrice.generator.java.tests/make.xml
index c9d26930d..8de693869 100644
--- a/tests/org.eclipse.etrice.generator.java.tests/make.xml
+++ b/tests/org.eclipse.etrice.generator.java.tests/make.xml
@@ -9,7 +9,7 @@
@author Henrik Rentz-Reichert
-->
-<project name="project">
+<project name="project" default="all">
<property name="java.tests.model.path" value="./models"/>
<property name="modellib.path" value="../../runtime/org.eclipse.etrice.modellib.java"/>
@@ -116,6 +116,8 @@
<arg value="${java.tests.model.path}/TCPTest.room"/>
<arg value="${java.tests.model.path}/StaticConfigTest.room"/>
<arg value="${java.tests.model.path}/StaticConfigTest.config"/>
+ <arg value="${java.tests.model.path}/DynamicConfigTest_Java.room"/>
+ <arg value="${java.tests.model.path}/DynamicConfigTest_Java.config"/>
<classpath refid="clspath"/>
</java>
</target>
@@ -141,6 +143,10 @@
<arg value="-run_as_test"/>
<classpath path="${bin.path};${runtime.path}/bin;${modellib.path}/bin"/>
</java>
+ <java output="${output}/runDynamicConfigTest.txt" classname="DynamicConfigTest.SubSystemRunner" fork="true" failonerror="true">
+ <arg value="-run_as_test"/>
+ <classpath path="${bin.path};${runtime.path}/bin;${modellib.path}/bin"/>
+ </java>
<java output="${output}/runHandlerTest.txt" classname="HandlerTest.SubSystem_HandlerTestRunner" fork="true" failonerror="true">
<arg value="-run_as_test"/>
<classpath path="${bin.path};${runtime.path}/bin;${modellib.path}/bin"/>
@@ -229,6 +235,13 @@
<arg value="./tmp/StaticConfigTest.etu"/>
<classpath refid="clspath"/>
</java>
+
+ <java output="${output}/convert.txt" append="true" classname="org.eclipse.etrice.etunit.converter.EtUnitReportConverter" fork="true" failonerror="true">
+ <arg value="-suite"/>
+ <arg value="org.eclipse.etrice.generator.java.tests.DynamicConfigTest"/>
+ <arg value="./tmp/DynamicConfigTest.etu"/>
+ <classpath refid="clspath"/>
+ </java>
</target>
<!--
@@ -238,6 +251,7 @@
<move file="./tmp/HandlerTest.xml" tofile="./tmp/JavaHandlerTest.xml"/>
<move file="./tmp/ChoicePointTest.xml" tofile="./tmp/JavaChoicePointTest.xml"/>
<move file="./tmp/StaticConfigTest.xml" tofile="./tmp/StaticConfigTest.xml"/>
+ <move file="./tmp/DynamicConfigTest.xml" tofile="./tmp/DynamicConfigTest.xml"/>
<copy todir="${test.results}" >
<fileset dir="./tmp">
<include name="*.xml"/>
diff --git a/tests/org.eclipse.etrice.generator.java.tests/src/DynamicConfigTest/ConfigSourceTestInstance.java b/tests/org.eclipse.etrice.generator.java.tests/src/DynamicConfigTest/ConfigSourceTestInstance.java
new file mode 100644
index 000000000..bb6eb4339
--- /dev/null
+++ b/tests/org.eclipse.etrice.generator.java.tests/src/DynamicConfigTest/ConfigSourceTestInstance.java
@@ -0,0 +1,16 @@
+package DynamicConfigTest;
+
+import org.eclipse.etrice.runtime.java.config.ConfigSourceFile;
+import org.eclipse.etrice.runtime.java.config.IConfigSource;
+
+public class ConfigSourceTestInstance {
+
+ private static IConfigSource instance = null;
+
+ public static IConfigSource getInstance(){
+ if(instance == null){
+ instance = new ConfigSourceFile("models/DynamicConfigTest_Java.rt-config");
+ }
+ return instance;
+ }
+}

Back to the top