blob: f0f2ea71a46099ee0415db9a7470e119a03c4c7d [file] [log] [blame]
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* license agreements; and to You under the Apache License, version 2.0:
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* This file is part of the Apache Pekko project, which was derived from Akka.
*/
/*
* Copyright (C) since 2016 Lightbend Inc. <https://www.lightbend.com>
*/
package docs.javadsl;
import org.apache.pekko.NotUsed;
import org.apache.pekko.stream.connectors.geode.javadsl.Geode;
import org.apache.pekko.stream.connectors.testkit.javadsl.LogCapturingJunit4;
import org.apache.pekko.stream.javadsl.Flow;
import org.apache.pekko.stream.javadsl.Keep;
import org.apache.pekko.stream.javadsl.Sink;
import org.apache.pekko.stream.javadsl.Source;
import org.junit.Rule;
import org.junit.Test;
import java.util.List;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.ExecutionException;
public class GeodeFlowTestCase extends GeodeBaseTestCase {
@Rule public final LogCapturingJunit4 logCapturing = new LogCapturingJunit4();
@Test
public void flow() throws ExecutionException, InterruptedException {
Geode geode = createGeodeClient();
Source<Person, NotUsed> source = buildPersonsSource(110, 111, 113, 114, 115);
// #flow
Flow<Person, Person, NotUsed> flow =
geode.flow(personRegionSettings, new PersonPdxSerializer());
CompletionStage<List<Person>> run =
source.via(flow).toMat(Sink.seq(), Keep.right()).run(system);
// #flow
run.toCompletableFuture().get();
geode.close();
}
}