Search in sources :

Example 46 with FakeProcessExecutor

use of com.facebook.buck.util.FakeProcessExecutor in project buck by facebook.

the class WorkerProcessProtocolZeroTest method setUp.

@Before
public void setUp() throws IOException {
    ProcessExecutorParams fakeParams = ProcessExecutorParams.ofCommand("");
    fakeProcess = new FakeProcess(0);
    fakeProcessExecutor = new FakeProcessExecutor(ImmutableMap.of(fakeParams, fakeProcess));
    fakeLaunchedProcess = fakeProcessExecutor.launchProcess(fakeParams);
    dummyJsonWriter = new JsonWriter(new StringWriter());
    dummyJsonReader = new JsonReader(new StringReader(""));
}
Also used : ProcessExecutorParams(com.facebook.buck.util.ProcessExecutorParams) StringWriter(java.io.StringWriter) FakeProcessExecutor(com.facebook.buck.util.FakeProcessExecutor) StringReader(java.io.StringReader) FakeProcess(com.facebook.buck.util.FakeProcess) JsonReader(com.google.gson.stream.JsonReader) JsonWriter(com.google.gson.stream.JsonWriter) Before(org.junit.Before)

Example 47 with FakeProcessExecutor

use of com.facebook.buck.util.FakeProcessExecutor in project buck by facebook.

the class WorkerProcessTest method testClose.

@Test
public void testClose() throws IOException {
    FakeWorkerProcessProtocol protocol = new FakeWorkerProcessProtocol();
    WorkerProcess process = new WorkerProcess(new FakeProcessExecutor(), createDummyParams(), new FakeProjectFilesystem(), Paths.get("tmp").toAbsolutePath().normalize());
    process.setProtocol(protocol);
    assertFalse(protocol.isClosed());
    process.close();
    assertTrue(protocol.isClosed());
}
Also used : FakeProcessExecutor(com.facebook.buck.util.FakeProcessExecutor) FakeProjectFilesystem(com.facebook.buck.testutil.FakeProjectFilesystem) Test(org.junit.Test)

Aggregations

FakeProcessExecutor (com.facebook.buck.util.FakeProcessExecutor)47 Test (org.junit.Test)42 FakeProcess (com.facebook.buck.util.FakeProcess)35 ProcessExecutorParams (com.facebook.buck.util.ProcessExecutorParams)21 ExecutionContext (com.facebook.buck.step.ExecutionContext)19 TestExecutionContext (com.facebook.buck.step.TestExecutionContext)19 FakeProjectFilesystem (com.facebook.buck.testutil.FakeProjectFilesystem)17 ImmutableList (com.google.common.collect.ImmutableList)9 SimpleImmutableEntry (java.util.AbstractMap.SimpleImmutableEntry)9 TestConsole (com.facebook.buck.testutil.TestConsole)8 Path (java.nio.file.Path)6 BuckConfig (com.facebook.buck.cli.BuckConfig)5 FakeBuckConfig (com.facebook.buck.cli.FakeBuckConfig)5 ProjectFilesystem (com.facebook.buck.io.ProjectFilesystem)5 BuckEventBusFactory (com.facebook.buck.event.BuckEventBusFactory)4 BuildRuleResolver (com.facebook.buck.rules.BuildRuleResolver)4 DefaultTargetNodeToBuildRuleTransformer (com.facebook.buck.rules.DefaultTargetNodeToBuildRuleTransformer)4 SourcePathResolver (com.facebook.buck.rules.SourcePathResolver)4 SourcePathRuleFinder (com.facebook.buck.rules.SourcePathRuleFinder)4 StepExecutionResult (com.facebook.buck.step.StepExecutionResult)4