Coverage Report - org.apache.maven.model.converter.V4PomRewriter
 
Classes in this File Line Coverage Branch Coverage Complexity
V4PomRewriter
0%
0/13
0%
0/6
2,5
 
 1  
 package org.apache.maven.model.converter;
 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.model.Model;
 23  
 import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
 24  
 import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
 25  
 
 26  
 import java.io.Reader;
 27  
 import java.io.Writer;
 28  
 import java.util.List;
 29  
 
 30  
 /**
 31  
  * @author jdcasey
 32  
  * @plexus.component role="org.apache.maven.model.converter.ArtifactPomRewriter" role-hint="v4"
 33  
  */
 34  0
 public class V4PomRewriter
 35  
     implements ArtifactPomRewriter
 36  
 {
 37  
     /**
 38  
      * @plexus.requirement
 39  
      */
 40  
     private ModelConverter translator;
 41  
 
 42  
     public void rewrite( Reader from, Writer to, boolean reportOnly, String groupId, String artifactId, String version,
 43  
                          String packaging )
 44  
         throws Exception
 45  
     {
 46  0
         Model model = null;
 47  
 
 48  0
         if ( from != null )
 49  
         {
 50  0
             MavenXpp3Reader reader = new MavenXpp3Reader();
 51  
 
 52  0
             model = reader.read( from );
 53  
         }
 54  
         else
 55  
         {
 56  0
             model = new Model();
 57  
         }
 58  
 
 59  0
         if ( model != null )
 60  
         {
 61  0
             translator.validateV4Basics( model, groupId, artifactId, version, packaging );
 62  
 
 63  0
             if ( !reportOnly )
 64  
             {
 65  0
                 MavenXpp3Writer writer = new MavenXpp3Writer();
 66  0
                 writer.write( to, model );
 67  
             }
 68  
         }
 69  0
     }
 70  
 
 71  
     public List getWarnings()
 72  
     {
 73  0
         return translator.getWarnings();
 74  
     }
 75  
 }