use of alluxio.hub.proto.AgentListFileResponse 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());
}
Aggregations