~ubuntu-branches/ubuntu/trusty/eclipse-linuxtools/trusty

« back to all changes in this revision

Viewing changes to lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/TmfUml2SDSyncLoaderTimeTest.java

  • Committer: Package Import Robot
  • Author(s): tony mancill
  • Date: 2013-05-13 21:43:22 UTC
  • mfrom: (1.2.1) (2.1.2 experimental)
  • Revision ID: package-import@ubuntu.com-20130513214322-6frgd9du1n0w2uo7
Tags: 1.2.1-1
* Team upload.
* New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*******************************************************************************
2
2
 * Copyright (c) 2011, 2012 Ericsson
3
 
 * 
 
3
 *
4
4
 * All rights reserved. This program and the accompanying materials are
5
5
 * made available under the terms of the Eclipse Public License v1.0 which
6
6
 * accompanies this distribution, and is available at
7
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 
 * 
 
8
 *
9
9
 * Contributors:
10
10
 *   Bernd Hufmann - Initial API and implementation
11
11
 *******************************************************************************/
24
24
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.GraphNode;
25
25
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.loader.TmfSyncMessage;
26
26
 
 
27
/**
 
28
 * Test cases for time synchronization handling.
 
29
 *
 
30
 * @author Bernd Hufmann
 
31
 *
 
32
 */
27
33
public class TmfUml2SDSyncLoaderTimeTest extends TestCase {
28
34
 
29
35
    // ------------------------------------------------------------------------
37
43
    final static private int                 TC_001_END_OCCURRANCE   = TC_001_START_OCCURRANCE;
38
44
    final static private String              TC_001_START_LIFELINE   = IUml2SDTestConstants.MASTER_PLAYER_NAME;
39
45
    final static private String              TC_001_END_LIFELINE     = IUml2SDTestConstants.FIRST_PLAYER_NAME;
40
 
    
 
46
 
41
47
    // Test case 002 expected values
42
48
    final static private Uml2SDTestTimestamp TC_002_TIME_VALUE       = new Uml2SDTestTimestamp(9789689830722L);
43
49
    final static private String              TC_002_MESSAGE_NAME     = "PAUSE_GAME_REQUEST"; //$NON-NLS-1$
46
52
    final static private int                 TC_002_END_OCCURRANCE   = TC_002_START_OCCURRANCE;
47
53
    final static private String              TC_002_START_LIFELINE   = IUml2SDTestConstants.FIRST_PLAYER_NAME;
48
54
    final static private String              TC_002_END_LIFELINE     = IUml2SDTestConstants.MASTER_PLAYER_NAME;
49
 
    
 
55
 
50
56
    // Test case 003 expected values
51
57
    final static private Uml2SDTestTimestamp TC_003_TIME_VALUE       = new Uml2SDTestTimestamp(9790750000000L);
52
58
    final static private int                 TC_003_PAGE_VALUE       = 4;
53
59
 
54
60
    // Test case 004 expected values
55
61
    final static private int                 TC_004_PAGE_VALUE       = 0;
56
 
    
 
62
 
57
63
    // Test case 005 expected values
58
64
    final static private int                 TC_005_PAGE_VALUE       = IUml2SDTestConstants.TOTAL_NUMBER_OF_PAGES - 1;
59
 
    
 
65
 
60
66
    // Test case 006 expected values
61
67
    final static private Uml2SDTestTimestamp TC_006_TIME_VALUE       = new Uml2SDTestTimestamp(9792420661655L);
62
68
    final static private int                 TC_006_PAGE_VALUE       = 4;
63
69
    final static private int                 TC_006_START_OCCURRANCE = IUml2SDTestConstants.MAX_MESSEAGES_PER_PAGE;
64
70
    final static private int                 TC_006_END_OCCURRANCE   = TC_006_START_OCCURRANCE;
65
 
  
 
71
 
66
72
    // Test case 007 expected values
67
73
    final static private Uml2SDTestTimestamp TC_007_TIME_VALUE       = new Uml2SDTestTimestamp(9792420756010L);
68
74
    final static private int                 TC_007_PAGE_VALUE       = 5;
69
75
    final static private int                 TC_007_START_OCCURRANCE = 1;
70
76
    final static private int                 TC_007_END_OCCURRANCE   = TC_007_START_OCCURRANCE;
71
 
    
 
77
 
72
78
    // Test case 008 expected values
73
79
    final static private Uml2SDTestTimestamp TC_008_TIME_VALUE       = new Uml2SDTestTimestamp(9788642228395L);
74
80
    final static private int                 TC_008_PAGE_VALUE       = 0;
80
86
    final static private int                 TC_009_PAGE_VALUE       = 1;
81
87
    final static private Uml2SDTestTimestamp TC_009_START_TIME_VALUE = TC_009_TIME_VALUE;
82
88
    final static private Uml2SDTestTimestamp TC_009_END_TIME_VALUE   = new Uml2SDTestTimestamp(9789773881426L);
83
 
    
 
89
 
84
90
    private Uml2SDTestFacility fFacility;
85
91
 
86
92
    // ------------------------------------------------------------------------
89
95
 
90
96
    /**
91
97
     * Returns test setup used when executing test case stand-alone.
92
 
     * @return Test setup class 
 
98
     * @return Test setup class
93
99
     */
94
100
    public static Test suite() {
95
101
        return new Uml2SDTestSetup(new TestSuite(TmfUml2SDSyncLoaderTimeTest.class));
96
102
    }
97
 
    
 
103
 
98
104
    // ------------------------------------------------------------------------
99
105
    // Constructors
100
106
    // ------------------------------------------------------------------------
 
107
    /**
 
108
     * Constructor
 
109
     */
101
110
    public TmfUml2SDSyncLoaderTimeTest() {
102
111
    }
103
112
 
118
127
        fFacility = null;
119
128
        super.tearDown();
120
129
    }
121
 
    
 
130
 
 
131
    /**
 
132
     * Main method with test cases.
 
133
     */
122
134
    @SuppressWarnings("nls")
123
135
    public void testTimeHandling() {
124
136
        /*
125
137
         * Test Case: 001
126
 
         * Description: Verify synchToTime (exact time in page), selection of message in page  
 
138
         * Description: Verify synchToTime (exact time in page), selection of message in page
127
139
         * Verified Methods: loader.syncToTime(), loader.moveToMessage(), loader.moveToMessageInPage()
128
140
         * Expected result: Correct message is selected.
129
141
         */
142
154
        assertEquals("synchToTime", TC_001_END_OCCURRANCE, msg.getEndOccurrence());
143
155
        assertEquals("synchToTime", TC_001_START_LIFELINE, msg.getStartLifeline().getName());
144
156
        assertEquals("synchToTime", TC_001_END_LIFELINE, msg.getEndLifeline().getName());
145
 
        
 
157
 
146
158
        /*
147
159
         * Test Case: 002
148
 
         * Description: Verify synchToTime (exact time outside of page), selection of message in page  
 
160
         * Description: Verify synchToTime (exact time outside of page), selection of message in page
149
161
         * Verified Methods: loader.syncToTime(), loader.moveToMessage(), loader.moveToPage()
150
162
         * Expected result: Correct message is selected.
151
163
         */
165
177
        assertEquals(TC_002_START_LIFELINE, msg.getStartLifeline().getName());
166
178
        assertEquals(TC_002_END_LIFELINE, msg.getEndLifeline().getName());
167
179
 
168
 
        
 
180
 
169
181
        /*
170
182
         * Test Case: 003
171
 
         * Description: Verify synchToTime (timestamp doesn't exist in trace), no selection of message in page  
 
183
         * Description: Verify synchToTime (timestamp doesn't exist in trace), no selection of message in page
172
184
         * Verified Methods: loader.syncToTime(), loader.moveToMessage(), loader.moveToPage()
173
185
         * Expected result: Move to correct page, currentTime is updated so that focus on the currentTime, but no selection.
174
186
         */
182
194
        selection = fFacility.getSdView().getSDWidget().getSelection();
183
195
        assertNotNull("synchToTime", selection);
184
196
        assertEquals("synchToTime", 0, selection.size());
185
 
        
 
197
 
186
198
        /*
187
199
         * Test Case: 004
188
 
         * Description: Verify synchToTime (timestamp < experiment time range start)  
 
200
         * Description: Verify synchToTime (timestamp < experiment time range start)
189
201
         * Verified Methods: loader.syncToTime(), loader.moveToMessage(), loader.moveToPage()
190
202
         * Expected result: Move to first page, focus on the beginning of the page, but no selection.
191
203
         */
196
208
        selection = fFacility.getSdView().getSDWidget().getSelection();
197
209
        assertNotNull("synchToTime", selection);
198
210
        assertEquals("synchToTime", 0, selection.size());
199
 
        
 
211
 
200
212
        /*
201
213
         * Test Case: 005
202
 
         * Description: Verify synchToTime (timestamp > experiment time range end)  
 
214
         * Description: Verify synchToTime (timestamp > experiment time range end)
203
215
         * Verified Methods: loader.syncToTime(), loader.moveToMessage(), loader.moveToPage()
204
216
         * Expected result: Move to last page, focus on the end of the page, but no selection.
205
217
         */
213
225
 
214
226
        /*
215
227
         * Test Case: 006
216
 
         * Description: Verify synchToTime (timestamp of last message in page)  
 
228
         * Description: Verify synchToTime (timestamp of last message in page)
217
229
         * Verified Methods: loader.syncToTime(), loader.moveToMessage(), loader.moveToPage(), loader.moveToMessageInPage()
218
230
         * Expected result: Move to correct page, selection of last message in page.
219
231
         */
227
239
        msg = (TmfSyncMessage) selection.get(0);
228
240
        assertEquals("synchToTime", TC_006_START_OCCURRANCE, msg.getStartOccurrence());
229
241
        assertEquals("synchToTime", TC_006_END_OCCURRANCE, msg.getEndOccurrence());
230
 
        
 
242
 
231
243
        /*
232
244
        * Test Case: 007
233
 
        * Description: Verify synchToTime (timestamp of first message in page)  
 
245
        * Description: Verify synchToTime (timestamp of first message in page)
234
246
        * Verified Methods: loader.syncToTime(), loader.moveToMessage(), loader.moveToPage()
235
247
        * Expected result: Move to correct page, selection of last message in page.
236
248
        */
247
259
 
248
260
        /*
249
261
        * Test Case: 008
250
 
        * Description: Verify time range signal (start, end time and current time are in same  page)  
 
262
        * Description: Verify time range signal (start, end time and current time are in same  page)
251
263
        * Verified Methods: loader.synchToTimeRange(), loader.moveToMessage(), loader.moveToMessageInPage()
252
264
        * Expected result: Move to correct page(=page of start time of range), set focus on start time of range, but no selection of message.
253
265
        */
264
276
        // We actually don't want something to be selected!!!
265
277
        assertNotNull("synchToTimeRange", selection);
266
278
        assertEquals("synchToTimeRange", 0, selection.size());
267
 
        
 
279
 
268
280
        /*
269
281
         * Test Case: 009
270
 
         * Description: Verify time range signal (start and end time are across 2 pages)  
 
282
         * Description: Verify time range signal (start and end time are across 2 pages)
271
283
         * Verified Methods: loader.synchToTimeRange(), loader.moveToMessage(), loader.moveToPage()
272
284
         * Expected result: Move to correct page (=page of start time of range), set focus on start time of range, but no selection of message.
273
285
         */
282
294
        // We actually don't want something to be selected!!!
283
295
        assertNotNull("synchToTimeRange", selection);
284
296
        assertEquals("synchToTimeRange", 0, selection.size());
285
 
        
 
297
 
286
298
    }
287
299
}
 
 
b'\\ No newline at end of file'