tmf.xml: Move all .core and .ui packages to internal
[deliverable/tracecompass.git] / tmf / org.eclipse.tracecompass.tmf.analysis.xml.core.tests / src / org / eclipse / tracecompass / tmf / analysis / xml / core / tests / stateprovider / TmfXmlDoubleTest.java
1 /*******************************************************************************
2 * Copyright (c) 2016 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
10 package org.eclipse.tracecompass.tmf.analysis.xml.core.tests.stateprovider;
11
12 import static org.junit.Assert.assertEquals;
13 import static org.junit.Assert.assertNotNull;
14
15 import java.util.List;
16
17 import org.eclipse.jdt.annotation.NonNull;
18 import org.eclipse.tracecompass.internal.tmf.analysis.xml.core.stateprovider.XmlStateSystemModule;
19 import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
20 import org.eclipse.tracecompass.statesystem.core.exceptions.StateSystemDisposedException;
21 import org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval;
22 import org.eclipse.tracecompass.tmf.analysis.xml.core.tests.common.TmfXmlTestFiles;
23 import org.eclipse.tracecompass.tmf.analysis.xml.core.tests.module.XmlUtilsTest;
24 import org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException;
25 import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
26 import org.junit.Test;
27
28 /**
29 * Test Doubles in xml state system
30 *
31 * @author Matthew Khouzam
32 *
33 */
34 public class TmfXmlDoubleTest {
35
36 private static final @NonNull String testTrace3 = "test_traces/testTrace3.xml";
37
38 /**
39 * Test the state system on a double
40 *
41 * @throws TmfAnalysisException
42 * if it happens, we fail
43 * @throws StateSystemDisposedException
44 * if it happens, we fail
45 *
46 */
47 @Test
48 public void testConditionsValidation() throws TmfAnalysisException, StateSystemDisposedException {
49 ITmfTrace trace = XmlUtilsTest.initializeTrace(testTrace3);
50 XmlStateSystemModule module = XmlUtilsTest.initializeModule(TmfXmlTestFiles.DOUBLES_FILE);
51 module.setTrace(trace);
52
53 module.schedule();
54 module.waitForCompletion();
55
56 ITmfStateSystem ss = module.getStateSystem();
57 assertNotNull(ss);
58 List<ITmfStateInterval> val = ss.queryFullState(2);
59 assertEquals(3.141592, val.get(0).getStateValue().unboxDouble(), Double.MIN_VALUE);
60 val = ss.queryFullState(4);
61 assertEquals(2.71828, val.get(0).getStateValue().unboxDouble(), Double.MIN_VALUE);
62 val = ss.queryFullState(6);
63 assertEquals(1.41421, val.get(0).getStateValue().unboxDouble(), Double.MIN_VALUE);
64 }
65 }
This page took 0.039941 seconds and 5 git commands to generate.