Commit | Line | Data |
---|---|---|
d18dd09b | 1 | /******************************************************************************* |
20658947 FC |
2 | * Copyright (c) 2009, 2010, 20112 Ericsson |
3 | * | |
d18dd09b ASL |
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 | |
20658947 | 8 | * |
d18dd09b ASL |
9 | * Contributors: |
10 | * Francois Chouinard - Initial API and implementation | |
20658947 | 11 | * Francois Chouinard - Adapted for TMF Trace Model 1.0 |
d18dd09b ASL |
12 | *******************************************************************************/ |
13 | ||
6c13869b | 14 | package org.eclipse.linuxtools.tmf.core.tests.trace; |
d18dd09b ASL |
15 | |
16 | import java.io.File; | |
1703b536 | 17 | import java.io.FileNotFoundException; |
e1ab8984 FC |
18 | import java.io.IOException; |
19 | import java.net.URISyntaxException; | |
20 | import java.net.URL; | |
d18dd09b ASL |
21 | import java.util.Vector; |
22 | ||
e1ab8984 FC |
23 | import junit.framework.TestCase; |
24 | ||
25 | import org.eclipse.core.runtime.FileLocator; | |
26 | import org.eclipse.core.runtime.Path; | |
6c13869b FC |
27 | import org.eclipse.linuxtools.tmf.core.component.ITmfDataProvider; |
28 | import org.eclipse.linuxtools.tmf.core.component.TmfProviderManager; | |
72f1e62a | 29 | import org.eclipse.linuxtools.tmf.core.event.ITmfEvent; |
7e6347b0 | 30 | import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp; |
6c13869b FC |
31 | import org.eclipse.linuxtools.tmf.core.event.TmfEvent; |
32 | import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange; | |
33 | import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp; | |
7e6347b0 | 34 | import org.eclipse.linuxtools.tmf.core.request.TmfDataRequest; |
6c13869b FC |
35 | import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest; |
36 | import org.eclipse.linuxtools.tmf.core.tests.TmfCoreTestPlugin; | |
37 | import org.eclipse.linuxtools.tmf.core.trace.ITmfContext; | |
7e6347b0 | 38 | import org.eclipse.linuxtools.tmf.core.trace.TmfCheckpointIndexer; |
6c13869b FC |
39 | import org.eclipse.linuxtools.tmf.core.trace.TmfContext; |
40 | import org.eclipse.linuxtools.tmf.core.trace.TmfTrace; | |
4918b8f2 | 41 | import org.eclipse.linuxtools.tmf.tests.stubs.trace.TmfTraceStub; |
d18dd09b ASL |
42 | |
43 | /** | |
44 | * <b><u>TmfTraceTest</u></b> | |
45 | * <p> | |
ff4ed569 | 46 | * Test suite for the TmfTrace class. |
d18dd09b | 47 | */ |
3b38ea61 | 48 | @SuppressWarnings("nls") |
d18dd09b ASL |
49 | public class TmfTraceTest extends TestCase { |
50 | ||
f17b2f70 FC |
51 | // ------------------------------------------------------------------------ |
52 | // Variables | |
53 | // ------------------------------------------------------------------------ | |
ff4ed569 | 54 | |
d18dd09b | 55 | private static final String DIRECTORY = "testfiles"; |
85fb0e54 | 56 | private static final String TEST_STREAM = "A-Test-10K"; |
ff4ed569 | 57 | private static final int BLOCK_SIZE = 500; |
e31e01e8 FC |
58 | private static final int NB_EVENTS = 10000; |
59 | private static TmfTraceStub fTrace = null; | |
d18dd09b | 60 | |
20658947 | 61 | private static int SCALE = -3; |
d18dd09b | 62 | |
e31e01e8 | 63 | // ------------------------------------------------------------------------ |
d18dd09b | 64 | // Housekeeping |
e31e01e8 | 65 | // ------------------------------------------------------------------------ |
d18dd09b | 66 | |
f17b2f70 FC |
67 | public TmfTraceTest(final String name) throws Exception { |
68 | super(name); | |
69 | } | |
70 | ||
71 | @Override | |
72 | protected void setUp() throws Exception { | |
73 | super.setUp(); | |
74 | fTrace = setupTrace(DIRECTORY + File.separator + TEST_STREAM); | |
f17b2f70 FC |
75 | } |
76 | ||
77 | @Override | |
78 | protected void tearDown() throws Exception { | |
79 | super.tearDown(); | |
80 | fTrace.dispose(); | |
81 | fTrace = null; | |
82 | } | |
ff4ed569 FC |
83 | |
84 | // ------------------------------------------------------------------------ | |
85 | // Helper functions | |
86 | // ------------------------------------------------------------------------ | |
87 | ||
f17b2f70 | 88 | private TmfTraceStub setupTrace(final String path) { |
20658947 | 89 | if (fTrace == null) { |
f17b2f70 FC |
90 | try { |
91 | final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(path), null); | |
92 | final File test = new File(FileLocator.toFileURL(location).toURI()); | |
20658947 FC |
93 | fTrace = new TmfTraceStub(test.toURI().getPath(), BLOCK_SIZE); |
94 | fTrace.indexTrace(); | |
f17b2f70 FC |
95 | } catch (final URISyntaxException e) { |
96 | e.printStackTrace(); | |
97 | } catch (final IOException e) { | |
98 | e.printStackTrace(); | |
99 | } | |
20658947 | 100 | } |
f17b2f70 | 101 | return fTrace; |
e1ab8984 FC |
102 | } |
103 | ||
e31e01e8 | 104 | // ------------------------------------------------------------------------ |
d18dd09b | 105 | // Constructors |
e31e01e8 | 106 | // ------------------------------------------------------------------------ |
d18dd09b | 107 | |
20658947 | 108 | public void testStandardConstructor() throws Exception { |
f17b2f70 FC |
109 | TmfTraceStub trace = null; |
110 | File testfile = null; | |
111 | try { | |
112 | final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(DIRECTORY + File.separator + TEST_STREAM), null); | |
113 | testfile = new File(FileLocator.toFileURL(location).toURI()); | |
114 | trace = new TmfTraceStub(testfile.toURI().getPath()); | |
20658947 | 115 | trace.indexTrace(); |
f17b2f70 FC |
116 | } catch (final URISyntaxException e) { |
117 | fail("URISyntaxException"); | |
118 | } catch (final IOException e) { | |
119 | fail("IOException"); | |
120 | } | |
20658947 FC |
121 | |
122 | assertFalse ("Open trace", trace == null); | |
123 | assertEquals("getType", TmfEvent.class, trace.getType()); | |
124 | assertNull ("getResource", trace.getResource()); | |
125 | assertEquals("getPath", testfile.toURI().getPath(), trace.getPath()); | |
126 | assertEquals("getCacheSize", TmfTrace.DEFAULT_TRACE_CACHE_SIZE, trace.getCacheSize()); | |
127 | assertEquals("getStreamingInterval", 0, trace.getStreamingInterval()); | |
128 | assertEquals("getName", TEST_STREAM, trace.getName()); | |
129 | ||
130 | assertEquals("getNbEvents", NB_EVENTS, trace.getNbEvents()); | |
131 | assertEquals("getRange-start", 1, trace.getTimeRange().getStartTime().getValue()); | |
132 | assertEquals("getRange-end", NB_EVENTS, trace.getTimeRange().getEndTime().getValue()); | |
133 | assertEquals("getStartTime", 1, trace.getStartTime().getValue()); | |
134 | assertEquals("getEndTime", NB_EVENTS, trace.getEndTime().getValue()); | |
ff4ed569 FC |
135 | } |
136 | ||
20658947 | 137 | public void testStandardConstructorCacheSize() throws Exception { |
f17b2f70 FC |
138 | TmfTraceStub trace = null; |
139 | File testfile = null; | |
140 | try { | |
141 | final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(DIRECTORY + File.separator + TEST_STREAM), null); | |
142 | testfile = new File(FileLocator.toFileURL(location).toURI()); | |
143 | trace = new TmfTraceStub(testfile.toURI().getPath(), 0); | |
20658947 FC |
144 | trace.indexTrace(); |
145 | } catch (final URISyntaxException e) { | |
146 | fail("URISyntaxException"); | |
147 | } catch (final IOException e) { | |
148 | fail("IOException"); | |
149 | } | |
150 | ||
151 | assertFalse ("Open trace", trace == null); | |
152 | assertEquals("getType", TmfEvent.class, trace.getType()); | |
153 | assertNull ("getResource", trace.getResource()); | |
154 | assertEquals("getPath", testfile.toURI().getPath(), trace.getPath()); | |
155 | assertEquals("getCacheSize", TmfTrace.DEFAULT_TRACE_CACHE_SIZE, trace.getCacheSize()); | |
156 | assertEquals("getStreamingInterval", 0, trace.getStreamingInterval()); | |
157 | assertEquals("getName", TEST_STREAM, trace.getName()); | |
158 | ||
159 | assertEquals("getNbEvents", NB_EVENTS, trace.getNbEvents()); | |
160 | assertEquals("getRange-start", 1, trace.getTimeRange().getStartTime().getValue()); | |
161 | assertEquals("getRange-end", NB_EVENTS, trace.getTimeRange().getEndTime().getValue()); | |
162 | assertEquals("getStartTime", 1, trace.getStartTime().getValue()); | |
163 | assertEquals("getEndTime", NB_EVENTS, trace.getEndTime().getValue()); | |
164 | ||
165 | try { | |
166 | final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(DIRECTORY + File.separator + TEST_STREAM), null); | |
167 | testfile = new File(FileLocator.toFileURL(location).toURI()); | |
168 | trace = new TmfTraceStub(testfile.toURI().getPath(), BLOCK_SIZE); | |
169 | trace.indexTrace(); | |
170 | } catch (final URISyntaxException e) { | |
171 | fail("URISyntaxException"); | |
172 | } catch (final IOException e) { | |
173 | fail("IOException"); | |
174 | } | |
175 | ||
176 | assertFalse ("Open trace", trace == null); | |
177 | assertEquals("getType", TmfEvent.class, trace.getType()); | |
178 | assertNull ("getResource", trace.getResource()); | |
179 | assertEquals("getPath", testfile.toURI().getPath(), trace.getPath()); | |
180 | assertEquals("getCacheSize", BLOCK_SIZE, trace.getCacheSize()); | |
181 | assertEquals("getStreamingInterval", 0, trace.getStreamingInterval()); | |
182 | assertEquals("getName", TEST_STREAM, trace.getName()); | |
183 | ||
184 | assertEquals("getNbEvents", NB_EVENTS, trace.getNbEvents()); | |
185 | assertEquals("getRange-start", 1, trace.getTimeRange().getStartTime().getValue()); | |
186 | assertEquals("getRange-end", NB_EVENTS, trace.getTimeRange().getEndTime().getValue()); | |
187 | assertEquals("getStartTime", 1, trace.getStartTime().getValue()); | |
188 | assertEquals("getEndTime", NB_EVENTS, trace.getEndTime().getValue()); | |
189 | } | |
190 | ||
191 | public void testFullConstructor() throws Exception { | |
192 | TmfTraceStub trace = null; | |
193 | File testfile = null; | |
194 | try { | |
195 | final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(DIRECTORY + File.separator + TEST_STREAM), null); | |
196 | testfile = new File(FileLocator.toFileURL(location).toURI()); | |
197 | trace = new TmfTraceStub(testfile.toURI().getPath(), BLOCK_SIZE, null); | |
198 | trace.indexTrace(); | |
199 | } catch (final URISyntaxException e) { | |
200 | fail("URISyntaxException"); | |
201 | } catch (final IOException e) { | |
202 | fail("IOException"); | |
203 | } | |
204 | ||
205 | assertFalse ("Open trace", trace == null); | |
206 | assertEquals("getType", TmfEvent.class, trace.getType()); | |
207 | assertNull ("getResource", trace.getResource()); | |
208 | assertEquals("getPath", testfile.toURI().getPath(), trace.getPath()); | |
209 | assertEquals("getCacheSize", BLOCK_SIZE, trace.getCacheSize()); | |
210 | assertEquals("getStreamingInterval", 0, trace.getStreamingInterval()); | |
211 | assertEquals("getName", TEST_STREAM, trace.getName()); | |
212 | ||
213 | assertEquals("getNbEvents", NB_EVENTS, trace.getNbEvents()); | |
214 | assertEquals("getRange-start", 1, trace.getTimeRange().getStartTime().getValue()); | |
215 | assertEquals("getRange-end", NB_EVENTS, trace.getTimeRange().getEndTime().getValue()); | |
216 | assertEquals("getStartTime", 1, trace.getStartTime().getValue()); | |
217 | assertEquals("getEndTime", NB_EVENTS, trace.getEndTime().getValue()); | |
218 | } | |
219 | ||
1703b536 FC |
220 | public void testLiveTraceConstructor() throws Exception { |
221 | TmfTraceStub trace = null; | |
222 | File testfile = null; | |
223 | final long interval = 100; | |
224 | try { | |
225 | final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(DIRECTORY + File.separator + TEST_STREAM), null); | |
226 | testfile = new File(FileLocator.toFileURL(location).toURI()); | |
227 | trace = new TmfTraceStub(testfile.toURI().getPath(), BLOCK_SIZE, interval); | |
228 | trace.indexTrace(); | |
229 | } catch (final URISyntaxException e) { | |
230 | fail("URISyntaxException"); | |
231 | } catch (final IOException e) { | |
232 | fail("IOException"); | |
233 | } | |
234 | ||
235 | assertFalse ("Open trace", trace == null); | |
236 | assertEquals("getType", TmfEvent.class, trace.getType()); | |
237 | assertNull ("getResource", trace.getResource()); | |
238 | assertEquals("getPath", testfile.toURI().getPath(), trace.getPath()); | |
239 | assertEquals("getCacheSize", BLOCK_SIZE, trace.getCacheSize()); | |
240 | assertEquals("getStreamingInterval", interval, trace.getStreamingInterval()); | |
241 | assertEquals("getName", TEST_STREAM, trace.getName()); | |
242 | ||
243 | assertEquals("getNbEvents", NB_EVENTS, trace.getNbEvents()); | |
244 | assertEquals("getRange-start", 1, trace.getTimeRange().getStartTime().getValue()); | |
245 | assertEquals("getRange-end", NB_EVENTS, trace.getTimeRange().getEndTime().getValue()); | |
246 | assertEquals("getStartTime", 1, trace.getStartTime().getValue()); | |
247 | assertEquals("getEndTime", NB_EVENTS, trace.getEndTime().getValue()); | |
248 | } | |
249 | ||
20658947 FC |
250 | @SuppressWarnings({ "rawtypes", "unchecked" }) |
251 | public void testCopyConstructor() throws Exception { | |
252 | TmfTraceStub original = null; | |
253 | TmfTraceStub trace = null; | |
254 | File testfile = null; | |
255 | try { | |
256 | final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(DIRECTORY + File.separator + TEST_STREAM), null); | |
257 | testfile = new File(FileLocator.toFileURL(location).toURI()); | |
7e6347b0 | 258 | original = new TmfTraceStub(testfile.toURI().getPath(), BLOCK_SIZE, new TmfCheckpointIndexer(null)); |
20658947 FC |
259 | trace = new TmfTraceStub(original); |
260 | trace.indexTrace(); | |
f17b2f70 FC |
261 | } catch (final URISyntaxException e) { |
262 | fail("URISyntaxException"); | |
263 | } catch (final IOException e) { | |
264 | fail("IOException"); | |
265 | } | |
20658947 FC |
266 | |
267 | assertFalse ("Open trace", trace == null); | |
268 | assertEquals("getType", TmfEvent.class, trace.getType()); | |
269 | assertNull ("getResource", trace.getResource()); | |
270 | assertEquals("getPath", testfile.toURI().getPath(), trace.getPath()); | |
271 | assertEquals("getCacheSize", BLOCK_SIZE, trace.getCacheSize()); | |
272 | assertEquals("getStreamingInterval", 0, trace.getStreamingInterval()); | |
273 | assertEquals("getName", TEST_STREAM, trace.getName()); | |
274 | ||
275 | assertEquals("getNbEvents", NB_EVENTS, trace.getNbEvents()); | |
276 | assertEquals("getRange-start", 1, trace.getTimeRange().getStartTime().getValue()); | |
277 | assertEquals("getRange-end", NB_EVENTS, trace.getTimeRange().getEndTime().getValue()); | |
278 | assertEquals("getStartTime", 1, trace.getStartTime().getValue()); | |
279 | assertEquals("getEndTime", NB_EVENTS, trace.getEndTime().getValue()); | |
280 | ||
281 | // Test the copy of a null trace | |
282 | try { | |
283 | new TmfTraceStub((TmfTraceStub) null); | |
284 | fail("Missing exception"); | |
285 | } catch (final IllegalArgumentException e) { | |
286 | // test passed | |
287 | } catch (final Exception e) { | |
288 | fail("Unexpected exception"); | |
289 | } | |
d18dd09b ASL |
290 | } |
291 | ||
20658947 | 292 | // ------------------------------------------------------------------------ |
1703b536 | 293 | // Trace initialization |
20658947 FC |
294 | // ------------------------------------------------------------------------ |
295 | ||
1703b536 | 296 | public void testInitializeNullPath() throws Exception { |
20658947 | 297 | |
1703b536 FC |
298 | // Instantiate an "empty" trace |
299 | final TmfTraceStub trace = new TmfTraceStub(); | |
20658947 | 300 | |
1703b536 FC |
301 | try { |
302 | trace.initialize(null, null, TmfEvent.class); | |
303 | fail("TmfTrace.initialize() - no exception thrown"); | |
304 | } catch (FileNotFoundException e) { | |
305 | // Success | |
306 | } catch (Exception e) { | |
307 | fail("TmfTrace.initialize() - wrong exception thrown"); | |
308 | } | |
ff4ed569 | 309 | } |
1703b536 FC |
310 | |
311 | public void testInitializeSimplePath() throws Exception { | |
ff4ed569 | 312 | |
1703b536 FC |
313 | // Instantiate an "empty" trace |
314 | final TmfTraceStub trace = new TmfTraceStub(); | |
315 | ||
316 | // Path == trace name | |
317 | String path = "TraceName"; | |
318 | try { | |
319 | trace.initialize(null, path, TmfEvent.class); | |
320 | } catch (Exception e) { | |
321 | fail("TmfTrace.initialize() - Exception thrown"); | |
322 | } | |
323 | ||
324 | assertFalse ("Open trace", trace == null); | |
325 | assertEquals("getType", TmfEvent.class, trace.getType()); | |
326 | assertNull ("getResource", trace.getResource()); | |
327 | assertEquals("getPath", path, trace.getPath()); | |
328 | assertEquals("getCacheSize", TmfTrace.DEFAULT_TRACE_CACHE_SIZE, trace.getCacheSize()); | |
329 | assertEquals("getStreamingInterval", 0, trace.getStreamingInterval()); | |
330 | assertEquals("getName", path, trace.getName()); | |
331 | ||
332 | assertEquals("getNbEvents", 0, trace.getNbEvents()); | |
333 | assertEquals("getRange-start", Long.MAX_VALUE, trace.getTimeRange().getStartTime().getValue()); | |
334 | assertEquals("getRange-end", Long.MIN_VALUE, trace.getTimeRange().getEndTime().getValue()); | |
335 | assertEquals("getStartTime", Long.MAX_VALUE, trace.getStartTime().getValue()); | |
336 | assertEquals("getEndTime", Long.MIN_VALUE, trace.getEndTime().getValue()); | |
337 | } | |
338 | ||
339 | public void testInitializeNormalPath() throws Exception { | |
340 | ||
341 | // Instantiate an "empty" trace | |
342 | final TmfTraceStub trace = new TmfTraceStub(); | |
343 | ||
344 | // Path == trace name | |
345 | String name = "TraceName"; | |
346 | String path = "/my/trace/path/" + name; | |
347 | try { | |
348 | trace.initialize(null, path, TmfEvent.class); | |
349 | } catch (Exception e) { | |
350 | fail("TmfTrace.initialize() - Exception thrown"); | |
351 | } | |
352 | ||
353 | assertFalse ("Open trace", trace == null); | |
354 | assertEquals("getType", TmfEvent.class, trace.getType()); | |
355 | assertNull ("getResource", trace.getResource()); | |
356 | assertEquals("getPath", path, trace.getPath()); | |
357 | assertEquals("getCacheSize", TmfTrace.DEFAULT_TRACE_CACHE_SIZE, trace.getCacheSize()); | |
358 | assertEquals("getStreamingInterval", 0, trace.getStreamingInterval()); | |
359 | assertEquals("getName", name, trace.getName()); | |
360 | ||
361 | assertEquals("getNbEvents", 0, trace.getNbEvents()); | |
362 | assertEquals("getRange-start", Long.MAX_VALUE, trace.getTimeRange().getStartTime().getValue()); | |
363 | assertEquals("getRange-end", Long.MIN_VALUE, trace.getTimeRange().getEndTime().getValue()); | |
364 | assertEquals("getStartTime", Long.MAX_VALUE, trace.getStartTime().getValue()); | |
365 | assertEquals("getEndTime", Long.MIN_VALUE, trace.getEndTime().getValue()); | |
366 | } | |
20658947 FC |
367 | |
368 | public void testInitTrace() throws Exception { | |
369 | ||
370 | // Instantiate an "empty" trace | |
371 | final TmfTraceStub trace = new TmfTraceStub(); | |
372 | ||
373 | assertFalse ("Open trace", trace == null); | |
374 | assertNull ("getType", trace.getType()); | |
375 | assertNull ("getResource", trace.getResource()); | |
376 | assertEquals("getCacheSize", TmfTrace.DEFAULT_TRACE_CACHE_SIZE, trace.getCacheSize()); | |
377 | assertEquals("getStreamingInterval", 0, trace.getStreamingInterval()); | |
378 | assertEquals("getName", "", trace.getName()); | |
379 | ||
380 | assertEquals("getNbEvents", 0, trace.getNbEvents()); | |
381 | assertEquals("getRange-start", Long.MAX_VALUE, trace.getTimeRange().getStartTime().getValue()); | |
382 | assertEquals("getRange-end", Long.MIN_VALUE, trace.getTimeRange().getEndTime().getValue()); | |
383 | assertEquals("getStartTime", Long.MAX_VALUE, trace.getStartTime().getValue()); | |
384 | assertEquals("getEndTime", Long.MIN_VALUE, trace.getEndTime().getValue()); | |
385 | ||
386 | // Validate | |
387 | final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(DIRECTORY + File.separator + TEST_STREAM), null); | |
388 | final File testfile = new File(FileLocator.toFileURL(location).toURI()); | |
389 | assertTrue("validate", trace.validate(null, testfile.getPath())); | |
390 | ||
391 | // InitTrace and wait for indexing completion... | |
392 | trace.initTrace(null, testfile.getPath(), TmfEvent.class); | |
393 | int nbSecs = 0; | |
394 | while (trace.getNbEvents() < NB_EVENTS && nbSecs < 10) { | |
395 | Thread.sleep(1000); | |
396 | nbSecs++; | |
397 | } | |
398 | if (trace.getNbEvents() < NB_EVENTS) { | |
399 | fail("indexing"); | |
400 | } | |
401 | ||
402 | assertFalse ("Open trace", trace == null); | |
403 | assertEquals("getType", TmfEvent.class, trace.getType()); | |
404 | assertNull ("getResource", trace.getResource()); | |
405 | assertEquals("getCacheSize", TmfTrace.DEFAULT_TRACE_CACHE_SIZE, trace.getCacheSize()); | |
406 | assertEquals("getStreamingInterval", 0, trace.getStreamingInterval()); | |
407 | assertEquals("getName", TEST_STREAM, trace.getName()); | |
408 | ||
409 | assertEquals("getNbEvents", NB_EVENTS, trace.getNbEvents()); | |
410 | assertEquals("getRange-start", 1, trace.getTimeRange().getStartTime().getValue()); | |
411 | assertEquals("getRange-end", NB_EVENTS, trace.getTimeRange().getEndTime().getValue()); | |
412 | assertEquals("getStartTime", 1, trace.getStartTime().getValue()); | |
413 | assertEquals("getEndTime", NB_EVENTS, trace.getEndTime().getValue()); | |
414 | } | |
d18dd09b | 415 | |
ff4ed569 | 416 | // ------------------------------------------------------------------------ |
1703b536 FC |
417 | // Set/Get streaming interval |
418 | // ------------------------------------------------------------------------ | |
419 | ||
420 | public void testSetStreamingInterval() throws Exception { | |
421 | final TmfTraceStub trace = new TmfTraceStub(fTrace); | |
422 | ||
423 | long interval = 0; | |
424 | assertEquals("getStreamingInterval", interval, trace.getStreamingInterval()); | |
425 | ||
426 | interval = 100; | |
427 | trace.setStreamingInterval(interval); | |
428 | assertEquals("getStreamingInterval", interval, trace.getStreamingInterval()); | |
429 | ||
430 | interval = -1; | |
431 | trace.setStreamingInterval(interval); | |
432 | assertEquals("getStreamingInterval", 0, trace.getStreamingInterval()); | |
433 | ||
434 | interval = 0; | |
435 | trace.setStreamingInterval(interval); | |
436 | assertEquals("getStreamingInterval", interval, trace.getStreamingInterval()); | |
437 | ||
438 | trace.dispose(); | |
439 | } | |
440 | ||
441 | // ------------------------------------------------------------------------ | |
442 | // Set/Get time range | |
ff4ed569 FC |
443 | // ------------------------------------------------------------------------ |
444 | ||
445 | public void testSetTimeRange() throws Exception { | |
f17b2f70 | 446 | final TmfTraceStub trace = new TmfTraceStub(fTrace); |
20658947 | 447 | trace.indexTrace(); |
f17b2f70 | 448 | |
ff4ed569 FC |
449 | assertEquals("getRange-start", 1, trace.getTimeRange().getStartTime().getValue()); |
450 | assertEquals("getRange-end", NB_EVENTS, trace.getTimeRange().getEndTime().getValue()); | |
451 | assertEquals("getStartTime", 1, trace.getStartTime().getValue()); | |
452 | assertEquals("getEndTime", NB_EVENTS, trace.getEndTime().getValue()); | |
453 | ||
454 | trace.setTimeRange(new TmfTimeRange(new TmfTimestamp(100), new TmfTimestamp(200))); | |
455 | assertEquals("setTimeRange", 100, trace.getTimeRange().getStartTime().getValue()); | |
456 | assertEquals("setTimeRange", 200, trace.getTimeRange().getEndTime().getValue()); | |
457 | assertEquals("setTimeRange", 100, trace.getStartTime().getValue()); | |
458 | assertEquals("setTimeRange", 200, trace.getEndTime().getValue()); | |
f17b2f70 FC |
459 | |
460 | trace.dispose(); | |
ff4ed569 | 461 | } |
f17b2f70 | 462 | |
ff4ed569 | 463 | public void testSetStartTime() throws Exception { |
f17b2f70 | 464 | final TmfTraceStub trace = new TmfTraceStub(fTrace); |
20658947 | 465 | trace.indexTrace(); |
f17b2f70 | 466 | |
ff4ed569 FC |
467 | assertEquals("getRange-start", 1, trace.getTimeRange().getStartTime().getValue()); |
468 | assertEquals("getRange-end", NB_EVENTS, trace.getTimeRange().getEndTime().getValue()); | |
469 | assertEquals("getStartTime", 1, trace.getStartTime().getValue()); | |
470 | assertEquals("getEndTime", NB_EVENTS, trace.getEndTime().getValue()); | |
471 | ||
472 | trace.setStartTime(new TmfTimestamp(100)); | |
473 | assertEquals("setStartTime", 100, trace.getTimeRange().getStartTime().getValue()); | |
474 | assertEquals("setStartTime", NB_EVENTS, trace.getTimeRange().getEndTime().getValue()); | |
475 | assertEquals("setStartTime", 100, trace.getStartTime().getValue()); | |
476 | assertEquals("setStartTime", NB_EVENTS, trace.getEndTime().getValue()); | |
f17b2f70 FC |
477 | |
478 | trace.dispose(); | |
ff4ed569 | 479 | } |
f17b2f70 | 480 | |
ff4ed569 | 481 | public void testSetEndTime() throws Exception { |
f17b2f70 | 482 | final TmfTraceStub trace = new TmfTraceStub(fTrace); |
20658947 | 483 | trace.indexTrace(); |
f17b2f70 | 484 | |
ff4ed569 FC |
485 | assertEquals("getRange-start", 1, trace.getTimeRange().getStartTime().getValue()); |
486 | assertEquals("getRange-end", NB_EVENTS, trace.getTimeRange().getEndTime().getValue()); | |
487 | assertEquals("getStartTime", 1, trace.getStartTime().getValue()); | |
488 | assertEquals("getEndTime", NB_EVENTS, trace.getEndTime().getValue()); | |
489 | ||
490 | trace.setEndTime(new TmfTimestamp(100)); | |
491 | assertEquals("setEndTime", 1, trace.getTimeRange().getStartTime().getValue()); | |
492 | assertEquals("setEndTime", 100, trace.getTimeRange().getEndTime().getValue()); | |
493 | assertEquals("setEndTime", 1, trace.getStartTime().getValue()); | |
494 | assertEquals("setEndTime", 100, trace.getEndTime().getValue()); | |
f17b2f70 FC |
495 | |
496 | trace.dispose(); | |
ff4ed569 | 497 | } |
f17b2f70 | 498 | |
e31e01e8 | 499 | // ------------------------------------------------------------------------ |
7e6347b0 FC |
500 | // seekEvent on location (note: does not reliably set the rank) |
501 | // ------------------------------------------------------------------------ | |
502 | ||
503 | public void testSeekEventOnCacheBoundary() throws Exception { | |
504 | ||
505 | // Position trace at event rank 0 | |
506 | ITmfContext context = fTrace.seekEvent(0); | |
507 | ITmfEvent event = fTrace.parseEvent(context); | |
508 | assertEquals("Event timestamp", 1, event.getTimestamp().getValue()); | |
509 | assertEquals("Event rank", 0, context.getRank()); | |
510 | ||
511 | context = fTrace.seekEvent(context.getLocation()); | |
512 | assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank()); | |
513 | ||
514 | event = fTrace.parseEvent(context); | |
515 | assertEquals("Event timestamp", 1, event.getTimestamp().getValue()); | |
516 | assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank()); | |
517 | ||
518 | event = fTrace.readEvent(context); | |
519 | assertEquals("Event timestamp", 1, event.getTimestamp().getValue()); | |
520 | assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank()); | |
521 | ||
522 | // Position trace at event rank 1000 | |
523 | ITmfContext tmpContext = fTrace.seekEvent(new TmfTimestamp(1001, SCALE, 0)); | |
524 | context = fTrace.seekEvent(tmpContext.getLocation()); | |
525 | assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank()); | |
526 | ||
527 | event = fTrace.parseEvent(context); | |
528 | assertEquals("Event timestamp", 1001, event.getTimestamp().getValue()); | |
529 | assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank()); | |
530 | ||
531 | event = fTrace.readEvent(context); | |
532 | assertEquals("Event timestamp", 1001, event.getTimestamp().getValue()); | |
533 | assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank()); | |
534 | ||
535 | // Position trace at event rank 4000 | |
536 | tmpContext = fTrace.seekEvent(new TmfTimestamp(4001, SCALE, 0)); | |
537 | context = fTrace.seekEvent(tmpContext.getLocation()); | |
538 | assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank()); | |
539 | ||
540 | event = fTrace.parseEvent(context); | |
541 | assertEquals("Event timestamp", 4001, event.getTimestamp().getValue()); | |
542 | assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank()); | |
543 | ||
544 | event = fTrace.readEvent(context); | |
545 | assertEquals("Event timestamp", 4001, event.getTimestamp().getValue()); | |
546 | assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank()); | |
547 | } | |
548 | ||
549 | public void testSeekEventNotOnCacheBoundary() throws Exception { | |
550 | ||
551 | // Position trace at event rank 9 | |
552 | ITmfContext tmpContext = fTrace.seekEvent(new TmfTimestamp(10, SCALE, 0)); | |
553 | TmfContext context = fTrace.seekEvent(tmpContext.getLocation()); | |
554 | assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank()); | |
555 | ||
556 | ITmfEvent event = fTrace.parseEvent(context); | |
557 | assertEquals("Event timestamp", 10, event.getTimestamp().getValue()); | |
558 | assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank()); | |
559 | ||
560 | event = fTrace.readEvent(context); | |
561 | assertEquals("Event timestamp", 10, event.getTimestamp().getValue()); | |
562 | assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank()); | |
563 | ||
564 | // Position trace at event rank 999 | |
565 | tmpContext = fTrace.seekEvent(new TmfTimestamp(1000, SCALE, 0)); | |
566 | context = fTrace.seekEvent(tmpContext.getLocation()); | |
567 | assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank()); | |
568 | ||
569 | event = fTrace.parseEvent(context); | |
570 | assertEquals("Event timestamp", 1000, event.getTimestamp().getValue()); | |
571 | assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank()); | |
572 | ||
573 | event = fTrace.readEvent(context); | |
574 | assertEquals("Event timestamp", 1000, event.getTimestamp().getValue()); | |
575 | assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank()); | |
576 | ||
577 | // Position trace at event rank 1001 | |
578 | tmpContext = fTrace.seekEvent(new TmfTimestamp(1002, SCALE, 0)); | |
579 | context = fTrace.seekEvent(tmpContext.getLocation()); | |
580 | assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank()); | |
581 | ||
582 | event = fTrace.parseEvent(context); | |
583 | assertEquals("Event timestamp", 1002, event.getTimestamp().getValue()); | |
584 | assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank()); | |
585 | ||
586 | event = fTrace.readEvent(context); | |
587 | assertEquals("Event timestamp", 1002, event.getTimestamp().getValue()); | |
588 | assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank()); | |
589 | ||
590 | // Position trace at event rank 4500 | |
591 | tmpContext = fTrace.seekEvent(new TmfTimestamp(4501, SCALE, 0)); | |
592 | context = fTrace.seekEvent(tmpContext.getLocation()); | |
593 | assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank()); | |
594 | ||
595 | event = fTrace.parseEvent(context); | |
596 | assertEquals("Event timestamp", 4501, event.getTimestamp().getValue()); | |
597 | assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank()); | |
598 | ||
599 | event = fTrace.readEvent(context); | |
600 | assertEquals("Event timestamp", 4501, event.getTimestamp().getValue()); | |
601 | assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank()); | |
602 | } | |
603 | ||
604 | public void testSeekEventOutOfScope() throws Exception { | |
605 | ||
606 | // Position trace at beginning | |
607 | ITmfContext tmpContext = fTrace.seekEvent(0); | |
608 | ITmfContext context = fTrace.seekEvent(tmpContext.getLocation()); | |
609 | assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank()); | |
610 | ||
611 | ITmfEvent event = fTrace.parseEvent(context); | |
612 | assertEquals("Event timestamp", 1, event.getTimestamp().getValue()); | |
613 | assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank()); | |
614 | ||
615 | event = fTrace.readEvent(context); | |
616 | assertEquals("Event timestamp", 1, event.getTimestamp().getValue()); | |
617 | assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank()); | |
618 | ||
619 | // Position trace at event passed the end | |
620 | tmpContext = fTrace.seekEvent(new TmfTimestamp(NB_EVENTS + 1, SCALE, 0)); | |
621 | context = fTrace.seekEvent(tmpContext.getLocation()); | |
622 | assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank()); | |
623 | ||
624 | event = fTrace.parseEvent(context); | |
625 | assertEquals("Event timestamp", null, event); | |
626 | assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank()); | |
627 | ||
628 | event = fTrace.readEvent(context); | |
629 | assertEquals("Event timestamp", null, event); | |
630 | assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank()); | |
631 | } | |
632 | ||
633 | // ------------------------------------------------------------------------ | |
634 | // seekEvent on timestamp (note: does not reliably set the rank) | |
54d55ced FC |
635 | // ------------------------------------------------------------------------ |
636 | ||
20658947 | 637 | public void testSeekEventOnNullTimestamp() throws Exception { |
54d55ced | 638 | |
f17b2f70 | 639 | // Position trace at event rank 0 |
7e6347b0 | 640 | ITmfContext context = fTrace.seekEvent((ITmfTimestamp) null); |
ff4ed569 | 641 | assertEquals("Event rank", 0, context.getRank()); |
9b635e61 | 642 | |
72f1e62a | 643 | ITmfEvent event = fTrace.parseEvent(context); |
54d55ced | 644 | assertEquals("Event timestamp", 1, event.getTimestamp().getValue()); |
20658947 | 645 | assertEquals("Event rank", 0, context.getRank()); |
54d55ced FC |
646 | } |
647 | ||
54d55ced FC |
648 | public void testSeekEventOnTimestampOnCacheBoundary() throws Exception { |
649 | ||
f17b2f70 FC |
650 | // Position trace at event rank 0 |
651 | ITmfContext context = fTrace.seekEvent(new TmfTimestamp(1, SCALE, 0)); | |
54d55ced | 652 | assertEquals("Event rank", 0, context.getRank()); |
9b635e61 | 653 | |
72f1e62a | 654 | ITmfEvent event = fTrace.parseEvent(context); |
54d55ced FC |
655 | assertEquals("Event timestamp", 1, event.getTimestamp().getValue()); |
656 | assertEquals("Event rank", 0, context.getRank()); | |
f17b2f70 | 657 | |
7e6347b0 | 658 | event = fTrace.readEvent(context); |
75828b1a | 659 | assertEquals("Event timestamp", 1, event.getTimestamp().getValue()); |
e31e01e8 | 660 | assertEquals("Event rank", 1, context.getRank()); |
d18dd09b | 661 | |
f17b2f70 | 662 | // Position trace at event rank 1000 |
54d55ced FC |
663 | context = fTrace.seekEvent(new TmfTimestamp(1001, SCALE, 0)); |
664 | assertEquals("Event rank", 1000, context.getRank()); | |
f17b2f70 | 665 | |
9b635e61 | 666 | event = fTrace.parseEvent(context); |
54d55ced FC |
667 | assertEquals("Event timestamp", 1001, event.getTimestamp().getValue()); |
668 | assertEquals("Event rank", 1000, context.getRank()); | |
f17b2f70 | 669 | |
7e6347b0 | 670 | event = fTrace.readEvent(context); |
e31e01e8 FC |
671 | assertEquals("Event timestamp", 1001, event.getTimestamp().getValue()); |
672 | assertEquals("Event rank", 1001, context.getRank()); | |
d18dd09b | 673 | |
f17b2f70 | 674 | // Position trace at event rank 4000 |
54d55ced FC |
675 | context = fTrace.seekEvent(new TmfTimestamp(4001, SCALE, 0)); |
676 | assertEquals("Event rank", 4000, context.getRank()); | |
f17b2f70 | 677 | |
9b635e61 | 678 | event = fTrace.parseEvent(context); |
54d55ced FC |
679 | assertEquals("Event timestamp", 4001, event.getTimestamp().getValue()); |
680 | assertEquals("Event rank", 4000, context.getRank()); | |
f17b2f70 | 681 | |
7e6347b0 | 682 | event = fTrace.readEvent(context); |
e31e01e8 FC |
683 | assertEquals("Event timestamp", 4001, event.getTimestamp().getValue()); |
684 | assertEquals("Event rank", 4001, context.getRank()); | |
75828b1a | 685 | } |
d18dd09b | 686 | |
54d55ced FC |
687 | public void testSeekEventOnTimestampNotOnCacheBoundary() throws Exception { |
688 | ||
f17b2f70 FC |
689 | // Position trace at event rank 1 |
690 | ITmfContext context = fTrace.seekEvent(new TmfTimestamp(2, SCALE, 0)); | |
54d55ced | 691 | assertEquals("Event rank", 1, context.getRank()); |
f17b2f70 | 692 | |
72f1e62a | 693 | ITmfEvent event = fTrace.parseEvent(context); |
54d55ced FC |
694 | assertEquals("Event timestamp", 2, event.getTimestamp().getValue()); |
695 | assertEquals("Event rank", 1, context.getRank()); | |
f17b2f70 | 696 | |
7e6347b0 | 697 | event = fTrace.readEvent(context); |
54d55ced FC |
698 | assertEquals("Event timestamp", 2, event.getTimestamp().getValue()); |
699 | assertEquals("Event rank", 2, context.getRank()); | |
d18dd09b | 700 | |
f17b2f70 FC |
701 | // Position trace at event rank 9 |
702 | context = fTrace.seekEvent(new TmfTimestamp(10, SCALE, 0)); | |
54d55ced | 703 | assertEquals("Event rank", 9, context.getRank()); |
f17b2f70 | 704 | |
9b635e61 | 705 | event = fTrace.parseEvent(context); |
54d55ced FC |
706 | assertEquals("Event timestamp", 10, event.getTimestamp().getValue()); |
707 | assertEquals("Event rank", 9, context.getRank()); | |
f17b2f70 | 708 | |
7e6347b0 | 709 | event = fTrace.readEvent(context); |
e31e01e8 FC |
710 | assertEquals("Event timestamp", 10, event.getTimestamp().getValue()); |
711 | assertEquals("Event rank", 10, context.getRank()); | |
d18dd09b | 712 | |
f17b2f70 | 713 | // Position trace at event rank 999 |
54d55ced FC |
714 | context = fTrace.seekEvent(new TmfTimestamp(1000, SCALE, 0)); |
715 | assertEquals("Event rank", 999, context.getRank()); | |
f17b2f70 | 716 | |
9b635e61 | 717 | event = fTrace.parseEvent(context); |
54d55ced | 718 | assertEquals("Event timestamp", 1000, event.getTimestamp().getValue()); |
e31e01e8 | 719 | assertEquals("Event rank", 999, context.getRank()); |
f17b2f70 | 720 | |
7e6347b0 | 721 | event = fTrace.readEvent(context); |
54d55ced FC |
722 | assertEquals("Event timestamp", 1000, event.getTimestamp().getValue()); |
723 | assertEquals("Event rank", 1000, context.getRank()); | |
e31e01e8 | 724 | |
f17b2f70 | 725 | // Position trace at event rank 1001 |
54d55ced | 726 | context = fTrace.seekEvent(new TmfTimestamp(1002, SCALE, 0)); |
e31e01e8 | 727 | assertEquals("Event rank", 1001, context.getRank()); |
f17b2f70 | 728 | |
9b635e61 | 729 | event = fTrace.parseEvent(context); |
54d55ced FC |
730 | assertEquals("Event timestamp", 1002, event.getTimestamp().getValue()); |
731 | assertEquals("Event rank", 1001, context.getRank()); | |
f17b2f70 | 732 | |
7e6347b0 | 733 | event = fTrace.readEvent(context); |
54d55ced FC |
734 | assertEquals("Event timestamp", 1002, event.getTimestamp().getValue()); |
735 | assertEquals("Event rank", 1002, context.getRank()); | |
736 | ||
f17b2f70 | 737 | // Position trace at event rank 4500 |
54d55ced FC |
738 | context = fTrace.seekEvent(new TmfTimestamp(4501, SCALE, 0)); |
739 | assertEquals("Event rank", 4500, context.getRank()); | |
f17b2f70 | 740 | |
9b635e61 | 741 | event = fTrace.parseEvent(context); |
54d55ced FC |
742 | assertEquals("Event timestamp", 4501, event.getTimestamp().getValue()); |
743 | assertEquals("Event rank", 4500, context.getRank()); | |
f17b2f70 | 744 | |
7e6347b0 | 745 | event = fTrace.readEvent(context); |
54d55ced FC |
746 | assertEquals("Event timestamp", 4501, event.getTimestamp().getValue()); |
747 | assertEquals("Event rank", 4501, context.getRank()); | |
75828b1a | 748 | } |
d18dd09b | 749 | |
54d55ced | 750 | public void testSeekEventOnTimestampOutOfScope() throws Exception { |
d18dd09b | 751 | |
f17b2f70 FC |
752 | // Position trace at beginning |
753 | ITmfContext context = fTrace.seekEvent(new TmfTimestamp(-1, SCALE, 0)); | |
54d55ced | 754 | assertEquals("Event rank", 0, context.getRank()); |
f17b2f70 | 755 | |
72f1e62a | 756 | ITmfEvent event = fTrace.parseEvent(context); |
75828b1a | 757 | assertEquals("Event timestamp", 1, event.getTimestamp().getValue()); |
54d55ced | 758 | assertEquals("Event rank", 0, context.getRank()); |
f17b2f70 | 759 | |
7e6347b0 | 760 | event = fTrace.readEvent(context); |
54d55ced FC |
761 | assertEquals("Event timestamp", 1, event.getTimestamp().getValue()); |
762 | assertEquals("Event rank", 1, context.getRank()); | |
75828b1a | 763 | |
f17b2f70 | 764 | // Position trace at event passed the end |
54d55ced FC |
765 | context = fTrace.seekEvent(new TmfTimestamp(NB_EVENTS + 1, SCALE, 0)); |
766 | assertEquals("Event rank", NB_EVENTS, context.getRank()); | |
f17b2f70 | 767 | |
9b635e61 | 768 | event = fTrace.parseEvent(context); |
75828b1a | 769 | assertEquals("Event timestamp", null, event); |
54d55ced | 770 | assertEquals("Event rank", NB_EVENTS, context.getRank()); |
f17b2f70 | 771 | |
7e6347b0 | 772 | event = fTrace.readEvent(context); |
54d55ced FC |
773 | assertEquals("Event timestamp", null, event); |
774 | assertEquals("Event rank", NB_EVENTS, context.getRank()); | |
d18dd09b ASL |
775 | } |
776 | ||
54d55ced FC |
777 | // ------------------------------------------------------------------------ |
778 | // seekEvent on rank | |
779 | // ------------------------------------------------------------------------ | |
780 | ||
20658947 FC |
781 | public void testSeekEventOnNegativeRank() throws Exception { |
782 | ||
783 | // Position trace at event rank 0 | |
784 | ITmfContext context = fTrace.seekEvent(-1); | |
785 | assertEquals("Event rank", 0, context.getRank()); | |
786 | ||
787 | ITmfEvent event = fTrace.parseEvent(context); | |
788 | assertEquals("Event timestamp", 1, event.getTimestamp().getValue()); | |
789 | assertEquals("Event rank", 0, context.getRank()); | |
790 | } | |
791 | ||
54d55ced | 792 | public void testSeekOnRankOnCacheBoundary() throws Exception { |
e31e01e8 | 793 | |
f17b2f70 FC |
794 | // On lower bound, returns the first event (ts = 1) |
795 | ITmfContext context = fTrace.seekEvent(0); | |
54d55ced | 796 | assertEquals("Event rank", 0, context.getRank()); |
f17b2f70 | 797 | |
72f1e62a | 798 | ITmfEvent event = fTrace.parseEvent(context); |
e31e01e8 | 799 | assertEquals("Event timestamp", 1, event.getTimestamp().getValue()); |
54d55ced | 800 | assertEquals("Event rank", 0, context.getRank()); |
f17b2f70 | 801 | |
7e6347b0 | 802 | event = fTrace.readEvent(context); |
54d55ced FC |
803 | assertEquals("Event timestamp", 1, event.getTimestamp().getValue()); |
804 | assertEquals("Event rank", 1, context.getRank()); | |
e31e01e8 | 805 | |
f17b2f70 | 806 | // Position trace at event rank 1000 |
54d55ced FC |
807 | context = fTrace.seekEvent(1000); |
808 | assertEquals("Event rank", 1000, context.getRank()); | |
f17b2f70 | 809 | |
9b635e61 | 810 | event = fTrace.parseEvent(context); |
54d55ced FC |
811 | assertEquals("Event timestamp", 1001, event.getTimestamp().getValue()); |
812 | assertEquals("Event rank", 1000, context.getRank()); | |
f17b2f70 | 813 | |
7e6347b0 | 814 | event = fTrace.readEvent(context); |
54d55ced FC |
815 | assertEquals("Event timestamp", 1001, event.getTimestamp().getValue()); |
816 | assertEquals("Event rank", 1001, context.getRank()); | |
e31e01e8 | 817 | |
f17b2f70 | 818 | // Position trace at event rank 4000 |
54d55ced FC |
819 | context = fTrace.seekEvent(4000); |
820 | assertEquals("Event rank", 4000, context.getRank()); | |
f17b2f70 | 821 | |
9b635e61 | 822 | event = fTrace.parseEvent(context); |
54d55ced FC |
823 | assertEquals("Event timestamp", 4001, event.getTimestamp().getValue()); |
824 | assertEquals("Event rank", 4000, context.getRank()); | |
f17b2f70 | 825 | |
7e6347b0 | 826 | event = fTrace.readEvent(context); |
54d55ced FC |
827 | assertEquals("Event timestamp", 4001, event.getTimestamp().getValue()); |
828 | assertEquals("Event rank", 4001, context.getRank()); | |
e31e01e8 FC |
829 | } |
830 | ||
54d55ced | 831 | public void testSeekOnRankNotOnCacheBoundary() throws Exception { |
d18dd09b | 832 | |
f17b2f70 FC |
833 | // Position trace at event rank 9 |
834 | ITmfContext context = fTrace.seekEvent(9); | |
54d55ced | 835 | assertEquals("Event rank", 9, context.getRank()); |
f17b2f70 | 836 | |
72f1e62a | 837 | ITmfEvent event = fTrace.parseEvent(context); |
54d55ced FC |
838 | assertEquals("Event timestamp", 10, event.getTimestamp().getValue()); |
839 | assertEquals("Event rank", 9, context.getRank()); | |
f17b2f70 | 840 | |
7e6347b0 | 841 | event = fTrace.readEvent(context); |
54d55ced FC |
842 | assertEquals("Event timestamp", 10, event.getTimestamp().getValue()); |
843 | assertEquals("Event rank", 10, context.getRank()); | |
d18dd09b | 844 | |
f17b2f70 | 845 | // Position trace at event rank 999 |
54d55ced FC |
846 | context = fTrace.seekEvent(999); |
847 | assertEquals("Event rank", 999, context.getRank()); | |
f17b2f70 | 848 | |
9b635e61 | 849 | event = fTrace.parseEvent(context); |
54d55ced FC |
850 | assertEquals("Event timestamp", 1000, event.getTimestamp().getValue()); |
851 | assertEquals("Event rank", 999, context.getRank()); | |
f17b2f70 | 852 | |
7e6347b0 | 853 | event = fTrace.readEvent(context); |
54d55ced FC |
854 | assertEquals("Event timestamp", 1000, event.getTimestamp().getValue()); |
855 | assertEquals("Event rank", 1000, context.getRank()); | |
d18dd09b | 856 | |
f17b2f70 | 857 | // Position trace at event rank 1001 |
54d55ced FC |
858 | context = fTrace.seekEvent(1001); |
859 | assertEquals("Event rank", 1001, context.getRank()); | |
f17b2f70 | 860 | |
9b635e61 | 861 | event = fTrace.parseEvent(context); |
54d55ced FC |
862 | assertEquals("Event timestamp", 1002, event.getTimestamp().getValue()); |
863 | assertEquals("Event rank", 1001, context.getRank()); | |
f17b2f70 | 864 | |
7e6347b0 | 865 | event = fTrace.readEvent(context); |
54d55ced FC |
866 | assertEquals("Event timestamp", 1002, event.getTimestamp().getValue()); |
867 | assertEquals("Event rank", 1002, context.getRank()); | |
868 | ||
f17b2f70 | 869 | // Position trace at event rank 4500 |
54d55ced FC |
870 | context = fTrace.seekEvent(4500); |
871 | assertEquals("Event rank", 4500, context.getRank()); | |
f17b2f70 | 872 | |
9b635e61 | 873 | event = fTrace.parseEvent(context); |
54d55ced FC |
874 | assertEquals("Event timestamp", 4501, event.getTimestamp().getValue()); |
875 | assertEquals("Event rank", 4500, context.getRank()); | |
f17b2f70 | 876 | |
7e6347b0 | 877 | event = fTrace.readEvent(context); |
54d55ced FC |
878 | assertEquals("Event timestamp", 4501, event.getTimestamp().getValue()); |
879 | assertEquals("Event rank", 4501, context.getRank()); | |
d18dd09b ASL |
880 | } |
881 | ||
54d55ced FC |
882 | public void testSeekEventOnRankOfScope() throws Exception { |
883 | ||
f17b2f70 FC |
884 | // Position trace at beginning |
885 | ITmfContext context = fTrace.seekEvent(-1); | |
54d55ced | 886 | assertEquals("Event rank", 0, context.getRank()); |
f17b2f70 | 887 | |
72f1e62a | 888 | ITmfEvent event = fTrace.parseEvent(context); |
54d55ced FC |
889 | assertEquals("Event timestamp", 1, event.getTimestamp().getValue()); |
890 | assertEquals("Event rank", 0, context.getRank()); | |
f17b2f70 | 891 | |
7e6347b0 | 892 | event = fTrace.readEvent(context); |
54d55ced FC |
893 | assertEquals("Event timestamp", 1, event.getTimestamp().getValue()); |
894 | assertEquals("Event rank", 1, context.getRank()); | |
895 | ||
f17b2f70 | 896 | // Position trace at event passed the end |
54d55ced FC |
897 | context = fTrace.seekEvent(NB_EVENTS); |
898 | assertEquals("Event rank", NB_EVENTS, context.getRank()); | |
f17b2f70 | 899 | |
9b635e61 | 900 | event = fTrace.parseEvent(context); |
54d55ced FC |
901 | assertEquals("Event timestamp", null, event); |
902 | assertEquals("Event rank", NB_EVENTS, context.getRank()); | |
f17b2f70 | 903 | |
7e6347b0 | 904 | event = fTrace.readEvent(context); |
54d55ced FC |
905 | assertEquals("Event timestamp", null, event); |
906 | assertEquals("Event rank", NB_EVENTS, context.getRank()); | |
907 | } | |
f17b2f70 | 908 | |
20658947 FC |
909 | // ------------------------------------------------------------------------ |
910 | // parseEvent - make sure parseEvent doesn't update the context | |
911 | // ------------------------------------------------------------------------ | |
912 | ||
913 | public void testParseEvent() throws Exception { | |
914 | ||
915 | final int NB_READS = 20; | |
916 | ||
917 | // On lower bound, returns the first event (ts = 0) | |
918 | final TmfContext context = (TmfContext) fTrace.seekEvent(new TmfTimestamp(0, SCALE, 0)); | |
919 | TmfContext svContext = new TmfContext(context); | |
920 | ||
921 | ITmfEvent event = fTrace.parseEvent(context); | |
922 | assertEquals("Event timestamp", 1, event.getTimestamp().getValue()); | |
923 | assertEquals("Event rank", 0, context.getRank()); | |
924 | assertTrue("parseEvent", context.equals(svContext)); | |
925 | ||
926 | event = fTrace.parseEvent(context); | |
927 | assertEquals("Event timestamp", 1, event.getTimestamp().getValue()); | |
928 | assertEquals("Event rank", 0, context.getRank()); | |
929 | assertTrue("parseEvent", context.equals(svContext)); | |
930 | ||
931 | event = fTrace.parseEvent(context); | |
932 | assertEquals("Event timestamp", 1, event.getTimestamp().getValue()); | |
933 | assertEquals("Event rank", 0, context.getRank()); | |
934 | assertTrue("parseEvent", context.equals(svContext)); | |
935 | ||
936 | // Position the trace at event NB_READS | |
937 | for (int i = 1; i < NB_READS; i++) { | |
7e6347b0 | 938 | event = fTrace.readEvent(context); |
20658947 FC |
939 | assertEquals("Event timestamp", i, event.getTimestamp().getValue()); |
940 | } | |
941 | ||
942 | svContext = new TmfContext(context); | |
943 | event = fTrace.parseEvent(context); | |
944 | assertEquals("Event timestamp", NB_READS, event.getTimestamp().getValue()); | |
945 | assertEquals("Event rank", NB_READS -1 , context.getRank()); | |
946 | assertTrue("parseEvent", context.equals(svContext)); | |
947 | ||
948 | event = fTrace.parseEvent(context); | |
949 | assertEquals("Event timestamp", NB_READS, event.getTimestamp().getValue()); | |
950 | assertEquals("Event rank", NB_READS - 1, context.getRank()); | |
951 | assertTrue("parseEvent", context.equals(svContext)); | |
952 | } | |
953 | ||
954 | // ------------------------------------------------------------------------ | |
7e6347b0 | 955 | // readEvent - updates the context |
20658947 FC |
956 | // ------------------------------------------------------------------------ |
957 | ||
7e6347b0 | 958 | public void testGetEvent() throws Exception { |
20658947 FC |
959 | |
960 | final int NB_READS = 20; | |
961 | ||
962 | // On lower bound, returns the first event (ts = 1) | |
963 | final ITmfContext context = fTrace.seekEvent(new TmfTimestamp(0, SCALE, 0)); | |
964 | ||
965 | // Read NB_EVENTS | |
966 | ITmfEvent event; | |
967 | for (int i = 0; i < NB_READS; i++) { | |
7e6347b0 | 968 | event = fTrace.readEvent(context); |
20658947 FC |
969 | assertEquals("Event timestamp", i + 1, event.getTimestamp().getValue()); |
970 | assertEquals("Event rank", i + 1, context.getRank()); | |
971 | } | |
972 | ||
973 | // Make sure we stay positioned | |
974 | event = fTrace.parseEvent(context); | |
975 | assertEquals("Event timestamp", NB_READS + 1, event.getTimestamp().getValue()); | |
976 | assertEquals("Event rank", NB_READS, context.getRank()); | |
977 | } | |
978 | ||
e31e01e8 | 979 | // ------------------------------------------------------------------------ |
d18dd09b | 980 | // processRequest |
e31e01e8 | 981 | // ------------------------------------------------------------------------ |
d18dd09b | 982 | |
e31e01e8 | 983 | @SuppressWarnings("unchecked") |
7e6347b0 FC |
984 | public void testProcessEventRequestForAllEvents() throws Exception { |
985 | final int BLOCK_SIZE = 1; | |
986 | final Vector<TmfEvent> requestedEvents = new Vector<TmfEvent>(); | |
987 | ||
988 | final TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BIG_BANG, TmfTimestamp.BIG_CRUNCH); | |
989 | final TmfEventRequest<TmfEvent> request = new TmfEventRequest<TmfEvent>(TmfEvent.class, range, NB_EVENTS, BLOCK_SIZE) { | |
990 | @Override | |
991 | public void handleData(final TmfEvent event) { | |
992 | super.handleData(event); | |
993 | requestedEvents.add(event); | |
994 | } | |
995 | }; | |
996 | final ITmfDataProvider<TmfEvent>[] providers = (ITmfDataProvider<TmfEvent>[]) TmfProviderManager.getProviders(TmfEvent.class, TmfTraceStub.class); | |
997 | providers[0].sendRequest(request); | |
998 | request.waitForCompletion(); | |
999 | ||
1000 | assertEquals("nbEvents", NB_EVENTS, requestedEvents.size()); | |
1001 | assertTrue("isCompleted", request.isCompleted()); | |
1002 | assertFalse("isCancelled", request.isCancelled()); | |
1003 | ||
1004 | // Ensure that we have distinct events. | |
1005 | // Don't go overboard: we are not validating the stub! | |
1006 | for (int i = 0; i < NB_EVENTS; i++) { | |
1007 | assertEquals("Distinct events", i + 1, requestedEvents.get(i).getTimestamp().getValue()); | |
1008 | } | |
1009 | } | |
1010 | ||
1011 | @SuppressWarnings("unchecked") | |
1012 | public void testProcessEventRequestForNbEvents() throws Exception { | |
d18dd09b ASL |
1013 | final int BLOCK_SIZE = 100; |
1014 | final int NB_EVENTS = 1000; | |
1015 | final Vector<TmfEvent> requestedEvents = new Vector<TmfEvent>(); | |
1016 | ||
f17b2f70 | 1017 | final TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BIG_BANG, TmfTimestamp.BIG_CRUNCH); |
e31e01e8 | 1018 | final TmfEventRequest<TmfEvent> request = new TmfEventRequest<TmfEvent>(TmfEvent.class, range, NB_EVENTS, BLOCK_SIZE) { |
f17b2f70 FC |
1019 | @Override |
1020 | public void handleData(final TmfEvent event) { | |
1021 | super.handleData(event); | |
1022 | requestedEvents.add(event); | |
1023 | } | |
d18dd09b | 1024 | }; |
f17b2f70 | 1025 | final ITmfDataProvider<TmfEvent>[] providers = (ITmfDataProvider<TmfEvent>[]) TmfProviderManager.getProviders(TmfEvent.class, TmfTraceStub.class); |
951d134a FC |
1026 | providers[0].sendRequest(request); |
1027 | request.waitForCompletion(); | |
d18dd09b ASL |
1028 | |
1029 | assertEquals("nbEvents", NB_EVENTS, requestedEvents.size()); | |
1030 | assertTrue("isCompleted", request.isCompleted()); | |
1031 | assertFalse("isCancelled", request.isCancelled()); | |
1032 | ||
1033 | // Ensure that we have distinct events. | |
f17b2f70 | 1034 | // Don't go overboard: we are not validating the stub! |
20658947 | 1035 | for (int i = 0; i < NB_EVENTS; i++) { |
7e6347b0 | 1036 | assertEquals("Distinct events", i + 1, requestedEvents.get(i).getTimestamp().getValue()); |
20658947 | 1037 | } |
d18dd09b | 1038 | } |
f17b2f70 | 1039 | |
e31e01e8 | 1040 | @SuppressWarnings("unchecked") |
7e6347b0 | 1041 | public void testProcessEventRequestForSomeEvents() throws Exception { |
d18dd09b | 1042 | final int BLOCK_SIZE = 1; |
7e6347b0 FC |
1043 | final long startTime = 100; |
1044 | final int NB_EVENTS = 1000; | |
d18dd09b ASL |
1045 | final Vector<TmfEvent> requestedEvents = new Vector<TmfEvent>(); |
1046 | ||
7e6347b0 | 1047 | final TmfTimeRange range = new TmfTimeRange(new TmfTimestamp(startTime, SCALE), TmfTimestamp.BIG_CRUNCH); |
e31e01e8 | 1048 | final TmfEventRequest<TmfEvent> request = new TmfEventRequest<TmfEvent>(TmfEvent.class, range, NB_EVENTS, BLOCK_SIZE) { |
f17b2f70 FC |
1049 | @Override |
1050 | public void handleData(final TmfEvent event) { | |
1051 | super.handleData(event); | |
1052 | requestedEvents.add(event); | |
1053 | } | |
d18dd09b | 1054 | }; |
f17b2f70 | 1055 | final ITmfDataProvider<TmfEvent>[] providers = (ITmfDataProvider<TmfEvent>[]) TmfProviderManager.getProviders(TmfEvent.class, TmfTraceStub.class); |
951d134a FC |
1056 | providers[0].sendRequest(request); |
1057 | request.waitForCompletion(); | |
d18dd09b ASL |
1058 | |
1059 | assertEquals("nbEvents", NB_EVENTS, requestedEvents.size()); | |
1060 | assertTrue("isCompleted", request.isCompleted()); | |
1061 | assertFalse("isCancelled", request.isCancelled()); | |
1062 | ||
1063 | // Ensure that we have distinct events. | |
f17b2f70 | 1064 | // Don't go overboard: we are not validating the stub! |
20658947 | 1065 | for (int i = 0; i < NB_EVENTS; i++) { |
7e6347b0 FC |
1066 | assertEquals("Distinct events", startTime + i, requestedEvents.get(i).getTimestamp().getValue()); |
1067 | } | |
1068 | } | |
1069 | ||
1070 | @SuppressWarnings("unchecked") | |
1071 | public void testProcessEventRequestForOtherEvents() throws Exception { | |
1072 | final int BLOCK_SIZE = 1; | |
1073 | final int startIndex = 99; | |
1074 | final long startTime = 100; | |
1075 | final int NB_EVENTS = 1000; | |
1076 | final Vector<TmfEvent> requestedEvents = new Vector<TmfEvent>(); | |
1077 | ||
1078 | final TmfTimeRange range = new TmfTimeRange(new TmfTimestamp(startTime, SCALE), TmfTimestamp.BIG_CRUNCH); | |
1079 | final TmfEventRequest<TmfEvent> request = new TmfEventRequest<TmfEvent>(TmfEvent.class, range, startIndex, NB_EVENTS, BLOCK_SIZE) { | |
1080 | @Override | |
1081 | public void handleData(final TmfEvent event) { | |
1082 | super.handleData(event); | |
1083 | requestedEvents.add(event); | |
1084 | } | |
1085 | }; | |
1086 | final ITmfDataProvider<TmfEvent>[] providers = (ITmfDataProvider<TmfEvent>[]) TmfProviderManager.getProviders(TmfEvent.class, TmfTraceStub.class); | |
1087 | providers[0].sendRequest(request); | |
1088 | request.waitForCompletion(); | |
1089 | ||
1090 | assertEquals("nbEvents", NB_EVENTS, requestedEvents.size()); | |
1091 | assertTrue("isCompleted", request.isCompleted()); | |
1092 | assertFalse("isCancelled", request.isCancelled()); | |
1093 | ||
1094 | // Ensure that we have distinct events. | |
1095 | // Don't go overboard: we are not validating the stub! | |
1096 | for (int i = 0; i < NB_EVENTS; i++) { | |
1097 | assertEquals("Distinct events", startTime + i, requestedEvents.get(i).getTimestamp().getValue()); | |
1098 | } | |
1099 | } | |
1100 | ||
1101 | @SuppressWarnings("unchecked") | |
1102 | public void testProcessDataRequestForSomeEvents() throws Exception { | |
1103 | final int startIndex = 100; | |
1104 | final int NB_EVENTS = 1000; | |
1105 | final Vector<TmfEvent> requestedEvents = new Vector<TmfEvent>(); | |
1106 | ||
1107 | final TmfDataRequest<TmfEvent> request = new TmfDataRequest<TmfEvent>(TmfEvent.class, startIndex, NB_EVENTS) { | |
1108 | @Override | |
1109 | public void handleData(final TmfEvent event) { | |
1110 | super.handleData(event); | |
1111 | requestedEvents.add(event); | |
1112 | } | |
1113 | }; | |
1114 | final ITmfDataProvider<TmfEvent>[] providers = (ITmfDataProvider<TmfEvent>[]) TmfProviderManager.getProviders(TmfEvent.class, TmfTraceStub.class); | |
1115 | providers[0].sendRequest(request); | |
1116 | request.waitForCompletion(); | |
1117 | ||
1118 | assertEquals("nbEvents", NB_EVENTS, requestedEvents.size()); | |
1119 | assertTrue("isCompleted", request.isCompleted()); | |
1120 | assertFalse("isCancelled", request.isCancelled()); | |
1121 | ||
1122 | // Ensure that we have distinct events. | |
1123 | // Don't go overboard: we are not validating the stub! | |
1124 | for (int i = 0; i < NB_EVENTS; i++) { | |
1125 | assertEquals("Distinct events", startIndex + 1 + i, requestedEvents.get(i).getTimestamp().getValue()); | |
20658947 | 1126 | } |
d18dd09b | 1127 | } |
f17b2f70 | 1128 | |
e31e01e8 | 1129 | // ------------------------------------------------------------------------ |
d18dd09b | 1130 | // cancel |
e31e01e8 | 1131 | // ------------------------------------------------------------------------ |
d18dd09b | 1132 | |
e31e01e8 | 1133 | @SuppressWarnings("unchecked") |
f17b2f70 | 1134 | public void testCancel() throws Exception { |
d18dd09b ASL |
1135 | final Vector<TmfEvent> requestedEvents = new Vector<TmfEvent>(); |
1136 | ||
f17b2f70 | 1137 | final TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BIG_BANG, TmfTimestamp.BIG_CRUNCH); |
cb866e08 | 1138 | final TmfEventRequest<TmfEvent> request = new TmfEventRequest<TmfEvent>(TmfEvent.class, range, NB_EVENTS, BLOCK_SIZE) { |
f17b2f70 FC |
1139 | int nbRead = 0; |
1140 | @Override | |
1141 | public void handleData(final TmfEvent event) { | |
1142 | super.handleData(event); | |
1143 | requestedEvents.add(event); | |
20658947 | 1144 | if (++nbRead == BLOCK_SIZE) { |
f17b2f70 | 1145 | cancel(); |
20658947 | 1146 | } |
f17b2f70 | 1147 | } |
d18dd09b | 1148 | }; |
f17b2f70 | 1149 | final ITmfDataProvider<TmfEvent>[] providers = (ITmfDataProvider<TmfEvent>[]) TmfProviderManager.getProviders(TmfEvent.class, TmfTraceStub.class); |
951d134a FC |
1150 | providers[0].sendRequest(request); |
1151 | request.waitForCompletion(); | |
d18dd09b | 1152 | |
cb866e08 | 1153 | assertEquals("nbEvents", BLOCK_SIZE, requestedEvents.size()); |
d18dd09b ASL |
1154 | assertTrue("isCompleted", request.isCompleted()); |
1155 | assertTrue("isCancelled", request.isCancelled()); | |
1156 | } | |
e31e01e8 | 1157 | |
1703b536 FC |
1158 | // ------------------------------------------------------------------------ |
1159 | // toString | |
1160 | // ------------------------------------------------------------------------ | |
1161 | ||
1162 | public void testDefaultTmfTraceStub() throws Exception { | |
1163 | assertFalse ("Open trace", fTrace == null); | |
1164 | assertEquals("getType", TmfEvent.class, fTrace.getType()); | |
1165 | assertNull ("getResource", fTrace.getResource()); | |
1166 | assertEquals("getCacheSize", BLOCK_SIZE, fTrace.getCacheSize()); | |
1167 | assertEquals("getStreamingInterval", 0, fTrace.getStreamingInterval()); | |
1168 | assertEquals("getName", TEST_STREAM, fTrace.getName()); | |
1169 | ||
1170 | assertEquals("getNbEvents", NB_EVENTS, fTrace.getNbEvents()); | |
1171 | assertEquals("getRange-start", 1, fTrace.getTimeRange().getStartTime().getValue()); | |
1172 | assertEquals("getRange-end", NB_EVENTS, fTrace.getTimeRange().getEndTime().getValue()); | |
1173 | assertEquals("getStartTime", 1, fTrace.getStartTime().getValue()); | |
1174 | assertEquals("getEndTime", NB_EVENTS, fTrace.getEndTime().getValue()); | |
1175 | ||
1176 | String expected = "TmfTrace [fPath=" + fTrace.getPath() + ", fCacheSize=" + fTrace.getCacheSize() + | |
1177 | ", fNbEvents=" + fTrace.getNbEvents() + ", fStartTime=" + fTrace.getStartTime() + | |
1178 | ", fEndTime=" + fTrace.getEndTime() + ", fStreamingInterval=" + fTrace.getStreamingInterval() + | |
1179 | "]"; | |
1180 | assertEquals("toString", expected, fTrace.toString()); | |
1181 | } | |
1182 | ||
e31e01e8 | 1183 | } |