Clover coverage report - angkor - 0.4
Coverage timestamp: ti okt 15 2002 22:32:48 CEST
file stats: LOC: 74   Methods: 5
NCLOC: 37   Classes: 1
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
MockPipeline.java 100% 63,6% 80% 72,2%
 1   
 /*
 2   
  * Angkor Web Framework
 3   
  *
 4   
  * Distributable under LGPL license.
 5   
  * See terms of license at gnu.org.
 6   
  */
 7   
 
 8   
 package com.tirsen.angkor.test.unit;
 9   
 
 10   
 import com.tirsen.angkor.process.*;
 11   
 import com.tirsen.angkor.Application;
 12   
 import com.tirsen.angkor.test.unit.mock.MockRenderContext;
 13   
 
 14   
 import java.util.Collections;
 15   
 
 16   
 /**
 17   
  * A utility class for unit tests which is simulating things happening on the pipeline.
 18   
  * Since most things is happening directly or indirectly on the pipeline in Angkor this would
 19   
  * probably include most unit tests of Angkor.
 20   
  *
 21   
  * <!-- $Id: MockPipeline.java,v 1.3 2002/10/13 13:37:26 tirsen Exp $ -->
 22   
  * <!-- $Author: tirsen $ -->
 23   
  *
 24   
  * @author Jon Tirs&acute;n (tirsen@users.sourceforge.net)
 25   
  * @version $Revision: 1.3 $
 26   
  */
 27   
 public class MockPipeline extends Pipeline
 28   
 {
 29   
     private MockRenderContext context;
 30   
 
 31   
     /**
 32   
      * Setup the execution context to simulate we're running on the pipeline.
 33   
      */
 34  18
     public void start() throws Exception
 35   
     {
 36  18
         ExecuteContext context = createExecuteContext(getRenderContext());
 37  18
         setCurrentExecuteContext(context);
 38   
     }
 39   
 
 40   
     /**
 41   
      * Execute the event-processing part of the event-valve.
 42   
      */
 43  0
     public void processEvents() throws Exception
 44   
     {
 45  0
         EventValve events = new EventValve();
 46   
         // create an "empty" execute context
 47  0
         ExecuteContext exec = new BasicExecuteContext(Collections.EMPTY_LIST.iterator());
 48  0
         initContext(exec, getRenderContext());
 49  0
         events.execute(exec);
 50   
     }
 51   
 
 52   
     /**
 53   
      * Tear down the execution context to simulate so we're running outside the pipeline.
 54   
      */
 55  12
     public void end()
 56   
     {
 57  12
         setCurrentExecuteContext(null);
 58   
     }
 59   
 
 60  40
     public MockRenderContext getRenderContext()
 61   
     {
 62  40
         if(context == null)
 63   
         {
 64  13
             context = new MockRenderContext();
 65   
         }
 66  40
         return context;
 67   
     }
 68   
 
 69  10
     public void setApplication(Application application)
 70   
     {
 71  10
         getRenderContext().setApplication(application);
 72   
     }
 73   
 }
 74