!str #16902: Unify stream internal representation
also =str #16912: Fix StreamTcpSpec flakiness
This commit is contained in:
parent
cac9c9f2fb
commit
8d77fa8b29
230 changed files with 7814 additions and 9596 deletions
|
|
@ -13,89 +13,90 @@ class GraphCyclesSpec extends AkkaSpec {
|
|||
|
||||
"include a deadlocked cycle" in {
|
||||
|
||||
// format: OFF
|
||||
//#deadlocked
|
||||
// WARNING! The graph below deadlocks!
|
||||
FlowGraph { implicit b =>
|
||||
import FlowGraphImplicits._
|
||||
b.allowCycles()
|
||||
FlowGraph.closed() { implicit b =>
|
||||
import FlowGraph.Implicits._
|
||||
|
||||
val merge = Merge[Int]
|
||||
val bcast = Broadcast[Int]
|
||||
val merge = b.add(Merge[Int](2))
|
||||
val bcast = b.add(Broadcast[Int](2))
|
||||
|
||||
source ~> merge ~> Flow[Int].map { (s) => println(s); s } ~> bcast ~> Sink.ignore
|
||||
bcast ~> merge
|
||||
source ~> merge ~> Flow[Int].map { s => println(s); s } ~> bcast ~> Sink.ignore()
|
||||
merge <~ bcast
|
||||
}
|
||||
//#deadlocked
|
||||
|
||||
// format: ON
|
||||
}
|
||||
|
||||
"include an unfair cycle" in {
|
||||
// format: OFF
|
||||
//#unfair
|
||||
// WARNING! The graph below stops consuming from "source" after a few steps
|
||||
FlowGraph { implicit b =>
|
||||
import FlowGraphImplicits._
|
||||
b.allowCycles()
|
||||
FlowGraph.closed() { implicit b =>
|
||||
import FlowGraph.Implicits._
|
||||
|
||||
val merge = MergePreferred[Int]
|
||||
val bcast = Broadcast[Int]
|
||||
val merge = b.add(MergePreferred[Int](1))
|
||||
val bcast = b.add(Broadcast[Int](2))
|
||||
|
||||
source ~> merge ~> Flow[Int].map { (s) => println(s); s } ~> bcast ~> Sink.ignore
|
||||
bcast ~> merge.preferred
|
||||
source ~> merge ~> Flow[Int].map { s => println(s); s } ~> bcast ~> Sink.ignore()
|
||||
merge.preferred <~ bcast
|
||||
}
|
||||
//#unfair
|
||||
|
||||
// format: ON
|
||||
}
|
||||
|
||||
"include a dropping cycle" in {
|
||||
// format: OFF
|
||||
//#dropping
|
||||
FlowGraph { implicit b =>
|
||||
import FlowGraphImplicits._
|
||||
b.allowCycles()
|
||||
FlowGraph.closed() { implicit b =>
|
||||
import FlowGraph.Implicits._
|
||||
|
||||
val merge = Merge[Int]
|
||||
val bcast = Broadcast[Int]
|
||||
val merge = b.add(Merge[Int](2))
|
||||
val bcast = b.add(Broadcast[Int](2))
|
||||
|
||||
source ~> merge ~> Flow[Int].map { (s) => println(s); s } ~> bcast ~> Sink.ignore
|
||||
bcast ~> Flow[Int].buffer(10, OverflowStrategy.dropHead) ~> merge
|
||||
source ~> merge ~> Flow[Int].map { s => println(s); s } ~> bcast ~> Sink.ignore()
|
||||
merge <~ Flow[Int].buffer(10, OverflowStrategy.dropHead) <~ bcast
|
||||
}
|
||||
//#dropping
|
||||
|
||||
// format: ON
|
||||
}
|
||||
|
||||
"include a dead zipping cycle" in {
|
||||
// format: OFF
|
||||
//#zipping-dead
|
||||
// WARNING! The graph below never processes any elements
|
||||
FlowGraph { implicit b =>
|
||||
import FlowGraphImplicits._
|
||||
b.allowCycles()
|
||||
FlowGraph.closed() { implicit b =>
|
||||
import FlowGraph.Implicits._
|
||||
|
||||
val zip = ZipWith[Int, Int, Int]((left, right) => right)
|
||||
val bcast = Broadcast[Int]
|
||||
val zip = b.add(ZipWith[Int, Int, Int]((left, right) => right))
|
||||
val bcast = b.add(Broadcast[Int](2))
|
||||
|
||||
source ~> zip.left ~> Flow[Int].map { (s) => println(s); s } ~> bcast ~> Sink.ignore
|
||||
bcast ~> zip.right
|
||||
source ~> zip.in0
|
||||
zip.out.map { s => println(s); s } ~> bcast ~> Sink.ignore()
|
||||
zip.in1 <~ bcast
|
||||
}
|
||||
//#zipping-dead
|
||||
|
||||
// format: ON
|
||||
}
|
||||
|
||||
"include a live zipping cycle" in {
|
||||
// format: OFF
|
||||
//#zipping-live
|
||||
FlowGraph { implicit b =>
|
||||
import FlowGraphImplicits._
|
||||
b.allowCycles()
|
||||
FlowGraph.closed() { implicit b =>
|
||||
import FlowGraph.Implicits._
|
||||
|
||||
val zip = ZipWith[Int, Int, Int]((left, right) => left)
|
||||
val bcast = Broadcast[Int]
|
||||
val concat = Concat[Int]
|
||||
|
||||
source ~> zip.left ~> Flow[Int].map { (s) => println(s); s } ~> bcast ~> Sink.ignore
|
||||
bcast ~> concat.second ~> zip.right
|
||||
Source.single(0) ~> concat.first
|
||||
val zip = b.add(ZipWith((left: Int, right: Int) => left))
|
||||
val bcast = b.add(Broadcast[Int](2))
|
||||
val concat = b.add(Concat[Int]())
|
||||
|
||||
source ~> zip.in0
|
||||
zip.out.map { s => println(s); s } ~> bcast ~> Sink.ignore()
|
||||
zip.in1 <~ concat <~ bcast
|
||||
concat <~ Source.single(0)
|
||||
}
|
||||
//#zipping-live
|
||||
|
||||
// format: ON
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue