use of alluxio.hub.proto.AgentFileUploadResponse in project alluxio by Alluxio.
the class ManagerProcessContextTest method testAddFile.
@Test
public void testAddFile() {
AgentFileUploadResponse r = AgentFileUploadResponse.newBuilder().setSuccess(true).setVersion(2).setFileName("uptime").build();
HubNodeAddress addr = HubTestUtils.generateNodeAddress();
Map<HubNodeAddress, AgentFileUploadResponse> resp = new HashMap<>();
resp.put(addr, r);
UploadFile req = UploadFile.newBuilder().setDestination(AlluxioNodeType.WORKER).setProcessType(UploadProcessType.PRESTO).setContent("#!/usr/bin/env bash\nuptime").setName("uptime").setPermission("0777").build();
doReturn(resp).when(mContext).execOnHub(any(), any(), any());
boolean addFileResp = mContext.uploadFile(Collections.singletonList(req));
assertTrue(addFileResp);
resp.put(HubTestUtils.generateNodeAddress(), r.toBuilder().setSuccess(false).build());
assertFalse(mContext.uploadFile(Collections.singletonList(req)));
}
Aggregations