lttng: Disable NLS warnings in tests
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng2.kernel.core.tests / src / org / eclipse / linuxtools / lttng2 / kernel / core / tests / stateprovider / StateSystemFullHistoryTest.java
1 /*******************************************************************************
2 * Copyright (c) 2012, 2013 Ericsson
3 *
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *
9 * Contributors:
10 * Alexandre Montplaisir - Initial API and implementation
11 ******************************************************************************/
12
13 package org.eclipse.linuxtools.lttng2.kernel.core.tests.stateprovider;
14
15 import static org.junit.Assert.assertEquals;
16 import static org.junit.Assert.assertNotNull;
17 import static org.junit.Assert.fail;
18 import static org.junit.Assume.assumeTrue;
19
20 import java.io.File;
21 import java.io.IOException;
22
23 import org.eclipse.linuxtools.internal.lttng2.kernel.core.stateprovider.CtfKernelStateInput;
24 import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
25 import org.eclipse.linuxtools.tmf.core.statesystem.IStateChangeInput;
26 import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateSystem;
27 import org.eclipse.linuxtools.tmf.core.statesystem.StateSystemManager;
28 import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTraces;
29 import org.junit.BeforeClass;
30 import org.junit.Test;
31
32 /**
33 * State system tests using a full history back-end and the LTTng kernel state
34 * input.
35 *
36 * @author Alexandre Montplaisir
37 */
38 public class StateSystemFullHistoryTest extends StateSystemTest {
39
40 private static File stateFile;
41 private static File stateFileBenchmark;
42
43 /**
44 * Initialize the test cases (build the history file once for all tests).
45 */
46 @BeforeClass
47 public static void initialize() {
48 assumeTrue(CtfTmfTestTraces.tracesExist());
49 try {
50 stateFile = File.createTempFile("test", ".ht");
51 stateFileBenchmark = File.createTempFile("test", ".ht.benchmark");
52
53 input = new CtfKernelStateInput(CtfTmfTestTraces.getTestTrace(TRACE_INDEX));
54 ssq = StateSystemManager.loadStateHistory(stateFile, input, true);
55 } catch (IOException e) {
56 e.printStackTrace();
57 } catch (TmfTraceException e) {
58 e.printStackTrace();
59 } finally {
60 stateFile.deleteOnExit();
61 stateFileBenchmark.deleteOnExit();
62 }
63 }
64
65 // ------------------------------------------------------------------------
66 // Tests specific to a full-history
67 // ------------------------------------------------------------------------
68
69 /**
70 * Rebuild independently so we can benchmark it. Too bad JUnit doesn't allow
71 * us to @Test the @BeforeClass...
72 */
73 @Test
74 public void testBuild() {
75 try {
76 IStateChangeInput input2 = new CtfKernelStateInput(CtfTmfTestTraces.getTestTrace(TRACE_INDEX));
77 ITmfStateSystem ssb2 = StateSystemManager.loadStateHistory(stateFileBenchmark, input2, true);
78
79 assertEquals(startTime, ssb2.getStartTime());
80 assertEquals(endTime, ssb2.getCurrentEndTime());
81
82 } catch (TmfTraceException e) {
83 fail();
84 }
85 }
86
87 /**
88 * Test re-opening the existing file.
89 */
90 @Test
91 public void testOpenExistingStateFile() {
92 try {
93 /* 'newStateFile' should have already been created */
94 ITmfStateSystem ssb2 = StateSystemManager.loadStateHistory(stateFile, null, true);
95
96 assertNotNull(ssb2);
97 assertEquals(startTime, ssb2.getStartTime());
98 assertEquals(endTime, ssb2.getCurrentEndTime());
99
100 } catch (TmfTraceException e) {
101 fail();
102 }
103 }
104
105 }
This page took 0.034901 seconds and 6 git commands to generate.