public class RabbitListenerTestHarness
extends org.springframework.amqp.rabbit.annotation.RabbitListenerAnnotationBeanPostProcessor
RabbitListenerAnnotationBeanPostProcessor.
Wraps the listener bean in a CGLIB proxy with an advice to capture the arguments
and result (if any) in a blocking queue. Test cases can access the results
by autowiring the test harness into test cases.| Modifier and Type | Class and Description |
|---|---|
static class |
RabbitListenerTestHarness.InvocationData |
| Constructor and Description |
|---|
RabbitListenerTestHarness(org.springframework.core.type.AnnotationMetadata importMetadata) |
| Modifier and Type | Method and Description |
|---|---|
<T> T |
getDelegate(java.lang.String id)
Get the actual listener object (not the spy).
|
<T> LambdaAnswer<T> |
getLambdaAnswerFor(java.lang.String id,
boolean callRealMethod,
LambdaAnswer.ValueToReturn<T> callback)
Return a
LambdaAnswer that is properly configured to invoke the listener. |
LatchCountDownAndCallRealMethodAnswer |
getLatchAnswerFor(java.lang.String id,
int count)
Return a
LatchCountDownAndCallRealMethodAnswer that is properly configured
to invoke the listener. |
RabbitListenerTestHarness.InvocationData |
getNextInvocationDataFor(java.lang.String id,
long wait,
java.util.concurrent.TimeUnit unit) |
<T> T |
getSpy(java.lang.String id) |
protected java.util.Collection<org.springframework.amqp.core.Declarable> |
processListener(org.springframework.amqp.rabbit.listener.MethodRabbitListenerEndpoint endpoint,
org.springframework.amqp.rabbit.annotation.RabbitListener rabbitListener,
java.lang.Object bean,
java.lang.Object target,
java.lang.String beanName) |
afterSingletonsInstantiated, assertBeanFactory, getOrder, noBeanFoundMessage, postProcessAfterInitialization, postProcessBeforeInitialization, processAmqpListener, resolveExpressionAsString, setBeanClassLoader, setBeanFactory, setCharset, setContainerFactoryBeanName, setEndpointRegistry, setEnvironment, setMessageHandlerMethodFactorypublic RabbitListenerTestHarness(org.springframework.core.type.AnnotationMetadata importMetadata)
protected java.util.Collection<org.springframework.amqp.core.Declarable> processListener(org.springframework.amqp.rabbit.listener.MethodRabbitListenerEndpoint endpoint,
org.springframework.amqp.rabbit.annotation.RabbitListener rabbitListener,
java.lang.Object bean,
java.lang.Object target,
java.lang.String beanName)
processListener in class org.springframework.amqp.rabbit.annotation.RabbitListenerAnnotationBeanPostProcessorpublic LatchCountDownAndCallRealMethodAnswer getLatchAnswerFor(java.lang.String id, int count)
LatchCountDownAndCallRealMethodAnswer that is properly configured
to invoke the listener.id - the listener id.count - the count.public <T> LambdaAnswer<T> getLambdaAnswerFor(java.lang.String id, boolean callRealMethod, LambdaAnswer.ValueToReturn<T> callback)
LambdaAnswer that is properly configured to invoke the listener.T - the return type.id - the listener id.callRealMethod - true to call the real method.callback - the callback.public RabbitListenerTestHarness.InvocationData getNextInvocationDataFor(java.lang.String id, long wait, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
java.lang.InterruptedExceptionpublic <T> T getSpy(java.lang.String id)
public <T> T getDelegate(java.lang.String id)
T - the type.id - the id.