Search in sources :

Example 31 with RevisionContext

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

the class HgMaterialUpdaterTest method failureCommandShouldNotLeakPasswordOnUrl.

@Test
public void failureCommandShouldNotLeakPasswordOnUrl() throws Exception {
    HgMaterial material = MaterialsMother.hgMaterial("https://foo:foopassword@this.is.absolute.not.exists");
    updateTo(material, new RevisionContext(REVISION_1), JobResult.Failed);
    assertThat(console.output(), containsString("https://foo:******@this.is.absolute.not.exists"));
    assertThat(console.output(), not(containsString("foopassword")));
}
Also used : RevisionContext(com.thoughtworks.go.domain.materials.RevisionContext) Test(org.junit.Test)

Example 32 with RevisionContext

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

the class HgMaterialUpdaterTest method shouldCreateBuildCommandUpdateToSpecificRevision.

@Test
public void shouldCreateBuildCommandUpdateToSpecificRevision() throws Exception {
    File newFile = new File(workingFolder, "end2end/revision2.txt");
    updateTo(hgMaterial, new RevisionContext(REVISION_0), JobResult.Passed);
    assertThat(console.output(), containsString("Start updating files at revision " + REVISION_0.getRevision()));
    assertThat(newFile.exists(), is(false));
    console.clear();
    updateTo(hgMaterial, new RevisionContext(REVISION_2, REVISION_1, 2), JobResult.Passed);
    assertThat(console.output(), containsString("Start updating files at revision " + REVISION_2.getRevision()));
    assertThat(newFile.exists(), is(true));
}
Also used : RevisionContext(com.thoughtworks.go.domain.materials.RevisionContext) File(java.io.File) Test(org.junit.Test)

Example 33 with RevisionContext

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

the class P4MaterialUpdaterTest 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.Passed);
    assertThat(console.output(), not(containsString("wubba lubba dub dub")));
}
Also used : RevisionContext(com.thoughtworks.go.domain.materials.RevisionContext) Test(org.junit.Test)

Example 34 with RevisionContext

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

the class P4MaterialUpdaterTestBase method shouldSyncToSpecifiedRevision.

@Test
public void shouldSyncToSpecifiedRevision() throws Exception {
    P4Material material = p4Fixture.material(VIEW);
    updateTo(material, new RevisionContext(REVISION_2), JobResult.Passed);
    assertThat(workingDir.listFiles().length, is(7));
    updateTo(material, new RevisionContext(REVISION_3), JobResult.Passed);
    assertThat(workingDir.listFiles().length, is(6));
}
Also used : RevisionContext(com.thoughtworks.go.domain.materials.RevisionContext) Test(org.junit.Test)

Example 35 with RevisionContext

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

the class P4MaterialUpdaterTestBase method shouldNotFailIfDestDoesNotExist.

@Test
public void shouldNotFailIfDestDoesNotExist() throws Exception {
    FileUtils.deleteDirectory(workingDir);
    assert (!workingDir.exists());
    P4Material material = p4Fixture.material(VIEW);
    updateTo(material, new RevisionContext(REVISION_2), JobResult.Passed);
    assert (workingDir.exists());
}
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