Search in sources :

Example 6 with SimpleEvent

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

the class SpringServiceFactoriesTest method testMapStreamUsingSpringBean.

@Test
public void testMapStreamUsingSpringBean() {
    Pipeline pipeline = Pipeline.create();
    pipeline.readFrom(TestSources.itemStream(100)).withNativeTimestamps(0).map(SimpleEvent::sequence).mapUsingService(bean("calculator"), Calculator::multiply).writeTo(assertCollectedEventually(10, c -> {
        assertTrue(c.size() > 100);
        c.forEach(i -> assertTrue(i <= 0));
    }));
    Job job = jet.newJob(pipeline);
    assertJobCompleted(job);
}
Also used : AfterClass(org.junit.AfterClass) BeforeClass(org.junit.BeforeClass) Pipeline(com.hazelcast.jet.pipeline.Pipeline) SimpleEvent(com.hazelcast.jet.pipeline.test.SimpleEvent) CustomSpringJUnit4ClassRunner(com.hazelcast.spring.CustomSpringJUnit4ClassRunner) AssertionSinks.assertCollectedEventually(com.hazelcast.jet.pipeline.test.AssertionSinks.assertCollectedEventually) RunWith(org.junit.runner.RunWith) Resource(javax.annotation.Resource) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) CompletionException(java.util.concurrent.CompletionException) JetService(com.hazelcast.jet.JetService) AssertionSinks.assertAnyOrder(com.hazelcast.jet.pipeline.test.AssertionSinks.assertAnyOrder) TestSources(com.hazelcast.jet.pipeline.test.TestSources) Hazelcast(com.hazelcast.core.Hazelcast) Arrays.asList(java.util.Arrays.asList) ContextConfiguration(org.springframework.test.context.ContextConfiguration) Assert.fail(org.junit.Assert.fail) JetSpringServiceFactories.bean(com.hazelcast.spring.jet.JetSpringServiceFactories.bean) Assert.assertEquals(org.junit.Assert.assertEquals) Job(com.hazelcast.jet.Job) SimpleEvent(com.hazelcast.jet.pipeline.test.SimpleEvent) Job(com.hazelcast.jet.Job) Pipeline(com.hazelcast.jet.pipeline.Pipeline) Test(org.junit.Test)

Aggregations

Job (com.hazelcast.jet.Job)6 Pipeline (com.hazelcast.jet.pipeline.Pipeline)6 SimpleEvent (com.hazelcast.jet.pipeline.test.SimpleEvent)6 Test (org.junit.Test)6 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)4 QuickTest (com.hazelcast.test.annotation.QuickTest)4 TestSources (com.hazelcast.jet.pipeline.test.TestSources)3 Assert.assertEquals (org.junit.Assert.assertEquals)3 Assert.assertTrue (org.junit.Assert.assertTrue)3 Assert.fail (org.junit.Assert.fail)3 Hazelcast (com.hazelcast.core.Hazelcast)2 JetService (com.hazelcast.jet.JetService)2 AssertionSinks.assertAnyOrder (com.hazelcast.jet.pipeline.test.AssertionSinks.assertAnyOrder)2 AssertionSinks.assertCollectedEventually (com.hazelcast.jet.pipeline.test.AssertionSinks.assertCollectedEventually)2 CustomSpringJUnit4ClassRunner (com.hazelcast.spring.CustomSpringJUnit4ClassRunner)2 JetSpringServiceFactories.bean (com.hazelcast.spring.jet.JetSpringServiceFactories.bean)2 Arrays.asList (java.util.Arrays.asList)2 CompletionException (java.util.concurrent.CompletionException)2 HazelcastException (com.hazelcast.core.HazelcastException)1 ConsumerEx (com.hazelcast.function.ConsumerEx)1