use of com.thoughtworks.go.config.remote.ConfigRepoConfig in project gocd by gocd.
the class GoPartialConfigTest method setUp.
@Before
public void setUp() {
serverHealthService = mock(ServerHealthService.class);
configPluginService = mock(GoConfigPluginService.class);
plugin = mock(PartialConfigProvider.class);
when(configPluginService.partialConfigProviderFor(any(ConfigRepoConfig.class))).thenReturn(plugin);
cruiseConfig = new BasicCruiseConfig();
configRepoConfig = new ConfigRepoConfig(new GitMaterialConfig("url"), "plugin");
cruiseConfig.setConfigRepos(new ConfigReposConfig(configRepoConfig));
cachedGoConfig = mock(CachedGoConfig.class);
when(cachedGoConfig.currentConfig()).thenReturn(cruiseConfig);
configWatchList = new GoConfigWatchList(cachedGoConfig);
repoConfigDataSource = new GoRepoConfigDataSource(configWatchList, configPluginService, serverHealthService);
cachedGoPartials = new CachedGoPartials(serverHealthService);
goConfigService = mock(GoConfigService.class);
serverHealthService = mock(ServerHealthService.class);
partialConfig = new GoPartialConfig(repoConfigDataSource, configWatchList, goConfigService, cachedGoPartials, serverHealthService);
}
use of com.thoughtworks.go.config.remote.ConfigRepoConfig in project gocd by gocd.
the class GoPartialConfigTest method shouldRemovePartialWhenNoLongerInWatchList.
@Test
public void shouldRemovePartialWhenNoLongerInWatchList() throws Exception {
ScmMaterialConfig material = setOneConfigRepo();
PartialConfig part = new PartialConfig();
when(plugin.load(any(File.class), any(PartialConfigLoadContext.class))).thenReturn(part);
repoConfigDataSource.onCheckoutComplete(material, folder, "7a8f");
assertThat(partialConfig.lastPartials().size(), is(1));
assertThat(partialConfig.lastPartials().get(0), is(part));
// we change current configuration
ScmMaterialConfig othermaterial = new GitMaterialConfig("http://myother.git");
cruiseConfig.setConfigRepos(new ConfigReposConfig(new ConfigRepoConfig(othermaterial, "myplugin")));
configWatchList.onConfigChange(cruiseConfig);
assertThat(partialConfig.lastPartials().size(), is(0));
}
use of com.thoughtworks.go.config.remote.ConfigRepoConfig in project gocd by gocd.
the class GoPartialConfigTest method setOneConfigRepo.
private ScmMaterialConfig setOneConfigRepo() {
ScmMaterialConfig material = new GitMaterialConfig("http://my.git");
cruiseConfig.setConfigRepos(new ConfigReposConfig(new ConfigRepoConfig(material, "myplugin")));
configWatchList.onConfigChange(cruiseConfig);
return material;
}
use of com.thoughtworks.go.config.remote.ConfigRepoConfig 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.remote.ConfigRepoConfig in project gocd by gocd.
the class PipelineConfigTest method shouldReturnConfigRepoOriginDisplayNameWhenOriginIsRemote.
@Test
public void shouldReturnConfigRepoOriginDisplayNameWhenOriginIsRemote() {
PipelineConfig pipelineConfig = new PipelineConfig();
pipelineConfig.setOrigin(new RepoConfigOrigin(new ConfigRepoConfig(MaterialConfigsMother.gitMaterialConfig(), "plugin"), "revision1"));
assertThat(pipelineConfig.getOriginDisplayName(), is("AwesomeGitMaterial at revision1"));
}
Aggregations