use of com.hazelcast.jet.core.TestProcessors.MockPMS in project hazelcast-jet by hazelcast.
the class ExecutionLifecycleTest method when_pmsInitThrows_then_jobFails.
@Test
public void when_pmsInitThrows_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
assertPmsClosedWithError(e);
assertJobFailed(job, e);
}
use of com.hazelcast.jet.core.TestProcessors.MockPMS in project hazelcast-jet by hazelcast.
the class ExecutionLifecycleTest method when_executionCancelled_then_jobCompletedWithCancellationException.
@Test
public void when_executionCancelled_then_jobCompletedWithCancellationException() throws Throwable {
// Given
DAG dag = new DAG().vertex(new Vertex("test", new MockPMS(() -> new MockPS(StuckProcessor::new, NODE_COUNT))));
// When
Job job = instance.newJob(dag);
try {
StuckProcessor.executionStarted.await();
job.cancel();
job.join();
fail("Job execution should fail");
} catch (CancellationException ignored) {
}
assertTrueEventually(() -> {
assertJobFailed(job, new CancellationException());
assertPsClosedWithError(new CancellationException());
assertPmsClosedWithError(new CancellationException());
});
}
use of com.hazelcast.jet.core.TestProcessors.MockPMS in project hazelcast-jet by hazelcast.
the class ExecutionLifecycleTest method when_processorInitThrows_then_failJob.
@Test
public void when_processorInitThrows_then_failJob() {
// Given
DAG dag = new DAG();
RuntimeException e = new RuntimeException("mock error");
dag.newVertex("faulty", new MockPMS(() -> new MockPS(() -> new MockP().setInitError(e), NODE_COUNT)));
// When
Job job = runJobExpectFailure(dag, e);
// Then
assertPClosedWithError(e, true);
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_pmsGetThrows_then_jobFails.
@Test
public void when_pmsGetThrows_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
assertPmsClosedWithError(e);
assertJobFailed(job, e);
}
use of com.hazelcast.jet.core.TestProcessors.MockPMS in project hazelcast-jet by hazelcast.
the class ExecutionLifecycleTest method when_processorNonCooperativeCompleteThrows_then_failJob.
@Test
public void when_processorNonCooperativeCompleteThrows_then_failJob() {
// Given
DAG dag = new DAG();
RuntimeException e = new RuntimeException("mock error");
dag.newVertex("faulty", nonCooperativeP(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);
}
Aggregations