use of org.alfresco.service.cmr.repository.TransformationOptions in project alfresco-repository by Alfresco.
the class ArchiveContentTransformerTest method testRecursing.
public void testRecursing() throws Exception {
ContentWriter writer;
String contents;
// Bean off, no options
transformer.setIncludeContents("FALSE");
writer = getTestWriter();
transformer.transform(getTestReader(), writer);
contents = writer.getReader().getContentString();
testHasFiles(contents);
testNested(contents, false);
// Bean on, no options
transformer.setIncludeContents("TRUE");
writer = getTestWriter();
transformer.transform(getTestReader(), writer);
contents = writer.getReader().getContentString();
testHasFiles(contents);
testNested(contents, true);
// Bean off, Transformation Options off
TransformationOptions options = new TransformationOptions();
transformer.setIncludeContents("FALSE");
writer = getTestWriter();
transformer.transform(getTestReader(), writer, options);
contents = writer.getReader().getContentString();
testHasFiles(contents);
testNested(contents, false);
// Bean on, Transformation Options off
transformer.setIncludeContents("T");
writer = getTestWriter();
transformer.transform(getTestReader(), writer, options);
contents = writer.getReader().getContentString();
testHasFiles(contents);
testNested(contents, true);
// Bean off, Transformation Options on - options win
options.setIncludeEmbedded(true);
transformer.setIncludeContents("FALSE");
writer = getTestWriter();
transformer.transform(getTestReader(), writer, options);
contents = writer.getReader().getContentString();
testHasFiles(contents);
testNested(contents, true);
// Bean on, Transformation Options on
transformer.setIncludeContents("YeS");
writer = getTestWriter();
transformer.transform(getTestReader(), writer, options);
contents = writer.getReader().getContentString();
testHasFiles(contents);
testNested(contents, true);
}
use of org.alfresco.service.cmr.repository.TransformationOptions in project alfresco-repository by Alfresco.
the class ComplexContentTransformerTest method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
ContentTransformer unoTransformer = (ContentTransformer) ctx.getBean("transformer.JodConverter");
ContentTransformer pdfBoxTransformer = (ContentTransformer) ctx.getBean("transformer.PdfBox");
// make sure that they are working for this test
if (unoTransformer.isTransformable(MimetypeMap.MIMETYPE_PPT, -1, MimetypeMap.MIMETYPE_PDF, new TransformationOptions()) == false) {
isAvailable = false;
return;
} else if (pdfBoxTransformer.isTransformable(MimetypeMap.MIMETYPE_PDF, -1, MimetypeMap.MIMETYPE_TEXT_PLAIN, new TransformationOptions()) == false) {
isAvailable = false;
return;
} else {
isAvailable = true;
}
transformer = new ComplexContentTransformer();
transformer.setMimetypeService(mimetypeService);
transformer.setTransformerDebug(transformerDebug);
transformer.setTransformerConfig(transformerConfig);
// set the transformer list
List<ContentTransformer> transformers = new ArrayList<ContentTransformer>(2);
transformers.add(unoTransformer);
transformers.add(pdfBoxTransformer);
transformer.setTransformers(transformers);
// set the intermediate mimetypes
List<String> intermediateMimetypes = Collections.singletonList(MimetypeMap.MIMETYPE_PDF);
transformer.setIntermediateMimetypes(intermediateMimetypes);
}
use of org.alfresco.service.cmr.repository.TransformationOptions in project alfresco-repository by Alfresco.
the class ComplexContentTransformerTest method testReliability.
public void testReliability() throws Exception {
if (!isAvailable) {
return;
}
boolean reliability = transformer.isTransformable(MimetypeMap.MIMETYPE_PPT, -1, MimetypeMap.MIMETYPE_PDF, new TransformationOptions());
assertEquals("Mimetype should not be supported", false, reliability);
reliability = transformer.isTransformable(MimetypeMap.MIMETYPE_PPT, -1, MimetypeMap.MIMETYPE_TEXT_PLAIN, new TransformationOptions());
assertEquals("Mimetype should be supported", true, reliability);
}
use of org.alfresco.service.cmr.repository.TransformationOptions in project alfresco-repository by Alfresco.
the class DummyTestContentTransformer method testReliability.
public void testReliability() throws Exception {
// The MIME types here are rather arbitrary
boolean reliability = transformer.isTransformable(sourceMimeType, -1, targetMimeType, new TransformationOptions());
assertEquals("Mimetype should be supported", true, reliability);
}
use of org.alfresco.service.cmr.repository.TransformationOptions in project alfresco-repository by Alfresco.
the class OpenOfficeContentTransformerTest method testReliability.
public void testReliability() throws Exception {
if (!isOpenOfficeWorkerAvailable()) {
// no connection
System.err.println("ooWorker not available - skipping testReliability !!");
return;
}
boolean reliability = transformer.isTransformable(MIMETYPE_RUBBISH, -1, MimetypeMap.MIMETYPE_TEXT_PLAIN, new TransformationOptions());
assertEquals("Mimetype should not be supported", false, reliability);
reliability = transformer.isTransformable(MimetypeMap.MIMETYPE_TEXT_PLAIN, -1, MIMETYPE_RUBBISH, new TransformationOptions());
assertEquals("Mimetype should not be supported", false, reliability);
reliability = transformer.isTransformable(MimetypeMap.MIMETYPE_TEXT_PLAIN, -1, MimetypeMap.MIMETYPE_XHTML, new TransformationOptions());
assertEquals("Mimetype should not be supported", false, reliability);
reliability = transformer.isTransformable(MimetypeMap.MIMETYPE_TEXT_PLAIN, -1, MimetypeMap.MIMETYPE_WORD, new TransformationOptions());
assertEquals("Mimetype should be supported", true, reliability);
reliability = transformer.isTransformable(MimetypeMap.MIMETYPE_WORD, -1, MimetypeMap.MIMETYPE_TEXT_PLAIN, new TransformationOptions());
assertEquals("Mimetype should be supported", true, reliability);
}
Aggregations