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());
}
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();
}
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));
}
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()));
}
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()));
}
Aggregations