From 5216c8b403ad3dd8f430b268265aab9a6f23c4a5 Mon Sep 17 00:00:00 2001 From: Josep Prat Date: Fri, 11 Aug 2017 19:23:11 +0200 Subject: [PATCH] =doc Fix wrong scala/java snippet directives #23513 Issue: #23513 Fix inline snippet in stream-io Fix wrong rendering on other pages --- akka-docs/src/main/paradox/scala/logging.md | 5 +++-- .../main/paradox/scala/stream/stream-flows-and-basics.md | 3 ++- akka-docs/src/main/paradox/scala/stream/stream-io.md | 9 +-------- .../src/main/paradox/scala/stream/stream-quickstart.md | 6 +++--- .../src/test/java/jdocs/stream/io/StreamTcpDocTest.java | 4 ++-- 5 files changed, 11 insertions(+), 16 deletions(-) diff --git a/akka-docs/src/main/paradox/scala/logging.md b/akka-docs/src/main/paradox/scala/logging.md index c3c935ac64..3d0fae2ba1 100644 --- a/akka-docs/src/main/paradox/scala/logging.md +++ b/akka-docs/src/main/paradox/scala/logging.md @@ -254,7 +254,9 @@ loggers, which are based upon the originating object’s class name as log category. The override of `getClazz` is only included for demonstration purposes as it contains exactly the default behavior. -@@@ note +@@@ + +@@@ note { .group-scala } You may also create the string representation up front and pass that in as the log source, but be aware that then the `Class[_]` which will be @@ -267,7 +269,6 @@ might want to do this also in case you implement your own logging adapter. @@@ -@@@ ### Turn Off Logging diff --git a/akka-docs/src/main/paradox/scala/stream/stream-flows-and-basics.md b/akka-docs/src/main/paradox/scala/stream/stream-flows-and-basics.md index d1a534b9fb..2f64bcf82a 100644 --- a/akka-docs/src/main/paradox/scala/stream/stream-flows-and-basics.md +++ b/akka-docs/src/main/paradox/scala/stream/stream-flows-and-basics.md @@ -254,7 +254,8 @@ but is not restricted to that—it could also mean opening files or socket conne Materialization is triggered at so called "terminal operations". Most notably this includes the various forms of the `run()` and `runWith()` methods defined on `Source` and `Flow` elements as well as a small number of special syntactic sugars for running with -well-known sinks, such as @scala[`runForeach(el => ...)`] @java[`runForeach(el -> ...)`] (being an alias to @scala[`runWith(Sink.foreach(el => ...))`] @java[`runWith(Sink.foreach(el -> ...))`]. +well-known sinks, such as @scala[`runForeach(el => ...)`]@java[`runForeach(el -> ...)`] +(being an alias to @scala[`runWith(Sink.foreach(el => ...))`]@java[`runWith(Sink.foreach(el -> ...))`]). Materialization is currently performed synchronously on the materializing thread. The actual stream processing is handled by actors started up during the streams materialization, diff --git a/akka-docs/src/main/paradox/scala/stream/stream-io.md b/akka-docs/src/main/paradox/scala/stream/stream-io.md index ed1c5f411c..2cddad7b0c 100644 --- a/akka-docs/src/main/paradox/scala/stream/stream-io.md +++ b/akka-docs/src/main/paradox/scala/stream/stream-io.md @@ -23,7 +23,7 @@ Java Next, we simply handle *each* incoming connection using a `Flow` which will be used as the processing stage to handle and emit `ByteString` s from and to the TCP Socket. Since one `ByteString` does not have to necessarily correspond to exactly one line of text (the client might be sending the line in chunks) we use the @scala[`Framing.delimiter`]@java[`delimiter`] -helper Flow @scala[]@java[from `akka.stream.javadsl.Framing`] to chunk the inputs up into actual lines of text. The last boolean +helper Flow @java[from `akka.stream.javadsl.Framing`] to chunk the inputs up into actual lines of text. The last boolean argument indicates that we require an explicit line ending even for the last message before the connection is closed. In this example we simply add exclamation marks to each incoming text message and push it through the flow: @@ -45,17 +45,10 @@ It is also possible to shut down the server's socket by cancelling the `Incoming We can then test the TCP server by sending data to the TCP Socket using `netcat`: -@scala[ ``` $ echo -n "Hello World" | netcat 127.0.0.1 8888 Hello World!!! ``` -]@java[ -``` -$ echo -n "Hello World" | netcat 127.0.0.1 8889 -Hello World!!! -``` -] ### Connecting: REPL Client diff --git a/akka-docs/src/main/paradox/scala/stream/stream-quickstart.md b/akka-docs/src/main/paradox/scala/stream/stream-quickstart.md index bd371bcf4b..01c3056fda 100644 --- a/akka-docs/src/main/paradox/scala/stream/stream-quickstart.md +++ b/akka-docs/src/main/paradox/scala/stream/stream-quickstart.md @@ -85,7 +85,7 @@ There are other ways to create a materializer, e.g. from an thing that makes streams run—you don’t need to worry about any of the details just now apart from that you need one for calling any of the `run` methods on a `Source`. @scala[The materializer is picked up implicitly if it is omitted -from the `run` method call arguments, which we will do in the following.]@java[] +from the `run` method call arguments, which we will do in the following.] The nice thing about Akka Streams is that the `Source` is just a description of what you want to run, and like an architect’s blueprint it can @@ -271,7 +271,7 @@ Java Finally in order to @ref:[materialize](stream-flows-and-basics.md#stream-materialization) and run the stream computation we need to attach the Flow to a @scala[`Sink`]@java[`Sink`] that will get the Flow running. The simplest way to do this is to call -`runWith(sink)` on a @scala[`Source`]@java[`Source`]. For convenience a number of common Sinks are predefined and collected as @scala[]@java[static] methods on +`runWith(sink)` on a @scala[`Source`]@java[`Source`]. For convenience a number of common Sinks are predefined and collected as @java[static] methods on the @scala[`Sink` companion object]@java[`Sink class`]. For now let's simply print each author: @@ -421,7 +421,7 @@ has also a type parameter of @scala[`Future[Int]`]@java[`CompletionStage>`]. Next we call `run()` which uses the @scala[implicit]@java[] `ActorMaterializer` +be `run()`, as indicated by its type: @scala[`RunnableGraph[Future[Int]]`]@java[`RunnableGraph>`]. Next we call `run()` which uses the @scala[implicit] `ActorMaterializer` to materialize and run the Flow. The value returned by calling `run()` on a @scala[`RunnableGraph[T]`]@java[`RunnableGraph`] is of type `T`. In our case this type is @scala[`Future[Int]`]@java[`CompletionStage`] which, when completed, will contain the total length of our `tweets` stream. In case of the stream failing, this future would complete with a Failure. diff --git a/akka-docs/src/test/java/jdocs/stream/io/StreamTcpDocTest.java b/akka-docs/src/test/java/jdocs/stream/io/StreamTcpDocTest.java index e5edc2f4de..5006ed412a 100644 --- a/akka-docs/src/test/java/jdocs/stream/io/StreamTcpDocTest.java +++ b/akka-docs/src/test/java/jdocs/stream/io/StreamTcpDocTest.java @@ -64,7 +64,7 @@ public class StreamTcpDocTest extends AbstractJavaTest { //#echo-server-simple-bind // IncomingConnection and ServerBinding imported from Tcp final Source> connections = - Tcp.get(system).bind("127.0.0.1", 8889); + Tcp.get(system).bind("127.0.0.1", 8888); //#echo-server-simple-bind } { @@ -133,7 +133,7 @@ public class StreamTcpDocTest extends AbstractJavaTest { { //#repl-client final Flow> connection = - Tcp.get(system).outgoingConnection("127.0.0.1", 8889); + Tcp.get(system).outgoingConnection("127.0.0.1", 8888); //#repl-client }