Search in sources :

Example 6 with TestTopologyBuilder

use of org.apache.heron.integration_test.core.TestTopologyBuilder in project heron by twitter.

the class StreamletWithFilterAndTransform method buildTopology.

@Override
protected TestTopologyBuilder buildTopology(TestTopologyBuilder testTopologyBuilder) {
    AtomicInteger atomicInteger = new AtomicInteger(0);
    Builder streamletBuilder = Builder.newBuilder();
    streamletBuilder.newSource(() -> atomicInteger.getAndIncrement()).setName("incremented-numbers").filter(i -> i <= 7).setName("numbers-lower-than-8").transform(new TextTransformer()).setName("numbers-transformed-to-text");
    BuilderImpl streamletBuilderImpl = (BuilderImpl) streamletBuilder;
    TestTopologyBuilder topology = (TestTopologyBuilder) streamletBuilderImpl.build(testTopologyBuilder);
    return topology;
}
Also used : Consumer(java.util.function.Consumer) MalformedURLException(java.net.MalformedURLException) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Config(org.apache.heron.api.Config) AbstractTestTopology(org.apache.heron.integration_test.common.AbstractTestTopology) SerializableTransformer(org.apache.heron.streamlet.SerializableTransformer) Context(org.apache.heron.streamlet.Context) Builder(org.apache.heron.streamlet.Builder) TestTopologyBuilder(org.apache.heron.integration_test.core.TestTopologyBuilder) BuilderImpl(org.apache.heron.streamlet.impl.BuilderImpl) BuilderImpl(org.apache.heron.streamlet.impl.BuilderImpl) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Builder(org.apache.heron.streamlet.Builder) TestTopologyBuilder(org.apache.heron.integration_test.core.TestTopologyBuilder) TestTopologyBuilder(org.apache.heron.integration_test.core.TestTopologyBuilder)

Aggregations

Config (org.apache.heron.api.Config)6 TestTopologyBuilder (org.apache.heron.integration_test.core.TestTopologyBuilder)6 MalformedURLException (java.net.MalformedURLException)4 AbstractTestTopology (org.apache.heron.integration_test.common.AbstractTestTopology)4 Builder (org.apache.heron.streamlet.Builder)4 BuilderImpl (org.apache.heron.streamlet.impl.BuilderImpl)4 Streamlet (org.apache.heron.streamlet.Streamlet)3 Arrays (java.util.Arrays)2 HashSet (java.util.HashSet)2 Set (java.util.Set)2 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)2 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Consumer (java.util.function.Consumer)1 Fields (org.apache.heron.api.tuple.Fields)1 BasicConfig (org.apache.heron.integration_test.common.BasicConfig)1 IdentityBolt (org.apache.heron.integration_test.common.bolt.IdentityBolt)1 PausedLocalFileSpout (org.apache.heron.integration_test.common.spout.PausedLocalFileSpout)1 Context (org.apache.heron.streamlet.Context)1