add Future case to javadsl.SinkTest
This commit is contained in:
parent
122daaa88d
commit
0dbe266dfd
1 changed files with 19 additions and 27 deletions
|
|
@ -3,37 +3,20 @@
|
|||
*/
|
||||
package akka.stream.javadsl;
|
||||
|
||||
import akka.actor.ActorRef;
|
||||
import akka.actor.ActorSystem;
|
||||
import akka.dispatch.Foreach;
|
||||
import akka.dispatch.Futures;
|
||||
import akka.dispatch.OnSuccess;
|
||||
import akka.japi.Pair;
|
||||
import akka.japi.Util;
|
||||
import akka.stream.FlowMaterializer;
|
||||
import akka.stream.MaterializerSettings;
|
||||
import akka.stream.OverflowStrategy;
|
||||
import akka.stream.Transformer;
|
||||
import akka.stream.javadsl.japi.*;
|
||||
import akka.stream.testkit.AkkaSpec;
|
||||
import akka.testkit.JavaTestKit;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.ClassRule;
|
||||
import org.junit.Test;
|
||||
import org.reactivestreams.Publisher;
|
||||
import scala.Option;
|
||||
import scala.collection.immutable.Seq;
|
||||
|
||||
import scala.concurrent.Await;
|
||||
import scala.concurrent.Future;
|
||||
import scala.concurrent.duration.Duration;
|
||||
import scala.concurrent.duration.FiniteDuration;
|
||||
import scala.runtime.BoxedUnit;
|
||||
import scala.util.Try;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import akka.actor.ActorSystem;
|
||||
import akka.stream.FlowMaterializer;
|
||||
import akka.stream.MaterializerSettings;
|
||||
import akka.stream.testkit.AkkaSpec;
|
||||
|
||||
public class SinkTest {
|
||||
|
||||
|
|
@ -48,8 +31,17 @@ public class SinkTest {
|
|||
|
||||
@Test
|
||||
public void mustBeAbleToUseFanoutPublisher() throws Exception {
|
||||
KeyedSink<Object, Publisher<Object>> pubSink = Sink.fanoutPublisher(2, 2);
|
||||
Publisher<Object> publisher = Source.from(new ArrayList<Object>()).runWith(pubSink, materializer);
|
||||
final KeyedSink<Object, Publisher<Object>> pubSink = Sink.fanoutPublisher(2, 2);
|
||||
final Publisher<Object> publisher = Source.from(new ArrayList<Object>()).runWith(pubSink, materializer);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mustBeAbleToUseFuture() throws Exception {
|
||||
final KeyedSink<Integer, Future<Integer>> futSink = Sink.future();
|
||||
final List<Integer> list = new ArrayList<Integer>();
|
||||
list.add(1);
|
||||
final Future<Integer> future = Source.from(list).runWith(futSink, materializer);
|
||||
assert Await.result(future, Duration.create("1 second")).equals(1);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue