1 /*******************************************************************************
2 * Copyright (c) 2012, 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 ******************************************************************************/
13 package org
.eclipse
.tracecompass
.tmf
.ctf
.core
.tests
.temp
.statistics
;
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
;
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
;
31 * Unit tests for the {@link TmfStateStatistics}
33 * @author Alexandre Montplaisir
35 public class TmfStateStatisticsTest
extends TmfStatisticsTest
{
37 private ITmfTrace fTrace
;
39 private TmfStatisticsTotalsModule fTotalsMod
;
40 private TmfStatisticsEventTypesModule fEventTypesMod
;
46 public static void setUpClass() {
47 assumeTrue(testTrace
.exists());
55 ITmfTrace trace
= testTrace
.getTrace();
58 /* Prepare the two analysis-backed state systems */
59 fTotalsMod
= new TmfStatisticsTotalsModule();
60 fEventTypesMod
= new TmfStatisticsEventTypesModule();
62 fTotalsMod
.setTrace(trace
);
63 fEventTypesMod
.setTrace(trace
);
64 } catch (TmfAnalysisException e
) {
68 fTotalsMod
.schedule();
69 fEventTypesMod
.schedule();
70 assertTrue(fTotalsMod
.waitForCompletion());
71 assertTrue(fEventTypesMod
.waitForCompletion());
73 ITmfStateSystem totalsSS
= fTotalsMod
.getStateSystem();
74 ITmfStateSystem eventTypesSS
= fEventTypesMod
.getStateSystem();
75 assertNotNull(totalsSS
);
76 assertNotNull(eventTypesSS
);
78 backend
= new TmfStateStatistics(totalsSS
, eventTypesSS
);
85 public void tearDown() {
87 fEventTypesMod
.dispose();