+doc Add more imports to the stream quick start guides for Java and Scala (#20797)

* Add more imports to the stream quick start guides.

This makes it easier for people to execute the code samples while they
read through the guide.

* Change line endings to be consistent with other files

For some reason these 2 files had CR+LF line endings.
This commit is contained in:
Chris Birchall 2016-06-18 11:15:17 +02:00 committed by Konrad Malawski
parent a9cb8ab4b5
commit f246c56087
4 changed files with 692 additions and 677 deletions

View file

@ -3,23 +3,27 @@
*/ */
package docs.stream; package docs.stream;
//#stream-imports
import akka.stream.*;
import akka.stream.javadsl.*;
//#stream-imports
//#other-imports
import akka.Done;
import akka.NotUsed;
import akka.actor.ActorSystem;
import akka.util.ByteString;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.math.BigInteger; import java.math.BigInteger;
import java.util.concurrent.CompletionStage; import java.util.concurrent.CompletionStage;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.junit.*;
import akka.Done;
import akka.NotUsed;
import akka.actor.ActorSystem;
//#imports
import akka.stream.*;
import akka.stream.javadsl.*;
//#imports
import akka.util.ByteString;
import scala.concurrent.duration.Duration; import scala.concurrent.duration.Duration;
//#other-imports
import org.junit.*;
/** /**
* This class is not meant to be run as a test in the test suite, but it * This class is not meant to be run as a test in the test suite, but it

View file

@ -6,7 +6,11 @@ Quick Start Guide
A stream usually begins at a source, so this is also how we start an Akka A stream usually begins at a source, so this is also how we start an Akka
Stream. Before we create one, we import the full complement of streaming tools: Stream. Before we create one, we import the full complement of streaming tools:
.. includecode:: ../code/docs/stream/QuickStartDocTest.java#imports .. includecode:: ../code/docs/stream/QuickStartDocTest.java#stream-imports
If you want to execute the code samples while you read through the quick start guide, you will also need the following imports:
.. includecode:: ../code/docs/stream/QuickStartDocTest.java#other-imports
Now we will start with a rather simple source, emitting the integers 1 to 100: Now we will start with a rather simple source, emitting the integers 1 to 100:

View file

@ -3,19 +3,22 @@
*/ */
package docs.stream package docs.stream
//#imports //#stream-imports
import akka.stream._ import akka.stream._
import akka.stream.scaladsl._ import akka.stream.scaladsl._
//#imports //#stream-imports
//#other-imports
import akka.{ NotUsed, Done } import akka.{ NotUsed, Done }
import akka.actor.ActorSystem import akka.actor.ActorSystem
import akka.util.ByteString import akka.util.ByteString
import org.scalatest._
import org.scalatest.concurrent._
import scala.concurrent._ import scala.concurrent._
import scala.concurrent.duration._ import scala.concurrent.duration._
import java.nio.file.Paths import java.nio.file.Paths
//#other-imports
import org.scalatest._
import org.scalatest.concurrent._
class QuickStartDocSpec extends WordSpec with BeforeAndAfterAll with ScalaFutures { class QuickStartDocSpec extends WordSpec with BeforeAndAfterAll with ScalaFutures {
implicit val patience = PatienceConfig(5.seconds) implicit val patience = PatienceConfig(5.seconds)

View file

@ -6,7 +6,11 @@ Quick Start Guide
A stream usually begins at a source, so this is also how we start an Akka A stream usually begins at a source, so this is also how we start an Akka
Stream. Before we create one, we import the full complement of streaming tools: Stream. Before we create one, we import the full complement of streaming tools:
.. includecode:: ../code/docs/stream/QuickStartDocSpec.scala#imports .. includecode:: ../code/docs/stream/QuickStartDocSpec.scala#stream-imports
If you want to execute the code samples while you read through the quick start guide, you will also need the following imports:
.. includecode:: ../code/docs/stream/QuickStartDocSpec.scala#other-imports
Now we will start with a rather simple source, emitting the integers 1 to 100: Now we will start with a rather simple source, emitting the integers 1 to 100: