Coverage Report - org.apache.maven.plugins.patchtracker.CreatePatchMojo
 
Classes in this File Line Coverage Branch Coverage Complexity
CreatePatchMojo
0 %
0/14
N/A
5
 
 1  
 package org.apache.maven.plugins.patchtracker;
 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.MojoExecutionException;
 23  
 import org.apache.maven.plugins.patchtracker.tracking.PatchTracker;
 24  
 import org.apache.maven.plugins.patchtracker.tracking.PatchTrackerException;
 25  
 import org.apache.maven.plugins.patchtracker.tracking.PatchTrackerRequest;
 26  
 import org.apache.maven.plugins.patchtracker.tracking.PatchTrackerResult;
 27  
 import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
 28  
 
 29  
 /**
 30  
  * Goal which create a diff/patch file from the current project and create an issue in the project
 31  
  * with attaching the created patch file
 32  
  *
 33  
  * @goal create
 34  
  * @aggregator
 35  
  */
 36  0
 public class CreatePatchMojo
 37  
     extends AbstractPatchMojo
 38  
 {
 39  
 
 40  
 
 41  
     public void execute()
 42  
         throws MojoExecutionException
 43  
     {
 44  
         // TODO do a status before and complains if some files in to be added status ?
 45  
 
 46  0
         String patchContent = getPatchContent();
 47  
 
 48  0
         PatchTrackerRequest patchTrackerRequest = buidPatchTrackerRequest( true );
 49  
 
 50  0
         patchTrackerRequest.setPatchContent( patchContent );
 51  
 
 52  0
         getLog().debug( patchTrackerRequest.toString() );
 53  
 
 54  
         try
 55  
         {
 56  0
             PatchTracker patchTracker = getPatchTracker();
 57  0
             PatchTrackerResult result = patchTracker.createPatch( patchTrackerRequest, getLog() );
 58  0
             getLog().info( "issue created with id:" + result.getPatchId() + ", url:" + result.getPatchUrl() );
 59  
         }
 60  0
         catch ( ComponentLookupException e )
 61  
         {
 62  0
             throw new MojoExecutionException( e.getMessage(), e );
 63  
         }
 64  0
         catch ( PatchTrackerException e )
 65  
         {
 66  0
             throw new MojoExecutionException( e.getMessage(), e );
 67  0
         }
 68  
 
 69  
 
 70  0
     }
 71  
 
 72  
 
 73  
 }