Sync with 5.4.0
[deliverable/titan.core.git] / titan_executor_api / TITAN_Executor_API_test / src / org / eclipse / titan / executorapi / test / JniExecutorAsyncTest.java
1 /******************************************************************************
2 * Copyright (c) 2000-2015 Ericsson Telecom AB
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 ******************************************************************************/
8 package org.eclipse.titan.executorapi.test;
9
10 import static org.junit.Assert.assertTrue;
11
12 import org.eclipse.titan.executor.jni.McStateEnum;
13 import org.eclipse.titan.executorapi.JniExecutor;
14 import org.eclipse.titan.executorapi.util.Log;
15 import org.junit.After;
16 import org.junit.AfterClass;
17 import org.junit.Before;
18 import org.junit.BeforeClass;
19
20 /**
21 * Base class of asynchronous JniExecutor tests.
22 */
23 public abstract class JniExecutorAsyncTest extends JniExecutorTest {
24
25 /**
26 * Common one-time initialization code for asynchronous JniExecutor tests.
27 * It runs only once for a test class.
28 */
29 @BeforeClass
30 public static void oneTimeSetUp() {
31 // one-time initialization code
32 Log.fi();
33 // make sure, that session is shut down
34 final JniExecutor je = JniExecutor.getInstance();
35 je.shutdownSession();
36 je.waitForCompletion();
37 Log.fo();
38 }
39
40 /**
41 * Common one-time cleanup code for asynchronous JniExecutor tests.
42 * It runs only once for a test class.
43 */
44 @AfterClass
45 public static void oneTimeTearDown() {
46 // one-time cleanup code
47 Log.fi();
48 Log.fo();
49 }
50
51 /**
52 * Common initialization code for asynchronous JniExecutor tests.
53 * It runs before each test method.
54 */
55 @Before
56 public void setUp() {
57 Log.fi();
58 // check if session is not started
59 final JniExecutor je = JniExecutor.getInstance();
60 assertTrue( !je.isConnected() );
61 final McStateEnum state = je.getState();
62 assertTrue( state == McStateEnum.MC_INACTIVE );
63 Log.fo();
64 }
65
66 /**
67 * Common cleanup code for asynchronous JniExecutor tests.
68 * It runs before each test method.
69 */
70 @After
71 public void tearDown() {
72 Log.fi();
73 // make sure, that session is shut down
74 final JniExecutor je = JniExecutor.getInstance();
75 je.shutdownSession();
76 je.waitForCompletion();
77 Log.fo();
78 }
79 }
This page took 0.040616 seconds and 5 git commands to generate.