use of com.thoughtworks.go.config.materials.svn.SvnMaterialConfig in project gocd by gocd.
the class BuildCauseProducerServiceTest method shouldScheduleAfterAllMaterialsAreUpdated.
@Test
public void shouldScheduleAfterAllMaterialsAreUpdated() throws Exception {
HgMaterial hgMaterial = new HgMaterial("url", null);
HgMaterialConfig hgMaterialConfig = hg("url", null);
SvnMaterial svnMaterial = new SvnMaterial("url", null, null, false);
SvnMaterialConfig svnMaterialConfig = svn("url", null, null, false);
pipelineConfig.addMaterialConfig(hgMaterialConfig);
pipelineConfig.addMaterialConfig(svnMaterialConfig);
GoConfigService service = mock(GoConfigService.class);
when(service.pipelineConfigNamed(pipelineConfig.name())).thenReturn(pipelineConfig);
when(materialConfigConverter.toMaterial(hgMaterialConfig)).thenReturn(hgMaterial);
when(materialConfigConverter.toMaterial(svnMaterialConfig)).thenReturn(svnMaterial);
MaterialUpdateStatusNotifier notifier = new MaterialUpdateStatusNotifier(mock(MaterialUpdateCompletedTopic.class));
buildCauseProducerService = spy(createBuildCauseProducerService(notifier));
buildCauseProducerService.manualSchedulePipeline(Username.ANONYMOUS, pipelineConfig.name(), new ScheduleOptions(), new ServerHealthStateOperationResult());
final HashMap<String, String> stringStringHashMap = new HashMap<>();
doReturn(ServerHealthState.success(healthStateType)).when(buildCauseProducerService).newProduceBuildCause(eq(pipelineConfig), any(ManualBuild.class), new ScheduleOptions(eq(EMPTY_REVISIONS), stringStringHashMap, new HashMap<>()), any(ServerHealthStateOperationResult.class), eq(12345L));
assertThat(notifier.hasListenerFor(pipelineConfig), is(true));
notifier.onMessage(new MaterialUpdateSuccessfulMessage(hgMaterial, 1111L));
assertThat(notifier.hasListenerFor(pipelineConfig), is(true));
notifier.onMessage(new MaterialUpdateSuccessfulMessage(svnMaterial, 2222L));
assertThat(notifier.hasListenerFor(pipelineConfig), is(false));
verify(buildCauseProducerService).newProduceBuildCause(eq(pipelineConfig), any(ManualBuild.class), eq(new ScheduleOptions()), any(ServerHealthStateOperationResult.class), eq(2222L));
}
use of com.thoughtworks.go.config.materials.svn.SvnMaterialConfig in project gocd by gocd.
the class PipelineHistoryServiceIntegrationTest method shouldContainNoRevisionsForNewMaterialsThatHAveNotBeenUpdated.
@Test
public void shouldContainNoRevisionsForNewMaterialsThatHAveNotBeenUpdated() throws Exception {
pipelineOne.createPipelineWithFirstStageScheduled();
SvnMaterialConfig svnMaterialConfig = svn("new-material", null, null, false);
svnMaterialConfig.setConfigAttributes(Collections.singletonMap(ScmMaterialConfig.FOLDER, "new-material"));
configHelper.addMaterialToPipeline(pipelineOne.pipelineName, svnMaterialConfig);
configHelper.setViewPermissionForGroup("group1", "username");
PipelineInstanceModels latest = pipelineHistoryService.loadWithEmptyAsDefault(pipelineOne.pipelineName, Pagination.ONE_ITEM, "username");
MaterialRevisions latestRevision = latest.get(0).getLatestRevisions();
assertThat(latestRevision.getRevisions().size(), is(1));
}
use of com.thoughtworks.go.config.materials.svn.SvnMaterialConfig in project gocd by gocd.
the class GoConfigMaterialsTest method shouldOnlyHaveOneCopyOfAMaterialIfOnlyTheFolderIsDifferent.
@Test
public void shouldOnlyHaveOneCopyOfAMaterialIfOnlyTheFolderIsDifferent() {
SvnMaterialConfig svn = MaterialConfigsMother.svnMaterialConfig("url", "folder1", true);
SvnMaterialConfig svnInDifferentFolder = MaterialConfigsMother.svnMaterialConfig("url", "folder2");
PipelineConfig pipeline1 = new PipelineConfig(new CaseInsensitiveString("pipeline1"), new MaterialConfigs(svn));
PipelineConfig pipeline2 = new PipelineConfig(new CaseInsensitiveString("pipeline2"), new MaterialConfigs(svnInDifferentFolder));
CruiseConfig config = new BasicCruiseConfig(new BasicPipelineConfigs(pipeline1, pipeline2));
assertThat(config.getAllUniqueMaterialsBelongingToAutoPipelines().size(), is(1));
}
use of com.thoughtworks.go.config.materials.svn.SvnMaterialConfig in project gocd by gocd.
the class GoConfigMaterialsTest method shouldHaveBothMaterialsIfTheTypeIsDifferent.
@Test
public void shouldHaveBothMaterialsIfTheTypeIsDifferent() {
SvnMaterialConfig svn = MaterialConfigsMother.svnMaterialConfig("url", "folder1", true);
HgMaterialConfig hg = MaterialConfigsMother.hgMaterialConfig("url", "folder2");
PipelineConfig pipeline1 = new PipelineConfig(new CaseInsensitiveString("pipeline1"), new MaterialConfigs(svn));
PipelineConfig pipeline2 = new PipelineConfig(new CaseInsensitiveString("pipeline2"), new MaterialConfigs(hg));
CruiseConfig config = new BasicCruiseConfig(new BasicPipelineConfigs(pipeline1, pipeline2));
assertThat(config.getAllUniqueMaterialsBelongingToAutoPipelines().size(), is(2));
}
use of com.thoughtworks.go.config.materials.svn.SvnMaterialConfig in project gocd by gocd.
the class PartialConfigMother method withPipelineMultipleMaterials.
public static PartialConfig withPipelineMultipleMaterials(String name, RepoConfigOrigin repoOrigin) {
GitMaterialConfig gitMaterialConfig = MaterialConfigsMother.gitMaterialConfig();
gitMaterialConfig.setFolder("git");
SvnMaterialConfig svnMaterialConfig = MaterialConfigsMother.svnMaterialConfig();
svnMaterialConfig.setFolder("svn");
PipelineConfig pipe = PipelineConfigMother.pipelineConfig(name, new MaterialConfigs(gitMaterialConfig, svnMaterialConfig));
BasicPipelineConfigs pipes = new BasicPipelineConfigs(pipe);
pipes.setGroup("group");
PartialConfig partialConfig = new PartialConfig(new PipelineGroups(pipes));
partialConfig.setOrigins(repoOrigin);
return partialConfig;
}
Aggregations