use of com.thoughtworks.go.config.materials.mercurial.HgMaterial in project gocd by gocd.
the class MaterialUpdateStatusNotifierTest method shouldNotifyListenerWhenItsMaterialIsUpdated.
@Test
public void shouldNotifyListenerWhenItsMaterialIsUpdated() throws Exception {
PipelineConfig pipelineConfig = new PipelineConfig(new CaseInsensitiveString("config"), new MaterialConfigs());
Material material = new HgMaterial("url", null);
pipelineConfig.addMaterialConfig(material.config());
MaterialUpdateStatusListener mockStatusListener = Mockito.mock(MaterialUpdateStatusListener.class);
when(mockStatusListener.isListeningFor(material)).thenReturn(true);
materialUpdateStatusNotifier.registerListenerFor(pipelineConfig, mockStatusListener);
materialUpdateStatusNotifier.onMessage(new MaterialUpdateSuccessfulMessage(material, 123));
Mockito.verify(mockStatusListener).onMaterialUpdate(new MaterialUpdateSuccessfulMessage(material, 123));
}
use of com.thoughtworks.go.config.materials.mercurial.HgMaterial in project gocd by gocd.
the class MercurialPostCommitHookImplementerTest method shouldReturnFalseWhenProtocolIsDifferent.
@Test
public void shouldReturnFalseWhenProtocolIsDifferent() throws Exception {
boolean isEqual = implementer.isUrlEqual("http://repo-url", new HgMaterial("https://repo-url", "dest"));
assertThat(isEqual, is(false));
}
use of com.thoughtworks.go.config.materials.mercurial.HgMaterial in project gocd by gocd.
the class MercurialPostCommitHookImplementerTest method shouldReturnTrueWhenBasicAuthWithoutPasswordIsProvidedInURL.
@Test
public void shouldReturnTrueWhenBasicAuthWithoutPasswordIsProvidedInURL() throws Exception {
boolean isEqual = implementer.isUrlEqual("http://repo-url", new HgMaterial("http://user:@repo-url", "dest"));
assertThat(isEqual, is(true));
}
use of com.thoughtworks.go.config.materials.mercurial.HgMaterial in project gocd by gocd.
the class MercurialPostCommitHookImplementerTest method shouldReturnEmptyListWhenURLIsSpecified.
@Test
public void shouldReturnEmptyListWhenURLIsSpecified() throws Exception {
HgMaterial material = mock(HgMaterial.class);
HashSet<Material> materials = new HashSet<>(Arrays.asList(material));
Set<Material> actual = implementer.prune(materials, new HashMap());
assertThat(actual.size(), is(0));
verify(material, times(0)).getUrlArgument();
}
use of com.thoughtworks.go.config.materials.mercurial.HgMaterial in project gocd by gocd.
the class MercurialPostCommitHookImplementerTest method shouldReturnFalseWhenNoValidatorCouldParseUrl.
@Test
public void shouldReturnFalseWhenNoValidatorCouldParseUrl() throws Exception {
boolean isEqual = implementer.isUrlEqual("http://repo-url", new HgMaterial("something.completely.random", "dest"));
assertThat(isEqual, is(false));
}
Aggregations