mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Thumbnail Service: can now get a list of thumbnail definitions that can be applied to a given content property
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@10437 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -142,6 +142,57 @@ public class ThumbnailServiceTest extends BaseWebScriptTest
|
||||
|
||||
}
|
||||
|
||||
public void testThumbnailDefinitions() throws Exception
|
||||
{
|
||||
// Check for pdfToSWF transformation before doing test
|
||||
if (this.contentService.getTransformer(MimetypeMap.MIMETYPE_PDF, MimetypeMap.MIMETYPE_FLASH) != null)
|
||||
{
|
||||
String url = "/api/node/" + pdfNode.getStoreRef().getProtocol() + "/" + pdfNode.getStoreRef().getIdentifier() + "/" + pdfNode.getId() + "/content/thumbnaildefinitions";
|
||||
MockHttpServletResponse response = this.getRequest(url, 200);
|
||||
|
||||
JSONArray array = new JSONArray(response.getContentAsString());
|
||||
assertNotNull(array);
|
||||
assertFalse(array.length() == 0);
|
||||
boolean hasMedium = false;
|
||||
boolean hasWebPreview = false;
|
||||
for (int i = 0; i < array.length(); i++)
|
||||
{
|
||||
if (array.getString(i).equals("medium") == true)
|
||||
{
|
||||
hasMedium = true;
|
||||
}
|
||||
else if (array.getString(i).equals("webpreview") == true)
|
||||
{
|
||||
hasWebPreview = true;
|
||||
}
|
||||
}
|
||||
assertTrue(hasMedium);
|
||||
assertTrue(hasWebPreview);
|
||||
}
|
||||
|
||||
String url = "/api/node/" + jpgNode.getStoreRef().getProtocol() + "/" + jpgNode.getStoreRef().getIdentifier() + "/" + jpgNode.getId() + "/content/thumbnaildefinitions";
|
||||
MockHttpServletResponse response = this.getRequest(url, 200);
|
||||
|
||||
JSONArray array = new JSONArray(response.getContentAsString());
|
||||
assertNotNull(array);
|
||||
assertFalse(array.length() == 0);
|
||||
boolean hasMedium = false;
|
||||
boolean hasWebPreview = false;
|
||||
for (int i = 0; i < array.length(); i++)
|
||||
{
|
||||
if (array.getString(i).equals("medium") == true)
|
||||
{
|
||||
hasMedium = true;
|
||||
}
|
||||
else if (array.getString(i).equals("webpreview") == true)
|
||||
{
|
||||
hasWebPreview = true;
|
||||
}
|
||||
}
|
||||
assertTrue(hasMedium);
|
||||
assertFalse(hasWebPreview);
|
||||
}
|
||||
|
||||
public void testCreateAsyncThumbnail() throws Exception
|
||||
{
|
||||
// Check for pdfToSWF transformation before doing test
|
||||
@@ -221,6 +272,4 @@ public class ThumbnailServiceTest extends BaseWebScriptTest
|
||||
{
|
||||
return "/api/node/" + nodeRef.getStoreRef().getProtocol() + "/" + nodeRef.getStoreRef().getIdentifier() + "/" + nodeRef.getId() + "/content/thumbnails";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user