mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged BRANCHES/DEV/RGAUSS/HEAD-SOURCE-TARGET-TRANS-OPTIONS to HEAD:
45449: ALF-13254: TransformationOptions Should Have Separate Source and Target Options - Added SerializedTransformationOptionsAccessor interface which defines the methods used in the protected AbstractRenderingEngine.RenderContext class in a public manner - Changed AbstractRenderingEngine.RenderContext to implement SerializedTransformationOptionsAccessor - Added TransformationSourceOptions interface which also contains TransformationSourceOptionsSerializer interface which uses SerializedTransformationOptionsAccessor for deserialization - Added base AbstractTransformationSourceOptions class - Added PagedSourceOptions class which extends TransformationSourceOptions for start and end page options - Added TemporalSourceOptions class which extends TransformationSourceOptions for time-based offset and duration options - Changed TransformationOptions to contain TransformationSourceOptions held as a map with class as key - Changed ImageTransformationOptions to extend copyFrom - Changed ImageMagickContentTransformerWorker.getSourcePageRange to check for paged source options in the TransformationOptions passed in - Added ImageMagickContentTransformerTest.testPageSourceOptions to test null, default, page 2, and invalid options - Changed ThumbnailRenditionConvertor to iterate the transformationOptions.sourceOptionsList and use each serializer to add to the parameters - Changed AbstractTransformationRenderingEngine to iterate a list of TransformationSourceOptionsSerializers and use each to deserialize the RenderContext parameters and construct a TransformationSourceOptions object - Changed rendition-services-context.xml to set imageRenderingEngine's list of known sourceOptionsSerializers - Changed ThumbnailServiceImplParameterTest to test paged and temporal options - Added ThumbanailServiceImplTest.testCreateRenditionThumbnailFromPdfPage2 which tests grabbing the second page of a PDF git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@46062 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -49,6 +49,7 @@ import org.alfresco.service.cmr.repository.ContentReader;
|
||||
import org.alfresco.service.cmr.repository.ContentServiceTransientException;
|
||||
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.PagedSourceOptions;
|
||||
import org.alfresco.service.cmr.repository.ScriptLocation;
|
||||
import org.alfresco.service.cmr.repository.ScriptService;
|
||||
import org.alfresco.service.cmr.repository.TransformationOptions;
|
||||
@@ -175,6 +176,39 @@ public class ThumbnailServiceImplTest extends BaseAlfrescoSpringTest
|
||||
checkRendition("doclib", thumbnail0);
|
||||
outputThumbnailTempContentLocation(thumbnail0, "jpg", "doclib test");
|
||||
}
|
||||
|
||||
public void testCreateRenditionThumbnailFromPdfPage2() throws Exception
|
||||
{
|
||||
ImageTransformationOptions options = new ImageTransformationOptions();
|
||||
PagedSourceOptions pagedSourceOptions = new PagedSourceOptions();
|
||||
pagedSourceOptions.setStartPageNumber(new Integer(2));
|
||||
pagedSourceOptions.setEndPageNumber(new Integer(2));
|
||||
options.addSourceOptions(pagedSourceOptions);
|
||||
|
||||
ThumbnailDefinition thumbnailDefinition = new ThumbnailDefinition(MimetypeMap.MIMETYPE_PDF, options, "doclib_2");
|
||||
thumbnailService.getThumbnailRegistry().addThumbnailDefinition(thumbnailDefinition);
|
||||
|
||||
checkTransformer();
|
||||
|
||||
NodeRef pdfOrig = createOriginalContent(this.folder, MimetypeMap.MIMETYPE_PDF);
|
||||
|
||||
NodeRef thumbnail0 = this.thumbnailService.createThumbnail(pdfOrig, ContentModel.PROP_CONTENT,
|
||||
MimetypeMap.MIMETYPE_IMAGE_JPEG, thumbnailDefinition.getTransformationOptions(), "doclib_2");
|
||||
assertNotNull(thumbnail0);
|
||||
checkRenditioned(pdfOrig, "doclib_2");
|
||||
checkRendition("doclib_2", thumbnail0);
|
||||
|
||||
// Check the length
|
||||
File tempFile = TempFileProvider.createTempFile("thumbnailServiceImplTest", ".jpg");
|
||||
ContentReader reader = this.contentService.getReader(thumbnail0, ContentModel.PROP_CONTENT);
|
||||
|
||||
long size = reader.getSize();
|
||||
System.out.println("size=" + size);
|
||||
assertTrue("Page 2 should be blank and less than 4500 bytes", size < 4500);
|
||||
|
||||
reader.getContent(tempFile);
|
||||
System.out.println("doclib_2 test: " + tempFile.getPath());
|
||||
}
|
||||
|
||||
public void testCreateThumbnailFromImage() throws Exception
|
||||
{
|
||||
|
Reference in New Issue
Block a user