use of alluxio.hub.proto.PrestoCatalogListing in project alluxio by Alluxio.
the class ManagerProcessContextTest method testListCatalogs.
@Test
public void testListCatalogs() throws IOException {
Set<String> nodes = Collections.singleton(UUID.randomUUID().toString());
doReturn(nodes).when(mMockHub).nodesFromAlluxio(mMockAlluxio, AlluxioNodeType.MASTER);
Path prestoCatalogDir = Paths.get(mTemp.getRoot().getAbsolutePath(), "etc/presto/conf/catalog");
Files.createDirectories(prestoCatalogDir);
PrestoCatalogListing r = PrestoCatalogListing.newBuilder().setCatalogName("hive-test").setHiveMetastoreUri("thrift://blahblahblah:9083").build();
Map<HubNodeAddress, AgentListCatalogResponse> map = new HashMap<>();
map.put(HubNodeAddress.newBuilder().build(), AgentListCatalogResponse.newBuilder().addCatalog(r).build());
doReturn(map).when(mMockHub).exec(any(), any(), any(), any());
assertEquals(PrestoCatalogListingResult.newBuilder().addCatalog(r).build(), mContext.listCatalogs(prestoCatalogDir.toString()));
}
use of alluxio.hub.proto.PrestoCatalogListing in project alluxio by Alluxio.
the class AgentManagerServiceTest method testListCatalogs.
@Test
public void testListCatalogs() throws Exception {
String confDir = mTemp.getRoot().getAbsolutePath();
AgentListCatalogRequest r = AgentListCatalogRequest.newBuilder().setConfDir(confDir).build();
Files.createDirectory(Paths.get(confDir, "catalog"));
Path testCatalog = Paths.get(confDir, "catalog", "test-hive.properties");
Path badCatalog = Paths.get(confDir, "catalog", "bad.poperties");
Files.createFile(testCatalog);
Files.write(testCatalog, "hive.metastore.uri=thrift://aaabbbccc::9083/\nconnector.name=hive-hadoop2\n".getBytes());
Files.write(badCatalog, "hive.metastore.uri=thrift://aaabbbccc::9083/\nconnector.name=hive-hadoop2\n".getBytes());
AgentListCatalogResponse resp = mClient.listCatalogs(r);
assertEquals(1, resp.getCatalogCount());
PrestoCatalogListing l = resp.getCatalog(0);
assertEquals("test-hive", l.getCatalogName());
assertEquals("thrift://aaabbbccc::9083/", l.getHiveMetastoreUri());
}
Aggregations