b3e161caa74a781f9f940fa1fc766d9eb8d7c4e8
[deliverable/tracecompass.git] / 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 import static org.junit.Assume.assumeTrue;
19
20 import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
21 import org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException;
22 import org.eclipse.tracecompass.tmf.core.statistics.TmfStateStatistics;
23 import org.eclipse.tracecompass.tmf.core.statistics.TmfStatisticsEventTypesModule;
24 import org.eclipse.tracecompass.tmf.core.statistics.TmfStatisticsTotalsModule;
25 import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
26 import org.junit.After;
27 import org.junit.Before;
28 import org.junit.BeforeClass;
29
30 /**
31 * Unit tests for the {@link TmfStateStatistics}
32 *
33 * @author Alexandre Montplaisir
34 */
35 public class TmfStateStatisticsTest extends TmfStatisticsTest {
36
37 private ITmfTrace fTrace;
38
39 private TmfStatisticsTotalsModule fTotalsMod;
40 private TmfStatisticsEventTypesModule fEventTypesMod;
41
42 /**
43 * Class setup
44 */
45 @BeforeClass
46 public static void setUpClass() {
47 assumeTrue(testTrace.exists());
48 }
49
50 /**
51 * Test setup
52 */
53 @Before
54 public void setUp() {
55 fTrace = testTrace.getTrace();
56
57 /* Prepare the two analysis-backed state systems */
58 fTotalsMod = new TmfStatisticsTotalsModule();
59 fEventTypesMod = new TmfStatisticsEventTypesModule();
60 try {
61 fTotalsMod.setTrace(fTrace);
62 fEventTypesMod.setTrace(fTrace);
63 } catch (TmfAnalysisException e) {
64 fail();
65 }
66
67 fTotalsMod.schedule();
68 fEventTypesMod.schedule();
69 assertTrue(fTotalsMod.waitForCompletion());
70 assertTrue(fEventTypesMod.waitForCompletion());
71
72 ITmfStateSystem totalsSS = fTotalsMod.getStateSystem();
73 ITmfStateSystem eventTypesSS = fEventTypesMod.getStateSystem();
74 assertNotNull(totalsSS);
75 assertNotNull(eventTypesSS);
76
77 backend = new TmfStateStatistics(totalsSS, eventTypesSS);
78 }
79
80 /**
81 * Test cleanup
82 */
83 @After
84 public void tearDown() {
85 fTotalsMod.dispose();
86 fEventTypesMod.dispose();
87 fTrace.dispose();
88 }
89 }
This page took 0.036523 seconds and 4 git commands to generate.