Search in sources :

Example 1 with ISchedulingCondition

use of org.jboss.tools.openshift.internal.common.core.job.JobChainBuilder.ISchedulingCondition in project jbosstools-openshift by jbosstools.

the class JobChainBuilderTest method should_schedule_2_jobs_given_condition_that_stops_after_2.

@Test
public void should_schedule_2_jobs_given_condition_that_stops_after_2() {
    // given
    JobCounter counter = new JobCounter(4);
    JobChainBuilder builder = new JobChainBuilder(createJob("Job 1", counter));
    counter.setBuilder(builder);
    createJobs(3, new ISchedulingCondition[] { new JobChainBuilder.NullCondition(), new JobChainBuilder.ISchedulingCondition() {

        @Override
        public boolean isFullfilled(Job preceedingJob) {
            return false;
        }
    }, new JobChainBuilder.NullCondition() }, builder, counter);
    // when
    builder.schedule();
    // then
    assertThat(counter.getDone()).isEqualTo(2);
}
Also used : ISchedulingCondition(org.jboss.tools.openshift.internal.common.core.job.JobChainBuilder.ISchedulingCondition) Job(org.eclipse.core.runtime.jobs.Job) JobChainBuilder(org.jboss.tools.openshift.internal.common.core.job.JobChainBuilder) Test(org.junit.Test)

Aggregations

Job (org.eclipse.core.runtime.jobs.Job)1 JobChainBuilder (org.jboss.tools.openshift.internal.common.core.job.JobChainBuilder)1 ISchedulingCondition (org.jboss.tools.openshift.internal.common.core.job.JobChainBuilder.ISchedulingCondition)1 Test (org.junit.Test)1