Search in sources :

Example 1 with UploadFile

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

Aggregations

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