use of com.thoughtworks.go.config.materials.git.GitMaterialConfig in project gocd by gocd.
the class ScheduledPipelineLoaderIntegrationTest method shouldLoadShallowCloneFlagForGitMaterialsBaseOnTheirOwnPipelineConfig.
@Test
public void shouldLoadShallowCloneFlagForGitMaterialsBaseOnTheirOwnPipelineConfig() throws IOException {
GitTestRepo testRepo = new GitTestRepo(temporaryFolder);
PipelineConfig shallowPipeline = PipelineConfigMother.pipelineConfig("shallowPipeline", new StageConfig(new CaseInsensitiveString("stage"), new JobConfigs(new JobConfig("job-one"))));
shallowPipeline.materialConfigs().clear();
shallowPipeline.addMaterialConfig(new GitMaterialConfig(testRepo.projectRepositoryUrl(), null, true));
configHelper.addPipeline(shallowPipeline);
PipelineConfig fullPipeline = PipelineConfigMother.pipelineConfig("fullPipeline", new StageConfig(new CaseInsensitiveString("stage"), new JobConfigs(new JobConfig("job-one"))));
fullPipeline.materialConfigs().clear();
fullPipeline.addMaterialConfig(new GitMaterialConfig(testRepo.projectRepositoryUrl(), null, false));
configHelper.addPipeline(fullPipeline);
Pipeline shallowPipelineInstance = createAndLoadModifyOneFilePipeline(shallowPipeline);
MaterialRevisions shallowRevisions = shallowPipelineInstance.getBuildCause().getMaterialRevisions();
assertThat(((GitMaterial) shallowRevisions.getRevisions().get(0).getMaterial()).isShallowClone(), is(true));
Pipeline fullPipelineInstance = createAndLoadModifyOneFilePipeline(fullPipeline);
MaterialRevisions fullRevisions = fullPipelineInstance.getBuildCause().getMaterialRevisions();
assertThat(((GitMaterial) fullRevisions.getRevisions().get(0).getMaterial()).isShallowClone(), is(false));
}
use of com.thoughtworks.go.config.materials.git.GitMaterialConfig in project gocd by gocd.
the class PipelineConfigServicePerformanceTest method performanceTestForCreatePipeline.
@Test
public void performanceTestForCreatePipeline() throws Exception {
setupPipelines(0);
final ConcurrentHashMap<String, Boolean> results = new ConcurrentHashMap<>();
run(new Runnable() {
@Override
public void run() {
JobConfig jobConfig = new JobConfig(new CaseInsensitiveString("job"));
StageConfig stageConfig = new StageConfig(new CaseInsensitiveString("stage"), new JobConfigs(jobConfig));
PipelineConfig pipelineConfig = new PipelineConfig(new CaseInsensitiveString(Thread.currentThread().getName()), new MaterialConfigs(new GitMaterialConfig("FOO")), stageConfig);
PerfTimer updateTimer = PerfTimer.start("Saving pipelineConfig : " + pipelineConfig.name());
pipelineConfigService.createPipelineConfig(user, pipelineConfig, result, "jumbo");
updateTimer.stop();
results.put(Thread.currentThread().getName(), result.isSuccessful());
if (!result.isSuccessful()) {
LOGGER.error(result.toString());
LOGGER.error("Errors on pipeline" + Thread.currentThread().getName() + " are : " + StringUtils.join(getAllErrors(pipelineConfig), ", "));
}
}
}, numberOfRequests, results);
}
use of com.thoughtworks.go.config.materials.git.GitMaterialConfig in project gocd by gocd.
the class PipelineConfigTest method shouldReturnFalseWhenOneOfPipelineMaterialsIsNotTheSameAsConfigOrigin.
@Test
public void shouldReturnFalseWhenOneOfPipelineMaterialsIsNotTheSameAsConfigOrigin() {
PipelineConfig pipelineConfig = PipelineConfigMother.createPipelineConfig("pipeline", "stage", "build");
MaterialConfig material = new GitMaterialConfig("http://git");
pipelineConfig.setOrigin(new RepoConfigOrigin(new ConfigRepoConfig(material, "plugin"), "1233"));
assertThat(pipelineConfig.isConfigOriginSameAsOneOfMaterials(), is(false));
}
use of com.thoughtworks.go.config.materials.git.GitMaterialConfig in project gocd by gocd.
the class PipelineConfigValidationTest method isValid_shouldEnsureReturnsTrueWhenLabelTemplateRefersToValidMaterials.
@Test
public void isValid_shouldEnsureReturnsTrueWhenLabelTemplateRefersToValidMaterials() {
pipeline.setLabelTemplate("pipeline-${COUNT}-${myGit}");
GitMaterialConfig gitConfig = MaterialConfigsMother.gitMaterialConfig("git://url");
gitConfig.setName(new CaseInsensitiveString("myGit"));
pipeline.addMaterialConfig(gitConfig);
pipeline.validate(validationContext);
assertThat(pipeline.errors().isEmpty(), is(true));
List<String> errors = pipeline.errors().getAllOn("labelTemplate");
assertThat(errors, is(nullValue()));
}
use of com.thoughtworks.go.config.materials.git.GitMaterialConfig in project gocd by gocd.
the class GoPartialConfigIntegrationTest method setUp.
@Before
public void setUp() throws Exception {
goCache.clear();
configHelper.usingCruiseConfigDao(goConfigDao);
configHelper.onSetUp();
repoConfig1 = new ConfigRepoConfig(new GitMaterialConfig("url1"), "plugin");
repoConfig2 = new ConfigRepoConfig(new GitMaterialConfig("url2"), "plugin");
configHelper.addConfigRepo(repoConfig1);
configHelper.addConfigRepo(repoConfig2);
}
Aggregations