From bcb6626965f4b624b330215862a13470951b948a Mon Sep 17 00:00:00 2001 From: David Edwards Date: Thu, 23 Apr 2020 11:23:31 +0100 Subject: [PATCH] Revert "ATS-702 Add AIO tests from Misc Transformers (#230)" This reverts commit b69a17a2a3d7c76ef3344c2fee0bf6c624fae9fb. --- .../alfresco-transform-core-aio-boot/pom.xml | 12 +-- .../AIOControllerImageMagickTest.java | 9 --- .../transformer/AIOControllerMiscTest.java | 81 ------------------- .../transformer/AIOMiscTransformsIT.java | 40 --------- .../AIOQueueTransformServiceIT.java | 63 --------------- .../alfresco-transform-misc-boot/pom.xml | 12 --- .../transformer/MiscControllerTest.java | 15 ++-- .../test/resources/{quick2.txt => quick.txt} | 0 .../alfresco-transform-tika/pom.xml | 4 + 9 files changed, 14 insertions(+), 222 deletions(-) delete mode 100644 alfresco-transform-core-aio/alfresco-transform-core-aio-boot/src/test/java/org/alfresco/transformer/AIOControllerMiscTest.java delete mode 100644 alfresco-transform-core-aio/alfresco-transform-core-aio-boot/src/test/java/org/alfresco/transformer/AIOMiscTransformsIT.java delete mode 100644 alfresco-transform-core-aio/alfresco-transform-core-aio-boot/src/test/java/org/alfresco/transformer/AIOQueueTransformServiceIT.java rename alfresco-transform-misc/alfresco-transform-misc-boot/src/test/resources/{quick2.txt => quick.txt} (100%) diff --git a/alfresco-transform-core-aio/alfresco-transform-core-aio-boot/pom.xml b/alfresco-transform-core-aio/alfresco-transform-core-aio-boot/pom.xml index 9c65d341..65a40435 100644 --- a/alfresco-transform-core-aio/alfresco-transform-core-aio-boot/pom.xml +++ b/alfresco-transform-core-aio/alfresco-transform-core-aio-boot/pom.xml @@ -38,14 +38,6 @@ test-jar test - - org.alfresco - alfresco-transform-tika-boot - ${project.version} - tests - test-jar - test - org.alfresco alfresco-transform-imagemagick-boot @@ -64,11 +56,11 @@ org.alfresco - alfresco-transform-misc-boot - ${project.version} + alfresco-transform-tika-boot tests test-jar test + ${project.version} org.alfresco diff --git a/alfresco-transform-core-aio/alfresco-transform-core-aio-boot/src/test/java/org/alfresco/transformer/AIOControllerImageMagickTest.java b/alfresco-transform-core-aio/alfresco-transform-core-aio-boot/src/test/java/org/alfresco/transformer/AIOControllerImageMagickTest.java index a532951d..a83347fb 100644 --- a/alfresco-transform-core-aio/alfresco-transform-core-aio-boot/src/test/java/org/alfresco/transformer/AIOControllerImageMagickTest.java +++ b/alfresco-transform-core-aio/alfresco-transform-core-aio-boot/src/test/java/org/alfresco/transformer/AIOControllerImageMagickTest.java @@ -26,8 +26,6 @@ */ package org.alfresco.transformer; -import static org.junit.Assert.assertTrue; - import java.io.IOException; import java.util.Map; @@ -98,13 +96,6 @@ public class AIOControllerImageMagickTest extends ImageMagickControllerTest return builder; } - @Test - public void testTestValidity() - { - // just test that we are actually testing against the AIOController (instead of MiscController) - assertTrue("Wrong controller wired for test", controller instanceof AIOController); - } - @Test @Override public void noTargetFileTest() diff --git a/alfresco-transform-core-aio/alfresco-transform-core-aio-boot/src/test/java/org/alfresco/transformer/AIOControllerMiscTest.java b/alfresco-transform-core-aio/alfresco-transform-core-aio-boot/src/test/java/org/alfresco/transformer/AIOControllerMiscTest.java deleted file mode 100644 index 714f1c60..00000000 --- a/alfresco-transform-core-aio/alfresco-transform-core-aio-boot/src/test/java/org/alfresco/transformer/AIOControllerMiscTest.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * #%L - * Alfresco Transform Core - * %% - * Copyright (C) 2005 - 2020 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.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; -import org.springframework.context.annotation.Import; -import org.springframework.test.context.junit4.SpringRunner; - -import static junit.framework.TestCase.assertTrue; - -@RunWith(SpringRunner.class) -@WebMvcTest(AIOController.class) -@Import(AIOCustomConfig.class) -public class AIOControllerMiscTest extends MiscControllerTest -{ - //Tests contained in MiscControllerTest - - - @Test - public void testTestValidity() - { - // just test that we are actually testing against the AIOController (instead of MiscController) - assertTrue("Wrong controller wired for test", controller instanceof AIOController); - } - - @Test - @Override - public void testGetTransformConfigInfo() - { - // Ignore the test in super class as the way the AIO transformer provides config is fundementally different. - - } - - @Test - @Override - public void testGetInfoFromConfigWithDuplicates() - { - // Ignore the test in super class as the way the AIO transformer provides config is fundementally different. - - } - @Test - @Override - public void testGetInfoFromConfigWithEmptyTransformOptions() - { - // Ignore the test in super class as the way the AIO transformer provides config is fundementally different. - - } - @Test - @Override - public void testGetInfoFromConfigWithNoTransformOptions() - { - // Ignore the test in super class as the way the AIO transformer provides config is fundementally different. - - } -} \ No newline at end of file diff --git a/alfresco-transform-core-aio/alfresco-transform-core-aio-boot/src/test/java/org/alfresco/transformer/AIOMiscTransformsIT.java b/alfresco-transform-core-aio/alfresco-transform-core-aio-boot/src/test/java/org/alfresco/transformer/AIOMiscTransformsIT.java deleted file mode 100644 index 4f415a6d..00000000 --- a/alfresco-transform-core-aio/alfresco-transform-core-aio-boot/src/test/java/org/alfresco/transformer/AIOMiscTransformsIT.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * #%L - * Alfresco Transform Core - * %% - * Copyright (C) 2005 - 2020 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.transformer; - -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; - -@RunWith(Parameterized.class) -public class AIOMiscTransformsIT extends MiscTransformsIT -{ - //Tests are in ImageMagickTransformationIT - public AIOMiscTransformsIT(final SourceTarget sourceTarget) - { - super(sourceTarget); - } -} diff --git a/alfresco-transform-core-aio/alfresco-transform-core-aio-boot/src/test/java/org/alfresco/transformer/AIOQueueTransformServiceIT.java b/alfresco-transform-core-aio/alfresco-transform-core-aio-boot/src/test/java/org/alfresco/transformer/AIOQueueTransformServiceIT.java deleted file mode 100644 index 0736dbb9..00000000 --- a/alfresco-transform-core-aio/alfresco-transform-core-aio-boot/src/test/java/org/alfresco/transformer/AIOQueueTransformServiceIT.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * #%L - * Alfresco Transform Core - * %% - * Copyright (C) 2005 - 2020 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 static org.alfresco.transform.client.model.Mimetype.MIMETYPE_HTML; -import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_TEXT_PLAIN; - -import java.util.UUID; - -import org.alfresco.transform.client.model.TransformRequest; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -/** - * @author David Edwards - * created on 21/04/2020 - */ -@RunWith(SpringRunner.class) -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, - properties = {"activemq.url=nio://localhost:61616"}) -public class AIOQueueTransformServiceIT extends AbstractQueueTransformServiceIT -{ - @Override - protected TransformRequest buildRequest() - { - return TransformRequest - .builder() - .withRequestId(UUID.randomUUID().toString()) - .withSourceMediaType(MIMETYPE_HTML) - .withTargetMediaType(MIMETYPE_TEXT_PLAIN) - .withTargetExtension("txt") - .withSchema(1) - .withClientData("ACS") - .withSourceReference(UUID.randomUUID().toString()) - .withSourceSize(32L) - .build(); - } -} \ No newline at end of file diff --git a/alfresco-transform-misc/alfresco-transform-misc-boot/pom.xml b/alfresco-transform-misc/alfresco-transform-misc-boot/pom.xml index 28898441..24d745b7 100644 --- a/alfresco-transform-misc/alfresco-transform-misc-boot/pom.xml +++ b/alfresco-transform-misc/alfresco-transform-misc-boot/pom.xml @@ -86,18 +86,6 @@ org.apache.maven.plugins maven-failsafe-plugin - - org.apache.maven.plugins - maven-jar-plugin - 3.2.0 - - - - test-jar - - - - diff --git a/alfresco-transform-misc/alfresco-transform-misc-boot/src/test/java/org/alfresco/transformer/MiscControllerTest.java b/alfresco-transform-misc/alfresco-transform-misc-boot/src/test/java/org/alfresco/transformer/MiscControllerTest.java index 08d7ad90..23ca6988 100644 --- a/alfresco-transform-misc/alfresco-transform-misc-boot/src/test/java/org/alfresco/transformer/MiscControllerTest.java +++ b/alfresco-transform-misc/alfresco-transform-misc-boot/src/test/java/org/alfresco/transformer/MiscControllerTest.java @@ -44,9 +44,9 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. import java.io.StringWriter; import java.io.UnsupportedEncodingException; -import java.nio.file.Files; import org.alfresco.transform.client.model.TransformRequest; +import org.alfresco.transformer.transformers.SelectingTransformer; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.text.PDFTextStripper; import org.junit.Before; @@ -54,6 +54,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.context.annotation.Import; import org.springframework.mock.web.MockMultipartFile; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MvcResult; @@ -64,13 +65,13 @@ import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilde public class MiscControllerTest extends AbstractTransformerControllerTest { @Autowired - protected AbstractTransformerController controller; + private MiscController controller; - protected final String sourceEncoding = "UTF-8"; - protected final String targetEncoding = "UTF-8"; - protected final String targetMimetype = MIMETYPE_TEXT_PLAIN; + private final String sourceEncoding = "UTF-8"; + private final String targetEncoding = "UTF-8"; + private final String targetMimetype = MIMETYPE_TEXT_PLAIN; - protected static final String ENGINE_CONFIG_NAME = "misc_engine_config.json"; + private static final String ENGINE_CONFIG_NAME = "misc_engine_config.json"; @Before public void before() throws Exception @@ -81,7 +82,7 @@ public class MiscControllerTest extends AbstractTransformerControllerTest expectedOptions = null; expectedSourceSuffix = null; expectedSourceFileBytes = readTestFile(sourceExtension); - expectedTargetFileBytes = Files.readAllBytes(getTestFile("quick2." + targetExtension, true).toPath()); + expectedTargetFileBytes = readTestFile(targetExtension); //expectedTargetFileBytes = null; sourceFile = new MockMultipartFile("file", "quick." + sourceExtension, sourceMimetype, expectedSourceFileBytes); diff --git a/alfresco-transform-misc/alfresco-transform-misc-boot/src/test/resources/quick2.txt b/alfresco-transform-misc/alfresco-transform-misc-boot/src/test/resources/quick.txt similarity index 100% rename from alfresco-transform-misc/alfresco-transform-misc-boot/src/test/resources/quick2.txt rename to alfresco-transform-misc/alfresco-transform-misc-boot/src/test/resources/quick.txt diff --git a/alfresco-transform-tika/alfresco-transform-tika/pom.xml b/alfresco-transform-tika/alfresco-transform-tika/pom.xml index eee57232..a80a58f5 100644 --- a/alfresco-transform-tika/alfresco-transform-tika/pom.xml +++ b/alfresco-transform-tika/alfresco-transform-tika/pom.xml @@ -47,6 +47,10 @@ org.quartz-scheduler quartz + + xml-apis + xml-apis +