Search in sources :

Example 51 with StringRevision

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

the class P4MaterialTestBase method shouldMapDirectoryInRepoToClientRoot.

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

Example 52 with StringRevision

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

the class P4MaterialTestBase method shouldSupportPercetage.

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

Example 53 with StringRevision

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

the class P4MaterialTestBase method shouldUpdateToSpecificRevision.

@Test
public void shouldUpdateToSpecificRevision() throws Exception {
    P4Material p4Material = p4Fixture.material(VIEW);
    updateMaterial(p4Material, new StringRevision("2"));
    assertThat(clientFolder.listFiles().length, is(8));
    updateMaterial(p4Material, new StringRevision("3"));
    assertThat(clientFolder.listFiles().length, is(7));
}
Also used : StringRevision(com.thoughtworks.go.domain.materials.mercurial.StringRevision) Test(org.junit.Test)

Example 54 with StringRevision

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

the class P4MaterialTestBase method shouldCleanOutRepoWhenMaterialChanges.

@Test
public void shouldCleanOutRepoWhenMaterialChanges() throws Exception {
    P4TestRepo secondTestRepo = P4TestRepo.createP4TestRepo(temporaryFolder, clientFolder);
    try {
        secondTestRepo.onSetup();
        P4Material p4Material = p4Fixture.material(VIEW);
        updateMaterial(p4Material, new StringRevision("2"));
        File.createTempFile("temp", "txt", clientFolder);
        assertThat(clientFolder.listFiles().length, is(9));
        P4Material otherMaterial = secondTestRepo.material("//depot/lib/... //something/...");
        otherMaterial.setUsername("cceuser1");
        updateMaterial(otherMaterial, new StringRevision("2"));
        File.createTempFile("temp", "txt", clientFolder);
        assertThat("Should clean and re-checkout after p4repo changed", clientFolder.listFiles().length, is(3));
        otherMaterial.setUsername("cceuser");
        otherMaterial.setPassword("password");
        updateMaterial(otherMaterial, new StringRevision("2"));
        assertThat("Should clean and re-checkout after user changed", clientFolder.listFiles().length, is(2));
        assertThat(outputconsumer.getStdOut(), containsString("Working directory has changed. Deleting and re-creating it."));
    } finally {
        secondTestRepo.stop();
        secondTestRepo.onTearDown();
    }
}
Also used : P4TestRepo(com.thoughtworks.go.helper.P4TestRepo) StringRevision(com.thoughtworks.go.domain.materials.mercurial.StringRevision) Test(org.junit.Test)

Example 55 with StringRevision

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

the class P4MaterialTestBase method laterDefinitionShouldMergeWithPreviousOneWhenPlusPresent.

@Test
public void laterDefinitionShouldMergeWithPreviousOneWhenPlusPresent() throws Exception {
    P4Material p4Material = p4Fixture.material("//depot/src/... //cws/build/... \n +//depot/lib/... //cws/build/...");
    File file = new File(clientFolder, "build/junit.jar");
    File folderNet = new File(clientFolder, "build/net");
    updateMaterial(p4Material, new StringRevision("2"));
    assertThat(folderNet.exists(), is(true));
    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