Search in sources :

Example 61 with HgMaterial

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));
}
Also used : MaterialConfigs(com.thoughtworks.go.config.materials.MaterialConfigs) PipelineConfig(com.thoughtworks.go.config.PipelineConfig) HgMaterial(com.thoughtworks.go.config.materials.mercurial.HgMaterial) Material(com.thoughtworks.go.domain.materials.Material) HgMaterial(com.thoughtworks.go.config.materials.mercurial.HgMaterial) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) Test(org.junit.Test)

Example 62 with HgMaterial

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));
}
Also used : HgMaterial(com.thoughtworks.go.config.materials.mercurial.HgMaterial) Test(org.junit.Test)

Example 63 with HgMaterial

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));
}
Also used : HgMaterial(com.thoughtworks.go.config.materials.mercurial.HgMaterial) Test(org.junit.Test)

Example 64 with HgMaterial

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();
}
Also used : HgMaterial(com.thoughtworks.go.config.materials.mercurial.HgMaterial) GitMaterial(com.thoughtworks.go.config.materials.git.GitMaterial) Material(com.thoughtworks.go.domain.materials.Material) HgMaterial(com.thoughtworks.go.config.materials.mercurial.HgMaterial) Test(org.junit.Test)

Example 65 with HgMaterial

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));
}
Also used : HgMaterial(com.thoughtworks.go.config.materials.mercurial.HgMaterial) Test(org.junit.Test)

Aggregations

HgMaterial (com.thoughtworks.go.config.materials.mercurial.HgMaterial)121 Test (org.junit.Test)107 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)34 MaterialRevisions (com.thoughtworks.go.domain.MaterialRevisions)29 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)23 SvnMaterial (com.thoughtworks.go.config.materials.svn.SvnMaterial)23 DependencyMaterial (com.thoughtworks.go.config.materials.dependency.DependencyMaterial)20 GitMaterial (com.thoughtworks.go.config.materials.git.GitMaterial)18 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)16 Material (com.thoughtworks.go.domain.materials.Material)15 P4Material (com.thoughtworks.go.config.materials.perforce.P4Material)10 ServerHealthStateOperationResult (com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult)10 Date (java.util.Date)10 HgMaterialConfig (com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig)9 ScheduleTestUtil (com.thoughtworks.go.server.service.ScheduleTestUtil)9 TimeProvider (com.thoughtworks.go.util.TimeProvider)8 Pagination (com.thoughtworks.go.server.util.Pagination)7 MaterialRevision (com.thoughtworks.go.domain.MaterialRevision)6 Modification (com.thoughtworks.go.domain.materials.Modification)6 File (java.io.File)6