diff --git a/.gitignore b/.gitignore index d40f148f62..da7131f349 100644 --- a/.gitignore +++ b/.gitignore @@ -29,6 +29,7 @@ Temporary Items /build/ /bin/ /doc/ +**/target/** # Created by https://www.gitignore.io test-output diff --git a/.java-version b/.java-version index d7ffb667a0..2ab5505161 100644 --- a/.java-version +++ b/.java-version @@ -1 +1 @@ -1.8.0.181 +1.8.0.251 diff --git a/.mvn/jvm.config b/.mvn/jvm.config new file mode 100644 index 0000000000..d45a55c6a4 --- /dev/null +++ b/.mvn/jvm.config @@ -0,0 +1 @@ +-Xmx8G -Xshare:off -XX:TieredStopAtLevel=1 -XX:+UseParallelGC -Djava.awt.headless=true -Dmaven.artifact.threads=4 diff --git a/.mvn/maven.config b/.mvn/maven.config new file mode 100644 index 0000000000..2a9e81da3c --- /dev/null +++ b/.mvn/maven.config @@ -0,0 +1 @@ +-T4.0C -U diff --git a/build.gradle b/build.gradle index 51f4efe0a6..26db51fa5f 100644 --- a/build.gradle +++ b/build.gradle @@ -12,6 +12,9 @@ plugins { id 'me.champeau.gradle.jmh' version '0.2.0' } +apply plugin: 'java' +apply plugin: 'maven' + def custom = { "$rootDir/gradle/${it}.gradle" } //find custom plugins locally diff --git a/cyclops-anym/pom.xml b/cyclops-anym/pom.xml new file mode 100644 index 0000000000..7889606c86 --- /dev/null +++ b/cyclops-anym/pom.xml @@ -0,0 +1,127 @@ + + + + com.oath.cyclops + com.oath.cyclops + 10.4.0 + + 4.0.0 + com.oath.cyclops + cyclops-anym + 10.4.0 + cyclops-anym + A higher kinded monad abstraction for Java + https://github.com/aol/cyclops-react + 2015 + + + The Apache Software License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + + johnmcclean + John McClean + john.mcclean@oath.com + + + kewangie + Ke Wang + ke.wang@teamaol.com + + + tkountis + Thomas Kountis Wang + thomas.kountis@adtech.com + + + colinfkennedy + Colin Kennedy + Colin.Kennedy@teamaol.com + + + + scm:git@github.com:aol/cyclops-react.git + scm:git@github.com:aol/simple-react.git + scm:git@github.com:aol/cyclops-react.git + + + + com.oath.cyclops + cyclops + 10.4.0 + compile + + + com.oath.cyclops + cyclops + 10.4.0 + test-jar + test + + + com.oath.cyclops + cyclops-futurestream + 10.4.0 + compile + + + com.oath.cyclops + cyclops-reactive-collections + 10.4.0 + compile + + + com.oath.cyclops + cyclops-pure + 10.4.0 + compile + + + io.projectreactor + reactor-core + 3.4.1 + test + + + junit + junit + ${junit.version} + test + + + org.hamcrest + hamcrest-all + 1.3 + test + + + com.github.stefanbirkner + system-rules + 1.19.0 + test + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.2.0 + + + + test-jar + + + + + + + + diff --git a/cyclops-futurestream/pom.xml b/cyclops-futurestream/pom.xml new file mode 100644 index 0000000000..67a14261f5 --- /dev/null +++ b/cyclops-futurestream/pom.xml @@ -0,0 +1,137 @@ + + + + com.oath.cyclops + com.oath.cyclops + 10.4.0 + + 4.0.0 + com.oath.cyclops + cyclops-futurestream + 10.4.0 + cyclops-futurestream + Asynchronous parallel streaming via futures + https://github.com/aol/cyclops-react + 2015 + + + The Apache Software License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + + johnmcclean + John McClean + john.mcclean@oath.com + + + kewangie + Ke Wang + ke.wang@teamaol.com + + + tkountis + Thomas Kountis Wang + thomas.kountis@adtech.com + + + colinfkennedy + Colin Kennedy + Colin.Kennedy@teamaol.com + + + + scm:git@github.com:aol/cyclops-react.git + scm:git@github.com:aol/simple-react.git + scm:git@github.com:aol/cyclops-react.git + + + + com.oath.cyclops + cyclops + 10.4.0 + + + com.oath.cyclops + cyclops + 10.4.0 + test-jar + test + + + com.oath.cyclops + cyclops-reactive-collections + 10.4.0 + compile + + + org.reactivestreams + reactive-streams-tck + ${reactive-streams.version} + test + + + org.mockito + mockito-core + ${mocikto-core.version} + test + + + io.projectreactor + reactor-core + 3.4.1 + test + + + org.hamcrest + hamcrest-all + 1.3 + test + + + junit + junit + ${junit.version} + test + + + org.testng + testng + ${testng.version} + test + + + com.github.stefanbirkner + system-rules + 1.19.0 + test + + + io.vertx + vertx-core + ${vertx-core.version} + test + + + io.vertx + vertx-web-client + 4.0.0 + + + org.hibernate + hibernate-core + 5.4.27.Final + test + + + org.hibernate + hibernate-entitymanager + 5.4.27.Final + test + + + diff --git a/cyclops-futurestream/src/main/java/com/oath/cyclops/internal/react/FutureStreamImpl.java b/cyclops-futurestream/src/main/java/com/oath/cyclops/internal/react/FutureStreamImpl.java index 40a909427b..789971b43c 100644 --- a/cyclops-futurestream/src/main/java/com/oath/cyclops/internal/react/FutureStreamImpl.java +++ b/cyclops-futurestream/src/main/java/com/oath/cyclops/internal/react/FutureStreamImpl.java @@ -39,7 +39,7 @@ import lombok.AccessLevel; import lombok.AllArgsConstructor; import lombok.Getter; -import lombok.experimental.Wither; +import lombok.With; import org.reactivestreams.Subscriber; @@ -47,23 +47,23 @@ @AllArgsConstructor(access = AccessLevel.PRIVATE) public class FutureStreamImpl implements FutureStream { - @Wither + @With private final Optional> errorHandler; private final LazyStreamWrapper lastActive; - @Wither + @With private final Supplier> lazyCollector; - @Wither + @With private final QueueFactory queueFactory; - @Wither + @With private final LazyReact simpleReact; - @Wither + @With private final Continueable subscription; private final static ReactPool pool = ReactPool.elasticPool(() -> new LazyReact( Executors.newSingleThreadExecutor())); - @Wither + @With private final ConsumerHolder error; - @Wither + @With private final MaxActive maxActive; @AllArgsConstructor diff --git a/cyclops-futurestream/src/main/java/com/oath/cyclops/internal/react/SimpleReactStreamImpl.java b/cyclops-futurestream/src/main/java/com/oath/cyclops/internal/react/SimpleReactStreamImpl.java index 18f5cdd4bb..d2422fb0ef 100644 --- a/cyclops-futurestream/src/main/java/com/oath/cyclops/internal/react/SimpleReactStreamImpl.java +++ b/cyclops-futurestream/src/main/java/com/oath/cyclops/internal/react/SimpleReactStreamImpl.java @@ -21,9 +21,9 @@ import lombok.AllArgsConstructor; import lombok.Getter; -import lombok.experimental.Wither; +import lombok.With; -@Wither +@With @Getter @AllArgsConstructor public class SimpleReactStreamImpl implements SimpleReactStream, EagerToQueue { diff --git a/cyclops-futurestream/src/main/java/com/oath/cyclops/internal/react/async/future/ExecutionPipeline.java b/cyclops-futurestream/src/main/java/com/oath/cyclops/internal/react/async/future/ExecutionPipeline.java index cc5e1b1629..2088d89563 100644 --- a/cyclops-futurestream/src/main/java/com/oath/cyclops/internal/react/async/future/ExecutionPipeline.java +++ b/cyclops-futurestream/src/main/java/com/oath/cyclops/internal/react/async/future/ExecutionPipeline.java @@ -10,11 +10,11 @@ import cyclops.data.Seq; import lombok.AllArgsConstructor; import lombok.ToString; -import lombok.experimental.Wither; +import lombok.With; @ToString @AllArgsConstructor -@Wither +@With public class ExecutionPipeline { private final Seq functionList; private final Seq execList; diff --git a/cyclops-futurestream/src/main/java/com/oath/cyclops/internal/react/async/future/PipelineBuilder.java b/cyclops-futurestream/src/main/java/com/oath/cyclops/internal/react/async/future/PipelineBuilder.java index d90a12562c..6878132f36 100644 --- a/cyclops-futurestream/src/main/java/com/oath/cyclops/internal/react/async/future/PipelineBuilder.java +++ b/cyclops-futurestream/src/main/java/com/oath/cyclops/internal/react/async/future/PipelineBuilder.java @@ -10,10 +10,10 @@ import cyclops.function.Memoize; import lombok.AllArgsConstructor; -import lombok.experimental.Wither; +import lombok.With; @AllArgsConstructor -@Wither +@With public class PipelineBuilder { private final ExecutionPipeline builder; diff --git a/cyclops-futurestream/src/main/java/com/oath/cyclops/internal/react/stream/EagerStreamWrapper.java b/cyclops-futurestream/src/main/java/com/oath/cyclops/internal/react/stream/EagerStreamWrapper.java index a1bf7ca485..5bac7c249d 100644 --- a/cyclops-futurestream/src/main/java/com/oath/cyclops/internal/react/stream/EagerStreamWrapper.java +++ b/cyclops-futurestream/src/main/java/com/oath/cyclops/internal/react/stream/EagerStreamWrapper.java @@ -17,9 +17,9 @@ import com.oath.cyclops.util.ExceptionSoftener; import lombok.AllArgsConstructor; -import lombok.experimental.Wither; +import lombok.With; -@Wither +@With @AllArgsConstructor public class EagerStreamWrapper implements StreamWrapper { @SuppressWarnings("rawtypes") diff --git a/cyclops-futurestream/src/main/java/com/oath/cyclops/internal/react/stream/LazyStreamWrapper.java b/cyclops-futurestream/src/main/java/com/oath/cyclops/internal/react/stream/LazyStreamWrapper.java index 55d3a7363c..69bf2c6fcf 100644 --- a/cyclops-futurestream/src/main/java/com/oath/cyclops/internal/react/stream/LazyStreamWrapper.java +++ b/cyclops-futurestream/src/main/java/com/oath/cyclops/internal/react/stream/LazyStreamWrapper.java @@ -15,13 +15,13 @@ import com.oath.cyclops.internal.react.async.future.FinalPipeline; import lombok.AllArgsConstructor; -import lombok.experimental.Wither; +import lombok.With; @AllArgsConstructor public class LazyStreamWrapper implements StreamWrapper { - @Wither + @With private final Supplier> values; - @Wither + @With private final LazyReact react; private PipelineBuilder pipeline; private final FuturePool pool; diff --git a/cyclops-futurestream/src/main/java/com/oath/cyclops/react/collectors/lazy/BatchingCollector.java b/cyclops-futurestream/src/main/java/com/oath/cyclops/react/collectors/lazy/BatchingCollector.java index 1165334b01..4e4e791cf1 100644 --- a/cyclops-futurestream/src/main/java/com/oath/cyclops/react/collectors/lazy/BatchingCollector.java +++ b/cyclops-futurestream/src/main/java/com/oath/cyclops/react/collectors/lazy/BatchingCollector.java @@ -11,8 +11,8 @@ import lombok.AllArgsConstructor; import lombok.Getter; -import lombok.experimental.Builder; -import lombok.experimental.Wither; +import lombok.With; +import lombok.Builder; /** * This class allows a Batch of completable futures to be processed before collecting their results, to increase @@ -22,7 +22,7 @@ * * @param Result type */ -@Wither +@With @AllArgsConstructor @Builder public class BatchingCollector implements LazyResultConsumer { diff --git a/cyclops-futurestream/src/main/java/com/oath/cyclops/react/collectors/lazy/EmptyCollector.java b/cyclops-futurestream/src/main/java/com/oath/cyclops/react/collectors/lazy/EmptyCollector.java index 0fd2cf00bf..2e27f268e1 100644 --- a/cyclops-futurestream/src/main/java/com/oath/cyclops/react/collectors/lazy/EmptyCollector.java +++ b/cyclops-futurestream/src/main/java/com/oath/cyclops/react/collectors/lazy/EmptyCollector.java @@ -11,7 +11,7 @@ import lombok.AllArgsConstructor; import lombok.Getter; -import lombok.experimental.Wither; +import lombok.With; /** * A collector that periodically joins active completablefutures @@ -20,7 +20,7 @@ * @author johnmcclean * */ -@Wither +@With @AllArgsConstructor public class EmptyCollector implements LazyResultConsumer { diff --git a/cyclops-futurestream/src/main/java/com/oath/cyclops/react/collectors/lazy/MaxActive.java b/cyclops-futurestream/src/main/java/com/oath/cyclops/react/collectors/lazy/MaxActive.java index 3178dc7ead..d327392e66 100644 --- a/cyclops-futurestream/src/main/java/com/oath/cyclops/react/collectors/lazy/MaxActive.java +++ b/cyclops-futurestream/src/main/java/com/oath/cyclops/react/collectors/lazy/MaxActive.java @@ -2,12 +2,12 @@ import lombok.AllArgsConstructor; import lombok.Getter; -import lombok.experimental.Builder; -import lombok.experimental.Wither; +import lombok.With; +import lombok.Builder; @AllArgsConstructor @Getter -@Wither +@With @Builder public class MaxActive { diff --git a/cyclops-futurestream/src/main/java/com/oath/cyclops/react/collectors/lazy/SamplingCollector.java b/cyclops-futurestream/src/main/java/com/oath/cyclops/react/collectors/lazy/SamplingCollector.java index af2a80b7d9..699e70cfef 100644 --- a/cyclops-futurestream/src/main/java/com/oath/cyclops/react/collectors/lazy/SamplingCollector.java +++ b/cyclops-futurestream/src/main/java/com/oath/cyclops/react/collectors/lazy/SamplingCollector.java @@ -6,8 +6,8 @@ import com.oath.cyclops.internal.react.async.future.FastFuture; import lombok.AllArgsConstructor; -import lombok.experimental.Builder; -import lombok.experimental.Wither; +import lombok.With; +import lombok.Builder; /** * @@ -19,7 +19,7 @@ * @param Result type */ @AllArgsConstructor -@Wither +@With @Builder public class SamplingCollector implements LazyResultConsumer { diff --git a/cyclops-futurestream/src/main/java/cyclops/futurestream/LazyReact.java b/cyclops-futurestream/src/main/java/cyclops/futurestream/LazyReact.java index 8e0d8c9188..fadcb854cf 100644 --- a/cyclops-futurestream/src/main/java/cyclops/futurestream/LazyReact.java +++ b/cyclops-futurestream/src/main/java/cyclops/futurestream/LazyReact.java @@ -22,6 +22,7 @@ import cyclops.data.Seq; import cyclops.reactive.ReactiveSeq; import cyclops.reactive.Spouts; +import lombok.With; import org.reactivestreams.Publisher; import com.oath.cyclops.internal.react.FutureStreamImpl; @@ -35,8 +36,8 @@ import lombok.Getter; import lombok.ToString; -import lombok.experimental.Builder; -import lombok.experimental.Wither; +import lombok.Builder; +import lombok.With; /** * @@ -71,7 +72,7 @@ */ @Builder -@Wither +@With @ToString public class LazyReact implements ReactBuilder { diff --git a/cyclops-futurestream/src/main/java/cyclops/futurestream/SimpleReact.java b/cyclops-futurestream/src/main/java/cyclops/futurestream/SimpleReact.java index 93ba4c23a2..55736e9673 100644 --- a/cyclops-futurestream/src/main/java/cyclops/futurestream/SimpleReact.java +++ b/cyclops-futurestream/src/main/java/cyclops/futurestream/SimpleReact.java @@ -7,7 +7,7 @@ import cyclops.reactive.Spouts; import lombok.Builder; import lombok.Getter; -import lombok.experimental.Wither; +import lombok.With; import org.reactivestreams.Publisher; import java.util.*; @@ -68,7 +68,7 @@ * */ @Builder -@Wither +@With public class SimpleReact implements ReactBuilder { @Getter private final Executor queueService; diff --git a/cyclops-futurestream/src/test/java/cyclops/futurestream/HibernateManagedTest.java b/cyclops-futurestream/src/test/java/cyclops/futurestream/HibernateManagedTest.java index 984b380878..6a79921f01 100644 --- a/cyclops-futurestream/src/test/java/cyclops/futurestream/HibernateManagedTest.java +++ b/cyclops-futurestream/src/test/java/cyclops/futurestream/HibernateManagedTest.java @@ -1,12 +1,10 @@ package cyclops.futurestream; import cyclops.control.Try; -import cyclops.reactive.IO; -import cyclops.reactive.Managed; -import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction; +import org.hibernate.query.NativeQuery; import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; @@ -24,7 +22,7 @@ public void setup(){ session = mock(Session.class); when(factory.openSession()).thenReturn(session); when(session.beginTransaction()).thenReturn(mock(Transaction.class)); - when(session.createQuery(Mockito.anyString())).thenReturn(mock(Query.class)); + when(session.createQuery(Mockito.anyString())).thenReturn(mock(NativeQuery.class)); } diff --git a/cyclops-futurestream/src/test/java/cyclops/futurestream/react/async/vertx/VertxTest.java b/cyclops-futurestream/src/test/java/cyclops/futurestream/react/async/vertx/VertxTest.java index 0d16936d0d..418b523cae 100644 --- a/cyclops-futurestream/src/test/java/cyclops/futurestream/react/async/vertx/VertxTest.java +++ b/cyclops-futurestream/src/test/java/cyclops/futurestream/react/async/vertx/VertxTest.java @@ -1,128 +1,124 @@ package cyclops.futurestream.react.async.vertx; -import static org.hamcrest.Matchers.equalTo; -import static cyclops.data.tuple.Tuple.tuple; -import static org.junit.Assert.assertThat; - -import java.util.concurrent.CompletableFuture; - -import org.junit.Ignore; -import org.junit.Test; - -import cyclops.futurestream.LazyReact; -import cyclops.reactive.ReactiveSeq; -import cyclops.futurestream.SimpleReact; -import com.oath.cyclops.async.adapters.Queue; import com.oath.cyclops.async.QueueFactories; +import com.oath.cyclops.async.adapters.Queue; import com.oath.cyclops.async.wait.WaitStrategy; - +import cyclops.futurestream.LazyReact; +import cyclops.futurestream.SimpleReact; +import cyclops.reactive.ReactiveSeq; import io.vertx.core.Vertx; import io.vertx.core.http.HttpServer; import io.vertx.core.http.HttpServerOptions; import io.vertx.core.http.HttpServerRequest; +import io.vertx.ext.web.client.WebClient; +import org.junit.Ignore; +import org.junit.Test; +import java.util.concurrent.CompletableFuture; -public class VertxTest { - @Test - public void sum(){ - Vertx vertx = Vertx.factory.vertx(); - - LazyReact react = new LazyReact(c->vertx.runOnContext(v -> c.run())); - int number = react.of(1, 2, 3).map(i -> i + 1).reduce((a,b) -> a + b).orElse(Integer.MIN_VALUE); - System.out.println("sum = " + number); // 2 + 3 + 4 = 9 +import static cyclops.data.tuple.Tuple.tuple; +import static org.hamcrest.Matchers.equalTo; +import static org.junit.Assert.assertThat; - assertThat(number,equalTo(9)); - } - @Test @Ignore - public void httpServer(){ - Vertx vertx = Vertx.factory.vertx(); - CompletableFuture server =new CompletableFuture<>(); +public class VertxTest { + @Test + public void sum() { + Vertx vertx = Vertx.vertx(); + LazyReact react = new LazyReact(c -> vertx.runOnContext(v -> c.run())); + int number = react.of(1, 2, 3).map(i -> i + 1).reduce((a, b) -> a + b).orElse(Integer.MIN_VALUE); + System.out.println("sum = " + number); // 2 + 3 + 4 = 9 + assertThat(number, equalTo(9)); + } - Queue reqs = QueueFactories.boundedNonBlockingQueue(1000, - WaitStrategy.spinWait()) - .build(); + @Test + @Ignore + public void httpServer() { + Vertx vertx = Vertx.vertx(); + CompletableFuture server = new CompletableFuture<>(); - vertx.createHttpServer(new HttpServerOptions(). - setPort(8080). - setHost("localhost") - ) - .requestHandler(event-> { - reqs.add(event); - System.out.println(event.absoluteURI()); - }).listen(e->{ - if(e.succeeded()) - server.complete(e.result()); - else - server.completeExceptionally(e.cause()); - }); - LazyReact react = new LazyReact(c->vertx.runOnContext(v -> c.run())); + Queue reqs = QueueFactories.boundedNonBlockingQueue(1000, + WaitStrategy.spinWait()) + .build(); - react.fromStream(reqs.stream()) - .filter(req->req.getParam("num")!=null) - .peek(i->System.out.println("grouping " + i)) - .grouped(2) - .map(list-> tuple(list.getOrElse(0,null).response(),list.getOrElse(1,null).response(),getParam(list.getOrElse(0,null)), - getParam(list.getOrElse(1,null)))) - .peek(i->System.out.println("peeking + "+i)) - .peek(t->t._1().end("adding "+(t._3()+t._4()))) - .peek(t->t._2().end("multiplying "+t._3()*t._4())) - .run(); + vertx.createHttpServer(new HttpServerOptions(). + setPort(8080). + setHost("localhost") + ) + .requestHandler(event -> { + reqs.add(event); + System.out.println(event.absoluteURI()); + }).listen(e -> { + if (e.succeeded()) + server.complete(e.result()); + else + server.completeExceptionally(e.cause()); + }); - new SimpleReact(c->vertx.runOnContext(v -> c.run())).from(server) - .then(s->"server started") - .onFail(e->"failed toNested skip "+e.getMessage()) - .peek(System.out::println); + LazyReact react = new LazyReact(c -> vertx.runOnContext(v -> c.run())); - while(true){ + react.fromStream(reqs.stream()) + .filter(req -> req.getParam("num") != null) + .peek(i -> System.out.println("grouping " + i)) + .grouped(2) + .map(list -> tuple(list.getOrElse(0, null).response(), list.getOrElse(1, null).response(), getParam(list.getOrElse(0, null)), + getParam(list.getOrElse(1, null)))) + .peek(i -> System.out.println("peeking + " + i)) + .peek(t -> t._1().end("adding " + (t._3() + t._4()))) + .peek(t -> t._2().end("multiplying " + t._3() * t._4())) + .run(); - } + new SimpleReact(c -> vertx.runOnContext(v -> c.run())).from(server) + .then(s -> "server started") + .onFail(e -> "failed toNested skip " + e.getMessage()) + .peek(System.out::println); + while (true) { - } + } - private int getParam(HttpServerRequest req){ - return Integer.parseInt(req.getParam("num")); - } + } + private int getParam(HttpServerRequest req) { + return Integer.parseInt(req.getParam("num")); + } - @Test @Ignore - public void downloadUrls(){ + @Test + @Ignore + public void downloadUrls() { - //cyclops2-react async.Queues + //cyclops2-react async.Queues Queue downloadQueue = new Queue(); Queue completedQueue = new Queue(); //vert.x meets cyclops2-react - Vertx vertx = Vertx.factory.vertx(); - LazyReact react = new LazyReact(c->vertx.runOnContext(v -> c.run())); + Vertx vertx = Vertx.vertx(); + LazyReact react = new LazyReact(c -> vertx.runOnContext(v -> c.run())); //populate the download queue asynchronously - ReactiveSeq.of("www.aol.com","www.rte.ie","www.aol.com") - .peek(next->System.out.println("adding toNested download queue " + next)) - .runFuture(c->vertx.runOnContext(v -> c.run()),t->t.forEach(downloadQueue::add,System.err::println)); + ReactiveSeq.of("www.aol.com", "www.rte.ie", "www.aol.com") + .peek(next -> System.out.println("adding toNested download queue " + next)) + .runFuture(c -> vertx.runOnContext(v -> c.run()), t -> t.forEach(downloadQueue::add, System.err::println)); //download asynchronously : all cyclops2-react tasks are passed into vert.x react.fromStream(downloadQueue.stream()) - .peek(System.out::println) - .map(url->vertx.createHttpClient().getNow(url,"",resp->resp.bodyHandler(body-> completedQueue.add(body.getString(0, body.length()))))) - .run(); - + .peek(System.out::println) + .map(url -> WebClient.create(vertx).get(443, url, "").send().onSuccess(response-> completedQueue.add(response.bodyAsString()))) + .run(); //handle the results completedQueue.stream() - .peek(next->System.out.println("just downloaded" + next)) - .forEach(System.out::println); - + .peek(next -> System.out.println("just downloaded" + next)) + .forEach(System.out::println); } diff --git a/cyclops-futurestream/src/test/java/cyclops/futurestream/react/simple/AlgorithmCompareTest.java b/cyclops-futurestream/src/test/java/cyclops/futurestream/react/simple/AlgorithmCompareTest.java index 11837a390d..6f16bf0aa5 100644 --- a/cyclops-futurestream/src/test/java/cyclops/futurestream/react/simple/AlgorithmCompareTest.java +++ b/cyclops-futurestream/src/test/java/cyclops/futurestream/react/simple/AlgorithmCompareTest.java @@ -1,25 +1,20 @@ package cyclops.futurestream.react.simple; -import static org.hamcrest.Matchers.is; -import static org.junit.Assert.assertThat; +import com.oath.cyclops.util.SimpleTimer; +import cyclops.futurestream.SimpleReact; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.With; +import org.junit.Test; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import java.util.concurrent.ExecutionException; -import org.junit.Test; - -import cyclops.futurestream.SimpleReact; -import com.oath.cyclops.util.SimpleTimer; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.experimental.Builder; -import lombok.experimental.Wither; - - - +import static org.hamcrest.Matchers.is; +import static org.junit.Assert.assertThat; public class AlgorithmCompareTest { @@ -79,7 +74,7 @@ private int retrieval(List list) { - @Wither + @With @Getter @AllArgsConstructor @Builder diff --git a/cyclops-jackson-integration/pom.xml b/cyclops-jackson-integration/pom.xml new file mode 100644 index 0000000000..2b103332ec --- /dev/null +++ b/cyclops-jackson-integration/pom.xml @@ -0,0 +1,81 @@ + + + + com.oath.cyclops + com.oath.cyclops + 10.4.0 + + 4.0.0 + com.oath.cyclops + cyclops-jackson-integration + 10.4.0 + cyclops-jackson + Cyclops integration for Jackson + https://github.com/oath/cyclops + 2015 + + + The MIT License (MIT) + https://github.com/oath/cyclops/blob/master/licence.txt + repo + + + + + johnmcclean + John McClean + john.mcclean@oath.com + + + + ssh://git@github.com:aol/cyclops.git + ssh://git@github.com:aol/cyclops.git + ssh://git@github.com:aol/cyclops.git + + + + com.oath.cyclops + cyclops + 10.4.0 + compile + + + com.fasterxml.jackson.core + jackson-databind + 2.12.0 + compile + + + com.oath.cyclops + cyclops-reactive-collections + 10.4.0 + test + + + com.fasterxml.jackson.datatype + jackson-datatype-jdk8 + 2.12.0 + test + + + junit + junit + ${junit.version} + test + + + org.hamcrest + hamcrest-all + 1.3 + test + + + org.mockito + mockito-all + ${mocikto-all.version} + test + + + diff --git a/cyclops-pure/pom.xml b/cyclops-pure/pom.xml new file mode 100644 index 0000000000..bd19318fbc --- /dev/null +++ b/cyclops-pure/pom.xml @@ -0,0 +1,114 @@ + + + + com.oath.cyclops + com.oath.cyclops + 10.4.0 + + 4.0.0 + com.oath.cyclops + cyclops-pure + 10.4.0 + cyclops-pure + Pure funcional programming for Java 8 and beyond + https://github.com/aol/cyclops-react + 2017 + + + The Apache Software License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + + johnmcclean + John McClean + john.mcclean@oath.com + + + kewangie + Ke Wang + ke.wang@teamaol.com + + + tkountis + Thomas Kountis Wang + thomas.kountis@adtech.com + + + colinfkennedy + Colin Kennedy + Colin.Kennedy@teamaol.com + + + + scm:git@github.com:aol/cyclops-react.git + scm:git@github.com:aol/simple-react.git + scm:git@github.com:aol/cyclops-react.git + + + + com.oath.cyclops + cyclops + 10.4.0 + compile + + + com.oath.cyclops + cyclops-reactive-collections + 10.4.0 + compile + + + org.reactivestreams + reactive-streams-tck + ${reactive-streams.version} + test + + + org.mockito + mockito-core + ${mocikto-core.version} + test + + + io.projectreactor + reactor-core + 3.4.1 + test + + + org.hamcrest + hamcrest-all + 1.3 + test + + + junit + junit + ${junit.version} + test + + + org.testng + testng + ${testng.version} + test + + + com.github.stefanbirkner + system-rules + 1.19.0 + test + + + io.vertx + vertx-core + ${vertx-core.version} + test + + + diff --git a/cyclops-pure/src/main/java/cyclops/instances/control/FutureInstances.java b/cyclops-pure/src/main/java/cyclops/instances/control/FutureInstances.java index 7cb6cc2a52..429164ff81 100644 --- a/cyclops-pure/src/main/java/cyclops/instances/control/FutureInstances.java +++ b/cyclops-pure/src/main/java/cyclops/instances/control/FutureInstances.java @@ -29,7 +29,7 @@ import cyclops.typeclasses.monad.TraverseByTraverse; import lombok.AllArgsConstructor; import lombok.experimental.UtilityClass; -import lombok.experimental.Wither; +import lombok.With; import java.util.function.Function; @@ -132,7 +132,7 @@ public Option> unfoldable() { private final FutureTypeclasses INSTANCE = new FutureTypeclasses(); @AllArgsConstructor - @Wither + @With public static class FutureTypeclasses implements MonadPlus, MonadRec, TraverseByTraverse, diff --git a/cyclops-pure/src/main/java/cyclops/instances/control/OptionInstances.java b/cyclops-pure/src/main/java/cyclops/instances/control/OptionInstances.java index a415aa83e1..d3d5c5e486 100644 --- a/cyclops-pure/src/main/java/cyclops/instances/control/OptionInstances.java +++ b/cyclops-pure/src/main/java/cyclops/instances/control/OptionInstances.java @@ -31,7 +31,7 @@ import cyclops.typeclasses.monad.TraverseByTraverse; import lombok.AllArgsConstructor; import lombok.experimental.UtilityClass; -import lombok.experimental.Wither; +import lombok.With; import java.util.function.Function; @@ -145,7 +145,7 @@ public Option> unfoldable() { private final OptionTypeclasses INSTANCE = new OptionTypeclasses(); @AllArgsConstructor - @Wither + @With public static class OptionTypeclasses implements MonadPlus