Commit | Line | Data |
---|---|---|
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 | 14 | package org.eclipse.tracecompass.lttng2.kernel.core.tests.analysis.kernel.statesystem; |
f9a76cac | 15 | |
6a769f6a BH |
16 | import static org.junit.Assert.assertTrue; |
17 | import static org.junit.Assert.fail; | |
92ba8466 | 18 | |
6d16f5a9 | 19 | import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.KernelAnalysisModule; |
2bdf0193 | 20 | import org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException; |
2bdf0193 | 21 | import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace; |
9722e5d7 | 22 | import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace; |
392bf486 AM |
23 | import org.junit.AfterClass; |
24 | import org.junit.BeforeClass; | |
f9a76cac AM |
25 | |
26 | /** | |
27 | * State system tests using the in-memory back-end. | |
28 | * | |
29 | * @author Alexandre Montplaisir | |
30 | */ | |
31 | public class StateSystemInMemoryTest extends StateSystemTest { | |
32 | ||
392bf486 AM |
33 | private static TestLttngKernelAnalysisModule module; |
34 | ||
35 | /** | |
36 | * Test class setup | |
37 | */ | |
38 | @BeforeClass | |
39 | public static void initialize() { | |
40 | if (!testTrace.exists()) { | |
41 | traceIsPresent = false; | |
42 | return; | |
43 | } | |
44 | traceIsPresent = true; | |
bd64ee73 | 45 | |
bd64ee73 | 46 | module = new TestLttngKernelAnalysisModule(); |
6a769f6a | 47 | try { |
f479550c | 48 | assertTrue(module.setTrace(testTrace.getTrace())); |
6a769f6a BH |
49 | } catch (TmfAnalysisException e) { |
50 | fail(); | |
51 | } | |
52 | module.schedule(); | |
7d6122fc | 53 | assertTrue(module.waitForCompletion()); |
392bf486 AM |
54 | |
55 | fixture = module.getStateSystem(); | |
6a769f6a BH |
56 | } |
57 | ||
bd64ee73 AM |
58 | /** |
59 | * Class cleanup | |
60 | */ | |
392bf486 AM |
61 | @AfterClass |
62 | public static void cleanup() { | |
edbdb7ea | 63 | if (module != null) { |
03f0b0b1 | 64 | module.dispose(); |
edbdb7ea | 65 | } |
392bf486 AM |
66 | if (fixture != null) { |
67 | fixture.dispose(); | |
68 | } | |
69 | module = null; | |
70 | fixture = null; | |
bd64ee73 AM |
71 | } |
72 | ||
6d16f5a9 | 73 | private static class TestLttngKernelAnalysisModule extends KernelAnalysisModule { |
6a769f6a BH |
74 | |
75 | /** | |
76 | * Constructor adding the views to the analysis | |
77 | */ | |
78 | public TestLttngKernelAnalysisModule() { | |
79 | super(); | |
80 | } | |
81 | ||
82 | @Override | |
f479550c | 83 | public boolean setTrace(ITmfTrace trace) throws TmfAnalysisException { |
6a769f6a | 84 | if (!(trace instanceof CtfTmfTrace)) { |
f479550c | 85 | return false; |
6a769f6a | 86 | } |
f479550c | 87 | return super.setTrace(trace); |
6a769f6a BH |
88 | } |
89 | ||
6a769f6a BH |
90 | @Override |
91 | protected StateSystemBackendType getBackendType() { | |
a3b864c0 | 92 | return StateSystemBackendType.INMEM; |
6a769f6a | 93 | } |
f9a76cac AM |
94 | } |
95 | } |