2016-01-13 16:25:24 +01:00
|
|
|
/**
|
2016-02-23 12:58:39 +01:00
|
|
|
* Copyright (C) 2015-2016 Lightbend Inc. <http://www.lightbend.com>
|
2016-01-13 16:25:24 +01:00
|
|
|
*/
|
|
|
|
|
package docs.stream
|
2015-11-02 17:23:39 +01:00
|
|
|
|
2016-01-19 20:26:43 +01:00
|
|
|
import akka.stream.scaladsl._
|
|
|
|
|
import akka.stream.testkit.AkkaSpec
|
2015-11-02 17:23:39 +01:00
|
|
|
|
2015-11-03 14:46:17 +01:00
|
|
|
class MigrationsScala extends AkkaSpec {
|
2015-11-02 17:23:39 +01:00
|
|
|
|
|
|
|
|
"Examples in migration guide" must {
|
|
|
|
|
"compile" in {
|
|
|
|
|
lazy val dontExecuteMe = {
|
2016-01-19 20:26:43 +01:00
|
|
|
//#expand-continually
|
|
|
|
|
Flow[Int].expand(Iterator.continually(_))
|
|
|
|
|
//#expand-continually
|
|
|
|
|
//#expand-state
|
|
|
|
|
Flow[Int].expand(i => {
|
|
|
|
|
var state = 0
|
|
|
|
|
Iterator.continually({
|
|
|
|
|
state += 1
|
|
|
|
|
(i, state)
|
2015-11-02 17:23:39 +01:00
|
|
|
})
|
2016-01-19 20:26:43 +01:00
|
|
|
})
|
|
|
|
|
//#expand-state
|
2016-02-10 13:56:38 +01:00
|
|
|
|
|
|
|
|
//#async
|
|
|
|
|
val flow = Flow[Int].map(_ + 1)
|
|
|
|
|
Source(1 to 10).via(flow.async)
|
|
|
|
|
//#async
|
2015-11-02 17:23:39 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|