1 /*
2 * ========================================================================
3 *
4 * Licensed to the Apache Software Foundation (ASF) under one or more
5 * contributor license agreements. See the NOTICE file distributed with
6 * this work for additional information regarding copyright ownership.
7 * The ASF licenses this file to You under the Apache License, Version 2.0
8 * (the "License"); you may not use this file except in compliance with
9 * the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 *
19 * ========================================================================
20 */
21 package org.apache.cactus;
22
23 import javax.servlet.jsp.JspWriter;
24
25 import junit.framework.Test;
26
27 import org.apache.cactus.internal.client.connector.http.HttpProtocolHandler;
28 import org.apache.cactus.internal.configuration.DefaultJspConfiguration;
29 import org.apache.cactus.server.AbstractPageContextWrapper;
30 import org.apache.cactus.spi.client.connector.ProtocolHandler;
31
32 /**
33 * Test classes that need access to valid JSP implicit objects (such as the
34 * page context, the output jsp writer, the HTTP request, ...) must subclass
35 * this class.
36 *
37 * @version $Id: JspTestCase.java 238991 2004-05-22 11:34:50Z vmassol $
38 */
39 public class JspTestCase extends ServletTestCase
40 {
41 /**
42 * Valid <code>PageContext</code> object that you can access from
43 * the <code>testXXX()</code>, <code>setUp</code> and
44 * <code>tearDown()</code> methods. If you try to access it from either the
45 * <code>beginXXX()</code> or <code>endXXX()</code> methods it will
46 * have the <code>null</code> value.
47 */
48 public AbstractPageContextWrapper pageContext;
49
50 /**
51 * Valid <code>JspWriter</code> object that you can access from
52 * the <code>testXXX()</code>, <code>setUp</code> and
53 * <code>tearDown()</code> methods. If you try to access it from either the
54 * <code>beginXXX()</code> or <code>endXXX()</code> methods it will
55 * have the <code>null</code> value.
56 */
57 public JspWriter out;
58
59 /**
60 * @see ServletTestCase#ServletTestCase()
61 */
62 public JspTestCase()
63 {
64 super();
65 }
66
67 /**
68 * @see ServletTestCase#ServletTestCase(String)
69 * @param theName of the JspTestCase
70 */
71 public JspTestCase(String theName)
72 {
73 super(theName);
74 }
75
76 /**
77 * @see ServletTestCase#ServletTestCase(String, Test)
78 * @param theName of the JspTestCase
79 * @param theTest of the JspTestCase
80 */
81 public JspTestCase(String theName, Test theTest)
82 {
83 super(theName, theTest);
84 }
85
86 /**
87 * @see ServletTestCase#createProtocolHandler()
88 * @return ProtocolHandler
89 */
90 protected ProtocolHandler createProtocolHandler()
91 {
92 return new HttpProtocolHandler(new DefaultJspConfiguration());
93 }
94 }