pcap: 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
1 /*******************************************************************************
2 * Copyright (c) 2013, 2014 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 * Bernd Hufmann - Use state system analysis module instead of factory
12 ******************************************************************************/
13
14 package org.eclipse.linuxtools.lttng2.kernel.core.tests.stateprovider;
15
16 import static org.junit.Assert.assertTrue;
17 import static org.junit.Assert.fail;
18
19 import org.eclipse.linuxtools.internal.lttng2.kernel.core.stateprovider.LttngKernelStateProvider;
20 import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
21 import org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException;
22 import org.eclipse.tracecompass.tmf.core.statesystem.ITmfStateProvider;
23 import org.eclipse.tracecompass.tmf.core.statesystem.TmfStateSystemAnalysisModule;
24 import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
25 import org.eclipse.tracecompass.tmf.ctf.core.CtfTmfTrace;
26 import org.junit.After;
27
28 /**
29 * State system tests using the in-memory back-end.
30 *
31 * @author Alexandre Montplaisir
32 */
33 public class StateSystemInMemoryTest extends StateSystemTest {
34
35 private TestLttngKernelAnalysisModule module;
36
37 @Override
38 protected ITmfStateSystem initialize() {
39 module = new TestLttngKernelAnalysisModule();
40 try {
41 module.setTrace(testTrace.getTrace());
42 } catch (TmfAnalysisException e) {
43 fail();
44 }
45 module.schedule();
46 assertTrue(module.waitForCompletion());
47 return module.getStateSystem();
48 }
49
50 /**
51 * Class cleanup
52 */
53 @After
54 public void cleanup() {
55 if (module != null) {
56 module.close();
57 }
58 }
59
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() {
79 return new LttngKernelStateProvider(getTrace());
80 }
81
82 @Override
83 protected StateSystemBackendType getBackendType() {
84 return StateSystemBackendType.INMEM;
85 }
86 }
87 }
This page took 0.039713 seconds and 5 git commands to generate.