diff --git a/.travis.yml b/.travis.yml index 9fff5cc5..3a412a0a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,12 @@ services: - mongodb - rabbitmq - redis-server -env: - - TERM=dumb +before_cache: + - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock +cache: + directories: + - $HOME/.gradle/caches/ + - $HOME/.gradle/wrapper/ +install: true script: - - ./gradlew check --continue + - ./gradlew check --refresh-dependencies --no-daemon diff --git a/basic/tcp-client-server/src/main/java/org/springframework/integration/samples/tcpclientserver/Main.java b/basic/tcp-client-server/src/main/java/org/springframework/integration/samples/tcpclientserver/Main.java index 6c315aea..ff3120ae 100644 --- a/basic/tcp-client-server/src/main/java/org/springframework/integration/samples/tcpclientserver/Main.java +++ b/basic/tcp-client-server/src/main/java/org/springframework/integration/samples/tcpclientserver/Main.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. @@ -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 java.util.HashMap; @@ -49,6 +50,8 @@ import org.springframework.util.SocketUtils; */ public final class Main { + private static final String AVAILABLE_SERVER_SOCKET = "availableServerSocket"; + /** * Prevent instantiation. */ @@ -64,14 +67,14 @@ public final class Main { final Scanner scanner = new Scanner(System.in); System.out.println("\n=========================================================" - + "\n " - + "\n Welcome to the Spring Integration " - + "\n TCP-Client-Server Sample! " - + "\n " - + "\n For more information please visit: " - + "\n http://www.springintegration.org/ " - + "\n " - + "\n=========================================================" ); + + "\n " + + "\n Welcome to the Spring Integration " + + "\n TCP-Client-Server Sample! " + + "\n " + + "\n For more information please visit: " + + "\n http://www.springintegration.org/ " + + "\n " + + "\n========================================================="); final GenericXmlApplicationContext context = Main.setupContext(); final SimpleGateway gateway = context.getBean(SimpleGateway.class); @@ -87,14 +90,14 @@ public final class Main { System.out.println("\t- Entering q will quit the application"); System.out.print("\n"); System.out.println("\t--> Please also check out the other samples, " + - "that are provided as JUnit tests."); + "that are provided as JUnit tests."); System.out.println("\t--> You can also connect to the server on port '" + crLfServer.getPort() + "' using Telnet.\n\n"); while (true) { final String input = scanner.nextLine(); - if("q".equals(input.trim())) { + if ("q".equals(input.trim())) { break; } else { @@ -111,17 +114,19 @@ public final class Main { public static GenericXmlApplicationContext setupContext() { final GenericXmlApplicationContext context = new GenericXmlApplicationContext(); - System.out.print("Detect open server socket..."); - int availableServerSocket = SocketUtils.findAvailableTcpPort(5678); + if (System.getProperty(AVAILABLE_SERVER_SOCKET) == null) { + System.out.print("Detect open server socket..."); + int availableServerSocket = SocketUtils.findAvailableTcpPort(5678); - final Map sockets = new HashMap(); - sockets.put("availableServerSocket", availableServerSocket); + final Map sockets = new HashMap<>(); + sockets.put(AVAILABLE_SERVER_SOCKET, availableServerSocket); - final MapPropertySource propertySource = new MapPropertySource("sockets", sockets); + final MapPropertySource propertySource = new MapPropertySource("sockets", sockets); - context.getEnvironment().getPropertySources().addLast(propertySource); + context.getEnvironment().getPropertySources().addLast(propertySource); + } - System.out.println("using port " + context.getEnvironment().getProperty("availableServerSocket")); + System.out.println("using port " + context.getEnvironment().getProperty(AVAILABLE_SERVER_SOCKET)); context.load("classpath:META-INF/spring/integration/tcpClientServerDemo-context.xml"); context.registerShutdownHook(); diff --git a/basic/tcp-client-server/src/main/resources/META-INF/spring/integration/tcpClientServerDemo-context.xml b/basic/tcp-client-server/src/main/resources/META-INF/spring/integration/tcpClientServerDemo-context.xml index 145703a3..c5a8d10d 100644 --- a/basic/tcp-client-server/src/main/resources/META-INF/spring/integration/tcpClientServerDemo-context.xml +++ b/basic/tcp-client-server/src/main/resources/META-INF/spring/integration/tcpClientServerDemo-context.xml @@ -1,67 +1,67 @@ - + + service-interface="org.springframework.integration.samples.tcpclientserver.SimpleGateway" + default-request-channel="input"/> + type="client" + host="localhost" + port="#{crLfServer.port}" + single-use="true" + so-timeout="10000"/> - + + request-channel="input" + reply-channel="clientBytes2StringChannel" + connection-factory="client" + request-timeout="10000" + reply-timeout="10000"/> + input-channel="clientBytes2StringChannel"/> + type="server" + port="${availableServerSocket:0}"/> + connection-factory="crLfServer" + request-channel="serverBytes2StringChannel" + error-channel="errorChannel"/> - + + ref="echoService" + method="test"/> + class="org.springframework.integration.samples.tcpclientserver.EchoService"/> + input-channel="serverBytes2StringChannel" + output-channel="toSA"/> + input-channel="errorChannel" + expression="payload.failedMessage.payload + ':' + payload.cause.message"/> diff --git a/basic/tcp-client-server/src/main/resources/META-INF/spring/integration/tcpClientServerDemo-conversion-context.xml b/basic/tcp-client-server/src/main/resources/META-INF/spring/integration/tcpClientServerDemo-conversion-context.xml index b836cdff..b8761bfa 100644 --- a/basic/tcp-client-server/src/main/resources/META-INF/spring/integration/tcpClientServerDemo-conversion-context.xml +++ b/basic/tcp-client-server/src/main/resources/META-INF/spring/integration/tcpClientServerDemo-conversion-context.xml @@ -1,10 +1,10 @@ @@ -15,69 +15,69 @@ + class="org.springframework.context.support.ConversionServiceFactoryBean"> - + - + + service-interface="org.springframework.integration.samples.tcpclientserver.SimpleGateway" + default-request-channel="input" + default-reply-channel="reply"/> + type="client" + host="localhost" + port="#{crLfServer.port}" + single-use="true" + so-timeout="10000" + /> - + + request-channel="input" + reply-channel="reply" + connection-factory="client" + request-timeout="10000" + reply-timeout="10000" + /> - + + type="server" + port="${availableServerSocket:0}"/> + connection-factory="crLfServer" + request-channel="toSA" + error-channel="errorChannel"/> - + + class="org.springframework.integration.samples.tcpclientserver.EchoService"/> + input-channel="errorChannel" + expression="payload.failedMessage.payload + ':' + payload.cause.message"/> diff --git a/basic/tcp-client-server/src/main/resources/META-INF/spring/integration/tcpServerConnectionDeserialize-context.xml b/basic/tcp-client-server/src/main/resources/META-INF/spring/integration/tcpServerConnectionDeserialize-context.xml index 290d6dfe..a7a3c8f7 100644 --- a/basic/tcp-client-server/src/main/resources/META-INF/spring/integration/tcpServerConnectionDeserialize-context.xml +++ b/basic/tcp-client-server/src/main/resources/META-INF/spring/integration/tcpServerConnectionDeserialize-context.xml @@ -1,69 +1,70 @@ - + + service-interface="org.springframework.integration.samples.tcpclientserver.SimpleGateway" + default-request-channel="input"/> + type="client" + host="localhost" + port="#{serverConnectionFactory.port}" + single-use="true" + so-timeout="10000" + deserializer="connectionSerializeDeserialize"/> - + + request-channel="input" + reply-channel="clientBytes2StringChannel" + connection-factory="client" + request-timeout="10000" + reply-timeout="10000"/> + input-channel="clientBytes2StringChannel"/> + type="server" + port="${availableServerSocket:0}" + serializer="connectionSerializeDeserialize" + deserializer="connectionSerializeDeserialize"/> - + + connection-factory="serverConnectionFactory" + request-channel="incomingServerChannel" + error-channel="errorChannel"/> - + - \ No newline at end of file + diff --git a/basic/tcp-client-server/src/main/resources/META-INF/spring/integration/tcpServerCustomSerialize-context.xml b/basic/tcp-client-server/src/main/resources/META-INF/spring/integration/tcpServerCustomSerialize-context.xml index a01d88b9..2e78549a 100644 --- a/basic/tcp-client-server/src/main/resources/META-INF/spring/integration/tcpServerCustomSerialize-context.xml +++ b/basic/tcp-client-server/src/main/resources/META-INF/spring/integration/tcpServerCustomSerialize-context.xml @@ -17,7 +17,7 @@ formatted with the Stx-Etx bytes. --> sockets = new HashMap(); - sockets.put("availableServerSocket", availableServerSocket); - - if (LOGGER.isInfoEnabled()) { - LOGGER.info("Available server socket: " + availableServerSocket); - } - - final MapPropertySource propertySource = new MapPropertySource("sockets", sockets); - - context.getEnvironment().getPropertySources().addLast(propertySource); - super.loadBeanDefinitions(context, mergedConfig); - } - -} diff --git a/build.gradle b/build.gradle index ede58426..34bc8cb4 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { dependencies { classpath 'io.spring.gradle:dependency-management-plugin:1.0.4.RELEASE' classpath "org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion" - classpath 'org.akhikhl.gretty:gretty:1.4.2' + classpath 'org.akhikhl.gretty:gretty:2.0.0' } } plugins { @@ -409,7 +409,7 @@ project('loan-broker') { project('loanshark') { description = 'Loan Shark Sample' - apply plugin: 'org.akhikhl.gretty' +// apply plugin: 'org.akhikhl.gretty' apply plugin: 'eclipse-wtp' dependencies { @@ -585,7 +585,7 @@ project('http') { description = 'HTTP Sample' apply plugin: 'application' - apply plugin: 'org.akhikhl.gretty' +// apply plugin: 'org.akhikhl.gretty' apply plugin: 'eclipse-wtp' mainClassName = 'org.springframework.integration.samples.http.HttpClientDemo' @@ -950,7 +950,7 @@ project('twitter') { project('ws-inbound-gateway') { description = 'WS Inbound Gateway Sample' - apply plugin: 'org.akhikhl.gretty' +// apply plugin: 'org.akhikhl.gretty' apply plugin: 'eclipse-wtp' dependencies { @@ -1070,7 +1070,7 @@ project('mail-attachments') { project('monitoring') { description = 'Monitoring Application' - apply plugin: 'org.akhikhl.gretty' +// apply plugin: 'org.akhikhl.gretty' apply plugin: 'application' apply plugin: 'eclipse-wtp' @@ -1089,7 +1089,7 @@ project('monitoring') { project('multipart-http') { description = 'HTTP Multipart Demo' - apply plugin: 'org.akhikhl.gretty' +// apply plugin: 'org.akhikhl.gretty' apply plugin: 'eclipse-wtp' dependencies { @@ -1105,7 +1105,7 @@ project('multipart-http') { project('rest-http') { description = 'Spring Integration Rest HTTP Path Usage Demo' - apply plugin: 'org.akhikhl.gretty' +// apply plugin: 'org.akhikhl.gretty' apply plugin: 'eclipse-wtp' dependencies { diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7a3265ee..f6b961fd 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 5a87b45f..bf3de218 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Tue Jul 25 14:05:00 EDT 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-bin.zip