use of com.hazelcast.jet.core.TestProcessors.MockPMS in project hazelcast-jet by hazelcast.
the class ExecutionLifecycleTest method when_processorProcessThrows_then_failJob.
@Test
public void when_processorProcessThrows_then_failJob() {
// Given
DAG dag = new DAG();
RuntimeException e = new RuntimeException("mock error");
Vertex source = dag.newVertex("source", ListSource.supplier(singletonList(1)));
Vertex process = dag.newVertex("faulty", new MockPMS(() -> new MockPS(() -> new MockP().setProcessError(e), NODE_COUNT)));
dag.edge(between(source, process));
// When
Job job = runJobExpectFailure(dag, e);
// Then
assertPClosedWithError(e, false);
assertPsClosedWithError(e);
assertPmsClosedWithError(e);
assertJobFailed(job, e);
}
use of com.hazelcast.jet.core.TestProcessors.MockPMS in project hazelcast-jet by hazelcast.
the class ExecutionLifecycleTest method when_jobCompletesSuccessfully_then_closeCalled.
@Test
public void when_jobCompletesSuccessfully_then_closeCalled() {
// Given
DAG dag = new DAG().vertex(new Vertex("test", new MockPMS(() -> new MockPS(MockP::new, NODE_COUNT))));
// When
Job job = instance.newJob(dag);
job.join();
// Then
assertPClosedWithoutError();
assertPsClosedWithoutError();
assertPmsClosedWithoutError();
assertJobSucceeded(job);
}
use of com.hazelcast.jet.core.TestProcessors.MockPMS in project hazelcast-jet by hazelcast.
the class ExecutionLifecycleTest method when_processorCooperativeCompleteThrows_then_failJob.
@Test
public void when_processorCooperativeCompleteThrows_then_failJob() {
// Given
DAG dag = new DAG();
RuntimeException e = new RuntimeException("mock error");
dag.newVertex("faulty", new MockPMS(() -> new MockPS(() -> new MockP().setCompleteError(e), NODE_COUNT)));
// When
Job job = runJobExpectFailure(dag, e);
// Then
assertPClosedWithError(e, false);
assertPsClosedWithError(e);
assertPmsClosedWithError(e);
assertJobFailed(job, e);
}
use of com.hazelcast.jet.core.TestProcessors.MockPMS in project hazelcast-jet by hazelcast.
the class ExecutionLifecycleTest method when_psGetThrows_then_jobFails.
@Test
public void when_psGetThrows_then_jobFails() {
// Given
RuntimeException e = new RuntimeException("mock error");
DAG dag = new DAG().vertex(new Vertex("faulty", new MockPMS(() -> new MockPS(MockP::new, NODE_COUNT).setGetError(e))));
// When
Job job = runJobExpectFailure(dag, e);
// Then
assertPsClosedWithError(e);
assertPmsClosedWithError(e);
assertJobFailed(job, e);
}
use of com.hazelcast.jet.core.TestProcessors.MockPMS in project hazelcast-jet by hazelcast.
the class ExecutionLifecycleTest method when_psInitThrows_then_jobFails.
@Test
public void when_psInitThrows_then_jobFails() {
// Given
RuntimeException e = new RuntimeException("mock error");
DAG dag = new DAG().vertex(new Vertex("test", new MockPMS(() -> new MockPS(MockP::new, NODE_COUNT).setInitError(e))));
// When
Job job = runJobExpectFailure(dag, e);
// Then
assertPsClosedWithError(e);
assertPmsClosedWithError(e);
assertJobFailed(job, e);
}
Aggregations