Search in sources :

Example 46 with StringRevision

use of com.thoughtworks.go.domain.materials.mercurial.StringRevision in project gocd by gocd.

the class HgMaterialTest method shouldUpdateToSpecificRevision.

@Test
public void shouldUpdateToSpecificRevision() throws Exception {
    updateMaterial(hgMaterial, new StringRevision("0"));
    File end2endFolder = new File(workingFolder, "end2end");
    assertThat(end2endFolder.listFiles().length, is(3));
    assertThat(outputStreamConsumer.getStdOut(), is(not("")));
    updateMaterial(hgMaterial, new StringRevision("1"));
    assertThat(end2endFolder.listFiles().length, is(4));
}
Also used : StringRevision(com.thoughtworks.go.domain.materials.mercurial.StringRevision) File(java.io.File) Test(org.junit.Test)

Example 47 with StringRevision

use of com.thoughtworks.go.domain.materials.mercurial.StringRevision in project gocd by gocd.

the class HgMaterialUpdaterTest method shouldLogRepoInfoToConsoleOutWithoutFolder.

@Test
public void shouldLogRepoInfoToConsoleOutWithoutFolder() throws Exception {
    updateTo(hgMaterial, new RevisionContext(new StringRevision("0")), JobResult.Passed);
    assertThat(console.output(), containsString(format("Start updating %s at revision %s from %s", "files", "0", hgMaterial.getUrl())));
}
Also used : RevisionContext(com.thoughtworks.go.domain.materials.RevisionContext) StringRevision(com.thoughtworks.go.domain.materials.mercurial.StringRevision) Test(org.junit.Test)

Example 48 with StringRevision

use of com.thoughtworks.go.domain.materials.mercurial.StringRevision in project gocd by gocd.

the class HgMaterialUpdaterTest method shouldPullNewChangesFromRemoteBeforeUpdating.

@Test
public void shouldPullNewChangesFromRemoteBeforeUpdating() throws Exception {
    File newWorkingFolder = temporaryFolder.newFolder("newWorkingFolder");
    updateTo(hgMaterial, new RevisionContext(REVISION_0), JobResult.Passed);
    String repositoryUrl = hgTestRepo.projectRepositoryUrl();
    HgMaterial material = MaterialsMother.hgMaterial(repositoryUrl);
    assertThat(material.getUrl(), is(hgMaterial.getUrl()));
    updateTo(material, new RevisionContext(REVISION_0), JobResult.Passed, newWorkingFolder);
    hgTestRepo.commitAndPushFile("SomeDocumentation.txt", "whatever");
    List<Modification> modification = hgMaterial.latestModification(workingFolder, new TestSubprocessExecutionContext());
    StringRevision revision = new StringRevision(modification.get(0).getRevision());
    updateTo(material, new RevisionContext(revision), JobResult.Passed, newWorkingFolder);
    assertThat(console.output(), containsString("Start updating files at revision " + revision.getRevision()));
}
Also used : Modification(com.thoughtworks.go.domain.materials.Modification) TestSubprocessExecutionContext(com.thoughtworks.go.domain.materials.TestSubprocessExecutionContext) RevisionContext(com.thoughtworks.go.domain.materials.RevisionContext) StringRevision(com.thoughtworks.go.domain.materials.mercurial.StringRevision) StringContains.containsString(org.hamcrest.core.StringContains.containsString) File(java.io.File) Test(org.junit.Test)

Example 49 with StringRevision

use of com.thoughtworks.go.domain.materials.mercurial.StringRevision in project gocd by gocd.

the class P4MaterialTestBase method shouldMapDirectoryInRepoToDirectoryUnderClientRoot.

@Test
public void shouldMapDirectoryInRepoToDirectoryUnderClientRoot() throws Exception {
    P4Material p4Material = p4Fixture.material("//depot/lib/... //cws/release1/...");
    updateMaterial(p4Material, new StringRevision("2"));
    assertThat(getContainedFileNames(new File(clientFolder, "release1")), hasItem("junit.jar"));
}
Also used : StringRevision(com.thoughtworks.go.domain.materials.mercurial.StringRevision) File(java.io.File) Test(org.junit.Test)

Example 50 with StringRevision

use of com.thoughtworks.go.domain.materials.mercurial.StringRevision in project gocd by gocd.

the class P4MaterialTestBase method shouldSupportAsterisk.

@Test
public void shouldSupportAsterisk() throws Exception {
    P4Material p4Material = p4Fixture.material("//depot/lib/*.jar //cws/*.war");
    updateMaterial(p4Material, new StringRevision("2"));
    File file = new File(clientFolder, "junit.war");
    assertThat(file.exists(), is(true));
}
Also used : StringRevision(com.thoughtworks.go.domain.materials.mercurial.StringRevision) File(java.io.File) Test(org.junit.Test)

Aggregations

StringRevision (com.thoughtworks.go.domain.materials.mercurial.StringRevision)61 Test (org.junit.Test)57 File (java.io.File)30 Modification (com.thoughtworks.go.domain.materials.Modification)16 RevisionContext (com.thoughtworks.go.domain.materials.RevisionContext)16 GitSubmoduleRepos (com.thoughtworks.go.helper.GitSubmoduleRepos)11 StringContains.containsString (org.hamcrest.core.StringContains.containsString)8 GitTestRepo (com.thoughtworks.go.domain.materials.git.GitTestRepo)7 TestSubprocessExecutionContext (com.thoughtworks.go.domain.materials.TestSubprocessExecutionContext)5 InMemoryStreamConsumer (com.thoughtworks.go.util.command.InMemoryStreamConsumer)5 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)5 RegexMatcher (com.thoughtworks.go.matchers.RegexMatcher)4 ModifiedFile (com.thoughtworks.go.domain.materials.ModifiedFile)3 JsonValue (com.thoughtworks.go.util.JsonValue)3 ArrayList (java.util.ArrayList)3 Changeset (com.microsoft.tfs.core.clients.versioncontrol.soapextensions.Changeset)2 ChangesetVersionSpec (com.microsoft.tfs.core.clients.versioncontrol.specs.version.ChangesetVersionSpec)2 DependencyMaterialRevision (com.thoughtworks.go.domain.materials.dependency.DependencyMaterialRevision)2 SysOutStreamConsumer (com.thoughtworks.go.mail.SysOutStreamConsumer)2 CommandLineException (com.thoughtworks.go.util.command.CommandLineException)2