Search in sources :

Example 51 with JobInstance

use of com.thoughtworks.go.domain.JobInstance in project gocd by gocd.

the class ArtifactPropertiesGeneratorRepositoryIntegrationTest method shouldSaveArtifactPropertiesGenerator.

@Test
public void shouldSaveArtifactPropertiesGenerator() {
    // Arrange
    JobInstance jobInstance = jobInstanceDao.save(stageId, new JobInstance(JOB_NAME));
    ArtifactPropertiesGenerator artifactPropertiesGenerator = new ArtifactPropertiesGenerator("test", "src", "//xpath");
    artifactPropertiesGenerator.setJobId(jobInstance.getId());
    // Act
    artifactPropertiesGeneratorRepository.save(artifactPropertiesGenerator);
    // Assert
    assertThat(artifactPropertiesGenerator.getId(), is(not(nullValue())));
}
Also used : JobInstance(com.thoughtworks.go.domain.JobInstance) ArtifactPropertiesGenerator(com.thoughtworks.go.config.ArtifactPropertiesGenerator) Test(org.junit.Test)

Example 52 with JobInstance

use of com.thoughtworks.go.domain.JobInstance in project gocd by gocd.

the class ArtifactPropertiesGeneratorRepositoryIntegrationTest method shouldLoadSavedArtifactPropertiesGenerator.

@Test
public void shouldLoadSavedArtifactPropertiesGenerator() {
    // Arrange
    JobInstance jobInstance = jobInstanceDao.save(stageId, new JobInstance(JOB_NAME));
    ArtifactPropertiesGenerator savedArtifactPropertiesGenerator = new ArtifactPropertiesGenerator("test", "src", "//xpath");
    savedArtifactPropertiesGenerator.setJobId(jobInstance.getId());
    artifactPropertiesGeneratorRepository.save(savedArtifactPropertiesGenerator);
    // Act
    List<ArtifactPropertiesGenerator> artifactPropertiesGeneratorList = artifactPropertiesGeneratorRepository.findByBuildId(jobInstance.getId());
    // Assert
    assertThat(artifactPropertiesGeneratorList.size(), is(1));
    assertThat(artifactPropertiesGeneratorList.get(0), is(savedArtifactPropertiesGenerator));
}
Also used : JobInstance(com.thoughtworks.go.domain.JobInstance) ArtifactPropertiesGenerator(com.thoughtworks.go.config.ArtifactPropertiesGenerator) Test(org.junit.Test)

Example 53 with JobInstance

use of com.thoughtworks.go.domain.JobInstance in project gocd by gocd.

the class ResourceRepositoryIntegrationTest method shouldLoadSavedResource.

@Test
public void shouldLoadSavedResource() {
    // Arrange
    JobInstance jobInstance = jobInstanceDao.save(stageId, new JobInstance(JOB_NAME));
    Resource savedResource = new Resource("something");
    savedResource.setBuildId(jobInstance.getId());
    resourceRepository.save(savedResource);
    // Act
    List<Resource> resourceList = resourceRepository.findByBuildId(jobInstance.getId());
    // Assert
    assertThat(resourceList.size(), is(1));
    assertThat(resourceList.get(0), is(savedResource));
}
Also used : JobInstance(com.thoughtworks.go.domain.JobInstance) Resource(com.thoughtworks.go.config.Resource) Test(org.junit.Test)

Example 54 with JobInstance

use of com.thoughtworks.go.domain.JobInstance in project gocd by gocd.

the class PipelineSchedulerIntegrationTest method returnPipelineForBuildDetailViewShouldContainOnlyMods.

@Test
public void returnPipelineForBuildDetailViewShouldContainOnlyMods() throws Exception {
    Pipeline pipeline = createPipelineWithStagesAndMods();
    JobInstance job = pipeline.getFirstStage().getJobInstances().first();
    Pipeline slimPipeline = pipelineService.wrapBuildDetails(job);
    assertThat(slimPipeline.getBuildCause().getMaterialRevisions().totalNumberOfModifications(), is(1));
    assertThat(slimPipeline.getName(), is(pipeline.getName()));
    assertThat(slimPipeline.getFirstStage().getJobInstances().size(), is(1));
}
Also used : JobInstance(com.thoughtworks.go.domain.JobInstance) Pipeline(com.thoughtworks.go.domain.Pipeline) Test(org.junit.Test)

Example 55 with JobInstance

use of com.thoughtworks.go.domain.JobInstance in project gocd by gocd.

the class RestfulServiceTest method shouldFindJobByPipelineCounter.

@Test
public void shouldFindJobByPipelineCounter() throws Exception {
    Pipeline pipeline = fixture.createdPipelineWithAllStagesPassed();
    Stage stage = pipeline.getStages().byName(fixture.devStage);
    JobInstance job = stage.getJobInstances().first();
    JobIdentifier result = restfulService.findJob(pipeline.getName(), String.valueOf(pipeline.getCounter()), stage.getName(), String.valueOf(stage.getCounter()), job.getName(), job.getId());
    JobIdentifier expect = new JobIdentifier(pipeline, stage, job);
    assertThat(result, is(expect));
}
Also used : JobInstance(com.thoughtworks.go.domain.JobInstance) Stage(com.thoughtworks.go.domain.Stage) JobIdentifier(com.thoughtworks.go.domain.JobIdentifier) Pipeline(com.thoughtworks.go.domain.Pipeline) Test(org.junit.Test)

Aggregations

JobInstance (com.thoughtworks.go.domain.JobInstance)82 Test (org.junit.Test)56 Stage (com.thoughtworks.go.domain.Stage)16 JobIdentifier (com.thoughtworks.go.domain.JobIdentifier)15 Pipeline (com.thoughtworks.go.domain.Pipeline)15 JobInstances (com.thoughtworks.go.domain.JobInstances)12 JobConfigIdentifier (com.thoughtworks.go.domain.JobConfigIdentifier)7 Agent (com.thoughtworks.go.server.domain.Agent)6 Gson (com.google.gson.Gson)5 Stages (com.thoughtworks.go.domain.Stages)5 Map (java.util.Map)5 DurationBean (com.thoughtworks.go.dto.DurationBean)4 DateTime (org.joda.time.DateTime)4 ArtifactPropertiesGenerator (com.thoughtworks.go.config.ArtifactPropertiesGenerator)3 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)3 Resource (com.thoughtworks.go.config.Resource)3 DirectoryEntries (com.thoughtworks.go.domain.DirectoryEntries)3 StageIdentifier (com.thoughtworks.go.domain.StageIdentifier)3 ProjectStatus (com.thoughtworks.go.domain.activity.ProjectStatus)3 JobInstanceModel (com.thoughtworks.go.server.ui.JobInstanceModel)3