StaticArchiveTestpublic class StaticArchiveTest extends AVKTasks This is the implementation for verifier invocation through Ant task.
This task runs the following two classses -
Invokes Verifier by passing the appropriate arguments,
Invokes the GenReportTool class to generate the reports.
The attributes of this task are:
appName ="REQUIRED"
partitionOpts ="OPTIONAL"
jvmArgs ="OPTIONAL" (default: "Xss512k -Xms128m -Xmx256m")
failOnError="OPTIONAL" (default: true)
These tasks require javke-ant.jar and sunone-appserv-ant.jar to be in
AVK_HOME/lib and APPSERVER_HOME/lib diroctries respectively. |
Fields Summary |
---|
private File | appName | private String | partitionOpts | private String | reportingOpts |
Methods Summary |
---|
private java.lang.String | addPartitionOptions()Parse and add the partitioning options. It add "--" to the options.
StringTokenizer options = new StringTokenizer(partitionOpts, ",");
String args = "";
while(options.hasMoreTokens()) {
String option = options.nextToken().trim();
if(!(option.equals("ejb") ||
option.equals("web") ||
option.equals("webservices") ||
option.equals("connector") ||
option.equals("app") ||
option.equals("appclient") ||
option.equals("webservicesclient")))
throw new BuildException("Provide a valid parititioning option. " +
"Valid options are [ejb, web, app, webservices, " +
"webservicesclient, connector, appclient]");
args += " --"+option;
}
return args;
| private void | checkArgs()
if(appName == null || !appName.exists())
throw new BuildException("Provide a valid fully qualified " +
"path of the application: appName="+appName);
| public void | execute()This is called by the ant framework.
checkArgs();
getInstallHomes();
invokeVerifier();
if(invokeGenReportTool(createJavaTask()) != 0 && failOnError)
throw new BuildException("Problem in executing GenReportTool command");
echo.setMessage("See \""+resultDir+File.separator+"verifierSummary.html\" for results.");
echo.execute();
| private int | invokeGenReportTool(org.apache.tools.ant.taskdefs.Java java)Invokes the com.sun.enterprise.appverification.tools.GenReportTool
List<String> list = new ArrayList<String>();
list.add(resultDir + File.separator + appName.getName() + ".xml");
list.add(resultDir);
String[] xsls = {"verifierSummary", "appFailureDetail", "appPassedDetail",
"appWarningDetail", "appNADetail", "ejbFailureDetail",
"ejbPassedDetail", "ejbWarningDetail", "ejbNADetail",
"acFailureDetail", "acPassedDetail", "acWarningDetail",
"acNADetail", "conFailureDetail", "conPassedDetail",
"conWarningDetail", "conNADetail", "errFailureDetail",
"webFailureDetail", "webPassedDetail", "webWarningDetail",
"webNADetail"};
for (int i = 0; i < xsls.length; i++)
list.add(xsls[i]);
String[] args = (String[])list.toArray(new String[1]);
// clear the args set in the invokeVerifier call.
java.clearArgs();
java.setClassname("com.sun.enterprise.appverification.tools.GenReportTool");
setArgs(java, args);
return java.executeJava();
| private void | invokeVerifier()Invokes the com.sun.enterprise.tools.verifier.Verifier
ExecTask exec = (ExecTask)project.createTask("exec");
String argument = "";
//adding the partitioning options
if(partitionOpts != null)
argument = addPartitionOptions();
//adding the fail/warning reporting option
if ((reportingOpts == null) || (reportingOpts.equals("")))
argument += " -rw";
else {// check for valid options a, w and f
if ( reportingOpts.equals("f") || reportingOpts.equals("w")
|| reportingOpts.equals("a") )
argument += " -r"+reportingOpts;
else
throw new BuildException("Provide a valid reporting option. " +
"Valid options are [f, w, a] ");
}
createResultDir("static");
//adding the result directory option
argument += " -d "+resultDir;
//do not run the runtime tests
argument += " -R";
// finally adding the application name in the options
argument += " "+appName.getAbsolutePath();
Commandline.Argument arg = exec.createArg();
arg.setLine(argument);
exec.setExecutable(j2ee_home+"/bin/verifier");
exec.setDir(new File(j2ee_home,"bin"));
exec.setVMLauncher(false);
//the exit status is non-zero if any assertion failed but
// we want to continue to invokeGenReportTool
exec.setFailonerror(false);
exec.execute();
| public void | setAppName(java.io.File appName)
this.appName = appName;
| public void | setPartitionOpts(java.lang.String partitionOpts)
this.partitionOpts = partitionOpts;
| public void | setReportingOpts(java.lang.String reportingOpts)
this.reportingOpts = reportingOpts;
| public void | setResultDir(java.lang.String resultDir)
super.setResultDir(resultDir);
|
|