Search in sources :

Example 1 with ListFile

use of alluxio.hub.proto.ListFile in project alluxio by Alluxio.

the class ManagerProcessContextTest method testListFiles.

@Test
public void testListFiles() {
    AgentListFileResponse r = AgentListFileResponse.newBuilder().addFileInfo(AgentListFileInfo.newBuilder().setFileName("abc123").setProcessType(UploadProcessType.PRESTO).build()).build();
    HubNodeAddress addr = HubTestUtils.generateNodeAddress();
    Map<HubNodeAddress, Pair<AlluxioNodeType, AgentListFileResponse>> resp = new HashMap<>();
    resp.put(addr, new Pair<>(AlluxioNodeType.MASTER, r));
    doReturn(resp).when(mContext).execOnHub(any(), eq(AlluxioNodeType.MASTER), any());
    doReturn(new HashMap<>()).when(mContext).execOnHub(any(), eq(AlluxioNodeType.WORKER), any());
    List<ListFile> s = mContext.listFiles();
    assertNotNull(s);
    assertEquals(1, s.size());
    assertTrue(s.get(0).hasLocation());
    assertTrue(s.get(0).hasName());
    assertTrue(s.get(0).hasProcessType());
    assertEquals(AlluxioNodeType.MASTER, s.get(0).getLocation());
    assertEquals("abc123", s.get(0).getName());
    assertEquals(UploadProcessType.PRESTO, s.get(0).getProcessType());
}
Also used : HubNodeAddress(alluxio.hub.proto.HubNodeAddress) ListFile(alluxio.hub.proto.ListFile) HashMap(java.util.HashMap) AgentListFileResponse(alluxio.hub.proto.AgentListFileResponse) Pair(alluxio.collections.Pair) BaseHubTest(alluxio.hub.test.BaseHubTest) Test(org.junit.Test)

Aggregations

Pair (alluxio.collections.Pair)1 AgentListFileResponse (alluxio.hub.proto.AgentListFileResponse)1 HubNodeAddress (alluxio.hub.proto.HubNodeAddress)1 ListFile (alluxio.hub.proto.ListFile)1 BaseHubTest (alluxio.hub.test.BaseHubTest)1 HashMap (java.util.HashMap)1 Test (org.junit.Test)1