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 19b1e5c3..056b2e56 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 @@ -46,6 +46,14 @@ test-jar test + + org.alfresco + alfresco-transform-tika-boot + tests + test-jar + test + ${project.version} + org.springframework.boot 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 9ea38aa1..4e5c75f2 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 @@ -112,7 +112,7 @@ public class AIOControllerImageMagickTest extends ImageMagickControllerTest @Override public void testGetTransformConfigInfo() { - // Ignore the test in super class as the way the AIO transformer provides config is fundementally different. + // Ignore the test in super class as the way the AIO transformer provides config is fundamentally different. } @@ -120,7 +120,7 @@ public class AIOControllerImageMagickTest extends ImageMagickControllerTest @Override public void testGetInfoFromConfigWithDuplicates() { - // Ignore the test in super class as the way the AIO transformer provides config is fundementally different. + // Ignore the test in super class as the way the AIO transformer provides config is fundamentally different. } @@ -128,7 +128,7 @@ public class AIOControllerImageMagickTest extends ImageMagickControllerTest @Override public void testGetInfoFromConfigWithEmptyTransformOptions() { - // Ignore the test in super class as the way the AIO transformer provides config is fundementally different. + // Ignore the test in super class as the way the AIO transformer provides config is fundamentally different. } @@ -136,7 +136,7 @@ public class AIOControllerImageMagickTest extends ImageMagickControllerTest @Override public void testGetInfoFromConfigWithNoTransformOptions() { - // Ignore the test in super class as the way the AIO transformer provides config is fundementally different. + // Ignore the test in super class as the way the AIO transformer provides config is fundamentally different. } diff --git a/alfresco-transform-core-aio/alfresco-transform-core-aio-boot/src/test/java/org/alfresco/transformer/AIOControllerTikaTest.java b/alfresco-transform-core-aio/alfresco-transform-core-aio-boot/src/test/java/org/alfresco/transformer/AIOControllerTikaTest.java new file mode 100644 index 00000000..85600986 --- /dev/null +++ b/alfresco-transform-core-aio/alfresco-transform-core-aio-boot/src/test/java/org/alfresco/transformer/AIOControllerTikaTest.java @@ -0,0 +1,86 @@ +/* + * #%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.junit.Assert.assertTrue; + +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; + +@RunWith(SpringRunner.class) +@WebMvcTest(AIOController.class) +@Import(AIOCustomConfig.class) +/** + * Test the AIOController Tika transforms without a server. + * Super class includes tests for the AbstractTransformerController. + */ +public class AIOControllerTikaTest extends TikaControllerTest +{ + // All tests contained in TikaControllerTest + + @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 fundamentally different. + + + } + @Test + @Override + public void testGetInfoFromConfigWithDuplicates() + { + // Ignore the test in super class as the way the AIO transformer provides config is fundamentally different. + + } + + @Test + @Override + public void testGetInfoFromConfigWithEmptyTransformOptions() + { + // Ignore the test in super class as the way the AIO transformer provides config is fundamentally different. + + } + + @Test + @Override + public void testGetInfoFromConfigWithNoTransformOptions() + { + // Ignore the test in super class as the way the AIO transformer provides config is fundamentally 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/AIOTikaTransformationIT.java b/alfresco-transform-core-aio/alfresco-transform-core-aio-boot/src/test/java/org/alfresco/transformer/AIOTikaTransformationIT.java new file mode 100644 index 00000000..efddfa72 --- /dev/null +++ b/alfresco-transform-core-aio/alfresco-transform-core-aio-boot/src/test/java/org/alfresco/transformer/AIOTikaTransformationIT.java @@ -0,0 +1,42 @@ +/* + * #%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.apache.commons.lang3.tuple.Triple; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; + +@RunWith(Parameterized.class) +public class AIOTikaTransformationIT extends TikaTransformationIT +{ + + //Tests are in ImageMagickTransformationIT + public AIOTikaTransformationIT(final Triple entry) + { + super(entry); + } +} \ No newline at end of file diff --git a/alfresco-transform-tika/alfresco-transform-tika-boot/pom.xml b/alfresco-transform-tika/alfresco-transform-tika-boot/pom.xml index 3c803d5b..80177b19 100644 --- a/alfresco-transform-tika/alfresco-transform-tika-boot/pom.xml +++ b/alfresco-transform-tika/alfresco-transform-tika-boot/pom.xml @@ -155,6 +155,18 @@ org.codehaus.mojo license-maven-plugin + + org.apache.maven.plugins + maven-jar-plugin + 3.2.0 + + + + test-jar + + + + diff --git a/alfresco-transform-tika/alfresco-transform-tika-boot/src/test/java/org/alfresco/transformer/TikaControllerTest.java b/alfresco-transform-tika/alfresco-transform-tika-boot/src/test/java/org/alfresco/transformer/TikaControllerTest.java index 9126cb2d..549f9ef0 100644 --- a/alfresco-transform-tika/alfresco-transform-tika-boot/src/test/java/org/alfresco/transformer/TikaControllerTest.java +++ b/alfresco-transform-tika/alfresco-transform-tika-boot/src/test/java/org/alfresco/transformer/TikaControllerTest.java @@ -2,7 +2,7 @@ * #%L * Alfresco Transform Core * %% - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 Alfresco Software Limited * %% * This file is part of the Alfresco software. * - @@ -88,7 +88,6 @@ import java.util.UUID; import org.alfresco.transform.client.model.TransformReply; import org.alfresco.transform.client.model.TransformRequest; import org.alfresco.transformer.executors.RuntimeExec; -import org.alfresco.transformer.executors.TikaJavaExecutor; import org.alfresco.transformer.model.FileRefEntity; import org.alfresco.transformer.model.FileRefResponse; import org.junit.Before; @@ -96,8 +95,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.stubbing.Answer; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; -import org.springframework.boot.test.mock.mockito.SpyBean; import org.springframework.core.io.FileSystemResource; import org.springframework.core.io.Resource; import org.springframework.http.HttpHeaders; @@ -134,8 +133,8 @@ public class TikaControllerTest extends AbstractTransformerControllerTest @Mock private RuntimeExec mockCheckCommand; - @SpyBean - private TikaController controller; + @Autowired + protected AbstractTransformerController controller; private String targetEncoding = "UTF-8"; private String targetMimetype = MIMETYPE_TEXT_PLAIN; diff --git a/alfresco-transform-tika/alfresco-transform-tika-boot/src/test/java/org/alfresco/transformer/TikaTransformationIT.java b/alfresco-transform-tika/alfresco-transform-tika-boot/src/test/java/org/alfresco/transformer/TikaTransformationIT.java index 43df464d..4b8c59f6 100644 --- a/alfresco-transform-tika/alfresco-transform-tika-boot/src/test/java/org/alfresco/transformer/TikaTransformationIT.java +++ b/alfresco-transform-tika/alfresco-transform-tika-boot/src/test/java/org/alfresco/transformer/TikaTransformationIT.java @@ -146,9 +146,8 @@ public class TikaTransformationIT @Test public void testTransformation() { - final String descriptor = format("Transform ({0} -> {1}, {2}, sourceMimetype={3})", - sourceFile, targetMimetype, targetExtension, sourceMimetype); - + final String descriptor = format("Transform ({0}, {1} -> {2}, {3})", + sourceFile, sourceMimetype, targetMimetype, targetExtension); try { final ResponseEntity response = sendTRequest(ENGINE_URL, sourceFile, null,