use of com.hazelcast.jet.core.TestProcessors.MockPMS in project hazelcast by hazelcast.
the class ExecutionLifecycleTest method when_executionCancelled_then_jobCompletedWithCancellationException.
@Test
public void when_executionCancelled_then_jobCompletedWithCancellationException() throws Exception {
// Given
DAG dag = new DAG().vertex(new Vertex("test", new MockPMS(() -> new MockPS(NoOutputSourceP::new, MEMBER_COUNT))));
// When
Job job = newJob(dag);
NoOutputSourceP.executionStarted.await();
cancelAndJoin(job);
assertTrueEventually(() -> {
assertJobFailed(job, new CancellationException());
assertPsClosedWithError();
assertPmsClosedWithError();
});
}
use of com.hazelcast.jet.core.TestProcessors.MockPMS in project hazelcast by hazelcast.
the class ExecutionLifecycleTest method when_processorOnSnapshotCompleteThrows_then_failJob.
@Test
public void when_processorOnSnapshotCompleteThrows_then_failJob() {
// Given
DAG dag = new DAG();
dag.newVertex("faulty", new MockPMS(() -> new MockPS(() -> new MockP().nonCooperative().streaming().setOnSnapshotCompleteError(MOCK_ERROR), MEMBER_COUNT)));
// When
Job job = runJobExpectFailure(dag, true);
assertTrue("onSnapshotCompleted not called", MockP.onSnapshotCompletedCalled);
// Then
assertPClosedWithError();
assertPsClosedWithError();
assertPmsClosedWithError();
assertJobFailed(job, MOCK_ERROR);
}
use of com.hazelcast.jet.core.TestProcessors.MockPMS in project hazelcast by hazelcast.
the class ClusterStateChangeTest method before.
@Before
public void before() {
TestProcessors.reset(TOTAL_PARALLELISM);
Config config = smallInstanceConfig();
config.getJetConfig().setCooperativeThreadCount(LOCAL_PARALLELISM);
members = createHazelcastInstances(config, NODE_COUNT);
assertTrueEventually(() -> {
for (HazelcastInstance instance : members) {
assertClusterSizeEventually(NODE_COUNT, instance);
}
});
for (HazelcastInstance member : members) {
if (!getNodeEngineImpl(member).getClusterService().isMaster()) {
hz = member;
break;
}
}
cluster = hz.getCluster();
dag = new DAG().vertex(new Vertex("test", new MockPMS(() -> new MockPS(NoOutputSourceP::new, NODE_COUNT))));
}
use of com.hazelcast.jet.core.TestProcessors.MockPMS in project hazelcast-jet by hazelcast.
the class ExecutionLifecycleTest method when_pmsCloseThrows_then_jobSucceeds.
@Test
public void when_pmsCloseThrows_then_jobSucceeds() {
// Given
RuntimeException e = new RuntimeException("mock error");
DAG dag = new DAG().vertex(new Vertex("test", new MockPMS(() -> new MockPS(MockP::new, NODE_COUNT)).setCloseError(e)));
// 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_psCloseThrows_then_jobSucceeds.
@Test
public void when_psCloseThrows_then_jobSucceeds() {
// Given
RuntimeException e = new RuntimeException("mock error");
DAG dag = new DAG().vertex(new Vertex("faulty", new MockPMS(() -> new MockPS(MockP::new, NODE_COUNT).setCloseError(e))));
// When
Job job = instance.newJob(dag);
job.join();
// Then
assertPClosedWithoutError();
assertPsClosedWithoutError();
assertPmsClosedWithoutError();
assertJobSucceeded(job);
}
Aggregations