KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > inversoft > verge > mvc > controller > form > test > TestActionHandler2


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.controller.form.test;
8
9
10 import junit.framework.Assert;
11
12 import com.inversoft.junit.internal.http.MockHttpServletRequest;
13 import com.inversoft.verge.mvc.controller.form.FormAction;
14
15
16 /**
17  * <p>
18  * This class is a test action handler
19  * </p>
20  *
21  * @author Brian Pontarelli
22  */

23 public class TestActionHandler2 {
24
25     public static boolean pre = false;
26     public static boolean post = false;
27     public static boolean longTxn = false;
28
29
30     /**
31      * Instantiates a new <code>TestActionHandler</code>
32      */

33     public TestActionHandler2() {
34     }
35
36     
37     public void preHandle(FormAction action) {
38         pre = true;
39     }
40
41     public String JavaDoc handleTestPreAndPost(FormAction formAction) {
42         return "foo";
43     }
44
45     public String JavaDoc handleTestLongTxn(FormAction formAction) {
46         MockHttpServletRequest request = (MockHttpServletRequest)
47             formAction.getHttpServletRequest();
48         Assert.assertEquals("/longTxnWait.jsp", request.getRequestDispatcher().getURL());
49         
50         return "doneLongTxn";
51     }
52
53     public void postHandle(FormAction action, Object JavaDoc result) {
54         post = true;
55         
56         if (!longTxn) {
57             Assert.assertSame("foo", result);
58         }
59     }
60 }
Popular Tags