diff --git a/build.gradle b/build.gradle index 7f4708a1..d3c6aa21 100644 --- a/build.gradle +++ b/build.gradle @@ -50,7 +50,7 @@ subprojects { "reactive-streams-tck", "reactive-streams-tck-flow", "reactive-streams-examples", - "reactive-streams-flow-bridge"]) { + "reactive-streams-flow-adapters"]) { apply plugin: "maven" apply plugin: "signing" diff --git a/flow-bridge/.gitignore b/flow-adapters/.gitignore similarity index 100% rename from flow-bridge/.gitignore rename to flow-adapters/.gitignore diff --git a/flow-bridge/build.gradle b/flow-adapters/build.gradle similarity index 85% rename from flow-bridge/build.gradle rename to flow-adapters/build.gradle index 13debe28..0a90eb9e 100644 --- a/flow-bridge/build.gradle +++ b/flow-adapters/build.gradle @@ -1,4 +1,4 @@ -description = 'reactive-streams-flow-bridge' +description = 'reactive-streams-flow-adapters' dependencies { compile project(':reactive-streams') diff --git a/flow-bridge/src/main/java/org/reactivestreams/ReactiveStreamsFlowBridge.java b/flow-adapters/src/main/java/org/reactivestreams/FlowAdapters.java similarity index 99% rename from flow-bridge/src/main/java/org/reactivestreams/ReactiveStreamsFlowBridge.java rename to flow-adapters/src/main/java/org/reactivestreams/FlowAdapters.java index e45fd548..4417e4c5 100644 --- a/flow-bridge/src/main/java/org/reactivestreams/ReactiveStreamsFlowBridge.java +++ b/flow-adapters/src/main/java/org/reactivestreams/FlowAdapters.java @@ -16,9 +16,9 @@ /** * Bridge between Reactive Streams API and the Java 9 {@link java.util.concurrent.Flow} API. */ -public final class ReactiveStreamsFlowBridge { +public final class FlowAdapters { /** Utility class. */ - private ReactiveStreamsFlowBridge() { + private FlowAdapters() { throw new IllegalStateException("No instances!"); } diff --git a/flow-bridge/src/test/java/org/reactivestreams/ReactiveStreamsFlowBridgeTest.java b/flow-adapters/src/test/java/org/reactivestreams/FlowAdaptersTest.java similarity index 84% rename from flow-bridge/src/test/java/org/reactivestreams/ReactiveStreamsFlowBridgeTest.java rename to flow-adapters/src/test/java/org/reactivestreams/FlowAdaptersTest.java index 1e24172f..4d3625fc 100644 --- a/flow-bridge/src/test/java/org/reactivestreams/ReactiveStreamsFlowBridgeTest.java +++ b/flow-adapters/src/test/java/org/reactivestreams/FlowAdaptersTest.java @@ -19,7 +19,7 @@ import java.util.concurrent.Flow; import java.util.concurrent.SubmissionPublisher; -public class ReactiveStreamsFlowBridgeTest { +public class FlowAdaptersTest { @Test public void reactiveToFlowNormal() { MulticastPublisher p = new MulticastPublisher(new Executor() { @@ -31,7 +31,7 @@ public void execute(Runnable command) { TestEitherConsumer tc = new TestEitherConsumer(); - ReactiveStreamsFlowBridge.toFlowPublisher(p).subscribe(tc); + FlowAdapters.toFlowPublisher(p).subscribe(tc); p.offer(1); p.offer(2); @@ -54,7 +54,7 @@ public void execute(Runnable command) { TestEitherConsumer tc = new TestEitherConsumer(); - ReactiveStreamsFlowBridge.toFlowPublisher(p).subscribe(tc); + FlowAdapters.toFlowPublisher(p).subscribe(tc); p.offer(1); p.offer(2); @@ -77,7 +77,7 @@ public void execute(Runnable command) { TestEitherConsumer tc = new TestEitherConsumer(); - ReactiveStreamsFlowBridge.toPublisher(p).subscribe(tc); + FlowAdapters.toPublisher(p).subscribe(tc); p.submit(1); p.submit(2); @@ -100,7 +100,7 @@ public void execute(Runnable command) { TestEitherConsumer tc = new TestEitherConsumer(); - ReactiveStreamsFlowBridge.toPublisher(p).subscribe(tc); + FlowAdapters.toPublisher(p).subscribe(tc); p.submit(1); p.submit(2); @@ -116,7 +116,7 @@ public void execute(Runnable command) { public void reactiveStreamsToFlowSubscriber() { TestEitherConsumer tc = new TestEitherConsumer(); - Flow.Subscriber fs = ReactiveStreamsFlowBridge.toFlowSubscriber(tc); + Flow.Subscriber fs = FlowAdapters.toFlowSubscriber(tc); final Object[] state = { null, null }; @@ -148,7 +148,7 @@ public void cancel() { public void flowToReactiveStreamsSubscriber() { TestEitherConsumer tc = new TestEitherConsumer(); - org.reactivestreams.Subscriber fs = ReactiveStreamsFlowBridge.toSubscriber(tc); + org.reactivestreams.Subscriber fs = FlowAdapters.toSubscriber(tc); final Object[] state = { null, null }; @@ -192,8 +192,8 @@ public void stableConversionForSubscriber() { @Override public void onComplete() {}; }; - Assert.assertSame(ReactiveStreamsFlowBridge.toSubscriber(ReactiveStreamsFlowBridge.toFlowSubscriber(rsSub)), rsSub); - Assert.assertSame(ReactiveStreamsFlowBridge.toFlowSubscriber(ReactiveStreamsFlowBridge.toSubscriber(fSub)), fSub); + Assert.assertSame(FlowAdapters.toSubscriber(FlowAdapters.toFlowSubscriber(rsSub)), rsSub); + Assert.assertSame(FlowAdapters.toFlowSubscriber(FlowAdapters.toSubscriber(fSub)), fSub); } @Test @@ -214,8 +214,8 @@ public void stableConversionForProcessor() { @Override public void subscribe(Flow.Subscriber s) {}; }; - Assert.assertSame(ReactiveStreamsFlowBridge.toProcessor(ReactiveStreamsFlowBridge.toFlowProcessor(rsPro)), rsPro); - Assert.assertSame(ReactiveStreamsFlowBridge.toFlowProcessor(ReactiveStreamsFlowBridge.toProcessor(fPro)), fPro); + Assert.assertSame(FlowAdapters.toProcessor(FlowAdapters.toFlowProcessor(rsPro)), rsPro); + Assert.assertSame(FlowAdapters.toFlowProcessor(FlowAdapters.toProcessor(fPro)), fPro); } @Test @@ -228,7 +228,7 @@ public void stableConversionForPublisher() { @Override public void subscribe(Flow.Subscriber s) {}; }; - Assert.assertSame(ReactiveStreamsFlowBridge.toPublisher(ReactiveStreamsFlowBridge.toFlowPublisher(rsPub)), rsPub); - Assert.assertSame(ReactiveStreamsFlowBridge.toFlowPublisher(ReactiveStreamsFlowBridge.toPublisher(fPub)), fPub); + Assert.assertSame(FlowAdapters.toPublisher(FlowAdapters.toFlowPublisher(rsPub)), rsPub); + Assert.assertSame(FlowAdapters.toFlowPublisher(FlowAdapters.toPublisher(fPub)), fPub); } } diff --git a/flow-bridge/src/test/java/org/reactivestreams/MulticastPublisher.java b/flow-adapters/src/test/java/org/reactivestreams/MulticastPublisher.java similarity index 100% rename from flow-bridge/src/test/java/org/reactivestreams/MulticastPublisher.java rename to flow-adapters/src/test/java/org/reactivestreams/MulticastPublisher.java diff --git a/flow-bridge/src/test/java/org/reactivestreams/SubmissionPublisherTckTest.java b/flow-adapters/src/test/java/org/reactivestreams/SubmissionPublisherTckTest.java similarity index 94% rename from flow-bridge/src/test/java/org/reactivestreams/SubmissionPublisherTckTest.java rename to flow-adapters/src/test/java/org/reactivestreams/SubmissionPublisherTckTest.java index 2c5b3a0d..06e9102e 100644 --- a/flow-bridge/src/test/java/org/reactivestreams/SubmissionPublisherTckTest.java +++ b/flow-adapters/src/test/java/org/reactivestreams/SubmissionPublisherTckTest.java @@ -40,14 +40,14 @@ public void run() { sp.close(); } }).start(); - return ReactiveStreamsFlowBridge.toPublisher(sp); + return FlowAdapters.toPublisher(sp); } @Override public Publisher createFailedPublisher() { final SubmissionPublisher sp = new SubmissionPublisher(); sp.closeExceptionally(new IOException()); - return ReactiveStreamsFlowBridge.toPublisher(sp); + return FlowAdapters.toPublisher(sp); } @Override diff --git a/flow-bridge/src/test/java/org/reactivestreams/TestEitherConsumer.java b/flow-adapters/src/test/java/org/reactivestreams/TestEitherConsumer.java similarity index 100% rename from flow-bridge/src/test/java/org/reactivestreams/TestEitherConsumer.java rename to flow-adapters/src/test/java/org/reactivestreams/TestEitherConsumer.java diff --git a/settings.gradle b/settings.gradle index 9272bcae..a1cbab78 100644 --- a/settings.gradle +++ b/settings.gradle @@ -11,14 +11,14 @@ try { Class.forName("java.util.concurrent.Flow") jdkFlow = true println(ANSI_GREEN + " INFO: ------------------ JDK9 classes detected ---------------------------------" + ANSI_RESET) - println(ANSI_GREEN + " INFO: Java 9 Flow API found; Including [flow-bridge, tck-flow] in build. " + ANSI_RESET) + println(ANSI_GREEN + " INFO: Java 9 Flow API found; Including [flow-adapters, tck-flow] in build. " + ANSI_RESET) println(ANSI_GREEN + " INFO: --------------------------------------------------------------------------" + ANSI_RESET) } catch (Throwable ex) { // Flow API not available - println(ANSI_RED + "WARNING: ------------------ JDK9 classes NOT detected -----------------------------" + ANSI_RESET) - println(ANSI_RED + "WARNING: Java 9 Flow API not found; Not including [flow-bridge, tck-flow] in build." + ANSI_RESET) - println(ANSI_RED + "WARNING: In order to execute the complete test-suite run the build using JDK9+. " + ANSI_RESET) - println(ANSI_RED + "WARNING: --------------------------------------------------------------------------" + ANSI_RESET) + println(ANSI_RED + "WARNING: -------------------- JDK9 classes NOT detected -----------------------------" + ANSI_RESET) + println(ANSI_RED + "WARNING: Java 9 Flow API not found; Not including [flow-adapters, tck-flow] in build." + ANSI_RESET) + println(ANSI_RED + "WARNING: In order to execute the complete test-suite run the build using JDK9+. " + ANSI_RESET) + println(ANSI_RED + "WARNING: ----------------------------------------------------------------------------" + ANSI_RESET) } include ':reactive-streams' @@ -26,7 +26,7 @@ include ':reactive-streams-tck' include ':reactive-streams-examples' if (jdkFlow) { - include ':reactive-streams-flow-bridge' + include ':reactive-streams-flow-adapters' include ':reactive-streams-tck-flow' } @@ -34,6 +34,6 @@ project(':reactive-streams').projectDir = "$rootDir/api" as File project(':reactive-streams-tck').projectDir = "$rootDir/tck" as File project(':reactive-streams-examples').projectDir = "$rootDir/examples" as File if (jdkFlow) { - project(':reactive-streams-flow-bridge').projectDir = "$rootDir/flow-bridge" as File + project(':reactive-streams-flow-adapters').projectDir = "$rootDir/flow-adapters" as File project(':reactive-streams-tck-flow').projectDir = "$rootDir/tck-flow" as File } diff --git a/tck-flow/build.gradle b/tck-flow/build.gradle index 17f93dc0..00642228 100644 --- a/tck-flow/build.gradle +++ b/tck-flow/build.gradle @@ -2,6 +2,6 @@ description = 'reactive-streams-tck-flow' dependencies { compile group: 'org.testng', name: 'testng', version:'5.14.10' compile project(':reactive-streams-tck') - compile project(':reactive-streams-flow-bridge') + compile project(':reactive-streams-flow-adapters') } test.useTestNG() diff --git a/tck-flow/src/main/java/org/reactivestreams/tck/flow/FlowPublisherVerification.java b/tck-flow/src/main/java/org/reactivestreams/tck/flow/FlowPublisherVerification.java index fbfdd672..dcdce51b 100644 --- a/tck-flow/src/main/java/org/reactivestreams/tck/flow/FlowPublisherVerification.java +++ b/tck-flow/src/main/java/org/reactivestreams/tck/flow/FlowPublisherVerification.java @@ -12,7 +12,7 @@ package org.reactivestreams.tck.flow; import org.reactivestreams.Publisher; -import org.reactivestreams.ReactiveStreamsFlowBridge; +import org.reactivestreams.FlowAdapters; import org.reactivestreams.tck.PublisherVerification; import org.reactivestreams.tck.TestEnvironment; @@ -36,7 +36,7 @@ public FlowPublisherVerification(TestEnvironment env) { @Override final public Publisher createPublisher(long elements) { final Flow.Publisher flowPublisher = createFlowPublisher(elements); - return ReactiveStreamsFlowBridge.toPublisher(flowPublisher); + return FlowAdapters.toPublisher(flowPublisher); } /** * This is the main method you must implement in your test incarnation. @@ -49,7 +49,7 @@ final public Publisher createPublisher(long elements) { final public Publisher createFailedPublisher() { final Flow.Publisher failed = createFailedFlowPublisher(); if (failed == null) return null; // because `null` means "SKIP" in createFailedPublisher - else return ReactiveStreamsFlowBridge.toPublisher(failed); + else return FlowAdapters.toPublisher(failed); } /** * By implementing this method, additional TCK tests concerning a "failed" publishers will be run. diff --git a/tck-flow/src/main/java/org/reactivestreams/tck/flow/FlowSubscriberBlackboxVerification.java b/tck-flow/src/main/java/org/reactivestreams/tck/flow/FlowSubscriberBlackboxVerification.java index b9a4ca1b..6ecf1a82 100644 --- a/tck-flow/src/main/java/org/reactivestreams/tck/flow/FlowSubscriberBlackboxVerification.java +++ b/tck-flow/src/main/java/org/reactivestreams/tck/flow/FlowSubscriberBlackboxVerification.java @@ -11,7 +11,7 @@ package org.reactivestreams.tck.flow; -import org.reactivestreams.ReactiveStreamsFlowBridge; +import org.reactivestreams.FlowAdapters; import org.reactivestreams.Subscriber; import org.reactivestreams.Subscription; import org.reactivestreams.tck.SubscriberBlackboxVerification; @@ -40,7 +40,7 @@ protected FlowSubscriberBlackboxVerification(TestEnvironment env) { @Override public final void triggerRequest(Subscriber subscriber) { - triggerFlowRequest(ReactiveStreamsFlowBridge.toFlowSubscriber(subscriber)); + triggerFlowRequest(FlowAdapters.toFlowSubscriber(subscriber)); } /** * Override this method if the {@link java.util.concurrent.Flow.Subscriber} implementation you are verifying @@ -54,7 +54,7 @@ public void triggerFlowRequest(Flow.Subscriber subscriber) { @Override public final Subscriber createSubscriber() { - return ReactiveStreamsFlowBridge.toSubscriber(createFlowSubscriber()); + return FlowAdapters.toSubscriber(createFlowSubscriber()); } /** * This is the main method you must implement in your test incarnation. diff --git a/tck-flow/src/main/java/org/reactivestreams/tck/flow/FlowSubscriberWhiteboxVerification.java b/tck-flow/src/main/java/org/reactivestreams/tck/flow/FlowSubscriberWhiteboxVerification.java index 23a74bd4..8f4bb9d4 100644 --- a/tck-flow/src/main/java/org/reactivestreams/tck/flow/FlowSubscriberWhiteboxVerification.java +++ b/tck-flow/src/main/java/org/reactivestreams/tck/flow/FlowSubscriberWhiteboxVerification.java @@ -11,7 +11,7 @@ package org.reactivestreams.tck.flow; -import org.reactivestreams.ReactiveStreamsFlowBridge; +import org.reactivestreams.FlowAdapters; import org.reactivestreams.Subscriber; import org.reactivestreams.tck.SubscriberWhiteboxVerification; import org.reactivestreams.tck.TestEnvironment; @@ -35,7 +35,7 @@ protected FlowSubscriberWhiteboxVerification(TestEnvironment env) { @Override final public Subscriber createSubscriber(WhiteboxSubscriberProbe probe) { - return ReactiveStreamsFlowBridge.toSubscriber(createFlowSubscriber(probe)); + return FlowAdapters.toSubscriber(createFlowSubscriber(probe)); } /** * This is the main method you must implement in your test incarnation. diff --git a/tck-flow/src/test/java/org/reactivestreams/tck/flow/EmptyLazyFlowPublisherTest.java b/tck-flow/src/test/java/org/reactivestreams/tck/flow/EmptyLazyFlowPublisherTest.java index 62b1fc24..6d5342dc 100644 --- a/tck-flow/src/test/java/org/reactivestreams/tck/flow/EmptyLazyFlowPublisherTest.java +++ b/tck-flow/src/test/java/org/reactivestreams/tck/flow/EmptyLazyFlowPublisherTest.java @@ -11,7 +11,7 @@ package org.reactivestreams.tck.flow; -import org.reactivestreams.ReactiveStreamsFlowBridge; +import org.reactivestreams.FlowAdapters; import org.reactivestreams.example.unicast.AsyncIterablePublisher; import java.util.concurrent.Flow.Publisher; @@ -41,7 +41,7 @@ public EmptyLazyFlowPublisherTest() { @Override public Publisher createFlowPublisher(long elements) { - return ReactiveStreamsFlowBridge.toFlowPublisher( + return FlowAdapters.toFlowPublisher( new AsyncIterablePublisher(Collections.emptyList(), ex) ); } diff --git a/tck-flow/src/test/java/org/reactivestreams/tck/flow/SingleElementFlowPublisherTest.java b/tck-flow/src/test/java/org/reactivestreams/tck/flow/SingleElementFlowPublisherTest.java index a58ee2ad..7c4b5236 100644 --- a/tck-flow/src/test/java/org/reactivestreams/tck/flow/SingleElementFlowPublisherTest.java +++ b/tck-flow/src/test/java/org/reactivestreams/tck/flow/SingleElementFlowPublisherTest.java @@ -14,7 +14,7 @@ import java.util.concurrent.Flow; import java.util.concurrent.Flow.Publisher; -import org.reactivestreams.ReactiveStreamsFlowBridge; +import org.reactivestreams.FlowAdapters; import org.reactivestreams.example.unicast.AsyncIterablePublisher; import org.reactivestreams.tck.TestEnvironment; import org.testng.annotations.AfterClass; @@ -42,7 +42,7 @@ public SingleElementFlowPublisherTest() { @Override public Flow.Publisher createFlowPublisher(long elements) { - return ReactiveStreamsFlowBridge.toFlowPublisher(new AsyncIterablePublisher(Collections.singleton(1), ex)); + return FlowAdapters.toFlowPublisher(new AsyncIterablePublisher(Collections.singleton(1), ex)); } @Override