1 /*******************************************************************************
2 * Copyright (c) 2009, 2010 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 *******************************************************************************/
13 package org
.eclipse
.linuxtools
.tmf
.tests
.request
;
16 import java
.io
.IOException
;
17 import java
.net
.URISyntaxException
;
19 import java
.util
.Vector
;
21 import junit
.framework
.TestCase
;
23 import org
.eclipse
.core
.runtime
.FileLocator
;
24 import org
.eclipse
.core
.runtime
.Path
;
25 import org
.eclipse
.linuxtools
.tmf
.component
.ITmfDataProvider
;
26 import org
.eclipse
.linuxtools
.tmf
.component
.TmfProviderManager
;
27 import org
.eclipse
.linuxtools
.tmf
.event
.TmfEvent
;
28 import org
.eclipse
.linuxtools
.tmf
.event
.TmfEventReference
;
29 import org
.eclipse
.linuxtools
.tmf
.event
.TmfEventSource
;
30 import org
.eclipse
.linuxtools
.tmf
.event
.TmfEventType
;
31 import org
.eclipse
.linuxtools
.tmf
.event
.TmfTimeRange
;
32 import org
.eclipse
.linuxtools
.tmf
.event
.TmfTimestamp
;
33 import org
.eclipse
.linuxtools
.tmf
.request
.TmfCoalescedDataRequest
;
34 import org
.eclipse
.linuxtools
.tmf
.request
.TmfCoalescedEventRequest
;
35 import org
.eclipse
.linuxtools
.tmf
.request
.TmfEventRequest
;
36 import org
.eclipse
.linuxtools
.tmf
.request
.TmfEventRequestStub
;
37 import org
.eclipse
.linuxtools
.tmf
.signal
.TmfSignal
;
38 import org
.eclipse
.linuxtools
.tmf
.signal
.TmfSignalHandler
;
39 import org
.eclipse
.linuxtools
.tmf
.signal
.TmfSignalManager
;
40 import org
.eclipse
.linuxtools
.tmf
.tests
.TmfCoreTestPlugin
;
41 import org
.eclipse
.linuxtools
.tmf
.trace
.TmfTraceStub
;
42 import org
.osgi
.framework
.Bundle
;
45 * <b><u>TmfCoalescedEventRequestTest</u></b>
47 * Test suite for the TmfCoalescedEventRequest class.
49 public class TmfCoalescedEventRequestTest
extends TestCase
{
51 // ------------------------------------------------------------------------
53 // ------------------------------------------------------------------------
55 private static TmfTimeRange range1
= new TmfTimeRange(TmfTimeRange
.Eternity
);
56 private static TmfTimeRange range2
= new TmfTimeRange(new TmfTimestamp(), TmfTimestamp
.BigCrunch
);
58 private static TmfCoalescedEventRequest
<TmfEvent
> fRequest1
;
59 private static TmfCoalescedEventRequest
<TmfEvent
> fRequest2
;
60 private static TmfCoalescedEventRequest
<TmfEvent
> fRequest3
;
61 private static TmfCoalescedEventRequest
<TmfEvent
> fRequest4
;
63 private static TmfCoalescedEventRequest
<TmfEvent
> fRequest1b
;
64 private static TmfCoalescedEventRequest
<TmfEvent
> fRequest1c
;
66 private static int fRequestCount
;
68 // ------------------------------------------------------------------------
70 // ------------------------------------------------------------------------
72 public TmfCoalescedEventRequestTest(String name
) {
77 public void setUp() throws Exception
{
79 TmfEventRequest
.reset();
80 fRequest1
= new TmfCoalescedEventRequest
<TmfEvent
>(TmfEvent
.class, range1
, 100, 200);
81 fRequest2
= new TmfCoalescedEventRequest
<TmfEvent
>(TmfEvent
.class, range2
, 100, 200);
82 fRequest3
= new TmfCoalescedEventRequest
<TmfEvent
>(TmfEvent
.class, range2
, 200, 200);
83 fRequest4
= new TmfCoalescedEventRequest
<TmfEvent
>(TmfEvent
.class, range2
, 200, 300);
85 fRequest1b
= new TmfCoalescedEventRequest
<TmfEvent
>(TmfEvent
.class, range1
, 100, 200);
86 fRequest1c
= new TmfCoalescedEventRequest
<TmfEvent
>(TmfEvent
.class, range1
, 100, 200);
88 fRequestCount
= fRequest1c
.getRequestId() + 1;
92 public void tearDown() throws Exception
{
96 private TmfCoalescedEventRequest
<TmfEvent
> setupTestRequest(final boolean[] flags
) {
98 TmfCoalescedEventRequest
<TmfEvent
> request
= new TmfCoalescedEventRequest
<TmfEvent
>(TmfEvent
.class, range1
, 100, 200) {
100 public void handleCompleted() {
101 super.handleCompleted();
105 public void handleSuccess() {
106 super.handleSuccess();
110 public void handleFailure() {
111 super.handleFailure();
115 public void handleCancel() {
116 super.handleCancel();
123 // ------------------------------------------------------------------------
125 // ------------------------------------------------------------------------
127 public void testTmfCoalescedEventRequest() {
128 TmfCoalescedEventRequest
<TmfEvent
> request
= new TmfCoalescedEventRequest
<TmfEvent
>(TmfEvent
.class);
130 assertEquals("getRequestId", fRequestCount
++, request
.getRequestId());
131 assertEquals("getDataType", TmfEvent
.class, request
.getDataType());
133 assertEquals("getRange", range1
, request
.getRange());
134 assertEquals("getNbRequestedEvents", TmfEventRequest
.ALL_DATA
, request
.getNbRequested());
135 assertEquals("getBlockize", TmfEventRequest
.DEFAULT_BLOCK_SIZE
, request
.getBlockize());
137 assertFalse("isCompleted", request
.isCompleted());
138 assertFalse("isFailed", request
.isFailed());
139 assertFalse("isCancelled", request
.isCancelled());
141 assertEquals("getNbRead", 0, request
.getNbRead());
144 public void testTmfCoalescedEventRequestIndex() {
145 TmfCoalescedEventRequest
<TmfEvent
> request
= new TmfCoalescedEventRequest
<TmfEvent
>(TmfEvent
.class, range1
);
147 assertEquals("getRequestId", fRequestCount
++, request
.getRequestId());
148 assertEquals("getDataType", TmfEvent
.class, request
.getDataType());
150 assertEquals("getRange", range1
, request
.getRange());
151 assertEquals("getNbRequestedEvents", TmfEventRequest
.ALL_DATA
, request
.getNbRequested());
152 assertEquals("getBlockize", TmfEventRequest
.DEFAULT_BLOCK_SIZE
, request
.getBlockize());
154 assertFalse("isCompleted", request
.isCompleted());
155 assertFalse("isFailed", request
.isFailed());
156 assertFalse("isCancelled", request
.isCancelled());
158 assertEquals("getNbRead", 0, request
.getNbRead());
161 public void testTmfCoalescedEventRequestIndexNbRequested() {
162 TmfCoalescedEventRequest
<TmfEvent
> request
= new TmfCoalescedEventRequest
<TmfEvent
>(TmfEvent
.class, range1
, 100);
164 assertEquals("getRequestId", fRequestCount
++, request
.getRequestId());
165 assertEquals("getDataType", TmfEvent
.class, request
.getDataType());
167 assertEquals("getRange", range1
, request
.getRange());
168 assertEquals("getNbRequestedEvents", 100, request
.getNbRequested());
169 assertEquals("getBlockize", TmfEventRequest
.DEFAULT_BLOCK_SIZE
, request
.getBlockize());
171 assertFalse("isCompleted", request
.isCompleted());
172 assertFalse("isFailed", request
.isFailed());
173 assertFalse("isCancelled", request
.isCancelled());
175 assertEquals("getNbRead", 0, request
.getNbRead());
178 public void testTmfCoalescedEventRequestIndexNbEventsBlocksize() {
179 TmfCoalescedEventRequest
<TmfEvent
> request
= new TmfCoalescedEventRequest
<TmfEvent
>(TmfEvent
.class, range1
, 100, 200);
181 assertEquals("getRequestId", fRequestCount
++, request
.getRequestId());
182 assertEquals("getDataType", TmfEvent
.class, request
.getDataType());
184 assertEquals("getRange", range1
, request
.getRange());
185 assertEquals("getNbRequestedEvents", 100, request
.getNbRequested());
186 assertEquals("getBlockize", 200, request
.getBlockize());
188 assertFalse("isCompleted", request
.isCompleted());
189 assertFalse("isFailed", request
.isFailed());
190 assertFalse("isCancelled", request
.isCancelled());
192 assertEquals("getNbRead", 0, request
.getNbRead());
195 // ------------------------------------------------------------------------
197 // ------------------------------------------------------------------------
199 public void testEqualsReflexivity() throws Exception
{
200 assertTrue("equals", fRequest1
.equals(fRequest1
));
201 assertTrue("equals", fRequest2
.equals(fRequest2
));
203 assertFalse("equals", fRequest1
.equals(fRequest2
));
204 assertFalse("equals", fRequest2
.equals(fRequest1
));
207 public void testEqualsSymmetry() throws Exception
{
208 assertTrue("equals", fRequest1
.equals(fRequest1b
));
209 assertTrue("equals", fRequest1b
.equals(fRequest1
));
211 assertFalse("equals", fRequest1
.equals(fRequest3
));
212 assertFalse("equals", fRequest2
.equals(fRequest3
));
213 assertFalse("equals", fRequest3
.equals(fRequest1
));
214 assertFalse("equals", fRequest3
.equals(fRequest2
));
217 public void testEqualsTransivity() throws Exception
{
218 assertTrue("equals", fRequest1
.equals(fRequest1b
));
219 assertTrue("equals", fRequest1b
.equals(fRequest1c
));
220 assertTrue("equals", fRequest1
.equals(fRequest1c
));
223 public void testEqualsNull() throws Exception
{
224 assertFalse("equals", fRequest1
.equals(null));
225 assertFalse("equals", fRequest2
.equals(null));
228 public void testEqualsSuper() throws Exception
{
229 TmfCoalescedDataRequest
<TmfEvent
> dataRequest1
= new TmfCoalescedDataRequest
<TmfEvent
>(
230 fRequest1
.getDataType(), fRequest1
.getIndex(), fRequest1
.getNbRequested(), fRequest1
.getBlockize());
231 TmfCoalescedDataRequest
<TmfEvent
> dataRequest2
= new TmfCoalescedDataRequest
<TmfEvent
>(
232 fRequest1
.getDataType(), fRequest1
.getIndex(), fRequest1
.getNbRequested(), fRequest1
.getBlockize());
233 TmfCoalescedDataRequest
<TmfEvent
> dataRequest3
= new TmfCoalescedDataRequest
<TmfEvent
>(
234 fRequest3
.getDataType(), fRequest3
.getIndex(), fRequest3
.getNbRequested(), fRequest3
.getBlockize());
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 // ------------------------------------------------------------------------
246 public void testHashCode() throws Exception
{
247 assertTrue("hashCode", fRequest1
.hashCode() == fRequest1
.hashCode());
248 assertTrue("hashCode", fRequest2
.hashCode() == fRequest2
.hashCode());
249 assertTrue("hashCode", fRequest1
.hashCode() != fRequest2
.hashCode());
252 // ------------------------------------------------------------------------
254 // ------------------------------------------------------------------------
256 public void testToString() {
257 String expected1
= "[TmfCoalescedEventRequest(0,TmfEvent," + range1
+ ",100,200)]";
258 String expected2
= "[TmfCoalescedEventRequest(1,TmfEvent," + range2
+ ",100,200)]";
259 String expected3
= "[TmfCoalescedEventRequest(2,TmfEvent," + range2
+ ",200,200)]";
260 String expected4
= "[TmfCoalescedEventRequest(3,TmfEvent," + range2
+ ",200,300)]";
262 assertEquals("toString", expected1
, fRequest1
.toString());
263 assertEquals("toString", expected2
, fRequest2
.toString());
264 assertEquals("toString", expected3
, fRequest3
.toString());
265 assertEquals("toString", expected4
, fRequest4
.toString());
268 // ------------------------------------------------------------------------
270 // ------------------------------------------------------------------------
272 public void testIsCompatible() {
273 TmfCoalescedEventRequest
<TmfEvent
> coalescedRequest
= new TmfCoalescedEventRequest
<TmfEvent
>(TmfEvent
.class, range1
, 100, 200);
274 TmfEventRequest
<TmfEvent
> request1
= new TmfEventRequestStub
<TmfEvent
>(TmfEvent
.class, range1
, 100, 200);
275 // TmfEventRequest<TmfEvent> request2 = new TmfEventRequestStub<TmfEvent>(TmfEvent.class, range2, 100, 200);
276 // TmfEventRequest<TmfEvent> request3 = new TmfEventRequestStub<TmfEvent>(TmfEvent.class, range1, 101, 200);
277 // TmfEventRequest<TmfEvent> request4 = new TmfEventRequestStub<TmfEvent>(TmfEvent.class, range1, 100, 201);
278 // TmfDataRequest<TmfEvent> request5 = new TmfDataRequestStub<TmfEvent> (TmfEvent.class, 10, 100, 201);
280 assertTrue ("isCompatible", coalescedRequest
.isCompatible(request1
));
281 // assertFalse("isCompatible", coalescedRequest.isCompatible(request2));
282 // assertFalse("isCompatible", coalescedRequest.isCompatible(request3));
283 // assertFalse("isCompatible", coalescedRequest.isCompatible(request4));
284 // assertFalse("isCompatible", coalescedRequest.isCompatible(request5));
287 // ------------------------------------------------------------------------
289 // ------------------------------------------------------------------------
291 public void testSetData() {
293 TmfCoalescedEventRequest
<TmfEvent
> coalescedRequest
= new TmfCoalescedEventRequest
<TmfEvent
>(TmfEvent
.class, range1
, 100, 200);
294 TmfEventRequest
<TmfEvent
> request1
= new TmfEventRequestStub
<TmfEvent
>(TmfEvent
.class, range1
, 100, 200);
295 TmfEventRequest
<TmfEvent
> request2
= new TmfEventRequestStub
<TmfEvent
>(TmfEvent
.class, range1
, 100, 200);
296 coalescedRequest
.addRequest(request1
);
297 coalescedRequest
.addRequest(request2
);
299 // Initialize the data
301 TmfEvent
[] events
= new TmfEvent
[nbEvents
];
302 for (int i
= 0; i
< nbEvents
; i
++) {
303 events
[i
] = new TmfEvent(new TmfTimestamp(i
), new TmfEventSource(),
304 new TmfEventType(), new TmfEventReference());
307 coalescedRequest
.setData(events
);
308 coalescedRequest
.handleData();
310 // Validate the coalescing request
311 assertEquals("setData", nbEvents
, coalescedRequest
.getNbRead());
312 TmfEvent
[] eventsRead1
= coalescedRequest
.getData();
313 assertEquals("getData", nbEvents
, eventsRead1
.length
);
314 for (int i
= 0; i
< nbEvents
; i
++) {
315 assertEquals("getData", i
, eventsRead1
[i
].getTimestamp().getValue());
318 // Validate the first coalesced request
319 assertEquals("setData", nbEvents
, request1
.getNbRead());
320 TmfEvent
[] eventsRead2
= request1
.getData();
321 assertEquals("getData", nbEvents
, eventsRead2
.length
);
322 for (int i
= 0; i
< nbEvents
; i
++) {
323 assertEquals("getData", i
, eventsRead2
[i
].getTimestamp().getValue());
326 // Validate the second coalesced request
327 assertEquals("setData", nbEvents
, request2
.getNbRead());
328 TmfEvent
[] eventsRead3
= request2
.getData();
329 assertEquals("getData", nbEvents
, eventsRead3
.length
);
330 for (int i
= 0; i
< nbEvents
; i
++) {
331 assertEquals("getData", i
, eventsRead3
[i
].getTimestamp().getValue());
335 // ------------------------------------------------------------------------
337 // ------------------------------------------------------------------------
339 public void testDone() {
342 final boolean[] crFlags
= new boolean[4];
343 TmfCoalescedEventRequest
<TmfEvent
> request
= setupTestRequest(crFlags
);
344 TmfEventRequest
<TmfEvent
> subRequest1
= new TmfEventRequestStub
<TmfEvent
>(TmfEvent
.class, range1
, 100, 200);
345 TmfEventRequest
<TmfEvent
> subRequest2
= new TmfEventRequestStub
<TmfEvent
>(TmfEvent
.class, range1
, 100, 200);
346 request
.addRequest(subRequest1
);
347 request
.addRequest(subRequest2
);
351 // Validate the coalescing request
352 assertTrue ("isCompleted", request
.isCompleted());
353 assertFalse("isFailed", request
.isFailed());
354 assertFalse("isCancelled", request
.isCancelled());
356 assertTrue ("handleCompleted", crFlags
[0]);
357 assertTrue ("handleSuccess", crFlags
[1]);
358 assertFalse("handleFailure", crFlags
[2]);
359 assertFalse("handleCancel", crFlags
[3]);
361 // Validate the first coalesced request
362 assertTrue ("isCompleted", subRequest1
.isCompleted());
363 assertFalse("isFailed", subRequest1
.isFailed());
364 assertFalse("isCancelled", subRequest1
.isCancelled());
366 // Validate the second coalesced request
367 assertTrue ("isCompleted", subRequest2
.isCompleted());
368 assertFalse("isFailed", subRequest2
.isFailed());
369 assertFalse("isCancelled", subRequest2
.isCancelled());
372 // ------------------------------------------------------------------------
374 // ------------------------------------------------------------------------
376 public void testFail() {
378 final boolean[] crFlags
= new boolean[4];
379 TmfCoalescedEventRequest
<TmfEvent
> request
= setupTestRequest(crFlags
);
380 TmfEventRequest
<TmfEvent
> subRequest1
= new TmfEventRequestStub
<TmfEvent
>(TmfEvent
.class, range1
, 100, 200);
381 TmfEventRequest
<TmfEvent
> subRequest2
= new TmfEventRequestStub
<TmfEvent
>(TmfEvent
.class, range1
, 100, 200);
382 request
.addRequest(subRequest1
);
383 request
.addRequest(subRequest2
);
387 // Validate the coalescing request
388 assertTrue ("isCompleted", request
.isCompleted());
389 assertTrue ("isFailed", request
.isFailed());
390 assertFalse("isCancelled", request
.isCancelled());
392 assertTrue ("handleCompleted", crFlags
[0]);
393 assertFalse("handleSuccess", crFlags
[1]);
394 assertTrue ("handleFailure", crFlags
[2]);
395 assertFalse("handleCancel", crFlags
[3]);
397 // Validate the first coalesced request
398 assertTrue ("isCompleted", subRequest1
.isCompleted());
399 assertTrue ("isFailed", subRequest1
.isFailed());
400 assertFalse("isCancelled", subRequest1
.isCancelled());
402 // Validate the second coalesced request
403 assertTrue ("isCompleted", subRequest2
.isCompleted());
404 assertTrue ("isFailed", subRequest2
.isFailed());
405 assertFalse("isCancelled", subRequest2
.isCancelled());
408 // ------------------------------------------------------------------------
410 // ------------------------------------------------------------------------
412 public void testCancel() {
414 final boolean[] crFlags
= new boolean[4];
415 TmfCoalescedEventRequest
<TmfEvent
> request
= setupTestRequest(crFlags
);
416 TmfEventRequest
<TmfEvent
> subRequest1
= new TmfEventRequestStub
<TmfEvent
>(TmfEvent
.class, range1
, 100, 200);
417 TmfEventRequest
<TmfEvent
> subRequest2
= new TmfEventRequestStub
<TmfEvent
>(TmfEvent
.class, range1
, 100, 200);
418 request
.addRequest(subRequest1
);
419 request
.addRequest(subRequest2
);
423 // Validate the coalescing request
424 assertTrue ("isCompleted", request
.isCompleted());
425 assertFalse("isFailed", request
.isFailed());
426 assertTrue ("isCancelled", request
.isCancelled());
428 assertTrue ("handleCompleted", crFlags
[0]);
429 assertFalse("handleSuccess", crFlags
[1]);
430 assertFalse("handleFailure", crFlags
[2]);
431 assertTrue ("handleCancel", crFlags
[3]);
433 // Validate the first coalesced request
434 assertTrue ("isCompleted", subRequest1
.isCompleted());
435 assertFalse("isFailed", subRequest1
.isFailed());
436 assertTrue ("isCancelled", subRequest1
.isCancelled());
438 // Validate the second coalesced request
439 assertTrue ("isCompleted", subRequest2
.isCompleted());
440 assertFalse("isFailed", subRequest2
.isFailed());
441 assertTrue ("isCancelled", subRequest2
.isCancelled());
444 // ------------------------------------------------------------------------
446 // ------------------------------------------------------------------------
448 // ------------------------------------------------------------------------
450 // ------------------------------------------------------------------------
452 private static final String DIRECTORY
= "testfiles";
453 private static final String TEST_STREAM
= "A-Test-10K";
454 private static final int NB_EVENTS
= 10000;
455 private static final int BLOCK_SIZE
= 100;
457 // Initialize the test trace
458 private static TmfTraceStub fTrace
= null;
459 private synchronized TmfTraceStub
setupTrace(String path
) {
460 if (fTrace
== null) {
462 URL location
= FileLocator
.find(TmfCoreTestPlugin
.getDefault().getBundle(), new Path(path
), null);
463 File test
= new File(FileLocator
.toFileURL(location
).toURI());
464 fTrace
= new TmfTraceStub(test
.getPath(), 500);
465 } catch (URISyntaxException e
) {
467 } catch (IOException e
) {
474 Vector
<TmfEvent
> requestedEvents1
;
475 Vector
<TmfEvent
> requestedEvents2
;
476 Vector
<TmfEvent
> requestedEvents3
;
478 TmfEventRequest
<TmfEvent
> request1
;
479 TmfEventRequest
<TmfEvent
> request2
;
480 TmfEventRequest
<TmfEvent
> request3
;
482 ITmfDataProvider
<TmfEvent
>[] providers
;
484 private class TmfTestTriggerSignal
extends TmfSignal
{
485 public final boolean forceCancel
;
486 public TmfTestTriggerSignal(Object source
, boolean cancel
) {
488 forceCancel
= cancel
;
493 @SuppressWarnings("unchecked")
495 public void trigger(final TmfTestTriggerSignal signal
) {
497 TmfTimeRange range
= new TmfTimeRange(TmfTimestamp
.BigBang
, TmfTimestamp
.BigCrunch
);
499 requestedEvents1
= new Vector
<TmfEvent
>();
500 request1
= new TmfEventRequest
<TmfEvent
>(TmfEvent
.class, range
, NB_EVENTS
, BLOCK_SIZE
) {
502 public void handleData() {
503 if (!isCompleted()) {
504 TmfEvent
[] events
= getData();
505 for (TmfEvent e
: events
) {
506 requestedEvents1
.add(e
);
508 if (signal
.forceCancel
)
514 requestedEvents2
= new Vector
<TmfEvent
>();
515 request2
= new TmfEventRequest
<TmfEvent
>(TmfEvent
.class, range
, NB_EVENTS
, BLOCK_SIZE
) {
517 public void handleData() {
518 if (!isCompleted()) {
519 TmfEvent
[] events
= getData();
520 for (TmfEvent e
: events
) {
521 requestedEvents2
.add(e
);
527 requestedEvents3
= new Vector
<TmfEvent
>();
528 request3
= new TmfEventRequest
<TmfEvent
>(TmfEvent
.class, range
, NB_EVENTS
, BLOCK_SIZE
) {
530 public void handleData() {
531 if (!isCompleted()) {
532 TmfEvent
[] events
= getData();
533 for (TmfEvent e
: events
) {
534 requestedEvents3
.add(e
);
540 providers
= (ITmfDataProvider
<TmfEvent
>[]) TmfProviderManager
.getProviders(TmfEvent
.class, TmfTraceStub
.class);
541 providers
[0].sendRequest(request1
);
542 providers
[0].sendRequest(request2
);
543 providers
[0].sendRequest(request3
);
546 // public void testCoalescedRequest() throws Exception {
548 // fTrace = setupTrace(DIRECTORY + File.separator + TEST_STREAM);
550 // TmfSignalManager.register(this);
551 // TmfTestTriggerSignal signal = new TmfTestTriggerSignal(this, false);
552 // TmfSignalManager.dispatchSignal(signal);
554 // request1.waitForCompletion();
555 // request2.waitForCompletion();
556 // request3.waitForCompletion();
558 // assertEquals("Request1: nbEvents", NB_EVENTS, requestedEvents1.size());
559 // assertTrue ("Request1: isCompleted", request1.isCompleted());
560 // assertFalse ("Request1: isCancelled", request1.isCancelled());
562 // assertEquals("Request2: nbEvents", NB_EVENTS, requestedEvents2.size());
563 // assertTrue ("Request2: isCompleted", request2.isCompleted());
564 // assertFalse ("Request2: isCancelled", request2.isCancelled());
566 // assertEquals("Request3: nbEvents", NB_EVENTS, requestedEvents3.size());
567 // assertTrue ("Request3: isCompleted", request3.isCompleted());
568 // assertFalse ("Request3: isCancelled", request3.isCancelled());
570 // // Ensure that we have distinct events.
571 // // Don't go overboard: we are not validating the stub!
572 // for (int i = 0; i < NB_EVENTS; i++) {
573 // assertEquals("Distinct events", i+1, requestedEvents1.get(i).getTimestamp().getValue());
574 // assertEquals("Distinct events", i+1, requestedEvents2.get(i).getTimestamp().getValue());
575 // assertEquals("Distinct events", i+1, requestedEvents3.get(i).getTimestamp().getValue());
578 // TmfSignalManager.deregister(this);
583 // public void testCancelCoalescedRequest() throws Exception {
585 // fTrace = setupTrace(DIRECTORY + File.separator + TEST_STREAM);
587 // TmfSignalManager.register(this);
588 // TmfTestTriggerSignal signal = new TmfTestTriggerSignal(this, true);
589 // TmfSignalManager.dispatchSignal(signal);
591 // request1.waitForCompletion();
592 // request2.waitForCompletion();
593 // request3.waitForCompletion();
595 // assertEquals("Request1: nbEvents", BLOCK_SIZE, requestedEvents1.size());
596 // assertTrue ("Request1: isCompleted", request1.isCompleted());
597 // assertTrue ("Request1: isCancelled", request1.isCancelled());
599 // assertEquals("Request2: nbEvents", NB_EVENTS, requestedEvents2.size());
600 // assertTrue ("Request2: isCompleted", request2.isCompleted());
601 // assertFalse ("Request2: isCancelled", request2.isCancelled());
603 // assertEquals("Request3: nbEvents", NB_EVENTS, requestedEvents3.size());
604 // assertTrue ("Request3: isCompleted", request3.isCompleted());
605 // assertFalse ("Request3: isCancelled", request3.isCancelled());
607 // // Ensure that we have distinct events.
608 // // Don't go overboard: we are not validating the stub!
609 // for (int i = 0; i < NB_EVENTS; i++) {
610 // assertEquals("Distinct events", i+1, requestedEvents2.get(i).getTimestamp().getValue());
611 // assertEquals("Distinct events", i+1, requestedEvents3.get(i).getTimestamp().getValue());
614 // TmfSignalManager.deregister(this);