1 17 package org.alfresco.repo.content.transform.magick; 18 19 import org.alfresco.repo.content.MimetypeMap; 20 import org.alfresco.repo.content.transform.AbstractContentTransformerTest; 21 import org.alfresco.repo.content.transform.ContentTransformer; 22 import org.apache.commons.logging.Log; 23 import org.apache.commons.logging.LogFactory; 24 25 30 public class JMagickContentTransformerTest extends AbstractContentTransformerTest 31 { 32 private static final Log logger = LogFactory.getLog(JMagickContentTransformerTest.class); 33 34 private JMagickContentTransformer transformer; 35 36 public void onSetUpInTransaction() throws Exception 37 { 38 transformer = new JMagickContentTransformer(); 39 transformer.setMimetypeService(mimetypeMap); 40 transformer.init(); 41 } 42 43 46 protected ContentTransformer getTransformer(String sourceMimetype, String targetMimetype) 47 { 48 return transformer; 49 } 50 51 public void testReliability() throws Exception 52 { 53 if (!transformer.isAvailable()) 54 { 55 return; 56 } 57 double reliability = 0.0; 58 reliability = transformer.getReliability(MimetypeMap.MIMETYPE_IMAGE_GIF, MimetypeMap.MIMETYPE_TEXT_PLAIN); 59 assertEquals("Mimetype should not be supported", 0.0, reliability); 60 reliability = transformer.getReliability(MimetypeMap.MIMETYPE_IMAGE_GIF, MimetypeMap.MIMETYPE_IMAGE_JPEG); 61 assertEquals("Mimetype should be supported", 1.0, reliability); 62 } 63 } 64 | Popular Tags |