Coverage Report - com.aurea.maven.plugins.sonic.esb.EsbTestExportGeneratedSrcMojo
 
Classes in this File Line Coverage Branch Coverage Complexity
EsbTestExportGeneratedSrcMojo
0%
0/21
0%
0/4
1.5
 
 1  
 package com.aurea.maven.plugins.sonic.esb;
 2  
 
 3  
 import java.io.File;
 4  
 
 5  
 import org.apache.maven.plugin.MojoExecutionException;
 6  
 
 7  
 import com.aurea.maven.plugins.sonic.utils.ProjectAnalyzer;
 8  
 import com.sonicsw.deploy.IArtifact;
 9  
 import com.sonicsw.deploy.artifact.ESBArtifact;
 10  
 import com.sonicsw.deploy.tools.common.ExportPropertiesArtifact;
 11  
 
 12  
 /**
 13  
  * exports from the Sonic Domain the ESB artifacts from the current Maven artifact into /deploy/generated-src/testXar.
 14  
  * 
 15  
  * @author Jamie Townsend
 16  
  * 
 17  
  * @goal test-export-generated-src
 18  
  */
 19  0
 public class EsbTestExportGeneratedSrcMojo extends AbstractExportGeneratedSrcMojo {
 20  
   
 21  
 
 22  
   /**
 23  
    * {@inheritDoc}
 24  
    */
 25  
   protected void addExportIgnores(final ExportPropertiesArtifact _expProps) {
 26  
 
 27  
     // TODO should probably remove /src/main/sonicesb processes from the list too, but it won't hurt to leave them in
 28  
     // for now
 29  
     
 30  0
     super.addExportIgnores(_expProps);
 31  
     
 32  0
   }
 33  
   
 34  
   /**
 35  
    * {@inheritDoc}
 36  
    */
 37  
   @Override
 38  
   protected File getDeployGenSrcDir() {
 39  
 
 40  0
     return testableDeployGenSrcDir;
 41  
   }
 42  
   
 43  
   
 44  
   /**
 45  
    * {@inheritDoc}
 46  
    */
 47  
   @Override
 48  
   protected String getProjectProcessesXarDir() {
 49  
 
 50  0
     return "/sonicesb/testProjectProcessesXar";
 51  
   }
 52  
   
 53  
   
 54  
   /**
 55  
    * {@inheritDoc}
 56  
    */
 57  
   @Override
 58  
   protected String getTmpExportToGeneratedSrcDir() {
 59  
 
 60  0
     return "/sonicesb/tmpTestableExportToGeneratedSrc";
 61  
   }
 62  
   
 63  
   /**
 64  
    * {@inheritDoc}
 65  
    */
 66  
   @Override
 67  
   protected File getSonicEsbSourceDirectory() {
 68  
 
 69  0
     return getSonicEsbTestSourceDirectory();
 70  
   }
 71  
   
 72  
   /**
 73  
    * @return the export properties for the pending export, by reading any ExportProperties.xml file (if one is defined)
 74  
    *         and adding the local processes.
 75  
  * @throws MojoExecutionException 
 76  
    */
 77  
   protected ExportPropertiesArtifact getExportProperties() throws MojoExecutionException {
 78  
 
 79  0
     ExportPropertiesArtifact expProps = super.getExportProperties();
 80  
     
 81  0
     getLog().info("Scan for generated processes to be included in domain export...");
 82  
 
 83  
     try {
 84  0
       for (File processFile : ProjectAnalyzer.getProcessSourceFiles(targetGenTestSrcDir.getAbsolutePath())) {
 85  0
         String processName = ProjectAnalyzer.getProcessNameFromFile(processFile);
 86  
         
 87  0
         getLog().info("Found ESB Process : " + processName);
 88  0
         IArtifact artifact = new ESBArtifact(ESBArtifact.PROCESS, processName);
 89  0
         expProps.addRoot(artifact);
 90  
       }
 91  0
     } catch (Exception e) {
 92  0
       if (getLog().isDebugEnabled()) {
 93  0
         e.printStackTrace();
 94  
       }
 95  0
       getLog().warn("Using empty root list as export properties");
 96  0
       expProps = new ExportPropertiesArtifact();
 97  0
     }
 98  0
     return expProps;
 99  
   }
 100  
 }