use of com.hazelcast.jet.core.TestProcessors.StuckProcessor in project hazelcast-jet 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(StuckProcessor::new, NODE_COUNT)));
// When
Job job = instance1.newJob(dag);
StuckProcessor.proceedLatch.countDown();
job.join();
// Then
Job trackedJob = instance1.getJob(job.getId());
assertNotNull(trackedJob);
assertEquals(job.getId(), trackedJob.getId());
assertEquals(COMPLETED, trackedJob.getStatus());
}
use of com.hazelcast.jet.core.TestProcessors.StuckProcessor in project hazelcast-jet by hazelcast.
the class JobTest method when_jobsAreCompleted_then_theyAreQueriedByName.
@Test
public void when_jobsAreCompleted_then_theyAreQueriedByName() {
// Given
DAG dag = new DAG().vertex(new Vertex("test", new MockPS(StuckProcessor::new, NODE_COUNT * 2)));
JobConfig config = new JobConfig();
String jobName = "job1";
config.setName(jobName);
// When
Job job1 = instance1.newJob(dag, config);
sleepAtLeastMillis(1);
Job job2 = instance1.newJob(dag, config);
StuckProcessor.proceedLatch.countDown();
job1.join();
job2.join();
// Then
List<Job> jobs = instance1.getJobs(jobName);
assertEquals(2, jobs.size());
Job trackedJob1 = jobs.get(0);
Job trackedJob2 = jobs.get(1);
assertEquals(job2.getId(), trackedJob1.getId());
assertEquals(jobName, trackedJob1.getName());
assertEquals(COMPLETED, trackedJob1.getStatus());
assertEquals(job1.getId(), trackedJob2.getId());
assertEquals(jobName, trackedJob2.getName());
assertEquals(COMPLETED, trackedJob2.getStatus());
}
use of com.hazelcast.jet.core.TestProcessors.StuckProcessor in project hazelcast-jet 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(StuckProcessor::new, NODE_COUNT)));
JobConfig config = new JobConfig();
String jobName = "job1";
config.setName(jobName);
// When
Job job = instance1.newJob(dag, config);
StuckProcessor.proceedLatch.countDown();
job.join();
// Then
Job trackedJob = instance1.getJob(jobName);
assertNotNull(trackedJob);
assertEquals(jobName, trackedJob.getName());
assertEquals(job.getId(), trackedJob.getId());
assertEquals(COMPLETED, trackedJob.getStatus());
}
use of com.hazelcast.jet.core.TestProcessors.StuckProcessor in project hazelcast-jet by hazelcast.
the class JobTest method when_jobsAreCompletedInReverseOrderOfTheirSubmissionOrder_then_theyAreQueriedByName.
@Test
public void when_jobsAreCompletedInReverseOrderOfTheirSubmissionOrder_then_theyAreQueriedByName() {
// Given
DAG dag1 = new DAG().vertex(new Vertex("test", new MockPS(StuckProcessor::new, NODE_COUNT)));
DAG dag2 = new DAG().vertex(new Vertex("test", new MockPS(Identity::new, NODE_COUNT)));
JobConfig config = new JobConfig();
String jobName = "job1";
config.setName(jobName);
// When
Job job1 = instance1.newJob(dag1, config);
sleepAtLeastMillis(1);
Job job2 = instance1.newJob(dag2, config);
job2.join();
StuckProcessor.proceedLatch.countDown();
job1.join();
// Then
List<Job> jobs = instance1.getJobs(jobName);
assertEquals(2, jobs.size());
Job trackedJob1 = jobs.get(0);
Job trackedJob2 = jobs.get(1);
assertEquals(job2.getId(), trackedJob1.getId());
assertEquals(COMPLETED, trackedJob1.getStatus());
assertEquals(job1.getId(), trackedJob2.getId());
assertEquals(COMPLETED, trackedJob2.getStatus());
}
use of com.hazelcast.jet.core.TestProcessors.StuckProcessor in project hazelcast-jet by hazelcast.
the class JobTest method testJobSubmissionTimeWhenJobIsRunning.
private void testJobSubmissionTimeWhenJobIsRunning(JetInstance instance) throws InterruptedException {
// Given
DAG dag = new DAG().vertex(new Vertex("test", new MockPS(StuckProcessor::new, NODE_COUNT)));
JobConfig config = new JobConfig();
String jobName = "job1";
config.setName(jobName);
// When
Job job = instance1.newJob(dag, config);
StuckProcessor.executionStarted.await();
Job trackedJob = instance.getJob("job1");
// Then
assertNotNull(trackedJob);
assertNotEquals(0, job.getSubmissionTime());
assertNotEquals(0, trackedJob.getSubmissionTime());
StuckProcessor.proceedLatch.countDown();
}
Aggregations