Search in sources :

Example 41 with ConfigRepoConfig

use of com.thoughtworks.go.config.remote.ConfigRepoConfig in project gocd by gocd.

the class BuildCauseProducerServiceTest method manualTrigger_shouldUpdateJustPipelineConfigNotMaterialsWhenPipelineIsDefinedInConfigRepoAndMDUFlagIsTurnedOff.

@Test
public void manualTrigger_shouldUpdateJustPipelineConfigNotMaterialsWhenPipelineIsDefinedInConfigRepoAndMDUFlagIsTurnedOff() {
    HgMaterial material1 = new HgMaterial("url", null);
    HgMaterialConfig materialConfig1 = new HgMaterialConfig("url", null);
    HgMaterialConfig materialConfig2 = new HgMaterialConfig("url2", null);
    pipelineConfig.addMaterialConfig(materialConfig1);
    pipelineConfig.setOrigin(new RepoConfigOrigin(new ConfigRepoConfig(materialConfig2, "plug"), "revision1"));
    when(materialConfigConverter.toMaterial(materialConfig1)).thenReturn(material1);
    when(materialConfigConverter.toMaterial(materialConfig2)).thenReturn(new MaterialConfigConverter().toMaterial(materialConfig2));
    ScheduleOptions scheduleOptions = new ScheduleOptions(new HashMap<>(), new HashMap<>(), new HashMap<>());
    scheduleOptions.shouldPerformMDUBeforeScheduling(false);
    buildCauseProducerService.manualSchedulePipeline(Username.ANONYMOUS, pipelineConfig.name(), scheduleOptions, new ServerHealthStateOperationResult());
    verify(goConfigService, times(1)).pipelineConfigNamed(pipelineConfig.name());
    MaterialUpdateStatusListener statusListener = extractMaterialListenerInstanceFromRegisterCall();
    statusListener.onMaterialUpdate(new MaterialUpdateSuccessfulMessage(material1, 0));
    verify(mockMaterialUpdateStatusNotifier).registerListenerFor(eq(pipelineConfig), any(MaterialUpdateStatusListener.class));
    verify(goConfigService, times(1)).pipelineConfigNamed(pipelineConfig.name());
}
Also used : ConfigRepoConfig(com.thoughtworks.go.config.remote.ConfigRepoConfig) HgMaterial(com.thoughtworks.go.config.materials.mercurial.HgMaterial) HgMaterialConfig(com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig) RepoConfigOrigin(com.thoughtworks.go.config.remote.RepoConfigOrigin) ServerHealthStateOperationResult(com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult) Test(org.junit.Test)

Example 42 with ConfigRepoConfig

use of com.thoughtworks.go.config.remote.ConfigRepoConfig in project gocd by gocd.

the class CachedGoPartialsTest method setUp.

@Before
public void setUp() throws Exception {
    serverHealthService = new ServerHealthService();
    partials = new CachedGoPartials(serverHealthService);
    configRepo1 = new ConfigRepoConfig(new GitMaterialConfig("url1"), "plugin");
    part1 = PartialConfigMother.withPipeline("p1", new RepoConfigOrigin(configRepo1, "1"));
    configRepo2 = new ConfigRepoConfig(new GitMaterialConfig("url2"), "plugin");
    part2 = PartialConfigMother.withPipeline("p2", new RepoConfigOrigin(configRepo2, "1"));
    partials.addOrUpdate(configRepo1.getMaterialConfig().getFingerprint(), part1);
    partials.addOrUpdate(configRepo2.getMaterialConfig().getFingerprint(), part2);
    fingerprintForRepo1 = ((RepoConfigOrigin) part1.getOrigin()).getMaterial().getFingerprint();
    fingerprintForRepo2 = ((RepoConfigOrigin) part2.getOrigin()).getMaterial().getFingerprint();
}
Also used : ConfigRepoConfig(com.thoughtworks.go.config.remote.ConfigRepoConfig) GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) ServerHealthService(com.thoughtworks.go.serverhealth.ServerHealthService) RepoConfigOrigin(com.thoughtworks.go.config.remote.RepoConfigOrigin) Before(org.junit.Before)

Example 43 with ConfigRepoConfig

use of com.thoughtworks.go.config.remote.ConfigRepoConfig in project gocd by gocd.

the class GoConfigWatchListTest method shouldNotifyConfigListenersWhenSingleConfigRepoHasChanged.

@Test
public void shouldNotifyConfigListenersWhenSingleConfigRepoHasChanged() throws Exception {
    final ChangedRepoConfigWatchListListener listener = mock(ChangedRepoConfigWatchListListener.class);
    watchList.registerListener(listener);
    watchList.onEntityConfigChange(new ConfigRepoConfig(new GitMaterialConfig("http://git1"), "myplugin", "id"));
    verify(listener, times(2)).onChangedRepoConfigWatchList(notNull(ConfigReposConfig.class));
}
Also used : ConfigReposConfig(com.thoughtworks.go.config.remote.ConfigReposConfig) ConfigRepoConfig(com.thoughtworks.go.config.remote.ConfigRepoConfig) GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) Test(org.junit.Test)

Example 44 with ConfigRepoConfig

use of com.thoughtworks.go.config.remote.ConfigRepoConfig 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, goConfigService);
    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 45 with ConfigRepoConfig

use of com.thoughtworks.go.config.remote.ConfigRepoConfig 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, mock(GoConfigService.class));
    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)

Aggregations

ConfigRepoConfig (com.thoughtworks.go.config.remote.ConfigRepoConfig)66 Test (org.junit.Test)40 GitMaterialConfig (com.thoughtworks.go.config.materials.git.GitMaterialConfig)37 RepoConfigOrigin (com.thoughtworks.go.config.remote.RepoConfigOrigin)34 Before (org.junit.Before)13 PartialConfig (com.thoughtworks.go.config.remote.PartialConfig)11 HttpLocalizedOperationResult (com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult)10 ConfigReposConfig (com.thoughtworks.go.config.remote.ConfigReposConfig)9 MaterialConfig (com.thoughtworks.go.domain.materials.MaterialConfig)9 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)8 DependencyMaterialConfig (com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig)6 SvnMaterialConfig (com.thoughtworks.go.config.materials.svn.SvnMaterialConfig)6 File (java.io.File)6 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)5 HgMaterialConfig (com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig)5 BuildCause (com.thoughtworks.go.domain.buildcause.BuildCause)5 IOException (java.io.IOException)5 AbstractMaterialConfig (com.thoughtworks.go.config.materials.AbstractMaterialConfig)4 PackageMaterialConfig (com.thoughtworks.go.config.materials.PackageMaterialConfig)4 PluggableSCMMaterialConfig (com.thoughtworks.go.config.materials.PluggableSCMMaterialConfig)4