Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Rentz-Reichert2011-04-06 15:43:03 +0000
committerHenrik Rentz-Reichert2011-04-06 15:43:03 +0000
commitf57e4945924da250d584684009c3c302bf1d23b4 (patch)
tree7acec881229f6188498d6801b631df307f02783e /tests/org.eclipse.etrice.integration.tests/src/org
parent902eca38ffe61fcff5c64eb46561ec42ec38e87e (diff)
parent40d0b5d8bcea282484b077c19981521fd2539f0b (diff)
downloadorg.eclipse.etrice-f57e4945924da250d584684009c3c302bf1d23b4.tar.gz
org.eclipse.etrice-f57e4945924da250d584684009c3c302bf1d23b4.tar.xz
org.eclipse.etrice-f57e4945924da250d584684009c3c302bf1d23b4.zip
Merge branch 'master' of
https://git.eclipse.org/gitroot/etrice/org.eclipse.etrice Conflicts: runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/debugging/MSCFilter.java
Diffstat (limited to 'tests/org.eclipse.etrice.integration.tests/src/org')
-rw-r--r--tests/org.eclipse.etrice.integration.tests/src/org/eclipse/etrice/integration/tests/IntegrationTestFSMGenerator.java17
-rw-r--r--tests/org.eclipse.etrice.integration.tests/src/org/eclipse/etrice/integration/tests/IntegrationTestPingPongThread.java64
-rw-r--r--tests/org.eclipse.etrice.integration.tests/src/org/eclipse/etrice/integration/tests/base/IntegrationTestBase.java21
3 files changed, 96 insertions, 6 deletions
diff --git a/tests/org.eclipse.etrice.integration.tests/src/org/eclipse/etrice/integration/tests/IntegrationTestFSMGenerator.java b/tests/org.eclipse.etrice.integration.tests/src/org/eclipse/etrice/integration/tests/IntegrationTestFSMGenerator.java
index 6403e2c71..4149f6598 100644
--- a/tests/org.eclipse.etrice.integration.tests/src/org/eclipse/etrice/integration/tests/IntegrationTestFSMGenerator.java
+++ b/tests/org.eclipse.etrice.integration.tests/src/org/eclipse/etrice/integration/tests/IntegrationTestFSMGenerator.java
@@ -18,7 +18,9 @@ import static org.junit.Assert.assertEquals;
import org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher;
import org.eclipse.etrice.integration.tests.SubSystemHFSMTest;
import org.eclipse.etrice.integration.tests.a_HFSM_Tester;
+import org.eclipse.etrice.integration.tests.base.IntegrationTestBase;
import org.eclipse.etrice.runtime.java.messaging.RTServices;
+import org.eclipse.etrice.runtime.java.modelbase.SubSystemClassBase;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -28,8 +30,7 @@ import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.resources.ResourcesPlugin;
-public class IntegrationTestFSMGenerator {
-
+public class IntegrationTestFSMGenerator extends IntegrationTestBase {
@Before
public void setUp() throws Exception {
// we have to launch a JUnit Plugin test since for the build we need an Eclipse environment
@@ -42,16 +43,20 @@ public class IntegrationTestFSMGenerator {
*/
}
- @Test(timeout=1000)
+ @Test (timeout=5000)
public void testHFSM(){
SubSystemHFSMTest main_component = new SubSystemHFSMTest(null,"MainComponent");
+
+ // hand over the semaphore to the subsystem
+ main_component.setTestSemaphore(this.testSem);
+
main_component.init(); // lifecycle init
main_component.start(); // lifecycle start
- RTServices.getInstance().getMsgSvcCtrl().waitTerminate();
-
- assertEquals(a_HFSM_Tester.STATE_TestPass ,main_component.getInstance("/MainComponent/application/HFSM_Tests/Tester").getState());
+ waitForTestcase();
+ assertEquals(0,main_component.getTestErrorCode());
+
// end the lifecycle
main_component.stop(); // lifecycle stop
main_component.destroy(); // lifecycle destroy
diff --git a/tests/org.eclipse.etrice.integration.tests/src/org/eclipse/etrice/integration/tests/IntegrationTestPingPongThread.java b/tests/org.eclipse.etrice.integration.tests/src/org/eclipse/etrice/integration/tests/IntegrationTestPingPongThread.java
new file mode 100644
index 000000000..0da06b16c
--- /dev/null
+++ b/tests/org.eclipse.etrice.integration.tests/src/org/eclipse/etrice/integration/tests/IntegrationTestPingPongThread.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * 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.PingPongThreadTest.SubSystem_PingPong;
+import org.eclipse.etrice.integration.tests.base.IntegrationTestBase;
+import org.eclipse.etrice.runtime.java.modelbase.SubSystemClassBase;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+
+
+public class IntegrationTestPingPongThread extends IntegrationTestBase {
+ @Before
+ public void setUp() throws Exception {
+ // we have to launch a JUnit Plugin test since for the build we need an Eclipse environment
+ // in this context the Mwe2Launcher suffers from https://bugs.eclipse.org/bugs/show_bug.cgi?id=318721
+ /*
+ Mwe2Launcher.main(new String[]{"/org.eclipse.etrice.integration.tests/src/de/protos/etrice/integration/test/IntegrationTestFSMGenerator.mwe2"});
+ final IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ final IProject project = workspace.getRoot().getProject("/org.eclipse.etrice.integration.tests");
+ project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, null);
+ */
+ }
+
+ @Test (timeout=10000)
+ public void testHFSM(){
+ SubSystem_PingPong main_component = new SubSystem_PingPong(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 {
+ }
+
+
+}
diff --git a/tests/org.eclipse.etrice.integration.tests/src/org/eclipse/etrice/integration/tests/base/IntegrationTestBase.java b/tests/org.eclipse.etrice.integration.tests/src/org/eclipse/etrice/integration/tests/base/IntegrationTestBase.java
new file mode 100644
index 000000000..614e77f62
--- /dev/null
+++ b/tests/org.eclipse.etrice.integration.tests/src/org/eclipse/etrice/integration/tests/base/IntegrationTestBase.java
@@ -0,0 +1,21 @@
+package org.eclipse.etrice.integration.tests.base;
+
+import java.util.concurrent.Semaphore;
+
+public class IntegrationTestBase {
+
+ protected Semaphore testSem = new Semaphore(0);
+
+ public IntegrationTestBase() {
+ super();
+ }
+
+ protected synchronized void waitForTestcase() {
+ try{
+ this.testSem.acquire(1);
+ }catch(InterruptedException e){
+ System.out.println("Semaphore fault !");
+ }
+ }
+
+} \ No newline at end of file

Back to the top