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 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.
@@ -24,6 +24,7 @@ import javax.jms.Destination;
import javax.jms.ExceptionListener;
import javax.jms.Session;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanNameAware;
import org.springframework.beans.factory.config.AbstractFactoryBean;
@@ -412,13 +413,7 @@ public class JmsChannelFactoryBean extends AbstractFactoryBean<AbstractJmsChanne
if (this.containerType == null) {
this.containerType = DefaultMessageListenerContainer.class;
}
AbstractMessageListenerContainer container;
try {
container = this.containerType.newInstance();
}
catch (InstantiationException | IllegalAccessException e) {
throw new IllegalStateException(e);
}
AbstractMessageListenerContainer container = BeanUtils.instantiateClass(this.containerType);
container.setAcceptMessagesWhileStopping(this.acceptMessagesWhileStopping);
container.setAutoStartup(this.autoStartup);
container.setClientId(this.clientId);

View File

@@ -19,6 +19,7 @@ package org.springframework.integration.jms.dsl;
import javax.jms.Destination;
import javax.jms.ExceptionListener;
import org.springframework.beans.BeanUtils;
import org.springframework.jms.listener.AbstractMessageListenerContainer;
import org.springframework.jms.listener.DefaultMessageListenerContainer;
import org.springframework.util.ErrorHandler;
@@ -34,25 +35,17 @@ import org.springframework.util.ErrorHandler;
*
* @since 5.0
*/
public class JmsListenerContainerSpec<S extends JmsListenerContainerSpec<S, C>, C extends AbstractMessageListenerContainer>
public class JmsListenerContainerSpec<S extends JmsListenerContainerSpec<S, C>,
C extends AbstractMessageListenerContainer>
extends JmsDestinationAccessorSpec<S, C> {
protected JmsListenerContainerSpec(Class<C> aClass) {
super(newInstance(aClass));
super(BeanUtils.instantiateClass(aClass));
if (DefaultMessageListenerContainer.class.isAssignableFrom(aClass)) {
this.target.setSessionTransacted(true);
}
}
private static <C extends AbstractMessageListenerContainer> C newInstance(Class<C> aClass) {
try {
return aClass.newInstance();
}
catch (InstantiationException | IllegalAccessException e) {
throw new IllegalStateException(e);
}
}
/**
* @param destination the destination.
* @return the spec.