Coverage report

  %line %branch
org.apache.jetspeed.components.test.AbstractSpringTestCase
0% 
0% 

 1  
 /*
 2  
  * Licensed to the Apache Software Foundation (ASF) under one or more
 3  
  * contributor license agreements.  See the NOTICE file distributed with
 4  
  * this work for additional information regarding copyright ownership.
 5  
  * The ASF licenses this file to You under the Apache License, Version 2.0
 6  
  * (the "License"); you may not use this file except in compliance with
 7  
  * the License.  You may obtain a copy of the License at
 8  
  * 
 9  
  *      http://www.apache.org/licenses/LICENSE-2.0
 10  
  * 
 11  
  * Unless required by applicable law or agreed to in writing, software
 12  
  * distributed under the License is distributed on an "AS IS" BASIS,
 13  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14  
  * See the License for the specific language governing permissions and
 15  
  * limitations under the License.
 16  
  */
 17  
 package org.apache.jetspeed.components.test;
 18  
 
 19  
 import org.springframework.context.ApplicationContext;
 20  
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 21  
 
 22  
 import junit.framework.TestCase;
 23  
 
 24  
 /**
 25  
  * <p>
 26  
  * AbstractSpringTestCase
 27  
  * </p>
 28  
  * <p>
 29  
  * 
 30  
  * </p>
 31  
  * 
 32  
  * @author <a href="mailto:weaver@apache.org">Scott T. Weaver </a>
 33  
  * @version $Id: AbstractSpringTestCase.java 516448 2007-03-09 16:25:47Z ate $
 34  
  *  
 35  
  */
 36  0
 public abstract class AbstractSpringTestCase extends TestCase
 37  
 {
 38  
     /**
 39  
      * Provides access to the Spring ApplicationContext.
 40  
      */
 41  
     protected ClassPathXmlApplicationContext ctx;
 42  
 
 43  
     /**
 44  
      * setup Spring context as part of test setup
 45  
      */
 46  
     protected void setUp() throws Exception
 47  
     {        
 48  0
         super.setUp();
 49  0
         if (ctx == null)
 50  
         {
 51  0
             String [] bootConfigurations = getBootConfigurations();
 52  0
             if (bootConfigurations != null)
 53  
             {
 54  0
                 ApplicationContext bootContext = new ClassPathXmlApplicationContext(bootConfigurations, true);
 55  0
                 ctx = new ClassPathXmlApplicationContext(getConfigurations(), true, bootContext);
 56  0
             }
 57  
             else
 58  
             {
 59  0
                 ctx = new ClassPathXmlApplicationContext(getConfigurations(), true);
 60  
             }
 61  
         }
 62  0
     }
 63  
 
 64  
     /**
 65  
      * close Spring context as part of test teardown
 66  
      */
 67  
     protected void tearDown() throws Exception
 68  
     {        
 69  0
         super.tearDown();
 70  0
         if (ctx != null)
 71  
         {
 72  0
             ctx.close();
 73  
         }
 74  0
     }
 75  
 
 76  
     /**
 77  
      * required specification of spring configurations
 78  
      */
 79  
     protected abstract String[] getConfigurations();
 80  
     
 81  
     /**
 82  
      * optional specification of boot spring configurations
 83  
      */
 84  
     protected String[] getBootConfigurations()
 85  
     {
 86  0
         return null;
 87  
     }
 88  
 }

This report is generated by jcoverage, Maven and Maven JCoverage Plugin.