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.FilterChain;
24 import javax.servlet.http.HttpServletResponse;
25
26 import junit.framework.Test;
27
28 import org.apache.cactus.internal.AbstractCactusTestCase;
29 import org.apache.cactus.internal.CactusTestCase;
30 import org.apache.cactus.internal.client.connector.http.HttpProtocolHandler;
31 import org.apache.cactus.internal.configuration.DefaultFilterConfiguration;
32 import org.apache.cactus.server.FilterConfigWrapper;
33 import org.apache.cactus.server.AbstractHttpServletRequestWrapper;
34 import org.apache.cactus.spi.client.connector.ProtocolHandler;
35
36 /**
37 * Test classes that need access to valid Filter implicit objects (such as the
38 * <code>FilterConfig</code> and <code>FilterChain</code> objects) must
39 * subclass this class.
40 *
41 * @version $Id: FilterTestCase.java 292560 2005-09-29 21:48:10Z kenney $
42 */
43 public class FilterTestCase
44 extends AbstractCactusTestCase implements CactusTestCase
45 {
46 /**
47 * Valid <code>HttpServletRequest</code> object that you can access from
48 * the <code>testXXX()</code>, <code>setUp</code> and
49 * <code>tearDown()</code> methods. If you try to access it from either the
50 * <code>beginXXX()</code> or <code>endXXX()</code> methods it will
51 * have the <code>null</code> value.
52 */
53 public AbstractHttpServletRequestWrapper request;
54
55 /**
56 * Valid <code>HttpServletResponse</code> object that you can access from
57 * the <code>testXXX()</code>, <code>setUp</code> and
58 * <code>tearDown()</code> methods. If you try to access it from either the
59 * <code>beginXXX()</code> or <code>endXXX()</code> methods it will
60 * have the <code>null</code> value.
61 */
62 public HttpServletResponse response;
63
64 /**
65 * Valid <code>FilterConfig</code> object that you can access from
66 * the <code>testXXX()</code>, <code>setUp</code> and
67 * <code>tearDown()</code> methods. If you try to access it from either the
68 * <code>beginXXX()</code> or <code>endXXX()</code> methods it will
69 * have the <code>null</code> value.
70 */
71 public FilterConfigWrapper config;
72
73 /**
74 * Valid <code>FilterChain</code> object that you can access from
75 * the <code>testXXX()</code>, <code>setUp</code> and
76 * <code>tearDown()</code> methods. If you try to access it from either the
77 * <code>beginXXX()</code> or <code>endXXX()</code> methods it will
78 * have the <code>null</code> value.
79 */
80 public FilterChain filterChain;
81
82 /**
83 * @see AbstractCactusTestCase#AbstractCactusTestCase()
84 */
85 public FilterTestCase()
86 {
87 super();
88 }
89
90 /**
91 * {@inheritDoc}
92 * @see AbstractCactusTestCase#AbstractCactusTestCase(String)
93 */
94 public FilterTestCase(String theName)
95 {
96 super(theName);
97 }
98
99 /**
100 * {@inheritDoc}
101 * @see AbstractCactusTestCase#AbstractCactusTestCase(String, Test)
102 */
103 public FilterTestCase(String theName, Test theTest)
104 {
105 super(theName, theTest);
106 }
107
108 /**
109 * {@inheritDoc}
110 * @see AbstractCactusTestCase#createProtocolHandler()
111 */
112 protected ProtocolHandler createProtocolHandler()
113 {
114 return new HttpProtocolHandler(new DefaultFilterConfiguration());
115 }
116 }