Clover coverage report - Cactus 1.5 for J2EE API 1.2
Coverage timestamp: Wed Feb 18 2004 09:04:33 EST
file stats: LOC: 208   Methods: 6
NCLOC: 59   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
ServiceEnumeration.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;
 58   
 
 59   
 /**
 60   
  * List of valid services that the test redirectors can perform.
 61   
  * 
 62   
  * <p>
 63   
  *   <strong>WARNING</strong><br/>
 64   
  *   This class is not intended for use by API clients. It may be altered in
 65   
  *   backwards-incompatible ways and even moved or removed at any time without
 66   
  *   further notice.
 67   
  * </p>
 68   
  * 
 69   
  * @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
 70   
  * @author <a href="mailto:cmlenz@apache.org">Christopher Lenz</a>
 71   
  *
 72   
  * @version $Id: ServiceEnumeration.java,v 1.11.2.1 2003/08/09 14:39:06 vmassol Exp $
 73   
  */
 74   
 public final class ServiceEnumeration
 75   
 {
 76   
     /**
 77   
      * Call test method Service.
 78   
      */
 79   
     public static final ServiceEnumeration CALL_TEST_SERVICE = 
 80   
         new ServiceEnumeration("CALL_TEST");
 81   
 
 82   
     /**
 83   
      * Get the previous test results Service.
 84   
      */
 85   
     public static final ServiceEnumeration GET_RESULTS_SERVICE = 
 86   
         new ServiceEnumeration("GET_RESULTS");
 87   
 
 88   
     /**
 89   
      * Noop service for testing.
 90   
      */
 91   
     public static final ServiceEnumeration RUN_TEST_SERVICE = 
 92   
         new ServiceEnumeration("RUN_TEST");
 93   
 
 94   
     /**
 95   
      * Service used to create an HTTP session so that it is returned
 96   
      * in a cookie.
 97   
      * @since 1.5
 98   
      */
 99   
     public static final ServiceEnumeration CREATE_SESSION_SERVICE = 
 100   
         new ServiceEnumeration("CREATE_SESSION");
 101   
 
 102   
     /**
 103   
      * Service that returns a cactus version identifier. This is used
 104   
      * to verify that the server side and client side versions of 
 105   
      * Cactus are the same.
 106   
      * @since 1.5
 107   
      */
 108   
     public static final ServiceEnumeration GET_VERSION_SERVICE = 
 109   
         new ServiceEnumeration("GET_VERSION");
 110   
 
 111   
     /**
 112   
      * The service's name
 113   
      */
 114   
     private String name;
 115   
 
 116   
     /**
 117   
      * Private constructor to only allow the predefined instances of the
 118   
      * enumeration.
 119   
      *
 120   
      * @param theServiceName the name of the service
 121   
      */
 122  0
     private ServiceEnumeration(String theServiceName)
 123   
     {
 124  0
         this.name = theServiceName;
 125   
     }
 126   
 
 127   
     /**
 128   
      * Compares a string representing the name of the service with the service
 129   
      * enumerated type.
 130   
      *
 131   
      * @param theString the string to compare with this Service name
 132   
      * @return true if the string corresponds to the current Service
 133   
      * @deprecated Use {@link ServiceEnumeration#valueOf} and identity
 134   
      *              comparison instead of this method
 135   
      */
 136  0
     public boolean equals(String theString)
 137   
     {
 138  0
         return theString.equals(this.name);
 139   
     }
 140   
 
 141   
     /**
 142   
      * Always compares object identity.
 143   
      * 
 144   
      * @see java.lang.Object#equals(Object)
 145   
      * @since 1.5
 146   
      */
 147  0
     public boolean equals(Object theObject)
 148   
     {
 149  0
         return super.equals(theObject);
 150   
     }
 151   
 
 152   
     /**
 153   
      * Delegates to the <code>java.lang.Object</code> implementation.
 154   
      * 
 155   
      * @see java.lang.Object#equals(Object)
 156   
      * @since 1.5
 157   
      */
 158  0
     public int hashCode()
 159   
     {
 160  0
         return super.hashCode();
 161   
     }
 162   
 
 163   
     /**
 164   
      * Returns the string representation of the service.
 165   
      * 
 166   
      * @return the service's name
 167   
      * @see java.lang.Object#toString
 168   
      */
 169  0
     public String toString()
 170   
     {
 171  0
         return this.name;
 172   
     }
 173   
     
 174   
     /**
 175   
      * Returns the enumeration instance corresponding to the provided service 
 176   
      * name.
 177   
      * 
 178   
      * @param theName The name of the service
 179   
      * @return The corresponding service instance
 180   
      * @since 1.5
 181   
      */
 182  0
     public static ServiceEnumeration valueOf(String theName)
 183   
     {
 184  0
         if (CALL_TEST_SERVICE.name.equals(theName))
 185   
         {
 186  0
             return CALL_TEST_SERVICE;
 187   
         }
 188  0
         else if (GET_RESULTS_SERVICE.name.equals(theName))
 189   
         {
 190  0
             return GET_RESULTS_SERVICE;
 191   
         }
 192  0
         else if (RUN_TEST_SERVICE.name.equals(theName))
 193   
         {
 194  0
             return RUN_TEST_SERVICE;
 195   
         }
 196  0
         else if (CREATE_SESSION_SERVICE.name.equals(theName))
 197   
         {
 198  0
             return CREATE_SESSION_SERVICE;
 199   
         }
 200  0
         else if (GET_VERSION_SERVICE.name.equals(theName))
 201   
         {
 202  0
             return GET_VERSION_SERVICE;
 203   
         }
 204  0
         return null;
 205   
     }
 206   
     
 207   
 }
 208