Skip to content

Commit 96e1a99

Browse files
committed
TCK: review follow ups and additional tests / blackbox tests
* Make spec rules linkable (#2.13) and use links in TCK * Verified 1-element-publishers are testable with TCK (skips unsupported tests) + moved 3.2 from subscriber tests to publisher tests + moved 3.4 to publisher + moved 3.6 spec to Publisher + check rule 3.3, assuming publisher breaks the reccursion + Splitting subscriber whitebox / blackbox tests + both got verifications of rule 2.3 + whitebox is the previous impl + blackbox is tests which work without any additional probes it mostly wrapps the subscriber in order to check things + better 2.10 verification in blackbox + test was testing onComplete instead of onError like it should + better blackbox tests for 2.9 + more java-doc style java-docs (added {@link}s) + minor cleanups and refactors to make BlackboxProxy more understandable + added missing delegation of boundedDepthOfOnNextAndRequestRecursion + improved error message when expecting error message
1 parent 1369af3 commit 96e1a99

15 files changed

+2023
-1235
lines changed

Diff for: README.md

+54-54
Large diffs are not rendered by default.

Diff for: api/src/examples/java/org/reactivestreams/example/multicast/NeverEndingStockStream.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public static synchronized void addHandler(Handler handler) {
3535

3636
public static synchronized void removeHandler(Handler handler) {
3737
// too lazy to do the array handling
38-
HashSet<Handler> set = new HashSet<>(Arrays.asList(INSTANCE.handlers));
38+
HashSet<Handler> set = new HashSet<Handler>(Arrays.asList(INSTANCE.handlers));
3939
set.remove(handler);
4040
INSTANCE.handlers = set.toArray(new Handler[set.size()]);
4141
}

Diff for: api/src/examples/java/org/reactivestreams/example/multicast/StockPriceSubscriber.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public class StockPriceSubscriber implements Subscriber<Stock> {
1313
private final int take;
1414

1515
public StockPriceSubscriber(int bufferSize, int delayPerStock, int take) {
16-
this.buffer = new ArrayBlockingQueue<>(bufferSize);
16+
this.buffer = new ArrayBlockingQueue<Stock>(bufferSize);
1717
this.delayPerStock = delayPerStock;
1818
this.take = take;
1919
}

Diff for: api/src/examples/java/org/reactivestreams/example/unicast/InfiniteIncrementNumberPublisher.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package org.reactivestreams.example.unicast;
22

33
import java.util.concurrent.atomic.AtomicInteger;
4+
import java.util.concurrent.atomic.AtomicLong;
45

56
import org.reactivestreams.Subscription;
67
import org.reactivestreams.Subscriber;
@@ -15,7 +16,7 @@ public void subscribe(final Subscriber<Integer> s) {
1516

1617
Subscription subscription = new Subscription() {
1718

18-
AtomicInteger capacity = new AtomicInteger();
19+
final AtomicLong capacity = new AtomicLong();
1920

2021
@Override
2122
public void request(long n) {

Diff for: api/src/examples/java/org/reactivestreams/example/unicast/NumberSubscriberThatHopsThreads.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
class NumberSubscriberThatHopsThreads implements Subscriber<Integer> {
99

1010
final int BUFFER_SIZE = 10;
11-
private final ArrayBlockingQueue<Integer> buffer = new ArrayBlockingQueue<>(BUFFER_SIZE);
11+
private final ArrayBlockingQueue<Integer> buffer = new ArrayBlockingQueue<Integer>(BUFFER_SIZE);
1212
private volatile boolean terminated = false;
1313
private final String token;
1414

Diff for: tck/src/main/java/org/reactivestreams/tck/Annotations.java

+10-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,15 @@ private Annotations() {}
1717
static @interface NotVerified {
1818
}
1919

20+
/**
21+
* Used to mark stochastic tests which MAY yield false positives (pass) can violate the tested rule in some specific scenario.
22+
*/
23+
@Target(ElementType.METHOD)
24+
@Retention(RetentionPolicy.SOURCE)
25+
static @interface Stochastic {
26+
27+
}
28+
2029
/**
2130
* Used to mark tests that MUST pass in all (even very restricted types of) Publishers / Subscribers.
2231
*/
@@ -31,7 +40,7 @@ private Annotations() {}
3140
*/
3241
@Target(ElementType.METHOD)
3342
@Retention(RetentionPolicy.SOURCE)
34-
@interface Additional {
43+
static @interface Additional {
3544
/** Description of situation when it's OK to not pass this test */
3645
String value() default "";
3746

0 commit comments

Comments
 (0)