ATS-466/ATS-538/ATS-539: Incorporate Misc T-Engine in ATS (#98)

- fix multiple Misc Transformer bugs related to file mimeTypes
- remove usage of 'source/targetMimetype' as transform options/parameters
- add 'source/targetMimetype' arguments to the 'processTransform' method
- remove unnecessary code (e.g. useless overridden methods)
- add quick* test resource files
- add integration test for 'Local Transformations' on the Misc engine
- set up Integration Tests POM configuration for all T-Engine modules
This commit is contained in:
CezarLeahu 2019-08-26 13:59:38 +03:00 committed by GitHub
parent 9c2661d13a
commit d9747f015d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
33 changed files with 864 additions and 194 deletions

View File

@ -5,16 +5,18 @@ PS4="\[\e[35m\]+ \[\e[m\]"
set -vex set -vex
pushd "$(dirname "${BASH_SOURCE[0]}")/../" pushd "$(dirname "${BASH_SOURCE[0]}")/../"
LIBREOFFICE_VERSION=6.1.6
# Cache the LibreOffice distribution, as it is takes a long time to download and it can cause the # Cache the LibreOffice distribution, as it is takes a long time to download and it can cause the
# build to fail (no output for more than 10 minutes) # build to fail (no output for more than 10 minutes)
LIBREOFFICE_RPM_URL="https://nexus.alfresco.com/nexus/service/local/repositories/thirdparty/content/org/libreoffice/libreoffice-dist/5.4.6/libreoffice-dist-5.4.6-linux.gz" LIBREOFFICE_RPM_URL="https://nexus.alfresco.com/nexus/service/local/repositories/thirdparty/content/org/libreoffice/libreoffice-dist/${LIBREOFFICE_VERSION}/libreoffice-dist-${LIBREOFFICE_VERSION}-linux.gz"
if [ -f "${HOME}/artifacts/libreoffice-dist-5.4.6-linux.gz" ]; then if [ -f "${HOME}/artifacts/libreoffice-dist-${LIBREOFFICE_VERSION}-linux.gz" ]; then
echo "Using cached LibreOffice distribution..." echo "Using cached LibreOffice distribution..."
else else
echo "Downloading LibreOffice distribution..." echo "Downloading LibreOffice distribution..."
curl -s -S ${LIBREOFFICE_RPM_URL} -o "${HOME}/artifacts/libreoffice-dist-5.4.6-linux.gz" curl -s -S ${LIBREOFFICE_RPM_URL} -o "${HOME}/artifacts/libreoffice-dist-${LIBREOFFICE_VERSION}-linux.gz"
fi fi
cp "${HOME}/artifacts/libreoffice-dist-5.4.6-linux.gz" alfresco-docker-libreoffice/ cp "${HOME}/artifacts/libreoffice-dist-${LIBREOFFICE_VERSION}-linux.gz" alfresco-docker-libreoffice/
popd popd

View File

@ -77,6 +77,78 @@
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId> <artifactId>maven-failsafe-plugin</artifactId>
</plugin> </plugin>
</plugins>
</build>
<profiles>
<profile>
<id>docker-it-setup</id>
<!-- raises an ActiveMq container for the Integration Tests -->
<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<configuration>
<images>
<image>
<alias>activemq</alias>
<name>alfresco/alfresco-activemq:5.15.6</name>
<run>
<hostname>activemq</hostname>
<ports>
<port>8161:8161</port>
<port>5672:5672</port>
<port>61616:61616</port>
</ports>
<wait>
<log>Apache ActiveMQ 5.15.6 .* started</log>
<time>20000</time>
<kill>500</kill>
<shutdown>100</shutdown>
<exec>
<preStop>kill 1</preStop>
<preStop>kill -9 1</preStop>
</exec>
</wait>
</run>
</image>
<image>
<alias>alfresco-pdf-renderer</alias>
<name>${image.name}:${image.tag}</name>
<run>
<ports>
<port>8090:8090</port>
</ports>
<wait>
<http>
<url>http://localhost:8090/transform/config</url>
<method>GET</method>
<status>200...299</status>
</http>
<time>300000</time>
<kill>500</kill>
<shutdown>100</shutdown>
<exec>
<preStop>kill 1</preStop>
<preStop>kill -9 1</preStop>
</exec>
</wait>
</run>
</image>
</images>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>local</id>
<build>
<plugins>
<plugin> <plugin>
<groupId>io.fabric8</groupId> <groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId> <artifactId>fabric8-maven-plugin</artifactId>
@ -93,36 +165,10 @@
</image> </image>
</images> </images>
</configuration> </configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>docker-it-setup</id>
<!-- raises an ActiveMq container for the Integration Tests -->
<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>local</id>
<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId>
<executions> <executions>
<execution> <execution>
<id>build-image</id> <id>build-image</id>
<phase>install</phase> <phase>package</phase>
<goals> <goals>
<goal>build</goal> <goal>build</goal>
</goals> </goals>
@ -167,10 +213,16 @@
</configuration> </configuration>
<executions> <executions>
<execution> <execution>
<id>build-push-image</id> <id>build-image</id>
<phase>install</phase> <phase>package</phase>
<goals> <goals>
<goal>build</goal> <goal>build</goal>
</goals>
</execution>
<execution>
<id>push-image</id>
<phase>install</phase>
<goals>
<goal>push</goal> <goal>push</goal>
</goals> </goals>
</execution> </execution>

View File

@ -108,8 +108,9 @@ public class AlfrescoPdfRendererController extends AbstractTransformerController
} }
@Override @Override
public void processTransform(File sourceFile, File targetFile, public void processTransform(final File sourceFile, final File targetFile,
Map<String, String> transformOptions, Long timeout) final String sourceMimetype, final String targetMimetype,
final Map<String, String> transformOptions, final Long timeout)
{ {
logger.debug("Processing request with: sourceFile '{}', targetFile '{}', transformOptions" + logger.debug("Processing request with: sourceFile '{}', targetFile '{}', transformOptions" +
" '{}', timeout {} ms", sourceFile, targetFile, transformOptions, timeout); " '{}', timeout {} ms", sourceFile, targetFile, transformOptions, timeout);

View File

@ -0,0 +1,76 @@
/*
* #%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 <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.transformer;
import static org.springframework.http.MediaType.MULTIPART_FORM_DATA;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.ResponseEntity;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
/**
* @author Cezar Leahu
*/
public class TransformationIT
{
private static final Logger logger = LoggerFactory.getLogger(TransformationIT.class);
private static final String ENGINE_URL = "http://localhost:8090";
@Test
public void testPdfToPng() throws Exception
{
sendTRequest("quick.pdf", "png");
}
private static void sendTRequest(final String sourceFile, final String targetExtension)
{
final RestTemplate restTemplate = new RestTemplate();
final HttpHeaders headers = new HttpHeaders();
headers.setContentType(MULTIPART_FORM_DATA);
//headers.setAccept(MULTIPART_FORM_DATA_VALUE);
MultiValueMap<String, Object> body = new LinkedMultiValueMap<>();
body.add("file", new ClassPathResource(sourceFile));
body.add("targetExtension", targetExtension);
final HttpEntity<MultiValueMap<String, Object>> entity = new HttpEntity<>(body, headers);
final ResponseEntity<Resource> response = restTemplate.postForEntity(
ENGINE_URL + "/transform",
entity, Resource.class);
logger.info("Response: {}", response);
}
}

View File

@ -77,6 +77,78 @@
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId> <artifactId>maven-failsafe-plugin</artifactId>
</plugin> </plugin>
</plugins>
</build>
<profiles>
<profile>
<id>docker-it-setup</id>
<!-- raises an ActiveMq container for the Integration Tests -->
<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<configuration>
<images>
<image>
<alias>activemq</alias>
<name>alfresco/alfresco-activemq:5.15.6</name>
<run>
<hostname>activemq</hostname>
<ports>
<port>8161:8161</port>
<port>5672:5672</port>
<port>61616:61616</port>
</ports>
<wait>
<log>Apache ActiveMQ 5.15.6 .* started</log>
<time>20000</time>
<kill>500</kill>
<shutdown>100</shutdown>
<exec>
<preStop>kill 1</preStop>
<preStop>kill -9 1</preStop>
</exec>
</wait>
</run>
</image>
<image>
<alias>imagemagick</alias>
<name>${image.name}:${image.tag}</name>
<run>
<ports>
<port>8090:8090</port>
</ports>
<wait>
<http>
<url>http://localhost:8090/transform/config</url>
<method>GET</method>
<status>200...299</status>
</http>
<time>300000</time>
<kill>500</kill>
<shutdown>100</shutdown>
<exec>
<preStop>kill 1</preStop>
<preStop>kill -9 1</preStop>
</exec>
</wait>
</run>
</image>
</images>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>local</id>
<build>
<plugins>
<plugin> <plugin>
<groupId>io.fabric8</groupId> <groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId> <artifactId>fabric8-maven-plugin</artifactId>
@ -93,36 +165,10 @@
</image> </image>
</images> </images>
</configuration> </configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>docker-it-setup</id>
<!-- raises an ActiveMq container for the Integration Tests -->
<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>local</id>
<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId>
<executions> <executions>
<execution> <execution>
<id>build-image</id> <id>build-image</id>
<phase>install</phase> <phase>package</phase>
<goals> <goals>
<goal>build</goal> <goal>build</goal>
</goals> </goals>
@ -167,10 +213,16 @@
</configuration> </configuration>
<executions> <executions>
<execution> <execution>
<id>build-push-image</id> <id>build-image</id>
<phase>install</phase> <phase>package</phase>
<goals> <goals>
<goal>build</goal> <goal>build</goal>
</goals>
</execution>
<execution>
<id>push-image</id>
<phase>install</phase>
<goals>
<goal>push</goal> <goal>push</goal>
</goals> </goals>
</execution> </execution>

View File

@ -191,6 +191,7 @@ public class ImageMagickController extends AbstractTransformerController
@Override @Override
public void processTransform(final File sourceFile, final File targetFile, public void processTransform(final File sourceFile, final File targetFile,
final String sourceMimetype, final String targetMimetype,
final Map<String, String> transformOptions, final Long timeout) final Map<String, String> transformOptions, final Long timeout)
{ {
logger.debug("Processing request with: sourceFile '{}', targetFile '{}', transformOptions" + logger.debug("Processing request with: sourceFile '{}', targetFile '{}', transformOptions" +

View File

@ -86,6 +86,78 @@
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId> <artifactId>maven-failsafe-plugin</artifactId>
</plugin> </plugin>
</plugins>
</build>
<profiles>
<profile>
<id>docker-it-setup</id>
<!-- raises an ActiveMq container for the Integration Tests -->
<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<configuration>
<images>
<image>
<alias>activemq</alias>
<name>alfresco/alfresco-activemq:5.15.6</name>
<run>
<hostname>activemq</hostname>
<ports>
<port>8161:8161</port>
<port>5672:5672</port>
<port>61616:61616</port>
</ports>
<wait>
<log>Apache ActiveMQ 5.15.6 .* started</log>
<time>20000</time>
<kill>500</kill>
<shutdown>100</shutdown>
<exec>
<preStop>kill 1</preStop>
<preStop>kill -9 1</preStop>
</exec>
</wait>
</run>
</image>
<image>
<alias>libreoffice</alias>
<name>${image.name}:${image.tag}</name>
<run>
<ports>
<port>8090:8090</port>
</ports>
<wait>
<http>
<url>http://localhost:8090/transform/config</url>
<method>GET</method>
<status>200...299</status>
</http>
<time>300000</time>
<kill>500</kill>
<shutdown>100</shutdown>
<exec>
<preStop>kill 1</preStop>
<preStop>kill -9 1</preStop>
</exec>
</wait>
</run>
</image>
</images>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>local</id>
<build>
<plugins>
<plugin> <plugin>
<groupId>io.fabric8</groupId> <groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId> <artifactId>fabric8-maven-plugin</artifactId>
@ -102,36 +174,10 @@
</image> </image>
</images> </images>
</configuration> </configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>docker-it-setup</id>
<!-- raises an ActiveMq container for the Integration Tests -->
<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>local</id>
<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId>
<executions> <executions>
<execution> <execution>
<id>build-image</id> <id>build-image</id>
<phase>install</phase> <phase>package</phase>
<goals> <goals>
<goal>build</goal> <goal>build</goal>
</goals> </goals>
@ -176,10 +222,16 @@
</configuration> </configuration>
<executions> <executions>
<execution> <execution>
<id>build-push-image</id> <id>build-image</id>
<phase>install</phase> <phase>package</phase>
<goals> <goals>
<goal>build</goal> <goal>build</goal>
</goals>
</execution>
<execution>
<id>push-image</id>
<phase>install</phase>
<goals>
<goal>push</goal> <goal>push</goal>
</goals> </goals>
</execution> </execution>

View File

@ -133,8 +133,9 @@ public class LibreOfficeController extends AbstractTransformerController
} }
@Override @Override
public void processTransform(File sourceFile, File targetFile, public void processTransform(final File sourceFile, final File targetFile,
Map<String, String> transformOptions, Long timeout) final String sourceMimetype, final String targetMimetype,
final Map<String, String> transformOptions, final Long timeout)
{ {
logger.debug("Processing request with: sourceFile '{}', targetFile '{}', transformOptions" + logger.debug("Processing request with: sourceFile '{}', targetFile '{}', transformOptions" +
" '{}', timeout {} ms", sourceFile, targetFile, transformOptions, timeout); " '{}', timeout {} ms", sourceFile, targetFile, transformOptions, timeout);

View File

@ -150,6 +150,78 @@
<groupId>org.codehaus.mojo</groupId> <groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId> <artifactId>license-maven-plugin</artifactId>
</plugin> </plugin>
</plugins>
</build>
<profiles>
<profile>
<id>docker-it-setup</id>
<!-- raises an ActiveMq container for the Integration Tests -->
<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<configuration>
<images>
<image>
<alias>activemq</alias>
<name>alfresco/alfresco-activemq:5.15.6</name>
<run>
<hostname>activemq</hostname>
<ports>
<port>8161:8161</port>
<port>5672:5672</port>
<port>61616:61616</port>
</ports>
<wait>
<log>Apache ActiveMQ 5.15.6 .* started</log>
<time>20000</time>
<kill>500</kill>
<shutdown>100</shutdown>
<exec>
<preStop>kill 1</preStop>
<preStop>kill -9 1</preStop>
</exec>
</wait>
</run>
</image>
<image>
<alias>tika</alias>
<name>${image.name}:${image.tag}</name>
<run>
<ports>
<port>8090:8090</port>
</ports>
<wait>
<http>
<url>http://localhost:8090/transform/config</url>
<method>GET</method>
<status>200...299</status>
</http>
<time>300000</time>
<kill>500</kill>
<shutdown>100</shutdown>
<exec>
<preStop>kill 1</preStop>
<preStop>kill -9 1</preStop>
</exec>
</wait>
</run>
</image>
</images>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>local</id>
<build>
<plugins>
<plugin> <plugin>
<groupId>io.fabric8</groupId> <groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId> <artifactId>fabric8-maven-plugin</artifactId>
@ -166,36 +238,10 @@
</image> </image>
</images> </images>
</configuration> </configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>docker-it-setup</id>
<!-- raises an ActiveMq container for the Integration Tests -->
<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>local</id>
<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId>
<executions> <executions>
<execution> <execution>
<id>build-image</id> <id>build-image</id>
<phase>install</phase> <phase>package</phase>
<goals> <goals>
<goal>build</goal> <goal>build</goal>
</goals> </goals>
@ -240,10 +286,16 @@
</configuration> </configuration>
<executions> <executions>
<execution> <execution>
<id>build-push-image</id> <id>build-image</id>
<phase>install</phase> <phase>package</phase>
<goals> <goals>
<goal>build</goal> <goal>build</goal>
</goals>
</execution>
<execution>
<id>push-image</id>
<phase>install</phase>
<goals>
<goal>push</goal> <goal>push</goal>
</goals> </goals>
</execution> </execution>

View File

@ -162,17 +162,17 @@ public class TikaController extends AbstractTransformerController
} }
@Override @Override
public void processTransform(File sourceFile, File targetFile, public void processTransform(final File sourceFile, final File targetFile,
Map<String, String> transformOptions, Long timeout) final String sourceMimetype, final String targetMimetype,
final Map<String, String> transformOptions, final Long timeout)
{ {
logger.debug("Processing request with: sourceFile '{}', targetFile '{}', transformOptions" + logger.debug("Processing request with: sourceFile '{}', targetFile '{}', transformOptions" +
" '{}', timeout {} ms", sourceFile, targetFile, transformOptions, timeout); " '{}', timeout {} ms", sourceFile, targetFile, transformOptions, timeout);
String transform = transformOptions.get("transform"); final String transform = transformOptions.get("transform");
Boolean includeContents = stringToBoolean("includeContents"); final Boolean includeContents = stringToBoolean("includeContents");
Boolean notExtractBookmarksText = stringToBoolean("notExtractBookmarksText"); final Boolean notExtractBookmarksText = stringToBoolean("notExtractBookmarksText");
String targetMimetype = transformOptions.get("targetMimetype"); final String targetEncoding = transformOptions.get("targetEncoding");
String targetEncoding = transformOptions.get("targetEncoding");
javaExecutor.call(sourceFile, targetFile, transform, javaExecutor.call(sourceFile, targetFile, transform,
includeContents != null && includeContents ? INCLUDE_CONTENTS : null, includeContents != null && includeContents ? INCLUDE_CONTENTS : null,

View File

@ -106,6 +106,78 @@
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId> <artifactId>maven-failsafe-plugin</artifactId>
</plugin> </plugin>
</plugins>
</build>
<profiles>
<profile>
<id>docker-it-setup</id>
<!-- raises an ActiveMq container for the Integration Tests -->
<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<configuration>
<images>
<image>
<alias>activemq</alias>
<name>alfresco/alfresco-activemq:5.15.6</name>
<run>
<hostname>activemq</hostname>
<ports>
<port>8161:8161</port>
<port>5672:5672</port>
<port>61616:61616</port>
</ports>
<wait>
<log>Apache ActiveMQ 5.15.6 .* started</log>
<time>20000</time>
<kill>500</kill>
<shutdown>100</shutdown>
<exec>
<preStop>kill 1</preStop>
<preStop>kill -9 1</preStop>
</exec>
</wait>
</run>
</image>
<image>
<alias>misc</alias>
<name>${image.name}:${image.tag}</name>
<run>
<ports>
<port>8090:8090</port>
</ports>
<wait>
<http>
<url>http://localhost:8090/transform/config</url>
<method>GET</method>
<status>200...299</status>
</http>
<time>300000</time>
<kill>500</kill>
<shutdown>100</shutdown>
<exec>
<preStop>kill 1</preStop>
<preStop>kill -9 1</preStop>
</exec>
</wait>
</run>
</image>
</images>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>local</id>
<build>
<plugins>
<plugin> <plugin>
<groupId>io.fabric8</groupId> <groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId> <artifactId>fabric8-maven-plugin</artifactId>
@ -122,36 +194,10 @@
</image> </image>
</images> </images>
</configuration> </configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>docker-it-setup</id>
<!-- raises an ActiveMq container for the Integration Tests -->
<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>local</id>
<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId>
<executions> <executions>
<execution> <execution>
<id>build-image</id> <id>build-image</id>
<phase>install</phase> <phase>package</phase>
<goals> <goals>
<goal>build</goal> <goal>build</goal>
</goals> </goals>
@ -196,10 +242,16 @@
</configuration> </configuration>
<executions> <executions>
<execution> <execution>
<id>build-push-image</id> <id>build-image</id>
<phase>install</phase> <phase>package</phase>
<goals> <goals>
<goal>build</goal> <goal>build</goal>
</goals>
</execution>
<execution>
<id>push-image</id>
<phase>install</phase>
<goals>
<goal>push</goal> <goal>push</goal>
</goals> </goals>
</execution> </execution>

View File

@ -98,8 +98,9 @@ public class MiscController extends AbstractTransformerController
} }
@Override @Override
public void processTransform(File sourceFile, File targetFile, public void processTransform(final File sourceFile, final File targetFile,
Map<String, String> transformOptions, Long timeout) final String sourceMimetype, final String targetMimetype,
final Map<String, String> transformOptions, final Long timeout)
{ {
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
{ {
@ -108,8 +109,6 @@ public class MiscController extends AbstractTransformerController
" '{}', timeout {} ms", sourceFile, targetFile, transformOptions, timeout); " '{}', timeout {} ms", sourceFile, targetFile, transformOptions, timeout);
} }
String sourceMimetype = transformOptions.get("sourceMimetype");
String targetMimetype = transformOptions.get("targetMimetype");
transformer.transform(sourceFile, targetFile, sourceMimetype, targetMimetype, transformer.transform(sourceFile, targetFile, sourceMimetype, targetMimetype,
transformOptions); transformOptions);
} }
@ -117,9 +116,9 @@ public class MiscController extends AbstractTransformerController
@PostMapping(value = "/transform", consumes = MULTIPART_FORM_DATA_VALUE) @PostMapping(value = "/transform", consumes = MULTIPART_FORM_DATA_VALUE)
public ResponseEntity<Resource> transform(HttpServletRequest request, public ResponseEntity<Resource> transform(HttpServletRequest request,
@RequestParam("file") MultipartFile sourceMultipartFile, @RequestParam("file") MultipartFile sourceMultipartFile,
@RequestParam(value = "targetExtension") String targetExtension, @RequestParam("targetExtension") String targetExtension,
@RequestParam(value = "targetMimetype") String targetMimetype, @RequestParam("targetMimetype") String targetMimetype,
@RequestParam(value = "sourceMimetype") String sourceMimetype, @RequestParam("sourceMimetype") String sourceMimetype,
@RequestParam(value = "testDelay", required = false) Long testDelay, @RequestParam(value = "testDelay", required = false) Long testDelay,
@RequestParam Map<String, String> parameters) @RequestParam Map<String, String> parameters)
{ {
@ -130,11 +129,11 @@ public class MiscController extends AbstractTransformerController
", parameters '{}'", sourceMimetype, targetMimetype, targetExtension, parameters); ", parameters '{}'", sourceMimetype, targetMimetype, targetExtension, parameters);
} }
String targetFilename = createTargetFileName(sourceMultipartFile.getOriginalFilename(), final String targetFilename = createTargetFileName(
targetExtension); sourceMultipartFile.getOriginalFilename(), targetExtension);
getProbeTestTransform().incrementTransformerCount(); getProbeTestTransform().incrementTransformerCount();
File sourceFile = createSourceFile(request, sourceMultipartFile); final File sourceFile = createSourceFile(request, sourceMultipartFile);
File targetFile = createTargetFile(request, targetFilename); final File targetFile = createTargetFile(request, targetFilename);
transformer.transform(sourceFile, targetFile, sourceMimetype, targetMimetype, parameters); transformer.transform(sourceFile, targetFile, sourceMimetype, targetMimetype, parameters);

View File

@ -82,11 +82,9 @@ public class AppleIWorksContentTransformer implements SelectableTransformer
} }
@Override @Override
public void transform(File sourceFile, File targetFile, Map<String, String> parameters) public void transform(final File sourceFile, final File targetFile, final String sourceMimetype,
final String targetMimetype, final Map<String, String> parameters)
{ {
final String sourceMimetype = parameters.get(SOURCE_MIMETYPE);
final String targetMimetype = parameters.get(TARGET_MIMETYPE);
logger.debug("Performing IWorks to jpeg transform with sourceMimetype={} targetMimetype={}", logger.debug("Performing IWorks to jpeg transform with sourceMimetype={} targetMimetype={}",
sourceMimetype, targetMimetype); sourceMimetype, targetMimetype);

View File

@ -85,8 +85,8 @@ public class HtmlParserContentTransformer implements SelectableTransformer
} }
@Override @Override
public void transform(File sourceFile, File targetFile, Map<String, String> parameters) public void transform(final File sourceFile, final File targetFile, final String sourceMimetype,
throws Exception final String targetMimetype, final Map<String, String> parameters) throws Exception
{ {
String sourceEncoding = parameters.get(SOURCE_ENCODING); String sourceEncoding = parameters.get(SOURCE_ENCODING);
checkEncodingParameter(sourceEncoding, SOURCE_ENCODING); checkEncodingParameter(sourceEncoding, SOURCE_ENCODING);

View File

@ -109,12 +109,9 @@ public class OOXMLThumbnailContentTransformer implements SelectableTransformer
} }
@Override @Override
public void transform(File sourceFile, File targetFile, Map<String, String> parameters) public void transform(final File sourceFile, final File targetFile, final String sourceMimetype,
throws Exception final String targetMimetype, final Map<String, String> parameters) throws Exception
{ {
final String sourceMimetype = parameters.get(SOURCE_MIMETYPE);
final String targetMimetype = parameters.get(TARGET_MIMETYPE);
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
{ {
logger.debug("Performing OOXML to jpeg transform with sourceMimetype=" + sourceMimetype logger.debug("Performing OOXML to jpeg transform with sourceMimetype=" + sourceMimetype

View File

@ -38,8 +38,6 @@ public interface SelectableTransformer
{ {
String SOURCE_ENCODING = "sourceEncoding"; String SOURCE_ENCODING = "sourceEncoding";
String TARGET_ENCODING = "targetEncoding"; String TARGET_ENCODING = "targetEncoding";
String SOURCE_MIMETYPE = "sourceMimetype";
String TARGET_MIMETYPE = "targetMimetype";
/** /**
* Implementation of the actual transformation. * Implementation of the actual transformation.
@ -49,8 +47,8 @@ public interface SelectableTransformer
* @param parameters * @param parameters
* @throws Exception * @throws Exception
*/ */
void transform(File sourceFile, File targetFile, Map<String, String> parameters) void transform(File sourceFile, File targetFile, String sourceMimetype,
throws Exception; String targetMimetype, Map<String, String> parameters) throws Exception;
/** /**
* Determine whether this transformer is applicable for the given MIME types. * Determine whether this transformer is applicable for the given MIME types.

View File

@ -82,7 +82,8 @@ public class SelectingTransformer
final SelectableTransformer transformer = selectTransformer(sourceMimetype, final SelectableTransformer transformer = selectTransformer(sourceMimetype,
targetMimetype, parameters); targetMimetype, parameters);
logOptions(sourceFile, targetFile, parameters); logOptions(sourceFile, targetFile, parameters);
transformer.transform(sourceFile, targetFile, parameters); transformer.transform(sourceFile, targetFile, sourceMimetype, targetMimetype,
parameters);
} }
catch (IllegalArgumentException e) catch (IllegalArgumentException e)
{ {
@ -126,7 +127,7 @@ public class SelectingTransformer
return e.getMessage() == null || e.getMessage().isEmpty() ? e.getClass().getSimpleName() : e.getMessage(); return e.getMessage() == null || e.getMessage().isEmpty() ? e.getClass().getSimpleName() : e.getMessage();
} }
private void logOptions(File sourceFile, File targetFile, Map<String, String> parameters) private static void logOptions(File sourceFile, File targetFile, Map<String, String> parameters)
{ {
StringJoiner sj = new StringJoiner(" "); StringJoiner sj = new StringJoiner(" ");
parameters.forEach((k, v) -> sj.add( parameters.forEach((k, v) -> sj.add(
@ -136,7 +137,7 @@ public class SelectingTransformer
LogEntry.setOptions(sj.toString()); LogEntry.setOptions(sj.toString());
} }
private String getExtension(File file) private static String getExtension(File file)
{ {
final String name = file.getName(); final String name = file.getName();
int i = name.lastIndexOf('.'); int i = name.lastIndexOf('.');

View File

@ -83,10 +83,9 @@ public class StringExtractingContentTransformer implements SelectableTransformer
* be unformatted but valid. * be unformatted but valid.
*/ */
@Override @Override
public void transform(File sourceFile, File targetFile, Map<String, String> parameters) public void transform(final File sourceFile, final File targetFile, final String sourceMimetype,
throws Exception final String targetMimetype, final Map<String, String> parameters) throws Exception
{ {
String sourceEncoding = parameters.get(SOURCE_ENCODING); String sourceEncoding = parameters.get(SOURCE_ENCODING);
String targetEncoding = parameters.get(TARGET_ENCODING); String targetEncoding = parameters.get(TARGET_ENCODING);

View File

@ -115,8 +115,8 @@ public class TextToPdfContentTransformer implements SelectableTransformer
} }
@Override @Override
public void transform(File sourceFile, File targetFile, Map<String, String> parameters) public void transform(final File sourceFile, final File targetFile, final String sourceMimetype,
throws Exception final String targetMimetype, final Map<String, String> parameters) throws Exception
{ {
String sourceEncoding = parameters.get(SOURCE_ENCODING); String sourceEncoding = parameters.get(SOURCE_ENCODING);
String stringPageLimit = parameters.get(PAGE_LIMIT); String stringPageLimit = parameters.get(PAGE_LIMIT);

View File

@ -0,0 +1,267 @@
/*
* #%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 <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.transformer;
import static java.util.function.Function.identity;
import static java.util.stream.Collectors.toMap;
import static java.util.stream.Collectors.toSet;
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_DITA;
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_EXCEL;
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_HTML;
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_IMAGE_GIF;
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_IMAGE_JPEG;
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_IMAGE_PNG;
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_IMAGE_TIFF;
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_JAVASCRIPT;
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_OPENXML_PRESENTATION;
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_OPENXML_SPREADSHEET;
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_OPENXML_WORDPROCESSING;
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_OUTLOOK_MSG;
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_PDF;
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_PPT;
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_TEXT_CSS;
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_TEXT_CSV;
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_TEXT_JAVASCRIPT;
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_TEXT_MEDIAWIKI;
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_TEXT_PLAIN;
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_WORD;
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_XML;
import static org.alfresco.transformer.MiscTransformsIT.TestFileInfo.testFile;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.springframework.http.MediaType.MULTIPART_FORM_DATA;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Stream;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.ResponseEntity;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
/**
* @author Cezar Leahu
*/
@RunWith(Parameterized.class)
public class MiscTransformsIT
{
private static final Logger logger = LoggerFactory.getLogger(MiscTransformsIT.class);
private static final String ENGINE_URL = "http://localhost:8090";
private static final Map<String, TestFileInfo> TEST_FILES = Stream.of(
testFile(MIMETYPE_IMAGE_GIF, "gif", "quick.gif", true),
testFile(MIMETYPE_IMAGE_JPEG, "jpg", "quick.jpg", true),
testFile(MIMETYPE_IMAGE_PNG, "png", "quick.png", true),
testFile(MIMETYPE_IMAGE_TIFF, "tiff", "quick.tiff", true),
testFile(MIMETYPE_WORD, "doc", "quick.doc", true),
testFile(MIMETYPE_OPENXML_WORDPROCESSING, "docx", "quick.docx", true),
testFile(MIMETYPE_EXCEL, "xls", "quick.xls", true),
testFile(MIMETYPE_OPENXML_SPREADSHEET, "xlsx", "quick.xlsx", true),
testFile(MIMETYPE_PPT, "ppt", "quick.ppt", true),
testFile(MIMETYPE_OPENXML_PRESENTATION, "pptx", "quick.pptx", true),
testFile(MIMETYPE_OUTLOOK_MSG, "msg", "quick.msg", true),
testFile(MIMETYPE_PDF, "pdf", "quick.pdf", true),
testFile(MIMETYPE_TEXT_PLAIN, "txt", "quick.txt", true),
testFile(MIMETYPE_TEXT_MEDIAWIKI, "mw", "sample.mw", false),
testFile(MIMETYPE_TEXT_CSS, "css", "style.css", false),
testFile(MIMETYPE_TEXT_CSV, "csv", "people.csv", false),
testFile(MIMETYPE_TEXT_JAVASCRIPT, "js", "script.js", false),
testFile(MIMETYPE_XML, "xml", "quick.xml", true),
testFile(MIMETYPE_HTML, "html", "quick.html", true),
testFile(MIMETYPE_JAVASCRIPT, "js", "script.js", false),
testFile(MIMETYPE_DITA, "dita", "quickConcept.dita", false),
testFile(MIMETYPE_IWORK_KEYNOTE, "key", "quick.key", false),
testFile(MIMETYPE_IWORK_NUMBERS, "number", "quick.numbers", false),
testFile(MIMETYPE_IWORK_PAGES, "pages", "quick.pages", false)
).collect(toMap(TestFileInfo::getMimeType, identity()));
private final String sourceMimetype;
private final String targetMimetype;
public MiscTransformsIT(final SourceTarget sourceTarget)
{
sourceMimetype = sourceTarget.source;
targetMimetype = sourceTarget.target;
}
@Parameterized.Parameters
public static Set<SourceTarget> engineTransformations()
{
return Stream.of(
SourceTarget.of("text/html", "text/plain"), //duplicate
SourceTarget.of("text/plain", "text/plain"),
SourceTarget.of("text/mediawiki", "text/plain"),
SourceTarget.of("text/css", "text/plain"),
SourceTarget.of("text/csv", "text/plain"),
SourceTarget.of("text/javascript", "text/plain"),
SourceTarget.of("text/xml", "text/plain"),
SourceTarget.of("text/html", "text/plain"),
SourceTarget.of("application/x-javascript", "text/plain"),
SourceTarget.of("application/dita+xml", "text/plain"),
SourceTarget.of("application/vnd.apple.keynote", "image/jpeg"),
SourceTarget.of("application/vnd.apple.numbers", "image/jpeg"),
SourceTarget.of("application/vnd.apple.pages", "image/jpeg"),
SourceTarget.of("text/plain", "application/pdf"),
SourceTarget.of("text/csv", "application/pdf"),
SourceTarget.of("application/dita+xml", "application/pdf"),
SourceTarget.of("text/xml", "application/pdf")
).collect(toSet());
}
@Test
public void testTransformation()
{
final TestFileInfo sourceFile = TEST_FILES.get(sourceMimetype);
final TestFileInfo targetFile = TEST_FILES.get(targetMimetype);
assertNotNull(sourceFile);
assertNotNull(targetFile);
final ResponseEntity<Resource> response = sendTRequest(sourceFile.path,
sourceMimetype, targetMimetype, targetFile.extension);
logger.info("Response: {}", response);
final int status = response.getStatusCode().value();
assertTrue("Transformation failed", status >= 200 && status < 300);
}
private static ResponseEntity<Resource> sendTRequest(final String sourceFile,
final String sourceMimetype, final String targetMimetype, final String targetExtension)
{
final RestTemplate restTemplate = new RestTemplate();
final HttpHeaders headers = new HttpHeaders();
headers.setContentType(MULTIPART_FORM_DATA);
//headers.setAccept(ImmutableList.of(MULTIPART_FORM_DATA));
final MultiValueMap<String, Object> body = new LinkedMultiValueMap<>();
body.add("file", new ClassPathResource(sourceFile));
body.add("targetExtension", targetExtension);
body.add("targetMimetype", targetMimetype);
body.add("sourceMimetype", sourceMimetype);
final HttpEntity<MultiValueMap<String, Object>> entity = new HttpEntity<>(body, headers);
return restTemplate.postForEntity(ENGINE_URL + "/transform", entity, Resource.class);
}
static class TestFileInfo
{
private final String mimeType;
private final String extension;
private final String path;
private final boolean exactMimeType;
public TestFileInfo(final String mimeType, final String extension, final String path,
final boolean exactMimeType)
{
this.mimeType = mimeType;
this.extension = extension;
this.path = path;
this.exactMimeType = exactMimeType;
}
public String getMimeType()
{
return mimeType;
}
public String getExtension()
{
return extension;
}
public String getPath()
{
return path;
}
public boolean isExactMimeType()
{
return exactMimeType;
}
public static TestFileInfo testFile(final String mimeType, final String extension,
final String path, final boolean exactMimeType)
{
return new TestFileInfo(mimeType, extension, path, exactMimeType);
}
}
public static class SourceTarget
{
final String source;
final String target;
private SourceTarget(final String source, final String target)
{
this.source = source;
this.target = target;
}
@Override
public boolean equals(Object o)
{
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
SourceTarget that = (SourceTarget) o;
return Objects.equals(source, that.source) &&
Objects.equals(target, that.target);
}
@Override
public int hashCode()
{
return Objects.hash(source, target);
}
@Override
public String toString()
{
return source + '|' + target;
}
public static SourceTarget of(final String source, final String target)
{
return new SourceTarget(source, target);
}
}
}

View File

@ -46,6 +46,9 @@ import org.springframework.test.context.junit4.SpringRunner;
@Import(HtmlParserContentTransformer.class) @Import(HtmlParserContentTransformer.class)
public class HtmlParserContentTransformerTest public class HtmlParserContentTransformerTest
{ {
private static final String SOURCE_MIMETYPE = "text/html";
private static final String TARGET_MIMETYPE = "text/plain";
@Autowired @Autowired
HtmlParserContentTransformer transformer; HtmlParserContentTransformer transformer;
@ -85,7 +88,7 @@ public class HtmlParserContentTransformerTest
Map<String, String> parameters = new HashMap<>(); Map<String, String> parameters = new HashMap<>();
parameters.put(SOURCE_ENCODING, "ISO-8859-1"); parameters.put(SOURCE_ENCODING, "ISO-8859-1");
transformer.transform(tmpS, tmpD, parameters); transformer.transform(tmpS, tmpD, SOURCE_MIMETYPE, TARGET_MIMETYPE, parameters);
assertEquals(expected, readFromFile(tmpD, "UTF-8")); assertEquals(expected, readFromFile(tmpD, "UTF-8"));
tmpS.delete(); tmpS.delete();
@ -98,7 +101,7 @@ public class HtmlParserContentTransformerTest
tmpD = File.createTempFile("AlfrescoTestTarget_", ".txt"); tmpD = File.createTempFile("AlfrescoTestTarget_", ".txt");
parameters = new HashMap<>(); parameters = new HashMap<>();
parameters.put(SOURCE_ENCODING, "UTF-8"); parameters.put(SOURCE_ENCODING, "UTF-8");
transformer.transform(tmpS, tmpD, parameters); transformer.transform(tmpS, tmpD, SOURCE_MIMETYPE, TARGET_MIMETYPE, parameters);
assertEquals(expected, readFromFile(tmpD, "UTF-8")); assertEquals(expected, readFromFile(tmpD, "UTF-8"));
tmpS.delete(); tmpS.delete();
tmpD.delete(); tmpD.delete();
@ -110,7 +113,7 @@ public class HtmlParserContentTransformerTest
tmpD = File.createTempFile("AlfrescoTestTarget_", ".txt"); tmpD = File.createTempFile("AlfrescoTestTarget_", ".txt");
parameters = new HashMap<>(); parameters = new HashMap<>();
parameters.put(SOURCE_ENCODING, "UTF-16"); parameters.put(SOURCE_ENCODING, "UTF-16");
transformer.transform(tmpS, tmpD, parameters); transformer.transform(tmpS, tmpD, SOURCE_MIMETYPE, TARGET_MIMETYPE, parameters);
assertEquals(expected, readFromFile(tmpD, "UTF-8")); assertEquals(expected, readFromFile(tmpD, "UTF-8"));
tmpS.delete(); tmpS.delete();
tmpD.delete(); tmpD.delete();
@ -135,7 +138,7 @@ public class HtmlParserContentTransformerTest
parameters = new HashMap<>(); parameters = new HashMap<>();
parameters.put(SOURCE_ENCODING, "ISO-8859-1"); parameters.put(SOURCE_ENCODING, "ISO-8859-1");
transformer.transform(tmpS, tmpD, parameters); transformer.transform(tmpS, tmpD, SOURCE_MIMETYPE, TARGET_MIMETYPE, parameters);
assertEquals(expected, readFromFile(tmpD, "UTF-8")); assertEquals(expected, readFromFile(tmpD, "UTF-8"));
tmpS.delete(); tmpS.delete();
tmpD.delete(); tmpD.delete();

View File

@ -116,7 +116,7 @@ public class TextToPdfContentTransformerTest
// Transform to PDF // Transform to PDF
Map<String, String> parameters = new HashMap<>(); Map<String, String> parameters = new HashMap<>();
parameters.put(PAGE_LIMIT, pageLimit); parameters.put(PAGE_LIMIT, pageLimit);
transformer.transform(sourceFile, targetFile, parameters); transformer.transform(sourceFile, targetFile, "text/plain", "application/pdf", parameters);
// Read back in the PDF and check it // Read back in the PDF and check it
PDDocument doc = PDDocument.load(targetFile); PDDocument doc = PDDocument.load(targetFile);

View File

@ -0,0 +1,4 @@
:ID,name,joined:date,active:boolean,points:int
user01,Joe Soap,2017-05-05,true,10
user02,Jane Doe,2017-08-21,true,15
user03,Moe Know,2018-02-17,false,7
1 :ID name joined:date active:boolean points:int
2 user01 Joe Soap 2017-05-05 true 10
3 user02 Jane Doe 2017-08-21 true 15
4 user03 Moe Know 2018-02-17 false 7

View File

@ -0,0 +1,17 @@
<html>
<head>
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
<title>The quick brown fox jumps over the lazy dog</title>
<meta name="author" content="Nevin Nollop">
<meta name="keywords" content="Pangram, fox, dog">
<meta name="description" content="Gym class featuring a brown fox and lazy dog">
</head>
<body lang=EN-US>
The quick brown fox jumps over the lazy dog
</body>
</html>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<document>
<text>The quick brown fox jumps over the lazy dog</text>
</document>

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN" "http://docs.oasis-open.org/dita/v1.1/OS/dtd/concept.dtd">
<concept id="quickConcept">
<title>The quick brown fox jumps over the lazy dog</title>
<shortdesc>Gym class featuring a brown fox and lazy dog</shortdesc>
<prolog>
<author>Alfresco Documentation</author>
<copyright>
<copyryear year="2011"/>
<copyrholder>Alfresco Software, Inc.</copyrholder>
</copyright>
<metadata>
<audience experiencelevel="expert" job="Customizing" type="Administrator"/>
<category>Testing</category>
<keywords>
<keyword>Pangram</keyword>
<keyword>Fox</keyword>
<keyword>Dog</keyword>
</keywords>
<prodinfo>
<prodname>Enterprise</prodname>
<vrmlist>
<vrm version="3.4.x" release="Enterprise" modification="2011/11/11"/>
</vrmlist>
</prodinfo>
</metadata>
</prolog>
<conbody>
<p>The quick brown fox jumps over the lazy dog</p>
</conbody>
</concept>

View File

@ -0,0 +1,5 @@
"Take some more [[tea]]," the March Hare said to Alice, very earnestly.
"I've had '''nothing''' yet," Alice replied in an offended tone, "so I can't take more."
"You mean you can't take ''less''," said the Hatter. "It's very easy to take ''more'' than nothing."<Paste>

View File

@ -0,0 +1,29 @@
/*
* #%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 <http://www.gnu.org/licenses/>.
* #L%
*/
function myFunction() {
document.getElementById("bla").innerHTML = "The quick brown fox jumps over the lazy dog";
}

View File

@ -0,0 +1,8 @@
body {
background-color: lightblue;
}
h1 {
color: navy;
margin-left: 20px;
}

View File

@ -214,7 +214,8 @@ public abstract class AbstractTransformerController implements TransformControll
// Run the transformation // Run the transformation
try try
{ {
processTransform(sourceFile, targetFile, request.getTransformRequestOptions(), timeout); processTransform(sourceFile, targetFile, request.getSourceMediaType(),
request.getTargetMediaType(), request.getTransformRequestOptions(), timeout);
} }
catch (TransformException e) catch (TransformException e)
{ {

View File

@ -65,8 +65,9 @@ public interface TransformController
ResponseEntity<TransformReply> transform(TransformRequest transformRequest, Long timeout); ResponseEntity<TransformReply> transform(TransformRequest transformRequest, Long timeout);
void processTransform(File sourceFile, File targetFile, Map<String, String> transformOptions, void processTransform(final File sourceFile, final File targetFile,
Long timeout); final String sourceMimetype, final String targetMimetype,
final Map<String, String> transformOptions, final Long timeout);
String getTransformerName(); String getTransformerName();

34
pom.xml
View File

@ -293,40 +293,6 @@
<artifactId>docker-maven-plugin</artifactId> <artifactId>docker-maven-plugin</artifactId>
<version>0.30.0</version> <version>0.30.0</version>
<extensions>true</extensions> <extensions>true</extensions>
<configuration>
<apiVersion>1.29</apiVersion>
<imagePullPolicy>Always</imagePullPolicy>
<autoCreateCustomNetworks>true</autoCreateCustomNetworks>
<!--<dockerHost>tcp://127.0.0.1:2376</dockerHost>-->
<images>
<image>
<alias>activemq</alias>
<name>alfresco/alfresco-activemq:5.15.6</name>
<run>
<hostname>activemq</hostname>
<network>
<name>transform</name>
<alias>activemq</alias>
</network>
<ports>
<port>8161:8161</port>
<port>5672:5672</port>
<port>61616:61616</port>
</ports>
<wait>
<log>Apache ActiveMQ 5.15.6 .* started</log>
<time>20000</time>
<kill>500</kill>
<shutdown>100</shutdown>
<exec>
<preStop>kill 1</preStop>
<preStop>kill -9 1</preStop>
</exec>
</wait>
</run>
</image>
</images>
</configuration>
<executions> <executions>
<execution> <execution>
<id>before-integration-tests</id> <id>before-integration-tests</id>