2011/08/05 - Jakarta Cactus has been retired.

For more information, please explore the Attic.

Clover coverage report - Cactus 1.8dev for J2EE API 1.3
Coverage timestamp: Sun Mar 26 2006 18:50:18 BRT
file stats: LOC: 161   Methods: 6
NCLOC: 59   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
ServiceEnumeration.java 30% 37.5% 50% 37.5%
coverage coverage
 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.internal;
 21   
 
 22   
 /**
 23   
  * List of valid services that the test redirectors can perform.
 24   
  * 
 25   
  * @version $Id: ServiceEnumeration.java 238991 2004-05-22 11:34:50Z vmassol $
 26   
  */
 27   
 public final class ServiceEnumeration
 28   
 {
 29   
     /**
 30   
      * Call test method Service.
 31   
      */
 32   
     public static final ServiceEnumeration CALL_TEST_SERVICE = 
 33   
         new ServiceEnumeration("CALL_TEST");
 34   
 
 35   
     /**
 36   
      * Get the previous test results Service.
 37   
      */
 38   
     public static final ServiceEnumeration GET_RESULTS_SERVICE = 
 39   
         new ServiceEnumeration("GET_RESULTS");
 40   
 
 41   
     /**
 42   
      * Noop service for testing.
 43   
      */
 44   
     public static final ServiceEnumeration RUN_TEST_SERVICE = 
 45   
         new ServiceEnumeration("RUN_TEST");
 46   
 
 47   
     /**
 48   
      * Service used to create an HTTP session so that it is returned
 49   
      * in a cookie.
 50   
      * @since 1.5
 51   
      */
 52   
     public static final ServiceEnumeration CREATE_SESSION_SERVICE = 
 53   
         new ServiceEnumeration("CREATE_SESSION");
 54   
 
 55   
     /**
 56   
      * Service that returns a cactus version identifier. This is used
 57   
      * to verify that the server side and client side versions of 
 58   
      * Cactus are the same.
 59   
      * @since 1.5
 60   
      */
 61   
     public static final ServiceEnumeration GET_VERSION_SERVICE = 
 62   
         new ServiceEnumeration("GET_VERSION");
 63   
 
 64   
     /**
 65   
      * The service's name
 66   
      */
 67   
     private String name;
 68   
 
 69   
     /**
 70   
      * Private constructor to only allow the predefined instances of the
 71   
      * enumeration.
 72   
      *
 73   
      * @param theServiceName the name of the service
 74   
      */
 75  5
     private ServiceEnumeration(String theServiceName)
 76   
     {
 77  5
         this.name = theServiceName;
 78   
     }
 79   
 
 80   
     /**
 81   
      * Compares a string representing the name of the service with the service
 82   
      * enumerated type.
 83   
      *
 84   
      * @param theString the string to compare with this Service name
 85   
      * @return true if the string corresponds to the current Service
 86   
      * @deprecated Use {@link ServiceEnumeration#valueOf} and identity
 87   
      *              comparison instead of this method
 88   
      */
 89  0
     public boolean equals(String theString)
 90   
     {
 91  0
         return theString.equals(this.name);
 92   
     }
 93   
 
 94   
     /**
 95   
      * Always compares object identity.
 96   
      * 
 97   
      * @see java.lang.Object#equals(Object)
 98   
      * @since 1.5
 99   
      */
 100  0
     public boolean equals(Object theObject)
 101   
     {
 102  0
         return super.equals(theObject);
 103   
     }
 104   
 
 105   
     /**
 106   
      * Delegates to the <code>java.lang.Object</code> implementation.
 107   
      * 
 108   
      * @see java.lang.Object#equals(Object)
 109   
      * @since 1.5
 110   
      */
 111  0
     public int hashCode()
 112   
     {
 113  0
         return super.hashCode();
 114   
     }
 115   
 
 116   
     /**
 117   
      * Returns the string representation of the service.
 118   
      * 
 119   
      * @return the service's name
 120   
      * @see java.lang.Object#toString
 121   
      */
 122  48
     public String toString()
 123   
     {
 124  48
         return this.name;
 125   
     }
 126   
     
 127   
     /**
 128   
      * Returns the enumeration instance corresponding to the provided service 
 129   
      * name.
 130   
      * 
 131   
      * @param theName The name of the service
 132   
      * @return The corresponding service instance
 133   
      * @since 1.5
 134   
      */
 135  48
     public static ServiceEnumeration valueOf(String theName)
 136   
     {
 137  48
         if (CALL_TEST_SERVICE.name.equals(theName))
 138   
         {
 139  24
             return CALL_TEST_SERVICE;
 140   
         }
 141  24
         else if (GET_RESULTS_SERVICE.name.equals(theName))
 142   
         {
 143  24
             return GET_RESULTS_SERVICE;
 144   
         }
 145  0
         else if (RUN_TEST_SERVICE.name.equals(theName))
 146   
         {
 147  0
             return RUN_TEST_SERVICE;
 148   
         }
 149  0
         else if (CREATE_SESSION_SERVICE.name.equals(theName))
 150   
         {
 151  0
             return CREATE_SESSION_SERVICE;
 152   
         }
 153  0
         else if (GET_VERSION_SERVICE.name.equals(theName))
 154   
         {
 155  0
             return GET_VERSION_SERVICE;
 156   
         }
 157  0
         return null;
 158   
     }
 159   
     
 160   
 }
 161