ATS-702 Add AIO tests from Misc Transformers (#230)

Add Misc transforms AIO tests
Add Misc IT through AIO
Remove accidental commit.

Co-authored-by: Erik Knizat <erik.knizat@alfresco.com>
Co-authored-by: kristian <kristian.dimitrov@alfresco.com>
Co-authored-by: eknizat <26163420+eknizat@users.noreply.github.com>
This commit is contained in:
David Edwards 2020-04-23 11:05:40 +01:00 committed by GitHub
parent 410997689f
commit b69a17a2a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 222 additions and 14 deletions

View File

@ -38,6 +38,14 @@
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-transform-tika-boot</artifactId>
<version>${project.version}</version>
<classifier>tests</classifier>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-transform-imagemagick-boot</artifactId>
@ -56,11 +64,11 @@
</dependency>
<dependency>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-transform-tika-boot</artifactId>
<artifactId>alfresco-transform-misc-boot</artifactId>
<version>${project.version}</version>
<classifier>tests</classifier>
<type>test-jar</type>
<scope>test</scope>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.alfresco</groupId>

View File

@ -26,6 +26,8 @@
*/
package org.alfresco.transformer;
import static org.junit.Assert.assertTrue;
import java.io.IOException;
import java.util.Map;
@ -96,6 +98,13 @@ 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()

View File

@ -0,0 +1,81 @@
/*
* #%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 <http://www.gnu.org/licenses/>.
* #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.
}
}

View File

@ -0,0 +1,40 @@
/*
* #%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 <http://www.gnu.org/licenses/>.
* #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);
}
}

View File

@ -0,0 +1,63 @@
/*
* #%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 <http://www.gnu.org/licenses/>.
* #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();
}
}

View File

@ -86,6 +86,18 @@
<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>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

View File

@ -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,7 +54,6 @@ 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;
@ -65,13 +64,13 @@ import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilde
public class MiscControllerTest extends AbstractTransformerControllerTest
{
@Autowired
private MiscController controller;
protected AbstractTransformerController controller;
private final String sourceEncoding = "UTF-8";
private final String targetEncoding = "UTF-8";
private final String targetMimetype = MIMETYPE_TEXT_PLAIN;
protected final String sourceEncoding = "UTF-8";
protected final String targetEncoding = "UTF-8";
protected final String targetMimetype = MIMETYPE_TEXT_PLAIN;
private static final String ENGINE_CONFIG_NAME = "misc_engine_config.json";
protected static final String ENGINE_CONFIG_NAME = "misc_engine_config.json";
@Before
public void before() throws Exception
@ -82,7 +81,7 @@ public class MiscControllerTest extends AbstractTransformerControllerTest
expectedOptions = null;
expectedSourceSuffix = null;
expectedSourceFileBytes = readTestFile(sourceExtension);
expectedTargetFileBytes = readTestFile(targetExtension);
expectedTargetFileBytes = Files.readAllBytes(getTestFile("quick2." + targetExtension, true).toPath());
//expectedTargetFileBytes = null;
sourceFile = new MockMultipartFile("file", "quick." + sourceExtension, sourceMimetype,
expectedSourceFileBytes);

View File

@ -47,10 +47,6 @@
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
</exclusion>
<exclusion>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
</exclusion>
</exclusions>
</dependency>