use of com.thoughtworks.go.serverhealth.ServerHealthStates in project gocd by gocd.
the class SCMMaterialSourceTest method shouldReloadSchedulableMaterialsOnPipelineConfigChange.
@Test
public void shouldReloadSchedulableMaterialsOnPipelineConfigChange() {
Set<MaterialConfig> schedulableMaterialConfigs = new HashSet<>(Arrays.asList(svnMaterial.config()));
when(goConfigService.getSchedulableSCMMaterials()).thenReturn(schedulableMaterialConfigs);
when(materialConfigConverter.toMaterials(schedulableMaterialConfigs)).thenReturn(new HashSet<>(Arrays.asList(svnMaterial)));
Set<Material> materials = source.materialsForUpdate();
assertThat(materials.size(), is(1));
assertTrue(materials.contains(svnMaterial));
schedulableMaterialConfigs = new HashSet<>(Arrays.asList(svnMaterial.config(), gitMaterial.config()));
when(goConfigService.getSchedulableSCMMaterials()).thenReturn(schedulableMaterialConfigs);
when(goConfigService.getCurrentConfig()).thenReturn(mock(CruiseConfig.class));
when(materialConfigConverter.toMaterials(schedulableMaterialConfigs)).thenReturn(new HashSet<>(Arrays.asList(svnMaterial, gitMaterial)));
when(serverHealthService.getAllLogs()).thenReturn(new ServerHealthStates());
source.pipelineConfigChangedListener().onEntityConfigChange(mock(PipelineConfig.class));
materials = source.materialsForUpdate();
assertThat(materials.size(), is(2));
assertTrue(materials.contains(svnMaterial));
assertTrue(materials.contains(gitMaterial));
}
Aggregations