Fix Scala 2.12 compilation error in akka-stream-tests (#31246)
* immutable.Seq
This commit is contained in:
parent
c2b53464a9
commit
22089bd5cf
2 changed files with 12 additions and 9 deletions
|
|
@ -166,7 +166,7 @@ class FlowMergeSpec extends BaseTwoStreamsSetup {
|
||||||
val sourceC = Source(List(100, 200, 300, 400))
|
val sourceC = Source(List(100, 200, 300, 400))
|
||||||
|
|
||||||
Source
|
Source
|
||||||
.mergePrioritizedN(Seq((sourceA, 9900), (sourceB, 99), (sourceC, 1)), eagerComplete = false)
|
.mergePrioritizedN(List((sourceA, 9900), (sourceB, 99), (sourceC, 1)), eagerComplete = false)
|
||||||
.runWith(Sink.foreach(println))
|
.runWith(Sink.foreach(println))
|
||||||
// prints e.g. 1, 100, 2, 3, 4, 10, 20, 30, 40, 200, 300, 400 since both sources have their first element ready and
|
// prints e.g. 1, 100, 2, 3, 4, 10, 20, 30, 40, 200, 300, 400 since both sources have their first element ready and
|
||||||
// the left sourceA has higher priority - if both sources have elements ready, sourceA has a 99% chance of being picked next
|
// the left sourceA has higher priority - if both sources have elements ready, sourceA has a 99% chance of being picked next
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
package akka.stream.scaladsl
|
package akka.stream.scaladsl
|
||||||
|
|
||||||
|
import scala.collection.immutable
|
||||||
import akka.NotUsed
|
import akka.NotUsed
|
||||||
import akka.stream.testkit.TestSubscriber.ManualProbe
|
import akka.stream.testkit.TestSubscriber.ManualProbe
|
||||||
import akka.stream.testkit.{ StreamSpec, TestSubscriber }
|
import akka.stream.testkit.{ StreamSpec, TestSubscriber }
|
||||||
|
|
@ -19,13 +20,13 @@ class GraphMergePrioritizedNSpec extends StreamSpec {
|
||||||
val source2 = Source.fromIterator(() => (4 to 6).iterator)
|
val source2 = Source.fromIterator(() => (4 to 6).iterator)
|
||||||
val source3 = Source.fromIterator(() => (7 to 9).iterator)
|
val source3 = Source.fromIterator(() => (7 to 9).iterator)
|
||||||
|
|
||||||
val sourcesAndPriorities = Seq((source1, 6), (source2, 3), (source3, 1));
|
val sourcesAndPriorities = List((source1, 6), (source2, 3), (source3, 1))
|
||||||
val probe = TestSubscriber.manualProbe[Int]()
|
val probe = TestSubscriber.manualProbe[Int]()
|
||||||
threeSourceMerge(sourcesAndPriorities, probe).run()
|
threeSourceMerge(sourcesAndPriorities, probe).run()
|
||||||
|
|
||||||
val subscription = probe.expectSubscription()
|
val subscription = probe.expectSubscription()
|
||||||
|
|
||||||
var collected = Seq.empty[Int]
|
var collected = Vector.empty[Int]
|
||||||
for (_ <- 1 to 9) {
|
for (_ <- 1 to 9) {
|
||||||
subscription.request(1)
|
subscription.request(1)
|
||||||
collected :+= probe.expectNext()
|
collected :+= probe.expectNext()
|
||||||
|
|
@ -41,7 +42,7 @@ class GraphMergePrioritizedNSpec extends StreamSpec {
|
||||||
val source2 = Source.fromIterator(() => Iterator.continually(2).take(elementCount))
|
val source2 = Source.fromIterator(() => Iterator.continually(2).take(elementCount))
|
||||||
val source3 = Source.fromIterator(() => Iterator.continually(3).take(elementCount))
|
val source3 = Source.fromIterator(() => Iterator.continually(3).take(elementCount))
|
||||||
|
|
||||||
val sourcesAndPriorities = Seq((source1, 6), (source2, 3), (source3, 1));
|
val sourcesAndPriorities = List((source1, 6), (source2, 3), (source3, 1));
|
||||||
|
|
||||||
val probe = TestSubscriber.manualProbe[Int]()
|
val probe = TestSubscriber.manualProbe[Int]()
|
||||||
|
|
||||||
|
|
@ -49,7 +50,7 @@ class GraphMergePrioritizedNSpec extends StreamSpec {
|
||||||
|
|
||||||
val subscription = probe.expectSubscription()
|
val subscription = probe.expectSubscription()
|
||||||
|
|
||||||
val builder = Seq.newBuilder[Int]
|
val builder = Vector.newBuilder[Int]
|
||||||
for (_ <- 1 to elementCount) {
|
for (_ <- 1 to elementCount) {
|
||||||
subscription.request(1)
|
subscription.request(1)
|
||||||
builder += probe.expectNext()
|
builder += probe.expectNext()
|
||||||
|
|
@ -71,7 +72,7 @@ class GraphMergePrioritizedNSpec extends StreamSpec {
|
||||||
val source2 = Source.fromIterator[Int](() => Iterator.empty)
|
val source2 = Source.fromIterator[Int](() => Iterator.empty)
|
||||||
val source3 = Source.fromIterator[Int](() => Iterator.empty)
|
val source3 = Source.fromIterator[Int](() => Iterator.empty)
|
||||||
|
|
||||||
val sourcesAndPriorities = Seq((source1, 6), (source2, 3), (source3, 1));
|
val sourcesAndPriorities = List((source1, 6), (source2, 3), (source3, 1))
|
||||||
|
|
||||||
val probe = TestSubscriber.manualProbe[Int]()
|
val probe = TestSubscriber.manualProbe[Int]()
|
||||||
|
|
||||||
|
|
@ -79,7 +80,7 @@ class GraphMergePrioritizedNSpec extends StreamSpec {
|
||||||
|
|
||||||
val subscription = probe.expectSubscription()
|
val subscription = probe.expectSubscription()
|
||||||
|
|
||||||
var collected = Seq.empty[Int]
|
var collected = Vector.empty[Int]
|
||||||
for (_ <- 1 to elementCount) {
|
for (_ <- 1 to elementCount) {
|
||||||
subscription.request(1)
|
subscription.request(1)
|
||||||
collected :+= probe.expectNext()
|
collected :+= probe.expectNext()
|
||||||
|
|
@ -100,7 +101,7 @@ class GraphMergePrioritizedNSpec extends StreamSpec {
|
||||||
val source2 = Source.fromIterator(() => Iterator.continually(2).take(elementCount))
|
val source2 = Source.fromIterator(() => Iterator.continually(2).take(elementCount))
|
||||||
val source3 = Source.fromIterator[Int](() => Iterator.empty)
|
val source3 = Source.fromIterator[Int](() => Iterator.empty)
|
||||||
|
|
||||||
val sourcesAndPriorities = Seq((source1, 6), (source2, 3), (source3, 1));
|
val sourcesAndPriorities = List((source1, 6), (source2, 3), (source3, 1))
|
||||||
|
|
||||||
val probe = TestSubscriber.manualProbe[Int]()
|
val probe = TestSubscriber.manualProbe[Int]()
|
||||||
|
|
||||||
|
|
@ -124,7 +125,9 @@ class GraphMergePrioritizedNSpec extends StreamSpec {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private def threeSourceMerge[T](sourceAndPriorities: Seq[(Source[T, NotUsed], Int)], probe: ManualProbe[T]) = {
|
private def threeSourceMerge[T](
|
||||||
|
sourceAndPriorities: immutable.Seq[(Source[T, NotUsed], Int)],
|
||||||
|
probe: ManualProbe[T]) = {
|
||||||
|
|
||||||
Source
|
Source
|
||||||
.mergePrioritizedN(sourceAndPriorities, eagerComplete = false)
|
.mergePrioritizedN(sourceAndPriorities, eagerComplete = false)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue