tmf: Use full history backend by default
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng2.kernel.core.tests / src / org / eclipse / linuxtools / lttng2 / kernel / core / tests / stateprovider / StateSystemInMemoryTest.java
1 /*******************************************************************************
2 * Copyright (c) 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 * 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.assertNotNull;
17 import static org.junit.Assert.assertTrue;
18 import static org.junit.Assert.fail;
19 import static org.junit.Assume.assumeTrue;
20
21 import org.eclipse.linuxtools.internal.lttng2.kernel.core.stateprovider.LttngKernelStateProvider;
22 import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
23 import org.eclipse.linuxtools.tmf.core.exceptions.TmfAnalysisException;
24 import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateProvider;
25 import org.eclipse.linuxtools.tmf.core.statesystem.TmfStateSystemAnalysisModule;
26 import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
27 import org.junit.BeforeClass;
28
29 /**
30 * State system tests using the in-memory back-end.
31 *
32 * @author Alexandre Montplaisir
33 */
34 public class StateSystemInMemoryTest extends StateSystemTest {
35
36 /**
37 * Initialization
38 */
39 @BeforeClass
40 public static void initialize() {
41 assumeTrue(testTrace.exists());
42
43 TestLttngKernelAnalysisModule module = new TestLttngKernelAnalysisModule();
44 try {
45 module.setTrace(testTrace.getTrace());
46 } catch (TmfAnalysisException e) {
47 fail();
48 }
49 module.schedule();
50 assertTrue(module.waitForCompletion());
51 ssq = module.getStateSystem();
52 assertNotNull(ssq);
53 }
54
55 private static class TestLttngKernelAnalysisModule extends TmfStateSystemAnalysisModule {
56
57 /**
58 * Constructor adding the views to the analysis
59 */
60 public TestLttngKernelAnalysisModule() {
61 super();
62 }
63
64 @Override
65 public void setTrace(ITmfTrace trace) throws TmfAnalysisException {
66 if (!(trace instanceof CtfTmfTrace)) {
67 throw new IllegalStateException("TestLttngKernelAnalysisModule: trace should be of type CtfTmfTrace"); //$NON-NLS-1$
68 }
69 super.setTrace(trace);
70 }
71
72 @Override
73 protected ITmfStateProvider createStateProvider() {
74 return new LttngKernelStateProvider((CtfTmfTrace) getTrace());
75 }
76
77 @Override
78 protected StateSystemBackendType getBackendType() {
79 return StateSystemBackendType.INMEM;
80 }
81 }
82 }
This page took 0.033921 seconds and 6 git commands to generate.