use of com.facebook.buck.util.FakeListeningProcessExecutor in project buck by facebook.
the class WatchmanTest method shouldReturnEmptyWatchmanIfVersionCheckFails.
@Test
public void shouldReturnEmptyWatchmanIfVersionCheckFails() throws InterruptedException, IOException {
SettableFakeClock clock = new SettableFakeClock(0, 0);
FakeListeningProcessExecutor executor = new FakeListeningProcessExecutor(ImmutableMultimap.<ProcessExecutorParams, FakeListeningProcessState>builder().putAll(ProcessExecutorParams.ofCommand(exe, "--output-encoding=bser", "get-sockname"), FakeListeningProcessState.ofExit(1)).build(), clock);
Watchman watchman = Watchman.build(executor, NULL_WATCHMAN_CONNECTOR, rootPaths, env, finder, new TestConsole(), clock, Optional.empty());
assertEquals(Watchman.NULL_WATCHMAN, watchman);
}
use of com.facebook.buck.util.FakeListeningProcessExecutor in project buck by facebook.
the class WatchmanTest method shouldReturnNullWatchmanIfExtendedVersionCheckMissing.
@Test
public void shouldReturnNullWatchmanIfExtendedVersionCheckMissing() throws InterruptedException, IOException {
SettableFakeClock clock = new SettableFakeClock(0, 0);
FakeListeningProcessExecutor executor = new FakeListeningProcessExecutor(ImmutableMultimap.<ProcessExecutorParams, FakeListeningProcessState>builder().putAll(ProcessExecutorParams.ofCommand(exe, "--output-encoding=bser", "get-sockname"), FakeListeningProcessState.ofStdoutBytes(bserSerialized(ImmutableMap.of("version", "3.7.9", "sockname", "/path/to/sock"))), FakeListeningProcessState.ofExit(0)).build(), clock);
Watchman watchman = Watchman.build(executor, fakeWatchmanConnector(Paths.get("/path/to/sock"), 0, ImmutableMap.of(VERSION_QUERY, ImmutableMap.of("version", "3.7.9"), ImmutableList.of("watch", root), ImmutableMap.of("version", "3.7.9", "watch", root))), rootPaths, env, finder, new TestConsole(), clock, Optional.empty());
assertEquals(Watchman.NULL_WATCHMAN, watchman);
}
use of com.facebook.buck.util.FakeListeningProcessExecutor in project buck by facebook.
the class WatchmanTest method emptyClockQueryShouldReturnNullClock.
@Test
public void emptyClockQueryShouldReturnNullClock() throws InterruptedException, IOException {
SettableFakeClock clock = new SettableFakeClock(0, 0);
FakeListeningProcessExecutor executor = new FakeListeningProcessExecutor(ImmutableMultimap.<ProcessExecutorParams, FakeListeningProcessState>builder().putAll(ProcessExecutorParams.ofCommand(exe, "--output-encoding=bser", "get-sockname"), FakeListeningProcessState.ofStdoutBytes(bserSerialized(ImmutableMap.of("version", "4.7.0", "sockname", "/path/to/sock"))), FakeListeningProcessState.ofExit(0)).build(), clock);
Watchman watchman = Watchman.build(executor, fakeWatchmanConnector(Paths.get("/path/to/sock"), 0, ImmutableMap.of(VERSION_QUERY, ImmutableMap.of("version", "4.7.0", "capabilities", ImmutableMap.<String, Boolean>builder().put("term-dirname", true).put("cmd-watch-project", true).put("wildmatch", true).put("wildmatch_multislash", true).put("glob_generator", true).put("clock-sync-timeout", true).build()), ImmutableList.of("watch-project", root), ImmutableMap.of("version", "4.7.0", "watch", root), ImmutableList.of("clock", root, ImmutableMap.of("sync_timeout", 100)), ImmutableMap.<String, Object>of())), rootPaths, env, finder, new TestConsole(), clock, Optional.empty());
assertEquals(ImmutableMap.of(), watchman.getClockIds());
}
Aggregations