mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Merged HEAD-BUG-FIX (5.1/Cloud) to HEAD (5.1/Cloud)
96317: Merged 5.0.N (5.0.1) to HEAD-BUG-FIX (5.1/Cloud) 96272: Merged V4.2-BUG-FIX (4.2.5) to 5.0.N (5.0.1) 96106: Merged V4.1-BUG-FIX (4.1.10) to V4.2-BUG-FIX (4.2.5) 96045: Merged DEV to V4.1-BUG-FIX (4.1.10) 94227 : MNT-12569: Problems with org/alfresco/repository/thumbnail scripts - Added a test 94339 : MNT-12569: Problems with org/alfresco/repository/thumbnail scripts - Implemented 'PUT' method git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@96483 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -42,6 +42,7 @@ import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest;
|
||||
import org.springframework.extensions.webscripts.TestWebScriptServer.PostRequest;
|
||||
import org.springframework.extensions.webscripts.TestWebScriptServer.PutRequest;
|
||||
import org.springframework.extensions.webscripts.TestWebScriptServer.Response;
|
||||
|
||||
/**
|
||||
@@ -212,6 +213,31 @@ public class ThumbnailServiceTest extends BaseWebScriptTest
|
||||
assertEquals(0, getArr.length());
|
||||
}
|
||||
|
||||
public void testUpdateThumbnail() throws Exception
|
||||
{
|
||||
// Do a image transformation
|
||||
String url = "/api/node/" + jpgNode.getStoreRef().getProtocol() + "/" + jpgNode.getStoreRef().getIdentifier() + "/" + jpgNode.getId() + "/content/thumbnails";
|
||||
JSONObject tn = new JSONObject();
|
||||
tn.put("thumbnailName", "doclib");
|
||||
Response response = sendRequest(new PostRequest(url, tn.toString(), "application/json"), 200);
|
||||
System.out.println(response.getContentAsString());
|
||||
|
||||
// Check getAll whilst we are here
|
||||
Response getAllResp = sendRequest(new GetRequest(getThumbnailsURL(jpgNode)), 200);
|
||||
JSONArray getArr = new JSONArray(getAllResp.getContentAsString());
|
||||
assertNotNull(getArr);
|
||||
assertEquals(1, getArr.length());
|
||||
assertEquals("doclib", getArr.getJSONObject(0).get("thumbnailName"));
|
||||
//Now we know that thumbnail was created
|
||||
|
||||
|
||||
sendRequest(new GetRequest(getThumbnailsURL(jpgNode) + "/incorrectname"), 404);
|
||||
//Request for update of thumbnail, that is absent
|
||||
sendRequest(new PutRequest(getThumbnailsURL(jpgNode) + "/incorrectname", "", "application/json"), 404);
|
||||
//Request for update of correct thumbnail
|
||||
sendRequest(new PutRequest(getThumbnailsURL(jpgNode) + "/doclib", "", "application/json"), 200);
|
||||
}
|
||||
|
||||
public void testThumbnailDefinitions() throws Exception
|
||||
{
|
||||
// Check for pdfToSWF transformation before doing test
|
||||
|
Reference in New Issue
Block a user