Search in sources :

Example 6 with ConfigReposConfig

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()));
}
Also used : ConfigReposConfig(com.thoughtworks.go.config.remote.ConfigReposConfig) GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) ConfigRepoConfig(com.thoughtworks.go.config.remote.ConfigRepoConfig) Test(org.junit.Test)

Example 7 with ConfigReposConfig

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));
}
Also used : ConfigReposConfig(com.thoughtworks.go.config.remote.ConfigReposConfig) Test(org.junit.Test)

Example 8 with ConfigReposConfig

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()));
}
Also used : ConfigReposConfig(com.thoughtworks.go.config.remote.ConfigReposConfig) GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) ConfigRepoConfig(com.thoughtworks.go.config.remote.ConfigRepoConfig) Test(org.junit.Test)

Example 9 with ConfigReposConfig

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())));
        }
    }
}
Also used : ConfigReposConfig(com.thoughtworks.go.config.remote.ConfigReposConfig)

Example 10 with ConfigReposConfig

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);
}
Also used : ConfigReposConfig(com.thoughtworks.go.config.remote.ConfigReposConfig)

Aggregations

ConfigReposConfig (com.thoughtworks.go.config.remote.ConfigReposConfig)11 GitMaterialConfig (com.thoughtworks.go.config.materials.git.GitMaterialConfig)8 ConfigRepoConfig (com.thoughtworks.go.config.remote.ConfigRepoConfig)8 Test (org.junit.Test)6 ScmMaterialConfig (com.thoughtworks.go.config.materials.ScmMaterialConfig)2 File (java.io.File)2 PartialConfig (com.thoughtworks.go.config.remote.PartialConfig)1 RepoConfigOrigin (com.thoughtworks.go.config.remote.RepoConfigOrigin)1 GoConfigService (com.thoughtworks.go.server.service.GoConfigService)1 ServerHealthService (com.thoughtworks.go.serverhealth.ServerHealthService)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 TimeoutException (java.util.concurrent.TimeoutException)1 InvalidCipherTextException (org.bouncycastle.crypto.InvalidCipherTextException)1 Before (org.junit.Before)1