ss: Rename packages to org.eclipse.tracecompass.*
[deliverable/tracecompass.git] / org.eclipse.tracecompass.lttng2.kernel.core.tests / src / org / eclipse / linuxtools / lttng2 / kernel / core / tests / stateprovider / StateSystemInMemoryTest.java
CommitLineData
f9a76cac 1/*******************************************************************************
60ae41e1 2 * Copyright (c) 2013, 2014 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
14package org.eclipse.linuxtools.lttng2.kernel.core.tests.stateprovider;
15
6a769f6a
BH
16import static org.junit.Assert.assertTrue;
17import static org.junit.Assert.fail;
92ba8466 18
d3ba47d4 19import org.eclipse.linuxtools.internal.lttng2.kernel.core.stateprovider.LttngKernelStateProvider;
e894a508 20import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
2bdf0193
AM
21import org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException;
22import org.eclipse.tracecompass.tmf.core.statesystem.ITmfStateProvider;
23import org.eclipse.tracecompass.tmf.core.statesystem.TmfStateSystemAnalysisModule;
24import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
25import org.eclipse.tracecompass.tmf.ctf.core.CtfTmfTrace;
58ba027e 26import org.junit.After;
f9a76cac
AM
27
28/**
29 * State system tests using the in-memory back-end.
30 *
31 * @author Alexandre Montplaisir
32 */
33public class StateSystemInMemoryTest extends StateSystemTest {
34
58ba027e 35 private TestLttngKernelAnalysisModule module;
bd64ee73 36
edbdb7ea
AM
37 @Override
38 protected ITmfStateSystem initialize() {
bd64ee73 39 module = new TestLttngKernelAnalysisModule();
6a769f6a
BH
40 try {
41 module.setTrace(testTrace.getTrace());
42 } catch (TmfAnalysisException e) {
43 fail();
44 }
45 module.schedule();
7d6122fc 46 assertTrue(module.waitForCompletion());
edbdb7ea 47 return module.getStateSystem();
6a769f6a
BH
48 }
49
bd64ee73
AM
50 /**
51 * Class cleanup
52 */
58ba027e 53 @After
edbdb7ea
AM
54 public void cleanup() {
55 if (module != null) {
56 module.close();
57 }
bd64ee73
AM
58 }
59
6a769f6a
BH
60 private static class TestLttngKernelAnalysisModule extends TmfStateSystemAnalysisModule {
61
62 /**
63 * Constructor adding the views to the analysis
64 */
65 public TestLttngKernelAnalysisModule() {
66 super();
67 }
68
69 @Override
70 public void setTrace(ITmfTrace trace) throws TmfAnalysisException {
71 if (!(trace instanceof CtfTmfTrace)) {
72 throw new IllegalStateException("TestLttngKernelAnalysisModule: trace should be of type CtfTmfTrace"); //$NON-NLS-1$
73 }
74 super.setTrace(trace);
75 }
76
77 @Override
78 protected ITmfStateProvider createStateProvider() {
1887c91b 79 return new LttngKernelStateProvider(getTrace());
6a769f6a
BH
80 }
81
82 @Override
83 protected StateSystemBackendType getBackendType() {
a3b864c0 84 return StateSystemBackendType.INMEM;
6a769f6a 85 }
f9a76cac
AM
86 }
87}
This page took 0.044843 seconds and 5 git commands to generate.