Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 69b32e69abeee71d428d9a905a00b46ed83797d6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*******************************************************************************
 * 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.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.runtime.java.messaging.RTServices;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.resources.ResourcesPlugin;


public class IntegrationTestFSMGenerator {

	@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=1000)
	public void testHFSM(){
		SubSystemHFSMTest main_component = new SubSystemHFSMTest(null,"MainComponent");
		main_component.init(); // lifecycle init
		main_component.start(); // lifecycle start
		
		// TODOTS: Test broken -> repair after changes for multi threading
//		main_component.waitTerminate();
		
		assertEquals(a_HFSM_Tester.STATE_TestPass ,main_component.getInstance("/MainComponent/application/HFSM_Tests/Tester").getState());
		
		// end the lifecycle
		main_component.stop(); // lifecycle stop
		main_component.destroy(); // lifecycle destroy
	}

	@After
	public void tearDown() throws Exception {
	}

	
}

Back to the top