/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at legal-notices/CDDLv1_0.txt.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information:
* Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
*
* Copyright 2008-2010 Sun Microsystems, Inc.
*/
public class GenerateOpenDSTestSpecs
{
public GenerateOpenDSTestSpecs()
{
}
{
// retrieve input
{
}
else
{
usage();
}
// validate input
if(!fileDirName.isDirectory())
{
}
else
{
}
if(!outputDirName.isDirectory())
{
}
else
{
}
// java files are assumed to be from the unit-integration tests.
// xml files are assumed to be from the functional tests.
{
strTestType = "Int";
strTestType = "Func";
}
else
{
}
// create list of files to parse
// clean out the list of files
{
}
{
}
// The ArrayList object, arrayFiles, contains the list of files that must be parsed.
// print out list of files
//for(int i=0; i<arrayFiles.size(); i++)
//{
// File gotFile = (File)(arrayFiles.get(i));
// System.out.println("File number " + Integer.toString(i) + " is " + gotFile.toString());
//}
// The ArrayList object, arrayDirs, contains the list of directories where the files will be found.
// print out list of directories
//for(int i=0; i<arrayDirs.size(); i++)
//{
// File gotDir = (File)(arrayDirs.get(i));
// System.out.println("Directory number " + Integer.toString(i) + " is " + gotDir.toString());
//}
// Assume each directory will result in an output xml file
// There will be one ParseData object for each directory.
// Each ParseData object holds the test specs for all tests in that directory.
// The ArrayList object, arrayTests, contains all the ParseData objects.
// For each directory, parse out the data from each file within that directory.
{
// parse out data from all java files in a directory
try
{
}
catch(Exception e)
{
e.printStackTrace();
}
}
// create the output xml files from the ParsedData objects
{
{
{
try
{
}
catch(Exception e)
{
e.printStackTrace();
}
}
{
try
{
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
}
// Write the index file
{
// Index.xml
try {
{
{
}
}
}
catch (Exception e) {
e.printStackTrace( );
}
// Index.html
try{
(new FileOutputStream(htmlFilename))
);
}
catch (Exception e) {
e.printStackTrace( );
}
}
}
private static void usage()
{
System.out.println("This program will parse files that are used for testing and create an xml file that is used for generating test specification html pages.");
System.out.println("The program will recursively search for files from the directory that is passed in from the parameter.");
System.out.println("This version will only recursively search one or two levels below the \"directory to files\" which is passed in as a parameter.");
System.out.println(" java GenerateOpenDSTestSpecs [directory to files] [directory for output files] [file format]");
}
{
}
{
return subStr;
}
}