INTEXT-54 - AWS Fix Failing Tests
For reference: https://jira.springsource.org/browse/INTEXT-54
This commit is contained in:
@@ -33,9 +33,10 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.TemporaryFolder;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.invocation.InvocationOnMock;
|
||||
import org.mockito.stubbing.Answer;
|
||||
@@ -62,6 +63,9 @@ public class AmazonS3MessageHandlerTests {
|
||||
private static AmazonS3Operations operations;
|
||||
private static PutObjectParameterHolder holder = new PutObjectParameterHolder();
|
||||
|
||||
@Rule
|
||||
public TemporaryFolder tempFolder = new TemporaryFolder();
|
||||
|
||||
@BeforeClass
|
||||
public static void setup() {
|
||||
operations = Mockito.mock(AmazonS3Operations.class);
|
||||
@@ -170,7 +174,7 @@ public class AmazonS3MessageHandlerTests {
|
||||
*/
|
||||
@Test
|
||||
public void withTempFileTypePayload() throws Exception {
|
||||
File file = new File(System.getProperty("java.io.tmpdir") + "TempFile.txt.writing");
|
||||
final File file = tempFolder.newFile("TempFile.txt.writing");
|
||||
messageWithFileTypePayload(file);
|
||||
}
|
||||
|
||||
@@ -179,7 +183,7 @@ public class AmazonS3MessageHandlerTests {
|
||||
*/
|
||||
@Test
|
||||
public void withFileTypePayload() throws Exception {
|
||||
File file = new File(System.getProperty("java.io.tmpdir") + "TempFile.txt");
|
||||
final File file = tempFolder.newFile("TempFile.txt");
|
||||
messageWithFileTypePayload(file);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,11 +17,14 @@
|
||||
package org.springframework.integration.aws.s3;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Rule;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.TemporaryFolder;
|
||||
import org.springframework.integration.Message;
|
||||
import org.springframework.integration.support.MessageBuilder;
|
||||
|
||||
@@ -36,6 +39,9 @@ import org.springframework.integration.support.MessageBuilder;
|
||||
*/
|
||||
public class DefaultFileNameGenerationStrategyTests {
|
||||
|
||||
@Rule
|
||||
public TemporaryFolder tempFolder = new TemporaryFolder();
|
||||
|
||||
/**
|
||||
* Tests with the file name present in the predetermined header "file_name" of the message
|
||||
*/
|
||||
@@ -48,13 +54,13 @@ public class DefaultFileNameGenerationStrategyTests {
|
||||
Assert.assertEquals("FileName.txt", strategy.generateFileName(message));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tests with a payload as a temp file payload
|
||||
* @throws IOException
|
||||
*/
|
||||
@Test
|
||||
public void withATempFile() {
|
||||
File file = new File(System.getProperty("java.io.tmpdir") + "TempFile.txt.writing");
|
||||
public void withATempFile() throws IOException {
|
||||
final File file = tempFolder.newFile("TempFile.txt.writing");
|
||||
Message<File> message = MessageBuilder.withPayload(file)
|
||||
.build();
|
||||
DefaultFileNameGenerationStrategy strategy = new DefaultFileNameGenerationStrategy();
|
||||
@@ -64,10 +70,11 @@ public class DefaultFileNameGenerationStrategyTests {
|
||||
|
||||
/**
|
||||
* Tests with a payload as a temp file payload
|
||||
* @throws IOException
|
||||
*/
|
||||
@Test
|
||||
public void withANonTempFile() {
|
||||
File file = new File(System.getProperty("java.io.tmpdir") + "TempFile.txt");
|
||||
public void withANonTempFile() throws IOException {
|
||||
final File file = tempFolder.newFile("TempFile.txt");
|
||||
Message<File> message = MessageBuilder.withPayload(file)
|
||||
.build();
|
||||
DefaultFileNameGenerationStrategy strategy = new DefaultFileNameGenerationStrategy();
|
||||
|
||||
Reference in New Issue
Block a user