Merge branch 'master' into ATS-812_PoC_FFmpeg_skeleton

* master: (52 commits)
  [maven-release-plugin][skip ci] prepare for next development iteration
  [maven-release-plugin][skip ci] prepare release 2.5.7-A4
  ACS-2587 Fix test failure
  ACS-2587 Include directAccessUrl in T-Config if supported (#539)
  ATS-864: fix dependabot
  ATS-864: Switch from fabric8 to docker mvn plugin (#436)
  ACS-2072 Enforce third party license compliance.
  [maven-release-plugin][skip ci] prepare for next development iteration
  [maven-release-plugin][skip ci] prepare release 2.5.7-A3
  [trigger release] 2.5.7-A3
  Bump activemq-client from 5.16.3 to 5.16.4 (#534)
  Bump maven-javadoc-plugin from 3.3.1 to 3.3.2 (#533)
  ATS-981 Avoid CVE-2022-23181 with spring-boot-starter-web 2.6.3 (#537)
  [maven-release-plugin][skip ci] prepare for next development iteration
  [maven-release-plugin][skip ci] prepare release 2.5.7-A2
  [trigger release] 2.5.7-A2
  ACS-2497 Rework httpTransformRequestUsingDirectAccessUrlTest so it can be used in AI and Aspose (#535)
  Bump docker-maven-plugin from 0.38.1 to 0.39.0 (#528)
  [maven-release-plugin][skip ci] prepare for next development iteration
  [maven-release-plugin][skip ci] prepare release 2.5.7-A1
  ...

# Conflicts:
#	.travis.yml
#	alfresco-transformer-base/src/main/java/org/alfresco/transformer/util/RequestParamMap.java

Also bumped pom.xml version (for two ffmpeg folders) from 2.5.5-A2-SNAPSHOT to match others (2.5.7-A5-SNAPSHOT)
This commit is contained in:
Jan Vonka
2022-02-25 15:33:26 +00:00
92 changed files with 1215 additions and 1405 deletions

View File

@@ -13,10 +13,6 @@ updates:
time: "22:00"
timezone: Europe/London
open-pull-requests-limit: 99
ignore:
- dependency-name: io.fabric8:fabric8-maven-plugin
versions:
- "> 4.4.0, < 4.5"
registries:
- maven-alfresco-internal
- package-ecosystem: docker

View File

@@ -21,7 +21,6 @@ branches:
- master
- /^SP\/.+$/
- /^HF\/.+$/
- company_release
- /^ATS-.*$/
- /^ACS-.*$/
@@ -30,7 +29,6 @@ stages:
if: branch = master
- build and test
- release
- company_release
before_install: bash _ci/init.sh
@@ -47,6 +45,7 @@ jobs:
before_script: travis_wait bash _ci/cache_artifacts.sh
install: travis_wait 20 mvn -B -U -q clean install -DadditionalOption=-Xdoclint:none -DskipTests -Dmaven.javadoc.skip=true -Dmaven.wagon.http.pool=false -Pbase
script: mvn -B -U clean deploy -DadditionalOption=-Xdoclint:none -Dmaven.javadoc.skip=true -Dmaven.wagon.http.pool=false -Pbase
# TODO PoC for Video/Audio transforms (using FFmpeg)
- name: "Transform Video/Audio (FFmpeg)"
stage: build and test
@@ -54,54 +53,36 @@ jobs:
before_script: travis_wait bash _ci/cache_artifacts.sh
install: _ci/build.sh ffmpeg
script: bash _ci/test.sh ffmpeg
# - name: "ImageMagick"
# stage: build and test
# if: branch NOT IN (company_release)
# before_script: travis_wait bash _ci/cache_artifacts.sh
# install: _ci/build.sh imagemagick
# script: bash _ci/test.sh imagemagick
# - name: "LibreOffice"
# stage: build and test
# if: branch NOT IN (company_release)
# before_script: travis_wait bash _ci/cache_artifacts.sh
# install: _ci/build.sh libreoffice
# script: bash _ci/test.sh libreoffice
# - name: "Transform Misc"
# stage: build and test
# if: branch NOT IN (company_release)
# before_script: travis_wait bash _ci/cache_artifacts.sh
# install: _ci/build.sh misc
# script: bash _ci/test.sh misc
# - name: "PDF Renderer"
# stage: build and test
# if: branch NOT IN (company_release)
# before_script: travis_wait bash _ci/cache_artifacts.sh
# install: _ci/build.sh pdf-renderer
# script: bash _ci/test.sh pdf-renderer
# - name: "Tika"
# stage: build and test
# if: branch NOT IN (company_release)
# before_script: travis_wait bash _ci/cache_artifacts.sh
# install: _ci/build.sh tika
# script: bash _ci/test.sh tika
# - name: "All in One Transformer"
# stage: build and test
# if: branch NOT IN (company_release)
# before_script: travis_wait bash _ci/cache_artifacts.sh
# install: _ci/build.sh full-build
# script: travis_wait 30 bash _ci/test.sh aio-test
# - name: "WhiteSource"
# stage: build and test
# if: branch NOT IN (company_release)
# script: bash _ci/whitesource.sh
# - name: "Source Clear Scan (SCA)"
# if: branch NOT IN (company_release)
# install: skip
# script: travis_wait 30 bash _ci/sourceclear.sh
- name: "ImageMagick"
before_script: travis_wait bash _ci/cache_artifacts.sh
install: _ci/build.sh imagemagick
script: bash _ci/test.sh imagemagick
- name: "LibreOffice"
before_script: travis_wait bash _ci/cache_artifacts.sh
install: _ci/build.sh libreoffice
script: bash _ci/test.sh libreoffice
- name: "Transform Misc"
before_script: travis_wait bash _ci/cache_artifacts.sh
install: _ci/build.sh misc
script: bash _ci/test.sh misc
- name: "PDF Renderer"
before_script: travis_wait bash _ci/cache_artifacts.sh
install: _ci/build.sh pdf-renderer
script: bash _ci/test.sh pdf-renderer
- name: "Tika"
before_script: travis_wait bash _ci/cache_artifacts.sh
install: _ci/build.sh tika
script: bash _ci/test.sh tika
- name: "All in One Transformer"
before_script: travis_wait bash _ci/cache_artifacts.sh
install: _ci/build.sh full-build
script: travis_wait 30 bash _ci/test.sh aio-test
# - name: "Static Analysis (SAST)"
# stage: build and test
# TODO ATS-721: comment out until it is possible to run concurrent SAST scans
# if: branch NOT IN (company_release) AND type != pull_request
# if: type != pull_request
# if: branch = master AND type != pull_request
# before_install:
# - bash _ci/static_analysis_init.sh
@@ -113,34 +94,3 @@ jobs:
if: commit_message ~= /\[trigger release\]/ AND branch ~= /^(master|SP\/.+|HF\/.+)$/
before_script: travis_wait bash _ci/cache_artifacts.sh
script: travis_wait 55 bash _ci/release.sh
before_deploy: source _ci/prepare_staging_deploy.sh
deploy:
provider: s3
access_key_id: "${STAGING_AWS_ACCESS_KEY}"
secret_access_key: "${STAGING_AWS_SECRET_KEY}"
bucket: "alfresco-artefacts-staging"
skip_cleanup: true
region: "eu-west-1"
local_dir: "deploy_dir"
upload-dir: "enterprise/AlfrescoTransformServices/TransformEngines/${VERSION}"
on:
all_branches: true
- name: "Company Release"
stage: company_release
if: branch = company_release
before_install: bash _ci/init.sh
install: echo "NoOp"
script: echo "NoOp"
before_deploy: source _ci/prepare_release_deploy.sh
deploy:
provider: s3
access_key_id: "${RELEASE_AWS_ACCESS_KEY}"
secret_access_key: "${RELEASE_AWS_SECRET_KEY}"
bucket: "eu.dl.alfresco.com"
skip_cleanup: true
region: "eu-west-1"
local_dir: "deploy_dir"
upload-dir: "release/enterprise/AlfrescoTransformServices/TransformEngines/${VERSION}"
on:
branch: company_release

View File

@@ -1,8 +0,0 @@
{
"generalSettings": {
"shouldScanRepo": true
},
"checkRunSettings": {
"vulnerableCheckRunConclusionLevel": "failure"
}
}

View File

@@ -13,7 +13,7 @@ Contains the common transformer (T-Engine) code, plus a few actual implementatio
### Documentation
In addition to the sub-projects (such as `alfresco-transformer-base` README above) some additional documentation can be found in:
In addition to the subprojects (such as `alfresco-transformer-base` README above) some additional documentation can be found in:
* [this project's docs](docs) folder
* [ACS Packaging docs](https://github.com/Alfresco/acs-packaging/tree/master/docs) folder
@@ -68,7 +68,7 @@ You can find examples of using Core AIO in the reference ACS Deployment for Dock
* [ACS Community](https://github.com/Alfresco/acs-deployment/blob/master/docker-compose/community-docker-compose.yml)
* [ACS Enterprise](https://github.com/Alfresco/acs-deployment/blob/master/docker-compose/docker-compose.yml)
You can find examples of using the indivudal T-Engines in the reference ACS Deployment for Helm / Kubernetes:
You can find examples of using the individual T-Engines in the reference ACS Deployment for Helm / Kubernetes:
* [ACS Community](https://github.com/Alfresco/acs-deployment/blob/master/helm/alfresco-content-services/community_values.yaml)
* [ACS Enterprise](https://github.com/Alfresco/acs-deployment/blob/master/helm/alfresco-content-services/values.yaml)

View File

@@ -5,7 +5,7 @@ PS4="\[\e[35m\]+ \[\e[m\]"
set -vex
pushd "$(dirname "${BASH_SOURCE[0]}")/../"
LIBREOFFICE_VERSION=6.3.5
LIBREOFFICE_VERSION=7.0.6
# 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)

View File

@@ -1,24 +0,0 @@
#!/usr/bin/env bash
echo "========================== Starting Prepare Release Deploy Script ==========================="
PS4="\[\e[35m\]+ \[\e[m\]"
set -vex
pushd "$(dirname "${BASH_SOURCE[0]}")/../"
# Identify latest annotated tag (latest version)
export VERSION=$(git describe --abbrev=0 --tags)
mkdir -p deploy_dir
# Download the WhiteSource report
# mvn -B org.alfresco:whitesource-downloader-plugin:inventoryReport \
# -N \
# "-Dorg.whitesource.product=Transform Service" \
# -DsaveReportAs=deploy_dir/3rd-party.xlsx
echo "Local deploy directory content:"
ls -lA deploy_dir
popd
set +vex
echo "========================== Finishing Prepare Release Deploy Script =========================="

View File

@@ -1,24 +0,0 @@
#!/usr/bin/env bash
echo "========================== Starting Prepare Staging Deploy Script ==========================="
PS4="\[\e[35m\]+ \[\e[m\]"
set -vex
pushd "$(dirname "${BASH_SOURCE[0]}")/../"
# Identify latest annotated tag (latest version)
export VERSION=$(git describe --abbrev=0 --tags)
mkdir -p deploy_dir
# Download the WhiteSource report
# mvn -B org.alfresco:whitesource-downloader-plugin:inventoryReport \
# -N \
# "-Dorg.whitesource.product=Transform Service" \
# -DsaveReportAs=deploy_dir/3rd-party.xlsx
echo "Local deploy directory content:"
ls -lA deploy_dir
popd
set +vex
echo "========================== Finishing Prepare Staging Deploy Script =========================="

View File

@@ -28,10 +28,6 @@
<url>https://artifacts.alfresco.com/nexus/content/groups/internal</url>
</pluginRepository>
</pluginRepositories>
<properties>
<!-- WhiteSource token -->
<org.whitesource.orgToken>${env.WHITESOURCE_TOKEN}</org.whitesource.orgToken>
</properties>
</profile>
</profiles>

View File

@@ -5,7 +5,7 @@ PS4="\[\e[35m\]+ \[\e[m\]"
set +e -v -x
pushd "$(dirname "${BASH_SOURCE[0]}")/../"
mvn -B -q clean install \
mvn -B -U -q clean install \
-DskipTests \
-Dmaven.javadoc.skip=true \
com.srcclr:srcclr-maven-plugin:scan \

View File

@@ -1,22 +0,0 @@
#!/usr/bin/env bash
echo "=========================== Starting WhiteSource Script ==========================="
PS4="\[\e[35m\]+ \[\e[m\]"
set -vex
pushd "$(dirname "${BASH_SOURCE[0]}")/../"
mvn -B clean install \
-DskipTests org.whitesource:whitesource-maven-plugin:update \
-Dorg.whitesource.failOnError=true \
-Dorg.whitesource.forceUpdate=true \
-Dorg.whitesource.checkPolicies=true \
-Dorg.whitesource.forceCheckAllDependencies=true \
-Dorg.whitesource.ignorePomModules=false \
"-Dorg.whitesource.product=Transform Service" \
-Dmaven.wagon.http.pool=false
popd
set +vex
echo "=========================== Finishing WhiteSource Script =========================="

View File

@@ -52,6 +52,7 @@ RUN ln /usr/bin/alfresco-transform-core-aio-boot-${env.project_version}.jar /usr
make && \
make test && \
make install) && \
yum -y autoremove perl-ExtUtils-MakeMaker make && rm -rf ${EXIFTOOL_FOLDER} ${EXIFTOOL_FOLDER}.tgz && \
yum clean all
ADD target/generated-resources/licenses /licenses

View File

@@ -1,15 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>alfresco-transform-core-aio-boot</artifactId>
<name>Alfresco Core All-In-One Transformer Spring Boot</name>
<packaging>jar</packaging>
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-transform-core</artifactId>
<version>2.5.5-A2-SNAPSHOT</version>
<version>2.5.7-A5-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
@@ -104,43 +102,37 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>docker-it-setup</id>
<!-- raises an ActiveMq container for the Integration Tests -->
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
</plugin>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<executions>
<execution>
<id>integration-tests</id>
<goals>
<goal>start</goal>
<goal>stop</goal>
</goals>
<configuration>
<images>
<image>
<alias>activemq</alias>
<name>alfresco/alfresco-activemq:5.16.1</name>
<run>
<hostname>activemq</hostname>
@@ -150,7 +142,7 @@
<port>61616:61616</port>
</ports>
<wait>
<log>Apache ActiveMQ 5.16.1 .* started</log>
<log>Apache ActiveMQ .* started</log>
<time>20000</time>
<kill>500</kill>
<shutdown>100</shutdown>
@@ -161,9 +153,7 @@
</wait>
</run>
</image>
<image>
<alias>aio</alias>
<name>${image.name}:${image.tag}</name>
<run>
<ports>
@@ -187,6 +177,8 @@
</image>
</images>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
@@ -198,20 +190,7 @@
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId>
<configuration>
<images>
<image>
<name>${image.name}:${image.tag}</name>
<build>
<dockerFileDir>${project.basedir}/</dockerFileDir>
<buildOptions>
<squash>true</squash>
</buildOptions>
</build>
</image>
</images>
</configuration>
<artifactId>docker-maven-plugin</artifactId>
<executions>
<execution>
<id>build-image</id>
@@ -219,6 +198,19 @@
<goals>
<goal>build</goal>
</goals>
<configuration>
<images>
<image>
<name>${image.name}:${image.tag}</name>
<build>
<contextDir>${project.basedir}</contextDir>
<buildOptions>
<squash>true</squash>
</buildOptions>
</build>
</image>
</images>
</configuration>
</execution>
</executions>
</plugin>
@@ -232,7 +224,7 @@
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId>
<artifactId>docker-maven-plugin</artifactId>
<configuration>
<images>
<!-- QuayIO image -->
@@ -240,7 +232,7 @@
<name>${image.name}:${image.tag}</name>
<registry>${image.registry}</registry>
<build>
<dockerFileDir>${project.basedir}/</dockerFileDir>
<contextDir>${project.basedir}</contextDir>
<buildOptions>
<squash>true</squash>
</buildOptions>
@@ -250,7 +242,7 @@
<image>
<name>${image.name}:${image.tag}</name>
<build>
<dockerFileDir>${project.basedir}/</dockerFileDir>
<contextDir>${project.basedir}</contextDir>
<buildOptions>
<squash>true</squash>
</buildOptions>
@@ -260,16 +252,9 @@
</configuration>
<executions>
<execution>
<id>build-image</id>
<phase>package</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
<execution>
<id>push-image</id>
<phase>install</phase>
<goals>
<goal>build</goal>
<goal>push</goal>
</goals>
</execution>
@@ -285,15 +270,15 @@
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId>
<configuration combine.self="override">
<artifactId>docker-maven-plugin</artifactId>
<configuration>
<images>
<!-- QuayIO image -->
<image>
<name>${image.name}:${project.version}</name>
<registry>${image.registry}</registry>
<build>
<dockerFileDir>${project.basedir}/</dockerFileDir>
<contextDir>${project.basedir}</contextDir>
<buildOptions>
<squash>true</squash>
</buildOptions>
@@ -303,7 +288,7 @@
<image>
<name>${image.name}:${project.version}</name>
<build>
<dockerFileDir>${project.basedir}/</dockerFileDir>
<contextDir>${project.basedir}</contextDir>
<buildOptions>
<squash>true</squash>
</buildOptions>
@@ -313,8 +298,6 @@
</configuration>
<executions>
<execution>
<id>build-push-image</id>
<phase>deploy</phase>
<goals>
<goal>build</goal>
<goal>push</goal>

View File

@@ -1,54 +0,0 @@
# Generated by org.codehaus.mojo.license.AddThirdPartyMojo
#-------------------------------------------------------------------------------
# Already used licenses in project :
# - (MIT-style) netCDF C library license
# - 3-Clause BSD License
# - Apache 2.0
# - Apache License 2.0
# - Apache License v2
# - Apache License v2.0
# - Apache License, Version 2.0
# - Apache License, version 2.0
# - Apache Software License - Version 2.0
# - BSD
# - BSD 3-clause License w/nuclear disclaimer
# - BSD 3-clause New License
# - BSD License
# - BSD-2-Clause
# - Bouncy Castle Licence
# - CDDL + GPLv2 with classpath exception
# - CDDL, v1.0
# - CDDL/GPLv2+CE
# - Common Development and Distribution License (CDDL) v1.0
# - Common Public License
# - EDL 1.0
# - EPL 2.0
# - Eclipse Distribution License - v 1.0
# - Eclipse Public License - v 1.0
# - Eclipse Public License 2.0
# - GNU General Public License, version 2 with the GNU Classpath Exception
# - GNU Lesser General Public License
# - GPL2 w/ CPE
# - LGPL, v2.1 or later
# - LGPL, version 2.1
# - MIT License
# - MIT License (MIT)
# - Mozilla Public License 1.1 (MPL 1.1)
# - OGC copyright
# - Public Domain
# - Public Domain, per Creative Commons CC0
# - Similar to Apache License but with the acknowledgment clause removed
# - The Apache License, Version 2.0
# - The Apache Software License, Version 2.0
# - The BSD License
# - The MIT License
# - The SAX License
# - The W3C License
# - UnRar License
# - lgpl
#-------------------------------------------------------------------------------
# Please fill the missing licenses for dependencies :
#
#
#Thu Apr 09 10:34:00 BST 2020
net.jcip--jcip-annotations--1.0=Public

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Transform Core
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -35,6 +35,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestParam;
import java.io.File;
import java.util.HashMap;
@@ -42,6 +43,9 @@ import java.util.Map;
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_HTML;
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_TEXT_PLAIN;
import static org.alfresco.transform.client.model.config.CoreVersionDecorator.setOrClearCoreVersion;
import static org.alfresco.transform.client.util.RequestParamMap.CONFIG_VERSION_DEFAULT;
import static org.alfresco.transformer.util.RequestParamMap.CONFIG_VERSION;
import static org.alfresco.transformer.util.RequestParamMap.SOURCE_ENCODING;
import static org.alfresco.transformer.util.RequestParamMap.TRANSFORM_NAME_PARAMETER;
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
@@ -88,10 +92,12 @@ public class AIOController extends AbstractTransformerController
}
@Override
public ResponseEntity<TransformConfig> info()
public ResponseEntity<TransformConfig> info(
@RequestParam(value = CONFIG_VERSION, defaultValue = CONFIG_VERSION_DEFAULT) int configVersion)
{
logger.info("GET Transform Config.");
logger.info("GET Transform Config version: " + configVersion);
TransformConfig transformConfig = transformRegistry.getTransformConfig();
transformConfig = setOrClearCoreVersion(transformConfig, configVersion);
return new ResponseEntity<>(transformConfig, OK);
}
@@ -105,7 +111,7 @@ public class AIOController extends AbstractTransformerController
Transformer transformer = transformRegistry.getByTransformName(transformName);
if (transformer == null)
{
new TransformException(INTERNAL_SERVER_ERROR.value(), "No transformer mapping for - transform:"
throw new TransformException(INTERNAL_SERVER_ERROR.value(), "No transformer mapping for - transform:"
+ transformName + " sourceMimetype:" + sourceMimetype + " targetMimetype:" + targetMimetype);
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Transform Core
* %%
* Copyright (C) 2005 - 2021 Alfresco Software Limited
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -85,6 +85,9 @@ public class AIOCustomConfig
@Value("${transform.core.tika.pdfBox.notExtractBookmarksTextDefault:false}")
private boolean notExtractBookmarksTextDefault;
@Value("${transform.core.version}")
private String coreVersion;
/**
*
* @return Override the TransformRegistryImpl used in {@link AbstractTransformerController}
@@ -94,13 +97,14 @@ public class AIOCustomConfig
public TransformServiceRegistry aioTransformRegistry() throws Exception
{
AIOTransformRegistry aioTransformRegistry = new AIOTransformRegistry();
aioTransformRegistry.setCoreVersion(coreVersion);
// T-Engines are sorted by name so they are combined in the same order as in the T-Router
// and Content Repository with individual T-Engines. See TransformersConfigRegistry#retrieveRemoteConfig and
// LocalTransformServiceRegistry#getTEngineUrlsSortedByName.
for (Transformer tEngine : getTEnginesSortedByName())
{
aioTransformRegistry.registerTransformer(tEngine); // now a poor name - should be combinedTransformers
aioTransformRegistry.registerTransformer(tEngine); // now a poor name - should be combineTransformers
}
aioTransformRegistry.registerCombinedTransformers();
return aioTransformRegistry;

View File

@@ -2,6 +2,7 @@ queue:
engineRequestQueue: ${TRANSFORM_ENGINE_REQUEST_QUEUE:org.alfresco.transform.engine.aio.acs}
transform:
core:
version: @project.version@
pdfrenderer:
exe: ${PDFRENDERER_EXE:/usr/bin/alfresco-pdf-renderer}
libreoffice:

View File

@@ -106,6 +106,14 @@ public class AIOControllerImageMagickTest extends ImageMagickControllerTest
}
@Test
@Override
public void testGetTransformConfigInfoExcludingCoreVersion()
{
// Ignore the test in super class as the way the AIO transformer provides config is fundamentally different.
}
@Test
@Override
public void testGetInfoFromConfigWithDuplicates()

View File

@@ -88,6 +88,13 @@ public class AIOControllerLibreOfficeTest extends LibreOfficeControllerTest
}
@Test
@Override
public void testGetTransformConfigInfoExcludingCoreVersion()
{
// Ignore the test in super class as the way the AIO transformer provides config is fundamentally different.
}
@Test
@Override
public void testGetInfoFromConfigWithDuplicates()

View File

@@ -50,10 +50,17 @@ public class AIOControllerMiscTest extends MiscControllerTest
@Override
public void testGetTransformConfigInfo()
{
// Ignore the test in super class as the way the AIO transformer provides config is fundamentality different.
// Ignore the test in super class as the way the AIO transformer provides config is fundamentally different.
}
@Test
@Override
public void testGetTransformConfigInfoExcludingCoreVersion()
{
// Ignore the test in super class as the way the AIO transformer provides config is fundamentally different.
}
@Test
@Override
public void testGetInfoFromConfigWithDuplicates()

View File

@@ -84,9 +84,15 @@ public class AIOControllerPdfRendererTest extends AlfrescoPdfRendererControllerT
public void testGetTransformConfigInfo()
{
// Ignore the test in super class as the way the AIO transformer provides config is fundamentally different.
}
@Test
@Override
public void testGetTransformConfigInfoExcludingCoreVersion()
{
// Ignore the test in super class as the way the AIO transformer provides config is fundamentally different.
}
@Test
@Override
public void testGetInfoFromConfigWithDuplicates()

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Transform Core
* %%
* Copyright (C) 2005 - 2021 Alfresco Software Limited
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -29,15 +29,25 @@ package org.alfresco.transformer;
import java.io.IOException;
import org.alfresco.transform.client.model.TransformRequest;
import org.alfresco.transform.client.model.config.TransformConfig;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.context.annotation.Import;
import org.springframework.http.ResponseEntity;
import static org.alfresco.transform.client.util.RequestParamMap.CONFIG_VERSION_DEFAULT;
import static org.alfresco.transform.client.util.RequestParamMap.CONFIG_VERSION_LATEST;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
@WebMvcTest(AIOController.class)
@Import(AIOCustomConfig.class)
public class AIOControllerTest //extends AbstractTransformerControllerTest
{
@Value("${transform.core.version}")
private String coreVersion;
@Autowired
AIOController aioController;
@@ -64,6 +74,20 @@ public class AIOControllerTest //extends AbstractTransformerControllerTest
@Test
public void emptyTest()
{
aioController.info();
ResponseEntity<TransformConfig> responseEntity = aioController.info(Integer.valueOf(CONFIG_VERSION_DEFAULT));
responseEntity.getBody().getTransformers().forEach(transformer -> {
assertNull(transformer.getCoreVersion(), transformer.getTransformerName() +
" should have had a null coreValue but was " + transformer.getCoreVersion());
});
}
@Test
public void emptyTestWithLatestVersion()
{
ResponseEntity<TransformConfig> responseEntity = aioController.info(CONFIG_VERSION_LATEST);
responseEntity.getBody().getTransformers().forEach(transformer -> {
assertNotNull(transformer.getCoreVersion(), transformer.getTransformerName() +
" should have had a coreValue but was null. Should have been " + coreVersion);
});
}
}

View File

@@ -57,6 +57,14 @@ public class AIOControllerTikaTest extends TikaControllerTest
}
@Test
@Override
public void testGetTransformConfigInfoExcludingCoreVersion()
{
// Ignore the test in super class as the way the AIO transformer provides config is fundamentally different.
}
@Test
@Override
public void testGetInfoFromConfigWithDuplicates()

View File

@@ -3,12 +3,11 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>alfresco-transform-core-aio</artifactId>
<name>Alfresco Core All-In-One Transformer</name>
<packaging>jar</packaging>
<parent>
<artifactId>alfresco-transform-core</artifactId>
<groupId>org.alfresco</groupId>
<version>2.5.5-A2-SNAPSHOT</version>
<version>2.5.7-A5-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
@@ -56,21 +55,12 @@
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

View File

@@ -1,54 +0,0 @@
# Generated by org.codehaus.mojo.license.AddThirdPartyMojo
#-------------------------------------------------------------------------------
# Already used licenses in project :
# - (MIT-style) netCDF C library license
# - 3-Clause BSD License
# - Apache 2.0
# - Apache License 2.0
# - Apache License v2
# - Apache License v2.0
# - Apache License, Version 2.0
# - Apache License, version 2.0
# - Apache Software License - Version 2.0
# - BSD
# - BSD 3-clause License w/nuclear disclaimer
# - BSD 3-clause New License
# - BSD License
# - BSD-2-Clause
# - Bouncy Castle Licence
# - CDDL + GPLv2 with classpath exception
# - CDDL, v1.0
# - CDDL/GPLv2+CE
# - Common Development and Distribution License (CDDL) v1.0
# - Common Public License
# - EDL 1.0
# - EPL 2.0
# - Eclipse Distribution License - v 1.0
# - Eclipse Public License - v 1.0
# - Eclipse Public License 2.0
# - GNU General Public License, version 2 with the GNU Classpath Exception
# - GNU Lesser General Public License
# - GPL2 w/ CPE
# - LGPL, v2.1 or later
# - LGPL, version 2.1
# - MIT License
# - MIT License (MIT)
# - Mozilla Public License 1.1 (MPL 1.1)
# - OGC copyright
# - Public Domain
# - Public Domain, per Creative Commons CC0
# - Similar to Apache License but with the acknowledgment clause removed
# - The Apache License, Version 2.0
# - The Apache Software License, Version 2.0
# - The BSD License
# - The MIT License
# - The SAX License
# - The W3C License
# - UnRar License
# - lgpl
#-------------------------------------------------------------------------------
# Please fill the missing licenses for dependencies :
#
#
#Thu Apr 09 10:33:33 BST 2020
net.jcip--jcip-annotations--1.0=Public

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Transform Core
* %%
* Copyright (C) 2005 - 2021 Alfresco Software Limited
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -34,6 +34,7 @@ import org.alfresco.transform.client.registry.TransformCache;
import org.alfresco.transformer.executors.Transformer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import java.io.IOException;
import java.io.InputStream;
@@ -43,6 +44,7 @@ import java.util.HashMap;
import java.util.Map;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.alfresco.transform.client.model.config.CoreVersionDecorator.setCoreVersionOnSingleStepTransformers;
/**
* AIOTransformRegistry manages all of the sub transformers registered to it and provides aggregated TransformConfig.
@@ -53,6 +55,8 @@ public class AIOTransformRegistry extends AbstractTransformRegistry
private static final String ENGINE_CONFIG_LOCATION_POSTFIX = "_engine_config.json";
private String coreVersion;
private CombinedTransformConfig combinedTransformConfig = new CombinedTransformConfig();
// Holds the structures used by AbstractTransformRegistry to look up what is supported.
@@ -64,20 +68,26 @@ public class AIOTransformRegistry extends AbstractTransformRegistry
// Represents the mapping between a transform and a transformer, multiple mappings can point to the same transformer.
private Map<String, Transformer> transformerEngineMapping = new HashMap();
public void setCoreVersion(String coreVersion)
{
this.coreVersion = coreVersion;
}
/**
* Adds a transformer's (T-Engine) config to the configuration and creates a map of transforms to the T-Engine.
* The name of this method is now misleading as the registry of transforms takes place in
* {@link #registerCombinedTransformers()} .
* @param transformer The transformer implementation, this could be a single transformer
* @param tEngine The transformer implementation, this could be a single transformer
* or a transformer managing multiple sub transformers. The transformer's configuration file will
* be read based on the {@link Transformer#getTransformerId()} value.
*/
public void registerTransformer(final Transformer transformer) throws Exception
public void registerTransformer(final Transformer tEngine) throws Exception
{
// Load config for the transformer
String location = getTransformConfigLocation(transformer);
String location = getTransformConfigLocation(tEngine);
TransformConfig transformConfig = loadTransformConfig(location);
String transformerId = transformer.getTransformerId();
setCoreVersionOnSingleStepTransformers(transformConfig, coreVersion);
String transformerId = tEngine.getTransformerId();
combinedTransformConfig.addTransformConfig(transformConfig, location, transformerId, this);
// Map all of the transforms defined in the config to this Transformer implementation
@@ -90,7 +100,7 @@ public class AIOTransformRegistry extends AbstractTransformRegistry
{
log.debug("Overriding transform with name: '{}' originally defined in '{}'.", transformerName, originalTEngine.getTransformerId());
}
transformerEngineMapping.put(transformerName, transformer);
transformerEngineMapping.put(transformerName, tEngine);
log.debug("Registered transform with name: '{}' defined in '{}'.", transformerName, transformerId);
}
}

View File

@@ -9,7 +9,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-transform-core</artifactId>
<version>2.5.5-A2-SNAPSHOT</version>
<version>2.5.7-A5-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-transform-core</artifactId>
<version>2.5.5-A2-SNAPSHOT</version>
<version>2.5.7-A5-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>alfresco-transform-imagemagick-boot</artifactId>
<name>Alfresco ImageMagick Transformer Spring Boot</name>
<packaging>jar</packaging>
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-transform-core</artifactId>
<version>2.5.5-A2-SNAPSHOT</version>
<version>2.5.7-A5-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
@@ -66,30 +66,14 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<goals>
@@ -101,20 +85,29 @@
</plugins>
</build>
<profiles>
<profile>
<id>docker-it-setup</id>
<!-- raises an ActiveMq container for the Integration Tests -->
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
</plugin>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<executions>
<execution>
<id>integration-tests</id>
<goals>
<goal>start</goal>
<goal>stop</goal>
</goals>
<configuration>
<images>
<image>
<alias>activemq</alias>
<name>alfresco/alfresco-activemq:5.16.1</name>
<run>
<hostname>activemq</hostname>
@@ -135,9 +128,7 @@
</wait>
</run>
</image>
<image>
<alias>imagemagick</alias>
<name>${image.name}:${image.tag}</name>
<run>
<ports>
@@ -161,6 +152,8 @@
</image>
</images>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
@@ -172,20 +165,7 @@
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId>
<configuration>
<images>
<image>
<name>${image.name}:${image.tag}</name>
<build>
<dockerFileDir>${project.basedir}/</dockerFileDir>
<buildOptions>
<squash>true</squash>
</buildOptions>
</build>
</image>
</images>
</configuration>
<artifactId>docker-maven-plugin</artifactId>
<executions>
<execution>
<id>build-image</id>
@@ -193,6 +173,19 @@
<goals>
<goal>build</goal>
</goals>
<configuration>
<images>
<image>
<name>${image.name}:${image.tag}</name>
<build>
<contextDir>${project.basedir}</contextDir>
<buildOptions>
<squash>true</squash>
</buildOptions>
</build>
</image>
</images>
</configuration>
</execution>
</executions>
</plugin>
@@ -206,7 +199,7 @@
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId>
<artifactId>docker-maven-plugin</artifactId>
<configuration>
<images>
<!-- QuayIO image -->
@@ -214,7 +207,7 @@
<name>${image.name}:${image.tag}</name>
<registry>${image.registry}</registry>
<build>
<dockerFileDir>${project.basedir}/</dockerFileDir>
<contextDir>${project.basedir}</contextDir>
<buildOptions>
<squash>true</squash>
</buildOptions>
@@ -224,7 +217,7 @@
<image>
<name>${image.name}:${image.tag}</name>
<build>
<dockerFileDir>${project.basedir}/</dockerFileDir>
<contextDir>${project.basedir}</contextDir>
<buildOptions>
<squash>true</squash>
</buildOptions>
@@ -234,16 +227,9 @@
</configuration>
<executions>
<execution>
<id>build-image</id>
<phase>package</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
<execution>
<id>push-image</id>
<phase>install</phase>
<goals>
<goal>build</goal>
<goal>push</goal>
</goals>
</execution>
@@ -259,15 +245,15 @@
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId>
<configuration combine.self="override">
<artifactId>docker-maven-plugin</artifactId>
<configuration>
<images>
<!-- QuayIO image -->
<image>
<name>${image.name}:${project.version}</name>
<registry>${image.registry}</registry>
<build>
<dockerFileDir>${project.basedir}/</dockerFileDir>
<contextDir>${project.basedir}</contextDir>
<buildOptions>
<squash>true</squash>
</buildOptions>
@@ -277,7 +263,7 @@
<image>
<name>${image.name}:${project.version}</name>
<build>
<dockerFileDir>${project.basedir}/</dockerFileDir>
<contextDir>${project.basedir}</contextDir>
<buildOptions>
<squash>true</squash>
</buildOptions>
@@ -287,8 +273,6 @@
</configuration>
<executions>
<execution>
<id>build-push-image</id>
<phase>deploy</phase>
<goals>
<goal>build</goal>
<goal>push</goal>

View File

@@ -2,6 +2,7 @@ queue:
engineRequestQueue: ${TRANSFORM_ENGINE_REQUEST_QUEUE:org.alfresco.transform.engine.imagemagick.acs}
transform:
core:
version: @project.version@
config:
location: classpath:imagemagick_engine_config.json
imagemagick:

View File

@@ -26,6 +26,7 @@
*/
package org.alfresco.transformer;
import static org.alfresco.transform.client.util.RequestParamMap.ENDPOINT_TRANSFORM;
import static org.alfresco.transformer.util.MimetypeMap.PREFIX_IMAGE;
import static org.hamcrest.Matchers.containsString;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -227,7 +228,7 @@ public class ImageMagickControllerTest extends AbstractTransformerControllerTest
expectedOptions = "-auto-orient " + "-gravity " + value + " +repage";
mockMvc
.perform(MockMvcRequestBuilders
.multipart("/transform")
.multipart(ENDPOINT_TRANSFORM)
.file(sourceFile)
.param("targetExtension", targetExtension)
.param("targetMimetype", targetMimetype)
@@ -244,7 +245,7 @@ public class ImageMagickControllerTest extends AbstractTransformerControllerTest
{
mockMvc
.perform(MockMvcRequestBuilders
.multipart("/transform")
.multipart(ENDPOINT_TRANSFORM)
.file(sourceFile)
.param("targetExtension", targetExtension)
.param("targetMimetype", targetMimetype)
@@ -260,7 +261,7 @@ public class ImageMagickControllerTest extends AbstractTransformerControllerTest
expectedSourceSuffix = "[2-3]";
mockMvc
.perform(MockMvcRequestBuilders
.multipart("/transform")
.multipart(ENDPOINT_TRANSFORM)
.file(sourceFile)
.param("targetExtension", targetExtension)
.param("targetMimetype", targetMimetype)
@@ -298,7 +299,7 @@ public class ImageMagickControllerTest extends AbstractTransformerControllerTest
expectedSourceSuffix = "[2-3]";
mockMvc
.perform(MockMvcRequestBuilders
.multipart("/transform")
.multipart(ENDPOINT_TRANSFORM)
.file(sourceFile)
.param("targetExtension", targetExtension)
.param("targetMimetype", targetMimetype)
@@ -336,7 +337,7 @@ public class ImageMagickControllerTest extends AbstractTransformerControllerTest
expectedOptions = "( horrible command / ); -auto-orient -resize 321x654";
mockMvc
.perform(MockMvcRequestBuilders
.multipart("/transform")
.multipart(ENDPOINT_TRANSFORM)
.file(sourceFile)
.param("targetExtension", targetExtension)
.param("targetMimetype", targetMimetype)
@@ -365,7 +366,7 @@ public class ImageMagickControllerTest extends AbstractTransformerControllerTest
{
when(mockExecutionResult.getExitValue()).thenReturn(1);
mockMvc.perform(mockMvcRequest("/transform", sourceFile, "targetExtension", "xxx"))
mockMvc.perform(mockMvcRequest(ENDPOINT_TRANSFORM, sourceFile, "targetExtension", "xxx"))
.andExpect(status().is(BAD_REQUEST.value()))
.andExpect(
status().reason(containsString("Transformer exit code was not 0: \nSTDERR")));
@@ -399,7 +400,7 @@ public class ImageMagickControllerTest extends AbstractTransformerControllerTest
String tr = objectMapper.writeValueAsString(transformRequest);
String transformationReplyAsString = mockMvc
.perform(MockMvcRequestBuilders
.post("/transform")
.post(ENDPOINT_TRANSFORM)
.header(ACCEPT, APPLICATION_JSON_VALUE)
.header(CONTENT_TYPE, APPLICATION_JSON_VALUE)
.content(tr))

View File

@@ -3,12 +3,11 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>alfresco-transform-imagemagick</artifactId>
<name>Alfresco ImageMagick Transformer</name>
<packaging>jar</packaging>
<parent>
<artifactId>alfresco-transform-core</artifactId>
<groupId>org.alfresco</groupId>
<version>2.5.5-A2-SNAPSHOT</version>
<version>2.5.7-A5-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
@@ -18,7 +17,6 @@
<artifactId>alfresco-transformer-base</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<build>
@@ -27,14 +25,6 @@
<groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

View File

@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>alfresco-transform-libreoffice-boot</artifactId>
<name>Alfresco LibreOffice Transformer Spring Boot </name>
<packaging>jar</packaging>
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-transform-core</artifactId>
<version>2.5.5-A2-SNAPSHOT</version>
<version>2.5.7-A5-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
@@ -74,30 +74,14 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<goals>
@@ -109,20 +93,29 @@
</plugins>
</build>
<profiles>
<profile>
<id>docker-it-setup</id>
<!-- raises an ActiveMq container for the Integration Tests -->
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
</plugin>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<executions>
<execution>
<id>integration-tests</id>
<goals>
<goal>start</goal>
<goal>stop</goal>
</goals>
<configuration>
<images>
<image>
<alias>activemq</alias>
<name>alfresco/alfresco-activemq:5.16.1</name>
<run>
<hostname>activemq</hostname>
@@ -143,9 +136,7 @@
</wait>
</run>
</image>
<image>
<alias>libreoffice</alias>
<name>${image.name}:${image.tag}</name>
<run>
<ports>
@@ -169,6 +160,8 @@
</image>
</images>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
@@ -180,20 +173,7 @@
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId>
<configuration>
<images>
<image>
<name>${image.name}:${image.tag}</name>
<build>
<dockerFileDir>${project.basedir}/</dockerFileDir>
<buildOptions>
<squash>true</squash>
</buildOptions>
</build>
</image>
</images>
</configuration>
<artifactId>docker-maven-plugin</artifactId>
<executions>
<execution>
<id>build-image</id>
@@ -201,6 +181,19 @@
<goals>
<goal>build</goal>
</goals>
<configuration>
<images>
<image>
<name>${image.name}:${image.tag}</name>
<build>
<contextDir>${project.basedir}</contextDir>
<buildOptions>
<squash>true</squash>
</buildOptions>
</build>
</image>
</images>
</configuration>
</execution>
</executions>
</plugin>
@@ -214,7 +207,7 @@
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId>
<artifactId>docker-maven-plugin</artifactId>
<configuration>
<images>
<!-- QuayIO image -->
@@ -222,7 +215,7 @@
<name>${image.name}:${image.tag}</name>
<registry>${image.registry}</registry>
<build>
<dockerFileDir>${project.basedir}/</dockerFileDir>
<contextDir>${project.basedir}</contextDir>
<buildOptions>
<squash>true</squash>
</buildOptions>
@@ -232,7 +225,7 @@
<image>
<name>${image.name}:${image.tag}</name>
<build>
<dockerFileDir>${project.basedir}/</dockerFileDir>
<contextDir>${project.basedir}</contextDir>
<buildOptions>
<squash>true</squash>
</buildOptions>
@@ -242,16 +235,9 @@
</configuration>
<executions>
<execution>
<id>build-image</id>
<phase>package</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
<execution>
<id>push-image</id>
<phase>install</phase>
<goals>
<goal>build</goal>
<goal>push</goal>
</goals>
</execution>
@@ -267,15 +253,15 @@
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId>
<configuration combine.self="override">
<artifactId>docker-maven-plugin</artifactId>
<configuration>
<images>
<!-- QuayIO image -->
<image>
<name>${image.name}:${project.version}</name>
<registry>${image.registry}</registry>
<build>
<dockerFileDir>${project.basedir}/</dockerFileDir>
<contextDir>${project.basedir}</contextDir>
<buildOptions>
<squash>true</squash>
</buildOptions>
@@ -285,7 +271,7 @@
<image>
<name>${image.name}:${project.version}</name>
<build>
<dockerFileDir>${project.basedir}/</dockerFileDir>
<contextDir>${project.basedir}</contextDir>
<buildOptions>
<squash>true</squash>
</buildOptions>
@@ -293,16 +279,6 @@
</image>
</images>
</configuration>
<executions>
<execution>
<id>build-push-image</id>
<phase>deploy</phase>
<goals>
<goal>build</goal>
<goal>push</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

View File

@@ -2,6 +2,7 @@ queue:
engineRequestQueue: ${TRANSFORM_ENGINE_REQUEST_QUEUE:org.alfresco.transform.engine.libreoffice.acs}
transform:
core:
version: @project.version@
config:
location: classpath:libreoffice_engine_config.json
libreoffice:

View File

@@ -27,6 +27,7 @@
package org.alfresco.transformer;
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_PDF;
import static org.alfresco.transform.client.util.RequestParamMap.ENDPOINT_TRANSFORM;
import static org.alfresco.transformer.util.RequestParamMap.SOURCE_MIMETYPE;
import static org.alfresco.transformer.util.RequestParamMap.TARGET_EXTENSION;
import static org.alfresco.transformer.util.RequestParamMap.TARGET_MIMETYPE;
@@ -200,7 +201,7 @@ public class LibreOfficeControllerTest extends AbstractTransformerControllerTest
mockMvc
.perform(MockMvcRequestBuilders
.multipart("/transform")
.multipart(ENDPOINT_TRANSFORM)
.file(sourceFile)
.param(TARGET_EXTENSION, "xxx")
.param(SOURCE_MIMETYPE,sourceMimetype)
@@ -247,7 +248,7 @@ public class LibreOfficeControllerTest extends AbstractTransformerControllerTest
String tr = objectMapper.writeValueAsString(transformRequest);
String transformationReplyAsString = mockMvc
.perform(MockMvcRequestBuilders
.post("/transform")
.post(ENDPOINT_TRANSFORM)
.header(ACCEPT, APPLICATION_JSON_VALUE)
.header(CONTENT_TYPE, APPLICATION_JSON_VALUE)
.content(tr))

View File

@@ -3,12 +3,11 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>alfresco-transform-libreoffice</artifactId>
<name>Alfresco LibreOffice Transformer</name>
<packaging>jar</packaging>
<parent>
<artifactId>alfresco-transform-core</artifactId>
<groupId>org.alfresco</groupId>
<version>2.5.5-A2-SNAPSHOT</version>
<version>2.5.7-A5-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
@@ -18,12 +17,10 @@
<artifactId>alfresco-transformer-base</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.dom4j</groupId>
<artifactId>dom4j</artifactId>
</dependency>
<dependency>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-jodconverter-core</artifactId>
@@ -44,15 +41,6 @@
<groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

View File

@@ -1,15 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>alfresco-transform-misc-boot</artifactId>
<name>Alfresco Miscellaneous Transformer Spring Boot</name>
<packaging>jar</packaging>
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-transform-core</artifactId>
<version>2.5.5-A2-SNAPSHOT</version>
<version>2.5.7-A5-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
@@ -64,30 +62,14 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<goals>
@@ -99,20 +81,29 @@
</plugins>
</build>
<profiles>
<profile>
<id>docker-it-setup</id>
<!-- raises an ActiveMq container for the Integration Tests -->
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
</plugin>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<executions>
<execution>
<id>integration-tests</id>
<goals>
<goal>start</goal>
<goal>stop</goal>
</goals>
<configuration>
<images>
<image>
<alias>activemq</alias>
<name>alfresco/alfresco-activemq:5.16.1</name>
<run>
<hostname>activemq</hostname>
@@ -133,9 +124,7 @@
</wait>
</run>
</image>
<image>
<alias>misc</alias>
<name>${image.name}:${image.tag}</name>
<run>
<ports>
@@ -159,6 +148,8 @@
</image>
</images>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
@@ -170,20 +161,7 @@
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId>
<configuration>
<images>
<image>
<name>${image.name}:${image.tag}</name>
<build>
<dockerFileDir>${project.basedir}/</dockerFileDir>
<buildOptions>
<squash>true</squash>
</buildOptions>
</build>
</image>
</images>
</configuration>
<artifactId>docker-maven-plugin</artifactId>
<executions>
<execution>
<id>build-image</id>
@@ -191,6 +169,19 @@
<goals>
<goal>build</goal>
</goals>
<configuration>
<images>
<image>
<name>${image.name}:${image.tag}</name>
<build>
<contextDir>${project.basedir}</contextDir>
<buildOptions>
<squash>true</squash>
</buildOptions>
</build>
</image>
</images>
</configuration>
</execution>
</executions>
</plugin>
@@ -204,7 +195,7 @@
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId>
<artifactId>docker-maven-plugin</artifactId>
<configuration>
<images>
<!-- QuayIO image -->
@@ -212,7 +203,7 @@
<name>${image.name}:${image.tag}</name>
<registry>${image.registry}</registry>
<build>
<dockerFileDir>${project.basedir}/</dockerFileDir>
<contextDir>${project.basedir}</contextDir>
<buildOptions>
<squash>true</squash>
</buildOptions>
@@ -222,7 +213,7 @@
<image>
<name>${image.name}:${image.tag}</name>
<build>
<dockerFileDir>${project.basedir}/</dockerFileDir>
<contextDir>${project.basedir}</contextDir>
<buildOptions>
<squash>true</squash>
</buildOptions>
@@ -232,16 +223,9 @@
</configuration>
<executions>
<execution>
<id>build-image</id>
<phase>package</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
<execution>
<id>push-image</id>
<phase>install</phase>
<goals>
<goal>build</goal>
<goal>push</goal>
</goals>
</execution>
@@ -257,15 +241,15 @@
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId>
<configuration combine.self="override">
<artifactId>docker-maven-plugin</artifactId>
<configuration>
<images>
<!-- QuayIO image -->
<image>
<name>${image.name}:${project.version}</name>
<registry>${image.registry}</registry>
<build>
<dockerFileDir>${project.basedir}/</dockerFileDir>
<contextDir>${project.basedir}</contextDir>
<buildOptions>
<squash>true</squash>
</buildOptions>
@@ -275,7 +259,7 @@
<image>
<name>${image.name}:${project.version}</name>
<build>
<dockerFileDir>${project.basedir}/</dockerFileDir>
<contextDir>${project.basedir}</contextDir>
<buildOptions>
<squash>true</squash>
</buildOptions>
@@ -283,16 +267,6 @@
</image>
</images>
</configuration>
<executions>
<execution>
<id>build-push-image</id>
<phase>deploy</phase>
<goals>
<goal>build</goal>
<goal>push</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Transform Core
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -38,7 +38,7 @@ import java.util.Map;
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_HTML;
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_TEXT_PLAIN;
import static org.alfresco.transformer.transformers.HtmlParserContentTransformer.SOURCE_ENCODING;
import static org.alfresco.transformer.util.RequestParamMap.SOURCE_ENCODING;
import static org.alfresco.transformer.util.RequestParamMap.TRANSFORM_NAME_PARAMETER;
@Controller

View File

@@ -2,5 +2,6 @@ queue:
engineRequestQueue: ${TRANSFORM_ENGINE_REQUEST_QUEUE:org.alfresco.transform.engine.misc.acs}
transform:
core:
version: @project.version@
config:
location: classpath:misc_engine_config.json

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Transform Core
* %%
* Copyright (C) 2005 - 2021 Alfresco Software Limited
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -35,6 +35,7 @@ import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_OPENXML_WORD
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_PDF;
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_RFC822;
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_TEXT_PLAIN;
import static org.alfresco.transform.client.util.RequestParamMap.ENDPOINT_TRANSFORM;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -490,7 +491,7 @@ public class MiscControllerTest extends AbstractTransformerControllerTest
"test_file." + sourceExtension, sourceMimetype, content);
final MockHttpServletRequestBuilder requestBuilder = super
.mockMvcRequest("/transform", sourceFile)
.mockMvcRequest(ENDPOINT_TRANSFORM, sourceFile)
.param("targetExtension", targetExtension)
.param("targetMimetype", targetMimetype)
.param("sourceMimetype", sourceMimetype);
@@ -531,4 +532,12 @@ public class MiscControllerTest extends AbstractTransformerControllerTest
text = text.replaceAll("\\n", "");
return text;
}
@Test
@Override
public void queueTransformRequestUsingDirectAccessUrlTest() throws Exception
{
super.targetMimetype = this.targetMimetype;
super.queueTransformRequestUsingDirectAccessUrlTest();
}
}

View File

@@ -1,15 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>alfresco-transform-misc</artifactId>
<name>Alfresco Miscellaneous Transformer</name>
<packaging>jar</packaging>
<parent>
<artifactId>alfresco-transform-core</artifactId>
<groupId>org.alfresco</groupId>
<version>2.5.5-A2-SNAPSHOT</version>
<version>2.5.7-A5-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
@@ -42,7 +40,7 @@
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox-tools</artifactId>
<version>2.0.24</version>
<version>2.0.25</version>
</dependency>
<!-- OOXMLThumbnailContentTransformer -->
@@ -83,14 +81,6 @@
<groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Transform Core
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -42,6 +42,8 @@ import java.nio.charset.Charset;
import java.nio.charset.IllegalCharsetNameException;
import java.util.Map;
import static org.alfresco.transform.client.util.RequestParamMap.SOURCE_ENCODING;
/**
* Content transformer which wraps the HTML Parser library for
* parsing HTML content.

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Transform Core
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -36,9 +36,6 @@ import java.util.Map;
*/
public interface SelectableTransformer
{
String SOURCE_ENCODING = "sourceEncoding";
String TARGET_ENCODING = "targetEncoding";
default void transform(String sourceMimetype, String targetMimetype, Map<String, String> parameters,
File sourceFile, File targetFile) throws Exception
{

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Transform Core
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -42,6 +42,9 @@ import java.nio.charset.Charset;
import java.nio.charset.IllegalCharsetNameException;
import java.util.Map;
import static org.alfresco.transform.client.util.RequestParamMap.SOURCE_ENCODING;
import static org.alfresco.transform.client.util.RequestParamMap.TARGET_ENCODING;
/**
* Converts any textual format to plain text.
* <p>

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Transform Core
* %%
* Copyright (C) 2005 - 2021 Alfresco Software Limited
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -50,6 +50,8 @@ import java.nio.charset.Charset;
import java.util.HashMap;
import java.util.Map;
import static org.alfresco.transform.client.util.RequestParamMap.SOURCE_ENCODING;
/**
* <p>
* This code is based on a class of the same name originally implemented in alfresco-repository.

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Transform Core
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -35,7 +35,7 @@ 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.transform.client.util.RequestParamMap.SOURCE_ENCODING;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class HtmlParserContentTransformerTest

View File

@@ -1,15 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>alfresco-transform-pdf-renderer-boot</artifactId>
<name>Alfresco Pdf Renderer Spring Boot</name>
<packaging>jar</packaging>
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-transform-core</artifactId>
<version>2.5.5-A2-SNAPSHOT</version>
<version>2.5.7-A5-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
@@ -64,30 +62,14 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<goals>
@@ -99,20 +81,29 @@
</plugins>
</build>
<profiles>
<profile>
<id>docker-it-setup</id>
<!-- raises an ActiveMq container for the Integration Tests -->
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
</plugin>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<executions>
<execution>
<id>integration-tests</id>
<goals>
<goal>start</goal>
<goal>stop</goal>
</goals>
<configuration>
<images>
<image>
<alias>activemq</alias>
<name>alfresco/alfresco-activemq:5.16.1</name>
<run>
<hostname>activemq</hostname>
@@ -133,9 +124,7 @@
</wait>
</run>
</image>
<image>
<alias>alfresco-pdf-renderer</alias>
<name>${image.name}:${image.tag}</name>
<run>
<ports>
@@ -159,6 +148,8 @@
</image>
</images>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
@@ -170,20 +161,7 @@
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId>
<configuration>
<images>
<image>
<name>${image.name}:${image.tag}</name>
<build>
<dockerFileDir>${project.basedir}/</dockerFileDir>
<buildOptions>
<squash>true</squash>
</buildOptions>
</build>
</image>
</images>
</configuration>
<artifactId>docker-maven-plugin</artifactId>
<executions>
<execution>
<id>build-image</id>
@@ -191,6 +169,19 @@
<goals>
<goal>build</goal>
</goals>
<configuration>
<images>
<image>
<name>${image.name}:${image.tag}</name>
<build>
<contextDir>${project.basedir}</contextDir>
<buildOptions>
<squash>true</squash>
</buildOptions>
</build>
</image>
</images>
</configuration>
</execution>
</executions>
</plugin>
@@ -204,7 +195,7 @@
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId>
<artifactId>docker-maven-plugin</artifactId>
<configuration>
<images>
<!-- QuayIO image -->
@@ -212,7 +203,7 @@
<name>${image.name}:${image.tag}</name>
<registry>${image.registry}</registry>
<build>
<dockerFileDir>${project.basedir}/</dockerFileDir>
<contextDir>${project.basedir}</contextDir>
<buildOptions>
<squash>true</squash>
</buildOptions>
@@ -222,7 +213,7 @@
<image>
<name>${image.name}:${image.tag}</name>
<build>
<dockerFileDir>${project.basedir}/</dockerFileDir>
<contextDir>${project.basedir}</contextDir>
<buildOptions>
<squash>true</squash>
</buildOptions>
@@ -232,16 +223,9 @@
</configuration>
<executions>
<execution>
<id>build-image</id>
<phase>package</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
<execution>
<id>push-image</id>
<phase>install</phase>
<goals>
<goal>build</goal>
<goal>push</goal>
</goals>
</execution>
@@ -257,15 +241,15 @@
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId>
<configuration combine.self="override">
<artifactId>docker-maven-plugin</artifactId>
<configuration>
<images>
<!-- QuayIO image -->
<image>
<name>${image.name}:${project.version}</name>
<registry>${image.registry}</registry>
<build>
<dockerFileDir>${project.basedir}/</dockerFileDir>
<contextDir>${project.basedir}</contextDir>
<buildOptions>
<squash>true</squash>
</buildOptions>
@@ -275,7 +259,7 @@
<image>
<name>${image.name}:${project.version}</name>
<build>
<dockerFileDir>${project.basedir}/</dockerFileDir>
<contextDir>${project.basedir}</contextDir>
<buildOptions>
<squash>true</squash>
</buildOptions>
@@ -285,8 +269,6 @@
</configuration>
<executions>
<execution>
<id>build-push-image</id>
<phase>deploy</phase>
<goals>
<goal>build</goal>
<goal>push</goal>

View File

@@ -2,6 +2,7 @@ queue:
engineRequestQueue: ${TRANSFORM_ENGINE_REQUEST_QUEUE:org.alfresco.transform.engine.alfresco-pdf-renderer.acs}
transform:
core:
version: @project.version@
config:
location: classpath:pdfrenderer_engine_config.json
pdfrenderer:

View File

@@ -26,6 +26,7 @@
*/
package org.alfresco.transformer;
import static org.alfresco.transform.client.util.RequestParamMap.ENDPOINT_TRANSFORM;
import static org.hamcrest.Matchers.containsString;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
@@ -221,7 +222,7 @@ public class AlfrescoPdfRendererControllerTest extends AbstractTransformerContro
expectedOptions = "--width=321 --height=654 --allow-enlargement --maintain-aspect-ratio --page=2";
mockMvc
.perform(MockMvcRequestBuilders
.multipart("/transform")
.multipart(ENDPOINT_TRANSFORM)
.file(sourceFile)
.param("targetExtension", targetExtension)
.param("targetMimetype", targetMimetype)
@@ -245,7 +246,7 @@ public class AlfrescoPdfRendererControllerTest extends AbstractTransformerContro
expectedOptions = "--width=321 --height=654 --page=2";
mockMvc
.perform(MockMvcRequestBuilders
.multipart("/transform")
.multipart(ENDPOINT_TRANSFORM)
.file(sourceFile)
.param("targetExtension", targetExtension)
.param("targetMimetype", targetMimetype)
@@ -277,7 +278,7 @@ public class AlfrescoPdfRendererControllerTest extends AbstractTransformerContro
{
when(mockExecutionResult.getExitValue()).thenReturn(1);
mockMvc.perform(mockMvcRequest("/transform", sourceFile, "targetExtension", "xxx"))
mockMvc.perform(mockMvcRequest(ENDPOINT_TRANSFORM, sourceFile, "targetExtension", "xxx"))
.andExpect(status().is(BAD_REQUEST.value()))
.andExpect(status()
.reason(containsString("Transformer exit code was not 0: \nSTDERR")));
@@ -311,7 +312,7 @@ public class AlfrescoPdfRendererControllerTest extends AbstractTransformerContro
String tr = objectMapper.writeValueAsString(transformRequest);
String transformationReplyAsString = mockMvc
.perform(MockMvcRequestBuilders
.post("/transform")
.post(ENDPOINT_TRANSFORM)
.header(ACCEPT, APPLICATION_JSON_VALUE)
.header(CONTENT_TYPE, APPLICATION_JSON_VALUE)
.content(tr))

View File

@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>alfresco-transform-pdf-renderer</artifactId>
<name>Alfresco Pdf Renderer Transformer</name>
<packaging>jar</packaging>
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-transform-core</artifactId>
<version>2.5.5-A2-SNAPSHOT</version>
<version>2.5.7-A5-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
@@ -25,14 +25,6 @@
<groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

View File

@@ -27,6 +27,7 @@ RUN ln /usr/bin/${env.project_artifactId}-${env.project_version}.jar /usr/bin/${
make && \
make test && \
make install) && \
yum -y autoremove perl-ExtUtils-MakeMaker make && rm -rf ${EXIFTOOL_FOLDER} ${EXIFTOOL_FOLDER}.tgz && \
yum clean all
ADD target/generated-resources/licenses /licenses

View File

@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>alfresco-transform-tika-boot</artifactId>
<name>Alfresco Tika Transformer Spring Boot</name>
<packaging>jar</packaging>
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-transform-core</artifactId>
<version>2.5.5-A2-SNAPSHOT</version>
<version>2.5.7-A5-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
@@ -65,13 +65,9 @@
</dependency>
<dependency>
<groupId>org.apache.tika</groupId>
<artifactId>tika-parsers</artifactId>
<artifactId>tika-parsers-standard-package</artifactId>
<version>${dependency.tika.version}</version>
<exclusions>
<exclusion>
<groupId>com.tdunning</groupId>
<artifactId>json</artifactId>
</exclusion>
<exclusion>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
@@ -80,10 +76,9 @@
<groupId>org.bouncycastle</groupId>
<artifactId>bcmail-jdk15on</artifactId>
</exclusion>
<!-- TODO ATS-534 check transformations not affected by this missing quartz lib -->
<exclusion>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
</exclusion>
</exclusions>
</dependency>
@@ -151,21 +146,6 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
@@ -174,7 +154,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<goals>
@@ -186,20 +165,29 @@
</plugins>
</build>
<profiles>
<profile>
<id>docker-it-setup</id>
<!-- raises an ActiveMq container for the Integration Tests -->
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
</plugin>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<executions>
<execution>
<id>integration-tests</id>
<goals>
<goal>start</goal>
<goal>stop</goal>
</goals>
<configuration>
<images>
<image>
<alias>activemq</alias>
<name>alfresco/alfresco-activemq:5.16.1</name>
<run>
<hostname>activemq</hostname>
@@ -220,9 +208,7 @@
</wait>
</run>
</image>
<image>
<alias>tika</alias>
<name>${image.name}:${image.tag}</name>
<run>
<ports>
@@ -246,6 +232,8 @@
</image>
</images>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
@@ -257,20 +245,7 @@
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId>
<configuration>
<images>
<image>
<name>${image.name}:${image.tag}</name>
<build>
<dockerFileDir>${project.basedir}/</dockerFileDir>
<buildOptions>
<squash>true</squash>
</buildOptions>
</build>
</image>
</images>
</configuration>
<artifactId>docker-maven-plugin</artifactId>
<executions>
<execution>
<id>build-image</id>
@@ -278,6 +253,19 @@
<goals>
<goal>build</goal>
</goals>
<configuration>
<images>
<image>
<name>${image.name}:${image.tag}</name>
<build>
<contextDir>${project.basedir}</contextDir>
<buildOptions>
<squash>true</squash>
</buildOptions>
</build>
</image>
</images>
</configuration>
</execution>
</executions>
</plugin>
@@ -291,7 +279,7 @@
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId>
<artifactId>docker-maven-plugin</artifactId>
<configuration>
<images>
<!-- QuayIO image -->
@@ -299,7 +287,7 @@
<name>${image.name}:${image.tag}</name>
<registry>${image.registry}</registry>
<build>
<dockerFileDir>${project.basedir}/</dockerFileDir>
<contextDir>${project.basedir}</contextDir>
<buildOptions>
<squash>true</squash>
</buildOptions>
@@ -309,7 +297,7 @@
<image>
<name>${image.name}:${image.tag}</name>
<build>
<dockerFileDir>${project.basedir}/</dockerFileDir>
<contextDir>${project.basedir}</contextDir>
<buildOptions>
<squash>true</squash>
</buildOptions>
@@ -319,16 +307,9 @@
</configuration>
<executions>
<execution>
<id>build-image</id>
<phase>package</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
<execution>
<id>push-image</id>
<phase>install</phase>
<goals>
<goal>build</goal>
<goal>push</goal>
</goals>
</execution>
@@ -344,15 +325,15 @@
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId>
<configuration combine.self="override">
<artifactId>docker-maven-plugin</artifactId>
<configuration>
<images>
<!-- QuayIO image -->
<image>
<name>${image.name}:${project.version}</name>
<registry>${image.registry}</registry>
<build>
<dockerFileDir>${project.basedir}/</dockerFileDir>
<contextDir>${project.basedir}</contextDir>
<buildOptions>
<squash>true</squash>
</buildOptions>
@@ -362,7 +343,7 @@
<image>
<name>${image.name}:${project.version}</name>
<build>
<dockerFileDir>${project.basedir}/</dockerFileDir>
<contextDir>${project.basedir}</contextDir>
<buildOptions>
<squash>true</squash>
</buildOptions>
@@ -372,8 +353,6 @@
</configuration>
<executions>
<execution>
<id>build-push-image</id>
<phase>deploy</phase>
<goals>
<goal>build</goal>
<goal>push</goal>

View File

@@ -1,46 +0,0 @@
# Generated by org.codehaus.mojo.license.AddThirdPartyMojo
#-------------------------------------------------------------------------------
# Already used licenses in project :
# - (MIT-style) netCDF C library license
# - Apache 2.0
# - Apache License 2.0
# - Apache License v2.0
# - Apache License, Version 2.0
# - Apache License, version 2.0
# - Apache Software License - Version 2.0
# - BSD
# - BSD 3-clause New License
# - BSD License
# - Bouncy Castle Licence
# - CDDL + GPLv2 with classpath exception
# - CDDL, v1.0
# - EPL 2.0
# - Eclipse Public License - v 1.0
# - Eclipse Public License, Version 1.0
# - GNU Lesser General Public License
# - GNU Lesser General Public License, Version 2.1
# - GPL2 w/ CPE
# - LGPL, v2.1 or later
# - LGPL, version 2.1
# - MIT License
# - MIT License (MIT)
# - MIT license
# - Mozilla Public License 1.1 (MPL 1.1)
# - New BSD license
# - OGC copyright
# - Public
# - Public Domain
# - Public Domain, per Creative Commons CC0
# - Similar to Apache License but with the acknowledgment clause removed
# - Specification License
# - The Apache License, Version 2.0
# - The Apache Software License, Version 2.0
# - The BSD License
# - The MIT License
# - UnRar License
#-------------------------------------------------------------------------------
# Please fill the missing licenses for dependencies :
#
#
#Mon Aug 19 18:06:38 EEST 2019
net.jcip--jcip-annotations--1.0=Public

View File

@@ -2,6 +2,7 @@ queue:
engineRequestQueue: ${TRANSFORM_ENGINE_REQUEST_QUEUE:org.alfresco.transform.engine.tika.acs}
transform:
core:
version: @project.version@
config:
location: classpath:tika_engine_config.json
tika:

View File

@@ -6,6 +6,7 @@
<form method="POST" enctype="multipart/form-data" action="/transform">
<table>
<tr><td><div style="text-align:right">file *</div></td><td><input type="file" name="file" /></td></tr>
<tr><td><div style="text-align:right">Direct Url</div></td><td><input type="text" name="directAccessUrl"/></td></tr>
<tr><td><div style="text-align:right">sourceMimetype *</div></td><td><input type="text" name="sourceMimetype" value="application/msword" /></td></tr>
<tr><td><div style="text-align:right">targetExtension *</div></td><td><input type="text" name="targetExtension" value="txt" /></td></tr>
<tr><td><div style="text-align:right">targetMimetype *</div></td><td><input type="text" name="targetMimetype" value="text/plain" /></td></tr>

View File

@@ -27,6 +27,7 @@
package org.alfresco.transformer;
import static java.nio.file.Files.readAllBytes;
import static org.alfresco.transform.client.util.RequestParamMap.ENDPOINT_TRANSFORM;
import static org.alfresco.transformer.executors.Tika.ARCHIVE;
import static org.alfresco.transformer.executors.Tika.CSV;
import static org.alfresco.transformer.executors.Tika.DOC;
@@ -152,6 +153,8 @@ public class TikaControllerTest extends AbstractTransformerControllerTest
{
sourceExtension = "pdf";
targetExtension = "txt";
sourceMimetype = MIMETYPE_PDF;
targetMimetype = MIMETYPE_TEXT_PLAIN;
}
@Override
@@ -249,9 +252,9 @@ public class TikaControllerTest extends AbstractTransformerControllerTest
System.out.println("Test " + transform + " " + sourceExtension + " to " + targetExtension);
MockHttpServletRequestBuilder requestBuilder = includeContents == null
? mockMvcRequest("/transform", sourceFile,
? mockMvcRequest(ENDPOINT_TRANSFORM, sourceFile,
"targetExtension", this.targetExtension)
: mockMvcRequest("/transform", sourceFile,
: mockMvcRequest(ENDPOINT_TRANSFORM, sourceFile,
"targetExtension", this.targetExtension, INCLUDE_CONTENTS, includeContents.toString());
MvcResult result = mockMvc.perform(requestBuilder)
.andExpect(status().is(OK.value()))
@@ -368,7 +371,7 @@ public class TikaControllerTest extends AbstractTransformerControllerTest
mockTransformCommand(PDF, TXT, MIMETYPE_PDF, true);
targetEncoding = "rubbish";
mockMvc.perform(
mockMvcRequest("/transform", sourceFile, "targetExtension", targetExtension))
mockMvcRequest(ENDPOINT_TRANSFORM, sourceFile, "targetExtension", targetExtension))
.andExpect(status().is(INTERNAL_SERVER_ERROR.value()));
}
@@ -553,7 +556,7 @@ public class TikaControllerTest extends AbstractTransformerControllerTest
"\"{http://www.alfresco.org/model/content/1.0}created\":\"created1\"}";
MockHttpServletRequestBuilder requestBuilder =
super.mockMvcRequest("/transform", sourceFile,
super.mockMvcRequest(ENDPOINT_TRANSFORM, sourceFile,
"targetExtension", XSLX,
"metadata", metadata,
"targetMimetype", MIMETYPE_METADATA_EMBED,
@@ -583,7 +586,7 @@ public class TikaControllerTest extends AbstractTransformerControllerTest
{
mockTransformCommand(PDF, TXT, MIMETYPE_PDF, true);
mockMvc.perform(
mockMvcRequest("/transform", sourceFile, "targetExtension", targetExtension).param(
mockMvcRequest(ENDPOINT_TRANSFORM, sourceFile, "targetExtension", targetExtension).param(
NOT_EXTRACT_BOOKMARKS_TEXT, "true"))
.andExpect(status().is(OK.value()))
.andExpect(header().string("Content-Disposition",
@@ -628,7 +631,7 @@ public class TikaControllerTest extends AbstractTransformerControllerTest
String tr = objectMapper.writeValueAsString(transformRequest);
String transformationReplyAsString = mockMvc
.perform(MockMvcRequestBuilders
.post("/transform")
.post(ENDPOINT_TRANSFORM)
.header(ACCEPT, APPLICATION_JSON_VALUE)
.header(CONTENT_TYPE, APPLICATION_JSON_VALUE)
.content(tr))
@@ -643,4 +646,12 @@ public class TikaControllerTest extends AbstractTransformerControllerTest
assertEquals(transformRequest.getClientData(), transformReply.getClientData());
assertEquals(transformRequest.getSchema(), transformReply.getSchema());
}
@Test
@Override
public void httpTransformRequestUsingDirectAccessUrlTest() throws Exception
{
expectedTargetFileBytes = readTestFile(targetExtension);
super.httpTransformRequestUsingDirectAccessUrlTest();
}
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Transform Core
* %%
* Copyright (C) 2005 - 2021 Alfresco Software Limited
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -56,18 +56,18 @@ public class TikaHttpRequestTest extends AbstractHttpRequestTest
// Override method as Tika requires sourceMimetype
// If not provided then sourceMimetype request parameter error will be thrown.
@Override
protected void assertTransformError(boolean addFile, String errorMessage)
protected void assertTransformError(boolean addFile,
String errorMessage,
LinkedMultiValueMap<String, Object> additionalParams)
{
LinkedMultiValueMap<String, Object> parameters = new LinkedMultiValueMap<>();
if (addFile)
{
parameters.add("file", new ClassPathResource("quick." + getSourceExtension()));
}
parameters.add("sourceMimetype", "application/pdf");
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MULTIPART_FORM_DATA);
HttpEntity<LinkedMultiValueMap<String, Object>> entity = new HttpEntity<>(parameters,
headers);
super.sendTranformationRequest(entity, errorMessage);
if (additionalParams != null)
{
parameters.addAll(additionalParams);
}
super.assertTransformError(addFile, errorMessage, parameters);
}
}

View File

@@ -548,4 +548,28 @@ public class TikaMetadataExtractsIT extends AbstractMetadataExtractsIT
);
}
@ParameterizedTest
@MethodSource("tika2_2_1_upgradeFailures")
public void testTika_2_2_1_upgradeFailures(TestFileInfo testFileInfo)
{
super.testTransformation(testFileInfo);
}
private static Stream<TestFileInfo> tika2_2_1_upgradeFailures()
{
// When we upgraded to Tika 2.2.1 from 2.2.0:
// - the original OfficeOpenXMLCore.SUBJECT raw metadata value started being null.
// - the replacement TikaCoreProperties.SUBJECT raw metadata changed into a multi value
// The following test files were the ones that failed.
return Stream.of(
testFile(MIMETYPE_OPENDOCUMENT_GRAPHICS_TEMPLATE, "otg", "quick.otg"),
testFile(MIMETYPE_OPENOFFICE1_WRITER, "sxw", "quick.sxw"),
testFile(MIMETYPE_OPENDOCUMENT_GRAPHICS, "odg", "quick.odg"),
testFile(MIMETYPE_OPENDOCUMENT_TEXT, "odt", "quick.odt"),
testFile(MIMETYPE_OPENDOCUMENT_TEXT_TEMPLATE, "ott", "quick.ott"),
testFile(MIMETYPE_OPENDOCUMENT_FORMULA, "odf", "quick.odf"),
testFile(MIMETYPE_PDF, "pdf", "quick.pdf")
);
}
}

View File

@@ -2,7 +2,8 @@
"{http://www.alfresco.org/model/content/1.0}description" : null,
"{http://www.alfresco.org/model/audio/1.0}releaseDate" : null,
"{http://www.alfresco.org/model/content/1.0}created" : null,
"{http://www.alfresco.org/model/audio/1.0}sampleRate" : "1000",
"{http://www.alfresco.org/model/audio/1.0}sampleRate" : "8000",
"{http://www.alfresco.org/model/content/1.0}author" : null,
"{http://www.alfresco.org/model/content/1.0}title" : null
"{http://www.alfresco.org/model/content/1.0}title" : null,
"{http://www.alfresco.org/model/audio/1.0}channelType" : "Stereo"
}

View File

@@ -2,7 +2,8 @@
"{http://www.alfresco.org/model/content/1.0}description" : null,
"{http://www.alfresco.org/model/audio/1.0}releaseDate" : null,
"{http://www.alfresco.org/model/content/1.0}created" : null,
"{http://www.alfresco.org/model/audio/1.0}sampleRate" : "1000",
"{http://www.alfresco.org/model/audio/1.0}sampleRate" : "8000",
"{http://www.alfresco.org/model/content/1.0}author" : null,
"{http://www.alfresco.org/model/content/1.0}title" : null
"{http://www.alfresco.org/model/content/1.0}title" : null,
"{http://www.alfresco.org/model/audio/1.0}channelType" : "Stereo"
}

View File

@@ -2,7 +2,8 @@
"{http://www.alfresco.org/model/content/1.0}description" : null,
"{http://www.alfresco.org/model/audio/1.0}releaseDate" : null,
"{http://www.alfresco.org/model/content/1.0}created" : null,
"{http://www.alfresco.org/model/audio/1.0}sampleRate" : "1000",
"{http://www.alfresco.org/model/audio/1.0}sampleRate" : "22050",
"{http://www.alfresco.org/model/content/1.0}author" : null,
"{http://www.alfresco.org/model/content/1.0}title" : null
"{http://www.alfresco.org/model/content/1.0}title" : null,
"{http://www.alfresco.org/model/audio/1.0}channelType" : "Stereo"
}

View File

@@ -2,7 +2,8 @@
"{http://www.alfresco.org/model/content/1.0}description" : null,
"{http://www.alfresco.org/model/audio/1.0}releaseDate" : null,
"{http://www.alfresco.org/model/content/1.0}created" : null,
"{http://www.alfresco.org/model/audio/1.0}sampleRate" : "1000",
"{http://www.alfresco.org/model/audio/1.0}sampleRate" : "22050",
"{http://www.alfresco.org/model/content/1.0}author" : null,
"{http://www.alfresco.org/model/content/1.0}title" : null
"{http://www.alfresco.org/model/content/1.0}title" : null,
"{http://www.alfresco.org/model/audio/1.0}channelType" : "Mono"
}

View File

@@ -2,7 +2,8 @@
"{http://www.alfresco.org/model/content/1.0}description" : null,
"{http://www.alfresco.org/model/audio/1.0}releaseDate" : null,
"{http://www.alfresco.org/model/content/1.0}created" : null,
"{http://www.alfresco.org/model/audio/1.0}sampleRate" : "90000",
"{http://www.alfresco.org/model/audio/1.0}sampleRate" : "22050",
"{http://www.alfresco.org/model/content/1.0}author" : null,
"{http://www.alfresco.org/model/content/1.0}title" : null
"{http://www.alfresco.org/model/content/1.0}title" : null,
"{http://www.alfresco.org/model/audio/1.0}channelType" : "Mono"
}

View File

@@ -1,5 +1,5 @@
{
"{http://www.alfresco.org/model/content/1.0}description" : "Gym class featuring a brown fox and lazy dog",
"{http://www.alfresco.org/model/content/1.0}description" : "Pangram, fox, dog, Gym class featuring a brown fox and lazy dog",
"{http://www.alfresco.org/model/content/1.0}created" : 1138362922000,
"{http://www.alfresco.org/model/content/1.0}author" : null,
"{http://www.alfresco.org/model/content/1.0}title" : "The quick brown fox jumps over the lazy dog"

View File

@@ -1,5 +1,5 @@
{
"{http://www.alfresco.org/model/content/1.0}description" : "Gym class featuring a brown fox and lazy dog",
"{http://www.alfresco.org/model/content/1.0}description" : "Pangram, fox, dog, Gym class featuring a brown fox and lazy dog",
"{http://www.alfresco.org/model/content/1.0}created" : 1138362371000,
"{http://www.alfresco.org/model/content/1.0}author" : "Derek Hulley",
"{http://www.alfresco.org/model/content/1.0}title" : "The quick brown fox jumps over the lazy dog"

View File

@@ -1,5 +1,5 @@
{
"{http://www.alfresco.org/model/content/1.0}description" : "Gym class featuring a brown fox and lazy dog",
"{http://www.alfresco.org/model/content/1.0}description" : "Pangram, fox, dog, Gym class featuring a brown fox and lazy dog",
"{http://www.alfresco.org/model/content/1.0}created" : 1126049640000,
"{http://www.alfresco.org/model/content/1.0}author" : "Jesper Steen Møller",
"{http://www.alfresco.org/model/content/1.0}title" : "The quick brown fox jumps over the lazy dog"

View File

@@ -1,5 +1,5 @@
{
"{http://www.alfresco.org/model/content/1.0}description" : "Gym class featuring a brown fox and lazy dog",
"{http://www.alfresco.org/model/content/1.0}description" : "Pangram, fox, dog, Gym class featuring a brown fox and lazy dog",
"{http://www.alfresco.org/model/content/1.0}created" : 1138362371000,
"{http://www.alfresco.org/model/content/1.0}author" : "Derek Hulley",
"{http://www.alfresco.org/model/content/1.0}title" : "The quick brown fox jumps over the lazy dog"

View File

@@ -1,5 +1,5 @@
{
"{http://www.alfresco.org/model/content/1.0}description" : "Gym class featuring a brown fox and lazy dog",
"{http://www.alfresco.org/model/content/1.0}description" : "Pangram, fox, dog, Gym class featuring a brown fox and lazy dog",
"{http://www.alfresco.org/model/content/1.0}created" : 1126049640000,
"{http://www.alfresco.org/model/content/1.0}author" : "Jesper Steen Møller",
"{http://www.alfresco.org/model/content/1.0}title" : "The quick brown fox jumps over the lazy dog"

View File

@@ -1,5 +1,5 @@
{
"{http://www.alfresco.org/model/content/1.0}description" : "Gym class featuring a brown fox and lazy dog",
"{http://www.alfresco.org/model/content/1.0}description" : "Pangram, fox, dog, Gym class featuring a brown fox and lazy dog",
"{http://www.alfresco.org/model/content/1.0}created" : "2005-05-26T19:52:58Z",
"{http://www.alfresco.org/model/content/1.0}author" : "Nevin Nollop",
"{http://www.alfresco.org/model/content/1.0}title" : "The quick brown fox jumps over the lazy dog"

View File

@@ -1,5 +1,5 @@
{
"{http://www.alfresco.org/model/content/1.0}description" : "Gym class featuring a brown fox and lazy dog",
"{http://www.alfresco.org/model/content/1.0}description" : "Pangram, fox, dog, Gym class featuring a brown fox and lazy dog",
"{http://www.alfresco.org/model/content/1.0}created" : 1126049640000,
"{http://www.alfresco.org/model/content/1.0}author" : "Jesper Steen Møller",
"{http://www.alfresco.org/model/content/1.0}title" : "The quick brown fox jumps over the lazy dog"

View File

@@ -3,12 +3,11 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>alfresco-transform-tika</artifactId>
<name>Alfresco Tika Transformer</name>
<packaging>jar</packaging>
<parent>
<artifactId>alfresco-transform-core</artifactId>
<groupId>org.alfresco</groupId>
<version>2.5.5-A2-SNAPSHOT</version>
<version>2.5.7-A5-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
@@ -27,13 +26,9 @@
</dependency>
<dependency>
<groupId>org.apache.tika</groupId>
<artifactId>tika-parsers</artifactId>
<artifactId>tika-parsers-standard-package</artifactId>
<version>${dependency.tika.version}</version>
<exclusions>
<exclusion>
<groupId>com.tdunning</groupId>
<artifactId>json</artifactId>
</exclusion>
<exclusion>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
@@ -42,11 +37,6 @@
<groupId>org.bouncycastle</groupId>
<artifactId>bcmail-jdk15on</artifactId>
</exclusion>
<!-- TODO ATS-534 check transformations not affected by this missing quartz lib -->
<exclusion>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
</exclusion>
<exclusion>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
@@ -126,14 +116,6 @@
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId>

View File

@@ -1,52 +0,0 @@
# Generated by org.codehaus.mojo.license.AddThirdPartyMojo
#-------------------------------------------------------------------------------
# Already used licenses in project :
# - (MIT-style) netCDF C library license
# - 3-Clause BSD License
# - Apache 2.0
# - Apache License 2.0
# - Apache License v2
# - Apache License v2.0
# - Apache License, Version 2.0
# - Apache License, version 2.0
# - Apache Software License - Version 2.0
# - BSD
# - BSD 3-clause License w/nuclear disclaimer
# - BSD 3-clause New License
# - BSD License
# - BSD-2-Clause
# - Bouncy Castle Licence
# - CDDL + GPLv2 with classpath exception
# - CDDL, v1.0
# - CDDL/GPLv2+CE
# - EDL 1.0
# - EPL 2.0
# - Eclipse Distribution License - v 1.0
# - Eclipse Public License - v 1.0
# - Eclipse Public License 2.0
# - GNU General Public License, version 2 with the GNU Classpath Exception
# - GNU Lesser General Public License
# - GPL2 w/ CPE
# - LGPL, v2.1 or later
# - LGPL, version 2.1
# - MIT License
# - MIT License (MIT)
# - Mozilla Public License 1.1 (MPL 1.1)
# - OGC copyright
# - Public Domain
# - Public Domain, per Creative Commons CC0
# - Similar to Apache License but with the acknowledgment clause removed
# - The Apache License, Version 2.0
# - The Apache Software License, Version 2.0
# - The BSD License
# - The MIT License
# - The SAX License
# - The W3C License
# - UnRar License
# - lgpl
#-------------------------------------------------------------------------------
# Please fill the missing licenses for dependencies :
#
#
#Thu Apr 09 10:31:19 BST 2020
net.jcip--jcip-annotations--1.0=Public

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Transform Core
* %%
* Copyright (C) 2005 - 2021 Alfresco Software Limited
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -28,7 +28,11 @@ package org.alfresco.transformer.metadataExtractors;
import org.apache.tika.embedder.Embedder;
import org.apache.tika.extractor.DocumentSelector;
import org.apache.tika.metadata.DublinCore;
import org.apache.tika.metadata.Metadata;
import org.apache.tika.metadata.OfficeOpenXMLCore;
import org.apache.tika.metadata.Property;
import org.apache.tika.metadata.TikaCoreProperties;
import org.apache.tika.parser.ParseContext;
import org.apache.tika.parser.Parser;
import org.apache.tika.sax.ContentHandlerDecorator;
@@ -58,7 +62,10 @@ import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* The parent of all Metadata Extractors which use Apache Tika under the hood. This handles all the
@@ -83,7 +90,7 @@ public abstract class AbstractTikaMetadataExtractor extends AbstractMetadataExtr
protected static final String KEY_CREATED = "created";
protected static final String KEY_DESCRIPTION = "description";
protected static final String KEY_COMMENTS = "comments";
protected static final String KEY_TAGS = "dc:subject";
protected static final String KEY_TAGS = DublinCore.SUBJECT.getName();
private static final String METADATA_SEPARATOR = ",";
@@ -208,7 +215,6 @@ public abstract class AbstractTikaMetadataExtractor extends AbstractMetadataExtr
}
@Override
@SuppressWarnings( "deprecation" )
public Map<String, Serializable> extractMetadata(String sourceMimetype, Map<String, String> transformOptions,
File sourceFile) throws Exception
{
@@ -245,7 +251,7 @@ public abstract class AbstractTikaMetadataExtractor extends AbstractMetadataExtr
for (String tikaKey : metadata.names())
{
// TODO review this change (part of MNT-15267) - should we really force string concatenation here !?
putRawValue(tikaKey, getMetadataValue(metadata, tikaKey), rawProperties);
putRawValue(tikaKey, getMetadataValue(metadata, Property.internalText(tikaKey)), rawProperties);
}
// Now, map the common Tika metadata keys onto
@@ -254,17 +260,17 @@ public abstract class AbstractTikaMetadataExtractor extends AbstractMetadataExtr
// to work without needing any changes
// The simple ones
putRawValue(KEY_AUTHOR, getMetadataValue(metadata, Metadata.AUTHOR), rawProperties);
putRawValue(KEY_TITLE, getMetadataValue(metadata, Metadata.TITLE), rawProperties);
putRawValue(KEY_COMMENTS, getMetadataValue(metadata, Metadata.COMMENTS), rawProperties);
putRawValue(KEY_AUTHOR, getMetadataValue(metadata, TikaCoreProperties.CREATOR), rawProperties);
putRawValue(KEY_TITLE, getMetadataValue(metadata, TikaCoreProperties.TITLE), rawProperties);
putRawValue(KEY_COMMENTS, getMetadataValue(metadata, TikaCoreProperties.COMMENTS), rawProperties);
// Tags
putRawValue(KEY_TAGS, getMetadataValues(metadata, KEY_TAGS), rawProperties);
// Get the subject and description, despite things not
// being nearly as consistent as one might hope
String subject = getMetadataValue(metadata, Metadata.SUBJECT);
String description = getMetadataValue(metadata, Metadata.DESCRIPTION);
String subject = getMetadataValue(metadata, TikaCoreProperties.SUBJECT);
String description = getMetadataValue(metadata, TikaCoreProperties.DESCRIPTION);
if (subject != null && description != null)
{
putRawValue(KEY_DESCRIPTION, description, rawProperties);
@@ -282,13 +288,13 @@ public abstract class AbstractTikaMetadataExtractor extends AbstractMetadataExtr
}
// Try for the dates two different ways too
if(metadata.get(Metadata.CREATION_DATE) != null)
if (metadata.get(TikaCoreProperties.CREATED) != null)
{
putRawValue(KEY_CREATED, metadata.get(Metadata.CREATION_DATE), rawProperties);
putRawValue(KEY_CREATED, metadata.get(TikaCoreProperties.CREATED), rawProperties);
}
else if(metadata.get(Metadata.DATE) != null)
else if (metadata.get(TikaCoreProperties.MODIFIED) != null)
{
putRawValue(KEY_CREATED, metadata.get(Metadata.DATE), rawProperties);
putRawValue(KEY_CREATED, metadata.get(TikaCoreProperties.MODIFIED), rawProperties);
}
// If people created a specific instance
@@ -388,24 +394,11 @@ public abstract class AbstractTikaMetadataExtractor extends AbstractMetadataExtr
return values.length == 0 ? null : (values.length == 1 ? values[0] : values);
}
private String getMetadataValue(Metadata metadata, String key)
private String getMetadataValue(Metadata metadata, Property key)
{
if (metadata.isMultiValued(key))
{
String[] parts = metadata.getValues(key);
// use Set to prevent duplicates
Set<String> value = new LinkedHashSet<>(parts.length);
for (int i = 0; i < parts.length; i++)
{
value.add(parts[i]);
}
String valueStr = value.toString();
// remove leading/trailing braces []
return valueStr.substring(1, valueStr.length() - 1);
return distinct(metadata.getValues(key)).collect(Collectors.joining(", "));
}
else
{
@@ -413,6 +406,15 @@ public abstract class AbstractTikaMetadataExtractor extends AbstractMetadataExtr
}
}
protected static Stream<String> distinct(final String[] strings)
{
return Stream.of(strings)
.filter(Objects::nonNull)
.map(String::strip)
.filter(s -> !s.isEmpty())
.distinct();
}
/**
* This content handler will capture entries from within
* the header of the Tika content XHTML, but ignore the

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Transform Core
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2021 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -27,6 +27,7 @@
package org.alfresco.transformer.metadataExtractors;
import org.apache.tika.metadata.Metadata;
import org.apache.tika.metadata.TikaCoreProperties;
import org.apache.tika.parser.Parser;
import org.apache.tika.parser.dwg.DWGParser;
import org.slf4j.Logger;
@@ -64,13 +65,12 @@ public class DWGMetadataExtractor extends AbstractTikaMetadataExtractor
super(logger);
}
@SuppressWarnings("deprecation")
@Override
protected Map<String, Serializable> extractSpecific(Metadata metadata,
Map<String, Serializable> properties, Map<String,String> headers)
{
putRawValue(KEY_KEYWORD, metadata.get(Metadata.KEYWORDS), properties);
putRawValue(KEY_LAST_AUTHOR, metadata.get(Metadata.LAST_AUTHOR), properties);
putRawValue(KEY_KEYWORD, metadata.get(TikaCoreProperties.SUBJECT), properties);
putRawValue(KEY_LAST_AUTHOR, metadata.get(TikaCoreProperties.MODIFIED), properties);
return properties;
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Transform Core
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2021 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -27,6 +27,7 @@
package org.alfresco.transformer.metadataExtractors;
import org.apache.tika.metadata.Metadata;
import org.apache.tika.metadata.TikaCoreProperties;
import org.apache.tika.metadata.XMPDM;
import org.apache.tika.parser.Parser;
import org.apache.tika.parser.mp3.Mp3Parser;
@@ -86,7 +87,6 @@ public class MP3MetadataExtractor extends TikaAudioMetadataExtractor
return new Mp3Parser();
}
@SuppressWarnings("deprecation")
@Override
protected Map<String, Serializable> extractSpecific(Metadata metadata,
Map<String, Serializable> properties, Map<String,String> headers)
@@ -98,7 +98,7 @@ public class MP3MetadataExtractor extends TikaAudioMetadataExtractor
// We only need these for people who had pre-existing mapping
// properties from before the proper audio model was added
putRawValue(KEY_ALBUM_TITLE, metadata.get(XMPDM.ALBUM), properties);
putRawValue(KEY_SONG_TITLE, metadata.get(Metadata.TITLE), properties);
putRawValue(KEY_SONG_TITLE, metadata.get(TikaCoreProperties.TITLE), properties);
putRawValue(KEY_ARTIST, metadata.get(XMPDM.ARTIST), properties);
putRawValue(KEY_COMMENT, metadata.get(XMPDM.LOG_COMMENT), properties);
putRawValue(KEY_TRACK_NUMBER, metadata.get(XMPDM.TRACK_NUMBER), properties);

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Transform Core
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2021 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -26,7 +26,9 @@
*/
package org.alfresco.transformer.metadataExtractors;
import org.apache.tika.metadata.Message;
import org.apache.tika.metadata.Metadata;
import org.apache.tika.metadata.TikaCoreProperties;
import org.apache.tika.parser.Parser;
import org.apache.tika.parser.microsoft.OfficeParser;
import org.slf4j.Logger;
@@ -82,26 +84,25 @@ public class MailMetadataExtractor extends AbstractTikaMetadataExtractor
return new OfficeParser();
}
@SuppressWarnings("deprecation")
@Override
protected Map<String, Serializable> extractSpecific(Metadata metadata,
Map<String, Serializable> properties, Map<String,String> headers)
{
putRawValue(KEY_ORIGINATOR, metadata.get(Metadata.AUTHOR), properties);
putRawValue(KEY_SUBJECT, metadata.get(Metadata.TITLE), properties);
putRawValue(KEY_DESCRIPTION, metadata.get(Metadata.SUBJECT), properties);
putRawValue(KEY_SENT_DATE, metadata.get(Metadata.LAST_SAVED), properties);
putRawValue(KEY_ORIGINATOR, metadata.get(TikaCoreProperties.CREATOR), properties);
putRawValue(KEY_SUBJECT, metadata.get(TikaCoreProperties.TITLE), properties);
putRawValue(KEY_DESCRIPTION, metadata.get(TikaCoreProperties.SUBJECT), properties);
putRawValue(KEY_SENT_DATE, metadata.get(TikaCoreProperties.MODIFIED), properties);
// Store the TO, but not cc/bcc in the addressee field
putRawValue(KEY_ADDRESSEE, metadata.get(Metadata.MESSAGE_TO), properties);
putRawValue(KEY_ADDRESSEE, metadata.get(Message.MESSAGE_TO), properties);
// Store each of To, CC and BCC in their own fields
putRawValue(KEY_TO_NAMES, metadata.getValues(Metadata.MESSAGE_TO), properties);
putRawValue(KEY_CC_NAMES, metadata.getValues(Metadata.MESSAGE_CC), properties);
putRawValue(KEY_BCC_NAMES, metadata.getValues(Metadata.MESSAGE_BCC), properties);
putRawValue(KEY_TO_NAMES, metadata.getValues(Message.MESSAGE_TO), properties);
putRawValue(KEY_CC_NAMES, metadata.getValues(Message.MESSAGE_CC), properties);
putRawValue(KEY_BCC_NAMES, metadata.getValues(Message.MESSAGE_BCC), properties);
// But store all email addresses (to/cc/bcc) in the addresses field
putRawValue(KEY_ADDRESSEES, metadata.getValues(Metadata.MESSAGE_RECIPIENT_ADDRESS), properties);
putRawValue(KEY_ADDRESSEES, metadata.getValues(Message.MESSAGE_RECIPIENT_ADDRESS), properties);
return properties;
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Transform Core
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2021 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -27,6 +27,8 @@
package org.alfresco.transformer.metadataExtractors;
import org.apache.tika.metadata.Metadata;
import org.apache.tika.metadata.Office;
import org.apache.tika.metadata.TikaCoreProperties;
import org.apache.tika.parser.Parser;
import org.apache.tika.parser.microsoft.OfficeParser;
import org.slf4j.Logger;
@@ -40,7 +42,7 @@ import java.util.Map;
*
* Configuration: (see OfficeMetadataExtractor_metadata_extract.properties and tika_engine_config.json)
*
* This extracter uses the POI library to extract the following:
* This extractor uses the POI library to extract the following:
* <pre>
* <b>author:</b> -- cm:author
* <b>title:</b> -- cm:title
@@ -91,23 +93,20 @@ public class OfficeMetadataExtractor extends AbstractTikaMetadataExtractor
return new OfficeParser();
}
@SuppressWarnings("deprecation")
@Override
protected Map<String, Serializable> extractSpecific(Metadata metadata,
Map<String, Serializable> properties, Map<String,String> headers)
{
putRawValue(KEY_CREATE_DATETIME, metadata.get(Metadata.CREATION_DATE), properties);
putRawValue(KEY_LAST_SAVE_DATETIME, metadata.get(Metadata.LAST_SAVED), properties);
putRawValue(KEY_EDIT_TIME, metadata.get(Metadata.EDIT_TIME), properties);
putRawValue(KEY_FORMAT, metadata.get(Metadata.FORMAT), properties);
putRawValue(KEY_KEYWORDS, metadata.get(Metadata.KEYWORDS), properties);
putRawValue(KEY_LAST_AUTHOR, metadata.get(Metadata.LAST_AUTHOR), properties);
putRawValue(KEY_LAST_PRINTED, metadata.get(Metadata.LAST_PRINTED), properties);
// putRawValue(KEY_OS_VERSION, metadata.get(Metadata.OS_VERSION), properties);
// putRawValue(KEY_THUMBNAIL, metadata.get(Metadata.THUMBNAIL), properties);
putRawValue(KEY_PAGE_COUNT, metadata.get(Metadata.PAGE_COUNT), properties);
putRawValue(KEY_PARAGRAPH_COUNT, metadata.get(Metadata.PARAGRAPH_COUNT), properties);
putRawValue(KEY_WORD_COUNT, metadata.get(Metadata.WORD_COUNT), properties);
putRawValue(KEY_CREATE_DATETIME, metadata.get(TikaCoreProperties.CREATED), properties);
putRawValue(KEY_LAST_SAVE_DATETIME, metadata.get(TikaCoreProperties.MODIFIED), properties);
putRawValue(KEY_EDIT_TIME, metadata.get(TikaCoreProperties.MODIFIED), properties);
putRawValue(KEY_FORMAT, metadata.get(TikaCoreProperties.FORMAT), properties);
putRawValue(KEY_KEYWORDS, metadata.get(TikaCoreProperties.SUBJECT), properties);
putRawValue(KEY_LAST_AUTHOR, metadata.get(TikaCoreProperties.MODIFIER), properties);
putRawValue(KEY_LAST_PRINTED, metadata.get(TikaCoreProperties.PRINT_DATE), properties);
putRawValue(KEY_PAGE_COUNT, metadata.get(Office.PAGE_COUNT), properties);
putRawValue(KEY_PARAGRAPH_COUNT, metadata.get(Office.PARAGRAPH_COUNT), properties);
putRawValue(KEY_WORD_COUNT, metadata.get(Office.WORD_COUNT), properties);
return properties;
}
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Transform Core
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2021 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -26,18 +26,28 @@
*/
package org.alfresco.transformer.metadataExtractors;
import static org.apache.tika.metadata.DublinCore.NAMESPACE_URI_DC;
import org.apache.tika.metadata.Metadata;
import org.apache.tika.metadata.TikaCoreProperties;
import org.apache.tika.parser.ParseContext;
import org.apache.tika.parser.Parser;
import org.apache.tika.parser.odf.OpenDocumentMetaParser;
import org.apache.tika.parser.odf.OpenDocumentParser;
import org.apache.tika.parser.xml.ElementMetadataHandler;
import org.apache.tika.sax.TeeContentHandler;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xml.sax.ContentHandler;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
/**
* {@code "application/vnd.oasis.opendocument..."} and {@code "applicationvnd.oasis.opendocument..."} metadata extractor.
@@ -77,6 +87,7 @@ public class OpenDocumentMetadataExtractor extends AbstractTikaMetadataExtractor
private static final String KEY_INITIAL_CREATOR = "initialCreator";
private static final String KEY_KEYWORD = "keyword";
private static final String KEY_LANGUAGE = "language";
private static final String KEY_ALFRESCO_CREATOR = "_alfresco:creator";
private static final String CUSTOM_PREFIX = "custom:";
@@ -90,22 +101,33 @@ public class OpenDocumentMetadataExtractor extends AbstractTikaMetadataExtractor
@Override
protected Parser getParser()
{
return new OpenDocumentParser();
OpenDocumentParser parser = new OpenDocumentParser();
parser.setMetaParser(new OpenDocumentMetaParser() {
@Override
protected ContentHandler getContentHandler(ContentHandler ch, Metadata md, ParseContext context)
{
final ContentHandler superHandler = super.getContentHandler(ch, md, context);
final ContentHandler creatorHandler = new ElementMetadataHandler(NAMESPACE_URI_DC, KEY_CREATOR, md, KEY_ALFRESCO_CREATOR);
return new TeeContentHandler(superHandler, creatorHandler);
}
});
return parser;
}
@SuppressWarnings("deprecation")
@Override
protected Map<String, Serializable> extractSpecific(Metadata metadata,
Map<String, Serializable> properties, Map<String, String> headers)
{
putRawValue(KEY_CREATION_DATE, getDateOrNull(metadata.get(Metadata.CREATION_DATE)), properties);
putRawValue(KEY_CREATOR, metadata.get(Metadata.CREATOR), properties);
putRawValue(KEY_DATE, getDateOrNull(metadata.get(Metadata.DATE)), properties);
putRawValue(KEY_DESCRIPTION, metadata.get(Metadata.DESCRIPTION), properties);
putRawValue(KEY_CREATION_DATE, getDateOrNull(metadata.get(TikaCoreProperties.CREATED)), properties);
final String creator = getCreator(metadata);
putRawValue(KEY_CREATOR, creator, properties);
putRawValue(KEY_AUTHOR, creator, properties);
putRawValue(KEY_DATE, getDateOrNull(metadata.get(TikaCoreProperties.MODIFIED)), properties);
putRawValue(KEY_DESCRIPTION, metadata.get(TikaCoreProperties.DESCRIPTION), properties);
putRawValue(KEY_GENERATOR, metadata.get("generator"), properties);
putRawValue(KEY_INITIAL_CREATOR, metadata.get("initial-creator"), properties);
putRawValue(KEY_KEYWORD, metadata.get(Metadata.KEYWORDS), properties);
putRawValue(KEY_LANGUAGE, metadata.get(Metadata.LANGUAGE), properties);
putRawValue(KEY_KEYWORD, metadata.get(TikaCoreProperties.SUBJECT), properties);
putRawValue(KEY_LANGUAGE, metadata.get(TikaCoreProperties.LANGUAGE), properties);
// Handle user-defined properties dynamically
Map<String, Set<String>> mapping = super.getExtractMapping();
@@ -120,6 +142,18 @@ public class OpenDocumentMetadataExtractor extends AbstractTikaMetadataExtractor
return properties;
}
private String getCreator(Metadata metadata)
{
final List<String> creators = distinct(metadata.getValues(TikaCoreProperties.CREATOR))
.collect(Collectors.toUnmodifiableList());
if (creators.size() == 1)
{
return creators.get(0);
}
return metadata.get(KEY_ALFRESCO_CREATOR);
}
private Date getDateOrNull(String dateString)
{
if (dateString != null && dateString.length() != 0)

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Transform Core
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2021 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -28,6 +28,7 @@ package org.alfresco.transformer.metadataExtractors;
import org.apache.tika.config.TikaConfig;
import org.apache.tika.metadata.Metadata;
import org.apache.tika.metadata.TikaCoreProperties;
import org.apache.tika.metadata.XMPDM;
import org.apache.tika.parser.CompositeParser;
import org.apache.tika.parser.Parser;
@@ -148,13 +149,12 @@ public class TikaAudioMetadataExtractor extends AbstractTikaMetadataExtractor
* @param metadata the metadata extracted from the file
* @return the description
*/
@SuppressWarnings("deprecation")
private String generateDescription(Metadata metadata)
{
StringBuilder result = new StringBuilder();
if (metadata.get(Metadata.TITLE) != null)
if (metadata.get(TikaCoreProperties.TITLE) != null)
{
result.append(metadata.get(Metadata.TITLE));
result.append(metadata.get(TikaCoreProperties.TITLE));
if (metadata.get(XMPDM.ALBUM) != null)
{
result

View File

@@ -44,9 +44,9 @@ import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.io.IOUtils;
import org.apache.commons.io.output.NullOutputStream;
import org.apache.tika.exception.TikaException;
import org.apache.tika.io.IOUtils;
import org.apache.tika.io.NullOutputStream;
import org.apache.tika.io.TemporaryResources;
import org.apache.tika.io.TikaInputStream;
import org.apache.tika.metadata.Metadata;
@@ -57,7 +57,7 @@ import org.apache.tika.parser.external.ExternalParser;
import org.apache.tika.parser.external.ExternalParsersFactory;
import org.apache.tika.parser.image.ImageParser;
import org.apache.tika.parser.image.TiffParser;
import org.apache.tika.parser.jpeg.JpegParser;
import org.apache.tika.parser.image.JpegParser;
import org.apache.tika.sax.XHTMLContentHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -263,7 +263,7 @@ public class ExifToolParser extends ExternalParser {
* stream of the given process to the given XHTML content handler.
* The standard output stream is closed once fully processed.
*
* @param process process
* @param stream stream
* @param xhtml XHTML content handler
* @throws SAXException if the XHTML SAX events could not be handled
* @throws IOException if an input error occurred
@@ -315,13 +315,13 @@ public class ExifToolParser extends ExternalParser {
* standard stream of the given process. Potential exceptions
* are ignored, and the stream is closed once fully processed.
*
* @param process process
* @param stream stream
*/
private void ignoreStream(final InputStream stream) {
Thread t = new Thread() {
public void run() {
try {
IOUtils.copy(stream, new NullOutputStream());
IOUtils.copy(stream, NullOutputStream.NULL_OUTPUT_STREAM);
} catch (IOException e) {
} finally {
IOUtils.closeQuietly(stream);

View File

@@ -1,15 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-transform-core</artifactId>
<version>2.5.5-A2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
<version>2.5.7-A5-SNAPSHOT</version>
</parent>
<artifactId>alfresco-transformer-base</artifactId>
<version>2.5.5-A2-SNAPSHOT</version>
<properties>
<transformer.base.deploy.skip>false</transformer.base.deploy.skip>
@@ -81,7 +80,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<goals>

View File

@@ -33,11 +33,11 @@ import org.alfresco.transform.client.model.TransformRequestValidator;
import org.alfresco.transform.client.model.config.TransformConfig;
import org.alfresco.transform.client.registry.TransformServiceRegistry;
import org.alfresco.transform.exceptions.TransformException;
import org.alfresco.transform.router.TransformStack;
import org.alfresco.transform.router.TransformerDebug;
import org.alfresco.transformer.clients.AlfrescoSharedFileStoreClient;
import org.alfresco.transformer.logging.LogEntry;
import org.alfresco.transformer.model.FileRefResponse;
import org.codehaus.plexus.util.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -58,12 +58,20 @@ import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static java.util.stream.Collectors.joining;
import static org.alfresco.transform.client.model.config.CoreVersionDecorator.setOrClearCoreVersion;
import static org.alfresco.transform.client.util.RequestParamMap.DIRECT_ACCESS_URL;
import static org.alfresco.transform.client.util.RequestParamMap.CONFIG_VERSION;
import static org.alfresco.transform.client.util.RequestParamMap.CONFIG_VERSION_DEFAULT;
import static org.alfresco.transform.client.util.RequestParamMap.ENDPOINT_TRANSFORM;
import static org.alfresco.transform.client.util.RequestParamMap.ENDPOINT_TRANSFORM_CONFIG;
import static org.alfresco.transformer.fs.FileManager.TempFileProvider.createTempFile;
import static org.alfresco.transformer.fs.FileManager.buildFile;
import static org.alfresco.transformer.fs.FileManager.createAttachment;
@@ -126,7 +134,7 @@ public abstract class AbstractTransformerController implements TransformControll
// Request parameters that are not part of transform options
public static final List<String> NON_TRANSFORM_OPTION_REQUEST_PARAMETERS = Arrays.asList(SOURCE_EXTENSION,
TARGET_EXTENSION, TARGET_MIMETYPE, SOURCE_MIMETYPE, TEST_DELAY, TRANSFORM_NAME_PROPERTY);
TARGET_EXTENSION, TARGET_MIMETYPE, SOURCE_MIMETYPE, TEST_DELAY, TRANSFORM_NAME_PROPERTY, DIRECT_ACCESS_URL);
@Autowired
private AlfrescoSharedFileStoreClient alfrescoSharedFileStoreClient;
@@ -140,18 +148,19 @@ public abstract class AbstractTransformerController implements TransformControll
@Autowired
private TransformerDebug transformerDebug;
@GetMapping(value = "/transform/config")
public ResponseEntity<TransformConfig> info()
@GetMapping(value = ENDPOINT_TRANSFORM_CONFIG)
public ResponseEntity<TransformConfig> info(
@RequestParam(value = CONFIG_VERSION, defaultValue = CONFIG_VERSION_DEFAULT) int configVersion)
{
logger.info("GET Transform Config.");
final TransformConfig transformConfig =
((TransformRegistryImpl) transformRegistry).getTransformConfig();
logger.info("GET Transform Config version: " + configVersion);
TransformConfig transformConfig = ((TransformRegistryImpl) transformRegistry).getTransformConfig();
transformConfig = setOrClearCoreVersion(transformConfig, configVersion);
return new ResponseEntity<>(transformConfig, OK);
}
@PostMapping(value = "/transform", consumes = MULTIPART_FORM_DATA_VALUE)
@PostMapping(value = ENDPOINT_TRANSFORM, consumes = MULTIPART_FORM_DATA_VALUE)
public ResponseEntity<Resource> transform(HttpServletRequest request,
@RequestParam(FILE) MultipartFile sourceMultipartFile,
@RequestParam(value = FILE, required = false) MultipartFile sourceMultipartFile,
@RequestParam(TARGET_EXTENSION) String targetExtension,
@RequestParam(value = SOURCE_MIMETYPE, required = false) String sourceMimetype,
@RequestParam(value = TARGET_MIMETYPE, required = false) String targetMimetype,
@@ -168,10 +177,27 @@ public abstract class AbstractTransformerController implements TransformControll
+ "targetExtension: '{}', requestParameters: {}", sourceMimetype, targetMimetype, targetExtension, requestParameters);
}
final String targetFilename = createTargetFileName(
sourceMultipartFile.getOriginalFilename(), targetExtension);
final String directUrl = requestParameters.getOrDefault(DIRECT_ACCESS_URL, "");
File sourceFile;
String sourceFilename;
if (directUrl.isBlank())
{
if (sourceMultipartFile == null)
{
throw new TransformException(BAD_REQUEST.value(), "Required request part 'file' is not present");
}
sourceFile = createSourceFile(request, sourceMultipartFile);
sourceFilename = sourceMultipartFile.getOriginalFilename();
}
else
{
sourceFile = getSourceFileFromDirectUrl(directUrl);
sourceFilename = sourceFile.getName();
}
final String targetFilename = createTargetFileName(sourceFilename, targetExtension);
getProbeTestTransform().incrementTransformerCount();
final File sourceFile = createSourceFile(request, sourceMultipartFile);
final File targetFile = createTargetFile(request, targetFilename);
Map<String, String> transformOptions = getTransformOptions(requestParameters);
@@ -186,6 +212,25 @@ public abstract class AbstractTransformerController implements TransformControll
return body;
}
private File getSourceFileFromDirectUrl(String directUrl)
{
File sourceFile = createTempFile("tmp", ".tmp");
try
{
FileUtils.copyURLToFile(new URL(directUrl), sourceFile);
}
catch (IllegalArgumentException e)
{
throw new TransformException(BAD_REQUEST.value(), "Direct Access Url is invalid.", e);
}
catch (IOException e)
{
throw new TransformException(BAD_REQUEST.value(), "Direct Access Url not found.", e);
}
return sourceFile;
}
protected Map<String, String> getTransformOptions(Map<String, String> requestParameters)
{
Map<String, String> transformOptions = new HashMap<>(requestParameters);
@@ -204,7 +249,7 @@ public abstract class AbstractTransformerController implements TransformControll
* @param timeout Transformation timeout
* @return A transformation reply
*/
@PostMapping(value = "/transform", produces = APPLICATION_JSON_VALUE)
@PostMapping(value = ENDPOINT_TRANSFORM, produces = APPLICATION_JSON_VALUE)
@ResponseBody
public ResponseEntity<TransformReply> transform(@RequestBody TransformRequest request,
@RequestParam(value = "timeout", required = false) Long timeout)
@@ -239,9 +284,17 @@ public abstract class AbstractTransformerController implements TransformControll
// Load the source file
File sourceFile;
try
{
final String directUrl = request.getTransformRequestOptions().getOrDefault(DIRECT_ACCESS_URL, "");
if (directUrl.isBlank())
{
sourceFile = loadSourceFile(request.getSourceReference(), request.getSourceExtension());
}
else
{
sourceFile = getSourceFileFromDirectUrl(directUrl);
}
}
catch (TransformException e)
{
reply.setStatus(e.getStatusCode());
@@ -280,7 +333,7 @@ public abstract class AbstractTransformerController implements TransformControll
{
String targetMimetype = request.getTargetMediaType();
String sourceMimetype = request.getSourceMediaType();
Map<String, String> transformOptions = request.getTransformRequestOptions();
Map<String, String> transformOptions = getTransformOptions(request.getTransformRequestOptions());
transformerDebug.logOptions(request);
String transformName = getTransformerName(sourceFile, sourceMimetype, targetMimetype, transformOptions);
transformImpl(transformName, sourceMimetype, targetMimetype, transformOptions, sourceFile, targetFile);

View File

@@ -26,6 +26,7 @@
package org.alfresco.transformer;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.alfresco.transform.client.model.config.CoreVersionDecorator.setCoreVersionOnSingleStepTransformers;
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
import java.io.IOException;
@@ -61,6 +62,9 @@ public class TransformRegistryImpl extends AbstractTransformRegistry
@Value("${transform.core.config.location:classpath:engine_config.json}")
private String locationFromProperty;
@Value("${transform.core.version}")
private String coreVersion;
private Resource engineConfig;
@PostConstruct
@@ -82,7 +86,9 @@ public class TransformRegistryImpl extends AbstractTransformRegistry
{
try (Reader reader = new InputStreamReader(engineConfig.getInputStream(), UTF_8))
{
return jsonObjectMapper.readValue(reader, TransformConfig.class);
TransformConfig transformConfig = jsonObjectMapper.readValue(reader, TransformConfig.class);
setCoreVersionOnSingleStepTransformers(transformConfig, coreVersion);
return transformConfig;
}
catch (IOException e)
{

View File

@@ -38,16 +38,17 @@ import org.springframework.web.client.RestTemplate;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import static org.alfresco.transform.client.util.RequestParamMap.ENDPOINT_TRANSFORM;
@Configuration
public class WebApplicationConfig implements WebMvcConfigurer
{
@Override
public void addInterceptors(InterceptorRegistry registry)
{
registry
.addInterceptor(transformInterceptor())
.addPathPatterns("/transform", "/live", "/ready");
.addPathPatterns(ENDPOINT_TRANSFORM, "/live", "/ready");
}
@Bean

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Transform Core
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -26,7 +26,11 @@
*/
package org.alfresco.transformer.util;
public interface RequestParamMap
/**
* Extends the list of transform options with historic request parameters or 'extra' parameters used in testing
* or communication in the all-in-one transformer.
*/
public interface RequestParamMap extends org.alfresco.transform.client.util.RequestParamMap
{
// This property can be sent by acs repository's legacy transformers to force a transform,
// instead of letting this T-Engine determine it based on the request parameters.
@@ -35,43 +39,14 @@ public interface RequestParamMap
// See ATS-731.
@Deprecated
String TRANSFORM_NAME_PROPERTY = "transformName";
String TRANSFORM_NAME_PARAMETER = "alfresco.transform-name-parameter";
String FILE = "file";
String SOURCE_ENCODING = "sourceEncoding";
String FILE = "file";
String SOURCE_EXTENSION = "sourceExtension";
String SOURCE_MIMETYPE = "sourceMimetype";
String TARGET_EXTENSION = "targetExtension";
String TARGET_MIMETYPE = "targetMimetype";
String TARGET_ENCODING = "targetEncoding";
String TEST_DELAY = "testDelay";
String PAGE_REQUEST_PARAM = "page";
String WIDTH_REQUEST_PARAM = "width";
String HEIGHT_REQUEST_PARAM = "height";
String ALLOW_PDF_ENLARGEMENT = "allowPdfEnlargement";
String MAINTAIN_PDF_ASPECT_RATIO = "maintainPdfAspectRatio";
String START_PAGE = "startPage";
String END_PAGE = "endPage";
String ALPHA_REMOVE = "alphaRemove";
String AUTO_ORIENT = "autoOrient";
String CROP_GRAVITY = "cropGravity";
String CROP_WIDTH = "cropWidth";
String CROP_HEIGHT = "cropHeight";
String CROP_PERCENTAGE = "cropPercentage";
String CROP_X_OFFSET = "cropXOffset";
String CROP_Y_OFFSET = "cropYOffset";
String THUMBNAIL = "thumbnail";
String RESIZE_WIDTH = "resizeWidth";
String RESIZE_HEIGHT = "resizeHeight";
String RESIZE_PERCENTAGE = "resizePercentage";
String ALLOW_ENLARGEMENT = "allowEnlargement";
String MAINTAIN_ASPECT_RATIO = "maintainAspectRatio";
String COMMAND_OPTIONS = "commandOptions";
String TIMEOUT = "timeout";
String INCLUDE_CONTENTS = "includeContents";
String NOT_EXTRACT_BOOKMARKS_TEXT = "notExtractBookmarksText";
String PAGE_LIMIT = "pageLimit";
// TODO PoC for FFmpeg - effectively target options (note: if we need specific source options, may need extra set)
String TIME_OFFSET = "timeOffset";
@@ -79,4 +54,5 @@ public interface RequestParamMap
String FRAMES_NUM = "framesNum";
String FRAME_WIDTH = "frameWidth";
String FRAME_HEIGHT = "frameHeight";
}

View File

@@ -36,6 +36,7 @@
<div>
<br/>
<a href="/">Test Transformation</a>
<a href="/transform/config?configVersion=9999">Transformer Config</a>
</div>
</body>

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Transform Core
* %%
* Copyright (C) 2005 - 2021 Alfresco Software Limited
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -26,6 +26,8 @@
*/
package org.alfresco.transformer;
import static org.alfresco.transform.client.util.RequestParamMap.DIRECT_ACCESS_URL;
import static org.alfresco.transform.client.util.RequestParamMap.ENDPOINT_TRANSFORM;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.springframework.http.HttpMethod.POST;
import static org.springframework.http.MediaType.MULTIPART_FORM_DATA;
@@ -89,9 +91,12 @@ public abstract class AbstractHttpRequestTest
@Test
public void noFileError()
{
// Transformer name is not part of the title as this is checked by another handler
LinkedMultiValueMap<String, Object> parameters = new LinkedMultiValueMap<>();
parameters.add("targetExtension", ".tmp");
assertTransformError(false,
"Required request part 'file' is not present");
getTransformerName() + " - Required request part 'file' is not present",
parameters);
}
@Test
@@ -103,10 +108,12 @@ public abstract class AbstractHttpRequestTest
private void assertMissingParameter(String name)
{
assertTransformError(true,
getTransformerName() + " - Request parameter '" + name + "' is missing");
getTransformerName() + " - Request parameter '" + name + "' is missing", null);
}
protected void assertTransformError(boolean addFile, String errorMessage)
protected void assertTransformError(boolean addFile,
String errorMessage,
LinkedMultiValueMap<String, Object> additionalParams)
{
LinkedMultiValueMap<String, Object> parameters = new LinkedMultiValueMap<>();
if (addFile)
@@ -114,6 +121,11 @@ public abstract class AbstractHttpRequestTest
parameters.add("file",
new org.springframework.core.io.ClassPathResource("quick." + getSourceExtension()));
}
if (additionalParams != null)
{
parameters.addAll(additionalParams);
}
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MULTIPART_FORM_DATA);
HttpEntity<LinkedMultiValueMap<String, Object>> entity = new HttpEntity<>(parameters,
@@ -122,10 +134,25 @@ public abstract class AbstractHttpRequestTest
sendTranformationRequest(entity, errorMessage);
}
@Test
public void httpTransformRequestDirectAccessUrlNotFoundTest()
{
String directUrl = "https://expired/direct/access/url";
LinkedMultiValueMap<String, Object> parameters = new LinkedMultiValueMap<>();
parameters.add("targetExtension", ".tmp");
parameters.add(DIRECT_ACCESS_URL, directUrl);
assertTransformError(false,
getTransformerName() + " - Direct Access Url not found.",
parameters);
}
protected void sendTranformationRequest(
final HttpEntity<LinkedMultiValueMap<String, Object>> entity, final String errorMessage)
{
final ResponseEntity<String> response = restTemplate.exchange("/transform", POST, entity,
final ResponseEntity<String> response = restTemplate.exchange(ENDPOINT_TRANSFORM, POST, entity,
String.class, "");
assertEquals(errorMessage, getErrorMessage(response.getBody()));
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Transform Core
* %%
* Copyright (C) 2005 - 2021 Alfresco Software Limited
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
@@ -103,7 +103,7 @@ public abstract class AbstractMetadataExtractsIT
Map<String, Serializable> expectedMetadata = readExpectedMetadata(metadataFilename, actualMetadataFile);
assertEquals(expectedMetadata, actualMetadata,
"The metadata did not match the expected value. It has been saved in "+actualMetadataFile.getAbsolutePath());
sourceFile+": The metadata did not match the expected value. It has been saved in "+actualMetadataFile.getAbsolutePath());
actualMetadataFile.delete();
}
catch (Exception e)

View File

@@ -27,13 +27,21 @@
package org.alfresco.transformer;
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_TEXT_PLAIN;
import static org.alfresco.transform.client.util.RequestParamMap.DIRECT_ACCESS_URL;
import static org.alfresco.transform.client.util.RequestParamMap.ENDPOINT_TRANSFORM;
import static org.alfresco.transform.client.util.RequestParamMap.ENDPOINT_TRANSFORM_CONFIG_LATEST;
import static org.alfresco.transform.client.util.RequestParamMap.ENDPOINT_TRANSFORM_CONFIG;
import static org.hamcrest.Matchers.containsString;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.when;
import static org.springframework.http.HttpHeaders.ACCEPT;
import static org.springframework.http.HttpHeaders.CONTENT_TYPE;
import static org.springframework.http.HttpStatus.BAD_REQUEST;
import static org.springframework.http.HttpStatus.CREATED;
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
import static org.springframework.http.HttpStatus.OK;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
@@ -52,6 +60,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import org.alfresco.transform.client.model.InternalContext;
import org.alfresco.transform.client.model.TransformReply;
@@ -65,16 +74,20 @@ import org.alfresco.transform.client.model.config.Transformer;
import org.alfresco.transform.client.registry.TransformServiceRegistry;
import org.alfresco.transform.router.TransformStack;
import org.alfresco.transformer.clients.AlfrescoSharedFileStoreClient;
import org.alfresco.transformer.model.FileRefEntity;
import org.alfresco.transformer.model.FileRefResponse;
import org.alfresco.transformer.probes.ProbeTestTransform;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.boot.test.mock.mockito.SpyBean;
import org.springframework.core.io.ClassPathResource;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.test.util.ReflectionTestUtils;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.ResultActions;
import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
@@ -103,6 +116,9 @@ public abstract class AbstractTransformerControllerTest
@SpyBean
protected TransformServiceRegistry transformRegistry;
@Value("${transform.core.version}")
private String coreVersion;
protected String sourceExtension;
protected String targetExtension;
protected String sourceMimetype;
@@ -209,7 +225,37 @@ public abstract class AbstractTransformerControllerTest
protected MockHttpServletRequestBuilder mockMvcRequest(String url, MockMultipartFile sourceFile,
String... params)
{
MockHttpServletRequestBuilder builder = MockMvcRequestBuilders.multipart("/transform").file(
if (sourceFile == null)
{
return mockMvcRequestWithoutMockMultipartFile(url, params);
}
else
{
return mockMvcRequestWithMockMultipartFile(url, sourceFile, params);
}
}
private MockHttpServletRequestBuilder mockMvcRequestWithoutMockMultipartFile(String url,
String... params)
{
MockHttpServletRequestBuilder builder = MockMvcRequestBuilders.multipart(ENDPOINT_TRANSFORM);
if (params.length % 2 != 0)
{
throw new IllegalArgumentException("each param should have a name and value.");
}
for (int i = 0; i < params.length; i += 2)
{
builder = builder.param(params[i], params[i + 1]);
}
return builder;
}
private MockHttpServletRequestBuilder mockMvcRequestWithMockMultipartFile(String url, MockMultipartFile sourceFile,
String... params)
{
MockHttpServletRequestBuilder builder = MockMvcRequestBuilders.multipart(ENDPOINT_TRANSFORM).file(
sourceFile);
if (params.length % 2 != 0)
@@ -252,7 +298,7 @@ public abstract class AbstractTransformerControllerTest
public void simpleTransformTest() throws Exception
{
mockMvc.perform(
mockMvcRequest("/transform", sourceFile, "targetExtension", targetExtension))
mockMvcRequest(ENDPOINT_TRANSFORM, sourceFile, "targetExtension", targetExtension))
.andExpect(status().is(OK.value()))
.andExpect(content().bytes(expectedTargetFileBytes))
.andExpect(header().string("Content-Disposition",
@@ -263,7 +309,7 @@ public abstract class AbstractTransformerControllerTest
public void testDelayTest() throws Exception
{
long start = System.currentTimeMillis();
mockMvc.perform(mockMvcRequest("/transform", sourceFile, "targetExtension", targetExtension,
mockMvc.perform(mockMvcRequest(ENDPOINT_TRANSFORM, sourceFile, "targetExtension", targetExtension,
"testDelay", "400"))
.andExpect(status().is(OK.value()))
.andExpect(content().bytes(expectedTargetFileBytes))
@@ -278,7 +324,7 @@ public abstract class AbstractTransformerControllerTest
@Test
public void noTargetFileTest() throws Exception
{
mockMvc.perform(mockMvcRequest("/transform", sourceFile, "targetExtension", "xxx"))
mockMvc.perform(mockMvcRequest(ENDPOINT_TRANSFORM, sourceFile, "targetExtension", "xxx"))
.andExpect(status().is(INTERNAL_SERVER_ERROR.value()));
}
@@ -290,7 +336,7 @@ public abstract class AbstractTransformerControllerTest
expectedSourceFileBytes);
mockMvc.perform(
mockMvcRequest("/transform", sourceFile, "targetExtension", targetExtension))
mockMvcRequest(ENDPOINT_TRANSFORM, sourceFile, "targetExtension", targetExtension))
.andExpect(status().is(OK.value()))
.andExpect(content().bytes(expectedTargetFileBytes))
.andExpect(header().string("Content-Disposition",
@@ -305,7 +351,7 @@ public abstract class AbstractTransformerControllerTest
expectedSourceFileBytes);
mockMvc.perform(
mockMvcRequest("/transform", sourceFile, "targetExtension", targetExtension))
mockMvcRequest(ENDPOINT_TRANSFORM, sourceFile, "targetExtension", targetExtension))
.andExpect(status().is(OK.value()))
.andExpect(content().bytes(expectedTargetFileBytes))
.andExpect(header().string("Content-Disposition",
@@ -319,7 +365,7 @@ public abstract class AbstractTransformerControllerTest
sourceFile = new MockMultipartFile("file", "abc/", sourceMimetype, expectedSourceFileBytes);
mockMvc.perform(
mockMvcRequest("/transform", sourceFile, "targetExtension", targetExtension))
mockMvcRequest(ENDPOINT_TRANSFORM, sourceFile, "targetExtension", targetExtension))
.andExpect(status().is(BAD_REQUEST.value()))
.andExpect(status().reason(containsString("The source filename was not supplied")));
}
@@ -330,14 +376,14 @@ public abstract class AbstractTransformerControllerTest
sourceFile = new MockMultipartFile("file", "", sourceMimetype, expectedSourceFileBytes);
mockMvc.perform(
mockMvcRequest("/transform", sourceFile, "targetExtension", targetExtension))
mockMvcRequest(ENDPOINT_TRANSFORM, sourceFile, "targetExtension", targetExtension))
.andExpect(status().is(BAD_REQUEST.value()));
}
@Test
public void noTargetExtensionTest() throws Exception
{
mockMvc.perform(mockMvcRequest("/transform", sourceFile))
mockMvc.perform(mockMvcRequest(ENDPOINT_TRANSFORM, sourceFile))
.andExpect(status().is(BAD_REQUEST.value()))
.andExpect(status().reason(
containsString("Request parameter 'targetExtension' is missing")));
@@ -382,7 +428,7 @@ public abstract class AbstractTransformerControllerTest
String tr = objectMapper.writeValueAsString(transformRequest);
String transformationReplyAsString = mockMvc
.perform(MockMvcRequestBuilders
.post("/transform")
.post(ENDPOINT_TRANSFORM)
.header(ACCEPT, APPLICATION_JSON_VALUE)
.header(CONTENT_TYPE, APPLICATION_JSON_VALUE)
.content(tr))
@@ -411,12 +457,38 @@ public abstract class AbstractTransformerControllerTest
TransformConfig expectedTransformConfig = objectMapper
.readValue(getTestFile(getEngineConfigName(), true),
TransformConfig.class);
expectedTransformConfig.getTransformers().forEach(transformer -> {
transformer.setCoreVersion(coreVersion);
transformer.getTransformOptions().add(DIRECT_ACCESS_URL);
});
expectedTransformConfig.getTransformOptions().put(DIRECT_ACCESS_URL, Set.of(new TransformOptionValue(false, DIRECT_ACCESS_URL)));
ReflectionTestUtils.setField(transformRegistry, "engineConfig",
new ClassPathResource(getEngineConfigName()));
String response = mockMvc
.perform(MockMvcRequestBuilders.get("/transform/config"))
.perform(MockMvcRequestBuilders.get(ENDPOINT_TRANSFORM_CONFIG_LATEST))
.andExpect(status().is(OK.value()))
.andExpect(header().string(CONTENT_TYPE, APPLICATION_JSON_VALUE))
.andReturn().getResponse().getContentAsString();
TransformConfig transformConfig = objectMapper.readValue(response, TransformConfig.class);
assertEquals(expectedTransformConfig, transformConfig);
}
@Test
// Test for case when T-Router or Repository is a version that does not expect it
public void testGetTransformConfigInfoExcludingCoreVersion() throws Exception
{
TransformConfig expectedTransformConfig = objectMapper
.readValue(getTestFile(getEngineConfigName(), true),
TransformConfig.class);
ReflectionTestUtils.setField(transformRegistry, "engineConfig",
new ClassPathResource(getEngineConfigName()));
String response = mockMvc
.perform(MockMvcRequestBuilders.get(ENDPOINT_TRANSFORM_CONFIG))
.andExpect(status().is(OK.value()))
.andExpect(header().string(CONTENT_TYPE, APPLICATION_JSON_VALUE))
.andReturn().getResponse().getContentAsString();
@@ -434,7 +506,7 @@ public abstract class AbstractTransformerControllerTest
new ClassPathResource("engine_config_with_duplicates.json"));
String response = mockMvc
.perform(MockMvcRequestBuilders.get("/transform/config"))
.perform(MockMvcRequestBuilders.get(ENDPOINT_TRANSFORM_CONFIG))
.andExpect(status().is(OK.value()))
.andExpect(header().string(CONTENT_TYPE, APPLICATION_JSON_VALUE))
.andReturn().getResponse().getContentAsString();
@@ -461,7 +533,7 @@ public abstract class AbstractTransformerControllerTest
new ClassPathResource("engine_config_incomplete.json"));
String response = mockMvc
.perform(MockMvcRequestBuilders.get("/transform/config"))
.perform(MockMvcRequestBuilders.get(ENDPOINT_TRANSFORM_CONFIG))
.andExpect(status().is(OK.value()))
.andExpect(header().string(CONTENT_TYPE, APPLICATION_JSON_VALUE))
.andReturn().getResponse().getContentAsString();
@@ -484,7 +556,7 @@ public abstract class AbstractTransformerControllerTest
new ClassPathResource("engine_config_no_transform_options.json"));
String response = mockMvc
.perform(MockMvcRequestBuilders.get("/transform/config"))
.perform(MockMvcRequestBuilders.get(ENDPOINT_TRANSFORM_CONFIG))
.andExpect(status().is(OK.value()))
.andExpect(header().string(CONTENT_TYPE, APPLICATION_JSON_VALUE))
.andReturn().getResponse().getContentAsString();
@@ -540,4 +612,64 @@ public abstract class AbstractTransformerControllerTest
transformer.setSupportedSourceAndTargetList(supportedSourceAndTargetList);
return transformer;
}
@Test
public void queueTransformRequestUsingDirectAccessUrlTest() throws Exception
{
// Files
String sourceFileRef = UUID.randomUUID().toString();
File sourceFile = getTestFile("quick." + sourceExtension, true);
String targetFileRef = UUID.randomUUID().toString();
TransformRequest transformRequest = createTransformRequest(sourceFileRef, sourceFile);
Map<String, String> transformRequestOptions = transformRequest.getTransformRequestOptions();
String directUrl = "file://" + sourceFile.toPath();
transformRequestOptions.put(DIRECT_ACCESS_URL, directUrl);
transformRequest.setTransformRequestOptions(transformRequestOptions);
when(alfrescoSharedFileStoreClient.saveFile(any()))
.thenReturn(new FileRefResponse(new FileRefEntity(targetFileRef)));
// Update the Transformation Request with any specific params before sending it
updateTransformRequestWithSpecificOptions(transformRequest);
// Serialize and call the transformer
String tr = objectMapper.writeValueAsString(transformRequest);
String transformationReplyAsString = mockMvc
.perform(MockMvcRequestBuilders
.post("/transform")
.header(ACCEPT, APPLICATION_JSON_VALUE)
.header(CONTENT_TYPE, APPLICATION_JSON_VALUE)
.content(tr))
.andExpect(status().is(CREATED.value()))
.andReturn().getResponse().getContentAsString();
TransformReply transformReply = objectMapper.readValue(transformationReplyAsString,
TransformReply.class);
// Assert the reply
assertEquals(transformRequest.getRequestId(), transformReply.getRequestId());
assertEquals(transformRequest.getClientData(), transformReply.getClientData());
assertEquals(transformRequest.getSchema(), transformReply.getSchema());
}
@Test
public void httpTransformRequestUsingDirectAccessUrlTest() throws Exception
{
File dauSourceFile = getTestFile("quick." + sourceExtension, true);
String directUrl = "file://" + dauSourceFile.toPath();
ResultActions resultActions = mockMvc.perform(
mockMvcRequest(ENDPOINT_TRANSFORM, null)
.param("targetExtension", targetExtension)
.param(DIRECT_ACCESS_URL, directUrl))
.andExpect(status().is(OK.value()));
if (expectedTargetFileBytes != null)
{
resultActions.andExpect(content().bytes(expectedTargetFileBytes));
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2019 Alfresco Software, Ltd. All rights reserved.
* Copyright 2015-2022 Alfresco Software, Ltd. All rights reserved.
*
* License rights for this program may be obtained from Alfresco Software, Ltd.
* pursuant to a written agreement and any use of this program without such an
@@ -8,6 +8,7 @@
package org.alfresco.transformer;
import static java.util.Collections.emptyMap;
import static org.alfresco.transform.client.util.RequestParamMap.ENDPOINT_TRANSFORM;
import static org.springframework.http.MediaType.MULTIPART_FORM_DATA;
import java.util.Map;
@@ -63,6 +64,6 @@ public class EngineClient
final HttpEntity<MultiValueMap<String, Object>> entity = new HttpEntity<>(body, headers);
return REST_TEMPLATE.postForEntity(engineUrl + "/transform", entity, Resource.class);
return REST_TEMPLATE.postForEntity(engineUrl + ENDPOINT_TRANSFORM, entity, Resource.class);
}
}

View File

@@ -76,4 +76,10 @@ public class TestFileInfo
{
return new TestFileInfo(mimeType, extension, path, false);
}
@Override
public String toString()
{
return path;
}
}

View File

@@ -4,9 +4,8 @@ The `.travis.yml` config file can be found in the root of the repository.
## Stages and Jobs
1. **Build**: Java build with unit tests, integration tests and WhiteSource scan.
2. **Release**: Release with artifact deployment to Nexus and AWS Staging bucket.
3. **Company Release**: Artifact deployment to AWS Release bucket.
1. **Build**: Java build with unit and integration tests.
2. **Release**: Release with artifact deployment to Nexus, DockerHub and Quay.io.
## Branches
@@ -27,10 +26,6 @@ Travis CI builds differ by branch:
of the release jobs (no artifacts will be published until the PR is actually merged).
* `ATS-*` branches:
- regular builds which include only the _Build_ and _Tests_ stages;
* `company_release` branch:
- builds that include the _Company Release_ stage only.
- the `company_release` branch should be used for one-off events; once used (a build
completes), the branch should be deleted.
All other branches are ignored.
@@ -67,13 +62,3 @@ been generated by steps (2) and (3), then an empty commit should be created - e.
**Create a merge commit** (_Merge pull request_) or **Squash and merge** options are used, you
need to ensure that the _commit message_ contains the `[trigger release]` tag (sub-string).
## Company Release process steps & info
Prerequisites:
- The **Release** stage is complete - i.e. the release commit is tagged and the release
artifacts are deployed on Nexus.
Steps:
1. Create a new `company_release` branch from the `master` / `SP/*`/ `HF/*` branch. This job uses
the latest branch git tag to identify the version that must be uploaded to the S3 release bucket.
2. Wait for a green build on the branch.
3. Delete local and remote `company_release` branch.

77
pom.xml
View File

@@ -3,13 +3,14 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-transform-core</artifactId>
<version>2.5.5-A2-SNAPSHOT</version>
<version>2.5.7-A5-SNAPSHOT</version>
<packaging>pom</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.2</version>
<version>2.6.3</version>
<relativePath />
</parent>
<properties>
@@ -18,23 +19,22 @@
<maven.compiler.target>11</maven.compiler.target>
<image.tag>latest</image.tag>
<dependency.pdfbox.version>2.0.24</dependency.pdfbox.version>
<dependency.pdfbox.version>2.0.25</dependency.pdfbox.version>
<dependency.alfresco-jodconverter-core.version>3.0.1.12</dependency.alfresco-jodconverter-core.version>
<env.project_version>${project.version}</env.project_version>
<dependency.alfresco-transform-model.version>1.4.5</dependency.alfresco-transform-model.version>
<dependency.activemq.version>5.16.3</dependency.activemq.version>
<dependency.alfresco-transform-model.version>1.4.11</dependency.alfresco-transform-model.version>
<dependency.activemq.version>5.16.4</dependency.activemq.version>
<dependency.jackson.version>2.13.1</dependency.jackson.version>
<dependency.jackson-databind.version>${dependency.jackson.version}</dependency.jackson-databind.version>
<dependency.junit.version>4.13.2</dependency.junit.version>
<dependency.cxf.version>3.5.0</dependency.cxf.version>
<dependency.tika.version>1.26</dependency.tika.version>
<dependency.tika.version>2.2.1</dependency.tika.version>
<dependency.poi.version>4.1.2</dependency.poi.version>
<dependency.ooxml-schemas.version>1.4</dependency.ooxml-schemas.version>
<parent.core.deploy.skip>false</parent.core.deploy.skip>
</properties>
<profiles>
<profile>
<id>full-build</id>
@@ -124,6 +124,7 @@
</modules>
</profile>
</profiles>
<scm>
<connection>scm:git:https://github.com/Alfresco/alfresco-transform-core.git</connection>
<developerConnection>scm:git:https://github.com/Alfresco/alfresco-transform-core.git</developerConnection>
@@ -231,7 +232,7 @@
<dependency>
<groupId>com.github.junrar</groupId>
<artifactId>junrar</artifactId>
<version>7.4.0</version>
<version>7.4.1</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
@@ -259,6 +260,15 @@
</dependencies>
</dependencyManagement>
<!-- ATS-981: Avoid CVE-2022-23181 with spring-boot-starter-web 2.6.3 -->
<dependencies>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
<version>9.0.58</version>
</dependency>
</dependencies>
<distributionManagement>
<snapshotRepository>
<id>alfresco-public-snapshots</id>
@@ -275,7 +285,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.3.1</version>
<configuration>
<doclint>none</doclint>
</configuration>
@@ -301,6 +310,7 @@
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
<configuration>
@@ -323,10 +333,15 @@
<goal>add-third-party</goal>
<goal>download-licenses</goal>
</goals>
<phase>generate-resources</phase>
<configuration>
<useMissingFile>true</useMissingFile>
<failOnMissing>true</failOnMissing>
<excludedScopes>provided,test</excludedScopes>
<excludedGroups>org.alfresco</excludedGroups>
<failIfWarning>true</failIfWarning>
<includedLicenses>https://raw.githubusercontent.com/Alfresco/third-party-license-overrides/master/includedLicenses.txt</includedLicenses>
<licenseMergesUrl>https://raw.githubusercontent.com/Alfresco/third-party-license-overrides/master/licenseMerges.txt</licenseMergesUrl>
<overrideUrl>https://raw.githubusercontent.com/Alfresco/third-party-license-overrides/master/override-THIRD-PARTY.properties</overrideUrl>
</configuration>
</execution>
<execution>
@@ -377,15 +392,6 @@
<buildDirectory>${project.build.directory}</buildDirectory>
</systemPropertyVariables>
</configuration>
<executions>
<execution>
<id>default-test</id>
<goals>
<goal>test</goal>
</goals>
<phase>test</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -394,42 +400,11 @@
<forkCount>1</forkCount>
<reuseForks>true</reuseForks>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId>
<version>4.4.0</version>
</plugin>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.38.0</version>
<extensions>true</extensions>
<executions>
<execution>
<id>before-integration-tests</id>
<phase>pre-integration-test</phase>
<goals>
<goal>stop</goal>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>after-integration-tests</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
<version>0.39.0</version>
</plugin>
</plugins>
</pluginManagement>