You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tck/README.md
+39-16
Original file line number
Diff line number
Diff line change
@@ -112,10 +112,11 @@ In order to inform the TCK your Publisher is only able to signal up to `2` eleme
112
112
}
113
113
```
114
114
115
-
The TCK also supports Publishers which are not able to signal completion. For example you might have a Publisher being backed by a timer.
116
-
Such Publisher does not have a natural way to "complete" after some number of ticks. It would be possible to implement a Processor which would
117
-
"take n elements from the TickPublisher and then signal completion to the downstream", but this adds a layer of indirection between the TCK and the
118
-
Publisher we initially wanted to test. We suggest testing such unbouded Publishers either way - using a "TakeNElementsProcessor" or by informing the TCK
115
+
The TCK also supports Publishers which are not able to signal completion. For example you might have a Publisher being
116
+
backed by a timer. Such Publisher does not have a natural way to "complete" after some number of ticks. It would be
117
+
possible to implement a Processor which would "take n elements from the TickPublisher and then signal completion to the
118
+
downstream", but this adds a layer of indirection between the TCK and the Publisher one initially wanted to test.
119
+
It is suggested to test such unbouded Publishers either way - using a "TakeNElementsProcessor" or by informing the TCK
119
120
that the publisher is not able to signal completion. The TCK will then skip all tests which require `onComplete` signals to be emitted.
120
121
121
122
In order to inform the TCK that your Publiher is not able to signal completion, override the `maxElementsFromPublisher` method like this:
@@ -261,12 +262,13 @@ In case an implementation needs to work on a specific type, the verification cla
261
262
262
263
While the `Publisher` implementation is provided, creating the signal elements is not – this is because a given Subscriber
263
264
may for example only work with `HashedMessage` or some other specific kind of signal. The TCK is unable to generate such
264
-
special messages automatically, so we provide the `T createElement(Integer id)` method to be implemented as part of
265
+
special messages automatically, so the TCK provides the `T createElement(Integer id)` method to be implemented as part of
265
266
Subscriber Verifications which should take the given ID and return an element of type `T` (where `T` is the type of
266
267
elements flowing into the `Subscriber<T>`, as known thanks to `... extends SubscriberWhiteboxVerification<T>`) representing
267
268
an element of the stream that will be passed on to the Subscriber.
268
269
269
-
The simplest valid implemenation is to return the incoming `id`*as the element* in a verification using `Integer`s as element types:
270
+
The simplest valid implemenation is to return the incoming `id`*as the element* in a verification using `Integer`s as
returnnewPublisher<Message>() { /* IMPL HERE */ };
293
+
returnnewPublisher<Message>() { /*CUSTOM IMPL HERE */ };
292
294
}
293
295
```
294
296
@@ -439,11 +441,14 @@ Note that hard-coded values *take precedence* over environment set values (!).
439
441
440
442
## Subscription Verification
441
443
442
-
Please note that while `Subscription` does **not** have it's own test class, it's rules are validated inside of the `Publisher` and `Subscriber` tests – depending if the Rule demands specific action to be taken by the publishing, or subscribing side of the subscription contract.
444
+
Please note that while `Subscription` does **not** have it's own test class, it's rules are validated inside of the
445
+
`Publisher` and `Subscriber` tests – depending if the Rule demands specific action to be taken by the publishing, or
446
+
subscribing side of the subscription contract.
443
447
444
448
## Identity Processor Verification
445
449
446
-
An `IdentityProcessorVerification` tests the given `Processor` for all `Subscriber`, `Publisher` as well as `Subscription` rules. Internally the `WhiteboxSubscriberVerification` is used for `Subscriber` rules.
450
+
An `IdentityProcessorVerification` tests the given `Processor` for all `Subscriber`, `Publisher` as well as
451
+
`Subscription` rules. Internally the `WhiteboxSubscriberVerification` is used for `Subscriber` rules.
447
452
448
453
```java
449
454
packagecom.example.streams;
@@ -502,12 +507,14 @@ public class MyIdentityProcessorVerificationTest extends IdentityProcessorVerifi
502
507
503
508
The additional configuration options reflect the options available in the Subscriber and Publisher Verifications.
504
509
505
-
The `IdentityProcessorVerification` also runs additional sanity verifications, which are not directly mapped to Specification rules, but help to verify that a Processor won't "get stuck" or face similar problems. Please refer to the sources for details on the tests included.
510
+
The `IdentityProcessorVerification` also runs additional sanity verifications, which are not directly mapped to
511
+
Specification rules, but help to verify that a Processor won't "get stuck" or face similar problems. Please refer to the
512
+
sources for details on the tests included.
506
513
507
514
## Ignoring tests
508
-
Since you inherit these tests instead of defining them yourself it's not possible to use the usual `@Ignore` annotations to skip certain tests
509
-
(which may be perfectly reasonable if your implementation has some know constraints on what it cannot implement). We recommend the below pattern
510
-
to skip tests inherited from the TCK's base classes:
515
+
Since you inherit these tests instead of defining them yourself it's not possible to use the usual `@Ignore` annotations
516
+
to skip certain tests (which may be perfectly reasonable if your implementation has some know constraints on what it
517
+
cannot implement). We recommend the below pattern to skip tests inherited from the TCK's base classes:
511
518
512
519
```java
513
520
packagecom.example.streams;
@@ -561,6 +568,22 @@ public class MyIdentityProcessorTest extends IdentityProcessorVerification<Integ
561
568
}
562
569
```
563
570
571
+
## Which verifications must be implemented by a compliant implementation?
572
+
In order to be considered an Reactive Streams compliant require implementations to cover their
573
+
Publishers and Subscribers with TCK verifications. If a library is only including
574
+
Subscribers, it does not have to implement Publisher tests. The same applies to `IdentityProcessorVerification` -
575
+
you do not need to implement it if the library does not contain Processors.
576
+
577
+
In the case of Subscriber Verification are two styles of verifications to available: Blackbox or Whitebox.
578
+
It is *strongly* recommend to test `Subscriber` implementations with the `SubscriberWhiteboxVerification` as it is able to
579
+
verify most of the specification. The `SubscriberBlackboxVerification` should only be used as a fallback,
580
+
once you are sure implementing the whitebox version will not be possible for your implementation - if that happens
581
+
feel free to open a ticket on the [reactive-streams-jvm](https://github.com/reactive-streams/reactive-streams-jvm) project explaining what stopped you from
582
+
implementing the whitebox verification.
583
+
584
+
In summary: implementations are required to use Verifications for the parts of the specification that they implement,
585
+
and suggest using the whitebox verification over blackbox for the subscriber whenever possible.
586
+
564
587
## Upgrading the TCK to newer versions
565
588
While we do not expect the Reactive Streams specification to change in the forseeable future,
566
589
it *may happen* that some semantics may need to change at some point. In this case you should expect test
0 commit comments