KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * $Id: TestFrameTag5.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 import javax.servlet.jsp.PageContext JavaDoc;
24
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  * Suite of unit tests for the
34  * <code>org.apache.struts.taglib.html.FrameTag</code> class.
35  *
36  */

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

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

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

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

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

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