1 17 package org.alfresco.repo.content.transform; 18 19 import org.alfresco.repo.content.MimetypeMap; 20 21 26 public class UnoContentTransformerTest extends AbstractContentTransformerTest 27 { 28 private static String MIMETYPE_RUBBISH = "text/rubbish"; 29 30 private UnoContentTransformer transformer; 31 32 public void onSetUpInTransaction() throws Exception 33 { 34 transformer = new UnoContentTransformer(); 35 transformer.setMimetypeService(mimetypeMap); 36 transformer.init(); 37 } 38 39 42 protected ContentTransformer getTransformer(String sourceMimetype, String targetMimetype) 43 { 44 return transformer; 45 } 46 47 public void testSetUp() throws Exception 48 { 49 super.testSetUp(); 50 assertNotNull(mimetypeMap); 51 } 52 53 public void testReliability() throws Exception 54 { 55 if (!transformer.isConnected()) 56 { 57 return; 59 } 60 double reliability = 0.0; 61 reliability = transformer.getReliability(MIMETYPE_RUBBISH, MimetypeMap.MIMETYPE_TEXT_PLAIN); 62 assertEquals("Mimetype should not be supported", 0.0, reliability); 63 reliability = transformer.getReliability(MimetypeMap.MIMETYPE_TEXT_PLAIN, MIMETYPE_RUBBISH); 64 assertEquals("Mimetype should not be supported", 0.0, reliability); 65 reliability = transformer.getReliability(MimetypeMap.MIMETYPE_TEXT_PLAIN, MimetypeMap.MIMETYPE_WORD); 66 assertEquals("Mimetype should be supported", 1.0, reliability); 67 reliability = transformer.getReliability(MimetypeMap.MIMETYPE_WORD, MimetypeMap.MIMETYPE_TEXT_PLAIN); 68 assertEquals("Mimetype should be supported", 1.0, reliability); 69 } 70 } 71 | Popular Tags |