Search in sources :

Example 1 with FakeUserIdFetcher

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

the class AppleCoreSimulatorServiceControllerTest method coreSimulatorServicePathFetchedFromLaunchctlPrint.

@Test
public void coreSimulatorServicePathFetchedFromLaunchctlPrint() throws IOException, InterruptedException {
    ImmutableList.Builder<Map.Entry<ProcessExecutorParams, FakeProcess>> fakeProcessesBuilder = ImmutableList.builder();
    fakeProcessesBuilder.add(new SimpleImmutableEntry<>(LAUNCHCTL_LIST_PARAMS, new FakeProcess(0, "87823\t0\tcom.apple.CoreSimulator.CoreSimulatorService.117.15.1.lkhDXxRPp5yy\n", "")));
    fakeProcessesBuilder.add(new SimpleImmutableEntry<>(ProcessExecutorParams.builder().setCommand(ImmutableList.of("launchctl", "print", "user/42/com.apple.CoreSimulator.CoreSimulatorService.117.15.1.lkhDXxRPp5yy")).build(), new FakeProcess(0, "com.apple.CoreSimulator.CoreSimulatorService.117.15.1.lkhDXxRPp5yy = {\n" + "    path = xcode-dir/Developer/Library/PrivateFrameworks/CoreSimulator.framework" + "/Versions/A/XPCServices/com.apple.CoreSimulator.CoreSimulatorService.xpc\n" + "}\n", "")));
    FakeProcessExecutor fakeProcessExecutor = new FakeProcessExecutor(fakeProcessesBuilder.build());
    AppleCoreSimulatorServiceController appleCoreSimulatorServiceController = new AppleCoreSimulatorServiceController(fakeProcessExecutor);
    Optional<Path> coreSimulatorServicePath = appleCoreSimulatorServiceController.getCoreSimulatorServicePath(new FakeUserIdFetcher(42));
    Optional<Path> expected = Optional.of(Paths.get("xcode-dir/Developer/Library/PrivateFrameworks/CoreSimulator.framework/" + "Versions/A/XPCServices/com.apple.CoreSimulator.CoreSimulatorService.xpc"));
    assertThat(coreSimulatorServicePath, is(equalTo(expected)));
}
Also used : Path(java.nio.file.Path) SimpleImmutableEntry(java.util.AbstractMap.SimpleImmutableEntry) FakeProcessExecutor(com.facebook.buck.util.FakeProcessExecutor) ImmutableList(com.google.common.collect.ImmutableList) FakeProcess(com.facebook.buck.util.FakeProcess) FakeUserIdFetcher(com.facebook.buck.util.FakeUserIdFetcher) Test(org.junit.Test)

Aggregations

FakeProcess (com.facebook.buck.util.FakeProcess)1 FakeProcessExecutor (com.facebook.buck.util.FakeProcessExecutor)1 FakeUserIdFetcher (com.facebook.buck.util.FakeUserIdFetcher)1 ImmutableList (com.google.common.collect.ImmutableList)1 Path (java.nio.file.Path)1 SimpleImmutableEntry (java.util.AbstractMap.SimpleImmutableEntry)1 Test (org.junit.Test)1