use of com.hazelcast.internal.cluster.impl.MembersView in project hazelcast-jet by hazelcast.
the class ExecutionLifecycleTest method when_executionCancelledBeforeStart_then_jobFutureIsCancelledOnExecute.
@Test
public void when_executionCancelledBeforeStart_then_jobFutureIsCancelledOnExecute() {
// Given
DAG dag = new DAG().vertex(new Vertex("test", new MockPS(StuckProcessor::new, NODE_COUNT)));
NodeEngineImpl nodeEngineImpl = getNodeEngineImpl(instance.getHazelcastInstance());
Address localAddress = nodeEngineImpl.getThisAddress();
ClusterServiceImpl clusterService = (ClusterServiceImpl) nodeEngineImpl.getClusterService();
MembersView membersView = clusterService.getMembershipManager().getMembersView();
int memberListVersion = membersView.getVersion();
JetService jetService = getJetService(instance);
final Map<MemberInfo, ExecutionPlan> executionPlans = ExecutionPlanBuilder.createExecutionPlans(nodeEngineImpl, membersView, dag, new JobConfig(), NO_SNAPSHOT);
ExecutionPlan executionPlan = executionPlans.get(membersView.getMember(localAddress));
long jobId = 0;
long executionId = 1;
Set<MemberInfo> participants = new HashSet<>(membersView.getMembers());
jetService.getJobExecutionService().initExecution(jobId, executionId, localAddress, memberListVersion, participants, executionPlan);
ExecutionContext executionContext = jetService.getJobExecutionService().getExecutionContext(executionId);
executionContext.cancelExecution();
// When
CompletableFuture<Void> future = executionContext.beginExecution();
// Then
expectedException.expect(CancellationException.class);
future.join();
}
Aggregations