+str #19069 Add FlowOp.prepend for prepending Sources to Flows
This commit is contained in:
parent
dcfa56e547
commit
52655f2836
10 changed files with 216 additions and 1 deletions
|
|
@ -408,6 +408,25 @@ public class FlowTest extends StreamTest {
|
|||
assertEquals(Arrays.asList("A", "B", "C", "D", "E", "F"), output);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mustBeAbleToUsePrepend() {
|
||||
final JavaTestKit probe = new JavaTestKit(system);
|
||||
final Iterable<String> input1 = Arrays.asList("A", "B", "C");
|
||||
final Iterable<String> input2 = Arrays.asList("D", "E", "F");
|
||||
|
||||
final Source<String, ?> in1 = Source.from(input1);
|
||||
final Source<String, ?> in2 = Source.from(input2);
|
||||
final Flow<String, String, ?> flow = Flow.of(String.class);
|
||||
in2.via(flow.prepend(in1)).runForeach(new Procedure<String>() {
|
||||
public void apply(String elem) {
|
||||
probe.getRef().tell(elem, ActorRef.noSender());
|
||||
}
|
||||
}, materializer);
|
||||
|
||||
List<Object> output = Arrays.asList(probe.receiveN(6));
|
||||
assertEquals(Arrays.asList("A", "B", "C", "D", "E", "F"), output);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mustBeAbleToUsePrefixAndTail() throws Exception {
|
||||
final JavaTestKit probe = new JavaTestKit(system);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue