Skip to content

Commit ee076ef

Browse files
akarnokdviktorklang
authored andcommitted
Add test expl. for the use of doesCoordinatedEmission
1 parent 33774b7 commit ee076ef

File tree

1 file changed

+41
-4
lines changed

1 file changed

+41
-4
lines changed

tck/src/main/java/org/reactivestreams/tck/IdentityProcessorVerification.java

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -411,8 +411,27 @@ public void required_spec317_mustNotSignalOnErrorWhenPendingAboveLongMaxValue()
411411
publisherVerification.required_spec317_mustNotSignalOnErrorWhenPendingAboveLongMaxValue();
412412
}
413413

414-
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.4
415-
// for multiple subscribers
414+
415+
/**
416+
* Asks for a {@code Processor} that supports at least 2 {@code Subscriber}s at once and checks if two {@code Subscriber}s
417+
* receive the same items and a terminal {@code Exception}.
418+
* <p>
419+
* If the {@code Processor} requests and/or emits items only when all of its {@code Subscriber}s have requested,
420+
* override {@link #doesCoordinatedEmission()} and return {@code true} to indicate this property.
421+
* <p>
422+
* <b>Verifies rule:</b> <a href='https://github.com/reactive-streams/reactive-streams-jvm#1.4'>1.4</a> with multiple
423+
* {@code Subscriber}s.
424+
* <p>
425+
* The test is not executed if {@link IdentityProcessorVerification#maxSupportedSubscribers()} is less than 2.
426+
* <p>
427+
* If this test fails, the following could be checked within the {@code Publisher} implementation:
428+
* <ul>
429+
* <li>The {@code TestEnvironment} has large enough timeout specified in case the {@code Processor} has some time-delay behavior.</li>
430+
* <li>The {@code Processor} is able to fulfill requests of its {@code Subscriber}s independently of each other's requests or
431+
* else override {@link #doesCoordinatedEmission()} and return {@code true} to indicate the test {@code Subscriber}s
432+
* both have to request first.</li>
433+
* </ul>
434+
*/
416435
@Test
417436
public void required_spec104_mustCallOnErrorOnAllItsSubscribersIfItEncountersANonRecoverableError() throws Throwable {
418437
optionalMultipleSubscribersTest(2, new Function<Long,TestSetup>() {
@@ -669,8 +688,26 @@ public void untested_spec316_requestMustNotThrowExceptionAndMustOnErrorTheSubscr
669688

670689
/////////////////////// ADDITIONAL "COROLLARY" TESTS //////////////////////
671690

672-
// A Processor
673-
// must trigger `requestFromUpstream` for elements that have been requested 'long ago'
691+
/**
692+
* Asks for a {@code Processor} that supports at least 2 {@code Subscriber}s at once and checks requests
693+
* from {@code Subscriber}s will eventually lead to requests towards the upstream of the {@code Processor}.
694+
* <p>
695+
* If the {@code Processor} requests and/or emits items only when all of its {@code Subscriber}s have requested,
696+
* override {@link #doesCoordinatedEmission()} and return {@code true} to indicate this property.
697+
* <p>
698+
* <b>Verifies rule:</b> <a href='https://github.com/reactive-streams/reactive-streams-jvm#1.4'>2.1</a> with multiple
699+
* {@code Subscriber}s.
700+
* <p>
701+
* The test is not executed if {@link IdentityProcessorVerification#maxSupportedSubscribers()} is less than 2.
702+
* <p>
703+
* If this test fails, the following could be checked within the {@code Publisher} implementation:
704+
* <ul>
705+
* <li>The {@code TestEnvironment} has large enough timeout specified in case the {@code Processor} has some time-delay behavior.</li>
706+
* <li>The {@code Processor} is able to fulfill requests of its {@code Subscriber}s independently of each other's requests or
707+
* else override {@link #doesCoordinatedEmission()} and return {@code true} to indicate the test {@code Subscriber}s
708+
* both have to request first.</li>
709+
* </ul>
710+
*/
674711
@Test
675712
public void required_mustRequestFromUpstreamForElementsThatHaveBeenRequestedLongAgo() throws Throwable {
676713
optionalMultipleSubscribersTest(2, new Function<Long,TestSetup>() {

0 commit comments

Comments
 (0)