Search in sources :

Example 11 with TestSubprocessExecutionContext

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

the class P4MultipleMaterialsTest method shouldUpdateToItsDestFolder.

@Test
public void shouldUpdateToItsDestFolder() {
    P4Material p4Material = p4Fixture.material(VIEW_SRC, "dest1");
    MaterialRevision revision = new MaterialRevision(p4Material, p4Material.latestModification(clientFolder, new TestSubprocessExecutionContext()));
    revision.updateTo(clientFolder, inMemoryConsumer(), new TestSubprocessExecutionContext());
    assertThat(new File(clientFolder, "dest1/net").exists(), is(true));
}
Also used : TestSubprocessExecutionContext(com.thoughtworks.go.domain.materials.TestSubprocessExecutionContext) MaterialRevision(com.thoughtworks.go.domain.MaterialRevision) MaterialRevisionsMatchers.containsModifiedFile(com.thoughtworks.go.config.MaterialRevisionsMatchers.containsModifiedFile) File(java.io.File) Test(org.junit.Test)

Example 12 with TestSubprocessExecutionContext

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

the class P4MultipleMaterialsTest method shouldFoundModificationsForEachMaterial.

@Test
public void shouldFoundModificationsForEachMaterial() throws Exception {
    P4Material p4Material1 = p4Fixture.material(VIEW_SRC, "src");
    P4Material p4Material2 = p4Fixture.material(VIEW_LIB, "lib");
    Materials materials = new Materials(p4Material1, p4Material2);
    p4TestRepo.checkInOneFile(p4Material1, "filename.txt");
    p4TestRepo.checkInOneFile(p4Material2, "filename2.txt");
    MaterialRevisions materialRevisions = materials.latestModification(clientFolder, new TestSubprocessExecutionContext());
    assertThat(materialRevisions.getRevisions().size(), is(2));
    assertThat(materialRevisions, containsModifiedFile("src/filename.txt"));
    assertThat(materialRevisions, containsModifiedFile("lib/filename2.txt"));
}
Also used : MaterialRevisions(com.thoughtworks.go.domain.MaterialRevisions) TestSubprocessExecutionContext(com.thoughtworks.go.domain.materials.TestSubprocessExecutionContext) Materials(com.thoughtworks.go.config.materials.Materials) Test(org.junit.Test)

Example 13 with TestSubprocessExecutionContext

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

the class GitCommandTest method shouldCheckIfRemoteRepoExists.

@Test
public void shouldCheckIfRemoteRepoExists() throws Exception {
    GitCommand gitCommand = new GitCommand(null, null, null, false, null, null);
    final TestSubprocessExecutionContext executionContext = new TestSubprocessExecutionContext();
    gitCommand.checkConnection(git.workingRepositoryUrl(), "master", executionContext.getDefaultEnvironmentVariables());
}
Also used : TestSubprocessExecutionContext(com.thoughtworks.go.domain.materials.TestSubprocessExecutionContext) Test(org.junit.Test)

Example 14 with TestSubprocessExecutionContext

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

the class GitCommandTest method shouldThrowExceptionWhenRepoNotExist.

@Test(expected = Exception.class)
public void shouldThrowExceptionWhenRepoNotExist() throws Exception {
    GitCommand gitCommand = new GitCommand(null, null, null, false, null, null);
    final TestSubprocessExecutionContext executionContext = new TestSubprocessExecutionContext();
    gitCommand.checkConnection(new UrlArgument("git://somewhere.is.not.exist"), "master", executionContext.getDefaultEnvironmentVariables());
}
Also used : UrlArgument(com.thoughtworks.go.util.command.UrlArgument) TestSubprocessExecutionContext(com.thoughtworks.go.domain.materials.TestSubprocessExecutionContext) Test(org.junit.Test)

Example 15 with TestSubprocessExecutionContext

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

the class GitMultipleMaterialsTest method shouldCloneMaterialToItsDestFolder.

@Test
public void shouldCloneMaterialToItsDestFolder() throws Exception {
    GitMaterial 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/.git").exists(), is(true));
}
Also used : GitMaterial(com.thoughtworks.go.config.materials.git.GitMaterial) TestSubprocessExecutionContext(com.thoughtworks.go.domain.materials.TestSubprocessExecutionContext) MaterialRevision(com.thoughtworks.go.domain.MaterialRevision) MaterialRevisionsMatchers.containsModifiedFile(com.thoughtworks.go.config.MaterialRevisionsMatchers.containsModifiedFile) File(java.io.File) Test(org.junit.Test)

Aggregations

TestSubprocessExecutionContext (com.thoughtworks.go.domain.materials.TestSubprocessExecutionContext)30 Test (org.junit.Test)24 File (java.io.File)15 Modification (com.thoughtworks.go.domain.materials.Modification)9 MaterialRevision (com.thoughtworks.go.domain.MaterialRevision)8 MaterialRevisions (com.thoughtworks.go.domain.MaterialRevisions)5 StringRevision (com.thoughtworks.go.domain.materials.mercurial.StringRevision)5 MaterialRevisionsMatchers.containsModifiedFile (com.thoughtworks.go.config.MaterialRevisionsMatchers.containsModifiedFile)4 Materials (com.thoughtworks.go.config.materials.Materials)4 SvnMaterial (com.thoughtworks.go.config.materials.svn.SvnMaterial)4 TfsCommand (com.thoughtworks.go.domain.materials.tfs.TfsCommand)3 GitMaterial (com.thoughtworks.go.config.materials.git.GitMaterial)2 HgMaterial (com.thoughtworks.go.config.materials.mercurial.HgMaterial)2 Material (com.thoughtworks.go.domain.materials.Material)2 RevisionContext (com.thoughtworks.go.domain.materials.RevisionContext)2 ValidationBean (com.thoughtworks.go.domain.materials.ValidationBean)2 SystemEnvironment (com.thoughtworks.go.util.SystemEnvironment)2 UrlArgument (com.thoughtworks.go.util.command.UrlArgument)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2