return handle(connection, DFS.GetFileStatusRequest.parseFrom(pBody)); return handle(connection, DFS.GetFileDataRequest.parseFrom(pBody)); return handle(connection, DFS.ListStatusRequest.parseFrom(pBody)); return handle(connection, DFS.MkdirsRequest.parseFrom(pBody)); return handle(connection, DFS.RenameRequest.parseFrom(pBody)); return handle(connection, DFS.DeleteRequest.parseFrom(pBody)); return handle(connection, DFS.WriteDataRequest.parseFrom(pBody), dBody);
/** * Get the response produced by the handler for a given filesystem response. * * @return * @throws IOException * @throws UserException */ private DFS.GetFileStatusResponse getResponse(final Object o) throws IOException, UserException { if (o instanceof Throwable) { doThrow((Throwable) o).when(getFileSystem()).getFileStatus(TEST_PATH); } else { doReturn(o).when(getFileSystem()).getFileStatus(TEST_PATH); } Response response = getPDFSProtocol().handle(getConnection(), DFS.RpcType.GET_FILE_STATUS_REQUEST_VALUE, DFS.GetFileStatusRequest.newBuilder().setPath(TEST_PATH_STRING).build().toByteString(), null); assertEquals(DFS.RpcType.GET_FILE_STATUS_RESPONSE, response.rpcType); assertArrayEquals(new ByteBuf[] {}, response.dBodies); return (DFS.GetFileStatusResponse) response.pBody; }
/** * Get the response produced by the handler for a given filesystem response. * * @return * @throws IOException * @throws UserException */ private Response getResponse(Long start, Integer length, final Object o) throws IOException, UserException { if (o instanceof Throwable) { doThrow((Throwable) o).when(getFileSystem()).open(TEST_PATH); } else { doReturn(o).when(getFileSystem()).open(TEST_PATH); } Response response = getPDFSProtocol().handle(getConnection(), DFS.RpcType.GET_FILE_DATA_REQUEST_VALUE, DFS.GetFileDataRequest.newBuilder().setPath(TEST_PATH_STRING).setStart(start).setLength(length).build().toByteString(), null); assertEquals(DFS.RpcType.GET_FILE_DATA_RESPONSE, response.rpcType); //assertArrayEquals(new ByteBuf[] {}, response.dBodies); return response; }
/** * Get the response produced by the handler for a given filesystem response. * * @return * @throws IOException * @throws UserException */ private DFS.DeleteResponse getResponse(final boolean recursive, final Object o) throws IOException, UserException { if (o instanceof Throwable) { doThrow((Throwable) o).when(getFileSystem()).delete(TEST_PATH, recursive); } else { doReturn(o).when(getFileSystem()).delete(TEST_PATH, recursive); } Response response = getPDFSProtocol().handle(getConnection(), DFS.RpcType.DELETE_REQUEST_VALUE, DFS.DeleteRequest.newBuilder().setPath(TEST_PATH_STRING).setRecursive(recursive).build().toByteString(), null); assertEquals(DFS.RpcType.DELETE_RESPONSE, response.rpcType); assertArrayEquals(new ByteBuf[] {}, response.dBodies); return (DFS.DeleteResponse) response.pBody; }
/** * Get the response produced by the handler for a given filesystem response. * * @return * @throws IOException * @throws UserException */ private DFS.RenameResponse getResponse(final Object o) throws IOException, UserException { if (o instanceof Throwable) { doThrow((Throwable) o).when(getFileSystem()).rename(TEST_PATH, TEST_PATH_2); } else { doReturn(o).when(getFileSystem()).rename(TEST_PATH, TEST_PATH_2); } Response response = getPDFSProtocol().handle(getConnection(), DFS.RpcType.RENAME_REQUEST_VALUE, DFS.RenameRequest.newBuilder().setOldpath(TEST_PATH_STRING).setNewpath(TEST_PATH_2_STRING).build().toByteString(), null); assertEquals(DFS.RpcType.RENAME_RESPONSE, response.rpcType); assertArrayEquals(new ByteBuf[] {}, response.dBodies); return (DFS.RenameResponse) response.pBody; }
/** * Get the response produced by the handler for a given filesystem response. * * @return * @throws IOException * @throws UserException */ private DFS.MkdirsResponse getResponse(final FsPermission permission, final Object o) throws IOException, UserException { if (o instanceof Throwable) { doThrow((Throwable) o).when(getFileSystem()).mkdirs(TEST_PATH, permission); } else { doReturn(o).when(getFileSystem()).mkdirs(TEST_PATH, permission); } Response response = getPDFSProtocol().handle(getConnection(), DFS.RpcType.MKDIRS_REQUEST_VALUE, DFS.MkdirsRequest.newBuilder().setPath(TEST_PATH_STRING).setPermission(permission.toExtendedShort()).build().toByteString(), null); assertEquals(DFS.RpcType.MKDIRS_RESPONSE, response.rpcType); assertArrayEquals(new ByteBuf[] {}, response.dBodies); return (DFS.MkdirsResponse) response.pBody; }
Response response = getPDFSProtocol().handle(getConnection(), DFS.RpcType.LIST_STATUS_REQUEST_VALUE, builder.build().toByteString(),