Coverage Report - org.apache.maven.its.plugins.VelocityMojo
 
Classes in this File Line Coverage Branch Coverage Complexity
VelocityMojo
0 %
0/7
N/A
3
 
 1  
 package org.apache.maven.its.plugins;
 2  
 
 3  
 /*
 4  
  * Licensed to the Apache Software Foundation (ASF) under one
 5  
  * or more contributor license agreements.  See the NOTICE file
 6  
  * distributed with this work for additional information
 7  
  * regarding copyright ownership.  The ASF licenses this file
 8  
  * to you under the Apache License, Version 2.0 (the
 9  
  * "License"); you may not use this file except in compliance
 10  
  * with the License.  You may obtain a copy of the License at
 11  
  *
 12  
  *   http://www.apache.org/licenses/LICENSE-2.0
 13  
  *
 14  
  * Unless required by applicable law or agreed to in writing,
 15  
  * software distributed under the License is distributed on an
 16  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 17  
  * KIND, either express or implied.  See the License for the
 18  
  * specific language governing permissions and limitations
 19  
  * under the License.
 20  
  */
 21  
 
 22  
 import org.apache.maven.plugin.AbstractMojo;
 23  
 import org.apache.maven.plugin.MojoExecutionException;
 24  
 import org.apache.maven.plugin.MojoFailureException;
 25  
 import org.codehaus.plexus.velocity.VelocityComponent;
 26  
 
 27  
 /**
 28  
  * @goal velocity
 29  
  * @phase validate
 30  
  */
 31  0
 public class VelocityMojo
 32  
     extends AbstractMojo
 33  
 {
 34  
     /**
 35  
      * @component
 36  
      */
 37  
     protected VelocityComponent velocityComponent;
 38  
 
 39  
     public void execute()
 40  
         throws MojoExecutionException, MojoFailureException
 41  
     {
 42  
         // velocityComponent should not be null
 43  0
         velocityComponent.getEngine();
 44  
 
 45  
         try
 46  
         {
 47  
             // velocityComponent engine should not be null
 48  
             // this is the real test to check that we got the right Initializable interface in both Plexus and the component
 49  
             /*
 50  
              * NOTE: There's a bug in the plexus-velocity:1.1.7 component that fails to transform "/template.vm" into
 51  
              * a proper resource name before searching the context class loader so we avoid the leading slash here.
 52  
              */
 53  0
             velocityComponent.getEngine().getTemplate( "template.vm" );
 54  
         }
 55  0
         catch ( Exception e )
 56  
         {
 57  0
             throw new MojoExecutionException( e.getMessage(), e );
 58  0
         }
 59  0
     }
 60  
 }