Search in sources :

Example 1 with StuckForeverSourceP

use of com.hazelcast.jet.core.TestProcessors.StuckForeverSourceP in project hazelcast-jet by hazelcast.

the class WatermarkMaxRetention_IntegrationTest method test_onEdgeCoalescing.

@Test
public void test_onEdgeCoalescing() {
    DAG dag = new DAG();
    // a vertex with two processor instances, one will emit a wm and the other won't
    Vertex source = dag.newVertex("source", (int count) -> asList(new ListSource(singletonList(new Watermark(1))), new StuckForeverSourceP())).localParallelism(2);
    Vertex map = dag.newVertex("map", MapWmToStringP::new).localParallelism(1);
    Vertex sink = dag.newVertex("sink", writeListP(SINK_NAME));
    dag.edge(between(source, map)).edge(between(map, sink));
    doTest(dag);
}
Also used : Vertex(com.hazelcast.jet.core.Vertex) StuckForeverSourceP(com.hazelcast.jet.core.TestProcessors.StuckForeverSourceP) ListSource(com.hazelcast.jet.core.TestProcessors.ListSource) DAG(com.hazelcast.jet.core.DAG) Watermark(com.hazelcast.jet.core.Watermark) Test(org.junit.Test)

Example 2 with StuckForeverSourceP

use of com.hazelcast.jet.core.TestProcessors.StuckForeverSourceP in project hazelcast-jet by hazelcast.

the class WatermarkMaxRetention_IntegrationTest method test_onVertexCoalescing.

@Test
public void test_onVertexCoalescing() {
    DAG dag = new DAG();
    Vertex source0 = dag.newVertex("source0", () -> new ListSource(singletonList(new Watermark(1)))).localParallelism(1);
    Vertex source1 = dag.newVertex("source1", StuckForeverSourceP::new);
    // a vertex with two inputs, one will emit a wm and the other won't
    Vertex map = dag.newVertex("map", MapWmToStringP::new).localParallelism(1);
    Vertex sink = dag.newVertex("sink", writeListP(SINK_NAME));
    dag.edge(from(source0).to(map, 0)).edge(from(source1).to(map, 1)).edge(between(map, sink));
    doTest(dag);
}
Also used : Vertex(com.hazelcast.jet.core.Vertex) StuckForeverSourceP(com.hazelcast.jet.core.TestProcessors.StuckForeverSourceP) ListSource(com.hazelcast.jet.core.TestProcessors.ListSource) DAG(com.hazelcast.jet.core.DAG) Watermark(com.hazelcast.jet.core.Watermark) Test(org.junit.Test)

Example 3 with StuckForeverSourceP

use of com.hazelcast.jet.core.TestProcessors.StuckForeverSourceP in project hazelcast-jet by hazelcast.

the class WriteBufferedPTest method when_writeBufferedJobFailed_then_bufferDisposed.

@Test
public void when_writeBufferedJobFailed_then_bufferDisposed() throws Exception {
    JetInstance instance = createJetMember();
    try {
        DAG dag = new DAG();
        Vertex source = dag.newVertex("source", StuckForeverSourceP::new);
        Vertex sink = dag.newVertex("sink", getLoggingBufferedWriter()).localParallelism(1);
        dag.edge(Edge.between(source, sink));
        Job job = instance.newJob(dag);
        // wait for the job to initialize
        Thread.sleep(5000);
        job.cancel();
        assertTrueEventually(() -> assertTrue("No \"dispose\", only: " + events, events.contains("dispose")), 60);
        System.out.println(events);
    } finally {
        instance.shutdown();
    }
}
Also used : Vertex(com.hazelcast.jet.core.Vertex) StuckForeverSourceP(com.hazelcast.jet.core.TestProcessors.StuckForeverSourceP) JetInstance(com.hazelcast.jet.JetInstance) DAG(com.hazelcast.jet.core.DAG) Job(com.hazelcast.jet.Job) Test(org.junit.Test)

Aggregations

DAG (com.hazelcast.jet.core.DAG)3 StuckForeverSourceP (com.hazelcast.jet.core.TestProcessors.StuckForeverSourceP)3 Vertex (com.hazelcast.jet.core.Vertex)3 Test (org.junit.Test)3 ListSource (com.hazelcast.jet.core.TestProcessors.ListSource)2 Watermark (com.hazelcast.jet.core.Watermark)2 JetInstance (com.hazelcast.jet.JetInstance)1 Job (com.hazelcast.jet.Job)1