Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Rentz-Reichert2011-06-07 12:45:17 +0000
committerHenrik Rentz-Reichert2011-06-07 12:45:17 +0000
commita74a1a64059d318a5360f598bf97d230eae96ceb (patch)
tree5c35c9225c05b416003c0b159eb46b586dcc6acb /tests/org.eclipse.etrice.integration.tests/src/org/eclipse
parentbadb3cf49802328b92e6fb6789c92ad143d2679c (diff)
downloadorg.eclipse.etrice-a74a1a64059d318a5360f598bf97d230eae96ceb.tar.gz
org.eclipse.etrice-a74a1a64059d318a5360f598bf97d230eae96ceb.tar.xz
org.eclipse.etrice-a74a1a64059d318a5360f598bf97d230eae96ceb.zip
[integration.tests] 348497: IntegrationTest ChoicePoints
https://bugs.eclipse.org/bugs/show_bug.cgi?id=348497 added new integration test with choice points and guarded transitions
Diffstat (limited to 'tests/org.eclipse.etrice.integration.tests/src/org/eclipse')
-rw-r--r--tests/org.eclipse.etrice.integration.tests/src/org/eclipse/etrice/integration/tests/IntegrationTestChoicePoint.java64
-rw-r--r--tests/org.eclipse.etrice.integration.tests/src/org/eclipse/etrice/integration/tests/helpers/CRC16Generator.java39
2 files changed, 103 insertions, 0 deletions
diff --git a/tests/org.eclipse.etrice.integration.tests/src/org/eclipse/etrice/integration/tests/IntegrationTestChoicePoint.java b/tests/org.eclipse.etrice.integration.tests/src/org/eclipse/etrice/integration/tests/IntegrationTestChoicePoint.java
new file mode 100644
index 000000000..294ce4cdb
--- /dev/null
+++ b/tests/org.eclipse.etrice.integration.tests/src/org/eclipse/etrice/integration/tests/IntegrationTestChoicePoint.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Tieto Deutschland Gmbh (http://www.tieto.com).
+ * 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 Jung
+ *
+ *******************************************************************************/
+
+package org.eclipse.etrice.integration.tests;
+
+
+import static org.junit.Assert.assertEquals;
+
+import org.eclipse.etrice.integration.ChoicePointTest.SubSystem_CPTest;
+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 IntegrationTestChoicePoint 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=5000)
+ public void testChoicePoint(){
+ SubSystem_CPTest main_component = new SubSystem_CPTest(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/helpers/CRC16Generator.java b/tests/org.eclipse.etrice.integration.tests/src/org/eclipse/etrice/integration/tests/helpers/CRC16Generator.java
new file mode 100644
index 000000000..13147fcce
--- /dev/null
+++ b/tests/org.eclipse.etrice.integration.tests/src/org/eclipse/etrice/integration/tests/helpers/CRC16Generator.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2010 tieto deutschland gmbh (http://www.tieto.com).
+ * 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 Jung (initial contribution)
+ *
+ *******************************************************************************/
+
+package org.eclipse.etrice.integration.tests.helpers;
+
+public class CRC16Generator {
+
+ private int crc;
+
+ public CRC16Generator(){
+ crc = 0;
+ }
+
+ public int getCrc(){
+ return crc;
+ }
+
+ public void update(int val) {
+ /* calculates 16-bit CRC of given data */
+ /* based on the polynomial x^16+x^15+x^2+1 */
+ int c,i;
+
+ c=val;
+ for(i=0;i<16;i++) {
+ if(((crc ^ c) & 1)==1) crc=(crc>>1)^0xA001;
+ else crc>>=1;
+ c>>=1;
+ }
+ }
+}

Back to the top