View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.transport.jms;
8   
9   import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit;
10  import org.junit.Test;
11  
12  import static org.junit.Assert.assertFalse;
13  import static org.junit.Assert.assertTrue;
14  
15  public class JmsInfiniteRedeliveryTestCase extends AbstractJmsRedeliveryTestCase
16  {
17  
18      public static final int DEFAULT_REDELIVERY = 6;
19  
20      public JmsInfiniteRedeliveryTestCase(ConfigVariant variant, String configResources)
21      {
22          super(variant, configResources);
23      }
24  
25      @Override
26      protected int getMaxRedelivery()
27      {
28          return JmsConnector.REDELIVERY_IGNORE;
29      }
30  
31      @Test
32      public void testInfiniteRedelivery() throws Exception
33      {
34          client.dispatch(JMS_INPUT_QUEUE, TEST_MESSAGE, null);
35  
36          assertFalse(messageRedeliveryExceptionFired.await(timeout, TimeUnit.MILLISECONDS));
37          assertTrue(callback.getCallbackCount() > DEFAULT_REDELIVERY + 1);
38          assertNoMessageInDlq("jms://dead.letter");
39      }
40  }