use of org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest in project alfresco-remote-api by Alfresco.
the class SubscriptionServiceRestApiTest method getFollowersCount.
protected int getFollowersCount(String user) throws Exception {
String url = getUrl(URL_FOLLOWERS_COUNT, user);
Response response = sendRequest(new GetRequest(url), Status.STATUS_OK);
JSONObject resultObject = new JSONObject(response.getContentAsString());
assertTrue(resultObject.has("count"));
return resultObject.getInt("count");
}
use of org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest in project alfresco-remote-api by Alfresco.
the class TaggingServiceTest method testGetNodes.
public void testGetNodes() throws Exception {
Response response = sendRequest(new GetRequest("/api/tags/" + StoreRef.PROTOCOL_WORKSPACE + "/SpacesStore/" + TAG_1 + "/nodes"), 200);
JSONArray jsonArray = new JSONArray(response.getContentAsString());
assertNotNull(jsonArray);
assertEquals(1, jsonArray.length());
System.out.println(response.getContentAsString());
response = sendRequest(new GetRequest("/api/tags/" + StoreRef.PROTOCOL_WORKSPACE + "/SpacesStore/" + TAG_2 + "/nodes"), 200);
jsonArray = new JSONArray(response.getContentAsString());
assertNotNull(jsonArray);
assertEquals(2, jsonArray.length());
response = sendRequest(new GetRequest("/api/tags/" + StoreRef.PROTOCOL_WORKSPACE + "/SpacesStore/jumk/nodes"), 200);
jsonArray = new JSONArray(response.getContentAsString());
assertNotNull(jsonArray);
assertEquals(0, jsonArray.length());
}
use of org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest in project alfresco-remote-api by Alfresco.
the class TaggingServiceTest method testGetTags.
public void testGetTags() throws Exception {
Response response = sendRequest(new GetRequest("/api/tags/" + StoreRef.PROTOCOL_WORKSPACE + "/SpacesStore"), 200);
JSONArray jsonArray = new JSONArray(response.getContentAsString());
// make sure there are results
assertNotNull(jsonArray);
assertTrue(jsonArray.length() > 0);
response = sendRequest(new GetRequest("/api/tags/" + StoreRef.PROTOCOL_WORKSPACE + "/SpacesStore?tf=one"), 200);
jsonArray = new JSONArray(response.getContentAsString());
// make sure there are results
assertNotNull(jsonArray);
assertTrue(jsonArray.length() > 0);
response = sendRequest(new GetRequest("/api/tags/" + StoreRef.PROTOCOL_WORKSPACE + "/SpacesStore?tf=none"), 200);
jsonArray = new JSONArray(response.getContentAsString());
// make sure there are no results
assertNotNull(jsonArray);
assertEquals(0, jsonArray.length());
}
use of org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest in project alfresco-remote-api by Alfresco.
the class ThumbnailServiceTest method getWait.
private void getWait(NodeRef node, String thumbnailName) throws Exception {
String url = "/api/node/" + node.getStoreRef().getProtocol() + "/" + node.getStoreRef().getIdentifier() + "/" + node.getId() + "/content/thumbnails/" + thumbnailName;
int retries = 50;
int tries = 0;
while (true) {
if (tries >= retries) {
fail("Thumbnail never gets created " + thumbnailName);
}
Response response = sendRequest(new GetRequest(url), 0);
if (response.getStatus() == 200) {
break;
} else if (response.getStatus() == 500) {
System.out.println("Error during getWait: " + response.getContentAsString());
fail("A 500 status was found whilst waiting for the thumbnail to be processed");
} else {
Thread.sleep(100);
}
tries++;
}
}
use of org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest in project alfresco-remote-api by Alfresco.
the class ThumbnailServiceTest method testCreateThumbnailInReadonlyMode.
public void testCreateThumbnailInReadonlyMode() throws Exception {
createUser(USER_ALFRESCO);
AuthenticationUtil.setFullyAuthenticatedUser(USER_ALFRESCO);
this.transactionService.setAllowWrite(false);
// do pdfToSWF transformation in read-only
if (this.contentService.getTransformer(MimetypeMap.MIMETYPE_PDF, MimetypeMap.MIMETYPE_FLASH) != null) {
// in share creation of thumbnail for webpreview is forced
String url = "/api/node/" + pdfNode.getStoreRef().getProtocol() + "/" + pdfNode.getStoreRef().getIdentifier() + "/" + pdfNode.getId() + "/content/thumbnails/webpreview?c=force";
JSONObject tn = new JSONObject();
tn.put("thumbnailName", "webpreview");
sendRequest(new GetRequest(url), 200, USER_ALFRESCO);
}
this.transactionService.setAllowWrite(true);
// Check getAll whilst we are here
Response getAllResp = sendRequest(new GetRequest(getThumbnailsURL(jpgNode)), 200);
JSONArray getArr = new JSONArray(getAllResp.getContentAsString());
assertNotNull(getArr);
assertEquals(0, getArr.length());
}
Aggregations