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

This commit is contained in:
David Edwards
2020-04-23 12:35:27 +01:00
committed by GitHub
parent bcb6626965
commit 0eda874c82
11 changed files with 224 additions and 16 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();
}
}