Upgrade to SF-5.1, remove deprecations etc.

* Upgrade to SF-5.1, Log4J-2.11, Mockito-2.17, Jackson 2.9.5,
SonarQube-2.6.1, Checkstyle-8.8
* Remove `spring-io-plugin` since it's not going to exist after Cairo
release
* Move `log4j-slf4j-impl` to the modules where no `logback-classic`
dependency - the `logback` performs expected work for us via
`spring-rabbit` infrastructure
* `log4j2-test.xml` in the `spring-rabbit-junit` to the `test` scope
* Remove some old `@Deprecated` API
This commit is contained in:
Artem Bilan
2018-04-04 16:41:19 -04:00
committed by Gary Russell
parent 7fa40933a2
commit d316dbf6c8
10 changed files with 29 additions and 256 deletions

View File

@@ -6,13 +6,11 @@ buildscript {
classpath 'io.spring.gradle:docbook-reference-plugin:0.3.1'
classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.0'
classpath 'me.champeau.gradle:gradle-javadoc-hotfix-plugin:0.1'
classpath 'io.spring.gradle:dependency-management-plugin:1.0.2.RELEASE'
classpath 'io.spring.gradle:spring-io-plugin:0.0.8.RELEASE'
}
}
plugins {
id "org.sonarqube" version '2.5'
id "org.sonarqube" version '2.6.1'
}
description = 'Spring AMQP'
@@ -65,39 +63,23 @@ subprojects { subproject ->
apply plugin: 'jacoco'
apply plugin: 'checkstyle'
if (project.hasProperty('platformVersion')) {
apply plugin: 'spring-io'
repositories {
maven { url 'https://repo.spring.io/libs-snapshot' }
}
dependencyManagement {
springIoTestRuntime {
imports {
mavenBom "io.spring.platform:platform-bom:$platformVersion"
}
}
}
}
sourceCompatibility=1.8
targetCompatibility=1.8
ext {
hamcrestVersion = '1.3'
jackson2Version = '2.9.1'
jackson2Version = '2.9.5'
junit4Version = '4.12'
junitJupiterVersion = '5.1.0'
junitPlatformVersion = '1.1.0'
junitVintageVersion = '5.1.0'
log4jVersion = '2.8.2'
log4jVersion = '2.11.0'
logbackVersion = '1.2.3'
mockitoVersion = '2.11.0'
mockitoVersion = '2.17.0'
rabbitmqVersion = project.hasProperty('rabbitmqVersion') ? project.rabbitmqVersion : '5.2.0'
rabbitmqHttpClientVersion = '2.0.1.RELEASE'
springVersion = project.hasProperty('springVersion') ? project.springVersion : '5.0.4.RELEASE'
springVersion = project.hasProperty('springVersion') ? project.springVersion : '5.1.0.BUILD-SNAPSHOT'
springRetryVersion = '1.2.2.RELEASE'
}
@@ -124,7 +106,6 @@ subprojects { subproject ->
}
testCompile "org.springframework:spring-test:$springVersion"
testRuntime "org.apache.logging.log4j:log4j-slf4j-impl:$log4jVersion"
testRuntime "org.apache.logging.log4j:log4j-jcl:$log4jVersion"
testCompile "org.junit.jupiter:junit-jupiter-api:$junitJupiterVersion"
@@ -187,7 +168,7 @@ subprojects { subproject ->
logging.captureStandardOutput(LogLevel.INFO)
dependsOn checkTestConfigs
if (name ==~ /(springIo.*)|(testAll)/) {
if (name ==~ /(testAll)/) {
systemProperty 'RUN_LONG_INTEGRATION_TESTS', 'true'
}
useJUnitPlatform()
@@ -205,7 +186,7 @@ subprojects { subproject ->
checkstyle {
configFile = file("${rootDir}/src/checkstyle/checkstyle.xml")
toolVersion = "8.1"
toolVersion = "8.8"
}
artifacts {
@@ -242,6 +223,8 @@ project('spring-amqp') {
compile ("org.springframework:spring-context:$springVersion", optional)
compile ("com.fasterxml.jackson.core:jackson-core:$jackson2Version", optional)
compile ("com.fasterxml.jackson.core:jackson-databind:$jackson2Version", optional)
testRuntime "org.apache.logging.log4j:log4j-slf4j-impl:$log4jVersion"
}
}
@@ -289,6 +272,7 @@ project('spring-rabbit-junit') {
compile ("org.junit.jupiter:junit-jupiter-api:$junitJupiterVersion", optional)
compileOnly 'org.apiguardian:apiguardian-api:1.0.0'
testRuntime "org.apache.logging.log4j:log4j-slf4j-impl:$log4jVersion"
}
}
@@ -308,7 +292,6 @@ project('spring-rabbit-test') {
}
testCompile project(":spring-rabbit").sourceSets.test.output
testCompile project(":spring-rabbit-junit")
}
}

View File

@@ -1,29 +0,0 @@
/*
* Copyright 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.amqp.core;
/**
* A message post processor that can also use/manipulate correlation data.
*
* @author Gary Russell
* @since 1.6.7
* @deprecated in 2.0, the method has been moved to {@link MessagePostProcessor}.
*/
@Deprecated
public interface CorrelationAwareMessagePostProcessor extends MessagePostProcessor {
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2017 the original author or authors.
* Copyright 2014-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.
@@ -25,8 +25,11 @@ import org.springframework.beans.BeanUtils;
/**
* Support class for building {@link Message} and {@link MessageProperties}
* fluent API.
*
* @param <T> The message builder type.
*
* @author Gary Russell
*
* @since 1.3
*
*/
@@ -85,18 +88,6 @@ public abstract class MessageBuilderSupport<T> {
return this;
}
/**
* Set the correlation id.
* @param correlationId the id.
* @return the builder.
* @deprecated - use {@link #setCorrelationId(String)}
*/
@Deprecated
public MessageBuilderSupport<T> setCorrelationIdString(String correlationId) {
this.properties.setCorrelationId(correlationId);
return this;
}
public MessageBuilderSupport<T> setReplyTo(String replyTo) {
this.properties.setReplyTo(replyTo);
return this;
@@ -222,20 +213,6 @@ public abstract class MessageBuilderSupport<T> {
return this;
}
/**
* Set the correlation id if not already present.
* @param correlationId the id.
* @return the builder.
* @deprecated - use {@link #setCorrelationIdIfAbsent(String)}
*/
@Deprecated
public MessageBuilderSupport<T> setCorrelationIdStringIfAbsent(String correlationId) {
if (this.properties.getCorrelationId() == null) {
this.properties.setCorrelationId(correlationId);
}
return this;
}
public MessageBuilderSupport<T> setReplyToIfAbsent(String replyTo) {
if (this.properties.getReplyTo() == null) {
this.properties.setReplyTo(replyTo);
@@ -368,4 +345,5 @@ public abstract class MessageBuilderSupport<T> {
}
public abstract T build();
}

View File

@@ -225,26 +225,6 @@ public class MessageProperties implements Serializable {
return this.correlationId;
}
/**
* Get the correlation id.
* @return the correlation id
* @deprecated use {@link #getCorrelationId()}.
*/
@Deprecated
public String getCorrelationIdString() {
return this.correlationId;
}
/**
* Set the correlation id.
* @param correlationId the id.
* @deprecated - use {@link #setCorrelationId(String)}.
*/
@Deprecated
public void setCorrelationIdString(String correlationId) {
this.correlationId = correlationId;
}
public void setReplyTo(String replyTo) {
this.replyTo = replyTo;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2016 the original author or authors.
* Copyright 2014-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.
@@ -32,6 +32,7 @@ import org.springframework.util.MimeType;
*
* @author Stephane Nicoll
* @author Gary Russell
*
* @since 1.4
*/
public class AmqpMessageHeaderAccessor extends NativeMessageHeaderAccessor {
@@ -98,16 +99,6 @@ public class AmqpMessageHeaderAccessor extends NativeMessageHeaderAccessor {
return (String) getHeader(AmqpHeaders.CORRELATION_ID);
}
/**
* Get the correlation id.
* @return the id.
* @deprecated - use {@link #getCorrelationId()}.
*/
@Deprecated
public String getCorrelationIdString() {
return (String) getHeader(AmqpHeaders.CORRELATION_ID);
}
public MessageDeliveryMode getDeliveryMode() {
return (MessageDeliveryMode) getHeader(AmqpHeaders.DELIVERY_MODE);
}

View File

@@ -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.
@@ -56,11 +56,11 @@ public class DefaultClassMapper implements ClassMapper, InitializingBean {
"java.lang"
);
private final Set<String> trustedPackages = new LinkedHashSet<String>(TRUSTED_PACKAGES);
private final Set<String> trustedPackages = new LinkedHashSet<>(TRUSTED_PACKAGES);
private volatile Map<String, Class<?>> idClassMapping = new HashMap<String, Class<?>>();
private volatile Map<String, Class<?>> idClassMapping = new HashMap<>();
private volatile Map<Class<?>, String> classIdMapping = new HashMap<Class<?>, String>();
private volatile Map<Class<?>, String> classIdMapping = new HashMap<>();
private volatile Class<?> defaultMapClass = LinkedHashMap.class;
@@ -75,23 +75,10 @@ public class DefaultClassMapper implements ClassMapper, InitializingBean {
this.defaultType = defaultType;
}
/**
* Set the type of {@link Map} to use. For outbound messages, set the
* {@value #DEFAULT_CLASSID_FIELD_NAME} header to {@code Hashtable}. For inbound messages,
* if the {@value #DEFAULT_CLASSID_FIELD_NAME} header is {@code HashTable} convert to this
* class.
* @param defaultMapClass the map class.
* @deprecated use {@link #setDefaultMapClass(Class)}
*/
@Deprecated
public void setDefaultHashtableClass(Class<?> defaultMapClass) {
this.defaultMapClass = defaultMapClass;
}
/**
* Set the type of {@link Map} to use. For outbound messages, set the
* {@value #DEFAULT_CLASSID_FIELD_NAME} header to {@code HashTable}. For inbound messages,
* if the {@value #DEFAULT_CLASSID_FIELD_NAME} header is {@code HashTable} convert to this
* if the {@value #DEFAULT_CLASSID_FIELD_NAME} header is {@code Hashtable} convert to this
* class.
* @param defaultMapClass the map class.
* @since 2.0

View File

@@ -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.
@@ -37,7 +37,8 @@ import org.springframework.util.MultiValueMap;
import com.rabbitmq.client.Channel;
/**
* Rabbit resource holder, wrapping a RabbitMQ Connection and Channel. RabbitTransactionManager binds instances of this
* Rabbit resource holder, wrapping a RabbitMQ Connection and Channel.
* RabbitTransactionManager binds instances of this
* class to the thread, for a given Rabbit ConnectionFactory.
*
* <p>
@@ -56,13 +57,13 @@ public class RabbitResourceHolder extends ResourceHolderSupport {
private final boolean frozen = false;
private final List<Connection> connections = new LinkedList<Connection>();
private final List<Connection> connections = new LinkedList<>();
private final List<Channel> channels = new LinkedList<Channel>();
private final List<Channel> channels = new LinkedList<>();
private final Map<Connection, List<Channel>> channelsPerConnection = new HashMap<Connection, List<Channel>>();
private final Map<Connection, List<Channel>> channelsPerConnection = new HashMap<>();
private final MultiValueMap<Channel, Long> deliveryTags = new LinkedMultiValueMap<Channel, Long>();
private final MultiValueMap<Channel, Long> deliveryTags = new LinkedMultiValueMap<>();
private final boolean releaseAfterCompletion;
@@ -218,14 +219,4 @@ public class RabbitResourceHolder extends ResourceHolderSupport {
}
}
/**
* Invalid - always returned false.
* @return true if the channels in this holder are transactional
* @deprecated Not used
*/
@Deprecated
public boolean isChannelTransactional() {
return false;
}
}

View File

@@ -23,8 +23,6 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.amqp.AmqpIOException;
import org.springframework.amqp.AmqpRejectAndDontRequeueException;
import org.springframework.amqp.rabbit.listener.MessageRejectedWhileStoppingException;
import org.springframework.amqp.rabbit.support.RabbitExceptionTranslator;
import org.springframework.util.Assert;
@@ -313,35 +311,4 @@ public abstract class RabbitUtils {
}
}
/**
* Determine whether a message should be requeued; returns true if the throwable is a
* {@link MessageRejectedWhileStoppingException} or defaultRequeueRejected is true and
* there is not an {@link AmqpRejectAndDontRequeueException} in the cause chain.
* @param defaultRequeueRejected the default requeue rejected.
* @param throwable the throwable.
* @param logger the logger to use for debug.
* @return true to requeue.
* @since 2.0
* @deprecated in favor of {@code ContainerUtils#shouldRequeue(boolean, Throwable, Log)}.
*/
@Deprecated
public static boolean shouldRequeue(boolean defaultRequeueRejected, Throwable throwable, Log logger) {
logger.warn("Use ContainerUtils.shouldRequeue()");
// compare class by name to avoid tangle
boolean shouldRequeue = defaultRequeueRejected ||
throwable.getClass().getName().equals(
"org.springframework.amqp.rabbit.listener.MessageRejectedWhileStoppingException");
Throwable t = throwable;
while (shouldRequeue && t != null) {
if (t instanceof AmqpRejectAndDontRequeueException) {
shouldRequeue = false;
}
t = t.getCause();
}
if (logger.isDebugEnabled()) {
logger.debug("Rejecting messages (requeue=" + shouldRequeue + ")");
}
return shouldRequeue;
}
}

View File

@@ -1,75 +0,0 @@
/*
* Copyright 2016-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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.amqp.rabbit.support;
import java.lang.reflect.Method;
import org.springframework.util.ClassUtils;
/**
* Utility methods for log appenders.
*
* @author Gary Russell
* @since 1.5.6
*
* @deprecated in favor of {@code ConnectionFactoryConfigurationUtils}.
*
*/
@Deprecated
public final class LogAppenderUtils {
private static final Method util;
static {
Method method;
try {
Class<?> utils = ClassUtils.forName(
"org.springframework.amqp.rabbit.connection.ConnectionFactoryConfigurationUtils",
LogAppenderUtils.class.getClassLoader());
Class<?> abstractCF = ClassUtils.forName(
"org.springframework.amqp.rabbit.connection.AbstractConnectionFactory",
LogAppenderUtils.class.getClassLoader());
method = utils.getDeclaredMethod("updateClientConnectionProperties", abstractCF, String.class);
}
catch (Exception e) {
method = null;
}
util = method;
}
private LogAppenderUtils() {
super();
}
/**
* Parse the properties {@code key:value[,key:value]...} and add them to the
* connection factory client properties.
* @param connectionFactory the connection factory.
* @param clientConnectionProperties the properties.
*/
public static void updateClientConnectionProperties(Object connectionFactory,
String clientConnectionProperties) {
try {
util.invoke(null, connectionFactory, clientConnectionProperties);
}
catch (Exception e) {
throw new RuntimeException("Failed to set properties", e);
}
}
}