Commit | Line | Data |
---|---|---|
e1c43333 | 1 | /******************************************************************************* |
60ae41e1 | 2 | * Copyright (c) 2012, 2014 Ericsson |
e1c43333 AM |
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 | ||
9722e5d7 | 13 | package org.eclipse.tracecompass.tmf.ctf.core.tests.temp.statistics; |
e1c43333 | 14 | |
c1264bdc AM |
15 | import static org.junit.Assert.assertNotNull; |
16 | import static org.junit.Assert.assertTrue; | |
947504fa | 17 | import static org.junit.Assert.fail; |
5dd1fa65 | 18 | |
e894a508 | 19 | import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem; |
2bdf0193 AM |
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; | |
c4d57ac1 | 25 | import org.eclipse.tracecompass.tmf.ctf.core.tests.shared.CtfTmfTestTraceUtils; |
c1264bdc AM |
26 | import org.junit.After; |
27 | import org.junit.Before; | |
e1c43333 AM |
28 | |
29 | /** | |
30 | * Unit tests for the {@link TmfStateStatistics} | |
31 | * | |
32 | * @author Alexandre Montplaisir | |
33 | */ | |
34 | public class TmfStateStatisticsTest extends TmfStatisticsTest { | |
35 | ||
c1264bdc | 36 | private ITmfTrace fTrace; |
947504fa | 37 | |
bd64ee73 AM |
38 | private TmfStatisticsTotalsModule fTotalsMod; |
39 | private TmfStatisticsEventTypesModule fEventTypesMod; | |
40 | ||
c1264bdc AM |
41 | /** |
42 | * Test setup | |
43 | */ | |
44 | @Before | |
45 | public void setUp() { | |
c4d57ac1 | 46 | ITmfTrace trace = CtfTmfTestTraceUtils.getTrace(testTrace); |
ba27dd38 | 47 | fTrace = trace; |
947504fa | 48 | |
c1264bdc | 49 | /* Prepare the two analysis-backed state systems */ |
bd64ee73 AM |
50 | fTotalsMod = new TmfStatisticsTotalsModule(); |
51 | fEventTypesMod = new TmfStatisticsEventTypesModule(); | |
c1264bdc | 52 | try { |
ba27dd38 GB |
53 | fTotalsMod.setTrace(trace); |
54 | fEventTypesMod.setTrace(trace); | |
c1264bdc | 55 | } catch (TmfAnalysisException e) { |
947504fa | 56 | fail(); |
e1c43333 | 57 | } |
c1264bdc | 58 | |
bd64ee73 AM |
59 | fTotalsMod.schedule(); |
60 | fEventTypesMod.schedule(); | |
61 | assertTrue(fTotalsMod.waitForCompletion()); | |
62 | assertTrue(fEventTypesMod.waitForCompletion()); | |
c1264bdc | 63 | |
bd64ee73 AM |
64 | ITmfStateSystem totalsSS = fTotalsMod.getStateSystem(); |
65 | ITmfStateSystem eventTypesSS = fEventTypesMod.getStateSystem(); | |
c1264bdc AM |
66 | assertNotNull(totalsSS); |
67 | assertNotNull(eventTypesSS); | |
68 | ||
69 | backend = new TmfStateStatistics(totalsSS, eventTypesSS); | |
e1c43333 | 70 | } |
947504fa AM |
71 | |
72 | /** | |
c1264bdc | 73 | * Test cleanup |
947504fa | 74 | */ |
c1264bdc AM |
75 | @After |
76 | public void tearDown() { | |
03f0b0b1 AM |
77 | fTotalsMod.dispose(); |
78 | fEventTypesMod.dispose(); | |
c1264bdc | 79 | fTrace.dispose(); |
947504fa | 80 | } |
e1c43333 | 81 | } |