Search in sources :

Example 1 with RemoveFile

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

the class ManagerProcessContextTest method testRemoveFile.

@Test
public void testRemoveFile() {
    AgentRemoveFileResponse r = AgentRemoveFileResponse.newBuilder().setSuccess(true).build();
    HubNodeAddress addr = HubTestUtils.generateNodeAddress();
    Map<HubNodeAddress, AgentRemoveFileResponse> resp = new HashMap<>();
    resp.put(addr, r);
    RemoveFile req = RemoveFile.newBuilder().setLocation(AlluxioNodeType.WORKER).setProcessType(UploadProcessType.PRESTO).setName("uptime").build();
    doReturn(resp).when(mContext).execOnHub(any(), any(), any());
    boolean addFileResp = mContext.removeFile(Collections.singletonList(req));
    assertTrue(addFileResp);
    resp.put(HubTestUtils.generateNodeAddress(), r.toBuilder().setSuccess(false).build());
    assertFalse(mContext.removeFile(Collections.singletonList(req)));
}
Also used : HubNodeAddress(alluxio.hub.proto.HubNodeAddress) AgentRemoveFileResponse(alluxio.hub.proto.AgentRemoveFileResponse) HashMap(java.util.HashMap) RemoveFile(alluxio.hub.proto.RemoveFile) BaseHubTest(alluxio.hub.test.BaseHubTest) Test(org.junit.Test)

Aggregations

AgentRemoveFileResponse (alluxio.hub.proto.AgentRemoveFileResponse)1 HubNodeAddress (alluxio.hub.proto.HubNodeAddress)1 RemoveFile (alluxio.hub.proto.RemoveFile)1 BaseHubTest (alluxio.hub.test.BaseHubTest)1 HashMap (java.util.HashMap)1 Test (org.junit.Test)1