1 /*******************************************************************************
2 * Copyright (c) 2013, 2014 Ericsson
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
10 * Alexandre Montplaisir - Initial API and implementation
11 * Bernd Hufmann - Use state system analysis module instead of factory
12 ******************************************************************************/
14 package org
.eclipse
.tracecompass
.lttng2
.kernel
.core
.tests
.analysis
.kernel
.statesystem
;
16 import static org
.junit
.Assert
.assertTrue
;
17 import static org
.junit
.Assert
.fail
;
19 import org
.eclipse
.tracecompass
.internal
.lttng2
.kernel
.core
.trace
.layout
.LttngEventLayout
;
20 import org
.eclipse
.tracecompass
.lttng2
.kernel
.core
.analysis
.kernel
.LttngKernelStateProvider
;
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
.trace
.CtfTmfTrace
;
26 import org
.junit
.AfterClass
;
27 import org
.junit
.BeforeClass
;
30 * State system tests using the in-memory back-end.
32 * @author Alexandre Montplaisir
34 public class StateSystemInMemoryTest
extends StateSystemTest
{
36 private static TestLttngKernelAnalysisModule module
;
42 public static void initialize() {
43 if (!testTrace
.exists()) {
44 traceIsPresent
= false;
47 traceIsPresent
= true;
49 module
= new TestLttngKernelAnalysisModule();
51 module
.setTrace(testTrace
.getTrace());
52 } catch (TmfAnalysisException e
) {
56 assertTrue(module
.waitForCompletion());
58 fixture
= module
.getStateSystem();
65 public static void cleanup() {
69 if (fixture
!= null) {
76 private static class TestLttngKernelAnalysisModule
extends TmfStateSystemAnalysisModule
{
79 * Constructor adding the views to the analysis
81 public TestLttngKernelAnalysisModule() {
86 public void setTrace(ITmfTrace trace
) throws TmfAnalysisException
{
87 if (!(trace
instanceof CtfTmfTrace
)) {
88 throw new IllegalStateException("TestLttngKernelAnalysisModule: trace should be of type CtfTmfTrace"); //$NON-NLS-1$
90 super.setTrace(trace
);
94 protected ITmfStateProvider
createStateProvider() {
95 return new LttngKernelStateProvider(getTrace(), LttngEventLayout
.getInstance());
99 protected StateSystemBackendType
getBackendType() {
100 return StateSystemBackendType
.INMEM
;