use of com.facebook.eden.thrift.MountInfo in project buck by facebook.
the class EdenMountTest method getSha1DelegatesToThriftClient.
@Test
public void getSha1DelegatesToThriftClient() throws EdenError, TException {
List<MountInfo> mountInfos = ImmutableList.of(new MountInfo("/home/mbolin/src/buck", /* edenClientPath */
""));
EdenService.Client thriftClient = createMock(EdenService.Client.class);
expect(thriftClient.listMounts()).andReturn(mountInfos);
FileSystem fs = Jimfs.newFileSystem(Configuration.unix());
Path entry = fs.getPath("LICENSE");
HashCode hash = HashCode.fromString("2b8b815229aa8a61e483fb4ba0588b8b6c491890");
SHA1Result sha1Result = new SHA1Result();
sha1Result.setSha1(hash.asBytes());
expect(thriftClient.getSHA1("/home/mbolin/src/buck", ImmutableList.of("LICENSE"))).andReturn(ImmutableList.of(sha1Result));
replay(thriftClient);
EdenClient client = new EdenClient(thriftClient);
Path pathToBuck = fs.getPath("/home/mbolin/src/buck");
EdenMount mount = client.getMountFor(pathToBuck);
assertNotNull("Should find mount for path.", mount);
assertEquals(Sha1HashCode.fromHashCode(hash), mount.getSha1(entry));
verify(thriftClient);
}
use of com.facebook.eden.thrift.MountInfo in project buck by facebook.
the class MountsCommand method run.
@Override
public int run() throws EdenError, IOException, TException {
Optional<EdenClient> clientOptional = EdenClient.newInstance();
if (!clientOptional.isPresent()) {
System.err.println("Could not connect to Eden");
return 1;
}
EdenClient client = clientOptional.get();
List<MountInfo> mountInfos = client.getMountInfos();
System.out.printf("Number of mounts: %d\n", mountInfos.size());
for (MountInfo info : mountInfos) {
System.out.println(info.mountPoint);
EdenMount mount = client.getMountFor(Paths.get(info.mountPoint));
List<Path> bindMounts = mount.getBindMounts();
System.out.printf(" Number of bind mounts: %d\n", bindMounts.size());
for (Path bindMount : bindMounts) {
System.out.printf(" %s\n", bindMount);
}
}
return 0;
}
Aggregations