package org.apache.jmeter;

import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.lang.Thread.UncaughtExceptionHandler; import java.security.Permission; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Arrays; import java.util.Date; import java.util.List; import java.util.regex.Pattern;

import org.apache.commons.io.IOUtils; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.tools.ant.DirectoryScanner;

/**

public class JMeterMojo extends AbstractMojo {

private static final Pattern PAT_ERROR = Pattern.compile(".*\\s+ERROR
s+.*");

/**

private File workDir;
private File saveServiceProps;
private File jmeterLog;
private DateFormat fmt = new SimpleDateFormat("yyMMdd");
/**

private void checkForErrors() throws MojoExecutionException, MojoFailureException { try {
BufferedReader in = new BufferedReader(new FileReader(jmeterLog));
String line;
while ( (line = in.readLine()) != null) {
if (PAT_ERROR.matcher(line).find()) {
throw new MojoFailureException("There were test errors");
}
}
in.close(); } catch (IOException e) {
throw new MojoExecutionException("Can't read log file", e); }
}

private void initSystemProps() throws MojoExecutionException { workDir = new File("target" + File.separator + "jmeter"); workDir.mkdirs(); createSaveServiceProps(); jmeterLog = new File(workDir, "jmeter.log"); try {
System.setProperty("log_file", jmeterLog.getCanonicalPath()); } catch (IOException e) {
throw new MojoExecutionException("Can't get canonical path for log file", e); }
}

/**

}