KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * $Id: TestFrameTag1.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.HashMap JavaDoc;
21 import java.util.Locale JavaDoc;
22
23
24 import javax.servlet.jsp.PageContext JavaDoc;
25 import junit.framework.Test;
26 import junit.framework.TestSuite;
27
28 import org.apache.cactus.JspTestCase;
29 import org.apache.struts.Globals;
30 import org.apache.struts.taglib.SimpleBeanForTesting;
31
32
33 /**
34  * Suite of unit tests for the
35  * <code>org.apache.struts.taglib.html.FrameTag</code> class.
36  *
37  */

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

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

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

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

76
77 //--------Testing attributes using forward------
78

79     public void testFrameForward() throws Exception JavaDoc {
80         runMyTest("testFrameForward", "");
81     }
82
83     public void testFrameForwardAnchor() throws Exception JavaDoc {
84         runMyTest("testFrameForwardAnchor", "");
85     }
86
87     public void testFrameForwardFrameborder() throws Exception JavaDoc {
88         runMyTest("testFrameForwardFrameborder", "");
89     }
90
91     public void testFrameForwardFrameName() throws Exception JavaDoc {
92         runMyTest("testFrameForwardFrameName", "");
93     }
94
95     public void testFrameForwardLongdesc() throws Exception JavaDoc {
96         runMyTest("testFrameForwardLongdesc", "");
97     }
98
99     public void testFrameForwardMarginheight() throws Exception JavaDoc {
100         runMyTest("testFrameForwardMarginheight", "");
101     }
102
103     public void testFrameForwardMarginwidth() throws Exception JavaDoc {
104         runMyTest("testFrameForwardMarginwidth", "");
105     }
106
107     public void testFrameForwardNameNoScope() throws Exception JavaDoc {
108                 HashMap JavaDoc map = new HashMap JavaDoc();
109                 map.put("param1","value1");
110                 map.put("param2","value2");
111                 map.put("param3","value3");
112                 map.put("param4","value4");
113                 pageContext.setAttribute("paramMap", map, PageContext.REQUEST_SCOPE);
114        runMyTest("testFrameForwardNameNoScope", "");
115     }
116
117     public void testFrameForwardNamePropertyNoScope() throws Exception JavaDoc {
118                 HashMap JavaDoc map = new HashMap JavaDoc();
119                 map.put("param1","value1");
120                 map.put("param2","value2");
121                 map.put("param3","value3");
122                 map.put("param4","value4");
123                 SimpleBeanForTesting sbft = new SimpleBeanForTesting(map);
124                 pageContext.setAttribute("paramPropertyMap", sbft, PageContext.REQUEST_SCOPE);
125        runMyTest("testFrameForwardNamePropertyNoScope", "");
126     }
127
128     public void testFrameForwardNameApplicationScope() throws Exception JavaDoc {
129                 HashMap JavaDoc map = new HashMap JavaDoc();
130                 map.put("param1","value1");
131                 map.put("param2","value2");
132                 map.put("param3","value3");
133                 map.put("param4","value4");
134                 pageContext.setAttribute("paramMap", map, PageContext.APPLICATION_SCOPE);
135        runMyTest("testFrameForwardNameApplicationScope", "");
136     }
137
138     public void testFrameForwardNamePropertyApplicationScope() throws Exception JavaDoc {
139                 HashMap JavaDoc map = new HashMap JavaDoc();
140                 map.put("param1","value1");
141                 map.put("param2","value2");
142                 map.put("param3","value3");
143                 map.put("param4","value4");
144                 SimpleBeanForTesting sbft = new SimpleBeanForTesting(map);
145                 pageContext.setAttribute("paramPropertyMap", sbft, PageContext.APPLICATION_SCOPE);
146        runMyTest("testFrameForwardNamePropertyApplicationScope", "");
147     }
148
149     public void testFrameForwardNameSessionScope() throws Exception JavaDoc {
150                 HashMap JavaDoc map = new HashMap JavaDoc();
151                 map.put("param1","value1");
152                 map.put("param2","value2");
153                 map.put("param3","value3");
154                 map.put("param4","value4");
155                 pageContext.setAttribute("paramMap", map, PageContext.SESSION_SCOPE);
156        runMyTest("testFrameForwardNameSessionScope", "");
157     }
158
159     public void testFrameForwardNamePropertySessionScope() throws Exception JavaDoc {
160                 HashMap JavaDoc map = new HashMap JavaDoc();
161                 map.put("param1","value1");
162                 map.put("param2","value2");
163                 map.put("param3","value3");
164                 map.put("param4","value4");
165                 SimpleBeanForTesting sbft = new SimpleBeanForTesting(map);
166                 pageContext.setAttribute("paramPropertyMap", sbft, PageContext.SESSION_SCOPE);
167        runMyTest("testFrameForwardNamePropertySessionScope", "");
168     }
169
170     public void testFrameForwardNameRequestScope() throws Exception JavaDoc {
171                 HashMap JavaDoc map = new HashMap JavaDoc();
172                 map.put("param1","value1");
173                 map.put("param2","value2");
174                 map.put("param3","value3");
175                 map.put("param4","value4");
176                 pageContext.setAttribute("paramMap", map, PageContext.REQUEST_SCOPE);
177        runMyTest("testFrameForwardNameRequestScope", "");
178     }
179
180     public void testFrameForwardNamePropertyRequestScope() throws Exception JavaDoc {
181                 HashMap JavaDoc map = new HashMap JavaDoc();
182                 map.put("param1","value1");
183                 map.put("param2","value2");
184                 map.put("param3","value3");
185                 map.put("param4","value4");
186                 SimpleBeanForTesting sbft = new SimpleBeanForTesting(map);
187                 pageContext.setAttribute("paramPropertyMap", sbft, PageContext.REQUEST_SCOPE);
188        runMyTest("testFrameForwardNamePropertyRequestScope", "");
189     }
190
191
192     public void testFrameForwardNoresize1() throws Exception JavaDoc {
193         runMyTest("testFrameForwardNoresize1", "");
194     }
195
196     public void testFrameForwardNoresize2() throws Exception JavaDoc {
197         runMyTest("testFrameForwardNoresize2", "");
198     }
199
200     public void testFrameForwardNoresize3() throws Exception JavaDoc {
201         runMyTest("testFrameForwardNoresize3", "");
202     }
203
204     public void testFrameForwardNoresize4() throws Exception JavaDoc {
205         runMyTest("testFrameForwardNoresize4", "");
206     }
207
208     public void testFrameForwardNoresize5() throws Exception JavaDoc {
209         runMyTest("testFrameForwardNoresize5", "");
210     }
211
212     public void testFrameForwardNoresize6() throws Exception JavaDoc {
213         runMyTest("testFrameForwardNoresize6", "");
214     }
215
216 }
217
Popular Tags