b30840358445539dde5a5953b98029b7101cfdf8
[deliverable/tracecompass.git] / ctf / org.eclipse.tracecompass.tmf.ctf.core.tests / src / org / eclipse / tracecompass / tmf / ctf / core / tests / temp / statistics / TmfStateStatisticsTest.java
1 /*******************************************************************************
2 * Copyright (c) 2012, 2014 Ericsson
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 * Alexandre Montplaisir - Initial API and implementation
11 ******************************************************************************/
12
13 package org.eclipse.tracecompass.tmf.ctf.core.tests.temp.statistics;
14
15 import static org.junit.Assert.assertNotNull;
16 import static org.junit.Assert.assertTrue;
17 import static org.junit.Assert.fail;
18
19 import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
20 import org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException;
21 import org.eclipse.tracecompass.tmf.core.statistics.TmfStateStatistics;
22 import org.eclipse.tracecompass.tmf.core.statistics.TmfStatisticsEventTypesModule;
23 import org.eclipse.tracecompass.tmf.core.statistics.TmfStatisticsTotalsModule;
24 import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
25 import org.eclipse.tracecompass.tmf.ctf.core.tests.shared.CtfTmfTestTraceUtils;
26 import org.junit.After;
27 import org.junit.Before;
28
29 /**
30 * Unit tests for the {@link TmfStateStatistics}
31 *
32 * @author Alexandre Montplaisir
33 */
34 public class TmfStateStatisticsTest extends TmfStatisticsTest {
35
36 private ITmfTrace fTrace;
37
38 private TmfStatisticsTotalsModule fTotalsMod;
39 private TmfStatisticsEventTypesModule fEventTypesMod;
40
41 /**
42 * Test setup
43 */
44 @Before
45 public void setUp() {
46 ITmfTrace trace = CtfTmfTestTraceUtils.getTrace(testTrace);
47 fTrace = trace;
48
49 /* Prepare the two analysis-backed state systems */
50 fTotalsMod = new TmfStatisticsTotalsModule();
51 fEventTypesMod = new TmfStatisticsEventTypesModule();
52 try {
53 fTotalsMod.setTrace(trace);
54 fEventTypesMod.setTrace(trace);
55 } catch (TmfAnalysisException e) {
56 fail();
57 }
58
59 fTotalsMod.schedule();
60 fEventTypesMod.schedule();
61 assertTrue(fTotalsMod.waitForCompletion());
62 assertTrue(fEventTypesMod.waitForCompletion());
63
64 ITmfStateSystem totalsSS = fTotalsMod.getStateSystem();
65 ITmfStateSystem eventTypesSS = fEventTypesMod.getStateSystem();
66 assertNotNull(totalsSS);
67 assertNotNull(eventTypesSS);
68
69 backend = new TmfStateStatistics(totalsSS, eventTypesSS);
70 }
71
72 /**
73 * Test cleanup
74 */
75 @After
76 public void tearDown() {
77 fTotalsMod.dispose();
78 fEventTypesMod.dispose();
79 fTrace.dispose();
80 }
81 }
This page took 0.03361 seconds and 5 git commands to generate.