use of com.hazelcast.jet.JetInstance in project hazelcast-jet by hazelcast.
the class DecoratorTest method mapDecorator.
@Test
public void mapDecorator() throws Exception {
JetInstance instance = Mockito.mock(JetInstance.class);
assertDecorator(IMap.class, IMapJet.class, m -> new IMapDecorator<>(m, instance));
}
use of com.hazelcast.jet.JetInstance in project hazelcast-jet by hazelcast.
the class JetSplitBrainTestSupport method applyOnBrains.
private void applyOnBrains(JetInstance[] instances, int firstSubClusterSize, BiConsumer<HazelcastInstance, HazelcastInstance> action) {
for (int i = 0; i < firstSubClusterSize; i++) {
JetInstance isolatedInstance = instances[i];
// do not take into account instances which have been shutdown
if (!isInstanceActive(isolatedInstance)) {
continue;
}
for (int j = firstSubClusterSize; j < instances.length; j++) {
JetInstance currentInstance = instances[j];
if (!isInstanceActive(currentInstance)) {
continue;
}
action.accept(isolatedInstance.getHazelcastInstance(), currentInstance.getHazelcastInstance());
}
}
}
use of com.hazelcast.jet.JetInstance in project hazelcast-jet by hazelcast.
the class JetSplitBrainTestSupport method assertSplitBrainCreated.
private void assertSplitBrainCreated(JetInstance[] instances, int firstSubClusterSize, int secondSubClusterSize) {
for (int isolatedIndex = 0; isolatedIndex < firstSubClusterSize; isolatedIndex++) {
JetInstance isolatedInstance = instances[isolatedIndex];
assertClusterSizeEventually(firstSubClusterSize, isolatedInstance.getHazelcastInstance());
}
for (int i = firstSubClusterSize; i < instances.length; i++) {
JetInstance currentInstance = instances[i];
assertClusterSizeEventually(secondSubClusterSize, currentInstance.getHazelcastInstance());
}
}
use of com.hazelcast.jet.JetInstance in project hazelcast-jet by hazelcast.
the class JobTest method when_jobIsCompleted_then_trackedJobCanQueryJobResultFromClient.
@Test
public void when_jobIsCompleted_then_trackedJobCanQueryJobResultFromClient() throws InterruptedException {
// Given
DAG dag = new DAG().vertex(new Vertex("test", new MockPS(StuckProcessor::new, NODE_COUNT)));
// When
instance1.newJob(dag);
StuckProcessor.executionStarted.await();
JetInstance client = createJetClient();
Collection<Job> trackedJobs = client.getJobs();
assertEquals(1, trackedJobs.size());
Job trackedJob = trackedJobs.iterator().next();
StuckProcessor.proceedLatch.countDown();
// Then
trackedJob.join();
assertEquals(COMPLETED, trackedJob.getStatus());
}
use of com.hazelcast.jet.JetInstance in project hazelcast-jet by hazelcast.
the class ManualRestartTest method when_jobIsNotBeingExecuted_then_itCannotBeRestarted.
@Test
public void when_jobIsNotBeingExecuted_then_itCannotBeRestarted() {
// Given that the job execution has not started
rejectOperationsBetween(instances[0].getHazelcastInstance(), instances[1].getHazelcastInstance(), JetInitDataSerializerHook.FACTORY_ID, singletonList(JetInitDataSerializerHook.INIT_EXECUTION_OP));
JetInstance client = createJetClient();
Job job = client.newJob(dag);
assertTrueEventually(() -> assertTrue(job.getStatus() == JobStatus.STARTING));
// Then, the job cannot restart
assertFalse(job.restart());
resetPacketFiltersFrom(instances[0].getHazelcastInstance());
}
Aggregations