use of org.apache.servicecomb.foundation.vertx.http.ReadStreamPart in project incubator-servicecomb-java-chassis by apache.
the class TestDownloadSchema method testDownloadFileAndDeleted.
private void testDownloadFileAndDeleted() throws Exception {
RestTemplate restTemplate = RestTemplateBuilder.create();
ReadStreamPart readStreamPart = restTemplate.getForObject("servicecomb://springmvc/download/deleteAfterFinished?content=hello", ReadStreamPart.class);
String hello = readStreamPart.saveAsString().get();
TestMgr.check(hello, "hello");
boolean exists = restTemplate.getForObject("servicecomb://springmvc/download/assertLastFileDeleted", boolean.class);
TestMgr.check(exists, false);
}
use of org.apache.servicecomb.foundation.vertx.http.ReadStreamPart in project incubator-servicecomb-java-chassis by apache.
the class TestDownloadSchema method testDownloadFileWithNull.
private void testDownloadFileWithNull() throws Exception {
RestTemplate restTemplate = RestTemplateBuilder.create();
ReadStreamPart readStreamPart = restTemplate.getForObject("servicecomb://springmvc/download/partIsNull?content=test", ReadStreamPart.class);
String result = readStreamPart.saveAsString().get();
TestMgr.check(result, "test");
readStreamPart = restTemplate.getForObject("servicecomb://springmvc/download/partIsNull?content=", ReadStreamPart.class);
result = readStreamPart.saveAsString().get();
TestMgr.check(result, "");
}
use of org.apache.servicecomb.foundation.vertx.http.ReadStreamPart in project java-chassis by ServiceComb.
the class RestClientSender method processResponse.
protected Future<Buffer> processResponse(HttpClientResponse httpClientResponse) {
transportContext.setHttpClientResponse(httpClientResponse);
if (HttpStatus.isSuccess(httpClientResponse.statusCode()) && transportContext.isDownloadFile()) {
ReadStreamPart streamPart = new ReadStreamPart(transportContext.getVertxContext(), httpClientResponse);
future.complete(createResponse(httpClientResponse, streamPart));
}
return httpClientResponse.body();
}
use of org.apache.servicecomb.foundation.vertx.http.ReadStreamPart in project java-chassis by ServiceComb.
the class TestDownloadSchema method testDownloadFileWithNull.
private void testDownloadFileWithNull() throws Exception {
RestTemplate restTemplate = RestTemplateBuilder.create();
ReadStreamPart readStreamPart = restTemplate.getForObject("servicecomb://springmvc/download/partIsNull?content=test", ReadStreamPart.class);
String result = readStreamPart.saveAsString().get();
TestMgr.check(result, "test");
readStreamPart = restTemplate.getForObject("servicecomb://springmvc/download/partIsNull?content=", ReadStreamPart.class);
result = readStreamPart.saveAsString().get();
TestMgr.check(result, "");
}
use of org.apache.servicecomb.foundation.vertx.http.ReadStreamPart in project incubator-servicecomb-java-chassis by apache.
the class TestDownloadSchema method testDownloadFileNotDeleted.
private void testDownloadFileNotDeleted() throws Exception {
RestTemplate restTemplate = RestTemplateBuilder.create();
ReadStreamPart readStreamPart = restTemplate.getForObject("servicecomb://springmvc/download/notDeleteAfterFinished?content=hello", ReadStreamPart.class);
String hello = readStreamPart.saveAsString().get();
TestMgr.check(hello, "hello");
boolean exists = restTemplate.getForObject("servicecomb://springmvc/download/assertLastFileDeleted", boolean.class);
TestMgr.check(exists, true);
}
Aggregations