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
.linuxtools
.lttng2
.kernel
.core
.tests
.stateprovider
;
16 import static org
.junit
.Assert
.assertTrue
;
17 import static org
.junit
.Assert
.fail
;
19 import org
.eclipse
.linuxtools
.internal
.lttng2
.kernel
.core
.stateprovider
.LttngKernelStateProvider
;
20 import org
.eclipse
.linuxtools
.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
;
29 * State system tests using the in-memory back-end.
31 * @author Alexandre Montplaisir
33 public class StateSystemInMemoryTest
extends StateSystemTest
{
35 private TestLttngKernelAnalysisModule module
;
38 protected ITmfStateSystem
initialize() {
39 module
= new TestLttngKernelAnalysisModule();
41 module
.setTrace(testTrace
.getTrace());
42 } catch (TmfAnalysisException e
) {
46 assertTrue(module
.waitForCompletion());
47 return module
.getStateSystem();
54 public void cleanup() {
60 private static class TestLttngKernelAnalysisModule
extends TmfStateSystemAnalysisModule
{
63 * Constructor adding the views to the analysis
65 public TestLttngKernelAnalysisModule() {
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$
74 super.setTrace(trace
);
78 protected ITmfStateProvider
createStateProvider() {
79 return new LttngKernelStateProvider(getTrace());
83 protected StateSystemBackendType
getBackendType() {
84 return StateSystemBackendType
.INMEM
;