mirror of
https://github.com/Alfresco/alfresco-transform-core.git
synced 2025-05-12 17:04:48 +00:00
ATS-702 Add AIO tests from Tika (#232)
* ATS-702 - Implement Tika controller tests on AIO * ATS-702 - Add Tika IT through AIOController
This commit is contained in:
parent
88116fc4af
commit
cd16637143
@ -46,6 +46,14 @@
|
|||||||
<type>test-jar</type>
|
<type>test-jar</type>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.alfresco</groupId>
|
||||||
|
<artifactId>alfresco-transform-tika-boot</artifactId>
|
||||||
|
<classifier>tests</classifier>
|
||||||
|
<type>test-jar</type>
|
||||||
|
<scope>test</scope>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
@ -112,7 +112,7 @@ public class AIOControllerImageMagickTest extends ImageMagickControllerTest
|
|||||||
@Override
|
@Override
|
||||||
public void testGetTransformConfigInfo()
|
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
|
@Override
|
||||||
public void testGetInfoFromConfigWithDuplicates()
|
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
|
@Override
|
||||||
public void testGetInfoFromConfigWithEmptyTransformOptions()
|
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
|
@Override
|
||||||
public void testGetInfoFromConfigWithNoTransformOptions()
|
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.
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||||
|
* #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.
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||||
|
* #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<String, String, String> entry)
|
||||||
|
{
|
||||||
|
super(entry);
|
||||||
|
}
|
||||||
|
}
|
@ -155,6 +155,18 @@
|
|||||||
<groupId>org.codehaus.mojo</groupId>
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
<artifactId>license-maven-plugin</artifactId>
|
<artifactId>license-maven-plugin</artifactId>
|
||||||
</plugin>
|
</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>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* #%L
|
* #%L
|
||||||
* Alfresco Transform Core
|
* 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.
|
* 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.TransformReply;
|
||||||
import org.alfresco.transform.client.model.TransformRequest;
|
import org.alfresco.transform.client.model.TransformRequest;
|
||||||
import org.alfresco.transformer.executors.RuntimeExec;
|
import org.alfresco.transformer.executors.RuntimeExec;
|
||||||
import org.alfresco.transformer.executors.TikaJavaExecutor;
|
|
||||||
import org.alfresco.transformer.model.FileRefEntity;
|
import org.alfresco.transformer.model.FileRefEntity;
|
||||||
import org.alfresco.transformer.model.FileRefResponse;
|
import org.alfresco.transformer.model.FileRefResponse;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
@ -96,8 +95,8 @@ import org.junit.Test;
|
|||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
import org.mockito.stubbing.Answer;
|
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.autoconfigure.web.servlet.WebMvcTest;
|
||||||
import org.springframework.boot.test.mock.mockito.SpyBean;
|
|
||||||
import org.springframework.core.io.FileSystemResource;
|
import org.springframework.core.io.FileSystemResource;
|
||||||
import org.springframework.core.io.Resource;
|
import org.springframework.core.io.Resource;
|
||||||
import org.springframework.http.HttpHeaders;
|
import org.springframework.http.HttpHeaders;
|
||||||
@ -134,8 +133,8 @@ public class TikaControllerTest extends AbstractTransformerControllerTest
|
|||||||
@Mock
|
@Mock
|
||||||
private RuntimeExec mockCheckCommand;
|
private RuntimeExec mockCheckCommand;
|
||||||
|
|
||||||
@SpyBean
|
@Autowired
|
||||||
private TikaController controller;
|
protected AbstractTransformerController controller;
|
||||||
|
|
||||||
private String targetEncoding = "UTF-8";
|
private String targetEncoding = "UTF-8";
|
||||||
private String targetMimetype = MIMETYPE_TEXT_PLAIN;
|
private String targetMimetype = MIMETYPE_TEXT_PLAIN;
|
||||||
|
@ -146,9 +146,8 @@ public class TikaTransformationIT
|
|||||||
@Test
|
@Test
|
||||||
public void testTransformation()
|
public void testTransformation()
|
||||||
{
|
{
|
||||||
final String descriptor = format("Transform ({0} -> {1}, {2}, sourceMimetype={3})",
|
final String descriptor = format("Transform ({0}, {1} -> {2}, {3})",
|
||||||
sourceFile, targetMimetype, targetExtension, sourceMimetype);
|
sourceFile, sourceMimetype, targetMimetype, targetExtension);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
final ResponseEntity<Resource> response = sendTRequest(ENGINE_URL, sourceFile, null,
|
final ResponseEntity<Resource> response = sendTRequest(ENGINE_URL, sourceFile, null,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user