os.linux: Rename the "kernelanalysis" package to just "kernel"
[deliverable/tracecompass.git] / lttng / org.eclipse.tracecompass.lttng2.kernel.core.tests / src / org / eclipse / tracecompass / lttng2 / kernel / core / tests / analysis / kernel / statesystem / StateSystemInMemoryTest.java
CommitLineData
f9a76cac 1/*******************************************************************************
ed902a2b 2 * Copyright (c) 2013, 2015 Ericsson
f9a76cac
AM
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
6a769f6a 11 * Bernd Hufmann - Use state system analysis module instead of factory
f9a76cac
AM
12 ******************************************************************************/
13
42d5b5f2 14package org.eclipse.tracecompass.lttng2.kernel.core.tests.analysis.kernel.statesystem;
f9a76cac 15
6a769f6a
BH
16import static org.junit.Assert.assertTrue;
17import static org.junit.Assert.fail;
92ba8466 18
0f7a12d3 19import org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule;
2bdf0193 20import org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException;
2bdf0193 21import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
c4d57ac1 22import org.eclipse.tracecompass.tmf.ctf.core.tests.shared.CtfTmfTestTraceUtils;
9722e5d7 23import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
392bf486
AM
24import org.junit.AfterClass;
25import org.junit.BeforeClass;
f9a76cac
AM
26
27/**
28 * State system tests using the in-memory back-end.
29 *
30 * @author Alexandre Montplaisir
31 */
32public class StateSystemInMemoryTest extends StateSystemTest {
33
c4d57ac1 34 private static CtfTmfTrace trace;
392bf486
AM
35 private static TestLttngKernelAnalysisModule module;
36
37 /**
38 * Test class setup
39 */
40 @BeforeClass
41 public static void initialize() {
c4d57ac1
AM
42 CtfTmfTrace thetrace = CtfTmfTestTraceUtils.getTrace(testTrace);
43 trace = thetrace;
bd64ee73 44
bd64ee73 45 module = new TestLttngKernelAnalysisModule();
6a769f6a 46 try {
c4d57ac1 47 assertTrue(module.setTrace(thetrace));
6a769f6a
BH
48 } catch (TmfAnalysisException e) {
49 fail();
50 }
51 module.schedule();
7d6122fc 52 assertTrue(module.waitForCompletion());
392bf486
AM
53
54 fixture = module.getStateSystem();
6a769f6a
BH
55 }
56
bd64ee73
AM
57 /**
58 * Class cleanup
59 */
392bf486
AM
60 @AfterClass
61 public static void cleanup() {
edbdb7ea 62 if (module != null) {
03f0b0b1 63 module.dispose();
edbdb7ea 64 }
392bf486
AM
65 if (fixture != null) {
66 fixture.dispose();
67 }
c4d57ac1
AM
68 if (trace != null) {
69 trace.dispose();
70 }
392bf486
AM
71 module = null;
72 fixture = null;
c4d57ac1 73 trace = null;
bd64ee73
AM
74 }
75
6d16f5a9 76 private static class TestLttngKernelAnalysisModule extends KernelAnalysisModule {
6a769f6a
BH
77
78 /**
79 * Constructor adding the views to the analysis
80 */
81 public TestLttngKernelAnalysisModule() {
82 super();
83 }
84
85 @Override
f479550c 86 public boolean setTrace(ITmfTrace trace) throws TmfAnalysisException {
6a769f6a 87 if (!(trace instanceof CtfTmfTrace)) {
f479550c 88 return false;
6a769f6a 89 }
f479550c 90 return super.setTrace(trace);
6a769f6a
BH
91 }
92
6a769f6a
BH
93 @Override
94 protected StateSystemBackendType getBackendType() {
a3b864c0 95 return StateSystemBackendType.INMEM;
6a769f6a 96 }
f9a76cac
AM
97 }
98}
This page took 0.0781539999999999 seconds and 5 git commands to generate.