Clover coverage report - Code Coverage for tapestry release 4.0.1
Coverage timestamp: Fri Mar 31 2006 09:12:14 EST
file stats: LOC: 96   Methods: 7
NCLOC: 47   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
HomeService.java 50% 83.3% 85.7% 81%
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 org.apache.tapestry.IRequestCycle;
 22    import org.apache.tapestry.Tapestry;
 23    import org.apache.tapestry.services.LinkFactory;
 24    import org.apache.tapestry.services.ResponseRenderer;
 25    import org.apache.tapestry.services.ServiceConstants;
 26   
 27    /**
 28    * An implementation of the home service that renders the Home page. This is the most likely
 29    * candidate for overriding ... for example, to select the page to render based on known information
 30    * about the user (stored as a cookie).
 31    *
 32    * @author Howard Lewis Ship
 33    * @since 1.0.9
 34    */
 35   
 36    public class HomeService implements IEngineService
 37    {
 38    /** @since 4.0 */
 39    private ResponseRenderer _responseRenderer;
 40   
 41    /** @since 4.0 */
 42   
 43    private LinkFactory _linkFactory;
 44   
 45    /** @since 4.0 */
 46   
 47    private String _pageName;
 48   
 49  10 public ILink getLink(boolean post, Object parameter)
 50    {
 51  10 if (parameter != null)
 52  0 throw new IllegalArgumentException(EngineMessages.serviceNoParameter(this));
 53   
 54  10 Map parameters = new HashMap();
 55   
 56  10 parameters.put(ServiceConstants.SERVICE, getName());
 57   
 58  10 return _linkFactory.constructLink(this, post, parameters, true);
 59    }
 60   
 61  42 public void service(IRequestCycle cycle) throws IOException
 62    {
 63  42 cycle.activate(_pageName);
 64   
 65  40 _responseRenderer.renderResponse(cycle);
 66    }
 67   
 68  58 public String getName()
 69    {
 70  58 return Tapestry.HOME_SERVICE;
 71    }
 72   
 73    /** @since 4.0 */
 74  38 public void setResponseRenderer(ResponseRenderer responseRenderer)
 75    {
 76  38 _responseRenderer = responseRenderer;
 77    }
 78   
 79    /** @since 4.0 */
 80  38 public void setLinkFactory(LinkFactory linkFactory)
 81    {
 82  38 _linkFactory = linkFactory;
 83    }
 84   
 85    /** @since 4.0 */
 86  38 public void setPageName(String pageName)
 87    {
 88  38 _pageName = pageName;
 89    }
 90   
 91    /** @since 4.0 */
 92  0 public String getPageName()
 93    {
 94  0 return _pageName;
 95    }
 96    }