blob: 8cb40fbaf71f1a3940cde1f11d55943342aa208e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
/*******************************************************************************
* Copyright (c) 2013, 2014 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Alexandre Montplaisir - Initial API and implementation
* Bernd Hufmann - Use state system analysis module instead of factory
******************************************************************************/
package org.eclipse.linuxtools.lttng2.kernel.core.tests.stateprovider;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.junit.Assume.assumeTrue;
import org.eclipse.linuxtools.internal.lttng2.kernel.core.stateprovider.LttngKernelStateProvider;
import org.eclipse.linuxtools.tmf.core.exceptions.TmfAnalysisException;
import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateProvider;
import org.eclipse.linuxtools.tmf.core.statesystem.TmfStateSystemAnalysisModule;
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
import org.eclipse.linuxtools.tmf.ctf.core.CtfTmfTrace;
import org.junit.AfterClass;
import org.junit.BeforeClass;
/**
* State system tests using the in-memory back-end.
*
* @author Alexandre Montplaisir
*/
public class StateSystemInMemoryTest extends StateSystemTest {
private static TestLttngKernelAnalysisModule module;
/**
* Initialization
*/
@BeforeClass
public static void initialize() {
assumeTrue(testTrace.exists());
module = new TestLttngKernelAnalysisModule();
try {
module.setTrace(testTrace.getTrace());
} catch (TmfAnalysisException e) {
fail();
}
module.schedule();
assertTrue(module.waitForCompletion());
ssq = module.getStateSystem();
assertNotNull(ssq);
}
/**
* Class cleanup
*/
@AfterClass
public static void cleanupClass() {
module.close();
}
private static class TestLttngKernelAnalysisModule extends TmfStateSystemAnalysisModule {
/**
* Constructor adding the views to the analysis
*/
public TestLttngKernelAnalysisModule() {
super();
}
@Override
public void setTrace(ITmfTrace trace) throws TmfAnalysisException {
if (!(trace instanceof CtfTmfTrace)) {
throw new IllegalStateException("TestLttngKernelAnalysisModule: trace should be of type CtfTmfTrace"); //$NON-NLS-1$
}
super.setTrace(trace);
}
@Override
protected ITmfStateProvider createStateProvider() {
return new LttngKernelStateProvider(getTrace());
}
@Override
protected StateSystemBackendType getBackendType() {
return StateSystemBackendType.INMEM;
}
}
}
|