Clover coverage report - Code Coverage for tapestry release 4.0-alpha-3
Coverage timestamp: Mon May 16 2005 09:05:49 EDT
file stats: LOC: 119   Methods: 9
NCLOC: 66   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
ScriptDescriptor.java 100% 100% 100% 100%
coverage
 1   
 // Copyright 2004, 2005 The Apache Software Foundation
 2   
 //
 3   
 // Licensed under the Apache License, Version 2.0 (the "License");
 4   
 // you may not use this file except in compliance with the License.
 5   
 // You may obtain a copy of the License at
 6   
 //
 7   
 //     http://www.apache.org/licenses/LICENSE-2.0
 8   
 //
 9   
 // Unless required by applicable law or agreed to in writing, software
 10   
 // distributed under the License is distributed on an "AS IS" BASIS,
 11   
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12   
 // See the License for the specific language governing permissions and
 13   
 // limitations under the License.
 14   
 
 15   
 package org.apache.tapestry.test;
 16   
 
 17   
 import java.util.ArrayList;
 18   
 import java.util.HashMap;
 19   
 import java.util.List;
 20   
 import java.util.Map;
 21   
 
 22   
 import org.apache.hivemind.ApplicationRuntimeException;
 23   
 import org.apache.hivemind.impl.BaseLocatable;
 24   
 
 25   
 /**
 26   
  * Top level object for test scripts.
 27   
  *
 28   
  * @author Howard Lewis Ship
 29   
  * @since 4.0
 30   
  */
 31   
 public class ScriptDescriptor extends BaseLocatable
 32   
 {
 33   
     private String _contextName;
 34   
     private String _rootDirectory;
 35   
 
 36   
     private Map _servletDescriptors = new HashMap();
 37   
     private List _requests = new ArrayList();
 38   
 
 39   
     private ServletDescriptor _defaultServletDescriptor;
 40   
 
 41  1
     public String getContextName()
 42   
     {
 43  1
         return _contextName;
 44   
     }
 45   
 
 46  1
     public String getRootDirectory()
 47   
     {
 48  1
         return _rootDirectory;
 49   
     }
 50   
 
 51  9
     public void setContextName(String string)
 52   
     {
 53  9
         _contextName = string;
 54   
     }
 55   
 
 56  9
     public void setRootDirectory(String string)
 57   
     {
 58  9
         _rootDirectory = string;
 59   
     }
 60   
 
 61   
     /**
 62   
      * Gets the named servlet descriptor, or returns null.
 63   
      */
 64  14
     public ServletDescriptor getServletDescriptor(String name)
 65   
     {
 66  14
         return (ServletDescriptor) _servletDescriptors.get(name);
 67   
     }
 68   
 
 69   
     /**
 70   
      * Adds a new ServletDescriptor to the script.
 71   
      * 
 72   
      * @throws ApplicationRuntimeException if the descriptor's name
 73   
      * duplicates an existing descriptor
 74   
      */
 75  9
     public void addServletDescriptor(ServletDescriptor sd)
 76   
     {
 77  9
         String name = sd.getName();
 78   
 
 79  9
         ServletDescriptor existing = getServletDescriptor(name);
 80   
 
 81  9
         if (existing != null)
 82  1
             throw new ApplicationRuntimeException(
 83   
                 "Servlet descriptor '"
 84   
                     + name
 85   
                     + "' (at "
 86   
                     + sd.getLocation()
 87   
                     + ") conflicts with prior instance at "
 88   
                     + existing.getLocation()
 89   
                     + ".",
 90   
                 sd.getLocation(),
 91   
                 null);
 92   
 
 93  8
         _servletDescriptors.put(name, sd);
 94   
 
 95  8
         if (_defaultServletDescriptor == null)
 96  5
             _defaultServletDescriptor = sd;
 97   
     }
 98   
 
 99  7
     public void addRequestDescriptor(RequestDescriptor rd)
 100   
     {
 101  7
         _requests.add(rd);
 102   
     }
 103   
 
 104   
     /**
 105   
      * @return List of {@link RequestDescriptor}
 106   
      * @see #addRequestDescriptor(RequestDescriptor)
 107   
      */
 108  5
     public List getRequestDescriptors()
 109   
     {
 110  5
         return _requests;
 111   
     }
 112   
     
 113  2
     public ServletDescriptor getDefaultServletDescriptor()
 114   
     {
 115  2
         return _defaultServletDescriptor;
 116   
     }
 117   
 
 118   
 }
 119