summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Jung2011-09-21 07:10:03 (EDT)
committerThomas Jung2011-09-21 07:10:03 (EDT)
commit7dd9504c67d33c5deb5ba0c7fd1a32cee46228a6 (patch)
tree791d79c8499e5d89e5b1b228e596029c1f6b1566
parent620e431a025ad21876c0164da7684e2df3ca819b (diff)
downloadorg.eclipse.etrice-7dd9504c67d33c5deb5ba0c7fd1a32cee46228a6.zip
org.eclipse.etrice-7dd9504c67d33c5deb5ba0c7fd1a32cee46228a6.tar.gz
org.eclipse.etrice-7dd9504c67d33c5deb5ba0c7fd1a32cee46228a6.tar.bz2
Integration test added for replicated ports
-rw-r--r--tests/org.eclipse.etrice.integration.tests/model/org.eclipse.etrice.integration.PingPongThreadTestReplPort.room55
-rw-r--r--tests/org.eclipse.etrice.integration.tests/src/org/eclipse/etrice/integration/tests/IntegrationTestPingPongThreadReplPort.java53
2 files changed, 84 insertions, 24 deletions
diff --git a/tests/org.eclipse.etrice.integration.tests/model/org.eclipse.etrice.integration.PingPongThreadTestReplPort.room b/tests/org.eclipse.etrice.integration.tests/model/org.eclipse.etrice.integration.PingPongThreadTestReplPort.room
index a709f6f..f8fa651 100644
--- a/tests/org.eclipse.etrice.integration.tests/model/org.eclipse.etrice.integration.PingPongThreadTestReplPort.room
+++ b/tests/org.eclipse.etrice.integration.tests/model/org.eclipse.etrice.integration.PingPongThreadTestReplPort.room
@@ -3,11 +3,11 @@ RoomModel org.eclipse.etrice.integration.PingPongThreadTestReplPort {
import room.basic.service.timing.*
- LogicalSystem System_PingPong {
- SubSystemRef subsystem: SubSystem_PingPong
+ LogicalSystem System_PingPongReplPort {
+ SubSystemRef subsystem: SubSystem_PingPongReplPort
}
- SubSystemClass SubSystem_PingPong {
+ SubSystemClass SubSystem_PingPongReplPort {
ActorRef application: PingPongTop
ActorRef services: ATimingService
LayerConnection ref application satisfied_by services.timer
@@ -27,7 +27,8 @@ RoomModel org.eclipse.etrice.integration.PingPongThreadTestReplPort {
Binding MrPing.PingPongPort and MrPong1.PingPongPort
Binding MrPing.PingPongPort and MrPong2.PingPongPort
Binding MrPing.PingPongPort and MrPong3.PingPongPort
- }
+ }
+ Behavior { }
}
ActorClass MrPingActor {
@@ -55,12 +56,12 @@ RoomModel org.eclipse.etrice.integration.PingPongThreadTestReplPort {
triggers {
<timeoutTick: timer>
}
- action {
- "PingPongPort.get(0).ping();"
- "PingPongPort.get(1).ping();"
- "PingPongPort.get(2).ping();"
- "pongCount = 0;"
- }
+ action {
+ "PingPongPort.get(0).ping();"
+ "PingPongPort.get(1).ping();"
+ "PingPongPort.get(2).ping();"
+ "pongCount = 0;"
+ }
}
Transition tr3: waitForPong -> cp cp0 {
triggers {
@@ -70,23 +71,29 @@ RoomModel org.eclipse.etrice.integration.PingPongThreadTestReplPort {
"pongCount++;"
}
}
- Transition tr5: cp cp0 -> waitForTimer {
- action {
- "if (count++ > 1000) {"
- "RTServices.getInstance().getSubSystem().testFinished(0);"
- "} else {"
- "System.out.println(count);"
- "timer.Start(5);}"
- }
+ Transition tr4: cp cp0 -> waitForTimer {
+ action {
+ "if (count++ > 1000) {"
+ "RTServices.getInstance().getSubSystem().testFinished(0);"
+ "} else {"
+ "//PingPongPort.get(0).ping();"
+ "//PingPongPort.get(1).ping();"
+ "//PingPongPort.get(2).ping();"
+ "System.out.println(pongCount);"
+ "System.out.println(count);"
+ "pongCount = 0;"
+ "timer.Start(10);"
+ "}"
+ }
}
Transition tr6: cp cp0 -> waitForPong {
- cond {
- "pongCount < 3"
- }
+ cond {
+ "pongCount < 3"
+ }
}
ChoicePoint cp0
- State waitForTimer { }
- State waitForPong { }
+ State waitForTimer
+ State waitForPong
}
}
}
@@ -109,7 +116,7 @@ RoomModel org.eclipse.etrice.integration.PingPongThreadTestReplPort {
"PingPongPort.pong();"
}
}
- State waitForPing { }
+ State waitForPing
}
}
}
diff --git a/tests/org.eclipse.etrice.integration.tests/src/org/eclipse/etrice/integration/tests/IntegrationTestPingPongThreadReplPort.java b/tests/org.eclipse.etrice.integration.tests/src/org/eclipse/etrice/integration/tests/IntegrationTestPingPongThreadReplPort.java
new file mode 100644
index 0000000..8ff0e03
--- /dev/null
+++ b/tests/org.eclipse.etrice.integration.tests/src/org/eclipse/etrice/integration/tests/IntegrationTestPingPongThreadReplPort.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * 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.integration.tests;
+
+
+import static org.junit.Assert.assertEquals;
+
+import org.eclipse.etrice.integration.PingPongThreadTestReplPort.SubSystem_PingPongReplPort;
+import org.eclipse.etrice.integration.tests.base.IntegrationTestBase;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class IntegrationTestPingPongThreadReplPort extends IntegrationTestBase {
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @Test (timeout=10000)
+ public void testPingPongThreadTestReplPort (){
+ SubSystem_PingPongReplPort main_component = new SubSystem_PingPongReplPort(null,"MainComponent");
+
+ // hand over the semaphore to the subsystem
+ main_component.setTestSemaphore(this.testSem);
+
+ main_component.init(); // lifecycle init
+ main_component.start(); // lifecycle start
+
+ waitForTestcase();
+
+ assertEquals(0,main_component.getTestErrorCode());
+
+ // end the lifecycle
+ main_component.stop(); // lifecycle stop
+ main_component.destroy(); // lifecycle destroy
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+
+}