View Javadoc

1   /*
2    * $Id: TestRetryPolicyTemplate.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.retry.RetryPolicy;
14  import org.mule.retry.PolicyStatus;
15  import org.mule.retry.policies.AbstractPolicyTemplate;
16  
17  import java.util.List;
18  
19  public class TestRetryPolicyTemplate extends AbstractPolicyTemplate
20  {
21      protected boolean fooBar = false;
22      protected int revolutions = 200;
23      protected List connectionUrls;
24  
25      public TestRetryPolicyTemplate()
26      {
27          super();
28      }
29  
30      public TestRetryPolicyTemplate(boolean fooBar, int revolutions)
31      {
32          super();
33          this.fooBar = fooBar;
34          this.revolutions = revolutions;
35      }
36  
37      public RetryPolicy createRetryInstance()
38      {
39          return new TestRetryPolicy(fooBar, revolutions);
40      }
41  
42      protected static class TestRetryPolicy implements RetryPolicy
43      {
44          protected boolean fooBar;
45          protected int revolutions;
46  
47          public TestRetryPolicy(boolean fooBar, int revolutions)
48          {
49              this.fooBar = fooBar;
50              this.revolutions = revolutions;
51          }
52          
53          public PolicyStatus applyPolicy(Throwable cause)
54          {
55              return PolicyStatus.policyExhausted(cause);
56          }
57      }
58  
59      public boolean isFooBar()
60      {
61          return fooBar;
62      }
63  
64      public void setFooBar(boolean fooBar)
65      {
66          this.fooBar = fooBar;
67      }
68  
69      public int getRevolutions()
70      {
71          return revolutions;
72      }
73  
74      public void setRevolutions(int revolutions)
75      {
76          this.revolutions = revolutions;
77      }
78  
79      public List getConnectionUrls()
80      {
81          return connectionUrls;
82      }
83  
84      public void setConnectionUrls(List connectionUrls)
85      {
86          this.connectionUrls = connectionUrls;
87      }
88  }