+ stream add collectType operator to Source,SubSource,Flow and SubFlow for javadsl.
add docs for collectType, do mirror it in scaladsl mima
This commit is contained in:
parent
39c97c3306
commit
e44fafd4b7
12 changed files with 204 additions and 15 deletions
|
|
@ -11,8 +11,7 @@ import akka.japi.Pair;
|
|||
import akka.japi.function.*;
|
||||
import akka.japi.pf.PFBuilder;
|
||||
import akka.stream.*;
|
||||
import akka.stream.testkit.TestSubscriber;
|
||||
import akka.stream.testkit.javadsl.TestSink;
|
||||
import akka.stream.scaladsl.FlowSpec;
|
||||
import akka.util.ConstantFun;
|
||||
import akka.stream.stage.*;
|
||||
import akka.testkit.AkkaSpec;
|
||||
|
|
@ -446,6 +445,19 @@ public class SourceTest extends StreamTest {
|
|||
probe.expectMsgEquals("C");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mustBeAbleToUseCollectType() throws Exception{
|
||||
final TestKit probe = new TestKit(system);
|
||||
final Iterable<FlowSpec.Apple> input = Collections.singletonList(new FlowSpec.Apple());
|
||||
final Source<FlowSpec.Apple,?> appleSource = Source.from(input);
|
||||
final Source<FlowSpec.Fruit,?> fruitSource = appleSource.collectType(FlowSpec.Fruit.class);
|
||||
fruitSource.collectType(FlowSpec.Apple.class).collectType(FlowSpec.Apple.class)
|
||||
.runForeach((elem) -> {
|
||||
probe.getRef().tell(elem,ActorRef.noSender());
|
||||
},materializer);
|
||||
probe.expectMsgAnyClassOf(FlowSpec.Apple.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mustWorkFromFuture() throws Exception {
|
||||
final Iterable<String> input = Arrays.asList("A", "B", "C");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue