Upgrade to SIK-3.0

* Fix Kafka Java DSL sample from bean name conflict
* Fix usage of deprecated `org.springframework.integration.test.util.SocketUtils`
This commit is contained in:
Artem Bilan
2017-11-30 20:37:49 -05:00
parent 38202d8b1f
commit bbcb4bcfae
7 changed files with 24 additions and 15 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2017 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.
@@ -23,7 +23,7 @@ import org.springframework.context.support.GenericXmlApplicationContext;
import org.springframework.core.env.MapPropertySource;
import org.springframework.integration.ip.tcp.connection.AbstractServerConnectionFactory;
import org.springframework.integration.ip.util.TestingUtilities;
import org.springframework.integration.test.util.SocketUtils;
import org.springframework.util.SocketUtils;
/**
* Demonstrates the use of a gateway as an entry point into the integration flow.
@@ -44,6 +44,7 @@ import org.springframework.integration.test.util.SocketUtils;
* </ul>
*
* @author Gunnar Hillert
* @author Artem Bilan
*
*/
public final class Main {
@@ -111,7 +112,7 @@ public final class Main {
final GenericXmlApplicationContext context = new GenericXmlApplicationContext();
System.out.print("Detect open server socket...");
int availableServerSocket = SocketUtils.findAvailableServerSocket(5678);
int availableServerSocket = SocketUtils.findAvailableTcpPort(5678);
final Map<String, Object> sockets = new HashMap<String, Object>();
sockets.put("availableServerSocket", availableServerSocket);
@@ -128,4 +129,5 @@ public final class Main {
return context;
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015 the original author or authors.
* Copyright 2015-2017 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.
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.samples.tcpclientserver;
import static org.junit.Assert.assertEquals;
@@ -38,7 +39,7 @@ import org.springframework.integration.ip.tcp.connection.AbstractServerConnectio
import org.springframework.integration.ip.tcp.connection.TcpNetClientConnectionFactory;
import org.springframework.integration.ip.tcp.connection.TcpNetServerConnectionFactory;
import org.springframework.integration.ip.util.TestingUtilities;
import org.springframework.integration.test.util.SocketUtils;
import org.springframework.util.SocketUtils;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.MessageHandler;
import org.springframework.test.context.ContextConfiguration;
@@ -57,6 +58,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
*
* @author Gary Russell
* @author Gunnar Hillert
* @author Artem Bilan
*
*/
@ContextConfiguration(classes = TcpClientServerAnnotationDemoTest.Config.class)
@@ -85,7 +87,7 @@ public class TcpClientServerAnnotationDemoTest {
@Configuration
public static class Config {
private final int port = SocketUtils.findAvailableServerSocket();
private final int port = SocketUtils.findAvailableTcpPort();
@MessagingGateway(defaultRequestChannel="toTcp")
public interface Gateway {

View File

@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.samples.tcpclientserver.support;
import java.util.HashMap;
@@ -23,13 +24,14 @@ import org.apache.commons.logging.LogFactory;
import org.springframework.context.support.GenericApplicationContext;
import org.springframework.core.env.MapPropertySource;
import org.springframework.integration.test.util.SocketUtils;
import org.springframework.util.SocketUtils;
import org.springframework.test.context.MergedContextConfiguration;
import org.springframework.test.context.support.GenericXmlContextLoader;
/**
* @author Gunnar Hillert
* @author Gary Russell
* @author Artem Bilan
*/
public class CustomTestContextLoader extends GenericXmlContextLoader {
@@ -39,7 +41,7 @@ public class CustomTestContextLoader extends GenericXmlContextLoader {
protected void loadBeanDefinitions(GenericApplicationContext context,
MergedContextConfiguration mergedConfig) {
int availableServerSocket = SocketUtils.findAvailableServerSocket(5678);
int availableServerSocket = SocketUtils.findAvailableTcpPort(5678);
final Map<String, Object> sockets = new HashMap<String, Object>();
sockets.put("availableServerSocket", availableServerSocket);

View File

@@ -212,9 +212,9 @@ subprojects { subproject ->
subethasmtpVersion = '1.2'
slf4jVersion = '1.7.25'
springIntegrationVersion = '5.0.0.RELEASE'
springIntegrationKafkaVersion = '3.0.0.M2'
springIntegrationKafkaVersion = '3.0.0.RELEASE'
springIntegrationSplunkVersion = '1.1.0.RELEASE'
springKafkaVersion = '2.0.0.RELEASE'
springKafkaVersion = '2.0.2.RELEASE'
springVersion = '5.0.2.RELEASE'
springSecurityVersion = '5.0.0.RELEASE'
springWebFlowVersion = '2.3.3.RELEASE'

View File

@@ -108,7 +108,7 @@ public class Application {
}
@Bean
public IntegrationFlow fromKafka(ConsumerFactory<?, ?> consumerFactory) {
public IntegrationFlow fromKafkaFlow(ConsumerFactory<?, ?> consumerFactory) {
return IntegrationFlows
.from(Kafka.messageDrivenChannelAdapter(consumerFactory, this.properties.getTopic()))
.channel(c -> c.queue("fromKafka"))

View File

@@ -37,7 +37,7 @@ import org.subethamail.wiser.WiserMessage;
import org.springframework.core.io.ByteArrayResource;
import org.springframework.integration.samples.mailattachments.support.EmailFragment;
import org.springframework.integration.samples.mailattachments.support.EmailParserUtils;
import org.springframework.integration.test.util.SocketUtils;
import org.springframework.util.SocketUtils;
import org.springframework.mail.MailParseException;
import org.springframework.mail.javamail.JavaMailSenderImpl;
import org.springframework.mail.javamail.MimeMessageHelper;
@@ -47,6 +47,8 @@ import org.springframework.mail.javamail.MimeMessageHelper;
*
* @author Gunnar Hillert
* @author Gary Russell
* @author Artem Bilan
*
* @since 2.2
*/
public class MimeMessageParsingTest {
@@ -60,7 +62,7 @@ public class MimeMessageParsingTest {
@Before
public void startWiser() {
this.wiserPort = SocketUtils.findAvailableServerSocket(2500);
this.wiserPort = SocketUtils.findAvailableTcpPort(2500);
wiser = new Wiser();
wiser.setPort(this.wiserPort);

View File

@@ -23,7 +23,7 @@ import org.apache.commons.logging.LogFactory;
import org.springframework.context.support.GenericApplicationContext;
import org.springframework.core.env.MapPropertySource;
import org.springframework.integration.test.util.SocketUtils;
import org.springframework.util.SocketUtils;
import org.springframework.test.context.MergedContextConfiguration;
import org.springframework.test.context.support.GenericXmlContextLoader;
@@ -31,6 +31,7 @@ import org.springframework.test.context.support.GenericXmlContextLoader;
*
* @author Gunnar Hillert
* @author Gary Russell
* @author Artem Bilan
*
*/
public class CustomTestContextLoader extends GenericXmlContextLoader {
@@ -41,7 +42,7 @@ public class CustomTestContextLoader extends GenericXmlContextLoader {
protected void loadBeanDefinitions(GenericApplicationContext context,
MergedContextConfiguration mergedConfig) {
int availableServerSocket = SocketUtils.findAvailableServerSocket(5678);
int availableServerSocket = SocketUtils.findAvailableTcpPort(5678);
final Map<String, Object> sockets = new HashMap<String, Object>();
sockets.put("availableServerSocket", availableServerSocket);