Clover coverage report - Code Coverage for tapestry release 3.1-alpha-1
Coverage timestamp: Mon Feb 21 2005 09:16:14 EST
file stats: LOC: 86   Methods: 5
NCLOC: 43   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
HomeService.java 50% 90% 100% 88.2%
coverage 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.engine;
 16   
 
 17   
 import java.io.IOException;
 18   
 import java.util.HashMap;
 19   
 import java.util.Map;
 20   
 
 21   
 import javax.servlet.ServletException;
 22   
 
 23   
 import org.apache.tapestry.IEngine;
 24   
 import org.apache.tapestry.IRequestCycle;
 25   
 import org.apache.tapestry.Tapestry;
 26   
 import org.apache.tapestry.TapestryConstants;
 27   
 import org.apache.tapestry.request.ResponseOutputStream;
 28   
 import org.apache.tapestry.services.LinkFactory;
 29   
 import org.apache.tapestry.services.ResponseRenderer;
 30   
 import org.apache.tapestry.services.ServiceConstants;
 31   
 
 32   
 /**
 33   
  * An implementation of the home service that renders the Home page. This is the most likely
 34   
  * candidate for overriding ... for example, to select the page to render based on known information
 35   
  * about the user (stored as a cookie).
 36   
  * 
 37   
  * @author Howard Lewis Ship
 38   
  * @since 1.0.9
 39   
  */
 40   
 
 41   
 public class HomeService implements IEngineService
 42   
 {
 43   
     /** @since 3.1 */
 44   
     private ResponseRenderer _responseRenderer;
 45   
 
 46   
     /** @since 3.1 */
 47   
 
 48   
     private LinkFactory _linkFactory;
 49   
 
 50  11
     public ILink getLink(IRequestCycle cycle, Object parameter)
 51   
     {
 52  11
         if (parameter != null)
 53  0
             throw new IllegalArgumentException(EngineMessages.serviceNoParameter(this));
 54   
 
 55  11
         Map parameters = new HashMap();
 56   
 
 57  11
         parameters.put(ServiceConstants.SERVICE, Tapestry.HOME_SERVICE);
 58   
 
 59  11
         return _linkFactory.constructLink(cycle, parameters, true);
 60   
     }
 61   
 
 62  26
     public void service(IRequestCycle cycle, ResponseOutputStream output) throws ServletException,
 63   
             IOException
 64   
     {
 65  26
         cycle.activate(TapestryConstants.HOME_PAGE);
 66   
 
 67  25
         _responseRenderer.renderResponse(cycle, output);
 68   
     }
 69   
 
 70  104
     public String getName()
 71   
     {
 72  104
         return Tapestry.HOME_SERVICE;
 73   
     }
 74   
 
 75   
     /** @since 3.1 */
 76  52
     public void setResponseRenderer(ResponseRenderer responseRenderer)
 77   
     {
 78  52
         _responseRenderer = responseRenderer;
 79   
     }
 80   
 
 81   
     /** @since 3.1 */
 82  52
     public void setLinkFactory(LinkFactory linkFactory)
 83   
     {
 84  52
         _linkFactory = linkFactory;
 85   
     }
 86   
 }