use of com.thoughtworks.go.config.remote.ConfigReposConfig in project gocd by gocd.
the class GoConfigWatchListTest method shouldReturnFalseWhenDoesNotHaveConfigRepoWithFingerprint.
@Test
public void shouldReturnFalseWhenDoesNotHaveConfigRepoWithFingerprint() {
GitMaterialConfig gitrepo = new GitMaterialConfig("http://configrepo.git");
when(cruiseConfig.getConfigRepos()).thenReturn(new ConfigReposConfig(new ConfigRepoConfig(gitrepo, "myplugin")));
watchList = new GoConfigWatchList(cachedGoConfig);
GitMaterialConfig gitrepo2 = new GitMaterialConfig("http://configrepo.git", "dev");
assertFalse(watchList.hasConfigRepoWithFingerprint(gitrepo2.getFingerprint()));
}
use of com.thoughtworks.go.config.remote.ConfigReposConfig in project gocd by gocd.
the class GoConfigWatchListTest method shouldNotifyConfigListenersWhenConfigChanges.
@Test
public void shouldNotifyConfigListenersWhenConfigChanges() throws Exception {
final ChangedRepoConfigWatchListListener listener = mock(ChangedRepoConfigWatchListListener.class);
watchList.registerListener(listener);
when(cruiseConfig.getConfigRepos()).thenReturn(new ConfigReposConfig());
watchList.onConfigChange(cruiseConfig);
verify(listener, times(1)).onChangedRepoConfigWatchList(notNull(ConfigReposConfig.class));
}
use of com.thoughtworks.go.config.remote.ConfigReposConfig in project gocd by gocd.
the class GoConfigWatchListTest method shouldReturnTrueWhenHasConfigRepoWithFingerprint.
@Test
public void shouldReturnTrueWhenHasConfigRepoWithFingerprint() {
GitMaterialConfig gitrepo = new GitMaterialConfig("http://configrepo.git");
when(cruiseConfig.getConfigRepos()).thenReturn(new ConfigReposConfig(new ConfigRepoConfig(gitrepo, "myplugin")));
watchList = new GoConfigWatchList(cachedGoConfig);
assertTrue(watchList.hasConfigRepoWithFingerprint(gitrepo.getFingerprint()));
}
use of com.thoughtworks.go.config.remote.ConfigReposConfig in project gocd by gocd.
the class BasicEnvironmentConfig method validate.
@Override
public void validate(ValidationContext validationContext) {
// each of these references is defined in this.origin
for (EnvironmentPipelineConfig pipelineRefConfig : this.pipelines) {
ConfigReposConfig configRepos = validationContext.getConfigRepos();
PipelineConfig pipelineConfig = validationContext.getPipelineConfigByName(pipelineRefConfig.getName());
if (pipelineConfig == null) {
//other rule will error that we reference unknown pipeline
continue;
}
if (validationContext.shouldCheckConfigRepo()) {
if (!configRepos.isReferenceAllowed(this.origin, pipelineConfig.getOrigin()))
pipelineRefConfig.addError(EnvironmentPipelineConfig.ORIGIN, String.format("Environment defined in %s cannot reference a pipeline in %s", this.origin, displayNameFor(pipelineConfig.getOrigin())));
}
}
}
use of com.thoughtworks.go.config.remote.ConfigReposConfig in project gocd by gocd.
the class GoConfigWatchList method onConfigChange.
@Override
public void onConfigChange(CruiseConfig newCruiseConfig) {
ConfigReposConfig partSources = newCruiseConfig.getConfigRepos();
this.reposConfig = partSources;
notifyListeners(partSources);
}
Aggregations