Search in sources :

Example 56 with HgMaterial

use of com.thoughtworks.go.config.materials.mercurial.HgMaterial in project gocd by gocd.

the class HgMultipleMaterialsTest method shouldCloneMaterialToItsDestFolder.

@Test
public void shouldCloneMaterialToItsDestFolder() throws Exception {
    HgMaterial material1 = repo.createMaterial("dest1");
    MaterialRevision materialRevision = new MaterialRevision(material1, material1.latestModification(pipelineDir, new TestSubprocessExecutionContext()));
    materialRevision.updateTo(pipelineDir, ProcessOutputStreamConsumer.inMemoryConsumer(), new TestSubprocessExecutionContext());
    assertThat(new File(pipelineDir, "dest1").exists(), is(true));
    assertThat(new File(pipelineDir, "dest1/.hg").exists(), is(true));
}
Also used : TestSubprocessExecutionContext(com.thoughtworks.go.domain.materials.TestSubprocessExecutionContext) HgMaterial(com.thoughtworks.go.config.materials.mercurial.HgMaterial) MaterialRevision(com.thoughtworks.go.domain.MaterialRevision) File(java.io.File) Test(org.junit.Test)

Example 57 with HgMaterial

use of com.thoughtworks.go.config.materials.mercurial.HgMaterial in project gocd by gocd.

the class HgTestRepo method createMaterial.

public HgMaterial createMaterial(String dest) {
    HgMaterial material = material();
    material.setFolder(dest);
    return material;
}
Also used : HgMaterial(com.thoughtworks.go.config.materials.mercurial.HgMaterial)

Example 58 with HgMaterial

use of com.thoughtworks.go.config.materials.mercurial.HgMaterial in project gocd by gocd.

the class HgTestRepo method updateTo.

public HgMaterial updateTo(File baseDir) {
    HgMaterial material = material();
    Revision tip = latestRevision(material, baseDir, new TestSubprocessExecutionContext());
    material.updateTo(ProcessOutputStreamConsumer.inMemoryConsumer(), baseDir, new RevisionContext(tip), new TestSubprocessExecutionContext());
    return material;
}
Also used : StringRevision(com.thoughtworks.go.domain.materials.mercurial.StringRevision) HgMaterial(com.thoughtworks.go.config.materials.mercurial.HgMaterial)

Example 59 with HgMaterial

use of com.thoughtworks.go.config.materials.mercurial.HgMaterial in project gocd by gocd.

the class MaterialInstanceTest method shouldGenerateUniqueFingerprintOnCreation.

@Test
public void shouldGenerateUniqueFingerprintOnCreation() throws Exception {
    MaterialInstance one = new HgMaterial("url", null).createMaterialInstance();
    MaterialInstance two = new HgMaterial("otherurl", null).createMaterialInstance();
    assertThat(one.getFingerprint(), not(nullValue()));
    assertThat(one.getFingerprint(), not(is(two.getFingerprint())));
}
Also used : HgMaterial(com.thoughtworks.go.config.materials.mercurial.HgMaterial) Test(org.junit.Test)

Example 60 with HgMaterial

use of com.thoughtworks.go.config.materials.mercurial.HgMaterial in project gocd by gocd.

the class MaterialUpdateStatusNotifierTest method shouldNotNotifyListenerWhenUnknownMaterialIsUpdated.

@Test
public void shouldNotNotifyListenerWhenUnknownMaterialIsUpdated() throws Exception {
    PipelineConfig pipelineConfig = new PipelineConfig(new CaseInsensitiveString("config"), new MaterialConfigs());
    MaterialUpdateStatusListener mockStatusListener = Mockito.mock(MaterialUpdateStatusListener.class);
    materialUpdateStatusNotifier.registerListenerFor(pipelineConfig, mockStatusListener);
    HgMaterial material = new HgMaterial("url", null);
    materialUpdateStatusNotifier.onMessage(new MaterialUpdateSuccessfulMessage(material, 1234));
    Mockito.verify(mockStatusListener, Mockito.never()).onMaterialUpdate(new MaterialUpdateSuccessfulMessage(material, 1234));
}
Also used : MaterialConfigs(com.thoughtworks.go.config.materials.MaterialConfigs) PipelineConfig(com.thoughtworks.go.config.PipelineConfig) HgMaterial(com.thoughtworks.go.config.materials.mercurial.HgMaterial) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) 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