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:
Roy Wetherall
2008-08-20 10:27:56 +00:00
parent f4da392bc3
commit b5caf3fdef
5 changed files with 92 additions and 3 deletions

View File

@@ -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";
}
}