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