Search in sources :

Example 1 with TestSources

use of com.hazelcast.jet.pipeline.test.TestSources in project hazelcast by hazelcast.

the class ManagedContextTest method testSources.

private void testSources(SupplierEx<? extends AnotherSourceContext> sourceSupplier) {
    BatchSource<String> src = SourceBuilder.batch("source", c -> sourceSupplier.get()).<String>fillBufferFn((c, b) -> {
        b.add(c.injectedValue);
        b.close();
    }).build();
    Pipeline pipeline = Pipeline.create();
    pipeline.readFrom(src).writeTo(assertAnyOrder(singletonList(INJECTED_VALUE)));
    hz.getJet().newJob(pipeline).join();
}
Also used : Config(com.hazelcast.config.Config) HazelcastInstance(com.hazelcast.core.HazelcastInstance) FunctionEx(com.hazelcast.function.FunctionEx) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) ManagedContext(com.hazelcast.core.ManagedContext) BatchSource(com.hazelcast.jet.pipeline.BatchSource) Pipeline(com.hazelcast.jet.pipeline.Pipeline) QuickTest(com.hazelcast.test.annotation.QuickTest) RunWith(org.junit.runner.RunWith) Test(org.junit.Test) Category(org.junit.experimental.categories.Category) SupplierEx(com.hazelcast.function.SupplierEx) Collections.singletonList(java.util.Collections.singletonList) Sources(com.hazelcast.jet.pipeline.Sources) AssertionSinks.assertAnyOrder(com.hazelcast.jet.pipeline.test.AssertionSinks.assertAnyOrder) TestSources(com.hazelcast.jet.pipeline.test.TestSources) HazelcastParallelClassRunner(com.hazelcast.test.HazelcastParallelClassRunner) ServiceFactory(com.hazelcast.jet.pipeline.ServiceFactory) SinkBuilder(com.hazelcast.jet.pipeline.SinkBuilder) SourceBuilder(com.hazelcast.jet.pipeline.SourceBuilder) ServiceFactories(com.hazelcast.jet.pipeline.ServiceFactories) Sink(com.hazelcast.jet.pipeline.Sink) Assert.assertEquals(org.junit.Assert.assertEquals) Before(org.junit.Before) Pipeline(com.hazelcast.jet.pipeline.Pipeline)

Aggregations

Config (com.hazelcast.config.Config)1 HazelcastInstance (com.hazelcast.core.HazelcastInstance)1 ManagedContext (com.hazelcast.core.ManagedContext)1 FunctionEx (com.hazelcast.function.FunctionEx)1 SupplierEx (com.hazelcast.function.SupplierEx)1 BatchSource (com.hazelcast.jet.pipeline.BatchSource)1 Pipeline (com.hazelcast.jet.pipeline.Pipeline)1 ServiceFactories (com.hazelcast.jet.pipeline.ServiceFactories)1 ServiceFactory (com.hazelcast.jet.pipeline.ServiceFactory)1 Sink (com.hazelcast.jet.pipeline.Sink)1 SinkBuilder (com.hazelcast.jet.pipeline.SinkBuilder)1 SourceBuilder (com.hazelcast.jet.pipeline.SourceBuilder)1 Sources (com.hazelcast.jet.pipeline.Sources)1 AssertionSinks.assertAnyOrder (com.hazelcast.jet.pipeline.test.AssertionSinks.assertAnyOrder)1 TestSources (com.hazelcast.jet.pipeline.test.TestSources)1 HazelcastParallelClassRunner (com.hazelcast.test.HazelcastParallelClassRunner)1 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)1 QuickTest (com.hazelcast.test.annotation.QuickTest)1 Collections.singletonList (java.util.Collections.singletonList)1 Assert.assertEquals (org.junit.Assert.assertEquals)1