use of alluxio.rest.TestCaseOptions in project alluxio by Alluxio.
the class FileSystemClientRestApiTest method writeFile.
private void writeFile(AlluxioURI path, byte[] input) throws Exception {
String result = new TestCase(mHostname, mPort, PATHS_PREFIX + path.toString() + "/" + PathsRestServiceHandler.CREATE_FILE, NO_PARAMS, HttpMethod.POST, null, TestCaseOptions.defaults().setBody(CreateFileOptions.defaults())).call();
Integer id = new ObjectMapper().readValue(result, Integer.TYPE);
TestCaseOptions options = TestCaseOptions.defaults();
long expected = 0;
if (input != null) {
options.setInputStream(new ByteArrayInputStream(input));
expected = input.length;
}
new TestCase(mHostname, mPort, STREAMS_PREFIX + id.toString() + "/" + StreamsRestServiceHandler.WRITE, NO_PARAMS, HttpMethod.POST, expected, options).run();
new TestCase(mHostname, mPort, STREAMS_PREFIX + id.toString() + "/" + StreamsRestServiceHandler.CLOSE, NO_PARAMS, HttpMethod.POST, null).run();
}
Aggregations