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:
Alan Davis
2015-02-07 10:29:39 +00:00
parent 5629ef1754
commit 010ba4a86c
3 changed files with 74 additions and 0 deletions

View File

@@ -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