diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/DefaultOutboundChannelAdapterParserTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/DefaultOutboundChannelAdapterParserTests.java index f87e4a24ee..592500bee5 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/DefaultOutboundChannelAdapterParserTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/DefaultOutboundChannelAdapterParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 the original author or authors. + * Copyright 2002-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -82,7 +82,7 @@ public class DefaultOutboundChannelAdapterParserTests { assertEquals(Boolean.FALSE, TestUtils.getPropertyValue(adapter, "autoStartup")); MessageHandler handler = TestUtils.getPropertyValue(adapter, "handler", MessageHandler.class); assertTrue(AopUtils.isAopProxy(handler)); - assertThat(TestUtils.getPropertyValue(handler, "h.advised.advisors.first.item.advice"), + assertThat(TestUtils.getPropertyValue(handler, "h.advised.advisors[0].advice"), Matchers.instanceOf(RequestHandlerRetryAdvice.class)); handler.handleMessage(new GenericMessage<>("foo")); diff --git a/spring-integration-file/src/test/java/org/springframework/integration/file/dsl/FileTests.java b/spring-integration-file/src/test/java/org/springframework/integration/file/dsl/FileTests.java index de3bbd900e..a86e2e6d11 100644 --- a/spring-integration-file/src/test/java/org/springframework/integration/file/dsl/FileTests.java +++ b/spring-integration-file/src/test/java/org/springframework/integration/file/dsl/FileTests.java @@ -28,8 +28,8 @@ import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import java.io.File; -import java.io.FileInputStream; import java.io.FileOutputStream; +import java.io.FileReader; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.util.ArrayList; @@ -91,7 +91,7 @@ import org.springframework.messaging.support.GenericMessage; import org.springframework.stereotype.Service; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.util.StreamUtils; +import org.springframework.util.FileCopyUtils; /** * @author Artem Bilan @@ -242,7 +242,7 @@ public class FileTests { File resultFile = (File) receive.getPayload(); assertThat(resultFile.getAbsolutePath(), endsWith(TestUtils.applySystemFileSeparator("fileWritingFlow/foo.write"))); - String fileContent = StreamUtils.copyToString(new FileInputStream(resultFile), Charset.defaultCharset()); + String fileContent = FileCopyUtils.copyToString(new FileReader(resultFile)); assertEquals(payload, fileContent); if (FileUtils.IS_POSIX) { assertThat(java.nio.file.Files.getPosixFilePermissions(resultFile.toPath()).size(), equalTo(9)); diff --git a/spring-integration-mqtt/src/test/java/org/springframework/integration/mqtt/config/xml/MqttOutboundChannelAdapterParserTests.java b/spring-integration-mqtt/src/test/java/org/springframework/integration/mqtt/config/xml/MqttOutboundChannelAdapterParserTests.java index 9f44391cb0..d2e3badb25 100644 --- a/spring-integration-mqtt/src/test/java/org/springframework/integration/mqtt/config/xml/MqttOutboundChannelAdapterParserTests.java +++ b/spring-integration-mqtt/src/test/java/org/springframework/integration/mqtt/config/xml/MqttOutboundChannelAdapterParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,6 +46,7 @@ import org.springframework.test.context.junit4.SpringRunner; /** * @author Gary Russell * @author Artem Bilan + * * @since 4.0 */ @RunWith(SpringRunner.class) @@ -93,7 +94,7 @@ public class MqttOutboundChannelAdapterParserTests { assertSame(((Advised) handler).getTargetSource().getTarget(), this.withConverterHandler); - assertThat(TestUtils.getPropertyValue(handler, "h.advised.advisors.first.item.advice"), + assertThat(TestUtils.getPropertyValue(handler, "h.advised.advisors[0].advice"), Matchers.instanceOf(RequestHandlerRetryAdvice.class)); } diff --git a/spring-integration-redis/src/test/java/org/springframework/integration/redis/config/RedisOutboundChannelAdapterParserTests.java b/spring-integration-redis/src/test/java/org/springframework/integration/redis/config/RedisOutboundChannelAdapterParserTests.java index 899db78692..2a3b2be653 100644 --- a/spring-integration-redis/src/test/java/org/springframework/integration/redis/config/RedisOutboundChannelAdapterParserTests.java +++ b/spring-integration-redis/src/test/java/org/springframework/integration/redis/config/RedisOutboundChannelAdapterParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -101,7 +101,7 @@ public class RedisOutboundChannelAdapterParserTests extends RedisAvailableTests assertTrue(AopUtils.isAopProxy(endpointHandler)); - assertThat(TestUtils.getPropertyValue(endpointHandler, "h.advised.advisors.first.item.advice"), + assertThat(TestUtils.getPropertyValue(endpointHandler, "h.advised.advisors[0].advice"), Matchers.instanceOf(RequestHandlerRetryAdvice.class)); } diff --git a/spring-integration-redis/src/test/java/org/springframework/integration/redis/config/RedisQueueOutboundChannelAdapterParserTests.java b/spring-integration-redis/src/test/java/org/springframework/integration/redis/config/RedisQueueOutboundChannelAdapterParserTests.java index 47d7f039c8..e1af5e3f07 100644 --- a/spring-integration-redis/src/test/java/org/springframework/integration/redis/config/RedisQueueOutboundChannelAdapterParserTests.java +++ b/spring-integration-redis/src/test/java/org/springframework/integration/redis/config/RedisQueueOutboundChannelAdapterParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2016 the original author or authors. + * Copyright 2013-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,6 +45,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; * @author Artem Bilan * @author Gary Russell * @author Rainer Frey + * * @since 3.0 */ @ContextConfiguration @@ -88,15 +89,17 @@ public class RedisQueueOutboundChannelAdapterParserTests { assertSame(((Advised) handler).getTargetSource().getTarget(), this.defaultAdapter); - assertThat(TestUtils.getPropertyValue(handler, "h.advised.advisors.first.item.advice"), + assertThat(TestUtils.getPropertyValue(handler, "h.advised.advisors[0].advice"), Matchers.instanceOf(RequestHandlerRetryAdvice.class)); assertTrue(TestUtils.getPropertyValue(this.defaultAdapter, "leftPush", Boolean.class)); } @Test public void testInt3017CustomConfig() { - assertSame(this.customRedisConnectionFactory, TestUtils.getPropertyValue(this.customAdapter, "template.connectionFactory")); - assertEquals("headers['redis_queue']", TestUtils.getPropertyValue(this.customAdapter, "queueNameExpression", Expression.class).getExpressionString()); + assertSame(this.customRedisConnectionFactory, + TestUtils.getPropertyValue(this.customAdapter, "template.connectionFactory")); + assertEquals("headers['redis_queue']", + TestUtils.getPropertyValue(this.customAdapter, "queueNameExpression.expression")); assertFalse(TestUtils.getPropertyValue(this.customAdapter, "extractPayload", Boolean.class)); assertTrue(TestUtils.getPropertyValue(this.customAdapter, "serializerExplicitlySet", Boolean.class)); assertSame(this.serializer, TestUtils.getPropertyValue(this.customAdapter, "serializer")); diff --git a/spring-integration-redis/src/test/java/org/springframework/integration/redis/config/RedisStoreOutboundChannelAdapterParserTests.java b/spring-integration-redis/src/test/java/org/springframework/integration/redis/config/RedisStoreOutboundChannelAdapterParserTests.java index d528bf7b1c..d1b4667156 100644 --- a/spring-integration-redis/src/test/java/org/springframework/integration/redis/config/RedisStoreOutboundChannelAdapterParserTests.java +++ b/spring-integration-redis/src/test/java/org/springframework/integration/redis/config/RedisStoreOutboundChannelAdapterParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2007-2017 the original author or authors. + * Copyright 2007-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -75,7 +75,7 @@ public class RedisStoreOutboundChannelAdapterParserTests { assertSame(((Advised) handler).getTargetSource().getTarget(), withStringTemplate); - assertThat(TestUtils.getPropertyValue(handler, "h.advised.advisors.first.item.advice"), + assertThat(TestUtils.getPropertyValue(handler, "h.advised.advisors[0].advice"), Matchers.instanceOf(RequestHandlerRetryAdvice.class)); assertEquals("true", TestUtils.getPropertyValue(withStringTemplate, "zsetIncrementScoreExpression", diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/session/SftpServerTests.java b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/session/SftpServerTests.java index 2b82622b80..793575c87b 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/session/SftpServerTests.java +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/session/SftpServerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2017 the original author or authors. + * Copyright 2014-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,7 +44,7 @@ import org.springframework.core.io.ByteArrayResource; import org.springframework.core.io.ClassPathResource; import org.springframework.integration.file.remote.session.Session; import org.springframework.util.Base64Utils; -import org.springframework.util.StreamUtils; +import org.springframework.util.FileCopyUtils; import com.jcraft.jsch.ChannelSftp.LsEntry; @@ -53,6 +53,7 @@ import com.jcraft.jsch.ChannelSftp.LsEntry; * @author Gary Russell * @author David Liu * @author Artem Bilan + * * @since 4.1 * */ @@ -115,7 +116,7 @@ public class SftpServerTests { f.setUser("user"); f.setAllowUnknownKeys(true); InputStream stream = new ClassPathResource(privKey).getInputStream(); - f.setPrivateKey(new ByteArrayResource(StreamUtils.copyToByteArray(stream))); + f.setPrivateKey(new ByteArrayResource(FileCopyUtils.copyToByteArray(stream))); f.setPrivateKeyPassphrase(passphrase); Session session = f.getSession(); doTest(server, session); @@ -127,7 +128,7 @@ public class SftpServerTests { private PublicKey decodePublicKey(String key) throws Exception { InputStream stream = new ClassPathResource(key).getInputStream(); - byte[] keyBytes = StreamUtils.copyToByteArray(stream); + byte[] keyBytes = FileCopyUtils.copyToByteArray(stream); // strip any newline chars while (keyBytes[keyBytes.length - 1] == 0x0a || keyBytes[keyBytes.length - 1] == 0x0d) { keyBytes = Arrays.copyOf(keyBytes, keyBytes.length - 1); diff --git a/spring-integration-ws/src/test/java/org/springframework/integration/ws/SimpleWebServiceOutboundGatewayTests.java b/spring-integration-ws/src/test/java/org/springframework/integration/ws/SimpleWebServiceOutboundGatewayTests.java index be96aeea84..64de912933 100644 --- a/spring-integration-ws/src/test/java/org/springframework/integration/ws/SimpleWebServiceOutboundGatewayTests.java +++ b/spring-integration-ws/src/test/java/org/springframework/integration/ws/SimpleWebServiceOutboundGatewayTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,8 +24,8 @@ import static org.junit.Assert.fail; import static org.mockito.Mockito.mock; import java.io.ByteArrayInputStream; +import java.io.InputStreamReader; import java.net.URI; -import java.nio.charset.Charset; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; @@ -48,7 +48,7 @@ import org.springframework.messaging.MessageChannel; import org.springframework.messaging.MessageHandlingException; import org.springframework.messaging.PollableChannel; import org.springframework.messaging.support.GenericMessage; -import org.springframework.util.StreamUtils; +import org.springframework.util.FileCopyUtils; import org.springframework.util.concurrent.SettableListenableFuture; import org.springframework.ws.WebServiceMessage; import org.springframework.ws.WebServiceMessageFactory; @@ -195,7 +195,7 @@ public class SimpleWebServiceOutboundGatewayTests { assertNotNull(myAttachment); assertEquals("text/plain", myAttachment.getContentType()); - assertEquals("my_data", StreamUtils.copyToString(myAttachment.getInputStream(), Charset.forName("UTF-8"))); + assertEquals("my_data", FileCopyUtils.copyToString(new InputStreamReader(myAttachment.getInputStream()))); } @Test