View Javadoc

1   /*
2    * $Id: DefaultRetryPolicyTestCase.java 22161 2011-06-09 17:26:53Z tcarlson $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.config.spring.handlers;
12  
13  import org.mule.api.config.MuleProperties;
14  import org.mule.api.retry.RetryPolicyTemplate;
15  import org.mule.api.transport.Connector;
16  import org.mule.retry.policies.SimpleRetryPolicyTemplate;
17  import org.mule.tck.FunctionalTestCase;
18  
19  public class DefaultRetryPolicyTestCase extends FunctionalTestCase
20  {
21      protected String getConfigResources()
22      {
23          return "org/mule/config/spring/handlers/default-retry-policy.xml";
24      }
25  
26      public void testPolicyRegistration() throws Exception
27      {
28          Object obj = muleContext.getRegistry().lookupObject(MuleProperties.OBJECT_DEFAULT_RETRY_POLICY_TEMPLATE);
29          assertNotNull(obj);
30          assertTrue(obj.getClass().getName(), obj instanceof SimpleRetryPolicyTemplate);
31          assertEquals(3, ((SimpleRetryPolicyTemplate) obj).getCount());
32      }
33      
34      public void testConnectorPolicy() throws Exception
35      {
36          Connector c = muleContext.getRegistry().lookupConnector("testConnector");
37          assertNotNull(c);
38  
39          RetryPolicyTemplate rpf = c.getRetryPolicyTemplate();
40          assertNotNull(rpf);
41          assertTrue(rpf instanceof SimpleRetryPolicyTemplate);
42          assertEquals(3, ((SimpleRetryPolicyTemplate) rpf).getCount());
43          
44          assertTrue(c.isConnected());
45          assertTrue(c.isStarted());
46      }
47  }