|
4 | 4 | import org.reactivestreams.Publisher;
|
5 | 5 | import org.reactivestreams.Subscriber;
|
6 | 6 | import org.reactivestreams.Subscription;
|
7 |
| -import org.reactivestreams.tck.Annotations.Subscribers; |
| 7 | +import org.reactivestreams.tck.Annotations.*; |
8 | 8 | import org.reactivestreams.tck.TestEnvironment.ManualPublisher;
|
9 | 9 | import org.reactivestreams.tck.TestEnvironment.ManualSubscriber;
|
10 | 10 | import org.reactivestreams.tck.TestEnvironment.ManualSubscriberWithSubscriptionSupport;
|
11 | 11 | import org.reactivestreams.tck.TestEnvironment.Promise;
|
12 | 12 | import org.reactivestreams.tck.support.Function;
|
| 13 | +import org.reactivestreams.tck.support.SubscriberWhiteboxVerificationRules; |
| 14 | +import org.reactivestreams.tck.support.PublisherVerificationRules; |
13 | 15 | import org.testng.annotations.BeforeMethod;
|
14 | 16 | import org.testng.annotations.Test;
|
15 | 17 |
|
16 | 18 | import java.util.HashSet;
|
17 | 19 | import java.util.Set;
|
18 | 20 |
|
19 |
| -public abstract class IdentityProcessorVerification<T> { |
| 21 | +public abstract class IdentityProcessorVerification<T> implements SubscriberWhiteboxVerificationRules, PublisherVerificationRules { |
20 | 22 |
|
21 | 23 | private final TestEnvironment env;
|
22 | 24 |
|
@@ -212,154 +214,154 @@ public void createPublisher3MustProduceAStreamOfExactly3Elements() throws Throwa
|
212 | 214 | publisherVerification.createPublisher3MustProduceAStreamOfExactly3Elements();
|
213 | 215 | }
|
214 | 216 |
|
215 |
| - @Test |
| 217 | + @Override @Required @Test |
216 | 218 | public void spec101_subscriptionRequestMustResultInTheCorrectNumberOfProducedElements() throws Throwable {
|
217 | 219 | publisherVerification.spec101_subscriptionRequestMustResultInTheCorrectNumberOfProducedElements();
|
218 | 220 | }
|
219 | 221 |
|
220 |
| - @Test |
| 222 | + @Override @Required @Test |
221 | 223 | public void spec102_maySignalLessThanRequestedAndTerminateSubscription() throws Throwable {
|
222 | 224 | publisherVerification.spec102_maySignalLessThanRequestedAndTerminateSubscription();
|
223 | 225 | }
|
224 | 226 |
|
225 |
| - @Test |
| 227 | + @Override @Stochastic @Test |
226 | 228 | public void spec103_mustSignalOnMethodsSequentially() throws Throwable {
|
227 | 229 | publisherVerification.spec103_mustSignalOnMethodsSequentially();
|
228 | 230 | }
|
229 | 231 |
|
230 |
| - @Test |
| 232 | + @Override @Additional(implement = "createErrorStatePublisher") @Test |
231 | 233 | public void spec104_mustSignalOnErrorWhenFails() throws Throwable {
|
232 | 234 | publisherVerification.spec104_mustSignalOnErrorWhenFails();
|
233 | 235 | }
|
234 | 236 |
|
235 |
| - @Test |
| 237 | + @Override @Required @Test |
236 | 238 | public void spec105_mustSignalOnCompleteWhenFiniteStreamTerminates() throws Throwable {
|
237 | 239 | publisherVerification.spec105_mustSignalOnCompleteWhenFiniteStreamTerminates();
|
238 | 240 | }
|
239 | 241 |
|
240 |
| - @Test |
| 242 | + @Override @NotVerified @Test |
241 | 243 | public void spec106_mustConsiderSubscriptionCancelledAfterOnErrorOrOnCompleteHasBeenCalled() throws Throwable {
|
242 | 244 | publisherVerification.spec106_mustConsiderSubscriptionCancelledAfterOnErrorOrOnCompleteHasBeenCalled();
|
243 | 245 | }
|
244 | 246 |
|
245 |
| - @Test |
| 247 | + @Override @Required @Test |
246 | 248 | public void spec107_mustNotEmitFurtherSignalsOnceOnCompleteHasBeenSignalled() throws Throwable {
|
247 | 249 | publisherVerification.spec107_mustNotEmitFurtherSignalsOnceOnCompleteHasBeenSignalled();
|
248 | 250 | }
|
249 | 251 |
|
250 |
| - @Test |
| 252 | + @Override @NotVerified @Test |
251 | 253 | public void spec107_mustNotEmitFurtherSignalsOnceOnErrorHasBeenSignalled() throws Throwable {
|
252 | 254 | publisherVerification.spec107_mustNotEmitFurtherSignalsOnceOnErrorHasBeenSignalled();
|
253 | 255 | }
|
254 | 256 |
|
255 |
| - @Test |
| 257 | + @Override @NotVerified @Test |
256 | 258 | public void spec108_possiblyCanceledSubscriptionShouldNotReceiveOnErrorOrOnCompleteSignals() throws Throwable {
|
257 | 259 | publisherVerification.spec108_possiblyCanceledSubscriptionShouldNotReceiveOnErrorOrOnCompleteSignals();
|
258 | 260 | }
|
259 | 261 |
|
260 |
| - @Test |
| 262 | + @Override @NotVerified @Test |
261 | 263 | public void spec109_subscribeShouldNotThrowNonFatalThrowable() throws Throwable {
|
262 | 264 | publisherVerification.spec109_subscribeShouldNotThrowNonFatalThrowable();
|
263 | 265 | }
|
264 | 266 |
|
265 |
| - @Test |
| 267 | + @Override @NotVerified @Test |
266 | 268 | public void spec110_rejectASubscriptionRequestIfTheSameSubscriberSubscribesTwice() throws Throwable {
|
267 | 269 | publisherVerification.spec110_rejectASubscriptionRequestIfTheSameSubscriberSubscribesTwice();
|
268 | 270 | }
|
269 | 271 |
|
270 |
| - @Test |
| 272 | + @Override @Additional @Test |
271 | 273 | public void spec111_maySupportMultiSubscribe() throws Throwable {
|
272 | 274 | publisherVerification.spec111_maySupportMultiSubscribe();
|
273 | 275 | }
|
274 | 276 |
|
275 |
| - @Test |
| 277 | + @Override @Additional(implement = "createErrorStatePublisher") @Test |
276 | 278 | public void spec112_mayRejectCallsToSubscribeIfPublisherIsUnableOrUnwillingToServeThemRejectionMustTriggerOnErrorInsteadOfOnSubscribe() throws Throwable {
|
277 | 279 | publisherVerification.spec112_mayRejectCallsToSubscribeIfPublisherIsUnableOrUnwillingToServeThemRejectionMustTriggerOnErrorInsteadOfOnSubscribe();
|
278 | 280 | }
|
279 | 281 |
|
280 |
| - @Test |
| 282 | + @Override @Required @Test |
281 | 283 | public void spec113_mustProduceTheSameElementsInTheSameSequenceToAllOfItsSubscribersWhenRequestingOneByOne() throws Throwable {
|
282 | 284 | publisherVerification.spec113_mustProduceTheSameElementsInTheSameSequenceToAllOfItsSubscribersWhenRequestingOneByOne();
|
283 | 285 | }
|
284 | 286 |
|
285 |
| - @Test |
| 287 | + @Override @Required @Test |
286 | 288 | public void spec113_mustProduceTheSameElementsInTheSameSequenceToAllOfItsSubscribersWhenRequestingManyUpfront() throws Throwable {
|
287 | 289 | publisherVerification.spec113_mustProduceTheSameElementsInTheSameSequenceToAllOfItsSubscribersWhenRequestingManyUpfront();
|
288 | 290 | }
|
289 | 291 |
|
290 |
| - @Test |
| 292 | + @Override @Required @Test |
291 | 293 | public void spec113_mustProduceTheSameElementsInTheSameSequenceToAllOfItsSubscribersWhenRequestingManyUpfrontAndCompleteAsExpected() throws Throwable {
|
292 | 294 | publisherVerification.spec113_mustProduceTheSameElementsInTheSameSequenceToAllOfItsSubscribersWhenRequestingManyUpfrontAndCompleteAsExpected();
|
293 | 295 | }
|
294 | 296 |
|
295 |
| - @Test |
| 297 | + @Override @Required @Test |
296 | 298 | public void spec302_mustAllowSynchronousRequestCallsFromOnNextAndOnSubscribe() throws Throwable {
|
297 | 299 | publisherVerification.spec302_mustAllowSynchronousRequestCallsFromOnNextAndOnSubscribe();
|
298 | 300 | }
|
299 | 301 |
|
300 |
| - @Test |
| 302 | + @Override @Required @Test @Additional(implement = "boundedDepthOfOnNextAndRequestRecursion") // FIXME @Required + @Additional? Really? |
301 | 303 | public void spec303_mustNotAllowUnboundedRecursion() throws Throwable {
|
302 | 304 | publisherVerification.spec303_mustNotAllowUnboundedRecursion();
|
303 | 305 | }
|
304 | 306 |
|
305 |
| - @Test |
| 307 | + @Override @NotVerified @Test |
306 | 308 | public void spec304_requestShouldNotPerformHeavyComputations() throws Exception {
|
307 | 309 | publisherVerification.spec304_requestShouldNotPerformHeavyComputations();
|
308 | 310 | }
|
309 | 311 |
|
310 |
| - @Test |
| 312 | + @Override @NotVerified @Test |
311 | 313 | public void spec305_cancelMustNotSynchronouslyPerformHeavyCompuatation() throws Exception {
|
312 | 314 | publisherVerification.spec305_cancelMustNotSynchronouslyPerformHeavyCompuatation();
|
313 | 315 | }
|
314 | 316 |
|
315 |
| - @Test |
| 317 | + @Override @Required @Test |
316 | 318 | public void spec306_afterSubscriptionIsCancelledRequestMustBeNops() throws Throwable {
|
317 | 319 | publisherVerification.spec306_afterSubscriptionIsCancelledRequestMustBeNops();
|
318 | 320 | }
|
319 | 321 |
|
320 |
| - @Test |
| 322 | + @Override @Required @Test |
321 | 323 | public void spec307_afterSubscriptionIsCancelledAdditionalCancelationsMustBeNops() throws Throwable {
|
322 | 324 | publisherVerification.spec307_afterSubscriptionIsCancelledAdditionalCancelationsMustBeNops();
|
323 | 325 | }
|
324 | 326 |
|
325 |
| - @Test |
| 327 | + @Override @Required @Test |
326 | 328 | public void spec309_requestZeroMustSignalIllegalArgumentException() throws Throwable {
|
327 | 329 | publisherVerification.spec309_requestZeroMustSignalIllegalArgumentException();
|
328 | 330 | }
|
329 | 331 |
|
330 |
| - @Test |
| 332 | + @Override @Required @Test |
331 | 333 | public void spec309_requestNegativeNumberMustSignalIllegalArgumentException() throws Throwable {
|
332 | 334 | publisherVerification.spec309_requestNegativeNumberMustSignalIllegalArgumentException();
|
333 | 335 | }
|
334 | 336 |
|
335 |
| - @Test |
| 337 | + @Override @Required @Test |
336 | 338 | public void spec312_cancelMustMakeThePublisherToEventuallyStopSignaling() throws Throwable {
|
337 | 339 | publisherVerification.spec312_cancelMustMakeThePublisherToEventuallyStopSignaling();
|
338 | 340 | }
|
339 | 341 |
|
340 |
| - @Test |
| 342 | + @Override @Required @Test |
341 | 343 | public void spec313_cancelMustMakeThePublisherEventuallyDropAllReferencesToTheSubscriber() throws Throwable {
|
342 | 344 | publisherVerification.spec313_cancelMustMakeThePublisherEventuallyDropAllReferencesToTheSubscriber();
|
343 | 345 | }
|
344 | 346 |
|
345 |
| - @Test |
| 347 | + @Override @Required @Test |
346 | 348 | public void spec317_mustSupportAPendingElementCountUpToLongMaxValue() throws Throwable {
|
347 | 349 | publisherVerification.spec317_mustSupportAPendingElementCountUpToLongMaxValue();
|
348 | 350 | }
|
349 | 351 |
|
350 |
| - @Test |
| 352 | + @Override @Required @Test |
351 | 353 | public void spec317_mustSupportACumulativePendingElementCountUpToLongMaxValue() throws Throwable {
|
352 | 354 | publisherVerification.spec317_mustSupportACumulativePendingElementCountUpToLongMaxValue();
|
353 | 355 | }
|
354 | 356 |
|
355 |
| - @Test |
| 357 | + @Override @Required @Test |
356 | 358 | public void spec317_mustSignalOnErrorWhenPendingAboveLongMaxValue() throws Throwable {
|
357 | 359 | publisherVerification.spec317_mustSignalOnErrorWhenPendingAboveLongMaxValue();
|
358 | 360 | }
|
359 | 361 |
|
360 | 362 | // Verifies rule: https://github.com/reactive-streams/reactive-streams#1.4
|
361 | 363 | // for multiple subscribers
|
362 |
| - @Test @Subscribers(2) |
| 364 | + @Test @Subscribers(2) // @Override FIXME Is this test specific for IdentityProcessorVerification or was it intending to be an override? |
363 | 365 | public void spec104_mustCallOnErrorOnAllItsSubscribersIfItEncountersANonRecoverableError() throws Throwable {
|
364 | 366 | optionalMultipleSubscribersTest(2, new Function<Long,TestSetup>() {
|
365 | 367 | @Override
|
@@ -469,117 +471,117 @@ public void exerciseWhiteboxHappyPath() throws Throwable {
|
469 | 471 | subscriberVerification.exerciseWhiteboxHappyPath();
|
470 | 472 | }
|
471 | 473 |
|
472 |
| - @Test |
| 474 | + @Override @Required @Test |
473 | 475 | public void spec201_mustSignalDemandViaSubscriptionRequest() throws Throwable {
|
474 | 476 | subscriberVerification.spec201_mustSignalDemandViaSubscriptionRequest();
|
475 | 477 | }
|
476 | 478 |
|
477 |
| - @Test |
| 479 | + @Override @NotVerified @Test |
478 | 480 | public void spec202_shouldAsynchronouslyDispatch() throws Exception {
|
479 | 481 | subscriberVerification.spec202_shouldAsynchronouslyDispatch();
|
480 | 482 | }
|
481 | 483 |
|
482 |
| - @Test |
| 484 | + @Override @Required @Test |
483 | 485 | public void spec203_mustNotCallMethodsOnSubscriptionOrPublisherInOnComplete() throws Throwable {
|
484 | 486 | subscriberVerification.spec203_mustNotCallMethodsOnSubscriptionOrPublisherInOnComplete();
|
485 | 487 | }
|
486 | 488 |
|
487 |
| - @Test |
| 489 | + @Override @Required @Test |
488 | 490 | public void spec203_mustNotCallMethodsOnSubscriptionOrPublisherInOnError() throws Throwable {
|
489 | 491 | subscriberVerification.spec203_mustNotCallMethodsOnSubscriptionOrPublisherInOnError();
|
490 | 492 | }
|
491 | 493 |
|
492 |
| - @Test |
| 494 | + @Override @NotVerified @Test |
493 | 495 | public void spec204_mustConsiderTheSubscriptionAsCancelledInAfterRecievingOnCompleteOrOnError() throws Exception {
|
494 | 496 | subscriberVerification.spec204_mustConsiderTheSubscriptionAsCancelledInAfterRecievingOnCompleteOrOnError();
|
495 | 497 | }
|
496 | 498 |
|
497 |
| - @Test |
| 499 | + @Override @Required @Test |
498 | 500 | public void spec205_mustCallSubscriptionCancelIfItAlreadyHasAnSubscriptionAndReceivesAnotherOnSubscribeSignal() throws Exception {
|
499 | 501 | subscriberVerification.spec205_mustCallSubscriptionCancelIfItAlreadyHasAnSubscriptionAndReceivesAnotherOnSubscribeSignal();
|
500 | 502 | }
|
501 | 503 |
|
502 |
| - @Test |
| 504 | + @Override @NotVerified @Test |
503 | 505 | public void spec206_mustCallSubscriptionCancelIfItIsNoLongerValid() throws Exception {
|
504 | 506 | subscriberVerification.spec206_mustCallSubscriptionCancelIfItIsNoLongerValid();
|
505 | 507 | }
|
506 | 508 |
|
507 |
| - @Test |
| 509 | + @Override @NotVerified @Test |
508 | 510 | public void spec207_mustEnsureAllCallsOnItsSubscriptionTakePlaceFromTheSameThreadOrTakeCareOfSynchronization() throws Exception {
|
509 | 511 | subscriberVerification.spec207_mustEnsureAllCallsOnItsSubscriptionTakePlaceFromTheSameThreadOrTakeCareOfSynchronization();
|
510 | 512 | }
|
511 | 513 |
|
512 |
| - @Test |
| 514 | + @Override @Required @Test |
513 | 515 | public void spec208_mustBePreparedToReceiveOnNextSignalsAfterHavingCalledSubscriptionCancel() throws Throwable {
|
514 | 516 | subscriberVerification.spec208_mustBePreparedToReceiveOnNextSignalsAfterHavingCalledSubscriptionCancel();
|
515 | 517 | }
|
516 | 518 |
|
517 |
| - @Test |
| 519 | + @Override @Required @Test |
518 | 520 | public void spec209_mustBePreparedToReceiveAnOnCompleteSignalWithPrecedingRequestCall() throws Throwable {
|
519 | 521 | subscriberVerification.spec209_mustBePreparedToReceiveAnOnCompleteSignalWithPrecedingRequestCall();
|
520 | 522 | }
|
521 | 523 |
|
522 |
| - @Test |
| 524 | + @Override @Required @Test |
523 | 525 | public void spec209_mustBePreparedToReceiveAnOnCompleteSignalWithoutPrecedingRequestCall() throws Throwable {
|
524 | 526 | subscriberVerification.spec209_mustBePreparedToReceiveAnOnCompleteSignalWithoutPrecedingRequestCall();
|
525 | 527 | }
|
526 | 528 |
|
527 |
| - @Test |
| 529 | + @Override @Required @Test |
528 | 530 | public void spec210_mustBePreparedToReceiveAnOnErrorSignalWithPrecedingRequestCall() throws Throwable {
|
529 | 531 | subscriberVerification.spec210_mustBePreparedToReceiveAnOnErrorSignalWithPrecedingRequestCall();
|
530 | 532 | }
|
531 | 533 |
|
532 |
| - @Test |
| 534 | + @Override @Required @Test |
533 | 535 | public void spec210_mustBePreparedToReceiveAnOnErrorSignalWithoutPrecedingRequestCall() throws Throwable {
|
534 | 536 | subscriberVerification.spec210_mustBePreparedToReceiveAnOnErrorSignalWithoutPrecedingRequestCall();
|
535 | 537 | }
|
536 | 538 |
|
537 |
| - @Test |
| 539 | + @Override @NotVerified @Test |
538 | 540 | public void spec211_mustMakeSureThatAllCallsOnItsMethodsHappenBeforeTheProcessingOfTheRespectiveEvents() throws Exception {
|
539 | 541 | subscriberVerification.spec211_mustMakeSureThatAllCallsOnItsMethodsHappenBeforeTheProcessingOfTheRespectiveEvents();
|
540 | 542 | }
|
541 | 543 |
|
542 |
| - @Test |
| 544 | + @Override @Additional @Test |
543 | 545 | public void spec212_mustNotCallOnSubscribeMoreThanOnceBasedOnObjectEquality_specViolation() throws Throwable {
|
544 | 546 | subscriberVerification.spec212_mustNotCallOnSubscribeMoreThanOnceBasedOnObjectEquality_specViolation();
|
545 | 547 | }
|
546 | 548 |
|
547 |
| - @Test |
| 549 | + @Override @NotVerified@Test |
548 | 550 | public void spec213_failingOnSignalInvocation() throws Exception {
|
549 | 551 | subscriberVerification.spec213_failingOnSignalInvocation();
|
550 | 552 | }
|
551 | 553 |
|
552 |
| - @Test |
| 554 | + @Override @NotVerified @Test |
553 | 555 | public void spec301_mustNotBeCalledOutsideSubscriberContext() throws Exception {
|
554 | 556 | subscriberVerification.spec301_mustNotBeCalledOutsideSubscriberContext();
|
555 | 557 | }
|
556 | 558 |
|
557 |
| - @Test |
| 559 | + @Override @Required @Test |
558 | 560 | public void spec308_requestMustRegisterGivenNumberElementsToBeProduced() throws Throwable {
|
559 | 561 | subscriberVerification.spec308_requestMustRegisterGivenNumberElementsToBeProduced();
|
560 | 562 | }
|
561 | 563 |
|
562 |
| - @Test |
| 564 | + @Override @NotVerified @Test |
563 | 565 | public void spec310_requestMaySynchronouslyCallOnNextOnSubscriber() throws Exception {
|
564 | 566 | subscriberVerification.spec310_requestMaySynchronouslyCallOnNextOnSubscriber();
|
565 | 567 | }
|
566 | 568 |
|
567 |
| - @Test |
| 569 | + @Override @NotVerified @Test |
568 | 570 | public void spec311_requestMaySynchronouslyCallOnCompleteOrOnError() throws Exception {
|
569 | 571 | subscriberVerification.spec311_requestMaySynchronouslyCallOnCompleteOrOnError();
|
570 | 572 | }
|
571 | 573 |
|
572 |
| - @Test |
| 574 | + @Override @NotVerified @Test |
573 | 575 | public void spec314_cancelMayCauseThePublisherToShutdownIfNoOtherSubscriptionExists() throws Exception {
|
574 | 576 | subscriberVerification.spec314_cancelMayCauseThePublisherToShutdownIfNoOtherSubscriptionExists();
|
575 | 577 | }
|
576 | 578 |
|
577 |
| - @Test |
| 579 | + @Override @NotVerified @Test |
578 | 580 | public void spec315_cancelMustNotThrowExceptionAndMustSignalOnError() throws Exception {
|
579 | 581 | subscriberVerification.spec315_cancelMustNotThrowExceptionAndMustSignalOnError();
|
580 | 582 | }
|
581 | 583 |
|
582 |
| - @Test |
| 584 | + @Override @NotVerified @Test |
583 | 585 | public void spec316_requestMustNotThrowExceptionAndMustOnErrorTheSubscriber() throws Exception {
|
584 | 586 | subscriberVerification.spec316_requestMustNotThrowExceptionAndMustOnErrorTheSubscriber();
|
585 | 587 | }
|
|
0 commit comments