|
|
@ -74,8 +74,10 @@ public class JmsListenerAnnotationBeanPostProcessorTests { |
|
|
|
assertEquals("Wrong endpoint type", MethodJmsListenerEndpoint.class, endpoint.getClass()); |
|
|
|
assertEquals("Wrong endpoint type", MethodJmsListenerEndpoint.class, endpoint.getClass()); |
|
|
|
MethodJmsListenerEndpoint methodEndpoint = (MethodJmsListenerEndpoint) endpoint; |
|
|
|
MethodJmsListenerEndpoint methodEndpoint = (MethodJmsListenerEndpoint) endpoint; |
|
|
|
assertEquals(SimpleMessageListenerTestBean.class, methodEndpoint.getBean().getClass()); |
|
|
|
assertEquals(SimpleMessageListenerTestBean.class, methodEndpoint.getBean().getClass()); |
|
|
|
assertEquals(SimpleMessageListenerTestBean.class.getMethod("handleIt", String.class), methodEndpoint.getMethod()); |
|
|
|
assertEquals(SimpleMessageListenerTestBean.class.getMethod("handleIt", String.class), |
|
|
|
assertEquals(SimpleMessageListenerTestBean.class.getMethod("handleIt", String.class), methodEndpoint.getMostSpecificMethod()); |
|
|
|
methodEndpoint.getMethod()); |
|
|
|
|
|
|
|
assertEquals(SimpleMessageListenerTestBean.class.getMethod("handleIt", String.class), |
|
|
|
|
|
|
|
methodEndpoint.getMostSpecificMethod()); |
|
|
|
|
|
|
|
|
|
|
|
SimpleMessageListenerContainer listenerContainer = new SimpleMessageListenerContainer(); |
|
|
|
SimpleMessageListenerContainer listenerContainer = new SimpleMessageListenerContainer(); |
|
|
|
methodEndpoint.setupListenerContainer(listenerContainer); |
|
|
|
methodEndpoint.setupListenerContainer(listenerContainer); |
|
|
@ -99,8 +101,10 @@ public class JmsListenerAnnotationBeanPostProcessorTests { |
|
|
|
assertEquals("Wrong endpoint type", MethodJmsListenerEndpoint.class, endpoint.getClass()); |
|
|
|
assertEquals("Wrong endpoint type", MethodJmsListenerEndpoint.class, endpoint.getClass()); |
|
|
|
MethodJmsListenerEndpoint methodEndpoint = (MethodJmsListenerEndpoint) endpoint; |
|
|
|
MethodJmsListenerEndpoint methodEndpoint = (MethodJmsListenerEndpoint) endpoint; |
|
|
|
assertEquals(MetaAnnotationTestBean.class, methodEndpoint.getBean().getClass()); |
|
|
|
assertEquals(MetaAnnotationTestBean.class, methodEndpoint.getBean().getClass()); |
|
|
|
assertEquals(MetaAnnotationTestBean.class.getMethod("handleIt", String.class), methodEndpoint.getMethod()); |
|
|
|
assertEquals(MetaAnnotationTestBean.class.getMethod("handleIt", String.class), |
|
|
|
assertEquals(MetaAnnotationTestBean.class.getMethod("handleIt", String.class), methodEndpoint.getMostSpecificMethod()); |
|
|
|
methodEndpoint.getMethod()); |
|
|
|
|
|
|
|
assertEquals(MetaAnnotationTestBean.class.getMethod("handleIt", String.class), |
|
|
|
|
|
|
|
methodEndpoint.getMostSpecificMethod()); |
|
|
|
assertEquals("metaTestQueue", ((AbstractJmsListenerEndpoint) endpoint).getDestination()); |
|
|
|
assertEquals("metaTestQueue", ((AbstractJmsListenerEndpoint) endpoint).getDestination()); |
|
|
|
} |
|
|
|
} |
|
|
|
finally { |
|
|
|
finally { |
|
|
@ -121,12 +125,14 @@ public class JmsListenerAnnotationBeanPostProcessorTests { |
|
|
|
MethodJmsListenerEndpoint methodEndpoint = (MethodJmsListenerEndpoint) endpoint; |
|
|
|
MethodJmsListenerEndpoint methodEndpoint = (MethodJmsListenerEndpoint) endpoint; |
|
|
|
assertTrue(AopUtils.isJdkDynamicProxy(methodEndpoint.getBean())); |
|
|
|
assertTrue(AopUtils.isJdkDynamicProxy(methodEndpoint.getBean())); |
|
|
|
assertTrue(methodEndpoint.getBean() instanceof SimpleService); |
|
|
|
assertTrue(methodEndpoint.getBean() instanceof SimpleService); |
|
|
|
assertEquals(SimpleService.class.getMethod("handleIt", String.class, String.class), methodEndpoint.getMethod()); |
|
|
|
assertEquals(SimpleService.class.getMethod("handleIt", String.class, String.class), |
|
|
|
assertEquals(InterfaceProxyTestBean.class.getMethod("handleIt", String.class, String.class), methodEndpoint.getMostSpecificMethod()); |
|
|
|
methodEndpoint.getMethod()); |
|
|
|
|
|
|
|
assertEquals(InterfaceProxyTestBean.class.getMethod("handleIt", String.class, String.class), |
|
|
|
Method m = ReflectionUtils.findMethod(endpoint.getClass(), "getDefaultResponseDestination"); |
|
|
|
methodEndpoint.getMostSpecificMethod()); |
|
|
|
ReflectionUtils.makeAccessible(m); |
|
|
|
|
|
|
|
Object destination = ReflectionUtils.invokeMethod(m, endpoint); |
|
|
|
Method method = ReflectionUtils.findMethod(endpoint.getClass(), "getDefaultResponseDestination"); |
|
|
|
|
|
|
|
ReflectionUtils.makeAccessible(method); |
|
|
|
|
|
|
|
Object destination = ReflectionUtils.invokeMethod(method, endpoint); |
|
|
|
assertEquals("SendTo annotation not found on proxy", "foobar", destination); |
|
|
|
assertEquals("SendTo annotation not found on proxy", "foobar", destination); |
|
|
|
} |
|
|
|
} |
|
|
|
finally { |
|
|
|
finally { |
|
|
@ -147,12 +153,14 @@ public class JmsListenerAnnotationBeanPostProcessorTests { |
|
|
|
MethodJmsListenerEndpoint methodEndpoint = (MethodJmsListenerEndpoint) endpoint; |
|
|
|
MethodJmsListenerEndpoint methodEndpoint = (MethodJmsListenerEndpoint) endpoint; |
|
|
|
assertTrue(AopUtils.isCglibProxy(methodEndpoint.getBean())); |
|
|
|
assertTrue(AopUtils.isCglibProxy(methodEndpoint.getBean())); |
|
|
|
assertTrue(methodEndpoint.getBean() instanceof ClassProxyTestBean); |
|
|
|
assertTrue(methodEndpoint.getBean() instanceof ClassProxyTestBean); |
|
|
|
assertEquals(ClassProxyTestBean.class.getMethod("handleIt", String.class, String.class), methodEndpoint.getMethod()); |
|
|
|
assertEquals(ClassProxyTestBean.class.getMethod("handleIt", String.class, String.class), |
|
|
|
assertEquals(ClassProxyTestBean.class.getMethod("handleIt", String.class, String.class), methodEndpoint.getMostSpecificMethod()); |
|
|
|
methodEndpoint.getMethod()); |
|
|
|
|
|
|
|
assertEquals(ClassProxyTestBean.class.getMethod("handleIt", String.class, String.class), |
|
|
|
Method m = ReflectionUtils.findMethod(endpoint.getClass(), "getDefaultResponseDestination"); |
|
|
|
methodEndpoint.getMostSpecificMethod()); |
|
|
|
ReflectionUtils.makeAccessible(m); |
|
|
|
|
|
|
|
Object destination = ReflectionUtils.invokeMethod(m, endpoint); |
|
|
|
Method method = ReflectionUtils.findMethod(endpoint.getClass(), "getDefaultResponseDestination"); |
|
|
|
|
|
|
|
ReflectionUtils.makeAccessible(method); |
|
|
|
|
|
|
|
Object destination = ReflectionUtils.invokeMethod(method, endpoint); |
|
|
|
assertEquals("SendTo annotation not found on proxy", "foobar", destination); |
|
|
|
assertEquals("SendTo annotation not found on proxy", "foobar", destination); |
|
|
|
} |
|
|
|
} |
|
|
|
finally { |
|
|
|
finally { |
|
|
@ -201,8 +209,8 @@ public class JmsListenerAnnotationBeanPostProcessorTests { |
|
|
|
@Bean |
|
|
|
@Bean |
|
|
|
public JmsListenerAnnotationBeanPostProcessor postProcessor() { |
|
|
|
public JmsListenerAnnotationBeanPostProcessor postProcessor() { |
|
|
|
JmsListenerAnnotationBeanPostProcessor postProcessor = new JmsListenerAnnotationBeanPostProcessor(); |
|
|
|
JmsListenerAnnotationBeanPostProcessor postProcessor = new JmsListenerAnnotationBeanPostProcessor(); |
|
|
|
postProcessor.setEndpointRegistry(jmsListenerEndpointRegistry()); |
|
|
|
|
|
|
|
postProcessor.setContainerFactoryBeanName("testFactory"); |
|
|
|
postProcessor.setContainerFactoryBeanName("testFactory"); |
|
|
|
|
|
|
|
postProcessor.setEndpointRegistry(jmsListenerEndpointRegistry()); |
|
|
|
return postProcessor; |
|
|
|
return postProcessor; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|