+ * The transformation is sensitive to the source and target string encodings.
+ *
+ *
+ *
+ * This code is based on a class of the same name originally implemented in alfresco-repository.
+ *
+ *
+ *
+ * @author Derek Hulley
+ * @author eknizat
+ */
+public class StringExtractingContentTransformer implements SelectableTransformer
+{
+
+ private static final Log logger = LogFactory.getLog(StringExtractingContentTransformer.class);
+
+ @Override
+ public boolean isTransformable(String sourceMimetype, String targetMimetype, Map parameters)
+ {
+ boolean transformable = (sourceMimetype.startsWith("text/")
+ || MIMETYPE_JAVASCRIPT.equals(sourceMimetype)
+ || MIMETYPE_DITA.equals(sourceMimetype))
+ && MIMETYPE_TEXT_PLAIN.equals(targetMimetype);
+ return transformable;
+ }
+
+ /**
+ * Text to text conversions are done directly using the content reader and writer string
+ * manipulation methods.
+ *
+ * Extraction of text from binary content attempts to take the possible character
+ * encoding into account. The text produced from this will, if the encoding was correct,
+ * be unformatted but valid.
+ */
+ @Override
+ public void transform(File sourceFile, File targetFile, Map parameters) throws Exception
+ {
+
+ String sourceEncoding = parameters.get(SOURCE_ENCODING);
+ String targetEncoding = parameters.get(TARGET_ENCODING);
+
+ if(logger.isDebugEnabled())
+ {
+ logger.debug("Performing text to text transform with sourceEncoding=" + sourceEncoding
+ + " targetEncoding=" + targetEncoding);
+ }
+
+ Reader charReader = null;
+ Writer charWriter = null;
+ try
+ {
+ // Build reader
+ if (sourceEncoding == null)
+ {
+ charReader = new BufferedReader(new InputStreamReader(new FileInputStream(sourceFile)));
+ }
+ else
+ {
+ checkEncodingParameter(sourceEncoding, SOURCE_ENCODING);
+ charReader = new BufferedReader(new InputStreamReader(new FileInputStream(sourceFile), sourceEncoding));
+ }
+
+ // Build writer
+ if (targetEncoding == null)
+ {
+ charWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(targetFile)));
+ }
+ else
+ {
+ checkEncodingParameter( targetEncoding, TARGET_ENCODING);
+ charWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(targetFile), targetEncoding));
+ }
+
+ // copy from the one to the other
+ char[] buffer = new char[8192];
+ int readCount = 0;
+ while (readCount > -1)
+ {
+ // write the last read count number of bytes
+ charWriter.write(buffer, 0, readCount);
+ // fill the buffer again
+ readCount = charReader.read(buffer);
+ }
+ }
+ finally
+ {
+ if (charReader != null)
+ {
+ try { charReader.close(); } catch (Throwable e) { logger.error(e); }
+ }
+ if (charWriter != null)
+ {
+ try { charWriter.close(); } catch (Throwable e) { logger.error(e); }
+ }
+ }
+ // done
+ }
+
+ private void checkEncodingParameter(String encoding, String paramterName)
+ {
+ try
+ {
+ if (!Charset.isSupported(encoding))
+ {
+ throw new IllegalArgumentException(paramterName + "=" + encoding + " is not supported by the JVM.");
+ }
+ }
+ catch (IllegalCharsetNameException e)
+ {
+ throw new IllegalArgumentException(paramterName + "=" + encoding + " is not a valid encoding.");
+ }
+ }
+}
diff --git a/alfresco-docker-transform-misc/src/main/java/org/alfresco/transformer/transformers/TextToPdfContentTransformer.java b/alfresco-docker-transform-misc/src/main/java/org/alfresco/transformer/transformers/TextToPdfContentTransformer.java
new file mode 100644
index 00000000..530f61e1
--- /dev/null
+++ b/alfresco-docker-transform-misc/src/main/java/org/alfresco/transformer/transformers/TextToPdfContentTransformer.java
@@ -0,0 +1,332 @@
+/*
+ * #%L
+ * Alfresco Transform Core
+ * %%
+ * Copyright (C) 2005 - 2019 Alfresco Software Limited
+ * %%
+ * This file is part of the Alfresco software.
+ * -
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ * -
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * -
+ * Alfresco is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ * -
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
+ * #L%
+ */
+package org.alfresco.transformer.transformers;
+
+import org.alfresco.error.AlfrescoRuntimeException;
+import org.apache.pdfbox.pdmodel.PDDocument;
+import org.apache.pdfbox.pdmodel.PDPage;
+import org.apache.pdfbox.pdmodel.PDPageContentStream;
+import org.apache.pdfbox.pdmodel.font.PDType1Font;
+import org.apache.pdfbox.tools.TextToPDF;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.BufferedOutputStream;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.nio.charset.Charset;
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_DITA;
+import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_PDF;
+import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_TEXT_CSV;
+import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_TEXT_PLAIN;
+import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_XML;
+
+/**
+ *
+ *
+ * This code is based on a class of the same name originally implemented in alfresco-repository.
+ *
+ *
+ * Makes use of the PDFBox library's TextToPDF
utility.
+ *
+ * @author Derek Hulley
+ * @author eknizat
+*/
+public class TextToPdfContentTransformer implements SelectableTransformer
+{
+ private static final Logger logger = LoggerFactory.getLogger(TextToPdfContentTransformer.class);
+
+ public static final String PAGE_LIMIT = "pageLimit";
+
+ private PagedTextToPDF transformer;
+
+ public TextToPdfContentTransformer()
+ {
+ transformer = new PagedTextToPDF();
+ }
+
+ public void setStandardFont(String fontName)
+ {
+ try
+ {
+ transformer.setFont(transformer.getStandardFont(fontName));
+ }
+ catch (Throwable e)
+ {
+ throw new AlfrescoRuntimeException("Unable to set Standard Font for PDF generation: " + fontName, e);
+ }
+ }
+
+ public void setFontSize(int fontSize)
+ {
+ try
+ {
+ transformer.setFontSize(fontSize);
+ }
+ catch (Throwable e)
+ {
+ throw new AlfrescoRuntimeException("Unable to set Font Size for PDF generation: " + fontSize);
+ }
+ }
+
+ @Override
+ public boolean isTransformable(String sourceMimetype, String targetMimetype, Map parameters)
+ {
+ boolean transformable = ( (MIMETYPE_TEXT_PLAIN.equals(sourceMimetype)
+ || MIMETYPE_TEXT_CSV.equals(sourceMimetype)
+ || MIMETYPE_DITA.equals(sourceMimetype)
+ || MIMETYPE_XML.equals(sourceMimetype) )
+ && MIMETYPE_PDF.equals(targetMimetype));
+
+ return transformable;
+ }
+
+ @Override
+ public void transform(File sourceFile, File targetFile, Map parameters) throws Exception
+ {
+ String sourceEncoding = parameters.get(SOURCE_ENCODING);
+ String stringPageLimit = parameters.get(PAGE_LIMIT);
+ int pageLimit = -1;
+ if ( stringPageLimit != null)
+ {
+ pageLimit = parseInt(stringPageLimit, PAGE_LIMIT);
+ }
+
+ PDDocument pdf = null;
+ try (InputStream is = new FileInputStream(sourceFile);
+ Reader ir = new BufferedReader(buildReader(is, sourceEncoding));
+ OutputStream os = new BufferedOutputStream(new FileOutputStream(targetFile)))
+ {
+ //TransformationOptionLimits limits = getLimits(reader, writer, options);
+ //TransformationOptionPair pageLimits = limits.getPagesPair();
+ pdf = transformer.createPDFFromText(ir, pageLimit);
+ pdf.save(os);
+ }
+ finally
+ {
+ if (pdf != null)
+ {
+ try { pdf.close(); } catch (Throwable e) {e.printStackTrace(); }
+ }
+ }
+ }
+
+ protected InputStreamReader buildReader(InputStream is, String encoding)
+ {
+ // If they gave an encoding, try to use it
+ if(encoding != null)
+ {
+ Charset charset = null;
+ try
+ {
+ charset = Charset.forName(encoding);
+ } catch(Exception e)
+ {
+ logger.warn("JVM doesn't understand encoding '" + encoding +
+ "' when transforming text to pdf");
+ }
+ if(charset != null)
+ {
+ logger.debug("Processing plain text in encoding " + charset.displayName());
+ return new InputStreamReader(is, charset);
+ }
+ }
+
+ // Fall back on the system default
+ logger.debug("Processing plain text using system default encoding");
+ return new InputStreamReader(is);
+ }
+
+ private static class PagedTextToPDF extends TextToPDF
+ {
+ // REPO-1066: duplicating the following lines from org.apache.pdfbox.tools.TextToPDF because they made them private
+ // before the upgrade to pdfbox 2.0.8, in pdfbox 1.8, this piece of code was public in org.apache.pdfbox.pdmodel.font.PDType1Font
+ static PDType1Font getStandardFont(String name) {
+ return (PDType1Font)STANDARD_14.get(name);
+ }
+ private static final Map STANDARD_14 = new HashMap();
+ static
+ {
+ STANDARD_14.put(PDType1Font.TIMES_ROMAN.getBaseFont(), PDType1Font.TIMES_ROMAN);
+ STANDARD_14.put(PDType1Font.TIMES_BOLD.getBaseFont(), PDType1Font.TIMES_BOLD);
+ STANDARD_14.put(PDType1Font.TIMES_ITALIC.getBaseFont(), PDType1Font.TIMES_ITALIC);
+ STANDARD_14.put(PDType1Font.TIMES_BOLD_ITALIC.getBaseFont(), PDType1Font.TIMES_BOLD_ITALIC);
+ STANDARD_14.put(PDType1Font.HELVETICA.getBaseFont(), PDType1Font.HELVETICA);
+ STANDARD_14.put(PDType1Font.HELVETICA_BOLD.getBaseFont(), PDType1Font.HELVETICA_BOLD);
+ STANDARD_14.put(PDType1Font.HELVETICA_OBLIQUE.getBaseFont(), PDType1Font.HELVETICA_OBLIQUE);
+ STANDARD_14.put(PDType1Font.HELVETICA_BOLD_OBLIQUE.getBaseFont(), PDType1Font.HELVETICA_BOLD_OBLIQUE);
+ STANDARD_14.put(PDType1Font.COURIER.getBaseFont(), PDType1Font.COURIER);
+ STANDARD_14.put(PDType1Font.COURIER_BOLD.getBaseFont(), PDType1Font.COURIER_BOLD);
+ STANDARD_14.put(PDType1Font.COURIER_OBLIQUE.getBaseFont(), PDType1Font.COURIER_OBLIQUE);
+ STANDARD_14.put(PDType1Font.COURIER_BOLD_OBLIQUE.getBaseFont(), PDType1Font.COURIER_BOLD_OBLIQUE);
+ STANDARD_14.put(PDType1Font.SYMBOL.getBaseFont(), PDType1Font.SYMBOL);
+ STANDARD_14.put(PDType1Font.ZAPF_DINGBATS.getBaseFont(), PDType1Font.ZAPF_DINGBATS);
+ }
+ //duplicating until here
+
+ // The following code is based on the code in TextToPDF with the addition of
+ // checks for page limits.
+ // The calling code must close the PDDocument once finished with it.
+ public PDDocument createPDFFromText(Reader text, int pageLimit)
+ throws IOException
+ {
+ //int pageLimit = (int)pageLimits.getValue();
+ PDDocument doc = null;
+ int pageCount = 0;
+ try
+ {
+ final int margin = 40;
+ float height = getFont().getFontDescriptor().getFontBoundingBox().getHeight()/1000;
+
+ //calculate font height and increase by 5 percent.
+ height = height*getFontSize()*1.05f;
+ doc = new PDDocument();
+ BufferedReader data = new BufferedReader( text );
+ String nextLine = null;
+ PDPage page = new PDPage();
+ PDPageContentStream contentStream = null;
+ float y = -1;
+ float maxStringLength = page.getMediaBox().getWidth() - 2*margin;
+
+ // There is a special case of creating a PDF document from an empty string.
+ boolean textIsEmpty = true;
+
+ outer:
+ while( (nextLine = data.readLine()) != null )
+ {
+
+ // The input text is nonEmpty. New pages will be created and added
+ // to the PDF document as they are needed, depending on the length of
+ // the text.
+ textIsEmpty = false;
+
+ String[] lineWords = nextLine.trim().split( " " );
+ int lineIndex = 0;
+ while( lineIndex < lineWords.length )
+ {
+ StringBuffer nextLineToDraw = new StringBuffer();
+ float lengthIfUsingNextWord = 0;
+ do
+ {
+ nextLineToDraw.append( lineWords[lineIndex] );
+ nextLineToDraw.append( " " );
+ lineIndex++;
+ if( lineIndex < lineWords.length )
+ {
+ String lineWithNextWord = nextLineToDraw.toString() + lineWords[lineIndex];
+ lengthIfUsingNextWord =
+ (getFont().getStringWidth( lineWithNextWord )/1000) * getFontSize();
+ }
+ }
+ while( lineIndex < lineWords.length &&
+ lengthIfUsingNextWord < maxStringLength );
+ if( y < margin )
+ {
+ int test = pageCount +1;
+ if (pageLimit > 0 && (pageCount++ >= pageLimit))
+ {
+// pageLimits.getAction().throwIOExceptionIfRequired("Page limit ("+pageLimit+
+// ") reached.", transformerDebug);
+ break outer;
+ }
+
+ // We have crossed the end-of-page boundary and need to extend the
+ // document by another page.
+ page = new PDPage();
+ doc.addPage( page );
+ if( contentStream != null )
+ {
+ contentStream.endText();
+ contentStream.close();
+ }
+ contentStream = new PDPageContentStream(doc, page);
+ contentStream.setFont(getFont(), getFontSize());
+ contentStream.beginText();
+ y = page.getMediaBox().getHeight() - margin + height;
+ contentStream.moveTextPositionByAmount(
+ margin, y );
+ }
+ //System.out.println( "Drawing string at " + x + "," + y );
+
+ if( contentStream == null )
+ {
+ throw new IOException( "Error:Expected non-null content stream." );
+ }
+ contentStream.moveTextPositionByAmount( 0, -height);
+ y -= height;
+ contentStream.drawString( nextLineToDraw.toString() );
+ }
+ }
+
+ // If the input text was the empty string, then the above while loop will have short-circuited
+ // and we will not have added any PDPages to the document.
+ // So in order to make the resultant PDF document readable by Adobe Reader etc, we'll add an empty page.
+ if (textIsEmpty)
+ {
+ doc.addPage(page);
+ }
+
+ if( contentStream != null )
+ {
+ contentStream.endText();
+ contentStream.close();
+ }
+ }
+ catch( IOException io )
+ {
+ if( doc != null )
+ {
+ doc.close();
+ }
+ throw io;
+ }
+ return doc;
+ }
+ }
+
+ private int parseInt(String s, String paramName)
+ {
+ try
+ {
+ return Integer.valueOf(s);
+ }
+ catch (NumberFormatException e)
+ {
+ throw new IllegalArgumentException(paramName + " parameter must be an integer.");
+ }
+ }
+}
diff --git a/alfresco-docker-transform-misc/src/main/resources/application-default.yaml b/alfresco-docker-transform-misc/src/main/resources/application-default.yaml
new file mode 100644
index 00000000..c0a793ba
--- /dev/null
+++ b/alfresco-docker-transform-misc/src/main/resources/application-default.yaml
@@ -0,0 +1,2 @@
+queue:
+ engineRequestQueue: ${TRANSFORM_ENGINE_REQUEST_QUEUE:org.alfresco.transform.engine.misc.acs}
\ No newline at end of file
diff --git a/alfresco-docker-transform-misc/src/main/resources/engine_config.json b/alfresco-docker-transform-misc/src/main/resources/engine_config.json
new file mode 100644
index 00000000..423d6a6a
--- /dev/null
+++ b/alfresco-docker-transform-misc/src/main/resources/engine_config.json
@@ -0,0 +1,65 @@
+{
+ "transformOptions": {
+ "textToPdfOptions": [
+ {"value": {"name": "pageLimit"}},
+ {"value": {"name": "sourceEncoding"}}
+ ],
+ "stringOptions": [
+ {"value": {"name": "sourceEncoding"}},
+ {"value": {"name": "targetEncoding"}}
+ ],
+ "htmlOptions": [
+ {"value": {"name": "sourceEncoding"}}
+ ]
+ },
+ "transformers": [
+ {
+ "transformerName": "html",
+ "supportedSourceAndTargetList": [
+ {"sourceMediaType": "text/html", "targetMediaType": "text/plain"}
+ ],
+ "transformOptions": [
+ "htmlOptions"
+ ]
+ },
+ {
+ "transformerName": "string",
+ "supportedSourceAndTargetList": [
+ {"sourceMediaType": "text/plain", "targetMediaType": "text/plain"},
+ {"sourceMediaType": "text/mediawiki", "targetMediaType": "text/plain"},
+ {"sourceMediaType": "text/css", "targetMediaType": "text/plain"},
+ {"sourceMediaType": "text/csv", "targetMediaType": "text/plain"},
+ {"sourceMediaType": "text/javascript", "targetMediaType": "text/plain"},
+ {"sourceMediaType": "text/xml", "targetMediaType": "text/plain"},
+ {"sourceMediaType": "text/html", "targetMediaType": "text/plain"},
+ {"sourceMediaType": "application/x-javascript", "targetMediaType": "text/plain"},
+ {"sourceMediaType": "application/dita+xml", "targetMediaType": "text/plain"}
+ ],
+ "transformOptions": [
+ "stringOptions"
+ ]
+ },
+ {
+ "transformerName": "appleIWorks",
+ "supportedSourceAndTargetList": [
+ {"sourceMediaType": "application/vnd.apple.keynote", "targetMediaType": "image/jpeg"},
+ {"sourceMediaType": "application/vnd.apple.numbers", "targetMediaType": "image/jpeg"},
+ {"sourceMediaType": "application/vnd.apple.pages", "targetMediaType": "image/jpeg"}
+ ],
+ "transformOptions": [
+ ]
+ },
+ {
+ "transformerName": "textToPdf",
+ "supportedSourceAndTargetList": [
+ {"sourceMediaType": "text/plain", "targetMediaType": "application/pdf"},
+ {"sourceMediaType": "text/csv", "targetMediaType": "application/pdf"},
+ {"sourceMediaType": "application/dita+xml", "targetMediaType": "application/pdf"},
+ {"sourceMediaType": "text/xml", "targetMediaType": "application/pdf"}
+ ],
+ "transformOptions": [
+ "textToPdfOptions"
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/alfresco-docker-transform-misc/src/main/resources/quick.html b/alfresco-docker-transform-misc/src/main/resources/quick.html
new file mode 100644
index 00000000..76c633d7
--- /dev/null
+++ b/alfresco-docker-transform-misc/src/main/resources/quick.html
@@ -0,0 +1,17 @@
+
+
+
+
+ The quick brown fox jumps over the lazy dog
+
+
+
+
+
+
+
+The quick brown fox jumps over the lazy dog
+
+
+
+
diff --git a/alfresco-docker-transform-misc/src/main/resources/templates/transformForm.html b/alfresco-docker-transform-misc/src/main/resources/templates/transformForm.html
new file mode 100644
index 00000000..59097697
--- /dev/null
+++ b/alfresco-docker-transform-misc/src/main/resources/templates/transformForm.html
@@ -0,0 +1,29 @@
+
+
+
+
+
Miscellaneous Transformers Test Transformation
+
+
+
+
+
+
+
diff --git a/alfresco-docker-transform-misc/src/test/java/org/alfresco/transformer/MiscControllerTest.java b/alfresco-docker-transform-misc/src/test/java/org/alfresco/transformer/MiscControllerTest.java
new file mode 100644
index 00000000..66d63619
--- /dev/null
+++ b/alfresco-docker-transform-misc/src/test/java/org/alfresco/transformer/MiscControllerTest.java
@@ -0,0 +1,294 @@
+/*
+ * #%L
+ * Alfresco Transform Core
+ * %%
+ * Copyright (C) 2005 - 2019 Alfresco Software Limited
+ * %%
+ * This file is part of the Alfresco software.
+ * -
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ * -
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * -
+ * Alfresco is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ * -
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
+ * #L%
+ */
+package org.alfresco.transformer;
+
+import org.alfresco.error.AlfrescoRuntimeException;
+import org.alfresco.transform.client.model.TransformRequest;
+import org.alfresco.transformer.transformers.AppleIWorksContentTransformer;
+import org.alfresco.transformer.transformers.HtmlParserContentTransformer;
+import org.alfresco.transformer.transformers.SelectingTransformer;
+import org.alfresco.transformer.transformers.StringExtractingContentTransformer;
+import org.alfresco.transformer.transformers.TextToPdfContentTransformer;
+import org.apache.pdfbox.pdmodel.PDDocument;
+import org.apache.pdfbox.text.PDFTextStripper;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
+import org.springframework.context.annotation.Import;
+import org.springframework.mock.web.MockMultipartFile;
+import org.springframework.test.context.junit4.SpringRunner;
+import org.springframework.test.web.servlet.MvcResult;
+import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder;
+
+import java.io.IOException;
+import java.io.StringWriter;
+import java.io.UnsupportedEncodingException;
+
+import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_HTML;
+import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_IMAGE_JPEG;
+import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_IWORK_KEYNOTE;
+import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_IWORK_NUMBERS;
+import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_IWORK_PAGES;
+import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_OPENXML_WORDPROCESSING;
+import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_PDF;
+import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_TEXT_PLAIN;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.springframework.http.HttpStatus.OK;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
+
+@RunWith(SpringRunner.class)
+@WebMvcTest(MiscController.class)
+@Import({SelectingTransformer.class})
+public class MiscControllerTest extends AbstractTransformerControllerTest
+{
+
+ @Autowired
+ private MiscController controller;
+
+ private String sourceEncoding = "UTF-8";
+ private String targetEncoding = "UTF-8";
+ private String targetMimetype = MIMETYPE_TEXT_PLAIN;
+
+ @Before
+ public void before() throws Exception
+ {
+ sourceMimetype = MIMETYPE_HTML;
+ sourceExtension = "html";
+ targetExtension = "txt";
+ expectedOptions = null;
+ expectedSourceSuffix = null;
+ expectedSourceFileBytes = readTestFile(sourceExtension);
+ expectedTargetFileBytes = readTestFile(targetExtension);
+ //expectedTargetFileBytes = null;
+ sourceFile = new MockMultipartFile("file", "quick." + sourceExtension, sourceMimetype, expectedSourceFileBytes);
+
+ }
+
+ @Override
+ protected void mockTransformCommand(String sourceExtension, String targetExtension, String sourceMimetype, boolean readTargetFileBytes) throws IOException
+ {
+ }
+
+ @Override
+ protected AbstractTransformerController getController()
+ {
+ return controller;
+ }
+
+ @Override
+ protected void updateTransformRequestWithSpecificOptions(TransformRequest transformRequest)
+ {
+ }
+
+ @Override
+ // Add extra required parameters to the request.
+ protected MockHttpServletRequestBuilder mockMvcRequest(String url, MockMultipartFile sourceFile, String... params)
+ {
+ return super.mockMvcRequest(url, sourceFile, params)
+ .param("targetEncoding", targetEncoding)
+ .param("sourceEncoding", sourceEncoding)
+ .param("targetMimetype", targetMimetype)
+ .param("sourceMimetype", sourceMimetype);
+ }
+
+ @Test
+ @Override
+ public void noTargetFileTest()
+ {
+ // Ignore the test in super class as the Misc transforms are real rather than mocked up.
+ // It is the mock that returns a zero length file for other transformers, when we supply an invalid targetExtension.
+ }
+
+ @Test
+ public void testHTMLtoString() throws Exception
+ {
+ final String NEWLINE = System.getProperty ("line.separator");
+ final String TITLE = "Testing!";
+ final String TEXT_P1 = "This is some text in English";
+ final String TEXT_P2 = "This is more text in English";
+ final String TEXT_P3 = "C'est en Fran\u00e7ais et Espa\u00f1ol";
+ String partA = "" + TITLE + "" + NEWLINE;
+ String partB = "" + TEXT_P1 + "
" + NEWLINE +
+ "" + TEXT_P2 + "
" + NEWLINE +
+ "" + TEXT_P3 + "
" + NEWLINE;
+ String partC = "";
+ final String expected = TITLE + NEWLINE + TEXT_P1 + NEWLINE + TEXT_P2 + NEWLINE + TEXT_P3 + NEWLINE;
+
+ MvcResult result = sendText("html",
+ "UTF-8",
+ MIMETYPE_HTML,
+ "txt",
+ MIMETYPE_TEXT_PLAIN,
+ "UTF-8",
+ expected.getBytes());
+
+ String contentResult = new String(result.getResponse().getContentAsByteArray(), targetEncoding);
+ assertTrue("The content did not include \""+expected, contentResult.contains(expected));
+ }
+
+ @Test
+ public void testStringtoString() throws Exception
+ {
+ String expected = null;
+ byte[] content = null;
+ try
+ {
+ content = "azAz10!�$%^&*()\t\r\n".getBytes("UTF-8");
+ expected = new String(content, "MacDingbat");
+ }
+ catch (UnsupportedEncodingException e)
+ {
+ throw new AlfrescoRuntimeException("Encoding not recognised", e);
+ }
+
+ MvcResult result = sendText("txt",
+ "MacDingbat",
+ MIMETYPE_TEXT_PLAIN,
+ "txt",
+ MIMETYPE_TEXT_PLAIN,
+ "UTF-8",
+ content);
+
+ String contentResult = new String(result.getResponse().getContentAsByteArray(), targetEncoding);
+ assertTrue("The content did not include \""+expected, contentResult.contains(expected));
+ }
+
+ @Test
+ public void textToPdf() throws Exception
+ {
+ StringBuilder sb = new StringBuilder();
+ String expected = null;
+ for (int i=1; i<=5; i++)
+ {
+ sb.append(i);
+ sb.append(" I must not talk in class or feed my homework to my cat.\n");
+ }
+ sb.append("\nBart\n");
+ expected = sb.toString();
+
+ MvcResult result = sendText("txt",
+ "UTF-8",
+ MIMETYPE_TEXT_PLAIN,
+ "pdf",
+ MIMETYPE_PDF,
+ "UTF-8",
+ expected.getBytes());
+
+ // Read back in the PDF and check it
+ PDDocument doc = PDDocument.load(result.getResponse().getContentAsByteArray());
+ PDFTextStripper textStripper = new PDFTextStripper();
+ StringWriter textWriter = new StringWriter();
+ textStripper.writeText(doc, textWriter);
+ doc.close();
+
+ expected = clean(expected);
+ String actual = clean(textWriter.toString());
+
+ assertEquals("The content did not match.", expected, actual);
+ }
+
+ @Test
+ public void testAppleIWorksPages() throws Exception
+ {
+ imageBasedTransform("pages", MIMETYPE_IWORK_PAGES, MIMETYPE_IMAGE_JPEG, "jpeg");
+ }
+
+ @Test
+ public void testAppleIWorksNumbers() throws Exception
+ {
+ imageBasedTransform("numbers", MIMETYPE_IWORK_NUMBERS, MIMETYPE_IMAGE_JPEG, "jpeg");
+ }
+
+ @Test
+ public void testAppleIWorksKey() throws Exception
+ {
+ imageBasedTransform("key", MIMETYPE_IWORK_KEYNOTE, MIMETYPE_IMAGE_JPEG, "jpeg");
+ }
+
+ // TODO Doesn't wotk with java 11, enable when fixed
+// @Test
+ public void testOOXML() throws Exception
+ {
+ imageBasedTransform("docx", MIMETYPE_OPENXML_WORDPROCESSING, MIMETYPE_IMAGE_JPEG, "jpeg");
+ }
+
+ private void imageBasedTransform(String sourceExtension, String sourceMimetype, String targetMimetype, String targetExtension) throws Exception
+ {
+ MockMultipartFile sourceFilex = new MockMultipartFile("file", "test_file." + sourceExtension, sourceMimetype, readTestFile(sourceExtension));
+
+ MockHttpServletRequestBuilder requestBuilder = super.mockMvcRequest("/transform", sourceFilex)
+ .param("targetExtension", "jpeg")
+ .param("targetMimetype", targetMimetype)
+ .param("sourceMimetype", sourceMimetype);
+
+ MvcResult result = mockMvc.perform(requestBuilder)
+ .andExpect(status().is(OK.value()))
+ .andExpect(header().string("Content-Disposition", "attachment; filename*= UTF-8''test_file." + targetExtension))
+ .andReturn();
+ assertTrue("Expected image content but content is empty.",result.getResponse().getContentLengthLong() > 0L);
+ }
+
+
+ private MvcResult sendText(String sourceExtension,
+ String sourceEncoding,
+ String sourceMimetype,
+ String targetExtension,
+ String targetMimetype,
+ String targetEncoding,
+ byte[] content) throws Exception
+ {
+ MockMultipartFile sourceFilex = new MockMultipartFile("file", "test_file." + sourceExtension, sourceMimetype, content);
+
+ MockHttpServletRequestBuilder requestBuilder = super.mockMvcRequest("/transform", sourceFilex)
+ .param("targetExtension", targetExtension)
+ .param("targetEncoding", targetEncoding)
+ .param("targetMimetype", targetMimetype)
+ .param("sourceEncoding", sourceEncoding)
+ .param("sourceMimetype", sourceMimetype);
+
+
+ MvcResult result = mockMvc.perform(requestBuilder)
+ .andExpect(status().is(OK.value()))
+ .andExpect(header().string("Content-Disposition", "attachment; filename*= "+targetEncoding+"''test_file." + targetExtension)).
+ andReturn();
+ return result;
+ }
+
+ private String clean(String text)
+ {
+ text = text.replaceAll("\\s+\\r", "");
+ text = text.replaceAll("\\s+\\n", "");
+ text = text.replaceAll("\\r", "");
+ text = text.replaceAll("\\n", "");
+ return text;
+ }
+
+}
\ No newline at end of file
diff --git a/alfresco-docker-transform-misc/src/test/java/org/alfresco/transformer/MiscQueueTransformServiceIT.java b/alfresco-docker-transform-misc/src/test/java/org/alfresco/transformer/MiscQueueTransformServiceIT.java
new file mode 100644
index 00000000..c78c5817
--- /dev/null
+++ b/alfresco-docker-transform-misc/src/test/java/org/alfresco/transformer/MiscQueueTransformServiceIT.java
@@ -0,0 +1,56 @@
+/*
+ * #%L
+ * Alfresco Transform Core
+ * %%
+ * Copyright (C) 2005 - 2019 Alfresco Software Limited
+ * %%
+ * This file is part of the Alfresco software.
+ * -
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ * -
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * -
+ * Alfresco is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ * -
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
+ * #L%
+ */
+package org.alfresco.transformer;
+
+import org.alfresco.transform.client.model.TransformRequest;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import java.util.UUID;
+
+import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_HTML;
+import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_TEXT_PLAIN;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+public class MiscQueueTransformServiceIT extends AbstractQueueTransformServiceIT
+{
+ @Override
+ protected TransformRequest buildRequest()
+ {
+ return TransformRequest.builder()
+ .withRequestId(UUID.randomUUID().toString())
+ .withSourceMediaType(MIMETYPE_HTML)
+ .withTargetMediaType(MIMETYPE_TEXT_PLAIN)
+ .withTargetExtension("txt")
+ .withSchema(1)
+ .withClientData("ACS")
+ .withSourceReference(UUID.randomUUID().toString())
+ .withSourceSize(32L).build();
+ }
+}
diff --git a/alfresco-docker-transform-misc/src/test/java/org/alfresco/transformer/MiscTransformerHttpRequestTest.java b/alfresco-docker-transform-misc/src/test/java/org/alfresco/transformer/MiscTransformerHttpRequestTest.java
new file mode 100644
index 00000000..3d18f2ca
--- /dev/null
+++ b/alfresco-docker-transform-misc/src/test/java/org/alfresco/transformer/MiscTransformerHttpRequestTest.java
@@ -0,0 +1,48 @@
+/*
+ * #%L
+ * Alfresco Transform Core
+ * %%
+ * Copyright (C) 2005 - 2019 Alfresco Software Limited
+ * %%
+ * This file is part of the Alfresco software.
+ * -
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ * -
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * -
+ * Alfresco is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ * -
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
+ * #L%
+ */
+package org.alfresco.transformer;
+
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+public class MiscTransformerHttpRequestTest extends AbstractHttpRequestTest
+{
+ @Override
+ protected String getTransformerName()
+ {
+ return "Miscellaneous Transformers";
+ }
+
+ @Override
+ protected String getSourceExtension()
+ {
+ return "html";
+ }
+}
diff --git a/alfresco-docker-transform-misc/src/test/java/org/alfresco/transformer/transformers/HtmlParserContentTransformerTest.java b/alfresco-docker-transform-misc/src/test/java/org/alfresco/transformer/transformers/HtmlParserContentTransformerTest.java
new file mode 100644
index 00000000..0bab9bf8
--- /dev/null
+++ b/alfresco-docker-transform-misc/src/test/java/org/alfresco/transformer/transformers/HtmlParserContentTransformerTest.java
@@ -0,0 +1,173 @@
+/*
+ * #%L
+ * Alfresco Transform Core
+ * %%
+ * Copyright (C) 2005 - 2019 Alfresco Software Limited
+ * %%
+ * This file is part of the Alfresco software.
+ * -
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ * -
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * -
+ * Alfresco is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ * -
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
+ * #L%
+ */
+package org.alfresco.transformer.transformers;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.mock.mockito.MockBean;
+import org.springframework.context.annotation.Import;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.OutputStreamWriter;
+import java.nio.file.Files;
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.alfresco.transformer.transformers.StringExtractingContentTransformer.SOURCE_ENCODING;
+import static org.alfresco.transformer.transformers.StringExtractingContentTransformer.TARGET_ENCODING;
+import static org.junit.Assert.*;
+
+@RunWith(SpringRunner.class)
+@Import(HtmlParserContentTransformer.class)
+public class HtmlParserContentTransformerTest
+{
+ @Autowired
+ HtmlParserContentTransformer transformer;
+
+ /**
+ * Checks that we correctly handle text in different encodings,
+ * no matter if the encoding is specified on the Content Property
+ * or in a meta tag within the HTML itself. (ALF-10466)
+ *
+ * On Windows, org.htmlparser.beans.StringBean.carriageReturn() appends a new system dependent new line
+ * so we must be careful when checking the returned text
+ */
+ @Test
+ public void testEncodingHandling() throws Exception
+ {
+ final String NEWLINE = System.getProperty ("line.separator");
+ final String TITLE = "Testing!";
+ final String TEXT_P1 = "This is some text in English";
+ final String TEXT_P2 = "This is more text in English";
+ final String TEXT_P3 = "C'est en Fran\u00e7ais et Espa\u00f1ol";
+ String partA = "" + TITLE + "" + NEWLINE;
+ String partB = "" + TEXT_P1 + "
" + NEWLINE +
+ "" + TEXT_P2 + "
" + NEWLINE +
+ "" + TEXT_P3 + "
" + NEWLINE;
+ String partC = "";
+ final String expected = TITLE + NEWLINE + TEXT_P1 + NEWLINE + TEXT_P2 + NEWLINE + TEXT_P3 + NEWLINE;
+
+ File tmpS = null;
+ File tmpD = null;
+
+ try
+ {
+ // Content set to ISO 8859-1
+ tmpS = File.createTempFile("AlfrescoTestSource_", ".html");
+ writeToFile(tmpS, partA+partB+partC, "ISO-8859-1");
+
+ tmpD = File.createTempFile("AlfrescoTestTarget_", ".txt");
+
+ Map parameters = new HashMap<>();
+ parameters.put(SOURCE_ENCODING, "ISO-8859-1");
+ transformer.transform(tmpS, tmpD, parameters);
+
+ assertEquals(expected, readFromFile(tmpD, "UTF-8"));
+ tmpS.delete();
+ tmpD.delete();
+
+ // Content set to UTF-8
+ tmpS = File.createTempFile("AlfrescoTestSource_", ".html");
+ writeToFile(tmpS, partA+partB+partC, "UTF-8");
+
+ tmpD = File.createTempFile("AlfrescoTestTarget_", ".txt");
+ parameters = new HashMap<>();
+ parameters.put(SOURCE_ENCODING, "UTF-8");
+ transformer.transform(tmpS, tmpD, parameters);
+ assertEquals(expected, readFromFile(tmpD, "UTF-8"));
+ tmpS.delete();
+ tmpD.delete();
+
+
+ // Content set to UTF-16
+ tmpS = File.createTempFile("AlfrescoTestSource_", ".html");
+ writeToFile(tmpS, partA+partB+partC, "UTF-16");
+
+ tmpD = File.createTempFile("AlfrescoTestTarget_", ".txt");
+ parameters = new HashMap<>();
+ parameters.put(SOURCE_ENCODING, "UTF-16");
+ transformer.transform(tmpS, tmpD, parameters);
+ assertEquals(expected, readFromFile(tmpD, "UTF-8"));
+ tmpS.delete();
+ tmpD.delete();
+
+ // Note - since HTML Parser 2.0 META tags specifying the
+ // document encoding will ONLY be respected if the original
+ // content type was set to ISO-8859-1.
+ //
+ // This means there is now only one test which we can perform
+ // to ensure that this now-limited overriding of the encoding
+ // takes effect.
+
+ // Content set to ISO 8859-1, meta set to UTF-8
+ tmpS = File.createTempFile("AlfrescoTestSource_", ".html");
+ String str = partA+
+ "" +
+ partB+partC;
+
+ writeToFile(tmpS, str, "UTF-8");
+
+ tmpD = File.createTempFile("AlfrescoTestTarget_", ".txt");
+
+ parameters = new HashMap<>();
+ parameters.put(SOURCE_ENCODING, "ISO-8859-1");
+ transformer.transform(tmpS, tmpD, parameters);
+ assertEquals(expected, readFromFile(tmpD, "UTF-8"));
+ tmpS.delete();
+ tmpD.delete();
+
+
+ // Note - we can't test UTF-16 with only a meta encoding,
+ // because without that the parser won't know about the
+ // 2 byte format so won't be able to identify the meta tag
+ }
+ finally
+ {
+ if (tmpS != null && tmpS.exists()) tmpS.delete();
+ if (tmpD != null && tmpD.exists()) tmpD.delete();
+ }
+ }
+
+ private void writeToFile(File file, String content, String encoding) throws Exception
+ {
+ try (OutputStreamWriter ow = new OutputStreamWriter(new FileOutputStream(file), encoding))
+ {
+ ow.append(content);
+ }
+ }
+
+ private String readFromFile(File file, String encoding) throws Exception
+ {
+ String content = "wrong content";
+ content = new String(Files.readAllBytes(file.toPath()), encoding);
+ return content;
+ }
+}
\ No newline at end of file
diff --git a/alfresco-docker-transform-misc/src/test/java/org/alfresco/transformer/transformers/TextToPdfContentTransformerTest.java b/alfresco-docker-transform-misc/src/test/java/org/alfresco/transformer/transformers/TextToPdfContentTransformerTest.java
new file mode 100644
index 00000000..3623628c
--- /dev/null
+++ b/alfresco-docker-transform-misc/src/test/java/org/alfresco/transformer/transformers/TextToPdfContentTransformerTest.java
@@ -0,0 +1,157 @@
+/*
+ * #%L
+ * Alfresco Transform Core
+ * %%
+ * Copyright (C) 2005 - 2019 Alfresco Software Limited
+ * %%
+ * This file is part of the Alfresco software.
+ * -
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ * -
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * -
+ * Alfresco is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ * -
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
+ * #L%
+ */
+package org.alfresco.transformer.transformers;
+
+import org.apache.pdfbox.pdmodel.PDDocument;
+import org.apache.pdfbox.text.PDFTextStripper;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.mock.mockito.MockBean;
+import org.springframework.context.annotation.Import;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.OutputStreamWriter;
+import java.io.StringWriter;
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.alfresco.transformer.transformers.TextToPdfContentTransformer.PAGE_LIMIT;
+import static org.junit.Assert.*;
+
+@RunWith(SpringRunner.class)
+@Import(TextToPdfContentTransformer.class)
+public class TextToPdfContentTransformerTest
+{
+ @Autowired
+ TextToPdfContentTransformer transformer;
+
+ @Before
+ public void setUp()
+ {
+ transformer.setStandardFont("Times-Roman");
+ transformer.setFontSize(20);
+ }
+
+
+ @Test
+ public void testUnlimitedPages() throws Exception
+ {
+ transformTextAndCheckPageLength(-1);
+ }
+
+ @Test
+ public void testLimitedTo1Page() throws Exception
+ {
+ transformTextAndCheckPageLength(1);
+ }
+
+ @Test
+ public void testLimitedTo2Pages() throws Exception
+ {
+ transformTextAndCheckPageLength(2);
+ }
+
+ @Test
+ public void testLimitedTo50Pages() throws Exception
+ {
+ transformTextAndCheckPageLength(50);
+ }
+
+ private void transformTextAndCheckPageLength(int pageLimit) throws Exception
+ {
+ int pageLength = 32;
+ int lines = (pageLength+10) * ((pageLimit > 0) ? pageLimit : 1);
+ StringBuilder sb = new StringBuilder();
+ String checkText = null;
+ int cutoff = pageLimit * pageLength;
+ for (int i=1; i<=lines; i++)
+ {
+ sb.append(i);
+ sb.append(" I must not talk in class or feed my homework to my cat.\n");
+ if (i == cutoff)
+ checkText = sb.toString();
+ }
+ sb.append("\nBart\n");
+ String text = sb.toString();
+ checkText = (checkText == null) ? clean(text) : clean(checkText);
+ transformTextAndCheck(text, "UTF-8", checkText, String.valueOf(pageLimit));
+ }
+
+ private void transformTextAndCheck(String text, String encoding, String checkText, String pageLimit) throws Exception
+ {
+ // Get a reader for the text
+ File sourceFile = File.createTempFile("AlfrescoTestSource_", ".txt");
+ writeToFile(sourceFile,text, encoding);
+
+
+ // And a temp writer
+ File targetFile = File.createTempFile("AlfrescoTestTarget_", ".pdf");
+
+ // Transform to PDF
+ Map parameters = new HashMap<>();
+ parameters.put(PAGE_LIMIT, pageLimit);
+ transformer.transform(sourceFile, targetFile, parameters);
+
+ // Read back in the PDF and check it
+ PDDocument doc = PDDocument.load(targetFile);
+ PDFTextStripper textStripper = new PDFTextStripper();
+ StringWriter textWriter = new StringWriter();
+ textStripper.writeText(doc, textWriter);
+ doc.close();
+
+ String roundTrip = clean(textWriter.toString());
+
+ assertEquals(
+ "Incorrect text in PDF when starting from text in " + encoding,
+ checkText, roundTrip
+ );
+
+ sourceFile.delete();
+ targetFile.delete();
+ }
+
+ private String clean(String text)
+ {
+ text = text.replaceAll("\\s+\\r", "");
+ text = text.replaceAll("\\s+\\n", "");
+ text = text.replaceAll("\\r", "");
+ text = text.replaceAll("\\n", "");
+ return text;
+ }
+
+ private void writeToFile(File file, String content, String encoding) throws Exception
+ {
+ try (OutputStreamWriter ow = new OutputStreamWriter(new FileOutputStream(file), encoding))
+ {
+ ow.append(content);
+ }
+ }
+}
diff --git a/alfresco-docker-transform-misc/src/test/resources/quick.docx b/alfresco-docker-transform-misc/src/test/resources/quick.docx
new file mode 100644
index 00000000..cd28e0a1
Binary files /dev/null and b/alfresco-docker-transform-misc/src/test/resources/quick.docx differ
diff --git a/alfresco-docker-transform-misc/src/test/resources/quick.key b/alfresco-docker-transform-misc/src/test/resources/quick.key
new file mode 100644
index 00000000..372c688c
Binary files /dev/null and b/alfresco-docker-transform-misc/src/test/resources/quick.key differ
diff --git a/alfresco-docker-transform-misc/src/test/resources/quick.numbers b/alfresco-docker-transform-misc/src/test/resources/quick.numbers
new file mode 100644
index 00000000..7e58c11f
Binary files /dev/null and b/alfresco-docker-transform-misc/src/test/resources/quick.numbers differ
diff --git a/alfresco-docker-transform-misc/src/test/resources/quick.pages b/alfresco-docker-transform-misc/src/test/resources/quick.pages
new file mode 100644
index 00000000..33ccef34
Binary files /dev/null and b/alfresco-docker-transform-misc/src/test/resources/quick.pages differ
diff --git a/alfresco-docker-transform-misc/src/test/resources/quick.txt b/alfresco-docker-transform-misc/src/test/resources/quick.txt
new file mode 100644
index 00000000..7ba3eb13
--- /dev/null
+++ b/alfresco-docker-transform-misc/src/test/resources/quick.txt
@@ -0,0 +1,18 @@
+
+
+
+
+
+The quick brown fox jumps over the lazy dog
+
+
+
+
+
+
+
+The quick brown fox jumps over the lazy dog
+
+
+
+
diff --git a/alfresco-transformer-base/src/main/java/org/alfresco/transformer/AbstractTransformerController.java b/alfresco-transformer-base/src/main/java/org/alfresco/transformer/AbstractTransformerController.java
index ae378a10..46b048ad 100644
--- a/alfresco-transformer-base/src/main/java/org/alfresco/transformer/AbstractTransformerController.java
+++ b/alfresco-transformer-base/src/main/java/org/alfresco/transformer/AbstractTransformerController.java
@@ -4,19 +4,24 @@
* %%
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
+ * This file is part of the Alfresco software.
+ * -
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ * -
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * -
+ * Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * .
+ * GNU Lesser General Public License for more details.
+ * -
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
* #L%
*/
package org.alfresco.transformer;
diff --git a/alfresco-transformer-base/src/main/java/org/alfresco/transformer/QueueTransformService.java b/alfresco-transformer-base/src/main/java/org/alfresco/transformer/QueueTransformService.java
index f57392ab..80a658b0 100644
--- a/alfresco-transformer-base/src/main/java/org/alfresco/transformer/QueueTransformService.java
+++ b/alfresco-transformer-base/src/main/java/org/alfresco/transformer/QueueTransformService.java
@@ -4,19 +4,24 @@
* %%
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
+ * This file is part of the Alfresco software.
+ * -
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ * -
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * -
+ * Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * .
+ * GNU Lesser General Public License for more details.
+ * -
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
* #L%
*/
package org.alfresco.transformer;
diff --git a/alfresco-transformer-base/src/main/java/org/alfresco/transformer/TransformController.java b/alfresco-transformer-base/src/main/java/org/alfresco/transformer/TransformController.java
index 33d0665c..36cc4865 100644
--- a/alfresco-transformer-base/src/main/java/org/alfresco/transformer/TransformController.java
+++ b/alfresco-transformer-base/src/main/java/org/alfresco/transformer/TransformController.java
@@ -4,19 +4,24 @@
* %%
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
+ * This file is part of the Alfresco software.
+ * -
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ * -
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * -
+ * Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * .
+ * GNU Lesser General Public License for more details.
+ * -
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
* #L%
*/
package org.alfresco.transformer;
diff --git a/alfresco-transformer-base/src/main/java/org/alfresco/transformer/TransformInterceptor.java b/alfresco-transformer-base/src/main/java/org/alfresco/transformer/TransformInterceptor.java
index 14797bdd..08516f61 100644
--- a/alfresco-transformer-base/src/main/java/org/alfresco/transformer/TransformInterceptor.java
+++ b/alfresco-transformer-base/src/main/java/org/alfresco/transformer/TransformInterceptor.java
@@ -4,19 +4,24 @@
* %%
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
+ * This file is part of the Alfresco software.
+ * -
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ * -
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * -
+ * Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * .
+ * GNU Lesser General Public License for more details.
+ * -
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
* #L%
*/
package org.alfresco.transformer;
diff --git a/alfresco-transformer-base/src/main/java/org/alfresco/transformer/clients/AlfrescoSharedFileStoreClient.java b/alfresco-transformer-base/src/main/java/org/alfresco/transformer/clients/AlfrescoSharedFileStoreClient.java
index b0567c61..9c93f2ac 100644
--- a/alfresco-transformer-base/src/main/java/org/alfresco/transformer/clients/AlfrescoSharedFileStoreClient.java
+++ b/alfresco-transformer-base/src/main/java/org/alfresco/transformer/clients/AlfrescoSharedFileStoreClient.java
@@ -4,19 +4,24 @@
* %%
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
+ * This file is part of the Alfresco software.
+ * -
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ * -
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * -
+ * Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * .
+ * GNU Lesser General Public License for more details.
+ * -
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
* #L%
*/
package org.alfresco.transformer.clients;
diff --git a/alfresco-transformer-base/src/main/java/org/alfresco/transformer/config/WebApplicationConfig.java b/alfresco-transformer-base/src/main/java/org/alfresco/transformer/config/WebApplicationConfig.java
index 05e34c11..3efa00b3 100644
--- a/alfresco-transformer-base/src/main/java/org/alfresco/transformer/config/WebApplicationConfig.java
+++ b/alfresco-transformer-base/src/main/java/org/alfresco/transformer/config/WebApplicationConfig.java
@@ -4,19 +4,24 @@
* %%
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
+ * This file is part of the Alfresco software.
+ * -
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ * -
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * -
+ * Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * .
+ * GNU Lesser General Public License for more details.
+ * -
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
* #L%
*/
package org.alfresco.transformer.config;
diff --git a/alfresco-transformer-base/src/main/java/org/alfresco/transformer/executors/AbstractCommandExecutor.java b/alfresco-transformer-base/src/main/java/org/alfresco/transformer/executors/AbstractCommandExecutor.java
index de7f83fb..81610a64 100644
--- a/alfresco-transformer-base/src/main/java/org/alfresco/transformer/executors/AbstractCommandExecutor.java
+++ b/alfresco-transformer-base/src/main/java/org/alfresco/transformer/executors/AbstractCommandExecutor.java
@@ -4,19 +4,24 @@
* %%
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
+ * This file is part of the Alfresco software.
+ * -
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ * -
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * -
+ * Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * .
+ * GNU Lesser General Public License for more details.
+ * -
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
* #L%
*/
package org.alfresco.transformer.executors;
diff --git a/alfresco-transformer-base/src/main/java/org/alfresco/transformer/executors/CommandExecutor.java b/alfresco-transformer-base/src/main/java/org/alfresco/transformer/executors/CommandExecutor.java
index 2a6901d7..9da4e1a9 100644
--- a/alfresco-transformer-base/src/main/java/org/alfresco/transformer/executors/CommandExecutor.java
+++ b/alfresco-transformer-base/src/main/java/org/alfresco/transformer/executors/CommandExecutor.java
@@ -4,19 +4,24 @@
* %%
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
+ * This file is part of the Alfresco software.
+ * -
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ * -
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * -
+ * Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * .
+ * GNU Lesser General Public License for more details.
+ * -
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
* #L%
*/
package org.alfresco.transformer.executors;
diff --git a/alfresco-transformer-base/src/main/java/org/alfresco/transformer/executors/JavaExecutor.java b/alfresco-transformer-base/src/main/java/org/alfresco/transformer/executors/JavaExecutor.java
index bee2cef6..190486a7 100644
--- a/alfresco-transformer-base/src/main/java/org/alfresco/transformer/executors/JavaExecutor.java
+++ b/alfresco-transformer-base/src/main/java/org/alfresco/transformer/executors/JavaExecutor.java
@@ -4,19 +4,24 @@
* %%
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
+ * This file is part of the Alfresco software.
+ * -
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ * -
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * -
+ * Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * .
+ * GNU Lesser General Public License for more details.
+ * -
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
* #L%
*/
package org.alfresco.transformer.executors;
diff --git a/alfresco-transformer-base/src/main/java/org/alfresco/transformer/fs/FileManager.java b/alfresco-transformer-base/src/main/java/org/alfresco/transformer/fs/FileManager.java
index ce131967..beacc873 100644
--- a/alfresco-transformer-base/src/main/java/org/alfresco/transformer/fs/FileManager.java
+++ b/alfresco-transformer-base/src/main/java/org/alfresco/transformer/fs/FileManager.java
@@ -4,19 +4,24 @@
* %%
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
+ * This file is part of the Alfresco software.
+ * -
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ * -
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * -
+ * Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * .
+ * GNU Lesser General Public License for more details.
+ * -
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
* #L%
*/
package org.alfresco.transformer.fs;
diff --git a/alfresco-transformer-base/src/main/java/org/alfresco/transformer/logging/LogEntry.java b/alfresco-transformer-base/src/main/java/org/alfresco/transformer/logging/LogEntry.java
index 31850f92..fccd8882 100644
--- a/alfresco-transformer-base/src/main/java/org/alfresco/transformer/logging/LogEntry.java
+++ b/alfresco-transformer-base/src/main/java/org/alfresco/transformer/logging/LogEntry.java
@@ -4,19 +4,24 @@
* %%
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
+ * This file is part of the Alfresco software.
+ * -
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ * -
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * -
+ * Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * .
+ * GNU Lesser General Public License for more details.
+ * -
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
* #L%
*/
package org.alfresco.transformer.logging;
diff --git a/alfresco-transformer-base/src/main/java/org/alfresco/transformer/logging/StandardMessages.java b/alfresco-transformer-base/src/main/java/org/alfresco/transformer/logging/StandardMessages.java
index 4d811e0c..f24fbed7 100644
--- a/alfresco-transformer-base/src/main/java/org/alfresco/transformer/logging/StandardMessages.java
+++ b/alfresco-transformer-base/src/main/java/org/alfresco/transformer/logging/StandardMessages.java
@@ -4,19 +4,24 @@
* %%
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
+ * This file is part of the Alfresco software.
+ * -
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ * -
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * -
+ * Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * .
+ * GNU Lesser General Public License for more details.
+ * -
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
* #L%
*/
package org.alfresco.transformer.logging;
diff --git a/alfresco-transformer-base/src/main/java/org/alfresco/transformer/messaging/MessagingConfig.java b/alfresco-transformer-base/src/main/java/org/alfresco/transformer/messaging/MessagingConfig.java
index 67a12cbc..437b349d 100644
--- a/alfresco-transformer-base/src/main/java/org/alfresco/transformer/messaging/MessagingConfig.java
+++ b/alfresco-transformer-base/src/main/java/org/alfresco/transformer/messaging/MessagingConfig.java
@@ -4,19 +4,24 @@
* %%
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
+ * This file is part of the Alfresco software.
+ * -
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ * -
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * -
+ * Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * .
+ * GNU Lesser General Public License for more details.
+ * -
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
* #L%
*/
package org.alfresco.transformer.messaging;
diff --git a/alfresco-transformer-base/src/main/java/org/alfresco/transformer/messaging/TransformMessageConverter.java b/alfresco-transformer-base/src/main/java/org/alfresco/transformer/messaging/TransformMessageConverter.java
index 0ae8206f..15503f3a 100644
--- a/alfresco-transformer-base/src/main/java/org/alfresco/transformer/messaging/TransformMessageConverter.java
+++ b/alfresco-transformer-base/src/main/java/org/alfresco/transformer/messaging/TransformMessageConverter.java
@@ -4,19 +4,24 @@
* %%
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
+ * This file is part of the Alfresco software.
+ * -
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ * -
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * -
+ * Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * .
+ * GNU Lesser General Public License for more details.
+ * -
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
* #L%
*/
diff --git a/alfresco-transformer-base/src/main/java/org/alfresco/transformer/messaging/TransformReplySender.java b/alfresco-transformer-base/src/main/java/org/alfresco/transformer/messaging/TransformReplySender.java
index 574c1de7..5fb85ef7 100644
--- a/alfresco-transformer-base/src/main/java/org/alfresco/transformer/messaging/TransformReplySender.java
+++ b/alfresco-transformer-base/src/main/java/org/alfresco/transformer/messaging/TransformReplySender.java
@@ -4,19 +4,24 @@
* %%
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
+ * This file is part of the Alfresco software.
+ * -
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ * -
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * -
+ * Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * .
+ * GNU Lesser General Public License for more details.
+ * -
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
* #L%
*/
package org.alfresco.transformer.messaging;
diff --git a/alfresco-transformer-base/src/main/java/org/alfresco/transformer/model/FileRefEntity.java b/alfresco-transformer-base/src/main/java/org/alfresco/transformer/model/FileRefEntity.java
index c77c8aa9..34524ad5 100644
--- a/alfresco-transformer-base/src/main/java/org/alfresco/transformer/model/FileRefEntity.java
+++ b/alfresco-transformer-base/src/main/java/org/alfresco/transformer/model/FileRefEntity.java
@@ -4,19 +4,24 @@
* %%
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
+ * This file is part of the Alfresco software.
+ * -
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ * -
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * -
+ * Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * .
+ * GNU Lesser General Public License for more details.
+ * -
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
* #L%
*/
package org.alfresco.transformer.model;
diff --git a/alfresco-transformer-base/src/main/java/org/alfresco/transformer/model/FileRefResponse.java b/alfresco-transformer-base/src/main/java/org/alfresco/transformer/model/FileRefResponse.java
index 96a4cbfa..afc5c118 100644
--- a/alfresco-transformer-base/src/main/java/org/alfresco/transformer/model/FileRefResponse.java
+++ b/alfresco-transformer-base/src/main/java/org/alfresco/transformer/model/FileRefResponse.java
@@ -4,19 +4,24 @@
* %%
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
+ * This file is part of the Alfresco software.
+ * -
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ * -
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * -
+ * Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * .
+ * GNU Lesser General Public License for more details.
+ * -
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
* #L%
*/
package org.alfresco.transformer.model;
diff --git a/alfresco-transformer-base/src/main/java/org/alfresco/transformer/probes/ProbeTestTransform.java b/alfresco-transformer-base/src/main/java/org/alfresco/transformer/probes/ProbeTestTransform.java
index cc2f6b8a..2f58c237 100644
--- a/alfresco-transformer-base/src/main/java/org/alfresco/transformer/probes/ProbeTestTransform.java
+++ b/alfresco-transformer-base/src/main/java/org/alfresco/transformer/probes/ProbeTestTransform.java
@@ -4,19 +4,24 @@
* %%
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
+ * This file is part of the Alfresco software.
+ * -
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ * -
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * -
+ * Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * .
+ * GNU Lesser General Public License for more details.
+ * -
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
* #L%
*/
package org.alfresco.transformer.probes;
diff --git a/alfresco-transformer-base/src/main/java/org/alfresco/transformer/util/Util.java b/alfresco-transformer-base/src/main/java/org/alfresco/transformer/util/Util.java
index c968ed8b..f1a6bd21 100644
--- a/alfresco-transformer-base/src/main/java/org/alfresco/transformer/util/Util.java
+++ b/alfresco-transformer-base/src/main/java/org/alfresco/transformer/util/Util.java
@@ -4,19 +4,24 @@
* %%
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
+ * This file is part of the Alfresco software.
+ * -
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ * -
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * -
+ * Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * .
+ * GNU Lesser General Public License for more details.
+ * -
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
* #L%
*/
package org.alfresco.transformer.util;
diff --git a/alfresco-transformer-base/src/main/resources/application.yaml b/alfresco-transformer-base/src/main/resources/application.yaml
index 9fc75b27..8bc4f767 100644
--- a/alfresco-transformer-base/src/main/resources/application.yaml
+++ b/alfresco-transformer-base/src/main/resources/application.yaml
@@ -24,6 +24,7 @@ logging:
org.alfresco.transformer.AlfrescoPdfRendererController: debug
org.alfresco.transformer.ImageMagickController: debug
org.alfresco.transformer.TikaController: debug
+ org.alfresco.transformer.MiscellaneousTransformersController: debug
fileStoreUrl: ${FILE_STORE_URL:http://localhost:8099/alfresco/api/-default-/private/sfs/versions/1/file}
diff --git a/alfresco-transformer-base/src/test/java/org/alfresco/transformer/AbstractHttpRequestTest.java b/alfresco-transformer-base/src/test/java/org/alfresco/transformer/AbstractHttpRequestTest.java
index 2406fba5..259b6992 100644
--- a/alfresco-transformer-base/src/test/java/org/alfresco/transformer/AbstractHttpRequestTest.java
+++ b/alfresco-transformer-base/src/test/java/org/alfresco/transformer/AbstractHttpRequestTest.java
@@ -4,19 +4,24 @@
* %%
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
+ * This file is part of the Alfresco software.
+ * -
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ * -
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * -
+ * Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * .
+ * GNU Lesser General Public License for more details.
+ * -
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
* #L%
*/
package org.alfresco.transformer;
@@ -125,4 +130,4 @@ public abstract class AbstractHttpRequestTest
}
return message;
}
-}
\ No newline at end of file
+}
diff --git a/alfresco-transformer-base/src/test/java/org/alfresco/transformer/AbstractQueueTransformServiceIT.java b/alfresco-transformer-base/src/test/java/org/alfresco/transformer/AbstractQueueTransformServiceIT.java
index 38f0fa3e..60df7d36 100644
--- a/alfresco-transformer-base/src/test/java/org/alfresco/transformer/AbstractQueueTransformServiceIT.java
+++ b/alfresco-transformer-base/src/test/java/org/alfresco/transformer/AbstractQueueTransformServiceIT.java
@@ -4,19 +4,24 @@
* %%
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
+ * This file is part of the Alfresco software.
+ * -
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ * -
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * -
+ * Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * .
+ * GNU Lesser General Public License for more details.
+ * -
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
* #L%
*/
package org.alfresco.transformer;
diff --git a/alfresco-transformer-base/src/test/java/org/alfresco/transformer/AbstractTransformerControllerTest.java b/alfresco-transformer-base/src/test/java/org/alfresco/transformer/AbstractTransformerControllerTest.java
index 8f257d77..b1bb5f43 100644
--- a/alfresco-transformer-base/src/test/java/org/alfresco/transformer/AbstractTransformerControllerTest.java
+++ b/alfresco-transformer-base/src/test/java/org/alfresco/transformer/AbstractTransformerControllerTest.java
@@ -4,19 +4,24 @@
* %%
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
+ * This file is part of the Alfresco software.
+ * -
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ * -
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * -
+ * Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * .
+ * GNU Lesser General Public License for more details.
+ * -
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
* #L%
*/
package org.alfresco.transformer;
diff --git a/alfresco-transformer-base/src/test/java/org/alfresco/transformer/QueueTransformServiceTest.java b/alfresco-transformer-base/src/test/java/org/alfresco/transformer/QueueTransformServiceTest.java
index 0bbeb3d1..4275089b 100644
--- a/alfresco-transformer-base/src/test/java/org/alfresco/transformer/QueueTransformServiceTest.java
+++ b/alfresco-transformer-base/src/test/java/org/alfresco/transformer/QueueTransformServiceTest.java
@@ -4,19 +4,24 @@
* %%
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
+ * This file is part of the Alfresco software.
+ * -
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ * -
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * -
+ * Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * .
+ * GNU Lesser General Public License for more details.
+ * -
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
* #L%
*/
diff --git a/pom.xml b/pom.xml
index 2d1e15f6..a8c3c556 100644
--- a/pom.xml
+++ b/pom.xml
@@ -33,6 +33,7 @@
alfresco-docker-alfresco-pdf-renderer
alfresco-docker-imagemagick
alfresco-docker-libreoffice
+ alfresco-docker-transform-misc
@@ -161,6 +162,11 @@
org.codehaus.mojo
license-maven-plugin
1.20
+
+ 2005
+ Alfresco Software Limited
+ Alfresco Transform Core
+
third-party-licenses
@@ -181,9 +187,6 @@
process-sources
- 2005
- Alfresco Software Limited
- Alfresco Transform Core
false
true
true