use of com.thoughtworks.go.server.materials.MaterialUpdateStatusListener in project gocd by gocd.
the class BuildCauseProducerServiceTest method manualTrigger_shouldNotUpdatePipelineConfigWhenConfigRepoIsNotInMaterials.
@Test
public void manualTrigger_shouldNotUpdatePipelineConfigWhenConfigRepoIsNotInMaterials() {
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);
buildCauseProducerService.manualSchedulePipeline(Username.ANONYMOUS, pipelineConfig.name(), new ScheduleOptions(new HashMap<>(), new HashMap<>(), new HashMap<>()), new ServerHealthStateOperationResult());
verify(goConfigService, times(1)).pipelineConfigNamed(pipelineConfig.name());
MaterialUpdateStatusListener statusListener = extractMaterialListenerInstanceFromRegisterCall();
statusListener.onMaterialUpdate(new MaterialUpdateSuccessfulMessage(material1, 0));
verify(mockMaterialUpdateStatusNotifier).removeListenerFor(pipelineConfig);
verify(goConfigService, times(1)).pipelineConfigNamed(pipelineConfig.name());
}
use of com.thoughtworks.go.server.materials.MaterialUpdateStatusListener in project gocd by gocd.
the class BuildCauseProducerServiceIntegrationTest method assertMDUPending.
private void assertMDUPending(PipelineConfig remotePipeline, Material material, boolean pending) {
MaterialUpdateStatusListener materialUpdateStatusListener = ((ConcurrentMap<String, MaterialUpdateStatusListener>) ReflectionUtil.getField(materialUpdateStatusNotifier, "pending")).get(CaseInsensitiveString.str(remotePipeline.name()));
assertThat(materialUpdateStatusListener.isListeningFor(material), is(pending));
}
Aggregations