use of org.alfresco.rest.api.tests.client.HttpResponse in project alfresco-remote-api by Alfresco.
the class AbstractBaseApiTest method updateTextFile.
protected Document updateTextFile(String contentId, String textContent, Map<String, String> params, int expectedStatus) throws Exception {
ByteArrayInputStream inputStream = new ByteArrayInputStream(textContent.getBytes());
File txtFile = TempFileProvider.createTempFile(inputStream, getClass().getSimpleName(), ".txt");
BinaryPayload payload = new BinaryPayload(txtFile);
HttpResponse response = putBinary(getNodeContentUrl(contentId), payload, null, params, expectedStatus);
if (expectedStatus != 200) {
return null;
}
return RestApiUtil.parseRestApiEntry(response.getJsonResponse(), Document.class);
}
use of org.alfresco.rest.api.tests.client.HttpResponse in project alfresco-remote-api by Alfresco.
the class AbstractBaseApiTest method post.
protected HttpResponse post(String url, String body, Map<String, String> params, Map<String, String> headers, String apiName, int expectedStatus) throws Exception {
RequestBuilder requestBuilder = httpClient.new PostRequestBuilder().setBodyAsString(body).setRequestContext(publicApiClient.getRequestContext()).setScope(getScope()).setApiName(apiName).setEntityCollectionName(url).setHeaders(headers).setParams(params);
HttpResponse response = publicApiClient.execute(requestBuilder);
checkStatus(expectedStatus, response.getStatusCode());
return response;
}
use of org.alfresco.rest.api.tests.client.HttpResponse in project alfresco-remote-api by Alfresco.
the class AbstractBaseApiTest method post.
protected HttpResponse post(String url, String body, String queryString, int expectedStatus) throws Exception {
if (queryString != null) {
url += queryString;
}
HttpResponse response = publicApiClient.post(getScope(), url, null, null, null, body);
checkStatus(expectedStatus, response.getStatusCode());
return response;
}
use of org.alfresco.rest.api.tests.client.HttpResponse in project alfresco-remote-api by Alfresco.
the class AbstractBaseApiTest method post.
protected HttpResponse post(String url, byte[] body, String queryString, String contentType, int expectedStatus) throws Exception {
if (queryString != null) {
url += queryString;
}
HttpResponse response = publicApiClient.post(getScope(), url, null, null, null, body, contentType);
checkStatus(expectedStatus, response.getStatusCode());
return response;
}
use of org.alfresco.rest.api.tests.client.HttpResponse in project alfresco-remote-api by Alfresco.
the class AbstractBaseApiTest method getSingle.
protected HttpResponse getSingle(Class<?> entityResource, String entityId, Map<String, String> params, int expectedStatus) throws Exception {
HttpResponse response = publicApiClient.get(entityResource, entityId, null, params);
checkStatus(expectedStatus, response.getStatusCode());
return response;
}
Aggregations