Search in sources :

Example 6 with DefaultRetryState

use of org.springframework.retry.support.DefaultRetryState in project spring-integration by spring-projects.

the class SpelExpressionRetryStateGeneratorTests method testForceRefreshElvis.

@Test
public void testForceRefreshElvis() {
    SpelExpressionRetryStateGenerator generator = new SpelExpressionRetryStateGenerator("headers['foo']", "headers['noHeader']?:true");
    RetryState state = generator.determineRetryState(message);
    assertEquals("bar", state.getKey());
    assertTrue(((DefaultRetryState) state).isForceRefresh());
    assertTrue(state.rollbackFor(new RuntimeException()));
}
Also used : DefaultRetryState(org.springframework.retry.support.DefaultRetryState) RetryState(org.springframework.retry.RetryState) Test(org.junit.Test)

Example 7 with DefaultRetryState

use of org.springframework.retry.support.DefaultRetryState in project spring-integration by spring-projects.

the class SpelExpressionRetryStateGeneratorTests method testClassifier.

@Test
public void testClassifier() {
    SpelExpressionRetryStateGenerator generator = new SpelExpressionRetryStateGenerator("headers['foo']");
    generator.setClassifier(new ClassifierSupport<Throwable, Boolean>(false));
    RetryState state = generator.determineRetryState(message);
    assertEquals("bar", state.getKey());
    assertFalse(((DefaultRetryState) state).isForceRefresh());
    assertFalse(state.rollbackFor(new RuntimeException()));
}
Also used : DefaultRetryState(org.springframework.retry.support.DefaultRetryState) RetryState(org.springframework.retry.RetryState) Test(org.junit.Test)

Example 8 with DefaultRetryState

use of org.springframework.retry.support.DefaultRetryState in project spring-integration by spring-projects.

the class SpelExpressionRetryStateGeneratorTests method testBasicConfig.

@Test
public void testBasicConfig() {
    RetryState state = configGenerator.determineRetryState(message);
    assertEquals("bar", state.getKey());
    assertFalse(((DefaultRetryState) state).isForceRefresh());
    assertTrue(state.rollbackFor(new RuntimeException()));
}
Also used : DefaultRetryState(org.springframework.retry.support.DefaultRetryState) RetryState(org.springframework.retry.RetryState) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)8 DefaultRetryState (org.springframework.retry.support.DefaultRetryState)8 RetryState (org.springframework.retry.RetryState)6 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)2 QueueChannel (org.springframework.integration.channel.QueueChannel)2 AbstractReplyProducingMessageHandler (org.springframework.integration.handler.AbstractReplyProducingMessageHandler)2 AdviceMessage (org.springframework.integration.message.AdviceMessage)2 Message (org.springframework.messaging.Message)2 ErrorMessage (org.springframework.messaging.support.ErrorMessage)2 GenericMessage (org.springframework.messaging.support.GenericMessage)2 ArrayList (java.util.ArrayList)1 Advice (org.aopalliance.aop.Advice)1 Matchers.containsString (org.hamcrest.Matchers.containsString)1 BeanFactory (org.springframework.beans.factory.BeanFactory)1 MessageHandlingExpressionEvaluatingAdviceException (org.springframework.integration.handler.advice.ExpressionEvaluatingRequestHandlerAdvice.MessageHandlingExpressionEvaluatingAdviceException)1 MessageHandlingException (org.springframework.messaging.MessageHandlingException)1 MessagingException (org.springframework.messaging.MessagingException)1