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 | ||
91e7f946 | 13 | package org.eclipse.linuxtools.tmf.ctf.core.tests.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; |
c1264bdc | 18 | import static org.junit.Assume.assumeTrue; |
5dd1fa65 | 19 | |
bcec0116 | 20 | import org.eclipse.linuxtools.statesystem.core.ITmfStateSystem; |
c1264bdc | 21 | import org.eclipse.linuxtools.tmf.core.exceptions.TmfAnalysisException; |
e1c43333 | 22 | import org.eclipse.linuxtools.tmf.core.statistics.TmfStateStatistics; |
c1264bdc AM |
23 | import org.eclipse.linuxtools.tmf.core.statistics.TmfStatisticsEventTypesModule; |
24 | import org.eclipse.linuxtools.tmf.core.statistics.TmfStatisticsTotalsModule; | |
25 | import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace; | |
26 | import org.junit.After; | |
27 | import org.junit.Before; | |
e1c43333 AM |
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 | ||
c1264bdc | 37 | private ITmfTrace fTrace; |
947504fa | 38 | |
e1c43333 | 39 | /** |
c1264bdc | 40 | * Class setup |
e1c43333 AM |
41 | */ |
42 | @BeforeClass | |
43 | public static void setUpClass() { | |
9ac63b5b | 44 | assumeTrue(testTrace.exists()); |
c1264bdc | 45 | } |
802017fe | 46 | |
c1264bdc AM |
47 | /** |
48 | * Test setup | |
49 | */ | |
50 | @Before | |
51 | public void setUp() { | |
52 | fTrace = testTrace.getTrace(); | |
947504fa | 53 | |
c1264bdc AM |
54 | /* Prepare the two analysis-backed state systems */ |
55 | TmfStatisticsTotalsModule totalsMod = new TmfStatisticsTotalsModule(); | |
56 | TmfStatisticsEventTypesModule eventTypesMod = new TmfStatisticsEventTypesModule(); | |
57 | try { | |
58 | totalsMod.setTrace(fTrace); | |
59 | eventTypesMod.setTrace(fTrace); | |
60 | } catch (TmfAnalysisException e) { | |
947504fa | 61 | fail(); |
e1c43333 | 62 | } |
c1264bdc AM |
63 | |
64 | totalsMod.schedule(); | |
65 | eventTypesMod.schedule(); | |
66 | assertTrue(totalsMod.waitForCompletion()); | |
67 | assertTrue(eventTypesMod.waitForCompletion()); | |
68 | ||
69 | ITmfStateSystem totalsSS = totalsMod.getStateSystem(); | |
70 | ITmfStateSystem eventTypesSS = eventTypesMod.getStateSystem(); | |
71 | assertNotNull(totalsSS); | |
72 | assertNotNull(eventTypesSS); | |
73 | ||
74 | backend = new TmfStateStatistics(totalsSS, eventTypesSS); | |
e1c43333 | 75 | } |
947504fa AM |
76 | |
77 | /** | |
c1264bdc | 78 | * Test cleanup |
947504fa | 79 | */ |
c1264bdc AM |
80 | @After |
81 | public void tearDown() { | |
82 | fTrace.dispose(); | |
947504fa | 83 | } |
e1c43333 | 84 | } |