1 /*******************************************************************************
2 * Copyright (c) 2009, 2010, 2013 Ericsson
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
10 * Francois Chouinard - Initial API and implementation
11 * Alexandre Montplaisir - Port to JUnit4
12 *******************************************************************************/
14 package org
.eclipse
.linuxtools
.tmf
.core
.tests
.request
;
16 import static org
.junit
.Assert
.assertEquals
;
17 import static org
.junit
.Assert
.assertFalse
;
18 import static org
.junit
.Assert
.assertTrue
;
21 import java
.io
.IOException
;
22 import java
.net
.URISyntaxException
;
24 import java
.util
.Vector
;
26 import org
.eclipse
.core
.runtime
.FileLocator
;
27 import org
.eclipse
.core
.runtime
.Path
;
28 import org
.eclipse
.linuxtools
.internal
.tmf
.core
.component
.TmfProviderManager
;
29 import org
.eclipse
.linuxtools
.internal
.tmf
.core
.request
.TmfCoalescedDataRequest
;
30 import org
.eclipse
.linuxtools
.internal
.tmf
.core
.request
.TmfCoalescedEventRequest
;
31 import org
.eclipse
.linuxtools
.tmf
.core
.component
.ITmfDataProvider
;
32 import org
.eclipse
.linuxtools
.tmf
.core
.event
.ITmfEvent
;
33 import org
.eclipse
.linuxtools
.tmf
.core
.event
.TmfTimeRange
;
34 import org
.eclipse
.linuxtools
.tmf
.core
.event
.TmfTimestamp
;
35 import org
.eclipse
.linuxtools
.tmf
.core
.exceptions
.TmfTraceException
;
36 import org
.eclipse
.linuxtools
.tmf
.core
.request
.ITmfDataRequest
.ExecutionType
;
37 import org
.eclipse
.linuxtools
.tmf
.core
.request
.TmfDataRequest
;
38 import org
.eclipse
.linuxtools
.tmf
.core
.request
.TmfEventRequest
;
39 import org
.eclipse
.linuxtools
.tmf
.core
.signal
.TmfSignal
;
40 import org
.eclipse
.linuxtools
.tmf
.core
.signal
.TmfSignalHandler
;
41 import org
.eclipse
.linuxtools
.tmf
.core
.signal
.TmfSignalManager
;
42 import org
.eclipse
.linuxtools
.tmf
.core
.tests
.TmfCoreTestPlugin
;
43 import org
.eclipse
.linuxtools
.tmf
.tests
.stubs
.request
.TmfEventRequestStub
;
44 import org
.eclipse
.linuxtools
.tmf
.tests
.stubs
.trace
.TmfTraceStub
;
45 import org
.junit
.Before
;
46 import org
.junit
.Test
;
49 * Test suite for the TmfCoalescedEventRequest class.
51 @SuppressWarnings({ "nls", "javadoc" })
52 public class TmfCoalescedEventRequestTest
{
54 // ------------------------------------------------------------------------
56 // ------------------------------------------------------------------------
58 private final TmfTimeRange range1
= new TmfTimeRange(TmfTimeRange
.ETERNITY
);
59 private final TmfTimeRange range2
= new TmfTimeRange(new TmfTimestamp(), TmfTimestamp
.BIG_CRUNCH
);
61 private TmfCoalescedEventRequest fRequest1
;
62 private TmfCoalescedEventRequest fRequest2
;
63 private TmfCoalescedEventRequest fRequest3
;
64 private TmfCoalescedEventRequest fRequest4
;
66 private TmfCoalescedEventRequest fRequest1b
;
67 private TmfCoalescedEventRequest fRequest1c
;
69 private int fRequestCount
;
71 // ------------------------------------------------------------------------
73 // ------------------------------------------------------------------------
77 TmfDataRequest
.reset();
78 fRequest1
= new TmfCoalescedEventRequest(ITmfEvent
.class, range1
, 100, 200);
79 fRequest2
= new TmfCoalescedEventRequest(ITmfEvent
.class, range2
, 100, 200);
80 fRequest3
= new TmfCoalescedEventRequest(ITmfEvent
.class, range2
, 200, 200);
81 fRequest4
= new TmfCoalescedEventRequest(ITmfEvent
.class, range2
, 200, 300);
83 fRequest1b
= new TmfCoalescedEventRequest(ITmfEvent
.class, range1
, 100, 200);
84 fRequest1c
= new TmfCoalescedEventRequest(ITmfEvent
.class, range1
, 100, 200);
86 fRequestCount
= fRequest1c
.getRequestId() + 1;
89 private TmfCoalescedEventRequest
setupTestRequest(final boolean[] flags
) {
91 TmfCoalescedEventRequest request
= new TmfCoalescedEventRequest(ITmfEvent
.class, range1
, 100, 200) {
93 public void handleCompleted() {
94 super.handleCompleted();
99 public void handleSuccess() {
100 super.handleSuccess();
105 public void handleFailure() {
106 super.handleFailure();
111 public void handleCancel() {
112 super.handleCancel();
119 // ------------------------------------------------------------------------
121 // ------------------------------------------------------------------------
124 public void testTmfCoalescedEventRequest() {
125 TmfCoalescedEventRequest request
= new TmfCoalescedEventRequest(ITmfEvent
.class);
127 assertEquals("getRequestId", fRequestCount
++, request
.getRequestId());
128 assertEquals("getDataType", ITmfEvent
.class, request
.getDataType());
130 assertEquals("getRange", range1
, request
.getRange());
131 assertEquals("getNbRequestedEvents", TmfDataRequest
.ALL_DATA
, request
.getNbRequested());
133 assertFalse("isCompleted", request
.isCompleted());
134 assertFalse("isFailed", request
.isFailed());
135 assertFalse("isCancelled", request
.isCancelled());
137 assertEquals("getNbRead", 0, request
.getNbRead());
141 public void testTmfCoalescedEventRequestIndex() {
142 TmfCoalescedEventRequest request
= new TmfCoalescedEventRequest(ITmfEvent
.class, range1
);
144 assertEquals("getRequestId", fRequestCount
++, request
.getRequestId());
145 assertEquals("getDataType", ITmfEvent
.class, request
.getDataType());
147 assertEquals("getRange", range1
, request
.getRange());
148 assertEquals("getNbRequestedEvents", TmfDataRequest
.ALL_DATA
, request
.getNbRequested());
150 assertFalse("isCompleted", request
.isCompleted());
151 assertFalse("isFailed", request
.isFailed());
152 assertFalse("isCancelled", request
.isCancelled());
154 assertEquals("getNbRead", 0, request
.getNbRead());
157 public void testTmfCoalescedEventRequestIndexNbRequested() {
158 TmfCoalescedEventRequest request
= new TmfCoalescedEventRequest(ITmfEvent
.class, range1
, 100);
160 assertEquals("getRequestId", fRequestCount
++, request
.getRequestId());
161 assertEquals("getDataType", ITmfEvent
.class, request
.getDataType());
163 assertEquals("getRange", range1
, request
.getRange());
164 assertEquals("getNbRequestedEvents", 100, request
.getNbRequested());
166 assertFalse("isCompleted", request
.isCompleted());
167 assertFalse("isFailed", request
.isFailed());
168 assertFalse("isCancelled", request
.isCancelled());
170 assertEquals("getNbRead", 0, request
.getNbRead());
174 public void testTmfCoalescedEventRequestIndexNbEventsBlocksize() {
175 TmfCoalescedEventRequest request
= new TmfCoalescedEventRequest(ITmfEvent
.class, range1
, 100, 200);
177 assertEquals("getRequestId", fRequestCount
++, request
.getRequestId());
178 assertEquals("getDataType", ITmfEvent
.class, request
.getDataType());
180 assertEquals("getRange", range1
, request
.getRange());
181 assertEquals("getNbRequestedEvents", 100, request
.getNbRequested());
183 assertFalse("isCompleted", request
.isCompleted());
184 assertFalse("isFailed", request
.isFailed());
185 assertFalse("isCancelled", request
.isCancelled());
187 assertEquals("getNbRead", 0, request
.getNbRead());
190 // ------------------------------------------------------------------------
192 // ------------------------------------------------------------------------
195 public void testEqualsReflexivity() {
196 assertTrue("equals", fRequest1
.equals(fRequest1
));
197 assertTrue("equals", fRequest2
.equals(fRequest2
));
199 assertFalse("equals", fRequest1
.equals(fRequest2
));
200 assertFalse("equals", fRequest2
.equals(fRequest1
));
204 public void testEqualsSymmetry() {
205 assertTrue("equals", fRequest1
.equals(fRequest1b
));
206 assertTrue("equals", fRequest1b
.equals(fRequest1
));
208 assertFalse("equals", fRequest1
.equals(fRequest3
));
209 assertFalse("equals", fRequest2
.equals(fRequest3
));
210 assertFalse("equals", fRequest3
.equals(fRequest1
));
211 assertFalse("equals", fRequest3
.equals(fRequest2
));
215 public void testEqualsTransivity() {
216 assertTrue("equals", fRequest1
.equals(fRequest1b
));
217 assertTrue("equals", fRequest1b
.equals(fRequest1c
));
218 assertTrue("equals", fRequest1
.equals(fRequest1c
));
222 public void testEqualsNull() {
223 assertFalse("equals", fRequest1
.equals(null));
224 assertFalse("equals", fRequest2
.equals(null));
228 public void testEqualsSuper() {
229 TmfCoalescedDataRequest dataRequest1
= new TmfCoalescedDataRequest(
230 fRequest1
.getDataType(), fRequest1
.getIndex(), fRequest1
.getNbRequested());
231 TmfCoalescedDataRequest dataRequest2
= new TmfCoalescedDataRequest(
232 fRequest1
.getDataType(), fRequest1
.getIndex(), fRequest1
.getNbRequested());
233 TmfCoalescedDataRequest dataRequest3
= new TmfCoalescedDataRequest(
234 fRequest3
.getDataType(), fRequest3
.getIndex(), fRequest3
.getNbRequested());
236 assertTrue("equals", fRequest1
.equals(dataRequest2
));
237 assertTrue("equals", fRequest2
.equals(dataRequest1
));
238 assertFalse("equals", fRequest1
.equals(dataRequest3
));
239 assertFalse("equals", fRequest3
.equals(dataRequest1
));
242 // ------------------------------------------------------------------------
244 // ------------------------------------------------------------------------
247 public void testHashCode() {
248 assertTrue("hashCode", fRequest1
.hashCode() == fRequest1
.hashCode());
249 assertTrue("hashCode", fRequest2
.hashCode() == fRequest2
.hashCode());
250 assertTrue("hashCode", fRequest1
.hashCode() != fRequest2
.hashCode());
253 // ------------------------------------------------------------------------
255 // ------------------------------------------------------------------------
258 public void testToString() {
259 String expected1
= "[TmfCoalescedEventRequest(0,ITmfEvent," + range1
+ ",0,100,200)]";
260 String expected2
= "[TmfCoalescedEventRequest(1,ITmfEvent," + range2
+ ",0,100,200)]";
261 String expected3
= "[TmfCoalescedEventRequest(2,ITmfEvent," + range2
+ ",0,200,200)]";
262 String expected4
= "[TmfCoalescedEventRequest(3,ITmfEvent," + range2
+ ",0,200,300)]";
264 assertEquals("toString", expected1
, fRequest1
.toString());
265 assertEquals("toString", expected2
, fRequest2
.toString());
266 assertEquals("toString", expected3
, fRequest3
.toString());
267 assertEquals("toString", expected4
, fRequest4
.toString());
270 // ------------------------------------------------------------------------
272 // ------------------------------------------------------------------------
275 public void testIsCompatible() {
276 TmfCoalescedEventRequest coalescedRequest
= new TmfCoalescedEventRequest(ITmfEvent
.class, range1
, 100, 200);
277 TmfEventRequest req1
= new TmfEventRequestStub(ITmfEvent
.class, range1
, 100, 200);
278 TmfEventRequest req2
= new TmfEventRequestStub(ITmfEvent
.class, range2
, 100, 200);
279 TmfEventRequest req3
= new TmfEventRequestStub(ITmfEvent
.class, range1
, 101, 200);
281 assertTrue("isCompatible", coalescedRequest
.isCompatible(req1
));
282 assertTrue("isCompatible", coalescedRequest
.isCompatible(req2
));
283 assertTrue("isCompatible", coalescedRequest
.isCompatible(req3
));
286 // ------------------------------------------------------------------------
288 // ------------------------------------------------------------------------
291 public void testAddEvent1() {
292 TmfCoalescedEventRequest coalescedRequest
= new TmfCoalescedEventRequest(ITmfEvent
.class, range1
, 0, 2147483647, 200, ExecutionType
.FOREGROUND
);
293 TmfEventRequest req1
= new TmfEventRequestStub(ITmfEvent
.class, range1
, 0, 2147483647, 200);
294 TmfEventRequest req2
= new TmfEventRequestStub(ITmfEvent
.class, range1
, 1, 2147483647, 200);
296 assertTrue("isCompatible", coalescedRequest
.isCompatible(req1
));
297 assertTrue("isCompatible", coalescedRequest
.isCompatible(req2
));
299 coalescedRequest
.addRequest(req1
);
300 coalescedRequest
.addRequest(req2
);
302 assertEquals("addRequest", 0, coalescedRequest
.getIndex());
303 assertEquals("addRequest", 2147483647, coalescedRequest
.getNbRequested());
304 assertEquals("addRequest", 200, coalescedRequest
.getBlockSize());
309 public void testAddEvent2() {
310 TmfCoalescedEventRequest coalescedRequest
= new TmfCoalescedEventRequest(ITmfEvent
.class, range1
, 1, 2147483647, 200, ExecutionType
.FOREGROUND
);
311 TmfEventRequest req1
= new TmfEventRequestStub(ITmfEvent
.class, range1
, 1, 2147483647, 200);
312 TmfEventRequest req2
= new TmfEventRequestStub(ITmfEvent
.class, range1
, 0, 2147483647, 200);
314 assertTrue("isCompatible", coalescedRequest
.isCompatible(req1
));
315 assertTrue("isCompatible", coalescedRequest
.isCompatible(req2
));
317 coalescedRequest
.addRequest(req1
);
318 coalescedRequest
.addRequest(req2
);
320 assertEquals("addRequest", 0, coalescedRequest
.getIndex());
321 assertEquals("addRequest", 2147483647, coalescedRequest
.getNbRequested());
322 assertEquals("addRequest", 200, coalescedRequest
.getBlockSize());
326 // ------------------------------------------------------------------------
328 // ------------------------------------------------------------------------
331 public void testDone() {
333 final boolean[] crFlags
= new boolean[4];
334 TmfCoalescedEventRequest request
= setupTestRequest(crFlags
);
335 TmfEventRequest subRequest1
= new TmfEventRequestStub(ITmfEvent
.class, range1
, 100, 200);
336 TmfEventRequest subRequest2
= new TmfEventRequestStub(ITmfEvent
.class, range1
, 100, 200);
337 request
.addRequest(subRequest1
);
338 request
.addRequest(subRequest2
);
342 // Validate the coalescing request
343 assertTrue("isCompleted", request
.isCompleted());
344 assertFalse("isFailed", request
.isFailed());
345 assertFalse("isCancelled", request
.isCancelled());
347 assertTrue("handleCompleted", crFlags
[0]);
348 assertTrue("handleSuccess", crFlags
[1]);
349 assertFalse("handleFailure", crFlags
[2]);
350 assertFalse("handleCancel", crFlags
[3]);
352 // Validate the first coalesced request
353 assertTrue("isCompleted", subRequest1
.isCompleted());
354 assertFalse("isFailed", subRequest1
.isFailed());
355 assertFalse("isCancelled", subRequest1
.isCancelled());
357 // Validate the second coalesced request
358 assertTrue("isCompleted", subRequest2
.isCompleted());
359 assertFalse("isFailed", subRequest2
.isFailed());
360 assertFalse("isCancelled", subRequest2
.isCancelled());
363 // ------------------------------------------------------------------------
365 // ------------------------------------------------------------------------
368 public void testFail() {
369 final boolean[] crFlags
= new boolean[4];
370 TmfCoalescedEventRequest request
= setupTestRequest(crFlags
);
371 TmfEventRequest subRequest1
= new TmfEventRequestStub(ITmfEvent
.class, range1
, 100, 200);
372 TmfEventRequest subRequest2
= new TmfEventRequestStub(ITmfEvent
.class, range1
, 100, 200);
373 request
.addRequest(subRequest1
);
374 request
.addRequest(subRequest2
);
378 // Validate the coalescing request
379 assertTrue("isCompleted", request
.isCompleted());
380 assertTrue("isFailed", request
.isFailed());
381 assertFalse("isCancelled", request
.isCancelled());
383 assertTrue("handleCompleted", crFlags
[0]);
384 assertFalse("handleSuccess", crFlags
[1]);
385 assertTrue("handleFailure", crFlags
[2]);
386 assertFalse("handleCancel", crFlags
[3]);
388 // Validate the first coalesced request
389 assertTrue("isCompleted", subRequest1
.isCompleted());
390 assertTrue("isFailed", subRequest1
.isFailed());
391 assertFalse("isCancelled", subRequest1
.isCancelled());
393 // Validate the second coalesced request
394 assertTrue("isCompleted", subRequest2
.isCompleted());
395 assertTrue("isFailed", subRequest2
.isFailed());
396 assertFalse("isCancelled", subRequest2
.isCancelled());
399 // ------------------------------------------------------------------------
401 // ------------------------------------------------------------------------
404 public void testCancel() {
405 final boolean[] crFlags
= new boolean[4];
406 TmfCoalescedEventRequest request
= setupTestRequest(crFlags
);
407 TmfEventRequest subRequest1
= new TmfEventRequestStub(ITmfEvent
.class, range1
, 100, 200);
408 TmfEventRequest subRequest2
= new TmfEventRequestStub(ITmfEvent
.class, range1
, 100, 200);
409 request
.addRequest(subRequest1
);
410 request
.addRequest(subRequest2
);
414 // Validate the coalescing request
415 assertTrue("isCompleted", request
.isCompleted());
416 assertFalse("isFailed", request
.isFailed());
417 assertTrue("isCancelled", request
.isCancelled());
419 assertTrue("handleCompleted", crFlags
[0]);
420 assertFalse("handleSuccess", crFlags
[1]);
421 assertFalse("handleFailure", crFlags
[2]);
422 assertTrue("handleCancel", crFlags
[3]);
424 // Validate the first coalesced request
425 assertTrue("isCompleted", subRequest1
.isCompleted());
426 assertFalse("isFailed", subRequest1
.isFailed());
427 assertTrue("isCancelled", subRequest1
.isCancelled());
429 // Validate the second coalesced request
430 assertTrue("isCompleted", subRequest2
.isCompleted());
431 assertFalse("isFailed", subRequest2
.isFailed());
432 assertTrue("isCancelled", subRequest2
.isCancelled());
435 // ------------------------------------------------------------------------
437 // ------------------------------------------------------------------------
439 private static final String DIRECTORY
= "testfiles";
440 private static final String TEST_STREAM
= "A-Test-10K";
441 private static final int NB_EVENTS
= 5000;
442 private static final int BLOCK_SIZE
= 100;
444 // Initialize the test trace
445 private TmfTraceStub fTrace
= null;
447 private synchronized TmfTraceStub
setupTrace(String path
) {
448 if (fTrace
== null) {
450 URL location
= FileLocator
.find(TmfCoreTestPlugin
.getDefault().getBundle(), new Path(path
), null);
451 File test
= new File(FileLocator
.toFileURL(location
).toURI());
452 fTrace
= new TmfTraceStub(test
.getPath(), 500);
453 } catch (TmfTraceException e
) {
455 } catch (URISyntaxException e
) {
457 } catch (IOException e
) {
464 Vector
<ITmfEvent
> requestedEvents1
;
465 Vector
<ITmfEvent
> requestedEvents2
;
466 Vector
<ITmfEvent
> requestedEvents3
;
468 TmfEventRequest request1
;
469 TmfEventRequest request2
;
470 TmfEventRequest request3
;
472 ITmfDataProvider
[] providers
;
474 private static class TmfTestTriggerSignal
extends TmfSignal
{
475 public final boolean forceCancel
;
476 public final long fIndex
;
478 public TmfTestTriggerSignal(Object source
, long index
, boolean cancel
) {
480 forceCancel
= cancel
;
486 public void trigger(final TmfTestTriggerSignal signal
) {
488 TmfTimeRange range
= new TmfTimeRange(TmfTimestamp
.BIG_BANG
, TmfTimestamp
.BIG_CRUNCH
);
489 final long REQUEST_OFFSET
= 1000;
491 requestedEvents1
= new Vector
<ITmfEvent
>();
492 request1
= new TmfEventRequest(ITmfEvent
.class, range
, signal
.fIndex
, NB_EVENTS
, BLOCK_SIZE
) {
495 public void handleData(ITmfEvent event
) {
496 super.handleData(event
);
497 if (!isCompleted()) {
498 requestedEvents1
.add(event
);
499 if (++nbRead
>= BLOCK_SIZE
&& signal
.forceCancel
) {
506 requestedEvents2
= new Vector
<ITmfEvent
>();
507 request2
= new TmfEventRequest(ITmfEvent
.class, range
, signal
.fIndex
+ REQUEST_OFFSET
, NB_EVENTS
, BLOCK_SIZE
) {
509 public void handleData(ITmfEvent event
) {
510 super.handleData(event
);
511 if (!isCompleted()) {
512 requestedEvents2
.add(event
);
517 requestedEvents3
= new Vector
<ITmfEvent
>();
518 request3
= new TmfEventRequest(ITmfEvent
.class, range
, signal
.fIndex
+ 2 * REQUEST_OFFSET
, NB_EVENTS
, BLOCK_SIZE
) {
520 public void handleData(ITmfEvent event
) {
521 super.handleData(event
);
522 if (!isCompleted()) {
523 requestedEvents3
.add(event
);
528 providers
= TmfProviderManager
.getProviders(ITmfEvent
.class, TmfTraceStub
.class);
529 providers
[0].sendRequest(request1
);
530 providers
[0].sendRequest(request2
);
531 providers
[0].sendRequest(request3
);
534 public void runCoalescedRequest(long startIndex
) throws InterruptedException
{
536 fTrace
= setupTrace(DIRECTORY
+ File
.separator
+ TEST_STREAM
);
538 TmfSignalManager
.register(this);
539 TmfTestTriggerSignal signal
= new TmfTestTriggerSignal(this, startIndex
, false);
540 TmfSignalManager
.dispatchSignal(signal
);
542 request1
.waitForCompletion();
543 request2
.waitForCompletion();
544 request3
.waitForCompletion();
547 assertEquals("Request1: nbEvents", NB_EVENTS
, requestedEvents1
.size());
548 assertTrue("Request1: isCompleted", request1
.isCompleted());
549 assertFalse("Request1: isCancelled", request1
.isCancelled());
551 assertEquals("Request2: nbEvents", NB_EVENTS
, requestedEvents2
.size());
552 assertTrue("Request2: isCompleted", request2
.isCompleted());
553 assertFalse("Request2: isCancelled", request2
.isCancelled());
555 assertEquals("Request3: nbEvents", NB_EVENTS
, requestedEvents3
.size());
556 assertTrue("Request3: isCompleted", request3
.isCompleted());
557 assertFalse("Request3: isCancelled", request3
.isCancelled());
559 // Ensure that we have distinct events.
560 // Don't go overboard: we are not validating the stub!
561 for (int i
= 0; i
< NB_EVENTS
; i
++) {
562 assertEquals("Distinct events", i
+ 1 + request1
.getIndex(), requestedEvents1
.get(i
).getTimestamp().getValue());
563 assertEquals("Distinct events", i
+ 1 + request2
.getIndex(), requestedEvents2
.get(i
).getTimestamp().getValue());
564 assertEquals("Distinct events", i
+ 1 + request3
.getIndex(), requestedEvents3
.get(i
).getTimestamp().getValue());
567 TmfSignalManager
.deregister(this);
574 public void testCoalescedRequest() throws InterruptedException
{
575 runCoalescedRequest(0);
576 runCoalescedRequest(1);
577 runCoalescedRequest(5);
581 public void testCancelCoalescedRequest() throws InterruptedException
{
583 fTrace
= setupTrace(DIRECTORY
+ File
.separator
+ TEST_STREAM
);
585 TmfSignalManager
.register(this);
586 TmfTestTriggerSignal signal
= new TmfTestTriggerSignal(this, 0, true);
587 TmfSignalManager
.dispatchSignal(signal
);
589 request1
.waitForCompletion();
590 request2
.waitForCompletion();
591 request3
.waitForCompletion();
593 assertEquals("Request1: nbEvents", BLOCK_SIZE
, requestedEvents1
.size());
594 assertTrue("Request1: isCompleted", request1
.isCompleted());
595 assertTrue("Request1: isCancelled", request1
.isCancelled());
597 assertEquals("Request2: nbEvents", NB_EVENTS
, requestedEvents2
.size());
598 assertTrue("Request2: isCompleted", request2
.isCompleted());
599 assertFalse("Request2: isCancelled", request2
.isCancelled());
601 assertEquals("Request3: nbEvents", NB_EVENTS
, requestedEvents3
.size());
602 assertTrue("Request3: isCompleted", request3
.isCompleted());
603 assertFalse("Request3: isCancelled", request3
.isCancelled());
605 // Ensure that we have distinct events.
606 // Don't go overboard: we are not validating the stub!
607 for (int i
= 0; i
< BLOCK_SIZE
; i
++) {
608 assertEquals("Distinct events", i
+ 1 + request1
.getIndex(), requestedEvents1
.get(i
).getTimestamp().getValue());
610 for (int i
= 0; i
< NB_EVENTS
; i
++) {
611 assertEquals("Distinct events", i
+ 1 + request2
.getIndex(), requestedEvents2
.get(i
).getTimestamp().getValue());
612 assertEquals("Distinct events", i
+ 1 + request3
.getIndex(), requestedEvents3
.get(i
).getTimestamp().getValue());
615 TmfSignalManager
.deregister(this);