mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Thumbnail tests are explicity about checking that the transformer is actually working
- Previously, it just got the bean and assumed it was OK - Now it does a check to see that the image transformer is working before running the test git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@13888 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -34,6 +34,7 @@ import java.util.Map;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.content.MimetypeMap;
|
||||
import org.alfresco.repo.content.transform.AbstractContentTransformerTest;
|
||||
import org.alfresco.repo.content.transform.ContentTransformer;
|
||||
import org.alfresco.repo.content.transform.magick.ImageResizeOptions;
|
||||
import org.alfresco.repo.content.transform.magick.ImageTransformationOptions;
|
||||
import org.alfresco.repo.jscript.ClasspathScriptLocation;
|
||||
@@ -85,19 +86,28 @@ public class ThumbnailServiceImplTest extends BaseAlfrescoSpringTest
|
||||
ContentModel.TYPE_FOLDER).getChildRef();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* TODO: Enable test (when build platform fixed) or ignore this change in merge to HEAD
|
||||
*/
|
||||
public void testDummy()
|
||||
private void checkTransformer()
|
||||
{
|
||||
ContentTransformer transformer = this.contentService.getImageTransformer();
|
||||
if (transformer == null)
|
||||
{
|
||||
fail("No transformer returned for 'getImageTransformer'");
|
||||
}
|
||||
// Check that it is working
|
||||
ImageTransformationOptions imageTransformationOptions = new ImageTransformationOptions();
|
||||
if (!transformer.isTransformable(
|
||||
MimetypeMap.MIMETYPE_IMAGE_JPEG,
|
||||
MimetypeMap.MIMETYPE_IMAGE_JPEG,
|
||||
imageTransformationOptions))
|
||||
{
|
||||
fail("Image transformer is not working. Please check your image conversion command setup.");
|
||||
}
|
||||
}
|
||||
|
||||
public void testCreateThumbnailFromImage() throws Exception
|
||||
{
|
||||
// Check that the image transformations are available
|
||||
if (this.contentService.getImageTransformer() != null)
|
||||
{
|
||||
checkTransformer();
|
||||
|
||||
NodeRef jpgOrig = createOrigionalContent(this.folder, MimetypeMap.MIMETYPE_IMAGE_JPEG);
|
||||
NodeRef gifOrig = createOrigionalContent(this.folder, MimetypeMap.MIMETYPE_IMAGE_GIF);
|
||||
|
||||
@@ -172,13 +182,12 @@ public class ThumbnailServiceImplTest extends BaseAlfrescoSpringTest
|
||||
checkThumbnail("half2", thumbnail4);
|
||||
outputThumbnailTempContentLocation(thumbnail4, "jpg", "half2 - 50%x50%, from gif");
|
||||
}
|
||||
}
|
||||
|
||||
public void testDuplicationNames()
|
||||
throws Exception
|
||||
{
|
||||
if (contentService.getImageTransformer() != null)
|
||||
{
|
||||
checkTransformer();
|
||||
|
||||
NodeRef jpgOrig = createOrigionalContent(this.folder, MimetypeMap.MIMETYPE_IMAGE_JPEG);
|
||||
ImageResizeOptions imageResizeOptions = new ImageResizeOptions();
|
||||
imageResizeOptions.setWidth(64);
|
||||
@@ -208,13 +217,12 @@ public class ThumbnailServiceImplTest extends BaseAlfrescoSpringTest
|
||||
// OK since this should have been thrown
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void testThumbnailUpdate()
|
||||
throws Exception
|
||||
{
|
||||
if (contentService.getImageTransformer() != null)
|
||||
{
|
||||
checkTransformer();
|
||||
|
||||
// First create a thumbnail
|
||||
NodeRef jpgOrig = createOrigionalContent(this.folder, MimetypeMap.MIMETYPE_IMAGE_JPEG);
|
||||
ImageResizeOptions imageResizeOptions = new ImageResizeOptions();
|
||||
@@ -232,13 +240,11 @@ public class ThumbnailServiceImplTest extends BaseAlfrescoSpringTest
|
||||
this.thumbnailService.updateThumbnail(thumbnail1, imageTransformationOptions);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void testGetThumbnailByName()
|
||||
throws Exception
|
||||
{
|
||||
if (contentService.getImageTransformer() != null)
|
||||
{
|
||||
checkTransformer();
|
||||
|
||||
NodeRef jpgOrig = createOrigionalContent(this.folder, MimetypeMap.MIMETYPE_IMAGE_JPEG);
|
||||
|
||||
// Check for missing thumbnail
|
||||
@@ -266,7 +272,6 @@ public class ThumbnailServiceImplTest extends BaseAlfrescoSpringTest
|
||||
NodeRef result3 = this.thumbnailService.getThumbnailByName(jpgOrig, ContentModel.PROP_CONTENT, "anotherone");
|
||||
assertNull("The thumbnail 'anotherone' should have been missing", result3);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO test getThumbnails
|
||||
|
||||
@@ -325,11 +330,12 @@ public class ThumbnailServiceImplTest extends BaseAlfrescoSpringTest
|
||||
|
||||
public void testAutoUpdate() throws Exception
|
||||
{
|
||||
if (contentService.getImageTransformer() != null)
|
||||
{
|
||||
checkTransformer();
|
||||
|
||||
final NodeRef jpgOrig = createOrigionalContent(this.folder, MimetypeMap.MIMETYPE_IMAGE_JPEG);
|
||||
|
||||
ThumbnailDefinition details = this.thumbnailService.getThumbnailRegistry().getThumbnailDefinition("medium");
|
||||
@SuppressWarnings("unused")
|
||||
final NodeRef thumbnail = this.thumbnailService.createThumbnail(jpgOrig, ContentModel.PROP_CONTENT, details.getMimetype(), details.getTransformationOptions(), details.getName());
|
||||
|
||||
setComplete();
|
||||
@@ -354,7 +360,6 @@ public class ThumbnailServiceImplTest extends BaseAlfrescoSpringTest
|
||||
|
||||
//Thread.sleep(1000);
|
||||
}
|
||||
}
|
||||
|
||||
public void testHTMLToImageAndSWF() throws Exception
|
||||
{
|
||||
|
Reference in New Issue
Block a user