Search in sources :

Example 56 with Pipeline

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

the class ChangeMaterialsTest method p4MaterialFromConfigShouldBeEqualWithP4MaterialFromDb.

@Test
public void p4MaterialFromConfigShouldBeEqualWithP4MaterialFromDb() throws Exception {
    String p4view = "//depot/... //localhost/...";
    cruiseConfig.replaceMaterialConfigForPipeline(PIPELINE_NAME, p4TestRepo.materialConfig(p4view));
    mingle = goConfigDao.load().pipelineConfigByName(new CaseInsensitiveString(PIPELINE_NAME));
    assertThat(mingle.materialConfigs().get(0), is(instanceOf(P4MaterialConfig.class)));
    scheduleHelper.manuallySchedulePipelineWithRealMaterials(PIPELINE_NAME, username);
    scheduleService.autoSchedulePipelinesFromRequestBuffer();
    Pipeline mostRecent = pipelineService.mostRecentFullPipelineByName(PIPELINE_NAME);
    assertThat(mostRecent.getMaterials().first(), is(new MaterialConfigConverter().toMaterial(mingle.materialConfigs().first())));
}
Also used : CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) Pipeline(com.thoughtworks.go.domain.Pipeline)

Example 57 with Pipeline

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

the class ChangeMaterialsTest method shouldManualScheduleWithLatestModificationFromNewMaterialAfterChangedMaterial.

// TODO: CS&DY Revisit this test to use materials properly
@Test
public void shouldManualScheduleWithLatestModificationFromNewMaterialAfterChangedMaterial() throws Exception, StageAlreadyBuildingException {
    cruiseConfig.replaceMaterialWithHgRepoForPipeline(PIPELINE_NAME, hgTestRepo.projectRepositoryUrl());
    scheduleHelper.manuallySchedulePipelineWithRealMaterials(PIPELINE_NAME, username);
    scheduleService.autoSchedulePipelinesFromRequestBuffer();
    Pipeline mostRecent = pipelineService.mostRecentFullPipelineByName(PIPELINE_NAME);
    assertThat("Should schedule new instance after changed material", mostRecent.getId(), is(not(pipeline.getId())));
    MaterialRevisions materialRevisions = mostRecent.getBuildCause().getMaterialRevisions();
    assertEquals(hgTestRepo.latestModifications().get(0).getModifiedTime(), materialRevisions.getDateOfLatestModification());
}
Also used : MaterialRevisions(com.thoughtworks.go.domain.MaterialRevisions) Pipeline(com.thoughtworks.go.domain.Pipeline)

Example 58 with Pipeline

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

the class ChangesetServiceIntegrationTest method shouldReturnModsOfItsOwnAndAllUpstreamPipelinesForTheGivenCounter.

@Test
public void shouldReturnModsOfItsOwnAndAllUpstreamPipelinesForTheGivenCounter() {
    SvnMaterial svn = MaterialsMother.svnMaterial("http://svn");
    PipelineConfig grandFatherPipeline = configHelper.addPipeline("granpa", "stage", svn.config(), "job");
    DependencyMaterial parentDependencyMaterial = MaterialsMother.dependencyMaterial("granpa", "stage");
    PipelineConfig upstreamPipeline = configHelper.addPipeline("upstream", "stage", git.config(), "job");
    upstreamPipeline.addMaterialConfig(parentDependencyMaterial.config());
    DependencyMaterial dependencyMaterial = MaterialsMother.dependencyMaterial("upstream", "stage");
    pipelineConfigWithTwoMaterials.addMaterialConfig(dependencyMaterial.config());
    pipelineConfigWithTwoMaterials.removeMaterialConfig(git.config());
    Username username = new Username(new CaseInsensitiveString("user1"));
    // Schedule grandfather
    List<MaterialRevision> revisionsForGrandfather1 = new ArrayList<>();
    addRevisionWith2Mods(revisionsForGrandfather1, svn);
    Pipeline grandFatherOne = dbHelper.checkinRevisionsToBuild(new ManualBuild(username), grandFatherPipeline, revisionsForGrandfather1);
    // Schedule upstream
    List<MaterialRevision> revisionsForUpstream1 = new ArrayList<>();
    addRevisionWith2Mods(revisionsForUpstream1, git);
    dbHelper.addDependencyRevisionModification(revisionsForUpstream1, parentDependencyMaterial, grandFatherOne);
    Pipeline upstreamOne = dbHelper.checkinRevisionsToBuild(new ManualBuild(username), upstreamPipeline, revisionsForUpstream1);
    // Schedule downstream
    List<MaterialRevision> revisionsForPipeline1 = new ArrayList<>();
    addRevisionWith2Mods(revisionsForPipeline1, hg);
    dbHelper.addDependencyRevisionModification(revisionsForPipeline1, dependencyMaterial, upstreamOne);
    Pipeline pipelineOne = dbHelper.checkinRevisionsToBuild(new ManualBuild(username), pipelineConfigWithTwoMaterials, revisionsForPipeline1);
    HttpLocalizedOperationResult result = new HttpLocalizedOperationResult();
    List<MaterialRevision> actual = changesetService.revisionsBetween(CaseInsensitiveString.str(pipelineConfigWithTwoMaterials.name()), pipelineOne.getCounter(), pipelineOne.getCounter(), username, result, true, false);
    List<MaterialRevision> expectedRevisions = groupByMaterial(revisionsForGrandfather1, revisionsForUpstream1, revisionsForPipeline1);
    assertMaterialRevisions(expectedRevisions, actual);
    assertThat(result.isSuccessful(), is(true));
}
Also used : HttpLocalizedOperationResult(com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult) Username(com.thoughtworks.go.server.domain.Username) SvnMaterial(com.thoughtworks.go.config.materials.svn.SvnMaterial) DependencyMaterial(com.thoughtworks.go.config.materials.dependency.DependencyMaterial) PipelineMaterialRevision(com.thoughtworks.go.domain.PipelineMaterialRevision) MaterialRevision(com.thoughtworks.go.domain.MaterialRevision) Pipeline(com.thoughtworks.go.domain.Pipeline) Test(org.junit.Test)

Example 59 with Pipeline

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

the class ChangesetServiceIntegrationTest method shouldReturnModsOf2MaterialsBetweenTheGivenPipelineCounters.

@Test
public void shouldReturnModsOf2MaterialsBetweenTheGivenPipelineCounters() {
    List<MaterialRevision> revisionsForPipeline1 = new ArrayList<>();
    addRevisionWith2Mods(revisionsForPipeline1, hg);
    addRevisionWith2Mods(revisionsForPipeline1, git);
    Username username = new Username(new CaseInsensitiveString("user1"));
    Pipeline pipelineOne = dbHelper.checkinRevisionsToBuild(new ManualBuild(username), pipelineConfigWithTwoMaterials, revisionsForPipeline1);
    List<MaterialRevision> revisionsForPipeline2 = new ArrayList<>();
    addRevisionWith2Mods(revisionsForPipeline2, hg);
    addRevisionWith2Mods(revisionsForPipeline2, git);
    Pipeline pipelineTwo = dbHelper.checkinRevisionsToBuild(new ManualBuild(username), pipelineConfigWithTwoMaterials, revisionsForPipeline2);
    HttpLocalizedOperationResult result = new HttpLocalizedOperationResult();
    List<MaterialRevision> actual = changesetService.revisionsBetween(CaseInsensitiveString.str(pipelineConfigWithTwoMaterials.name()), pipelineOne.getCounter(), pipelineTwo.getCounter(), username, result, true, false);
    List<MaterialRevision> expectedRevisions = groupByMaterial(revisionsForPipeline2);
    assertMaterialRevisions(expectedRevisions, actual);
    assertThat(result.isSuccessful(), is(true));
}
Also used : HttpLocalizedOperationResult(com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult) Username(com.thoughtworks.go.server.domain.Username) PipelineMaterialRevision(com.thoughtworks.go.domain.PipelineMaterialRevision) MaterialRevision(com.thoughtworks.go.domain.MaterialRevision) Pipeline(com.thoughtworks.go.domain.Pipeline) Test(org.junit.Test)

Example 60 with Pipeline

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

the class BuilderFactoryIntegrationTest method shouldCreateBuilderForFetchPluggableArtifactTask.

@Test
public void shouldCreateBuilderForFetchPluggableArtifactTask() {
    final PipelineConfig pipelineConfig = goConfigService.pipelineConfigNamed(new CaseInsensitiveString("up42"));
    goConfigService.artifactStores().add(new ArtifactStore("storeId", "PluginId"));
    pipelineConfig.getStage("up42_stage").jobConfigByConfigName("up42_job").artifactConfigs().add(new PluggableArtifactConfig("artifactId", "storeId"));
    final FetchPluggableArtifactTask pluggableArtifactTask = new FetchPluggableArtifactTask(new CaseInsensitiveString("up42"), new CaseInsensitiveString("up42_stage"), new CaseInsensitiveString("up42_job"), "artifactId");
    final Pipeline pipeline = new Pipeline("up42", BuildCause.createExternal());
    final Builder builder = builderFactory.builderFor(pluggableArtifactTask, pipeline, upstreamResolver);
    assertThat(builder, instanceOf(FetchPluggableArtifactBuilder.class));
}
Also used : FetchArtifactBuilder(com.thoughtworks.go.domain.builder.FetchArtifactBuilder) Builder(com.thoughtworks.go.domain.builder.Builder) FetchPluggableArtifactBuilder(com.thoughtworks.go.domain.builder.FetchPluggableArtifactBuilder) FetchPluggableArtifactBuilder(com.thoughtworks.go.domain.builder.FetchPluggableArtifactBuilder) Pipeline(com.thoughtworks.go.domain.Pipeline) Test(org.junit.Test)

Aggregations

Pipeline (com.thoughtworks.go.domain.Pipeline)184 Test (org.junit.Test)122 Stage (com.thoughtworks.go.domain.Stage)33 Username (com.thoughtworks.go.server.domain.Username)30 MaterialRevision (com.thoughtworks.go.domain.MaterialRevision)29 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)24 HttpLocalizedOperationResult (com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult)24 PipelineMaterialRevision (com.thoughtworks.go.domain.PipelineMaterialRevision)21 MaterialRevisions (com.thoughtworks.go.domain.MaterialRevisions)20 JobInstance (com.thoughtworks.go.domain.JobInstance)19 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)13 JobIdentifier (com.thoughtworks.go.domain.JobIdentifier)13 Modification (com.thoughtworks.go.domain.materials.Modification)13 ServerHealthStateOperationResult (com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult)13 Date (java.util.Date)13 DependencyMaterial (com.thoughtworks.go.config.materials.dependency.DependencyMaterial)11 StageIdentifier (com.thoughtworks.go.domain.StageIdentifier)10 DependencyMaterialConfig (com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig)8 PipelineConfigDependencyGraph (com.thoughtworks.go.server.domain.PipelineConfigDependencyGraph)7 PipelineState (com.thoughtworks.go.domain.PipelineState)6