Search in sources :

Example 36 with RevisionContext

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

the class P4MaterialUpdaterTestBase method shouldSupportCustomDestinations.

@Test
public void shouldSupportCustomDestinations() throws Exception {
    P4Material material = p4Fixture.material(VIEW);
    material.setFolder("dest");
    updateTo(material, new RevisionContext(REVISION_2), JobResult.Passed);
    assertThat(workingDir.listFiles().length, is(1));
    assertThat(new File(workingDir, "dest").listFiles().length, is(7));
}
Also used : RevisionContext(com.thoughtworks.go.domain.materials.RevisionContext) File(java.io.File) Test(org.junit.Test)

Example 37 with RevisionContext

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

the class P4MaterialUpdaterTicketTest method shouldNotDisplayPassword.

@Test
public void shouldNotDisplayPassword() throws Exception {
    P4Material material = p4Fixture.material(VIEW);
    material.setPassword("wubba lubba dub dub");
    updateTo(material, new RevisionContext(REVISION_2), JobResult.Failed);
    assertThat(console.output(), not(containsString("wubba lubba dub dub")));
}
Also used : RevisionContext(com.thoughtworks.go.domain.materials.RevisionContext) Test(org.junit.Test)

Example 38 with RevisionContext

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

the class SvnMaterialUpdaterTest method shouldDoAFreshCheckoutIfDestIsNotARepo.

@Test
public void shouldDoAFreshCheckoutIfDestIsNotARepo() throws Exception {
    updateTo(svnMaterial, new RevisionContext(revision), JobResult.Passed);
    console.clear();
    FileUtils.deleteQuietly(new File(workingDir, "svnDir/.svn"));
    updateTo(svnMaterial, new RevisionContext(revision), JobResult.Passed);
    assertThat(console.output(), containsString("Checked out revision"));
    assertThat(console.output(), not(containsString("Updating")));
}
Also used : RevisionContext(com.thoughtworks.go.domain.materials.RevisionContext) File(java.io.File) Test(org.junit.Test)

Example 39 with RevisionContext

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

the class SvnMaterialUpdaterTest method shouldUpdateToDestinationFolder.

@Test
public void shouldUpdateToDestinationFolder() throws Exception {
    svnMaterial.setFolder("dest");
    updateTo(svnMaterial, new RevisionContext(revision), JobResult.Passed);
    assertThat(new File(workingDir, "dest").exists(), is(true));
    assertThat(new File(workingDir, "dest/.svn").exists(), is(true));
}
Also used : RevisionContext(com.thoughtworks.go.domain.materials.RevisionContext) File(java.io.File) Test(org.junit.Test)

Example 40 with RevisionContext

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

the class SvnMaterialUpdaterTest method shouldNotLeakPasswordInUrlIfCheckoutFails.

@Test
public void shouldNotLeakPasswordInUrlIfCheckoutFails() throws Exception {
    SvnMaterial material = MaterialsMother.svnMaterial("https://foo:foopassword@thisdoesnotexist.io/repo");
    updateTo(material, new RevisionContext(revision), JobResult.Failed);
    assertThat(console.output(), containsString("https://foo:******@thisdoesnotexist.io/repo"));
    assertThat(console.output(), not(containsString("foopassword")));
}
Also used : RevisionContext(com.thoughtworks.go.domain.materials.RevisionContext) Test(org.junit.Test)

Aggregations

RevisionContext (com.thoughtworks.go.domain.materials.RevisionContext)43 Test (org.junit.Test)37 File (java.io.File)23 StringRevision (com.thoughtworks.go.domain.materials.mercurial.StringRevision)17 GitTestRepo (com.thoughtworks.go.domain.materials.git.GitTestRepo)9 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)9 GitSubmoduleRepos (com.thoughtworks.go.helper.GitSubmoduleRepos)6 Modification (com.thoughtworks.go.domain.materials.Modification)5 Test (org.junit.jupiter.api.Test)4 InMemoryStreamConsumer (com.thoughtworks.go.util.command.InMemoryStreamConsumer)3 StringContains.containsString (org.hamcrest.core.StringContains.containsString)3 GitMaterial (com.thoughtworks.go.config.materials.git.GitMaterial)2 TestSubprocessExecutionContext (com.thoughtworks.go.domain.materials.TestSubprocessExecutionContext)2 HgTestRepo (com.thoughtworks.go.helper.HgTestRepo)2 RegexMatcher (com.thoughtworks.go.matchers.RegexMatcher)2 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)1 SvnMaterial (com.thoughtworks.go.config.materials.svn.SvnMaterial)1 AgentSubprocessExecutionContext (com.thoughtworks.go.domain.materials.AgentSubprocessExecutionContext)1 Revision (com.thoughtworks.go.domain.materials.Revision)1 SvnTestRepo (com.thoughtworks.go.helper.SvnTestRepo)1