use of org.alfresco.rest.api.tests.client.HttpResponse in project alfresco-remote-api by Alfresco.
the class AbstractBaseApiTest method getAll.
protected HttpResponse getAll(String url, PublicApiClient.Paging paging, Map<String, String> otherParams, int expectedStatus) throws Exception {
Map<String, String> params = createParams(paging, otherParams);
HttpResponse response = publicApiClient.get(getScope(), url, null, null, null, params);
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 createAndGetRendition.
protected Rendition createAndGetRendition(String sourceNodeId, String renditionId) throws Exception {
Rendition renditionRequest = new Rendition();
renditionRequest.setId(renditionId);
int retryCount = 0;
while (retryCount < MAX_RETRY) {
try {
HttpResponse res = post(getNodeRenditionsUrl(sourceNodeId), toJsonAsString(renditionRequest), 202);
assertNull(res.getJsonResponse());
break;
} catch (AssertionError ex) {
// If no transformer is currently available,
// wait for 'PAUSE_TIME' and try again.
retryCount++;
System.out.println("waitAndGetRendition: " + retryCount);
Thread.sleep(PAUSE_TIME);
}
}
return waitAndGetRendition(sourceNodeId, renditionId);
}
use of org.alfresco.rest.api.tests.client.HttpResponse in project alfresco-remote-api by Alfresco.
the class AbstractBaseApiTest method putBinary.
protected HttpResponse putBinary(String url, int version, BinaryPayload payload, String queryString, Map<String, String> params, int expectedStatus) throws Exception {
if (queryString != null) {
url += queryString;
}
HttpResponse response = publicApiClient.putBinary(getScope(), version, url, null, null, null, payload, params);
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 getSharedNodeId.
// -shared- (eg. "Shared" folder for on-prem)
protected String getSharedNodeId() throws Exception {
HttpResponse response = getSingle(NodesEntityResource.class, Nodes.PATH_SHARED, null, 200);
Node node = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), Node.class);
return node.getId();
}
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, Map<String, String> params, Map<String, String> headers, String apiName, String contentType, int expectedStatus) throws Exception {
RequestBuilder requestBuilder = httpClient.new PostRequestBuilder().setBodyAsByteArray(body).setContentType(contentType).setRequestContext(publicApiClient.getRequestContext()).setScope(getScope()).setApiName(apiName).setEntityCollectionName(url).setHeaders(headers).setParams(params);
HttpResponse response = publicApiClient.execute(requestBuilder);
checkStatus(expectedStatus, response.getStatusCode());
return response;
}
Aggregations