diff --git a/alfresco-transform-core-aio/alfresco-transform-core-aio-boot/src/main/java/org/alfresco/transformer/AIOCustomConfig.java b/alfresco-transform-core-aio/alfresco-transform-core-aio-boot/src/main/java/org/alfresco/transformer/AIOCustomConfig.java index bdad260d..9bf7201d 100644 --- a/alfresco-transform-core-aio/alfresco-transform-core-aio-boot/src/main/java/org/alfresco/transformer/AIOCustomConfig.java +++ b/alfresco-transform-core-aio/alfresco-transform-core-aio-boot/src/main/java/org/alfresco/transformer/AIOCustomConfig.java @@ -31,19 +31,12 @@ import org.alfresco.transformer.executors.ImageMagickCommandExecutor; import org.alfresco.transformer.executors.LibreOfficeJavaExecutor; import org.alfresco.transformer.executors.PdfRendererCommandExecutor; import org.alfresco.transformer.executors.TikaJavaExecutor; -import org.alfresco.transformer.executors.Transformer; import org.alfresco.transformer.transformers.SelectingTransformer; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Primary; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.List; -import java.util.stream.Collectors; -import java.util.stream.Stream; - @Configuration public class AIOCustomConfig { @@ -95,26 +88,12 @@ public class AIOCustomConfig public TransformServiceRegistry aioTransformRegistry() throws Exception { AIOTransformRegistry aioTransformRegistry = new AIOTransformRegistry(); - - // 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(new SelectingTransformer()); + aioTransformRegistry.registerTransformer(new TikaJavaExecutor(notExtractBookmarksTextDefault)); + aioTransformRegistry.registerTransformer(new ImageMagickCommandExecutor(imageMagickExePath, imageMagickDynPath, imageMagickRootPath, imageMagickCodersPath, imageMagickConfigPath)); + aioTransformRegistry.registerTransformer(new LibreOfficeJavaExecutor(libreofficePath, libreofficeMaxTasksPerProcess, libreofficeTimeout, libreofficePortNumbers, libreofficeTemplateProfileDir, libreofficeIsEnabled)); + aioTransformRegistry.registerTransformer(new PdfRendererCommandExecutor(pdfRendererPath)); aioTransformRegistry.registerCombinedTransformers(); return aioTransformRegistry; } - - List getTEnginesSortedByName() - { - return Stream.of(new SelectingTransformer(), - new TikaJavaExecutor(notExtractBookmarksTextDefault), - new ImageMagickCommandExecutor(imageMagickExePath, imageMagickDynPath, imageMagickRootPath, imageMagickCodersPath, imageMagickConfigPath), - new LibreOfficeJavaExecutor(libreofficePath, libreofficeMaxTasksPerProcess, libreofficeTimeout, libreofficePortNumbers, libreofficeTemplateProfileDir, libreofficeIsEnabled), - new PdfRendererCommandExecutor(pdfRendererPath)) - .sorted(Comparator.comparing(Transformer::getTransformerId)) - .collect(Collectors.toList()); - } } diff --git a/alfresco-transform-core-aio/alfresco-transform-core-aio-boot/src/test/java/org/alfresco/transformer/AIOCustomConfigTest.java b/alfresco-transform-core-aio/alfresco-transform-core-aio-boot/src/test/java/org/alfresco/transformer/AIOCustomConfigTest.java deleted file mode 100644 index 849d88db..00000000 --- a/alfresco-transform-core-aio/alfresco-transform-core-aio-boot/src/test/java/org/alfresco/transformer/AIOCustomConfigTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * #%L - * Alfresco Transform Core - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.transformer; - -import org.junit.jupiter.api.Test; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; -import org.springframework.context.annotation.Import; - -import java.util.StringJoiner; - -import static org.junit.jupiter.api.Assertions.*; - -@WebMvcTest(AIOController.class) -@Import(AIOCustomConfig.class) -class AIOCustomConfigTest -{ - @Autowired - AIOCustomConfig aioCustomConfig; - - @Test - void testGetTEnginesSortedByName() - { - // T-Engine config must be read in a predictable order (alphabetically on T-Engine name) as they may override each other. - StringJoiner sortedTEngines = new StringJoiner(","); - aioCustomConfig.getTEnginesSortedByName().stream().forEach(tEngine -> sortedTEngines.add(tEngine.getTransformerId())); - assertEquals("imagemagick,libreoffice,misc,pdfrenderer,tika", sortedTEngines.toString()); - } -} \ No newline at end of file