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())));
}
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());
}
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));
}
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));
}
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));
}
Aggregations