Skip to content

Commit f89509f

Browse files
committed
adapt TCK to changes in rule 3.17
Specifically remove required_spec317_mustSignalOnErrorWhenPendingAboveLongMaxValue since it is now allowed to treat request overflow as “unlimited demand”.
1 parent fdafe3f commit f89509f

File tree

4 files changed

+3
-80
lines changed

4 files changed

+3
-80
lines changed

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

+1-6
Original file line numberDiff line numberDiff line change
@@ -356,11 +356,6 @@ public void required_spec317_mustSupportACumulativePendingElementCountUpToLongMa
356356
publisherVerification.required_spec317_mustSupportACumulativePendingElementCountUpToLongMaxValue();
357357
}
358358

359-
@Override @Test
360-
public void required_spec317_mustSignalOnErrorWhenPendingAboveLongMaxValue() throws Throwable {
361-
publisherVerification.required_spec317_mustSignalOnErrorWhenPendingAboveLongMaxValue();
362-
}
363-
364359
// Verifies rule: https://github.com/reactive-streams/reactive-streams#1.4
365360
// for multiple subscribers
366361
@Test
@@ -727,4 +722,4 @@ public void expectError(Throwable cause, long timeoutMillis) throws InterruptedE
727722
}
728723
}
729724
}
730-
}
725+
}

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

+1-38
Original file line numberDiff line numberDiff line change
@@ -939,43 +939,6 @@ public void run(Publisher<T> pub) throws Throwable {
939939
});
940940
}
941941

942-
// Verifies rule: https://github.com/reactive-streams/reactive-streams#3.17
943-
@Override @Test
944-
public void required_spec317_mustSignalOnErrorWhenPendingAboveLongMaxValue() throws Throwable {
945-
activePublisherTest(Integer.MAX_VALUE, false, new PublisherTestRun<T>() {
946-
@Override public void run(Publisher<T> pub) throws Throwable {
947-
ManualSubscriberWithSubscriptionSupport<T> sub = new BlackholeSubscriberWithSubscriptionSupport<T>(env) {
948-
// arbitrarily set limit on nuber of request calls signalled, we expect overflow after already 2 calls,
949-
// so 10 is relatively high and safe even if arbitrarily chosen
950-
int callsCounter = 10;
951-
952-
@Override
953-
public void onNext(T element) {
954-
env.debug(String.format("%s::onNext(%s)", this, element));
955-
if (subscription.isCompleted()) {
956-
if (callsCounter > 0) {
957-
subscription.value().request(Long.MAX_VALUE - 1);
958-
callsCounter--;
959-
}
960-
} else {
961-
env.flop(String.format("Subscriber::onNext(%s) called before Subscriber::onSubscribe", element));
962-
}
963-
}
964-
};
965-
env.subscribe(pub, sub, env.defaultTimeoutMillis());
966-
967-
// eventually triggers `onNext`, which will then trigger up to `callsCounter` times `request(Long.MAX_VALUE - 1)`
968-
// we're pretty sure to overflow from those
969-
sub.request(1);
970-
971-
sub.expectErrorWithMessage(IllegalStateException.class, "3.17");
972-
973-
// onError must be signalled only once, even with in-flight other request() messages that would trigger overflow again
974-
env.verifyNoAsyncErrors(env.defaultTimeoutMillis());
975-
}
976-
});
977-
}
978-
979942
///////////////////// ADDITIONAL "COROLLARY" TESTS ////////////////////////
980943

981944
///////////////////// TEST INFRASTRUCTURE /////////////////////////////////
@@ -1091,4 +1054,4 @@ public void notVerified(String message) {
10911054
throw new SkipException(message);
10921055
}
10931056

1094-
}
1057+
}

tck/src/main/java/org/reactivestreams/tck/support/PublisherVerificationRules.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,4 @@ public interface PublisherVerificationRules {
3939
void required_spec313_cancelMustMakeThePublisherEventuallyDropAllReferencesToTheSubscriber() throws Throwable;
4040
void required_spec317_mustSupportAPendingElementCountUpToLongMaxValue() throws Throwable;
4141
void required_spec317_mustSupportACumulativePendingElementCountUpToLongMaxValue() throws Throwable;
42-
void required_spec317_mustSignalOnErrorWhenPendingAboveLongMaxValue() throws Throwable;
43-
}
42+
}

tck/src/test/java/org/reactivestreams/tck/PublisherVerificationTest.java

-34
Original file line numberDiff line numberDiff line change
@@ -443,40 +443,6 @@ public void required_spec317_mustSupportAPendingElementCountUpToLongMaxValue_sho
443443
}, "Received more than bufferSize (32) onNext signals. The Publisher probably emited more signals than expected!");
444444
}
445445

446-
@Test
447-
public void required_spec317_mustSignalOnErrorWhenPendingAboveLongMaxValue_shouldFail_onAsynchDemandIgnoringPublisher() throws Throwable {
448-
final ExecutorService signallersPool = Executors.newFixedThreadPool(2);
449-
requireTestFailure(new ThrowingRunnable() {
450-
@Override public void run() throws Throwable {
451-
demandIgnoringAsynchronousPublisherVerification(signallersPool).required_spec317_mustSignalOnErrorWhenPendingAboveLongMaxValue();
452-
}
453-
}, "Expected onError(java.lang.IllegalStateException)");
454-
}
455-
456-
@Test
457-
public void required_spec317_mustSignalOnErrorWhenPendingAboveLongMaxValue_shouldFail_onSynchDemandIgnoringPublisher() throws Throwable {
458-
requireTestFailure(new ThrowingRunnable() {
459-
@Override public void run() throws Throwable {
460-
customPublisherVerification(new Publisher<Integer>() {
461-
long demand = 0;
462-
463-
@Override public void subscribe(final Subscriber<? super Integer> s) {
464-
s.onSubscribe(new Subscription() {
465-
@Override public void request(long n) {
466-
// it does not protect from demand overflow!
467-
demand += n;
468-
}
469-
470-
@Override public void cancel() {
471-
// noop
472-
}
473-
});
474-
}
475-
}).required_spec317_mustSignalOnErrorWhenPendingAboveLongMaxValue();
476-
}
477-
}, "Expected onError(java.lang.IllegalStateException)");
478-
}
479-
480446
@Test
481447
public void required_spec317_mustSupportACumulativePendingElementCountUpToLongMaxValue_shouldFail_overflowingDemand() throws Throwable {
482448
requireTestFailure(new ThrowingRunnable() {

0 commit comments

Comments
 (0)