INT-3458: Compatibility with Spring Framework 4.1

JIRA: https://jira.spring.io/browse/INT-3458

* Change Spring AMQP to `1.3.5.RELEASE`
* `HttpRequestHandlingEndpointSupport`: remove `MappingJacksonHttpMessageConverter` registration
* `IntegrationRequestMappingHandlerMapping`: add 'fake' `name()` attribute to the inline `RequestMapping` annotation
* `StoredProcJmxManagedBeanTests`: remove `context.stop();` code, Since `MBeanExporter` deregister MBeans on `stop()` now
* `StoredProcPollingChannelAdapterParserTests`: change deprecated `ParameterizedSingleColumnRowMapper` to the `SingleColumnRowMapper`
* `Jms`: comment out the reflection code to check the value for the `recoveryInterval`, because it is removed already in favor of `backOff`
* `NotificationListeningMessageProducer`: move the start-up listener registration to the `onApplicationEvent`,
because `MBeanExporter` moved `registerBeans()` to the `start()` now.
The same `phase` might cause the issue, that MBeans aren't registered yet for `NotificationListeningMessageProducer`
* `JpaOutboundGatewayTests`: change `@TransactionConfiguration` to the `@Transactional`. Don't know why the first doesn't work now.

**Cherry-pick to 4.0.x**

INT-3458: Addressing PR comments

`NotificationListeningMessageProducer`: defer listener registration until `onApplicationEvent()`
This commit is contained in:
Artem Bilan
2014-06-30 19:38:03 +03:00
committed by Gary Russell
parent 5aee3c85ba
commit c92d7a5da9
15 changed files with 170 additions and 163 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2011 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.
@@ -16,10 +16,7 @@
package org.springframework.integration.jms.config;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.*;
import java.util.Properties;
@@ -27,11 +24,11 @@ import javax.jms.ConnectionFactory;
import javax.jms.DeliveryMode;
import org.junit.Test;
import org.springframework.beans.DirectFieldAccessor;
import org.springframework.beans.NotReadablePropertyException;
import org.springframework.beans.factory.BeanDefinitionStoreException;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.messaging.Message;
import org.springframework.messaging.PollableChannel;
import org.springframework.integration.history.MessageHistory;
import org.springframework.integration.jms.JmsMessageDrivenEndpoint;
import org.springframework.integration.test.util.TestUtils;
@@ -40,6 +37,8 @@ import org.springframework.jms.core.JmsTemplate;
import org.springframework.jms.listener.AbstractMessageListenerContainer;
import org.springframework.jms.listener.DefaultMessageListenerContainer;
import org.springframework.jms.support.destination.JmsDestinationAccessor;
import org.springframework.messaging.Message;
import org.springframework.messaging.PollableChannel;
/**
* @author Mark Fisher
@@ -259,7 +258,14 @@ public class JmsInboundGatewayParserTests {
gateway.start();
AbstractMessageListenerContainer container = (AbstractMessageListenerContainer)
new DirectFieldAccessor(gateway).getPropertyValue("listenerContainer");
assertEquals(2222L, new DirectFieldAccessor(container).getPropertyValue("recoveryInterval"));
Object recoveryInterval;
try {
recoveryInterval = TestUtils.getPropertyValue(container, "recoveryInterval");
}
catch (NotReadablePropertyException e) {
recoveryInterval = TestUtils.getPropertyValue(container, "backOff.interval");
}
assertEquals(2222L, recoveryInterval);
gateway.stop();
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 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.
@@ -16,15 +16,14 @@
package org.springframework.integration.jms.config;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.*;
import java.util.Properties;
import org.junit.Test;
import org.springframework.beans.DirectFieldAccessor;
import org.springframework.beans.NotReadablePropertyException;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.integration.history.MessageHistory;
import org.springframework.integration.jms.JmsMessageDrivenEndpoint;
@@ -121,7 +120,14 @@ public class JmsMessageDrivenChannelAdapterParserTests {
adapter.start();
AbstractMessageListenerContainer container = (AbstractMessageListenerContainer)
new DirectFieldAccessor(adapter).getPropertyValue("listenerContainer");
assertEquals(2222L, new DirectFieldAccessor(container).getPropertyValue("recoveryInterval"));
Object recoveryInterval;
try {
recoveryInterval = TestUtils.getPropertyValue(container, "recoveryInterval");
}
catch (NotReadablePropertyException e) {
recoveryInterval = TestUtils.getPropertyValue(container, "backOff.interval");
}
assertEquals(2222L, recoveryInterval);
adapter.stop();
context.close();
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 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.
@@ -16,17 +16,8 @@
package org.springframework.integration.jms.config;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.junit.Assert.*;
import static org.mockito.Mockito.*;
import java.lang.reflect.Method;
import java.util.Properties;
@@ -38,10 +29,13 @@ import javax.jms.Session;
import org.junit.Test;
import org.mockito.Mockito;
import org.springframework.beans.DirectFieldAccessor;
import org.springframework.beans.NotReadablePropertyException;
import org.springframework.beans.factory.parsing.BeanDefinitionParsingException;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.expression.Expression;
import org.springframework.integration.core.MessagingTemplate;
import org.springframework.integration.endpoint.EventDrivenConsumer;
import org.springframework.integration.endpoint.PollingConsumer;
import org.springframework.integration.handler.ExpressionEvaluatingMessageProcessor;
@@ -49,7 +43,6 @@ import org.springframework.integration.handler.advice.AbstractRequestHandlerAdvi
import org.springframework.integration.history.MessageHistory;
import org.springframework.integration.jms.JmsOutboundGateway;
import org.springframework.integration.jms.StubMessageConverter;
import org.springframework.messaging.support.GenericMessage;
import org.springframework.integration.support.MessageBuilder;
import org.springframework.integration.test.util.TestUtils;
import org.springframework.jms.listener.DefaultMessageListenerContainer;
@@ -59,7 +52,7 @@ import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.MessageHandler;
import org.springframework.messaging.MessagingException;
import org.springframework.messaging.SubscribableChannel;
import org.springframework.integration.core.MessagingTemplate;
import org.springframework.messaging.support.GenericMessage;
/**
* @author Jonas Partner
@@ -87,7 +80,15 @@ public class JmsOutboundGatewayParserTests {
assertEquals(5, TestUtils.getPropertyValue(container, "maxConcurrentConsumers"));
assertEquals(10, TestUtils.getPropertyValue(container, "maxMessagesPerTask"));
assertEquals(2000L, TestUtils.getPropertyValue(container, "receiveTimeout"));
assertEquals(10000L, TestUtils.getPropertyValue(container, "recoveryInterval"));
Object recoveryInterval;
try {
recoveryInterval = TestUtils.getPropertyValue(container, "recoveryInterval");
}
catch (NotReadablePropertyException e) {
recoveryInterval = TestUtils.getPropertyValue(container, "backOff.interval");
}
assertEquals(10000L, recoveryInterval);
assertEquals(7, TestUtils.getPropertyValue(container, "idleConsumerLimit"));
assertEquals(2, TestUtils.getPropertyValue(container, "idleTaskExecutionLimit"));
assertEquals(3, TestUtils.getPropertyValue(container, "cacheLevel"));