Search in sources :

Example 1 with AgentListCatalogResponse

use of alluxio.hub.proto.AgentListCatalogResponse 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()));
}
Also used : Path(java.nio.file.Path) HubNodeAddress(alluxio.hub.proto.HubNodeAddress) PrestoCatalogListing(alluxio.hub.proto.PrestoCatalogListing) HashMap(java.util.HashMap) AgentListCatalogResponse(alluxio.hub.proto.AgentListCatalogResponse) BaseHubTest(alluxio.hub.test.BaseHubTest) Test(org.junit.Test)

Example 2 with AgentListCatalogResponse

use of alluxio.hub.proto.AgentListCatalogResponse 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());
}
Also used : Path(java.nio.file.Path) AgentListCatalogRequest(alluxio.hub.proto.AgentListCatalogRequest) PrestoCatalogListing(alluxio.hub.proto.PrestoCatalogListing) AgentListCatalogResponse(alluxio.hub.proto.AgentListCatalogResponse) Test(org.junit.Test) BaseHubTest(alluxio.hub.test.BaseHubTest)

Aggregations

AgentListCatalogResponse (alluxio.hub.proto.AgentListCatalogResponse)2 PrestoCatalogListing (alluxio.hub.proto.PrestoCatalogListing)2 BaseHubTest (alluxio.hub.test.BaseHubTest)2 Path (java.nio.file.Path)2 Test (org.junit.Test)2 AgentListCatalogRequest (alluxio.hub.proto.AgentListCatalogRequest)1 HubNodeAddress (alluxio.hub.proto.HubNodeAddress)1 HashMap (java.util.HashMap)1