KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > inversoft > verge > mvc > test > LongTxnActionHandler


1 /*
2  * Copyright (c) 2003, Inversoft
3  *
4  * This software is distribuable under the GNU Lesser General Public License.
5  * For more information visit gnu.org.
6  */

7 package com.inversoft.verge.mvc.test;
8
9
10 import junit.framework.Assert;
11
12 import com.inversoft.junit.internal.http.MockHttpServletRequest;
13 import com.inversoft.verge.mvc.controller.actionflow.ActionFlowAction;
14 import com.inversoft.verge.mvc.controller.form.FormAction;
15
16
17 /**
18  * <p>
19  * This class is a testing action handler for long txn
20  * support.
21  * </p>
22  *
23  * @author Brian Pontarelli
24  */

25 public class LongTxnActionHandler {
26
27     public String JavaDoc handleStart(ActionFlowAction action) {
28         return "action1";
29     }
30
31     public String JavaDoc handleAction1(ActionFlowAction action) {
32         MockHttpServletRequest request = (MockHttpServletRequest)
33             action.getHttpServletRequest();
34         Assert.assertNotNull("Should have gotten dispatcher", request.getRequestDispatcher());
35         Assert.assertEquals("/longTxn1.jsp", request.getRequestDispatcher().getURL());
36
37         return "action2";
38     }
39
40     public String JavaDoc handleAction2(ActionFlowAction action) {
41         MockHttpServletRequest request = (MockHttpServletRequest)
42             action.getHttpServletRequest();
43         Assert.assertEquals("/longTxn1.jsp", request.getRequestDispatcher().getURL());
44
45         return "action3";
46     }
47
48     public String JavaDoc handleAction3(ActionFlowAction action) {
49         MockHttpServletRequest request = (MockHttpServletRequest)
50             action.getHttpServletRequest();
51         Assert.assertNull(request.getRequestDispatcher().getURL());
52
53         return "action4";
54     }
55
56     public String JavaDoc handleAction4(ActionFlowAction action) {
57         MockHttpServletRequest request = (MockHttpServletRequest)
58             action.getHttpServletRequest();
59         //Assert.assertNull(request.getRequestDispatcher());
60
Assert.assertNull(request.getRequestDispatcher().getURL());
61
62         return "action5";
63     }
64
65     public String JavaDoc handleAction5(ActionFlowAction action) {
66         MockHttpServletRequest request = (MockHttpServletRequest)
67             action.getHttpServletRequest();
68         Assert.assertEquals("/longTxn1.jsp", request.getRequestDispatcher().getURL());
69
70         return "action6";
71     }
72
73     public String JavaDoc handleAction6(ActionFlowAction action) {
74         MockHttpServletRequest request = (MockHttpServletRequest)
75             action.getHttpServletRequest();
76         Assert.assertEquals("/longTxn1.jsp", request.getRequestDispatcher().getURL());
77
78         return "action7";
79     }
80
81     public String JavaDoc handleFormBasedLongTxn(FormAction action) {
82         MockHttpServletRequest request = (MockHttpServletRequest)
83             action.getHttpServletRequest();
84         Assert.assertEquals("/longTxnStart.jsp", request.getRequestDispatcher().getURL());
85
86         return "success";
87     }
88 }
Popular Tags