use of com.hazelcast.jet.core.TestProcessors.NoOutputSourceP in project hazelcast by hazelcast.
the class JobTest method when_suspendedNamedJob_then_newJobWithEqualNameFails.
@Test
public void when_suspendedNamedJob_then_newJobWithEqualNameFails() {
// Given
DAG dag = new DAG().vertex(new Vertex("test", new MockPS(NoOutputSourceP::new, NODE_COUNT * 2)));
JobConfig config = new JobConfig().setName(randomName());
// When
Job job1 = instance().getJet().newJob(dag, config);
assertJobStatusEventually(job1, RUNNING);
job1.suspend();
assertJobStatusEventually(job1, SUSPENDED);
// Then
assertThatThrownBy(() -> instances()[1].getJet().newJob(dag, config)).isInstanceOf(JobAlreadyExistsException.class);
}
use of com.hazelcast.jet.core.TestProcessors.NoOutputSourceP in project hazelcast by hazelcast.
the class JobTest method when_jobIsCompleted_then_itIsQueriedById.
@Test
public void when_jobIsCompleted_then_itIsQueriedById() {
// Given
DAG dag = new DAG().vertex(new Vertex("test", new MockPS(NoOutputSourceP::new, NODE_COUNT)));
// When
Job job = instance().getJet().newJob(dag);
NoOutputSourceP.proceedLatch.countDown();
job.join();
// Then
Job trackedJob = instance().getJet().getJob(job.getId());
assertNotNull(trackedJob);
assertEquals(job.getId(), trackedJob.getId());
assertEquals(COMPLETED, trackedJob.getStatus());
}
use of com.hazelcast.jet.core.TestProcessors.NoOutputSourceP in project hazelcast by hazelcast.
the class JobTest method when_jobConfigChanged_then_doesNotAffectSubmittedJob.
@Test
public void when_jobConfigChanged_then_doesNotAffectSubmittedJob() {
// Given
DAG dag = new DAG().vertex(new Vertex("test", new MockPS(NoOutputSourceP::new, NODE_COUNT * 2)));
JobConfig config = new JobConfig().setName(randomName());
Job job1 = instance().getJet().newJob(dag, config);
assertJobStatusEventually(job1, RUNNING);
// When
config.setName(randomName());
// Then
Job job2 = instance().getJet().newJob(dag, config);
assertJobStatusEventually(job2, RUNNING);
}
use of com.hazelcast.jet.core.TestProcessors.NoOutputSourceP in project hazelcast by hazelcast.
the class JobTest method when_suspendedNamedJob_then_newJobIfAbsentWithEqualNameJoinsIt.
@Test
public void when_suspendedNamedJob_then_newJobIfAbsentWithEqualNameJoinsIt() {
// Given
DAG dag = new DAG().vertex(new Vertex("test", new MockPS(NoOutputSourceP::new, NODE_COUNT * 2)));
JobConfig config = new JobConfig().setName(randomName());
// When
Job job1 = instance().getJet().newJob(dag, config);
assertJobStatusEventually(job1, RUNNING);
job1.suspend();
assertJobStatusEventually(job1, SUSPENDED);
// Then
Job job2 = instances()[1].getJet().newJobIfAbsent(dag, config);
assertEquals(job1.getId(), job2.getId());
assertEquals(job2.getStatus(), SUSPENDED);
}
use of com.hazelcast.jet.core.TestProcessors.NoOutputSourceP in project hazelcast by hazelcast.
the class JobTest method when_jobIsCompleted_then_itIsQueriedByName.
@Test
public void when_jobIsCompleted_then_itIsQueriedByName() {
// Given
DAG dag = new DAG().vertex(new Vertex("test", new MockPS(NoOutputSourceP::new, NODE_COUNT)));
JobConfig config = new JobConfig();
String jobName = randomName();
config.setName(jobName);
// When
Job job = instance().getJet().newJob(dag, config);
NoOutputSourceP.proceedLatch.countDown();
job.join();
// Then
Job trackedJob = instance().getJet().getJob(jobName);
assertNotNull(trackedJob);
assertEquals(jobName, trackedJob.getName());
assertEquals(job.getId(), trackedJob.getId());
assertEquals(COMPLETED, trackedJob.getStatus());
}
Aggregations