1 package csdl.jblanket.ant; 2 3 import csdl.jblanket.modifier.MethodCollector; 4 5 import java.io.File ; 6 import java.util.ArrayList ; 7 8 102 public class JBlanketAppTask extends JBlanketTask { 103 104 107 public JBlanketAppTask() { 108 super(); 109 } 110 111 114 public void execute() { 115 116 if (!super.enable) { 118 if (super.verbose) { 119 System.out.println("jblanketapp disabled; application was not launched."); 120 } 121 return; 122 } 123 ArrayList argsList = new ArrayList (); 125 126 argsList.add("java"); 128 argsList.add("-D\"jblanket.dir\"=" + MethodCollector.getJBlanketDir()); 129 130 argsList.add("-classpath"); 132 String slash = File.separator; 133 String antLib = System.getProperty("ant.home") + slash + "lib" + slash; 134 String classPath = ".;" + antLib + "jblanket.jar;" + antLib + "jdom.jar;" 135 + antLib + "xerces.jar"; 136 argsList.add(classPath); 137 argsList.add("csdl.jblanket.app.ExcludeIndividualMethodApp"); 138 139 argsList.add("-verbose"); 141 argsList.add(new Boolean (super.verbose).toString()); 142 143 if (super.excludeOneLineMethods) { 145 argsList.add("-excludeOneLineMethods"); 146 argsList.add(new Boolean (super.excludeOneLineMethods).toString()); 147 if (super.oneLineFile != null) { 148 argsList.add("-oneLineFile"); 149 argsList.add(super.oneLineFile); 150 } 151 } 152 153 if (super.excludeConstructors) { 155 argsList.add("-excludeConstructors"); 156 argsList.add(new Boolean (super.excludeConstructors).toString()); 157 if (super.constructorFile != null) { 158 argsList.add("-constructorFile"); 159 argsList.add(super.constructorFile); 160 } 161 } 162 163 if (super.excludedIndividualFile != null) { 165 argsList.add("-excludedIndividualFile"); 166 argsList.add(super.excludedIndividualFile); 167 } 168 169 argsList.add("-total.testedFile"); 171 argsList.add("-total.untestedFile"); 172 173 String [] args = (String []) argsList.toArray(new String [argsList.size()]); 174 175 Runtime runtime = Runtime.getRuntime(); 177 try { 178 runtime.exec(args); 179 } 180 catch (Exception e) { 181 e.printStackTrace(); 182 } 183 } 184 } 185 | Popular Tags |