KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > struts > taglib > bean > TestIncludeTag


1 /*
2  * $Id: TestIncludeTag.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.bean;
19
20 import junit.framework.Test;
21 import junit.framework.TestSuite;
22 import org.apache.struts.taglib.TaglibTestBase;
23
24 /**
25  * Suite of unit tests for the
26  * <code>org.apache.struts.taglib.bean.IncludeTag</code> class.
27  *
28  */

29 public class TestIncludeTag extends TaglibTestBase {
30
31     /**
32      * Defines the testcase name for JUnit.
33      *
34      * @param theName the testcase's name.
35      */

36     public TestIncludeTag(String JavaDoc theName) {
37         super(theName);
38     }
39
40     /**
41      * Start the tests.
42      *
43      * @param theArgs the arguments. Not used
44      */

45     public static void main(String JavaDoc[] theArgs) {
46         junit.awtui.TestRunner.main(new String JavaDoc[] {TestIncludeTag.class.getName()});
47     }
48
49     /**
50      * @return a test suite (<code>TestSuite</code>) that includes all methods
51      * starting with "test"
52      */

53     public static Test suite() {
54         // All methods starting with "test" will be executed in the test suite.
55
return new TestSuite(TestIncludeTag.class);
56     }
57
58     private void runMyTest(String JavaDoc whichTest) throws Exception JavaDoc {
59         request.setAttribute("runTest", whichTest);
60         pageContext.forward(
61         request.getRequestURI() + "/org/apache/struts/taglib/bean/TestIncludeTag.jsp");
62     }
63
64     /*
65      * Testing IncludeTag using the forward attribute.
66      */

67     public void testIncludeTagForward() throws Exception JavaDoc {
68                 //@TODO problem with Cactus' request wrapper causing wrong value when request.getServerPort()
69
// System.out.println("[TestIncludeTag.java]========>request.getServerPort():" + request.getServerPort());
70
// System.out.println("[TestIncludeTag.java]========>request.getRequestURI():" + request.getRequestURI());
71
// System.out.println("[TestIncludeTag.java]========>request.getRequestURL():" + request.getRequestURL());
72
// System.out.println("[TestIncludeTag.java]========>request.getQueryString():" + request.getQueryString());
73
// runMyTest("testIncludeTagForward");
74
}
75
76     /*
77      * Testing IncludeTag using the href attribute.
78      */

79     public void testIncludeTagHref() throws Exception JavaDoc {
80                 //@TODO problem with Cactus' request wrapper causing wrong value when request.getServerPort()
81
// runMyTest("testIncludeTagHref");
82
}
83
84     /*
85      * Testing IncludeTag using the page attribute
86      */

87     public void testIncludeTagPage() throws Exception JavaDoc {
88                 //@TODO problem with Cactus' request wrapper causing wrong value when request.getServerPort()
89
// runMyTest("testIncludeTagPage");
90
}
91
92
93 }
94
Popular Tags