REPO-3424 More unit tests and pick up latest alfresco-core (7.2)

This commit is contained in:
Alan Davis
2018-04-16 23:22:18 +01:00
parent f7f6525950
commit 73af441ab3
4 changed files with 90 additions and 3 deletions

View File

@@ -26,13 +26,17 @@
package org.alfresco.transformer;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.mock.mockito.SpyBean;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import java.io.IOException;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
/**
* Test the AlfrescoPdfRendererControllerTest without a server.
* Super class includes tests for the AbstractTransformerController.
@@ -49,4 +53,44 @@ public class AlfrescoPdfRendererControllerTest extends AbstractTransformerContro
{
super.mockTransformCommand(controller, "pdf", "png", "application/pdf");
}
@Test
public void optionsTest() throws Exception
{
expectedOptions = "--width=321 --height=654 --allow-enlargement --maintain-aspect-ratio --page=2";
mockMvc.perform(MockMvcRequestBuilders.fileUpload("/transform")
.file(sourceFile)
.param("targetExtension", targetExtension)
.param("page", "2")
.param("width", "321")
.param("height", "654")
.param("allowEnlargement", "true")
.param("maintainAspectRatio", "true"))
.andExpect(status().is(200))
.andExpect(content().bytes(expectedTargetFileBytes))
.andExpect(header().string("Content-Disposition", "attachment; filename*= UTF-8''quick."+targetExtension));
}
@Test
public void optionsNegateBooleansTest() throws Exception
{
expectedOptions = "--width=321 --height=654 --page=2";
mockMvc.perform(MockMvcRequestBuilders.fileUpload("/transform")
.file(sourceFile)
.param("targetExtension", targetExtension)
.param("page", "2")
.param("width", "321")
.param("height", "654")
.param("allowEnlargement", "false")
.param("maintainAspectRatio", "false"))
.andExpect(status().is(200))
.andExpect(content().bytes(expectedTargetFileBytes))
.andExpect(header().string("Content-Disposition", "attachment; filename*= UTF-8''quick."+targetExtension));
}
}