mirror of
https://github.com/Alfresco/alfresco-transform-core.git
synced 2025-05-12 17:04:48 +00:00
ACS-2497 Rework httpTransformRequestUsingDirectAccessUrlTest so it can be used in AI and Aspose (#535)
This commit is contained in:
parent
5587d183f3
commit
f05b54dea3
@ -153,6 +153,8 @@ public class TikaControllerTest extends AbstractTransformerControllerTest
|
||||
{
|
||||
sourceExtension = "pdf";
|
||||
targetExtension = "txt";
|
||||
sourceMimetype = MIMETYPE_PDF;
|
||||
targetMimetype = MIMETYPE_TEXT_PLAIN;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -649,9 +651,6 @@ public class TikaControllerTest extends AbstractTransformerControllerTest
|
||||
@Override
|
||||
public void httpTransformRequestUsingDirectAccessUrlTest() throws Exception
|
||||
{
|
||||
this.sourceExtension = PDF;
|
||||
this.targetExtension = TXT;
|
||||
this.sourceMimetype = MIMETYPE_PDF;
|
||||
expectedTargetFileBytes = readTestFile(targetExtension);
|
||||
super.httpTransformRequestUsingDirectAccessUrlTest();
|
||||
}
|
||||
|
@ -36,6 +36,7 @@
|
||||
<div>
|
||||
<br/>
|
||||
<a href="/">Test Transformation</a>
|
||||
<a href="/transform/config?configVersion=9999">Transformer Config</a>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
@ -27,6 +27,7 @@
|
||||
package org.alfresco.transformer;
|
||||
|
||||
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
|
||||
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_TEXT_PLAIN;
|
||||
import static org.alfresco.transform.client.util.RequestParamMap.DIRECT_ACCESS_URL;
|
||||
import static org.alfresco.transform.client.util.RequestParamMap.ENDPOINT_TRANSFORM;
|
||||
import static org.alfresco.transform.client.util.RequestParamMap.ENDPOINT_TRANSFORM_CONFIG_LATEST;
|
||||
@ -86,6 +87,7 @@ import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.mock.web.MockMultipartFile;
|
||||
import org.springframework.test.util.ReflectionTestUtils;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
import org.springframework.test.web.servlet.ResultActions;
|
||||
import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder;
|
||||
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
|
||||
|
||||
@ -655,9 +657,15 @@ public abstract class AbstractTransformerControllerTest
|
||||
File dauSourceFile = getTestFile("quick." + sourceExtension, true);
|
||||
String directUrl = "file://" + dauSourceFile.toPath();
|
||||
|
||||
mockMvc.perform(
|
||||
mockMvcRequest("/transform", null, "targetExtension", targetExtension, DIRECT_ACCESS_URL, directUrl))
|
||||
.andExpect(status().is(OK.value()))
|
||||
.andExpect(content().bytes(expectedTargetFileBytes));
|
||||
ResultActions resultActions = mockMvc.perform(
|
||||
mockMvcRequest(ENDPOINT_TRANSFORM, null)
|
||||
.param("targetExtension", targetExtension)
|
||||
.param(DIRECT_ACCESS_URL, directUrl))
|
||||
.andExpect(status().is(OK.value()));
|
||||
|
||||
if (expectedTargetFileBytes != null)
|
||||
{
|
||||
resultActions.andExpect(content().bytes(expectedTargetFileBytes));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user