Permalink
Browse files

AMQP-360 Update Versions; Align with SI/SF 4

JIRA: https://jira.springsource.org/browse/AMQP-360

Note: The changes to the RabbitBrokerAdmin test rules are simply
to make them work with junit 4.11 - these tests (controlled by
a System property) currently do no run and will be addressed by
a separate JIRA.

RabbitBrokerAdmin is not part of the main Spring-AMQP runtime.
  • Loading branch information...
1 parent fe88307 commit d5494f4ed4544c2e472415ddc9b0a46842d90be6 @garyrussell garyrussell committed with Artem Bilan Feb 28, 2014
Showing with 160 additions and 116 deletions.
  1. +14 −10 build.gradle
  2. +18 −16 spring-amqp/src/main/java/org/springframework/amqp/support/converter/DefaultJavaTypeMapper.java
  3. +2 −4 spring-amqp/src/main/java/org/springframework/amqp/support/converter/JsonMessageConverter.java
  4. +2 −2 spring-amqp/src/test/java/org/springframework/amqp/core/AddressTests.java
  5. +5 −3 spring-amqp/src/test/java/org/springframework/amqp/support/converter/DefaultClassMapperTest.java
  6. +16 −12 ...p/src/test/java/org/springframework/amqp/support/converter/DefaultJackson2JavaTypeMapperTest.java
  7. +24 −20 spring-amqp/src/test/java/org/springframework/amqp/support/converter/DefaultJavaTypeMapperTest.java
  8. +19 −4 spring-rabbit/src/test/java/org/springframework/amqp/rabbit/admin/JInterfaceIntegrationTests.java
  9. +5 −3 ...rabbit/src/test/java/org/springframework/amqp/rabbit/admin/RabbitBrokerAdminIntegrationTests.java
  10. +5 −2 ...c/test/java/org/springframework/amqp/rabbit/admin/RabbitBrokerAdminLifecycleIntegrationTests.java
  11. +4 −1 ...-rabbit/src/test/java/org/springframework/amqp/rabbit/config/MismatchedQueueDeclarationTests.java
  12. +6 −3 ...a/org/springframework/amqp/rabbit/listener/MessageListenerBrokerInterruptionIntegrationTests.java
  13. +1 −0 .../java/org/springframework/amqp/rabbit/listener/MessageListenerContainerRetryIntegrationTests.java
  14. +9 −6 spring-rabbit/src/test/java/org/springframework/amqp/rabbit/test/BrokerPanic.java
  15. +14 −10 spring-rabbit/src/test/java/org/springframework/amqp/rabbit/test/BrokerRunning.java
  16. +9 −13 spring-rabbit/src/test/java/org/springframework/amqp/rabbit/test/EnvironmentAvailable.java
  17. +7 −7 spring-rabbit/src/test/java/org/springframework/amqp/rabbit/test/LongRunningIntegrationTest.java
View
@@ -57,17 +57,20 @@ subprojects { subproject ->
targetCompatibility=1.6
ext {
- cglibVersion = '2.2'
- commonsIoVersion = '1.4'
- erlangOtpVersion = '1.5.3'
- jacksonVersion = '1.4.3'
- jackson2Version = '2.0.1'
- junitVersion = '4.8.2'
- log4jVersion = '1.2.15'
- mockitoVersion = '1.8.4'
- rabbitmqVersion = '3.2.2'
+ cglibVersion = '3.1'
+ commonsIoVersion = '2.4'
+ erlangOtpVersion = '1.5.6'
+ hamcrestVersion = '1.3'
+ jacksonVersion = '1.9.13'
+ jackson2Version = '2.3.1'
+ junitVersion = '4.11'
+ log4jVersion = '1.2.17'
+ mockitoVersion = '1.9.5'
+ rabbitmqVersion = '3.2.3'
springVersion = project.hasProperty('springVersion') ? project.springVersion : '3.2.7.RELEASE'
+
+ springRetryVersion = '1.0.3.RELEASE'
}
eclipse {
@@ -92,6 +95,7 @@ subprojects { subproject ->
exclude group: 'com.sun.jmx', module: 'jmxri'
}
+ testCompile "org.hamcrest:hamcrest-all:$hamcrestVersion"
testCompile "org.mockito:mockito-all:$mockitoVersion"
testCompile "org.springframework:spring-test:$springVersion"
@@ -194,7 +198,7 @@ project('spring-rabbit') {
compile "org.springframework:spring-context:$springVersion"
compile "org.springframework:spring-tx:$springVersion"
- compile ("org.springframework.retry:spring-retry:1.0.3.RELEASE", optional)
+ compile ("org.springframework.retry:spring-retry:$springRetryVersion", optional)
testCompile "commons-cli:commons-cli:1.2"
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2013 the original author or authors. Licensed under the Apache License, Version 2.0 (the "License");
+ * Copyright 2002-2014 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,
@@ -8,27 +8,26 @@
*/
package org.springframework.amqp.support.converter;
-import static org.codehaus.jackson.map.type.TypeFactory.collectionType;
-import static org.codehaus.jackson.map.type.TypeFactory.mapType;
-import static org.codehaus.jackson.map.type.TypeFactory.type;
-
-import java.util.Collection;
-import java.util.Map;
-
+import org.codehaus.jackson.map.type.CollectionType;
+import org.codehaus.jackson.map.type.MapType;
+import org.codehaus.jackson.map.type.TypeFactory;
import org.codehaus.jackson.type.JavaType;
import org.springframework.amqp.core.MessageProperties;
import org.springframework.util.ClassUtils;
+
+
/**
* @author Mark Pollack
* @author Sam Nelson
* @author Andreas Asplund
* @author Artem Bilan
+ * @author Gary Russell
*/
public class DefaultJavaTypeMapper extends AbstractJavaTypeMapper implements JavaTypeMapper, ClassMapper {
- @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
public JavaType toJavaType(MessageProperties properties) {
JavaType classType = getClassIdType(retrieveHeader(properties,
getClassIdFieldName()));
@@ -39,26 +38,26 @@ public JavaType toJavaType(MessageProperties properties) {
JavaType contentClassType = getClassIdType(retrieveHeader(properties,
getContentClassIdFieldName()));
if (classType.getKeyType() == null) {
- return collectionType(
- (Class<? extends Collection>) classType.getRawClass(),
+ return CollectionType.construct(
+ classType.getRawClass(),
contentClassType);
}
JavaType keyClassType = getClassIdType(retrieveHeader(properties,
getKeyClassIdFieldName()));
- return mapType(
- (Class<? extends Map>) classType.getRawClass(), keyClassType,
+ return MapType.construct(
+ classType.getRawClass(), keyClassType,
contentClassType);
}
private JavaType getClassIdType(String classId) {
if (getIdClassMapping().containsKey(classId)) {
- return type(getIdClassMapping().get(classId));
+ return TypeFactory.defaultInstance().constructType(getIdClassMapping().get(classId));
}
try {
- return type(ClassUtils.forName(classId, getClass()
+ return TypeFactory.defaultInstance().constructType(ClassUtils.forName(classId, getClass()
.getClassLoader()));
}
catch (ClassNotFoundException e) {
@@ -73,6 +72,7 @@ private JavaType getClassIdType(String classId) {
}
}
+ @Override
public void fromJavaType(JavaType javaType, MessageProperties properties) {
addHeader(properties, getClassIdFieldName(),
javaType.getRawClass());
@@ -88,11 +88,13 @@ public void fromJavaType(JavaType javaType, MessageProperties properties) {
}
}
+ @Override
public void fromClass(Class<?> clazz, MessageProperties properties) {
- fromJavaType(type(clazz), properties);
+ fromJavaType(TypeFactory.defaultInstance().constructType(clazz), properties);
}
+ @Override
public Class<?> toClass(MessageProperties properties) {
return toJavaType(properties).getRawClass();
}
@@ -9,8 +9,6 @@
package org.springframework.amqp.support.converter;
-import static org.codehaus.jackson.map.type.TypeFactory.type;
-
import java.io.IOException;
import org.apache.commons.logging.Log;
@@ -130,7 +128,7 @@ private Object convertBytesToObject(byte[] body, String encoding,
Class<?> targetClass) throws JsonParseException,
JsonMappingException, IOException {
String contentAsString = new String(body, encoding);
- return jsonObjectMapper.readValue(contentAsString, type(targetClass));
+ return jsonObjectMapper.readValue(contentAsString, jsonObjectMapper.constructType(targetClass));
}
@Override
@@ -154,7 +152,7 @@ protected Message createMessage(Object objectToConvert,
}
if (getClassMapper() == null) {
- getJavaTypeMapper().fromJavaType(type(objectToConvert.getClass()),
+ getJavaTypeMapper().fromJavaType(jsonObjectMapper.constructType(objectToConvert.getClass()),
messageProperties);
}
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2010 the original author or authors.
+ * Copyright 2002-2014 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.
@@ -17,8 +17,8 @@
package org.springframework.amqp.core;
import static org.junit.Assert.assertEquals;
-import junit.framework.Assert;
+import org.junit.Assert;
import org.junit.Test;
/**
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2012 the original author or authors.
+ * Copyright 2002-2014 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
@@ -13,10 +13,10 @@
package org.springframework.amqp.support.converter;
import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.Matchers.containsString;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertThat;
-import static org.junit.matchers.JUnitMatchers.containsString;
import static org.mockito.BDDMockito.given;
import java.util.HashMap;
@@ -28,6 +28,7 @@
import org.junit.runner.RunWith;
import org.mockito.Spy;
import org.mockito.runners.MockitoJUnitRunner;
+
import org.springframework.amqp.core.MessageProperties;
import org.springframework.amqp.support.converter.JsonMessageConverterTests.Foo;
@@ -47,7 +48,8 @@
public void shouldThrowAnExceptionWhenClassIdNotPresent() {
try {
classMapper.toClass(props);
- } catch (MessageConversionException e) {
+ }
+ catch (MessageConversionException e) {
String classIdFieldName = classMapper.getClassIdFieldName();
assertThat(e.getMessage(), containsString("Could not resolve "
+ classIdFieldName + " in header"));
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2013 the original author or authors. Licensed under the Apache License, Version 2.0 (the "License");
+ * Copyright 2002-2014 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,
@@ -8,25 +8,29 @@
*/
package org.springframework.amqp.support.converter;
-import com.fasterxml.jackson.databind.JavaType;
-import com.fasterxml.jackson.databind.type.CollectionType;
-import com.fasterxml.jackson.databind.type.MapType;
-import com.fasterxml.jackson.databind.type.TypeFactory;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.Matchers.containsString;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
+import static org.mockito.BDDMockito.given;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
import org.junit.Test;
-import static org.junit.matchers.JUnitMatchers.containsString;
import org.junit.runner.RunWith;
-import static org.mockito.BDDMockito.given;
import org.mockito.Spy;
import org.mockito.runners.MockitoJUnitRunner;
+
import org.springframework.amqp.core.MessageProperties;
+import com.fasterxml.jackson.databind.JavaType;
+import com.fasterxml.jackson.databind.type.CollectionType;
+import com.fasterxml.jackson.databind.type.MapType;
+import com.fasterxml.jackson.databind.type.TypeFactory;
+
/**
* @author James Carr
* @author Sam Nelson
@@ -40,10 +44,10 @@
private final MessageProperties properties = new MessageProperties();
@SuppressWarnings("rawtypes")
- private Class<ArrayList> containerClass = ArrayList.class;
+ private final Class<ArrayList> containerClass = ArrayList.class;
@SuppressWarnings("rawtypes")
- private Class<HashMap> mapClass = HashMap.class;
+ private final Class<HashMap> mapClass = HashMap.class;
@Test
public void shouldThrowAnExceptionWhenClassIdNotPresent() {
Oops, something went wrong.

0 comments on commit d5494f4

Please sign in to comment.