Skip to content

Commit a4abf38

Browse files
authored
Implementing renaming proposal for the interop with j.u.c.Flow (#402)
1 parent c24b476 commit a4abf38

15 files changed

+39
-39
lines changed

Diff for: build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ subprojects {
5050
"reactive-streams-tck",
5151
"reactive-streams-tck-flow",
5252
"reactive-streams-examples",
53-
"reactive-streams-flow-bridge"]) {
53+
"reactive-streams-flow-adapters"]) {
5454
apply plugin: "maven"
5555
apply plugin: "signing"
5656

File renamed without changes.

Diff for: flow-bridge/build.gradle renamed to flow-adapters/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
description = 'reactive-streams-flow-bridge'
1+
description = 'reactive-streams-flow-adapters'
22

33
dependencies {
44
compile project(':reactive-streams')

Diff for: flow-bridge/src/main/java/org/reactivestreams/ReactiveStreamsFlowBridge.java renamed to flow-adapters/src/main/java/org/reactivestreams/FlowAdapters.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
/**
1717
* Bridge between Reactive Streams API and the Java 9 {@link java.util.concurrent.Flow} API.
1818
*/
19-
public final class ReactiveStreamsFlowBridge {
19+
public final class FlowAdapters {
2020
/** Utility class. */
21-
private ReactiveStreamsFlowBridge() {
21+
private FlowAdapters() {
2222
throw new IllegalStateException("No instances!");
2323
}
2424

Diff for: flow-bridge/src/test/java/org/reactivestreams/ReactiveStreamsFlowBridgeTest.java renamed to flow-adapters/src/test/java/org/reactivestreams/FlowAdaptersTest.java

+13-13
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import java.util.concurrent.Flow;
2020
import java.util.concurrent.SubmissionPublisher;
2121

22-
public class ReactiveStreamsFlowBridgeTest {
22+
public class FlowAdaptersTest {
2323
@Test
2424
public void reactiveToFlowNormal() {
2525
MulticastPublisher<Integer> p = new MulticastPublisher<Integer>(new Executor() {
@@ -31,7 +31,7 @@ public void execute(Runnable command) {
3131

3232
TestEitherConsumer<Integer> tc = new TestEitherConsumer<Integer>();
3333

34-
ReactiveStreamsFlowBridge.toFlowPublisher(p).subscribe(tc);
34+
FlowAdapters.toFlowPublisher(p).subscribe(tc);
3535

3636
p.offer(1);
3737
p.offer(2);
@@ -54,7 +54,7 @@ public void execute(Runnable command) {
5454

5555
TestEitherConsumer<Integer> tc = new TestEitherConsumer<Integer>();
5656

57-
ReactiveStreamsFlowBridge.toFlowPublisher(p).subscribe(tc);
57+
FlowAdapters.toFlowPublisher(p).subscribe(tc);
5858

5959
p.offer(1);
6060
p.offer(2);
@@ -77,7 +77,7 @@ public void execute(Runnable command) {
7777

7878
TestEitherConsumer<Integer> tc = new TestEitherConsumer<Integer>();
7979

80-
ReactiveStreamsFlowBridge.toPublisher(p).subscribe(tc);
80+
FlowAdapters.toPublisher(p).subscribe(tc);
8181

8282
p.submit(1);
8383
p.submit(2);
@@ -100,7 +100,7 @@ public void execute(Runnable command) {
100100

101101
TestEitherConsumer<Integer> tc = new TestEitherConsumer<Integer>();
102102

103-
ReactiveStreamsFlowBridge.toPublisher(p).subscribe(tc);
103+
FlowAdapters.toPublisher(p).subscribe(tc);
104104

105105
p.submit(1);
106106
p.submit(2);
@@ -116,7 +116,7 @@ public void execute(Runnable command) {
116116
public void reactiveStreamsToFlowSubscriber() {
117117
TestEitherConsumer<Integer> tc = new TestEitherConsumer<Integer>();
118118

119-
Flow.Subscriber<Integer> fs = ReactiveStreamsFlowBridge.toFlowSubscriber(tc);
119+
Flow.Subscriber<Integer> fs = FlowAdapters.toFlowSubscriber(tc);
120120

121121
final Object[] state = { null, null };
122122

@@ -148,7 +148,7 @@ public void cancel() {
148148
public void flowToReactiveStreamsSubscriber() {
149149
TestEitherConsumer<Integer> tc = new TestEitherConsumer<Integer>();
150150

151-
org.reactivestreams.Subscriber<Integer> fs = ReactiveStreamsFlowBridge.toSubscriber(tc);
151+
org.reactivestreams.Subscriber<Integer> fs = FlowAdapters.toSubscriber(tc);
152152

153153
final Object[] state = { null, null };
154154

@@ -192,8 +192,8 @@ public void stableConversionForSubscriber() {
192192
@Override public void onComplete() {};
193193
};
194194

195-
Assert.assertSame(ReactiveStreamsFlowBridge.toSubscriber(ReactiveStreamsFlowBridge.toFlowSubscriber(rsSub)), rsSub);
196-
Assert.assertSame(ReactiveStreamsFlowBridge.toFlowSubscriber(ReactiveStreamsFlowBridge.toSubscriber(fSub)), fSub);
195+
Assert.assertSame(FlowAdapters.toSubscriber(FlowAdapters.toFlowSubscriber(rsSub)), rsSub);
196+
Assert.assertSame(FlowAdapters.toFlowSubscriber(FlowAdapters.toSubscriber(fSub)), fSub);
197197
}
198198

199199
@Test
@@ -214,8 +214,8 @@ public void stableConversionForProcessor() {
214214
@Override public void subscribe(Flow.Subscriber s) {};
215215
};
216216

217-
Assert.assertSame(ReactiveStreamsFlowBridge.toProcessor(ReactiveStreamsFlowBridge.toFlowProcessor(rsPro)), rsPro);
218-
Assert.assertSame(ReactiveStreamsFlowBridge.toFlowProcessor(ReactiveStreamsFlowBridge.toProcessor(fPro)), fPro);
217+
Assert.assertSame(FlowAdapters.toProcessor(FlowAdapters.toFlowProcessor(rsPro)), rsPro);
218+
Assert.assertSame(FlowAdapters.toFlowProcessor(FlowAdapters.toProcessor(fPro)), fPro);
219219
}
220220

221221
@Test
@@ -228,7 +228,7 @@ public void stableConversionForPublisher() {
228228
@Override public void subscribe(Flow.Subscriber s) {};
229229
};
230230

231-
Assert.assertSame(ReactiveStreamsFlowBridge.toPublisher(ReactiveStreamsFlowBridge.toFlowPublisher(rsPub)), rsPub);
232-
Assert.assertSame(ReactiveStreamsFlowBridge.toFlowPublisher(ReactiveStreamsFlowBridge.toPublisher(fPub)), fPub);
231+
Assert.assertSame(FlowAdapters.toPublisher(FlowAdapters.toFlowPublisher(rsPub)), rsPub);
232+
Assert.assertSame(FlowAdapters.toFlowPublisher(FlowAdapters.toPublisher(fPub)), fPub);
233233
}
234234
}

Diff for: flow-bridge/src/test/java/org/reactivestreams/SubmissionPublisherTckTest.java renamed to flow-adapters/src/test/java/org/reactivestreams/SubmissionPublisherTckTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ public void run() {
4040
sp.close();
4141
}
4242
}).start();
43-
return ReactiveStreamsFlowBridge.toPublisher(sp);
43+
return FlowAdapters.toPublisher(sp);
4444
}
4545

4646
@Override
4747
public Publisher<Integer> createFailedPublisher() {
4848
final SubmissionPublisher<Integer> sp = new SubmissionPublisher<Integer>();
4949
sp.closeExceptionally(new IOException());
50-
return ReactiveStreamsFlowBridge.toPublisher(sp);
50+
return FlowAdapters.toPublisher(sp);
5151
}
5252

5353
@Override

Diff for: settings.gradle

+7-7
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,29 @@ try {
1111
Class.forName("java.util.concurrent.Flow")
1212
jdkFlow = true
1313
println(ANSI_GREEN + " INFO: ------------------ JDK9 classes detected ---------------------------------" + ANSI_RESET)
14-
println(ANSI_GREEN + " INFO: Java 9 Flow API found; Including [flow-bridge, tck-flow] in build. " + ANSI_RESET)
14+
println(ANSI_GREEN + " INFO: Java 9 Flow API found; Including [flow-adapters, tck-flow] in build. " + ANSI_RESET)
1515
println(ANSI_GREEN + " INFO: --------------------------------------------------------------------------" + ANSI_RESET)
1616
} catch (Throwable ex) {
1717
// Flow API not available
18-
println(ANSI_RED + "WARNING: ------------------ JDK9 classes NOT detected -----------------------------" + ANSI_RESET)
19-
println(ANSI_RED + "WARNING: Java 9 Flow API not found; Not including [flow-bridge, tck-flow] in build." + ANSI_RESET)
20-
println(ANSI_RED + "WARNING: In order to execute the complete test-suite run the build using JDK9+. " + ANSI_RESET)
21-
println(ANSI_RED + "WARNING: --------------------------------------------------------------------------" + ANSI_RESET)
18+
println(ANSI_RED + "WARNING: -------------------- JDK9 classes NOT detected -----------------------------" + ANSI_RESET)
19+
println(ANSI_RED + "WARNING: Java 9 Flow API not found; Not including [flow-adapters, tck-flow] in build." + ANSI_RESET)
20+
println(ANSI_RED + "WARNING: In order to execute the complete test-suite run the build using JDK9+. " + ANSI_RESET)
21+
println(ANSI_RED + "WARNING: ----------------------------------------------------------------------------" + ANSI_RESET)
2222
}
2323

2424
include ':reactive-streams'
2525
include ':reactive-streams-tck'
2626
include ':reactive-streams-examples'
2727

2828
if (jdkFlow) {
29-
include ':reactive-streams-flow-bridge'
29+
include ':reactive-streams-flow-adapters'
3030
include ':reactive-streams-tck-flow'
3131
}
3232

3333
project(':reactive-streams').projectDir = "$rootDir/api" as File
3434
project(':reactive-streams-tck').projectDir = "$rootDir/tck" as File
3535
project(':reactive-streams-examples').projectDir = "$rootDir/examples" as File
3636
if (jdkFlow) {
37-
project(':reactive-streams-flow-bridge').projectDir = "$rootDir/flow-bridge" as File
37+
project(':reactive-streams-flow-adapters').projectDir = "$rootDir/flow-adapters" as File
3838
project(':reactive-streams-tck-flow').projectDir = "$rootDir/tck-flow" as File
3939
}

Diff for: tck-flow/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ description = 'reactive-streams-tck-flow'
22
dependencies {
33
compile group: 'org.testng', name: 'testng', version:'5.14.10'
44
compile project(':reactive-streams-tck')
5-
compile project(':reactive-streams-flow-bridge')
5+
compile project(':reactive-streams-flow-adapters')
66
}
77
test.useTestNG()

Diff for: tck-flow/src/main/java/org/reactivestreams/tck/flow/FlowPublisherVerification.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
package org.reactivestreams.tck.flow;
1313

1414
import org.reactivestreams.Publisher;
15-
import org.reactivestreams.ReactiveStreamsFlowBridge;
15+
import org.reactivestreams.FlowAdapters;
1616
import org.reactivestreams.tck.PublisherVerification;
1717
import org.reactivestreams.tck.TestEnvironment;
1818

@@ -36,7 +36,7 @@ public FlowPublisherVerification(TestEnvironment env) {
3636
@Override
3737
final public Publisher<T> createPublisher(long elements) {
3838
final Flow.Publisher<T> flowPublisher = createFlowPublisher(elements);
39-
return ReactiveStreamsFlowBridge.toPublisher(flowPublisher);
39+
return FlowAdapters.toPublisher(flowPublisher);
4040
}
4141
/**
4242
* This is the main method you must implement in your test incarnation.
@@ -49,7 +49,7 @@ final public Publisher<T> createPublisher(long elements) {
4949
final public Publisher<T> createFailedPublisher() {
5050
final Flow.Publisher<T> failed = createFailedFlowPublisher();
5151
if (failed == null) return null; // because `null` means "SKIP" in createFailedPublisher
52-
else return ReactiveStreamsFlowBridge.toPublisher(failed);
52+
else return FlowAdapters.toPublisher(failed);
5353
}
5454
/**
5555
* By implementing this method, additional TCK tests concerning a "failed" publishers will be run.

Diff for: tck-flow/src/main/java/org/reactivestreams/tck/flow/FlowSubscriberBlackboxVerification.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
package org.reactivestreams.tck.flow;
1313

14-
import org.reactivestreams.ReactiveStreamsFlowBridge;
14+
import org.reactivestreams.FlowAdapters;
1515
import org.reactivestreams.Subscriber;
1616
import org.reactivestreams.Subscription;
1717
import org.reactivestreams.tck.SubscriberBlackboxVerification;
@@ -40,7 +40,7 @@ protected FlowSubscriberBlackboxVerification(TestEnvironment env) {
4040

4141
@Override
4242
public final void triggerRequest(Subscriber<? super T> subscriber) {
43-
triggerFlowRequest(ReactiveStreamsFlowBridge.toFlowSubscriber(subscriber));
43+
triggerFlowRequest(FlowAdapters.toFlowSubscriber(subscriber));
4444
}
4545
/**
4646
* Override this method if the {@link java.util.concurrent.Flow.Subscriber} implementation you are verifying
@@ -54,7 +54,7 @@ public void triggerFlowRequest(Flow.Subscriber<? super T> subscriber) {
5454

5555
@Override
5656
public final Subscriber<T> createSubscriber() {
57-
return ReactiveStreamsFlowBridge.<T>toSubscriber(createFlowSubscriber());
57+
return FlowAdapters.<T>toSubscriber(createFlowSubscriber());
5858
}
5959
/**
6060
* This is the main method you must implement in your test incarnation.

Diff for: tck-flow/src/main/java/org/reactivestreams/tck/flow/FlowSubscriberWhiteboxVerification.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
package org.reactivestreams.tck.flow;
1313

14-
import org.reactivestreams.ReactiveStreamsFlowBridge;
14+
import org.reactivestreams.FlowAdapters;
1515
import org.reactivestreams.Subscriber;
1616
import org.reactivestreams.tck.SubscriberWhiteboxVerification;
1717
import org.reactivestreams.tck.TestEnvironment;
@@ -35,7 +35,7 @@ protected FlowSubscriberWhiteboxVerification(TestEnvironment env) {
3535

3636
@Override
3737
final public Subscriber<T> createSubscriber(WhiteboxSubscriberProbe<T> probe) {
38-
return ReactiveStreamsFlowBridge.toSubscriber(createFlowSubscriber(probe));
38+
return FlowAdapters.toSubscriber(createFlowSubscriber(probe));
3939
}
4040
/**
4141
* This is the main method you must implement in your test incarnation.

Diff for: tck-flow/src/test/java/org/reactivestreams/tck/flow/EmptyLazyFlowPublisherTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
package org.reactivestreams.tck.flow;
1313

14-
import org.reactivestreams.ReactiveStreamsFlowBridge;
14+
import org.reactivestreams.FlowAdapters;
1515
import org.reactivestreams.example.unicast.AsyncIterablePublisher;
1616
import java.util.concurrent.Flow.Publisher;
1717

@@ -41,7 +41,7 @@ public EmptyLazyFlowPublisherTest() {
4141

4242
@Override
4343
public Publisher<Integer> createFlowPublisher(long elements) {
44-
return ReactiveStreamsFlowBridge.toFlowPublisher(
44+
return FlowAdapters.toFlowPublisher(
4545
new AsyncIterablePublisher<Integer>(Collections.<Integer>emptyList(), ex)
4646
);
4747
}

Diff for: tck-flow/src/test/java/org/reactivestreams/tck/flow/SingleElementFlowPublisherTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import java.util.concurrent.Flow;
1515
import java.util.concurrent.Flow.Publisher;
1616

17-
import org.reactivestreams.ReactiveStreamsFlowBridge;
17+
import org.reactivestreams.FlowAdapters;
1818
import org.reactivestreams.example.unicast.AsyncIterablePublisher;
1919
import org.reactivestreams.tck.TestEnvironment;
2020
import org.testng.annotations.AfterClass;
@@ -42,7 +42,7 @@ public SingleElementFlowPublisherTest() {
4242

4343
@Override
4444
public Flow.Publisher<Integer> createFlowPublisher(long elements) {
45-
return ReactiveStreamsFlowBridge.toFlowPublisher(new AsyncIterablePublisher<Integer>(Collections.singleton(1), ex));
45+
return FlowAdapters.toFlowPublisher(new AsyncIterablePublisher<Integer>(Collections.singleton(1), ex));
4646
}
4747

4848
@Override

0 commit comments

Comments
 (0)