Coverage Report - org.apache.torque.mojo.morph.VersionTableMorpher
 
Classes in this File Line Coverage Branch Coverage Complexity
VersionTableMorpher
0%
0/15
N/A
1
 
 1  
 package org.apache.torque.mojo.morph;
 2  
 
 3  
 import org.apache.commons.lang.StringUtils;
 4  
 import org.apache.commons.logging.Log;
 5  
 import org.apache.commons.logging.LogFactory;
 6  
 
 7  
 public class VersionTableMorpher extends Morpher {
 8  0
         private static final Log log = LogFactory.getLog(VersionTableMorpher.class);
 9  
 
 10  
         String projectVersion;
 11  
 
 12  
         public VersionTableMorpher() {
 13  0
                 this(null, null);
 14  0
         }
 15  
 
 16  
         public VersionTableMorpher(MorphRequest morphRequest, String artifactId) {
 17  0
                 super(morphRequest, artifactId);
 18  0
         }
 19  
 
 20  
         protected String getMorphedContents(String contents) {
 21  0
                 log.debug("contents=" + contents);
 22  0
                 String oldVersion = StringUtils.substringBetween(contents, "VERSION=\"", "\"");
 23  0
                 String searchString = "VERSION=\"" + oldVersion + "\"";
 24  0
                 String replacement = "VERSION=\"" + getProjectVersion() + "\"";
 25  0
                 String s = StringUtils.replace(contents, searchString, replacement);
 26  0
                 return s;
 27  
         }
 28  
 
 29  
         /**
 30  
          * Return true if we need to morph this file
 31  
          */
 32  
         protected boolean isMorphNeeded(String contents) {
 33  0
                 return true;
 34  
         }
 35  
 
 36  
         public String getProjectVersion() {
 37  0
                 return projectVersion;
 38  
         }
 39  
 
 40  
         public void setProjectVersion(String projectVersion) {
 41  0
                 this.projectVersion = projectVersion;
 42  0
         }
 43  
 
 44  
 }