1 /*******************************************************************************
2 * Copyright (c) 2013, 2015 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
.eclipse
.tracecompass
.common
.core
.NonNullUtils
.checkNotNull
;
17 import static org
.junit
.Assert
.assertTrue
;
18 import static org
.junit
.Assert
.fail
;
20 import org
.eclipse
.tracecompass
.analysis
.os
.linux
.core
.kernelanalysis
.KernelStateProvider
;
21 import org
.eclipse
.tracecompass
.internal
.lttng2
.kernel
.core
.trace
.layout
.LttngEventLayout
;
22 import org
.eclipse
.tracecompass
.tmf
.core
.exceptions
.TmfAnalysisException
;
23 import org
.eclipse
.tracecompass
.tmf
.core
.statesystem
.ITmfStateProvider
;
24 import org
.eclipse
.tracecompass
.tmf
.core
.statesystem
.TmfStateSystemAnalysisModule
;
25 import org
.eclipse
.tracecompass
.tmf
.core
.trace
.ITmfTrace
;
26 import org
.eclipse
.tracecompass
.tmf
.ctf
.core
.trace
.CtfTmfTrace
;
27 import org
.junit
.AfterClass
;
28 import org
.junit
.BeforeClass
;
31 * State system tests using the in-memory back-end.
33 * @author Alexandre Montplaisir
35 public class StateSystemInMemoryTest
extends StateSystemTest
{
37 private static TestLttngKernelAnalysisModule module
;
43 public static void initialize() {
44 if (!testTrace
.exists()) {
45 traceIsPresent
= false;
48 traceIsPresent
= true;
50 module
= new TestLttngKernelAnalysisModule();
52 assertTrue(module
.setTrace(testTrace
.getTrace()));
53 } catch (TmfAnalysisException e
) {
57 assertTrue(module
.waitForCompletion());
59 fixture
= module
.getStateSystem();
66 public static void cleanup() {
70 if (fixture
!= null) {
77 private static class TestLttngKernelAnalysisModule
extends TmfStateSystemAnalysisModule
{
80 * Constructor adding the views to the analysis
82 public TestLttngKernelAnalysisModule() {
87 public boolean setTrace(ITmfTrace trace
) throws TmfAnalysisException
{
88 if (!(trace
instanceof CtfTmfTrace
)) {
91 return super.setTrace(trace
);
95 protected ITmfStateProvider
createStateProvider() {
96 return new KernelStateProvider(checkNotNull(getTrace()), LttngEventLayout
.getInstance());
100 protected StateSystemBackendType
getBackendType() {
101 return StateSystemBackendType
.INMEM
;