Search in sources :

Example 1 with SimpleImmutableEntry

use of java.util.AbstractMap.SimpleImmutableEntry in project buck by facebook.

the class AppleCoreSimulatorServiceControllerTest method coreSimulatorServicesKillSucceedsEvenIfNoSuchProcess.

@Test
public void coreSimulatorServicesKillSucceedsEvenIfNoSuchProcess() 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" + "74617\t0\tcom.apple.CoreSimulator.SimDevice.CC1B0BAD-BAE6-4A53-92CF-F79850654057" + ".launchd_sim\n" + "74614\t0\tcom.apple.iphonesimulator.6564\n", "")));
    fakeProcessesBuilder.add(new SimpleImmutableEntry<>(ProcessExecutorParams.builder().setCommand(ImmutableList.of("launchctl", "remove", "com.apple.CoreSimulator.CoreSimulatorService.117.15.1.lkhDXxRPp5yy")).build(), new FakeProcess(0)));
    fakeProcessesBuilder.add(new SimpleImmutableEntry<>(ProcessExecutorParams.builder().setCommand(ImmutableList.of("launchctl", "remove", "com.apple.CoreSimulator.SimDevice.CC1B0BAD-BAE6-4A53-92CF-F79850654057." + "launchd_sim")).build(), new FakeProcess(3)));
    fakeProcessesBuilder.add(new SimpleImmutableEntry<>(ProcessExecutorParams.builder().setCommand(ImmutableList.of("launchctl", "remove", "com.apple.iphonesimulator.6564")).build(), new FakeProcess(0)));
    FakeProcessExecutor fakeProcessExecutor = new FakeProcessExecutor(fakeProcessesBuilder.build());
    AppleCoreSimulatorServiceController appleCoreSimulatorServiceController = new AppleCoreSimulatorServiceController(fakeProcessExecutor);
    assertThat(appleCoreSimulatorServiceController.killSimulatorProcesses(), is(true));
}
Also used : SimpleImmutableEntry(java.util.AbstractMap.SimpleImmutableEntry) FakeProcessExecutor(com.facebook.buck.util.FakeProcessExecutor) ImmutableList(com.google.common.collect.ImmutableList) FakeProcess(com.facebook.buck.util.FakeProcess) Test(org.junit.Test)

Example 2 with SimpleImmutableEntry

use of java.util.AbstractMap.SimpleImmutableEntry 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)

Example 3 with SimpleImmutableEntry

use of java.util.AbstractMap.SimpleImmutableEntry in project buck by facebook.

the class AppleCoreSimulatorServiceControllerTest method coreSimulatorServicesKillFailsIfUnrecognizedError.

@Test
public void coreSimulatorServicesKillFailsIfUnrecognizedError() 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", "remove", "com.apple.CoreSimulator.CoreSimulatorService.117.15.1.lkhDXxRPp5yy")).build(), new FakeProcess(42)));
    FakeProcessExecutor fakeProcessExecutor = new FakeProcessExecutor(fakeProcessesBuilder.build());
    AppleCoreSimulatorServiceController appleCoreSimulatorServiceController = new AppleCoreSimulatorServiceController(fakeProcessExecutor);
    assertThat(appleCoreSimulatorServiceController.killSimulatorProcesses(), is(false));
}
Also used : SimpleImmutableEntry(java.util.AbstractMap.SimpleImmutableEntry) FakeProcessExecutor(com.facebook.buck.util.FakeProcessExecutor) ImmutableList(com.google.common.collect.ImmutableList) FakeProcess(com.facebook.buck.util.FakeProcess) Test(org.junit.Test)

Example 4 with SimpleImmutableEntry

use of java.util.AbstractMap.SimpleImmutableEntry in project buck by facebook.

the class AppleSimulatorControllerTest method canStartSimulatorWhenNoSimulatorBooted.

@Test
public void canStartSimulatorWhenNoSimulatorBooted() throws IOException, InterruptedException {
    ImmutableList.Builder<Map.Entry<ProcessExecutorParams, FakeProcess>> fakeProcessesBuilder = ImmutableList.builder();
    fakeProcessesBuilder.add(new SimpleImmutableEntry<>(SIMCTL_LIST_PARAMS, new FakeProcess(0, "    iPhone 5 (45BD7164-686C-474F-8C68-3730432BC5F2) (Shutdown)\n" + "    iPhone 5s (70200ED8-EEF1-4BDB-BCCF-3595B137D67D) (Shutdown)\n", "")));
    FakeProcessExecutor fakeProcessExecutor = new FakeProcessExecutor(fakeProcessesBuilder.build());
    AppleSimulatorController appleSimulatorController = new AppleSimulatorController(fakeProcessExecutor, SIMCTL_PATH, IOS_SIMULATOR_PATH);
    assertThat(appleSimulatorController.canStartSimulator("45BD7164-686C-474F-8C68-3730432BC5F2"), is(true));
}
Also used : SimpleImmutableEntry(java.util.AbstractMap.SimpleImmutableEntry) FakeProcessExecutor(com.facebook.buck.util.FakeProcessExecutor) ImmutableList(com.google.common.collect.ImmutableList) FakeProcess(com.facebook.buck.util.FakeProcess) Test(org.junit.Test)

Example 5 with SimpleImmutableEntry

use of java.util.AbstractMap.SimpleImmutableEntry in project buck by facebook.

the class AppleSimulatorControllerTest method canStartSimulatorWhenSimulatorAlreadyBooted.

@Test
public void canStartSimulatorWhenSimulatorAlreadyBooted() throws IOException, InterruptedException {
    ImmutableList.Builder<Map.Entry<ProcessExecutorParams, FakeProcess>> fakeProcessesBuilder = ImmutableList.builder();
    fakeProcessesBuilder.add(new SimpleImmutableEntry<>(SIMCTL_LIST_PARAMS, new FakeProcess(0, "    iPhone 5 (45BD7164-686C-474F-8C68-3730432BC5F2) (Booted)\n" + "    iPhone 5s (70200ED8-EEF1-4BDB-BCCF-3595B137D67D) (Shutdown)\n", "")));
    FakeProcessExecutor fakeProcessExecutor = new FakeProcessExecutor(fakeProcessesBuilder.build());
    AppleSimulatorController appleSimulatorController = new AppleSimulatorController(fakeProcessExecutor, SIMCTL_PATH, IOS_SIMULATOR_PATH);
    assertThat(appleSimulatorController.canStartSimulator("45BD7164-686C-474F-8C68-3730432BC5F2"), is(true));
}
Also used : SimpleImmutableEntry(java.util.AbstractMap.SimpleImmutableEntry) FakeProcessExecutor(com.facebook.buck.util.FakeProcessExecutor) ImmutableList(com.google.common.collect.ImmutableList) FakeProcess(com.facebook.buck.util.FakeProcess) Test(org.junit.Test)

Aggregations

SimpleImmutableEntry (java.util.AbstractMap.SimpleImmutableEntry)29 Test (org.junit.Test)19 FakeProcess (com.facebook.buck.util.FakeProcess)9 FakeProcessExecutor (com.facebook.buck.util.FakeProcessExecutor)9 ImmutableList (com.google.common.collect.ImmutableList)9 SortKey (javax.swing.RowSorter.SortKey)9 HashMap (java.util.HashMap)5 NonNull (android.support.annotation.NonNull)4 WorkerThread (android.support.annotation.WorkerThread)4 StorIOException (com.pushtorefresh.storio.StorIOException)4 Entry (java.util.Map.Entry)4 GeneratorState (com.github.anba.es6draft.compiler.CodeVisitor.GeneratorState)2 LabelState (com.github.anba.es6draft.compiler.CodeVisitor.LabelState)2 Completion (com.github.anba.es6draft.compiler.StatementGenerator.Completion)2 MethodCode (com.github.anba.es6draft.compiler.assembler.Code.MethodCode)2 ContentResolverTypeMapping (com.pushtorefresh.storio.contentresolver.ContentResolverTypeMapping)2 StorIOContentResolver (com.pushtorefresh.storio.contentresolver.StorIOContentResolver)2 SQLiteTypeMapping (com.pushtorefresh.storio.sqlite.SQLiteTypeMapping)2 StorIOSQLite (com.pushtorefresh.storio.sqlite.StorIOSQLite)2 ArrayList (java.util.ArrayList)2