Search in sources :

Example 6 with ProcessOutputStreamConsumer

use of com.thoughtworks.go.util.command.ProcessOutputStreamConsumer in project gocd by gocd.

the class P4CommandTestBase method shouldBombForNonZeroReturnCode.

@Test
public void shouldBombForNonZeroReturnCode() throws Exception {
    ProcessOutputStreamConsumer outputStreamConsumer = Mockito.mock(ProcessOutputStreamConsumer.class);
    CommandLine line = Mockito.mock(CommandLine.class);
    when(line.run(outputStreamConsumer, null, "foo")).thenReturn(1);
    try {
        p4.execute(line, "foo", outputStreamConsumer, true);
        fail("did't bomb for non zero return code");
    } catch (Exception ignored) {
    }
    verify(line).run(outputStreamConsumer, null, "foo");
}
Also used : CommandLine(com.thoughtworks.go.util.command.CommandLine) ProcessOutputStreamConsumer(com.thoughtworks.go.util.command.ProcessOutputStreamConsumer) Test(org.junit.Test)

Example 7 with ProcessOutputStreamConsumer

use of com.thoughtworks.go.util.command.ProcessOutputStreamConsumer in project gocd by gocd.

the class SvnMultipleMaterialsTest method updateMaterials.

private void updateMaterials(Materials materials, Revision revision) {
    ProcessOutputStreamConsumer outputStreamConsumer = inMemoryConsumer();
    TestSubprocessExecutionContext execCtx = new TestSubprocessExecutionContext();
    materials.cleanUp(pipelineDir, outputStreamConsumer);
    for (Material material : materials) {
        material.updateTo(outputStreamConsumer, pipelineDir, new RevisionContext(revision), execCtx);
    }
}
Also used : ProcessOutputStreamConsumer(com.thoughtworks.go.util.command.ProcessOutputStreamConsumer)

Aggregations

ProcessOutputStreamConsumer (com.thoughtworks.go.util.command.ProcessOutputStreamConsumer)7 Test (org.junit.Test)3 AgentIdentifier (com.thoughtworks.go.remote.AgentIdentifier)2 CommandLine (com.thoughtworks.go.util.command.CommandLine)2 File (java.io.File)2 SubprocessExecutionContext (com.thoughtworks.go.config.materials.SubprocessExecutionContext)1 GitMaterial (com.thoughtworks.go.config.materials.git.GitMaterial)1 MaterialRevision (com.thoughtworks.go.domain.MaterialRevision)1 PackageMaterialAgent (com.thoughtworks.go.domain.materials.packagematerial.PackageMaterialAgent)1 PluggableSCMMaterialAgent (com.thoughtworks.go.domain.materials.scm.PluggableSCMMaterialAgent)1 CommandLineException (com.thoughtworks.go.util.command.CommandLineException)1 DevNull (com.thoughtworks.go.util.command.DevNull)1 EnvironmentVariableContext (com.thoughtworks.go.util.command.EnvironmentVariableContext)1 SafeOutputStreamConsumer (com.thoughtworks.go.util.command.SafeOutputStreamConsumer)1