use of com.thoughtworks.go.domain.JobConfigIdentifier in project gocd by gocd.
the class JobStatusCacheTest method shouldFindAllMatchingJobsForJobsThatAreRunOnAllAgents.
@Test
public void shouldFindAllMatchingJobsForJobsThatAreRunOnAllAgents() {
JobInstance job1 = JobInstanceMother.instanceForRunOnAllAgents("cruise", "dev", "linux-firefox", "1", 1);
JobInstance job2 = JobInstanceMother.instanceForRunOnAllAgents("cruise", "dev", "linux-firefox", "1", 2);
jobStatusCache.jobStatusChanged(job1);
jobStatusCache.jobStatusChanged(job2);
JobConfigIdentifier config = new JobConfigIdentifier("cruise", "dev", "linux-firefox");
List<JobInstance> list = jobStatusCache.currentJobs(config);
assertThat(list, hasItem(job1));
assertThat(list, hasItem(job2));
assertThat(list.size(), is(2));
}
use of com.thoughtworks.go.domain.JobConfigIdentifier in project gocd by gocd.
the class JobStatusCacheTest method shouldLoadMostRecentInstanceFromDBForTheFirstTime.
@Test
public void shouldLoadMostRecentInstanceFromDBForTheFirstTime() throws SQLException {
pipelineFixture.createdPipelineWithAllStagesPassed();
Pipeline pipeline = pipelineFixture.createPipelineWithFirstStageScheduled();
JobInstance expect = pipeline.getStages().byName(pipelineFixture.devStage).getJobInstances().first();
assertThat(jobStatusCache.currentJob(new JobConfigIdentifier(pipelineFixture.pipelineName, pipelineFixture.devStage, PipelineWithTwoStages.JOB_FOR_DEV_STAGE)), is(expect));
}
use of com.thoughtworks.go.domain.JobConfigIdentifier in project gocd by gocd.
the class JobStatusCacheTest method shouldFindAllMatchingJobsForJobsThatAreRunMultipleInstance.
@Test
public void shouldFindAllMatchingJobsForJobsThatAreRunMultipleInstance() {
JobInstance job1 = JobInstanceMother.instanceForRunMultipleInstance("cruise", "dev", "linux-firefox", "1", 1);
JobInstance job2 = JobInstanceMother.instanceForRunMultipleInstance("cruise", "dev", "linux-firefox", "1", 2);
jobStatusCache.jobStatusChanged(job1);
jobStatusCache.jobStatusChanged(job2);
JobConfigIdentifier config = new JobConfigIdentifier("cruise", "dev", "linux-firefox");
List<JobInstance> list = jobStatusCache.currentJobs(config);
assertThat(list, hasItem(job1));
assertThat(list, hasItem(job2));
assertThat(list.size(), is(2));
}
use of com.thoughtworks.go.domain.JobConfigIdentifier in project gocd by gocd.
the class JobStatusCacheTest method shouldExcludeJobFromOtherInstancesOfThisStage.
@Test
public void shouldExcludeJobFromOtherInstancesOfThisStage() {
JobInstance job1 = JobInstanceMother.buildingInstance("cruise", "dev", "linux-firefox", "1");
JobInstance job2 = JobInstanceMother.instanceForRunOnAllAgents("cruise", "dev", "linux-firefox", "2", 1);
jobStatusCache.jobStatusChanged(job1);
jobStatusCache.jobStatusChanged(job2);
JobConfigIdentifier config = new JobConfigIdentifier("cruise", "dev", "linux-firefox");
List<JobInstance> list = jobStatusCache.currentJobs(config);
assertThat(list, hasItem(job2));
assertThat(list, not(hasItem(job1)));
}
Aggregations