Search in sources :

Example 6 with SWFTransformationOptions

use of org.alfresco.repo.content.transform.swf.SWFTransformationOptions in project alfresco-repository by Alfresco.

the class RenditionDefinitionTest method testGetRenderingEngineDefinition.

@Test
public void testGetRenderingEngineDefinition() throws Exception {
    ThumbnailRenditionConvertor converter = new ThumbnailRenditionConvertor();
    List<RenditionDefinition> renditionDefinitions = new ArrayList(renditionService.loadRenditionDefinitions());
    Set<String> renditionNames = renditionDefinitionRegistry2.getRenditionNames();
    for (String renditionName : renditionNames) {
        System.out.println("renditionName=" + renditionName);
        RenditionDefinition definition = getRenditionDefinition(renditionDefinitions, renditionName);
        assertNotNull("There is no RenditionDefinition for " + renditionName, definition);
        renditionDefinitions.remove(definition);
        ThumbnailDefinition thumbnailDefinition = converter.convert(definition);
        TransformationOptions transformationOptions = thumbnailDefinition.getTransformationOptions();
        RenditionDefinition2 definition2 = renditionDefinitionRegistry2.getRenditionDefinition(renditionName);
        Map<String, String> options = definition2.getTransformOptions();
        TransformationOptions transformationOptions2 = transformationOptionsConverter.getTransformationOptions(renditionName, options);
        Map<String, String> options2 = transformationOptionsConverter.getOptions(transformationOptions2, null, null);
        // The use is not set in the original until much later
        transformationOptions2.setUse(null);
        // than checking transformationOptions is equal to transformationOptions2.
        if (!renditionName.equals("pdf") && !renditionName.equals("webpreview")) {
            assertEquals("The TransformationOptions used in transforms for " + renditionName + " should be the same", transformationOptions.toStringAll(), transformationOptions2.toStringAll());
            assertEquals("The transformationOptionsConverter back to the newer format was not the same for " + renditionName, options, options2);
        } else {
            assertEquals("The converted class for " + renditionName + " should be the same as before", transformationOptions.getClass(), transformationOptions2.getClass());
            assertEquals("The converted class for " + renditionName + " should be SWFTransformationOptions", SWFTransformationOptions.class, transformationOptions2.getClass());
        }
    }
    if (!renditionDefinitions.isEmpty()) {
        StringJoiner sj = new StringJoiner(", ");
        for (RenditionDefinition renditionDefinition : renditionDefinitions) {
            String name = renditionDefinition.getRenditionName().getLocalName();
            sj.add(name);
        }
        fail("There is no RenditionDefinition2 for existing RenditionDefinitions " + sj);
    }
}
Also used : ThumbnailDefinition(org.alfresco.repo.thumbnail.ThumbnailDefinition) ArrayList(java.util.ArrayList) RenditionDefinition(org.alfresco.service.cmr.rendition.RenditionDefinition) StringJoiner(java.util.StringJoiner) ThumbnailRenditionConvertor(org.alfresco.repo.thumbnail.ThumbnailRenditionConvertor) SWFTransformationOptions(org.alfresco.repo.content.transform.swf.SWFTransformationOptions) TransformationOptions(org.alfresco.service.cmr.repository.TransformationOptions) BaseSpringTest(org.alfresco.util.BaseSpringTest) Test(org.junit.Test)

Aggregations

SWFTransformationOptions (org.alfresco.repo.content.transform.swf.SWFTransformationOptions)6 ImageResizeOptions (org.alfresco.repo.content.transform.magick.ImageResizeOptions)4 ImageTransformationOptions (org.alfresco.repo.content.transform.magick.ImageTransformationOptions)4 HashMap (java.util.HashMap)3 PagedSourceOptions (org.alfresco.service.cmr.repository.PagedSourceOptions)3 TransformationOptions (org.alfresco.service.cmr.repository.TransformationOptions)3 TransformationSourceOptions (org.alfresco.service.cmr.repository.TransformationSourceOptions)3 Serializable (java.io.Serializable)2 ArrayList (java.util.ArrayList)2 StringJoiner (java.util.StringJoiner)2 RuntimeExecutableContentTransformerOptions (org.alfresco.repo.content.transform.RuntimeExecutableContentTransformerOptions)2 CropSourceOptions (org.alfresco.service.cmr.repository.CropSourceOptions)2 TemporalSourceOptions (org.alfresco.service.cmr.repository.TemporalSourceOptions)2 Arrays (java.util.Arrays)1 Collection (java.util.Collection)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Map (java.util.Map)1 Set (java.util.Set)1 MimetypeMap (org.alfresco.repo.content.MimetypeMap)1