tmf: Disable NLS warnings in tests
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui.tests / src / org / eclipse / linuxtools / tmf / ui / tests / views / uml2sd / loader / TmfUml2SDSyncLoaderSignalTest.java
CommitLineData
73005152 1/*******************************************************************************
90ed5958 2 * Copyright (c) 2011-2013 Ericsson
64636df8 3 *
73005152
BH
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
64636df8 8 *
73005152
BH
9 * Contributors:
10 * Bernd Hufmann - Initial API and implementation
90ed5958 11 * Alexandre Montplaisir - Port to JUnit4
73005152 12 *******************************************************************************/
90ed5958 13
df0b8ff4 14package org.eclipse.linuxtools.tmf.ui.tests.views.uml2sd.loader;
73005152 15
90ed5958
AM
16import static org.junit.Assert.assertEquals;
17import static org.junit.Assert.assertFalse;
18import static org.junit.Assert.assertTrue;
73005152 19
6c13869b 20import org.eclipse.linuxtools.tmf.core.signal.TmfRangeSynchSignal;
3bd46eef
AM
21import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
22import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
73005152 23import org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.GraphNode;
90ed5958
AM
24import org.junit.AfterClass;
25import org.junit.BeforeClass;
26import org.junit.Test;
73005152 27
64636df8
BH
28/**
29 * Test cases for signal handling.
30 *
31 * @author Bernd Hufmann
64636df8 32 */
90ed5958 33public class TmfUml2SDSyncLoaderSignalTest {
73005152 34
90ed5958
AM
35 private static Uml2SDTestFacility fFacility;
36 private static Uml2SDSignalValidator fTmfComponent;
4f5d9f9b 37
90ed5958
AM
38 private static TmfTimeRange range;
39 private static TmfTimestamp rangeWindow;
40 private static TmfTimestamp currentTime;
4f5d9f9b
BH
41
42 /**
90ed5958 43 * Initialization
4f5d9f9b 44 */
90ed5958
AM
45 @BeforeClass
46 public static void setUpClass() {
73005152 47 fFacility = Uml2SDTestFacility.getInstance();
73005152 48 fFacility.selectExperiment();
90ed5958
AM
49
50 range = new TmfTimeRange(new Uml2SDTestTimestamp(9789689220871L), new Uml2SDTestTimestamp(9789773881426L));
51 // Get range window for tests below
52 rangeWindow = (TmfTimestamp) range.getEndTime().getDelta(range.getStartTime());
53 currentTime = new Uml2SDTestTimestamp(9789773782043L);
54
55 fFacility.getTrace().broadcast(new TmfRangeSynchSignal(fFacility, range, currentTime));
56 fFacility.delay(IUml2SDTestConstants.BROADCAST_DELAY);
57
58 fTmfComponent = new Uml2SDSignalValidator();
73005152
BH
59 }
60
90ed5958
AM
61 /**
62 * Cleanup
63 */
64 @AfterClass
65 public static void tearDownClass() {
73005152 66 fFacility.disposeExperiment();
73005152 67 fFacility = null;
73005152 68 }
64636df8
BH
69
70 /**
90ed5958
AM
71 * Test Case: 001
72 * Description: Verify that time range signal is send with correct values when going to first page
73 * Verified Methods: broadcast()
74 * Expected result: Time range sync signal is sent with correct range and current time.
64636df8 75 */
90ed5958
AM
76 @Test
77 public void verifyFirstPageSignal() {
73005152
BH
78 currentTime = new Uml2SDTestTimestamp(9788641608418L);
79 range = new TmfTimeRange(currentTime, new Uml2SDTestTimestamp(currentTime.getValue() + rangeWindow.getValue()));
64636df8 80
73005152
BH
81 fTmfComponent.setSignalError(false);
82 fTmfComponent.setSignalReceived(false);
83 fTmfComponent.setCurrentTimeError(false);
84 fTmfComponent.setRangeError(false);
85 fTmfComponent.setSourceError(false);
86
87 // set expected values
88 fTmfComponent.setSource(fFacility.getLoader());
89 fTmfComponent.setCurrentTime(currentTime);
90 fTmfComponent.setCurrentRange(range);
91
92 fFacility.firstPage();
93 assertTrue("TmfRangeSynchSignal", fTmfComponent.isSignalReceived());
94 assertFalse("TmfRangeSynchSignal", fTmfComponent.isSignalError());
95 assertFalse("TmfRangeSynchSignal", fTmfComponent.isCurrentTimeError());
96 assertFalse("TmfRangeSynchSignal", fTmfComponent.isSourceError());
97 assertFalse("TmfRangeSynchSignal", fTmfComponent.isRangeError());
90ed5958 98 }
64636df8 99
90ed5958
AM
100 /**
101 * Test Case: 002
102 * Description: Verify that time sync signal is sent correctly after selection
103 * Verified Methods: loader.broadcast(), testSelectionChanged
104 * Expected result: Time sync signal is sent with correct current time.
105 */
106 @Test
107 public void verifySelectionSignal() {
73005152
BH
108 fTmfComponent.setSignalReceived(false);
109
110 int count = fFacility.getSdView().getFrame().syncMessageCount();
111 assertEquals("Test Preparation", IUml2SDTestConstants.MAX_MESSEAGES_PER_PAGE, count);
112 GraphNode node = fFacility.getSdView().getFrame().getSyncMessage(3);
113
114 // set expected values
115 fTmfComponent.setSource(fFacility.getLoader());
116 fTmfComponent.setCurrentTime(new Uml2SDTestTimestamp(9788642113228L));
117 fTmfComponent.setCurrentRange(null); // not used
118
119 fFacility.getSdView().getSDWidget().moveTo(node); // selects the given node
814969ed
BH
120 // Wait for the selection to finish - needed due to new platform behavior in Juno
121 fFacility.delay(IUml2SDTestConstants.GUI_REFESH_DELAY);
73005152
BH
122 assertTrue("TmfTimeSynchSignal", fTmfComponent.isSignalReceived());
123 assertFalse("TmfTimeSynchSignal", fTmfComponent.isSignalError());
124 assertFalse("TmfTimeSynchSignal", fTmfComponent.isCurrentTimeError());
125 assertFalse("TmfTimeSynchSignal", fTmfComponent.isSourceError());
126
127 fTmfComponent.setSignalReceived(false);
64636df8 128
73005152
BH
129 fTmfComponent.dispose();
130 }
131}
This page took 0.054139 seconds and 5 git commands to generate.