KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jacorb > test > notification > engine > AlwaysDisposeRetryStrategyTest


1 /*
2  * JacORB - a free Java ORB
3  *
4  * Copyright (C) 1999-2004 Gerald Brose
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the Free
18  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19  *
20  */

21
22 package org.jacorb.test.notification.engine;
23
24 import junit.framework.Test;
25 import junit.framework.TestSuite;
26
27 import org.jacorb.notification.engine.AlwaysDisposeRetryStrategy;
28 import org.jacorb.notification.engine.AbstractRetryStrategy;
29
30 /**
31  * @author Alphonse Bendt
32  * @version $Id: AlwaysDisposeRetryStrategyTest.java,v 1.2 2005/04/17 17:18:30 alphonse.bendt Exp $
33  */

34 public class AlwaysDisposeRetryStrategyTest extends AbstractRetryStrategyTest
35 {
36     /**
37      * Constructor for NoRetryRetryStrategyTest.
38      *
39      * @param name
40      */

41     public AlwaysDisposeRetryStrategyTest(String JavaDoc name)
42     {
43         super(name);
44     }
45
46     public void testRetryDisposesOperationAndConsumer() throws Exception JavaDoc
47     {
48         mockConsumer_.isRetryAllowed();
49         controlConsumer_.setDefaultReturnValue(true);
50
51         mockConsumer_.destroy();
52         controlConsumer_.replay();
53
54         mockPushOperation_.dispose();
55         controlPushOperation_.replay();
56
57         objectUnderTest_.retry();
58
59         controlConsumer_.verify();
60         controlPushOperation_.verify();
61     }
62     
63     public void testRetryAllowedDisposesPushOperation() throws Exception JavaDoc
64     {
65         mockPushOperation_.dispose();
66         
67         controlPushOperation_.replay();
68         
69         mockConsumer_.isRetryAllowed();
70         controlConsumer_.setDefaultReturnValue(true);
71         
72         controlConsumer_.replay();
73       
74         objectUnderTest_.retry();
75         
76         controlPushOperation_.verify();
77     }
78
79     protected void setUpTest()
80     {
81         // no op
82
}
83
84     protected AbstractRetryStrategy newRetryStrategy()
85     {
86         return new AlwaysDisposeRetryStrategy(mockConsumer_, mockPushOperation_);
87     }
88
89     
90     public static Test suite()
91     {
92         return new TestSuite(AlwaysDisposeRetryStrategyTest.class);
93     }
94 }
95
Popular Tags