LTTng: Remove dependency to LttngKernelTrace in Lttng Kernel analysis module
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng2.kernel.core.tests / src / org / eclipse / linuxtools / lttng2 / kernel / core / tests / analysis / LttngKernelAnalysisTest.java
1 /*******************************************************************************
2 * Copyright (c) 2014 École Polytechnique de Montréal
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 * Geneviève Bastien - Initial API and implementation
11 *******************************************************************************/
12
13 package org.eclipse.linuxtools.lttng2.kernel.core.tests.analysis;
14
15 import static org.junit.Assert.assertFalse;
16 import static org.junit.Assert.assertNotNull;
17 import static org.junit.Assert.assertNull;
18 import static org.junit.Assert.assertTrue;
19 import static org.junit.Assert.fail;
20 import static org.junit.Assume.assumeTrue;
21
22 import java.util.List;
23
24 import org.eclipse.linuxtools.lttng2.kernel.core.analysis.LttngKernelAnalysisModule;
25 import org.eclipse.linuxtools.statesystem.core.ITmfStateSystem;
26 import org.eclipse.linuxtools.tmf.core.exceptions.TmfAnalysisException;
27 import org.eclipse.linuxtools.tmf.core.tests.shared.TmfTestHelper;
28 import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
29 import org.eclipse.linuxtools.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
30 import org.junit.After;
31 import org.junit.Before;
32 import org.junit.Test;
33
34 /**
35 * Test the {@link LttngKernelAnalysisModule} class
36 *
37 * @author Geneviève Bastien
38 */
39 public class LttngKernelAnalysisTest {
40
41 private ITmfTrace fTrace;
42
43 /**
44 * Set-up the test
45 */
46 @Before
47 public void setUp() {
48 assumeTrue(CtfTmfTestTrace.KERNEL.exists());
49 fTrace = CtfTmfTestTrace.KERNEL.getTrace();
50 }
51
52 /**
53 * Dispose test objects
54 */
55 @After
56 public void tearDown() {
57 fTrace.dispose();
58 }
59
60 /**
61 * Test the LTTng kernel analysis execution
62 */
63 @Test
64 public void testAnalysisExecution() {
65 LttngKernelAnalysisModule module = new LttngKernelAnalysisModule();
66 module.setId("test");
67 try {
68 module.setTrace(fTrace);
69 } catch (TmfAnalysisException e) {
70 fail(e.getMessage());
71 }
72 // Assert the state system has not been initialized yet
73 ITmfStateSystem ss = module.getStateSystem();
74 assertNull(ss);
75
76 assertTrue(TmfTestHelper.executeAnalysis(module));
77
78 ss = module.getStateSystem();
79 assertNotNull(ss);
80
81 List<Integer> quarks = ss.getQuarks("*");
82 assertFalse(quarks.isEmpty());
83 }
84 }
This page took 0.040316 seconds and 6 git commands to generate.