KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > struts > taglib > html > TestFrameTag2


1 /*
2  * $Id: TestFrameTag2.java 54929 2004-10-16 16:38:42Z germuska $
3  *
4  * Copyright 1999-2004 The Apache Software Foundation.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18 package org.apache.struts.taglib.html;
19
20 import java.util.Locale JavaDoc;
21
22 import javax.servlet.jsp.PageContext JavaDoc;
23 import junit.framework.Test;
24 import junit.framework.TestSuite;
25
26 import org.apache.cactus.JspTestCase;
27 import org.apache.struts.Globals;
28 import org.apache.struts.taglib.SimpleBeanForTesting;
29
30
31 /**
32  * Suite of unit tests for the
33  * <code>org.apache.struts.taglib.html.FrameTag</code> class.
34  *
35  */

36 public class TestFrameTag2 extends JspTestCase {
37
38     /**
39      * Defines the testcase name for JUnit.
40      *
41      * @param theName the testcase's name.
42      */

43     public TestFrameTag2(String JavaDoc theName) {
44         super(theName);
45     }
46
47     /**
48      * Start the tests.
49      *
50      * @param theArgs the arguments. Not used
51      */

52     public static void main(String JavaDoc[] theArgs) {
53         junit.awtui.TestRunner.main(new String JavaDoc[] {TestFrameTag2.class.getName()});
54     }
55
56     /**
57      * @return a test suite (<code>TestSuite</code>) that includes all methods
58      * starting with "test"
59      */

60     public static Test suite() {
61         // All methods starting with "test" will be executed in the test suite.
62
return new TestSuite(TestFrameTag2.class);
63     }
64
65     private void runMyTest(String JavaDoc whichTest, String JavaDoc locale) throws Exception JavaDoc {
66         pageContext.setAttribute(Globals.LOCALE_KEY, new Locale JavaDoc(locale, locale), PageContext.SESSION_SCOPE);
67         pageContext.setAttribute(Constants.BEAN_KEY, new SimpleBeanForTesting("Test Value"), PageContext.REQUEST_SCOPE);
68         request.setAttribute("runTest", whichTest);
69         pageContext.forward("/test/org/apache/struts/taglib/html/TestFrameTag2.jsp");
70     }
71
72     /*
73      * Testing FrameTag.
74      */

75
76 //--------Testing attributes using forward------
77
public void testFrameForwardParamIdParamNameNoScope() throws Exception JavaDoc {
78                 pageContext.setAttribute("paramName", "paramValue", PageContext.REQUEST_SCOPE);
79         runMyTest("testFrameForwardParamIdParamNameNoScope", "");
80     }
81
82     public void testFrameForwardParamIdParamNameParamPropertyNoScope() throws Exception JavaDoc {
83         SimpleBeanForTesting sbft = new SimpleBeanForTesting("paramPropertyValue");
84                 pageContext.setAttribute("testingParamProperty", sbft, PageContext.REQUEST_SCOPE);
85         runMyTest("testFrameForwardParamIdParamNameParamPropertyNoScope", "");
86     }
87
88     public void testFrameForwardParamIdParamNameApplicationScope() throws Exception JavaDoc {
89                 pageContext.setAttribute("paramName", "paramValue", PageContext.APPLICATION_SCOPE);
90         runMyTest("testFrameForwardParamIdParamNameApplicationScope", "");
91     }
92
93     public void testFrameForwardParamIdParamNameParamPropertyApplicationScope() throws Exception JavaDoc {
94         SimpleBeanForTesting sbft = new SimpleBeanForTesting("paramPropertyValue");
95                 pageContext.setAttribute("testingParamProperty", sbft, PageContext.APPLICATION_SCOPE);
96         runMyTest("testFrameForwardParamIdParamNameParamPropertyApplicationScope", "");
97     }
98
99     public void testFrameForwardParamIdParamNameSessionScope() throws Exception JavaDoc {
100                 pageContext.setAttribute("paramName", "paramValue", PageContext.SESSION_SCOPE);
101         runMyTest("testFrameForwardParamIdParamNameSessionScope", "");
102     }
103
104     public void testFrameForwardParamIdParamNameParamPropertySessionScope() throws Exception JavaDoc {
105         SimpleBeanForTesting sbft = new SimpleBeanForTesting("paramPropertyValue");
106                 pageContext.setAttribute("testingParamProperty", sbft, PageContext.SESSION_SCOPE);
107         runMyTest("testFrameForwardParamIdParamNameParamPropertySessionScope", "");
108     }
109
110     public void testFrameForwardParamIdParamNameRequestScope() throws Exception JavaDoc {
111                 pageContext.setAttribute("paramName", "paramValue", PageContext.REQUEST_SCOPE);
112         runMyTest("testFrameForwardParamIdParamNameRequestScope", "");
113     }
114
115     public void testFrameForwardParamIdParamNameParamPropertyRequestScope() throws Exception JavaDoc {
116         SimpleBeanForTesting sbft = new SimpleBeanForTesting("paramPropertyValue");
117                 pageContext.setAttribute("testingParamProperty", sbft, PageContext.REQUEST_SCOPE);
118         runMyTest("testFrameForwardParamIdParamNameParamPropertyRequestScope", "");
119     }
120
121     public void testFrameForwardScrolling1() throws Exception JavaDoc {
122         runMyTest("testFrameForwardScrolling1", "");
123     }
124
125     public void testFrameForwardScrolling2() throws Exception JavaDoc {
126         runMyTest("testFrameForwardScrolling2", "");
127     }
128
129     public void testFrameForwardScrolling3() throws Exception JavaDoc {
130         runMyTest("testFrameForwardScrolling3", "");
131     }
132
133     public void testFrameForwardScrolling4() throws Exception JavaDoc {
134         runMyTest("testFrameForwardScrolling4", "");
135     }
136
137     public void testFrameForwardScrolling5() throws Exception JavaDoc {
138         runMyTest("testFrameForwardScrolling5", "");
139     }
140
141     public void testFrameForwardScrolling6() throws Exception JavaDoc {
142         runMyTest("testFrameForwardScrolling6", "");
143     }
144
145     public void testFrameForwardScrolling7() throws Exception JavaDoc {
146         runMyTest("testFrameForwardScrolling7", "");
147     }
148
149     public void testFrameForwardScrolling8() throws Exception JavaDoc {
150         runMyTest("testFrameForwardScrolling8", "");
151     }
152
153     public void testFrameForwardScrolling9() throws Exception JavaDoc {
154         runMyTest("testFrameForwardScrolling9", "");
155     }
156
157     public void testFrameForwardScrolling10() throws Exception JavaDoc {
158         runMyTest("testFrameForwardScrolling10", "");
159     }
160
161     public void testFrameForwardStyle() throws Exception JavaDoc {
162         runMyTest("testFrameForwardStyle", "");
163     }
164
165     public void testFrameForwardTitle() throws Exception JavaDoc {
166         runMyTest("testFrameForwardTitle", "");
167     }
168
169     public void testFrameForwardTitleKey() throws Exception JavaDoc {
170         runMyTest("testFrameForwardTitleKey", "");
171     }
172     public void testFrameForwardTitleKeyAlt() throws Exception JavaDoc {
173         runMyTest("testFrameForwardTitleKeyAlt", "");
174     }
175
176     public void testFrameForwardTransaction() throws Exception JavaDoc {
177         pageContext.setAttribute(Globals.TRANSACTION_TOKEN_KEY, "Some_Token_Here", PageContext.SESSION_SCOPE);
178         runMyTest("testFrameForwardTransaction", "");
179     }
180
181
182
183
184
185 }
186
Popular Tags