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
;
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
;
30 * Unit tests for the {@link TmfStateStatistics}
32 * @author Alexandre Montplaisir
34 public class TmfStateStatisticsTest
extends TmfStatisticsTest
{
36 private ITmfTrace fTrace
;
38 private TmfStatisticsTotalsModule fTotalsMod
;
39 private TmfStatisticsEventTypesModule fEventTypesMod
;
46 ITmfTrace trace
= CtfTmfTestTraceUtils
.getTrace(testTrace
);
49 /* Prepare the two analysis-backed state systems */
50 fTotalsMod
= new TmfStatisticsTotalsModule();
51 fEventTypesMod
= new TmfStatisticsEventTypesModule();
53 fTotalsMod
.setTrace(trace
);
54 fEventTypesMod
.setTrace(trace
);
55 } catch (TmfAnalysisException e
) {
59 fTotalsMod
.schedule();
60 fEventTypesMod
.schedule();
61 assertTrue(fTotalsMod
.waitForCompletion());
62 assertTrue(fEventTypesMod
.waitForCompletion());
64 ITmfStateSystem totalsSS
= fTotalsMod
.getStateSystem();
65 ITmfStateSystem eventTypesSS
= fEventTypesMod
.getStateSystem();
66 assertNotNull(totalsSS
);
67 assertNotNull(eventTypesSS
);
69 backend
= new TmfStateStatistics(totalsSS
, eventTypesSS
);
76 public void tearDown() {
78 fEventTypesMod
.dispose();