use of com.thoughtworks.go.config.remote.PartialConfig 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;
}
use of com.thoughtworks.go.config.remote.PartialConfig in project gocd by gocd.
the class PartialConfigMother method withPipeline.
public static PartialConfig withPipeline(String name, RepoConfigOrigin repoOrigin) {
PipelineConfig pipe = PipelineConfigMother.pipelineConfig(name);
BasicPipelineConfigs pipes = new BasicPipelineConfigs(pipe);
pipes.setGroup("group");
PartialConfig partialConfig = new PartialConfig(new PipelineGroups(pipes));
partialConfig.setOrigins(repoOrigin);
return partialConfig;
}
use of com.thoughtworks.go.config.remote.PartialConfig in project gocd by gocd.
the class GoFileConfigDataSourceTest method shouldNotRetryConfigUpdateIfLastKnownAndValidPartialsAreSame_OnWriteFullConfigWithLock.
@Test(expected = RuntimeException.class)
public void shouldNotRetryConfigUpdateIfLastKnownAndValidPartialsAreSame_OnWriteFullConfigWithLock() throws Exception {
PartialConfig partialConfig1 = PartialConfigMother.withPipeline("p1", new RepoConfigOrigin(new ConfigRepoConfig(MaterialConfigsMother.gitMaterialConfig(), "plugin"), "git_r1"));
List<PartialConfig> known = asList(partialConfig1);
List<PartialConfig> valid = asList(partialConfig1);
BasicCruiseConfig configForEdit = new BasicCruiseConfig();
MagicalGoConfigXmlLoader.setMd5(configForEdit, "md5");
FullConfigUpdateCommand updatingCommand = new FullConfigUpdateCommand(new BasicCruiseConfig(), "md5");
GoConfigHolder configHolder = new GoConfigHolder(new BasicCruiseConfig(), configForEdit);
CachedGoPartials cachedGoPartials = mock(CachedGoPartials.class);
GoFileConfigDataSource source = new GoFileConfigDataSource(null, null, systemEnvironment, null, null, null, null, null, cachedGoPartials, fullConfigSaveMergeFlow, fullConfigSaveNormalFlow);
stub(cachedGoPartials.lastKnownPartials()).toReturn(known);
stub(cachedGoPartials.lastValidPartials()).toReturn(valid);
when(fullConfigSaveNormalFlow.execute(updatingCommand, known, "loser_boozer")).thenThrow(new GoConfigInvalidException(configForEdit, "error"));
source.writeFullConfigWithLock(updatingCommand, configHolder);
}
use of com.thoughtworks.go.config.remote.PartialConfig in project gocd by gocd.
the class GoFileConfigDataSourceTest method shouldReturnFalseWhenValidPartialsListIsNotTheSameAsKnownPartialList.
@Test
public void shouldReturnFalseWhenValidPartialsListIsNotTheSameAsKnownPartialList() {
PartialConfig partialConfig1 = PartialConfigMother.withPipeline("p1", new RepoConfigOrigin(new ConfigRepoConfig(MaterialConfigsMother.gitMaterialConfig(), "plugin"), "git_r1"));
PartialConfig partialConfig2 = PartialConfigMother.withPipeline("p2", new RepoConfigOrigin(new ConfigRepoConfig(MaterialConfigsMother.svnMaterialConfig(), "plugin"), "svn_r1"));
PartialConfig partialConfig3 = PartialConfigMother.withPipeline("p1", new RepoConfigOrigin(new ConfigRepoConfig(MaterialConfigsMother.gitMaterialConfig(), "plugin"), "git_r2"));
PartialConfig partialConfig4 = PartialConfigMother.withPipeline("p2", new RepoConfigOrigin(new ConfigRepoConfig(MaterialConfigsMother.svnMaterialConfig(), "plugin"), "svn_r2"));
List<PartialConfig> known = asList(partialConfig1, partialConfig2);
List<PartialConfig> valid = asList(partialConfig3, partialConfig4);
assertThat(dataSource.areKnownPartialsSameAsValidPartials(known, valid), is(false));
}
use of com.thoughtworks.go.config.remote.PartialConfig in project gocd by gocd.
the class GoPartialConfigTest method shouldNotifyListenersAfterUpdatingMapOfLatestValidConfig.
@Test
public void shouldNotifyListenersAfterUpdatingMapOfLatestValidConfig() {
ScmMaterialConfig material = setOneConfigRepo();
PartialConfig part = new PartialConfig();
when(plugin.load(any(File.class), any(PartialConfigLoadContext.class))).thenReturn(part);
PartialConfigUpdateCompletedListener listener = mock(PartialConfigUpdateCompletedListener.class);
repoConfigDataSource.registerListener(listener);
repoConfigDataSource.onCheckoutComplete(material, folder, "7a8f");
verify(listener, times(1)).onSuccessPartialConfig(any(ConfigRepoConfig.class), any(PartialConfig.class));
}
Aggregations