Clover coverage report - Cactus 1.5 for J2EE API 1.3
Coverage timestamp: Wed Feb 18 2004 09:09:13 EST
file stats: LOC: 171   Methods: 8
NCLOC: 52   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
ServerTestCaseDelegate.java 0% 0% 0% 0%
coverage
 1   
 /*
 2   
  * ====================================================================
 3   
  *
 4   
  * The Apache Software License, Version 1.1
 5   
  *
 6   
  * Copyright (c) 2001-2003 The Apache Software Foundation.  All rights
 7   
  * reserved.
 8   
  *
 9   
  * Redistribution and use in source and binary forms, with or without
 10   
  * modification, are permitted provided that the following conditions
 11   
  * are met:
 12   
  *
 13   
  * 1. Redistributions of source code must retain the above copyright
 14   
  *    notice, this list of conditions and the following disclaimer.
 15   
  *
 16   
  * 2. Redistributions in binary form must reproduce the above copyright
 17   
  *    notice, this list of conditions and the following disclaimer in
 18   
  *    the documentation and/or other materials provided with the
 19   
  *    distribution.
 20   
  *
 21   
  * 3. The end-user documentation included with the redistribution, if
 22   
  *    any, must include the following acknowlegement:
 23   
  *       "This product includes software developed by the
 24   
  *        Apache Software Foundation (http://www.apache.org/)."
 25   
  *    Alternately, this acknowlegement may appear in the software itself,
 26   
  *    if and wherever such third-party acknowlegements normally appear.
 27   
  *
 28   
  * 4. The names "The Jakarta Project", "Cactus" and "Apache Software
 29   
  *    Foundation" must not be used to endorse or promote products
 30   
  *    derived from this software without prior written permission. For
 31   
  *    written permission, please contact apache@apache.org.
 32   
  *
 33   
  * 5. Products derived from this software may not be called "Apache"
 34   
  *    nor may "Apache" appear in their names without prior written
 35   
  *    permission of the Apache Group.
 36   
  *
 37   
  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 38   
  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 39   
  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 40   
  * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
 41   
  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 42   
  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 43   
  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 44   
  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 45   
  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 46   
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 47   
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 48   
  * SUCH DAMAGE.
 49   
  * ====================================================================
 50   
  *
 51   
  * This software consists of voluntary contributions made by many
 52   
  * individuals on behalf of the Apache Software Foundation.  For more
 53   
  * information on the Apache Software Foundation, please see
 54   
  * <http://www.apache.org/>.
 55   
  *
 56   
  */
 57   
 package org.apache.cactus.internal.server;
 58   
 
 59   
 import junit.framework.Assert;
 60   
 import junit.framework.Test;
 61   
 
 62   
 import org.apache.commons.logging.Log;
 63   
 import org.apache.commons.logging.LogFactory;
 64   
 
 65   
 /**
 66   
  * Delegate class that allows executing JUnit test on the server side by
 67   
  * calling <code>setUp()</code>, <code>testXXX()</code> and 
 68   
  * <code>tearDown()</code>.
 69   
  *
 70   
  * @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
 71   
  *
 72   
  * @version $Id: ServerTestCaseDelegate.java,v 1.1.2.2 2003/08/31 14:38:18 vmassol Exp $
 73   
  */
 74   
 public class ServerTestCaseDelegate extends Assert
 75   
 {
 76   
     /**
 77   
      * The logger.
 78   
      */
 79   
     private Log logger;
 80   
 
 81   
     /**
 82   
      * The test we are delegating for.
 83   
      */
 84   
     private Test delegatedTest;   
 85   
 
 86   
     /**
 87   
      * Pure JUnit Test Case that we are wrapping (if any)
 88   
      */
 89   
     private Test wrappedTest;
 90   
 
 91   
     /**
 92   
      * @param theDelegatedTest the test we are delegating for
 93   
      * @param theWrappedTest the test being wrapped by this delegate (or null 
 94   
      *        if none)
 95   
      */
 96  0
     public ServerTestCaseDelegate(Test theDelegatedTest, Test theWrappedTest) 
 97   
     {        
 98  0
         if (theDelegatedTest == null)
 99   
         {
 100  0
             throw new IllegalStateException(
 101   
                 "The test object passed must not be null");
 102   
         }
 103   
 
 104  0
         setDelegatedTest(theDelegatedTest); 
 105  0
         setWrappedTest(theWrappedTest);
 106   
     }
 107   
 
 108   
     /**
 109   
      * @param theWrappedTest the pure JUnit test that we need to wrap 
 110   
      */
 111  0
     public void setWrappedTest(Test theWrappedTest)
 112   
     {
 113  0
         this.wrappedTest = theWrappedTest;
 114   
     }
 115   
 
 116   
     /**
 117   
      * @return the wrapped JUnit test
 118   
      */
 119  0
     public Test getWrappedTest()
 120   
     {
 121  0
         return this.wrappedTest;
 122   
     }
 123   
 
 124   
     /**
 125   
      * @param theDelegatedTest the test we are delegating for
 126   
      */
 127  0
     public void setDelegatedTest(Test theDelegatedTest)
 128   
     {
 129  0
         this.delegatedTest = theDelegatedTest;
 130   
     }
 131   
 
 132   
     /**
 133   
      * @return the test we are delegating for
 134   
      */
 135  0
     public Test getDelegatedTest()
 136   
     {
 137  0
         return this.delegatedTest;
 138   
     }
 139   
 
 140   
     /**
 141   
      */
 142  0
     public void runBareInit()
 143   
     {
 144   
         // Initialize the logging system. As this class is instanciated both
 145   
         // on the server side and on the client side, we need to differentiate
 146   
         // the logging initialisation. This method is only called on the server
 147   
         // side, so we instanciate the log for server side here.
 148  0
         if (getLogger() == null)
 149   
         {
 150  0
             setLogger(LogFactory.getLog(getDelegatedTest().getClass()));
 151   
         }        
 152   
     }
 153   
     
 154   
     /**
 155   
      * @return the logger pointing to the wrapped test case that use to perform
 156   
      *         logging on behalf of the wrapped test.
 157   
      */
 158  0
     private Log getLogger()
 159   
     {
 160  0
         return this.logger;
 161   
     }
 162   
 
 163   
     /**
 164   
      * @param theLogger the logger to use 
 165   
      */
 166  0
     private void setLogger(Log theLogger)
 167   
     {
 168  0
         this.logger = theLogger;
 169   
     }
 170   
 }
 171