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:
@@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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.core.env.MapPropertySource;
|
||||||
import org.springframework.integration.ip.tcp.connection.AbstractServerConnectionFactory;
|
import org.springframework.integration.ip.tcp.connection.AbstractServerConnectionFactory;
|
||||||
import org.springframework.integration.ip.util.TestingUtilities;
|
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.
|
* 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>
|
* </ul>
|
||||||
*
|
*
|
||||||
* @author Gunnar Hillert
|
* @author Gunnar Hillert
|
||||||
|
* @author Artem Bilan
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public final class Main {
|
public final class Main {
|
||||||
@@ -111,7 +112,7 @@ public final class Main {
|
|||||||
final GenericXmlApplicationContext context = new GenericXmlApplicationContext();
|
final GenericXmlApplicationContext context = new GenericXmlApplicationContext();
|
||||||
|
|
||||||
System.out.print("Detect open server socket...");
|
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>();
|
final Map<String, Object> sockets = new HashMap<String, Object>();
|
||||||
sockets.put("availableServerSocket", availableServerSocket);
|
sockets.put("availableServerSocket", availableServerSocket);
|
||||||
@@ -128,4 +129,5 @@ public final class Main {
|
|||||||
|
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.springframework.integration.samples.tcpclientserver;
|
package org.springframework.integration.samples.tcpclientserver;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
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.TcpNetClientConnectionFactory;
|
||||||
import org.springframework.integration.ip.tcp.connection.TcpNetServerConnectionFactory;
|
import org.springframework.integration.ip.tcp.connection.TcpNetServerConnectionFactory;
|
||||||
import org.springframework.integration.ip.util.TestingUtilities;
|
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.MessageChannel;
|
||||||
import org.springframework.messaging.MessageHandler;
|
import org.springframework.messaging.MessageHandler;
|
||||||
import org.springframework.test.context.ContextConfiguration;
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
@@ -57,6 +58,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
|||||||
*
|
*
|
||||||
* @author Gary Russell
|
* @author Gary Russell
|
||||||
* @author Gunnar Hillert
|
* @author Gunnar Hillert
|
||||||
|
* @author Artem Bilan
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ContextConfiguration(classes = TcpClientServerAnnotationDemoTest.Config.class)
|
@ContextConfiguration(classes = TcpClientServerAnnotationDemoTest.Config.class)
|
||||||
@@ -85,7 +87,7 @@ public class TcpClientServerAnnotationDemoTest {
|
|||||||
@Configuration
|
@Configuration
|
||||||
public static class Config {
|
public static class Config {
|
||||||
|
|
||||||
private final int port = SocketUtils.findAvailableServerSocket();
|
private final int port = SocketUtils.findAvailableTcpPort();
|
||||||
|
|
||||||
@MessagingGateway(defaultRequestChannel="toTcp")
|
@MessagingGateway(defaultRequestChannel="toTcp")
|
||||||
public interface Gateway {
|
public interface Gateway {
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.springframework.integration.samples.tcpclientserver.support;
|
package org.springframework.integration.samples.tcpclientserver.support;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -23,13 +24,14 @@ import org.apache.commons.logging.LogFactory;
|
|||||||
|
|
||||||
import org.springframework.context.support.GenericApplicationContext;
|
import org.springframework.context.support.GenericApplicationContext;
|
||||||
import org.springframework.core.env.MapPropertySource;
|
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.MergedContextConfiguration;
|
||||||
import org.springframework.test.context.support.GenericXmlContextLoader;
|
import org.springframework.test.context.support.GenericXmlContextLoader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Gunnar Hillert
|
* @author Gunnar Hillert
|
||||||
* @author Gary Russell
|
* @author Gary Russell
|
||||||
|
* @author Artem Bilan
|
||||||
*/
|
*/
|
||||||
public class CustomTestContextLoader extends GenericXmlContextLoader {
|
public class CustomTestContextLoader extends GenericXmlContextLoader {
|
||||||
|
|
||||||
@@ -39,7 +41,7 @@ public class CustomTestContextLoader extends GenericXmlContextLoader {
|
|||||||
protected void loadBeanDefinitions(GenericApplicationContext context,
|
protected void loadBeanDefinitions(GenericApplicationContext context,
|
||||||
MergedContextConfiguration mergedConfig) {
|
MergedContextConfiguration mergedConfig) {
|
||||||
|
|
||||||
int availableServerSocket = SocketUtils.findAvailableServerSocket(5678);
|
int availableServerSocket = SocketUtils.findAvailableTcpPort(5678);
|
||||||
|
|
||||||
final Map<String, Object> sockets = new HashMap<String, Object>();
|
final Map<String, Object> sockets = new HashMap<String, Object>();
|
||||||
sockets.put("availableServerSocket", availableServerSocket);
|
sockets.put("availableServerSocket", availableServerSocket);
|
||||||
|
|||||||
@@ -212,9 +212,9 @@ subprojects { subproject ->
|
|||||||
subethasmtpVersion = '1.2'
|
subethasmtpVersion = '1.2'
|
||||||
slf4jVersion = '1.7.25'
|
slf4jVersion = '1.7.25'
|
||||||
springIntegrationVersion = '5.0.0.RELEASE'
|
springIntegrationVersion = '5.0.0.RELEASE'
|
||||||
springIntegrationKafkaVersion = '3.0.0.M2'
|
springIntegrationKafkaVersion = '3.0.0.RELEASE'
|
||||||
springIntegrationSplunkVersion = '1.1.0.RELEASE'
|
springIntegrationSplunkVersion = '1.1.0.RELEASE'
|
||||||
springKafkaVersion = '2.0.0.RELEASE'
|
springKafkaVersion = '2.0.2.RELEASE'
|
||||||
springVersion = '5.0.2.RELEASE'
|
springVersion = '5.0.2.RELEASE'
|
||||||
springSecurityVersion = '5.0.0.RELEASE'
|
springSecurityVersion = '5.0.0.RELEASE'
|
||||||
springWebFlowVersion = '2.3.3.RELEASE'
|
springWebFlowVersion = '2.3.3.RELEASE'
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ public class Application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public IntegrationFlow fromKafka(ConsumerFactory<?, ?> consumerFactory) {
|
public IntegrationFlow fromKafkaFlow(ConsumerFactory<?, ?> consumerFactory) {
|
||||||
return IntegrationFlows
|
return IntegrationFlows
|
||||||
.from(Kafka.messageDrivenChannelAdapter(consumerFactory, this.properties.getTopic()))
|
.from(Kafka.messageDrivenChannelAdapter(consumerFactory, this.properties.getTopic()))
|
||||||
.channel(c -> c.queue("fromKafka"))
|
.channel(c -> c.queue("fromKafka"))
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ import org.subethamail.wiser.WiserMessage;
|
|||||||
import org.springframework.core.io.ByteArrayResource;
|
import org.springframework.core.io.ByteArrayResource;
|
||||||
import org.springframework.integration.samples.mailattachments.support.EmailFragment;
|
import org.springframework.integration.samples.mailattachments.support.EmailFragment;
|
||||||
import org.springframework.integration.samples.mailattachments.support.EmailParserUtils;
|
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.MailParseException;
|
||||||
import org.springframework.mail.javamail.JavaMailSenderImpl;
|
import org.springframework.mail.javamail.JavaMailSenderImpl;
|
||||||
import org.springframework.mail.javamail.MimeMessageHelper;
|
import org.springframework.mail.javamail.MimeMessageHelper;
|
||||||
@@ -47,6 +47,8 @@ import org.springframework.mail.javamail.MimeMessageHelper;
|
|||||||
*
|
*
|
||||||
* @author Gunnar Hillert
|
* @author Gunnar Hillert
|
||||||
* @author Gary Russell
|
* @author Gary Russell
|
||||||
|
* @author Artem Bilan
|
||||||
|
*
|
||||||
* @since 2.2
|
* @since 2.2
|
||||||
*/
|
*/
|
||||||
public class MimeMessageParsingTest {
|
public class MimeMessageParsingTest {
|
||||||
@@ -60,7 +62,7 @@ public class MimeMessageParsingTest {
|
|||||||
@Before
|
@Before
|
||||||
public void startWiser() {
|
public void startWiser() {
|
||||||
|
|
||||||
this.wiserPort = SocketUtils.findAvailableServerSocket(2500);
|
this.wiserPort = SocketUtils.findAvailableTcpPort(2500);
|
||||||
|
|
||||||
wiser = new Wiser();
|
wiser = new Wiser();
|
||||||
wiser.setPort(this.wiserPort);
|
wiser.setPort(this.wiserPort);
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import org.apache.commons.logging.LogFactory;
|
|||||||
|
|
||||||
import org.springframework.context.support.GenericApplicationContext;
|
import org.springframework.context.support.GenericApplicationContext;
|
||||||
import org.springframework.core.env.MapPropertySource;
|
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.MergedContextConfiguration;
|
||||||
import org.springframework.test.context.support.GenericXmlContextLoader;
|
import org.springframework.test.context.support.GenericXmlContextLoader;
|
||||||
|
|
||||||
@@ -31,6 +31,7 @@ import org.springframework.test.context.support.GenericXmlContextLoader;
|
|||||||
*
|
*
|
||||||
* @author Gunnar Hillert
|
* @author Gunnar Hillert
|
||||||
* @author Gary Russell
|
* @author Gary Russell
|
||||||
|
* @author Artem Bilan
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class CustomTestContextLoader extends GenericXmlContextLoader {
|
public class CustomTestContextLoader extends GenericXmlContextLoader {
|
||||||
@@ -41,7 +42,7 @@ public class CustomTestContextLoader extends GenericXmlContextLoader {
|
|||||||
protected void loadBeanDefinitions(GenericApplicationContext context,
|
protected void loadBeanDefinitions(GenericApplicationContext context,
|
||||||
MergedContextConfiguration mergedConfig) {
|
MergedContextConfiguration mergedConfig) {
|
||||||
|
|
||||||
int availableServerSocket = SocketUtils.findAvailableServerSocket(5678);
|
int availableServerSocket = SocketUtils.findAvailableTcpPort(5678);
|
||||||
|
|
||||||
final Map<String, Object> sockets = new HashMap<String, Object>();
|
final Map<String, Object> sockets = new HashMap<String, Object>();
|
||||||
sockets.put("availableServerSocket", availableServerSocket);
|
sockets.put("availableServerSocket", availableServerSocket);
|
||||||
|
|||||||
Reference in New Issue
Block a user