Support Java 14 (#3310)

* Support Java 14

* Provide changes to avoid deprecated Java API
and have a compatibility back to Java 8
* Change affected test classes to JUnit 5 whenever it is possible
* Ignore/Disable some TCP/IP tests which don't pass on Java 14

* Fix (some) TCP tests on JRE 14

* Fix SSL Handshake test - client side handshake is successful with java 14

- change the badClient cert to a badServer cert to force an error on the client side

Co-authored-by: artembilan <raven666>
Co-authored-by: Gary Russell <grussell@pivotal.io>
This commit is contained in:
Artem Bilan
2020-06-17 14:00:06 -04:00
committed by GitHub
parent b0cd0156c7
commit 3f5aba2cb9
53 changed files with 613 additions and 671 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016-2019 the original author or authors.
* Copyright 2016-2020 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.
@@ -20,6 +20,7 @@ import java.util.LinkedHashMap;
import java.util.Map;
import java.util.function.Function;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.BeanNameAware;
import org.springframework.core.ResolvableType;
import org.springframework.integration.channel.DirectChannel;
@@ -55,14 +56,9 @@ public abstract class EndpointSpec<S extends EndpointSpec<S, F, H>, F extends Be
@SuppressWarnings("unchecked")
protected EndpointSpec(H handler) {
try {
Class<?> fClass = ResolvableType.forClass(this.getClass()).as(EndpointSpec.class).resolveGenerics()[1];
this.endpointFactoryBean = (F) fClass.newInstance();
this.handler = handler;
}
catch (Exception e) {
throw new IllegalStateException(e);
}
Class<?> fClass = ResolvableType.forClass(this.getClass()).as(EndpointSpec.class).resolveGenerics()[1];
this.endpointFactoryBean = (F) BeanUtils.instantiateClass(fClass);
this.handler = handler;
}
@Override

View File

@@ -179,14 +179,14 @@ public abstract class IntegrationFlowAdapter implements IntegrationFlow, SmartLi
return IntegrationFlows.from(inboundGatewaySpec);
}
protected <T> IntegrationFlowBuilder from(Supplier<T> messageSource) {
return IntegrationFlows.from(messageSource);
protected <T> IntegrationFlowBuilder fromSupplier(Supplier<T> messageSource) {
return IntegrationFlows.fromSupplier(messageSource);
}
protected <T> IntegrationFlowBuilder from(Supplier<T> messageSource,
protected <T> IntegrationFlowBuilder fromSupplier(Supplier<T> messageSource,
Consumer<SourcePollingChannelAdapterSpec> endpointConfigurer) {
return IntegrationFlows.from(messageSource, endpointConfigurer);
return IntegrationFlows.fromSupplier(messageSource, endpointConfigurer);
}
protected IntegrationFlowBuilder from(Class<?> serviceInterface) {

View File

@@ -141,8 +141,8 @@ public final class IntegrationFlows {
* @return new {@link IntegrationFlowBuilder}.
* @see Supplier
*/
public static <T> IntegrationFlowBuilder from(Supplier<T> messageSource) {
return from(messageSource, null);
public static <T> IntegrationFlowBuilder fromSupplier(Supplier<T> messageSource) {
return fromSupplier(messageSource, null);
}
/**
@@ -156,7 +156,7 @@ public final class IntegrationFlows {
* @return new {@link IntegrationFlowBuilder}.
* @see Supplier
*/
public static <T> IntegrationFlowBuilder from(Supplier<T> messageSource,
public static <T> IntegrationFlowBuilder fromSupplier(Supplier<T> messageSource,
Consumer<SourcePollingChannelAdapterSpec> endpointConfigurer) {
Assert.notNull(messageSource, "'messageSource' must not be null");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 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.
@@ -27,7 +27,7 @@ import org.springframework.messaging.Message;
* <p>
* The BridgeHandler can be used as a stopper at the end of an assembly line of
* channels. In this setup the output channel doesn't have to be set, but if the
* output channel is omitted the <tt>REPLY_CHANNEL</tt> MUST be set on the
* output channel is omitted the {@code REPLY_CHANNEL} MUST be set on the
* message. Otherwise, a MessagingException will be thrown at runtime.
*
* @author Mark Fisher

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 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.
@@ -52,8 +52,8 @@ public interface MetadataStore {
/**
* Remove a value for the given key from this MetadataStore.
* @param key The key.
* @return The previous value associated with <tt>key</tt>, or
* <tt>null</tt> if there was no mapping for <tt>key</tt>.
* @return The previous value associated with key, or
* null if there was no mapping for key.
*/
@ManagedAttribute
String remove(String key);

View File

@@ -106,7 +106,7 @@ fun integrationFlow(messageSource: MessageSourceSpec<*, out MessageSource<*>>,
fun integrationFlow(source: () -> Any,
options: SourcePollingChannelAdapterSpec.() -> Unit = {},
flow: KotlinIntegrationFlowDefinition.() -> Unit) =
buildIntegrationFlow(IntegrationFlows.from(source, options), flow)
buildIntegrationFlow(IntegrationFlows.fromSupplier(source, options), flow)
/**
* Functional [IntegrationFlow] definition in Kotlin DSL for [IntegrationFlows.from] -