mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

el_kaboing
01.07.2007 f32c25094986e239e07497725161c1d1cc5d2533
The new parsing tool for retrieving test specs from the test case comments and creating xml files with the test specifications.
9 files added
1875 ■■■■■ changed files
opendj-sdk/opends/tests/functional-tests/shared/java/parsingtool/ArrayData.java 153 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/functional-tests/shared/java/parsingtool/GenerateOpenDSTestSpecs.java 225 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/functional-tests/shared/java/parsingtool/ParseData.java 236 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/functional-tests/shared/java/parsingtool/README 194 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/functional-tests/shared/java/parsingtool/TestFileList.java 154 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/functional-tests/shared/java/parsingtool/WriteXMLFile_int.java 150 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/functional-tests/shared/java/parsingtool/WriteXMLFile_xml.java 166 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/functional-tests/shared/xsl/functestspec-stylesheet.xml 293 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/functional-tests/shared/xsl/functestspec-stylesheet_security.xml 304 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/functional-tests/shared/java/parsingtool/ArrayData.java
New file
@@ -0,0 +1,153 @@
/*
 * 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
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * 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
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  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
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
import java.io.*;
import java.lang.*;
import java.util.ArrayList;
public class ArrayData
{
  private ArrayList <Object> testGroupName;
  private ArrayList <Object> testGroupPurpose;
  private ArrayList <Object> testSubgroupName;
  private ArrayList <Object> testSuiteName;
  private ArrayList <Object> testSuitePurpose;
  private ArrayList <Object> testSuiteID;
  private ArrayList <Object> testSuiteGroup;
  private ArrayList <Object> testSuitePreamble;
  private ArrayList <Object> testSuitePostamble;
  private ArrayList <Object> testSuite;
  private ArrayList <Object> testName;
  private ArrayList <Object> testMarker;
  private ArrayList <Object> testID;
  private ArrayList <Object> testIssue;
  private ArrayList <Object> testGroup;
  private ArrayList <Object> testScript;
  private ArrayList <Object> testHTMLLink;
  private ArrayList <Object> testPurpose;
  private ArrayList <Object> testPreamble;
  private ArrayList <Object> testSteps;
  private ArrayList <Object> testPostamble;
  private ArrayList <Object> testResult;
  public ArrayData()
  {
    testGroupName = new ArrayList<Object>();
    testGroupPurpose = new ArrayList<Object>();
    testSubgroupName = new ArrayList<Object>();
    testSuiteName = new ArrayList<Object>();
    testSuitePurpose = new ArrayList<Object>();
    testSuiteID = new ArrayList<Object>();
    testSuiteGroup = new ArrayList<Object>();
    testSuitePreamble = new ArrayList<Object>();
    testSuitePostamble = new ArrayList<Object>();
    testSuite = new ArrayList<Object>();
    testName = new ArrayList<Object>();
    testMarker = new ArrayList<Object>();
    testID = new ArrayList<Object>();
    testIssue = new ArrayList<Object>();
    testGroup = new ArrayList<Object>();
    testScript = new ArrayList<Object>();
    testHTMLLink = new ArrayList<Object>();
    testPurpose = new ArrayList<Object>();
    testPreamble = new ArrayList<Object>();
    testSteps = new ArrayList<Object>();
    testPostamble = new ArrayList<Object>();
    testResult = new ArrayList<Object>();
  }
  public void setGroupName(String inGroupName){ testGroupName.add(inGroupName); }
  public void setGroupPurpose(String inGroupPurpose){ testGroupPurpose.add(inGroupPurpose); }
  public void setSubgroupName(String inSubgroupName){ testSubgroupName.add(inSubgroupName); }
  public void setTestSuiteName(String inTestSuiteName){ testSuiteName.add(inTestSuiteName); }
  public void setTestSuitePurpose(String inTestSuitePurpose){ testSuitePurpose.add(inTestSuitePurpose); }
  public void setTestSuiteID(String inTestSuiteID){ testSuiteID.add(inTestSuiteID); }
  public void setTestSuiteGroup(String inTestSuiteGroup){ testSuiteGroup.add(inTestSuiteGroup); }
  public void setTestSuitePreamble(String inTestSuitePreamble){ testSuitePreamble.add(inTestSuitePreamble); }
  public void setTestSuitePostamble(String inTestSuitePostamble){ testSuitePostamble.add(inTestSuitePostamble); }
  public void setTestSuite(String inTestSuite){ testSuite.add(inTestSuite); }
  public void setTestName(String inTestName){ testName.add(inTestName); }
  public void setTestMarker(String inTestMarker){ testMarker.add(inTestMarker); }
  public void setTestID(String inTestID){ testID.add(inTestID); }
  public void setTestIssue(String inTestIssue){ testIssue.add(inTestIssue); }
  public void setTestGroup(String inTestGroup){ testGroup.add(inTestGroup); }
  public void setTestScript(String inTestScript){ testScript.add(inTestScript); }
  public void setTestHTMLLink(String inTestHTMLLink){ testHTMLLink.add(inTestHTMLLink); }
  public void setTestPurpose(String inTestPurpose){ testPurpose.add(inTestPurpose); }
  public void setTestPreamble(String inTestPreamble){ testPreamble.add(inTestPreamble); }
  public void setTestSteps(ArrayList inTestSteps){ testSteps.add(inTestSteps); }
  public void setTestPostamble(String inTestPostamble){ testPostamble.add(inTestPostamble); }
  public void setTestResult(String inTestResult){ testResult.add(inTestResult); }
  public <Object> ArrayList getGroupName(){ return testGroupName; }
  public <Object> ArrayList getGroupPurpose(){ return testGroupPurpose; }
  public <Object> ArrayList getSubgroupName(){ return testSubgroupName; }
  public <Object> ArrayList getTestSuiteName(){ return testSuiteName; }
  public <Object> ArrayList getTestSuitePurpose(){ return testSuitePurpose; }
  public <Object> ArrayList getTestSuiteID(){ return testSuiteID; }
  public <Object> ArrayList getTestSuiteGroup(){ return testSuiteGroup; }
  public <Object> ArrayList getTestSuitePreamble(){ return testSuitePreamble; }
  public <Object> ArrayList getTestSuitePostamble(){ return testSuitePostamble; }
  public <Object> ArrayList getTestSuite(){ return testSuite; }
  public <Object> ArrayList getTestName(){ return testName; }
  public <Object> ArrayList getTestMarker(){ return testMarker; }
  public <Object> ArrayList getTestID(){ return testID; }
  public <Object> ArrayList getTestIssue(){ return testIssue; }
  public <Object> ArrayList getTestGroup(){ return testGroup; }
  public <Object> ArrayList getTestScript(){ return testScript; }
  public <Object> ArrayList getTestHTMLLink(){ return testHTMLLink; }
  public <Object> ArrayList getTestPurpose(){ return testPurpose; }
  public <Object> ArrayList getTestPreamble(){ return testPreamble; }
  public <Object> ArrayList getTestSteps(){ return testSteps; }
  public <Object> ArrayList getTestPostamble(){ return testPostamble; }
  public <Object> ArrayList getTestResult(){ return testResult; }
  public String getGroupName(int index){ if(testGroupName != null && index < testGroupName.size())  return (String)(testGroupName.get(index)); else return null;}
  public String getGroupPurpose(int index){ if(testGroupPurpose != null && index < testGroupPurpose.size())  return (String)(testGroupPurpose.get(index)); else return null;}
  public String getSubgroupName(int index){ if(testSubgroupName != null && index < testSubgroupName.size())  return (String)(testSubgroupName.get(index)); else return null;}
  public String getTestSuiteName(int index){ if(testSuiteName != null && index < testSuiteName.size())  return (String)(testSuiteName.get(index)); else return null;}
  public String getTestSuitePurpose(int index){ if(testSuitePurpose != null && index < testSuitePurpose.size())  return (String)(testSuitePurpose.get(index)); else return null;}
  public String getTestSuiteID(int index){ if(testSuiteID != null && index < testSuiteID.size())  return (String)(testSuiteID.get(index)); else return null;}
  public String getTestSuiteGroup(int index){ if(testSuiteGroup != null && index < testSuiteGroup.size())  return (String)(testSuiteGroup.get(index)); else return null;}
  public String getTestSuitePreamble(int index){ if(testSuitePreamble != null && index < testSuitePreamble.size())  return (String)(testSuitePreamble.get(index)); else return null;}
  public String getTestSuitePostamble(int index){ if(testSuitePostamble != null && index < testSuitePostamble.size())  return (String)(testSuitePostamble.get(index)); else return null;}
  public String getTestSuite(int index){ if(testSuite != null && index < testSuite.size())  return (String)(testSuite.get(index)); else return null;}
  public String getTestName(int index){ if(testName != null && index < testName.size())  return (String)(testName.get(index)); else return null;}
  public String getTestMarker(int index){ if(testMarker != null && index < testMarker.size())  return (String)(testMarker.get(index)); else return null;}
  public String getTestID(int index){ if(testID != null && index < testID.size())  return (String)(testID.get(index)); else return null;}
  public String getTestIssue(int index){ if(testIssue != null && index < testIssue.size()) return (String)(testIssue.get(index)); else return null;}
  public String getTestGroup(int index){ if(testGroup != null && index < testGroup.size()) return (String)(testGroup.get(index)); else return null;}
  public String getTestScript(int index){ if(testScript != null && index < testScript.size()) return (String)(testScript.get(index)); else return null;}
  public String getTestHTMLLink(int index){ if(testHTMLLink != null && index < testHTMLLink.size()) return (String)(testHTMLLink.get(index)); else return null;}
  public String getTestPurpose(int index){ if(testPurpose != null && index < testPurpose.size()) return (String)(testPurpose.get(index)); else return null;}
  public String getTestPreamble(int index){if(testPreamble != null && index < testPreamble.size()) return (String)(testPreamble.get(index)); else return null;}
  public ArrayList<String> getTestSteps(int index){ if(testSteps != null && index < testSteps.size()) return (ArrayList<String>)(testSteps.get(index)); else return null;}
  public String getTestPostamble(int index){ if(testPostamble != null && index < testPostamble.size()) return (String)(testPostamble.get(index)); else return null;}
  public String getTestResult(int index){ if(testResult != null && index < testResult.size()) return (String)(testResult.get(index)); else return null;}
  public int size(){ return testName.size(); }
  public int sizeSuites(){ return testSuiteName.size(); }
}
opendj-sdk/opends/tests/functional-tests/shared/java/parsingtool/GenerateOpenDSTestSpecs.java
New file
@@ -0,0 +1,225 @@
/*
 * 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
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * 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
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  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
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
import java.io.*;
import java.lang.*;
import java.util.ArrayList;
public class GenerateOpenDSTestSpecs
{
  private static String strParentDirName;
  private static String strOutputDirName;
  private static String strFileFormat;
  private static String strTestType;
  private static File fileList;
  private ArrayList <Object> arrayParsedData;
  public GenerateOpenDSTestSpecs()
  {
  }
  public static void main(String[] args)
  {
    // retrieve input
    if(args.length == 3)
    {
      strParentDirName = new String(args[0]);
      strOutputDirName = new String(args[1]);
      strFileFormat = new String(args[2]);
    }
    else
    {
      usage();
      System.exit(0);
    }
    // validate input
    File fileDirName = new File(strParentDirName);
    if(!fileDirName.isDirectory())
    {
      fatalMsg(fileDirName + " is not a directory.");
      System.exit(0);
    }
    else
    {
      System.out.println("Using file directory, " + strParentDirName);
    }
    File outputDirName = new File(strOutputDirName);
    if(!outputDirName.isDirectory())
    {
      fatalMsg(outputDirName + " is not a directory.");
      System.exit(0);
    }
    else
    {
      System.out.println("Using output directory, " + strOutputDirName);
    }
    // java files are assumed to be from the unit-integration tests.
    // xml files are assumed to be from the functional tests.
    if((strFileFormat.startsWith("java")) || (strFileFormat.startsWith("xml")))
    {
        System.out.println("Using file format " + strFileFormat.toString());
        if (strFileFormat.startsWith("java"))
            strTestType = "Int";
        else if (strFileFormat.startsWith("xml"))
            strTestType = "Func";
    }
    else
    {
        fatalMsg(strFileFormat + " is not supported in this version");
        System.exit(0);
    }
    System.out.println("Now running......");
    // create list of files to parse
    TestFileList listFiles = new TestFileList(strParentDirName);
    listFiles.createFileArray();
    // clean out the list of files
    listFiles.purgeFilesWithSubstring("svn");
    if(strFileFormat.startsWith("java"))
    {
        listFiles.keepFilesWithSubstring("java");
    }
    else if(strFileFormat.startsWith("xml"))
    {
        listFiles.keepFilesWithSubstring("xml");
    }
    // The ArrayList object, arrayFiles, contains the list of files that must be parsed.
    ArrayList arrayFiles = listFiles.getFileArray();
    // 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.
    ArrayList arrayDirs = listFiles.getDirArray();
    listFiles.purgeDirsWithSubstring("svn");
    // 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.
    ArrayList <Object>arrayTests = new ArrayList<Object>();
    // For each directory, parse out the data from each file within that directory.
    for(int i=0; i<arrayDirs.size(); i++)
    {
      // parse out data from all java files in a directory
      File gotDir = (File)(arrayDirs.get(i));
      String parsedDir = parseSuite(gotDir, strParentDirName);
      ParseData parseData = new ParseData(parsedDir, strFileFormat);
      try
      {
        arrayTests.add((ArrayData)(parseData.ParseFile(parsedDir, arrayFiles, strParentDirName)));
      }
      catch(Exception e)
      {
    e.printStackTrace();
    System.exit(0);
      }
    }
    // create the output xml files from the ParsedData objects
    for(int i = 0; i < arrayTests.size(); i++)
    {
      ArrayData arrayData = (ArrayData)(arrayTests.get(i));
      if(arrayData.size() > 0)
      {
          if(strFileFormat.startsWith("java"))
          {
            WriteXMLFile_int xmlFile = new WriteXMLFile_int(arrayData.getTestSuite(0));
            try
            {
              xmlFile.MakeXMLFile(arrayData, strOutputDirName);
            }
            catch(Exception e)
            {
              e.printStackTrace();
            }
          }
         else if(strFileFormat.startsWith("xml"))
         {
            WriteXMLFile_xml xmlFile = new WriteXMLFile_xml(arrayData.getTestSuite(0));
            try
            {
              xmlFile.MakeXMLFile(arrayData, strOutputDirName);
            }
            catch(Exception e)
            {
              e.printStackTrace();
            }
         }
      }
    }
    System.out.println("Files successfully written to the output directory.");
  }
  private static void usage()
  {
    System.out.println("Version 01202007");
    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("The file formats that are currently supported are \"java\" and \"xml\".");
    System.out.println("Usage:");
    System.out.println("    java GenerateOpenDSTestSpecs [directory to files] [directory for output files] [file format]");
  }
  private static void fatalMsg(String str)
  {
    System.out.println(str);
    System.out.println("exiting.....");
  }
  private static String parseSuite(File inDir, String strParentDir)
  {
      String tmpStr = new String(inDir.toString());
      int index = tmpStr.indexOf(strParentDir) + strParentDir.length() + 1;
      String subStr = tmpStr.substring(index);
      return subStr;
  }
}
opendj-sdk/opends/tests/functional-tests/shared/java/parsingtool/ParseData.java
New file
@@ -0,0 +1,236 @@
/*
 * 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
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * 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
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  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
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
import java.io.*;
import java.lang.*;
import java.util.ArrayList;
public class ParseData
{
  private String suite;
  private String fileFormat;
  private ArrayData arrayData;
  public ParseData(String inName, String inFileFormat)
  {
    suite = inName;
    fileFormat = inFileFormat;
    arrayData = new ArrayData();
  }
  // Parse out data from all the files in the directory.
  // Place the data into an ArrayData object.
  // Return the ArrayData object.
  public ArrayData ParseFile(String fileDir, ArrayList arrayFiles, String strParentDirName) throws IOException
  {
      String currTestSuite = strParentDirName + "/" + fileDir;
      for(int j=0; j<arrayFiles.size(); j++)
      {
        File currFile = (File)(arrayFiles.get(j));
        if(currFile.toString().indexOf(currTestSuite) >= 0)
        {
          // synthesize the filename for the current file to parse
          String filename = currTestSuite + "/" + currFile.getName();
          File inputFile = new File(filename);
          // Final check to make sure inputFile is a real file
          if(inputFile.isFile())
          {
              FileInputStream fis = new FileInputStream(inputFile);
              LineNumberReader fin = new LineNumberReader(new InputStreamReader(fis));
              String tmpStr;
              while((tmpStr = fin.readLine()) != null)
              {
                // First check the line to see if there is any QA test marker, #@, at all.
                if(tmpStr.indexOf("#@") >= 0)
                {
                  if(tmpStr.indexOf("#@TestSuiteName") >= 0)
                  {
                    arrayData.setTestSuiteName(StripSubstring(tmpStr, "#@TestSuiteName"));
                    //System.out.println("Test suite name is " + arrayData.getTestSuiteName());
                  }
                  else if(tmpStr.indexOf("#@TestGroupName") >= 0)
                  {
                    arrayData.setGroupName(StripSubstring(tmpStr, "#@TestGroupName"));
                  }
                  else if(tmpStr.indexOf("#@TestGroupPurpose") >= 0)
                  {
                    arrayData.setGroupPurpose(StripSubstring(tmpStr, "#@TestGroupPurpose"));
                  }
                  else if(tmpStr.indexOf("#@TestSubgroupName") >= 0)
                  {
                    arrayData.setSubgroupName(StripSubstring(tmpStr, "#@TestSubgroupName"));
                  }
                  else if(tmpStr.indexOf("#@TestSuitePurpose") >= 0)
                  {
                    arrayData.setTestSuitePurpose(StripSubstring(tmpStr, "#@TestSuitePurpose"));
                  }
                  else if(tmpStr.indexOf("#@TestSuiteID") >= 0)
                  {
                    arrayData.setTestSuiteID(StripSubstring(tmpStr, "#@TestSuiteID"));
                  }
                  else if(tmpStr.indexOf("#@TestSuiteGroup") >= 0)
                  {
                    arrayData.setTestSuiteGroup(StripSubstring(tmpStr, "#@TestSuiteGroup"));
                  }
                  else if(tmpStr.indexOf("#@TestSuitePreamble") >= 0)
                  {
                    arrayData.setTestSuitePreamble(StripSubstring(tmpStr, "#@TestSuitePreamble"));
                  }
                  else if(tmpStr.indexOf("#@TestSuitePostamble") >= 0)
                  {
                    arrayData.setTestSuitePostamble(StripSubstring(tmpStr, "#@TestSuitePostamble"));
                  }
                  else if(tmpStr.indexOf("#@TestName") >= 0)
                  {
                    arrayData.setTestName(StripSubstring(tmpStr, "#@TestName"));
                    arrayData.setTestSuite(fileDir);
                  }
                  else if(tmpStr.indexOf("#@TestMarker") >= 0)
                  {
                    arrayData.setTestMarker(StripSubstring(tmpStr, "#@TestMarker"));
                  }
                  else if(tmpStr.indexOf("#@TestID") >= 0)
                  {
                    arrayData.setTestID(StripSubstring(tmpStr, "#@TestID"));
                  }
                  else if(tmpStr.indexOf("#@TestIssue") >= 0)
                  {
                    arrayData.setTestIssue(StripSubstring(tmpStr, "#@TestIssue"));
                  }
                  else if(tmpStr.indexOf("#@TestGroup") >= 0)
                  {
                    arrayData.setTestGroup(StripSubstring(tmpStr, "#@TestGroup"));
                  }
                  else if(tmpStr.indexOf("#@TestScript") >= 0)
                  {
                    arrayData.setTestScript(StripSubstring(tmpStr, "#@TestScript"));
                  }
                  else if(tmpStr.indexOf("#@TestHTMLLink") >= 0)
                  {
                    arrayData.setTestHTMLLink(StripSubstring(tmpStr, "#@TestHTMLLink"));
                  }
                  else if(tmpStr.indexOf("#@TestPreamble") >= 0)
                  {
                    arrayData.setTestPreamble(StripSubstring(tmpStr, "#@TestPreamble"));
                  }
                  else if(tmpStr.indexOf("#@TestStep") >= 0)
                  {
                    ArrayList <String> strIndividualSteps = new ArrayList<String>();
                    fin.mark(1000);
                    while(tmpStr.indexOf("#@TestStep") >= 0)
                    {
                        String strStep = StripSubstring(tmpStr, "#@TestStep");
                        tmpStr = fin.readLine();
                        while((tmpStr.indexOf("#@")) < 0)
                        {
                          strStep = strStep + " " + tmpStr.toString();
                          tmpStr = fin.readLine();
                        }
                        strIndividualSteps.add(strStep);
                    }
                    arrayData.setTestSteps(strIndividualSteps);
                    fin.reset();
                    tmpStr = fin.readLine();
                    while(tmpStr.indexOf("#@") < 0 || tmpStr.indexOf("#@TestStep") >= 0)
                    {
                        fin.mark(100);
                        tmpStr = fin.readLine();
                    }
                    fin.reset();
                  }
                  else if(tmpStr.indexOf("#@TestPostamble") >= 0)
                  {
                    arrayData.setTestPostamble(StripSubstring(tmpStr, "#@TestPostamble"));
                  }
                  else if(tmpStr.indexOf("#@TestPurpose") >= 0)
                  {
                    arrayData.setTestPurpose(StripSubstring(tmpStr, "#@TestPurpose"));
                  }
                  else if(tmpStr.indexOf("#@TestResult") >= 0)
                  {
                    arrayData.setTestResult(StripSubstring(tmpStr, "#@TestResult"));
                    if(fileFormat.startsWith("java"))
                    {
                        // parse test purpose from java doc comments
                        fin.mark(1000);
                        String oneMoLine = new String(fin.readLine().trim());
                        while((oneMoLine.indexOf("/**")) < 0)
                        {
                          oneMoLine = new String(fin.readLine().trim());
                        }
                        oneMoLine = new String(fin.readLine().trim());
                        String strPurpose = StripSubstring(oneMoLine, "*");
                        oneMoLine = new String(fin.readLine().trim());
                        while((oneMoLine.indexOf("@")) < 0)
                        {
                          strPurpose += " ";
                          strPurpose += StripSubstring(oneMoLine.toString().trim(), "*");
                          oneMoLine = new String(fin.readLine().trim());
                        }
                        fin.reset();
                        int starIndex = strPurpose.lastIndexOf("*");
                        if(starIndex > 0)
                        {
                          String strPurpose2 = new String(strPurpose.substring(0, starIndex));
                          arrayData.setTestPurpose(strPurpose2.toString());
                        }
                        else
                        {
                          arrayData.setTestPurpose(strPurpose.toString());
                        }
                    }
                  }
                }
              }
              fin.close();
           }
        }
      }
      return arrayData;
  }
  private String StripSubstring(String tmpStr, String subStr)
  {
    int index = tmpStr.indexOf(subStr);
    String retStr = tmpStr.substring(index + subStr.length());
    return (retStr.trim());
  }
}
opendj-sdk/opends/tests/functional-tests/shared/java/parsingtool/README
New file
@@ -0,0 +1,194 @@
/*
 * 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
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * 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
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  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
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
The purpose of the parsing tool is to parse comments from the functional test xml files.
The comments must have preset tags in order for the them to be properly captured by the
parsing tool. This README files will describe what is needed in the comments of
the functional test xml files, and how to build and run the parsing tool.
***Function Test XML Files - Test Group Tags***
Each directory will be assumed to contain the tests within a test group.
Each test group needs to have the following tags.......
#@TestGroupName
#@TestGroupPurpose
#@TestSubgroupName  [only necessary for some test groups, like Security]
It is not critical in which xml file or where in the xml file these tags are located,
as long as the xml file is in the proper directory for the test group. For convenience,
the tags for the test group should be near the top of the xml file which is used
for setting up for the test group test cases.
The following is an example for the test group, functional-tests/testcases/security/pwd_storage,
and is located in file, security_setup_pwd_storage.xml
      <!---
            Place group-specific test information here.
            #@TestGroupName             Security
            #@TestGroupPurpose          To test the security functionality.
            #@TestSubgroupName          Password Storage Schemes
      -->
Some test groups will not have the tag, #@TestSubgroupName.
For instance, the test group tags for the Backend group are
     <!--
            Place group-specific test information here.
            #@TestGroupName             Backends
            #@TestGroupPurpose          To test the backend functionality.
     -->
***Function Test XML Files - Test Suite Tags***
Each xml file will be treated as a test suite. Each file should contain the following tags......
#@TestSuiteName
#@TestSuitePurpose
#@TestSuiteGroup
#@TestScript
The tags should be located near the top of each file. The exact location is not critical.
The following example is from the test suite, MD5 Tests, which is located in
functional-tests/testcases/security/pwd_storage/security_pwd_MD5.xml.
      <!---
            Place suite-specific test information here.
            #@TestSuiteName             MD5 Tests
            #@TestSuitePurpose          Test the MD5 storage scheme.
            #@TestSuiteGroup            MD5 Storage Scheme Tests
            #@TestScript                security_pwd_MD5.xml
      -->
***Function Test XML Files - Test Case Tags***
Each functional test xml file will have multiple test cases.
Each test case should have the following tags........
#@TestMarker
#@TestName
#@TestIssue
#@TestPurpose
#@TestPreamble
#@TestStep
#@TestPostamble
#@TestResult
The tags should be located near the beginning of each test case.
The #@TestMarker should match the value of #@TestSuiteName. The parsing tool needs this
correlation to match each test case with the proper test suite.
The #@TestIssue should be the number in IssueTracker that corresponds to the feature or defect
which this test case is testing. Do not add the hyperlink to the issue web page.
The parsing tool adds the hyperlink when it runs.
As many #@TestStep tags may used to define the steps that are involved in each test case.
There should be one #@TestStep tag for each step. There is no limit to the number of test
steps which may be defined. Each test step may have multiple lines.
The #@TestResult may have multiple lines.
The following example is from the file,
functional-tests/testcases/security/pwd_storage/security_pwd_MD5.xml
       <!---
            Place test-specific test information here.
            The tag, TestMarker, must be the same as the tag, TestSuiteName.
            #@TestMarker                MD5 Tests
            #@TestName                  MD5 Preamble
            #@TestIssue                 312
            #@TestPurpose               Change password storage scheme to MD5.
            #@TestPreamble              none
            #@TestStep                  Client calls ldapmodify
                                        with the filename to the appropriate file.
            #@TestPostamble             none
            #@TestResult                Success if OpenDS returns 0
        -->
The following is another example from the file,
functional-tests/testcases/security/pwd_storage/security_pwd_MD5.xml
Note that this example contains three test steps.
       <!---
            Place test-specific test information here.
            The tag, TestMarker, must be the same as the tag, TestSuiteName.
            #@TestMarker                MD5 Tests
            #@TestName                  MD5 Test 1
            #@TestIssue                 312
            #@TestPurpose               Test MD5 password storage scheme.
            #@TestPreamble              none
            #@TestStep                  Admin changes a user's password to convert
                                        so it is stored as MD5 scheme.
            #@TestStep                  The user binds with the new password.
            #@TestStep                  Admin retrieves the user's password and
                                        checks for the required {MD5} prefix.
            #@TestPostamble             none
            #@TestResult                Success if OpenDS returns 0 for the ldap
                                        operations and the password has the {MD5} prefix.
        -->
***Building the Parser Tool***
No other packages are necessary for building the java files other than those
that come with the jvm. Java version 1.5.0 was used to build the java files.
Command line build while in the directory containing the java files.....
javac *.java
***Running the Parser Tool***
Three parameters are required to run the parsing tool from the command line, directory-to-testcase-files,
directory-for-output-files, and file format.
Command line execution.....
java -cp [path-to-class-files] GenerateOpenDSTestSpecs [directory-to-testcase-files] [directory-for-output-files] [file format]
The directory-to-testcase-files is the directory from where the parsing tool will begin searching
for functional test files to parse. The parsing tool will only search one or two levels below
the value for this parameter.
The directory-for-output-files is where the parsing tool will place the output xml files.
The file format is necessary because the same code is used for the unit-integration tests where
java files are parsed for test specifications rather than xml files. The file format must be
"xml" for the functional tests.
An example command line execution of the parsing tool would be
java -cp /export/ParseTestCode GenerateOpenDSTestSpecs /export/src/opends/tests/functional-tests/testcases /export/testspecs xml
where
the class files for the parsing tool are in /export/ParseTestCode
the directory-to-testcase-files is /export/src/opends/tests/functional-tests/testcases
the directory-for-output-files is /export/testspecs
the file format is xml.
opendj-sdk/opends/tests/functional-tests/shared/java/parsingtool/TestFileList.java
New file
@@ -0,0 +1,154 @@
/*
 * 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
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * 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
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  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
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
import java.io.*;
import java.lang.*;
import java.util.ArrayList;
public class TestFileList
{
  private File fileParentDirName;
  private ArrayList <Object> arrayFiles;
  private ArrayList <Object> arrayDirs;
  public TestFileList(String inParentDir)
  {
    fileParentDirName = new File(inParentDir);
  }
  public ArrayList createFileArray()
  {
    // Retrieve list of files to parse
    File fileAndDirList[] = fileParentDirName.listFiles();
    // create an array object that can be increased and decreased in size
    arrayFiles = new ArrayList<Object>(fileAndDirList.length);
    for(int i=0; i<fileAndDirList.length; i++)
    {
      arrayFiles.add((File)(fileAndDirList[i]));
    }
    // find the files in subdirectories
    arrayDirs = new ArrayList<Object>();
    int intStartNumElements = arrayFiles.size();
    for(int i=0; i<intStartNumElements; i++)
    {
      File fileChildDirName = (File)(arrayFiles.get(i));
      if(fileChildDirName.isDirectory())
      {
    arrayDirs.add((File)(fileChildDirName));
        File fileTmpList[] = fileChildDirName.listFiles();
        for(int j=0; j<fileTmpList.length; j++)
        {
      if(fileTmpList[j].isFile())
          {
          arrayFiles.add((File)(fileTmpList[j]));
          }
          else if(fileTmpList[j].isDirectory())
          {
              arrayDirs.add((File)(fileTmpList[j]));
              File fileTmpList2[] = fileTmpList[j].listFiles();
              for(int j2=0; j2<fileTmpList2.length; j2++)
              {
                    if(fileTmpList2[j2].isFile())
                    {
                        arrayFiles.add((File)(fileTmpList2[j2]));
                    }
              }
          }
      //System.out.println("Found " + fileTmpList[j].toString());
    }
      }
    }
    // clean out file array
    for(int i=arrayFiles.size()-1; i>=0; i--)
    {
      File fileTmp = (File)(arrayFiles.get(i));
      if(fileTmp.isDirectory())
    arrayFiles.remove(i);
    }
    return arrayFiles;
  }
  public void purgeFilesWithSubstring(String subStr)
  {
    for(int i=arrayFiles.size()-1; i>=0; i--)
    {
      File fileTmp = (File)(arrayFiles.get(i));
      if(fileTmp.toString().indexOf(subStr) >= 0)
    arrayFiles.remove(i);
    }
  }
  public void keepFilesWithSubstring(String subStr)
  {
    for(int i=arrayFiles.size()-1; i>=0; i--)
    {
      File fileTmp = (File)(arrayFiles.get(i));
      if(fileTmp.toString().indexOf(subStr) < 0)
    arrayFiles.remove(i);
    }
  }
  public void purgeDirsWithSubstring(String subStr)
  {
    for(int i=arrayDirs.size()-1; i>=0; i--)
    {
      File fileTmp = (File)(arrayDirs.get(i));
      if(fileTmp.toString().indexOf(subStr) >= 0)
    arrayDirs.remove(i);
    }
  }
  public void keepDirsWithSubstring(String subStr)
  {
    for(int i=arrayDirs.size()-1; i>=0; i--)
    {
      File fileTmp = (File)(arrayDirs.get(i));
      if(fileTmp.toString().indexOf(subStr) < 0)
    arrayDirs.remove(i);
    }
  }
  public ArrayList getFileArray()
  {
    return arrayFiles;
  }
  public ArrayList getDirArray()
  {
    return arrayDirs;
  }
}
opendj-sdk/opends/tests/functional-tests/shared/java/parsingtool/WriteXMLFile_int.java
New file
@@ -0,0 +1,150 @@
/*
 * 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
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * 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
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  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
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
import java.io.*;
import java.lang.*;
import java.util.ArrayList;
public class WriteXMLFile_int
{
  private String group;
  private ArrayData arrayData;
  public WriteXMLFile_int(String inGroup)
  {
    group = inGroup;
  }
  public void MakeXMLFile(ArrayData arrayData, String strDir) throws IOException
  {
    //System.out.println("For " + group + " the number of suites is " + Integer.toString(arrayData.sizeSuites()));
    //System.out.println("The number of tests is " + Integer.toString(arrayData.size()));
    String strDirName = strDir + "/" + group;
    File fileDirName = new File(strDirName);
    if(!fileDirName.isDirectory())
    {
      if(!fileDirName.mkdirs())
      {
    System.out.println("Could not create directory, " + strDirName);
    System.out.println("Exiting.....");
    System.exit(0);
      }
    }
    String strFilename = strDirName + "/" + group + ".xml";
    File fileOutput = new File(strFilename);
    FileWriter fwOutput = new FileWriter(fileOutput);
    fwOutput.write("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
    fwOutput.write("<?xml-stylesheet type=\"text/xsl\" href=\"" + group + ".xsl\"?>\n");
    fwOutput.write("<qa xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"no-schema-yet.xsd\">\n\n");
    fwOutput.write("  <!-- A section describing each product under test -->\n");
    fwOutput.write("  <product name=\"OpenDS\">\n\n");
    fwOutput.write("    <!-- A section describing each testgroup-->\n");
    fwOutput.write("    <testgroup  name=\"Integration\">\n");
    fwOutput.write("      <category name=\"" + group + "\"/>\n");
    fwOutput.write("      <groupid>" + group + "</groupid>\n");
    fwOutput.write("      <purpose></purpose>\n");
    fwOutput.write("      <version></version>\n");
    fwOutput.write("      <url>http://samsonite.central.sun.com/" + group + "</url>\n\n");
    fwOutput.write("      <!-- A section describing each testsuite-->\n");
    for(int i = 0; i < arrayData.sizeSuites(); i++)
    {
      String currTestSuite = new String(arrayData.getTestSuiteName(i));
      //System.out.println("currTestSuite is " + currTestSuite.toString());
      String currTestGroup = arrayData.getTestGroup(i);
      String currTestScript = arrayData.getTestScript(i);
      String currTestHTMLLink = "";
      //String currTestHTMLLink = arrayData.getTestHTMLLink(i);
      fwOutput.write("      <testsuite name=\"" + currTestSuite + "\">\n");
      fwOutput.write("          <purpose>" + arrayData.getTestSuitePurpose(i) + "</purpose>\n");
      fwOutput.write("          <suiteid>" + arrayData.getTestSuiteID(i) + "</suiteid>\n");
      fwOutput.write("          <group>" + arrayData.getTestSuiteGroup(i) + "</group>\n\n");
      fwOutput.write("         <!-- A section describing each testcase-->\n");
      //System.out.println("arrayData size is " + Integer.toString(arrayData.size()));
      for(int j = 0; j < arrayData.size(); j++)
      {
    //System.out.println("Test Marker is\n" + arrayData.getTestMarker(j));
    //System.out.println("currTestSuite is\n" + currTestSuite);
        //System.out.println(" ");
    if(currTestSuite.indexOf(arrayData.getTestMarker(j)) >= 0)
    {
          fwOutput.write("         <testcase name=\"" + arrayData.getTestName(j) + "\">\n");
          fwOutput.write("            <testid>" + arrayData.getTestID(j) + "</testid>\n");
          //fwOutput.write("            <testissue>" + arrayData.getTestIssue(j) + "</testissue>\n");
          fwOutput.write("            <group>" + currTestGroup + "</group>\n");
          fwOutput.write("            <suite>" + currTestSuite.toString() + "</suite>\n");
          fwOutput.write("            <purpose>" + arrayData.getTestPurpose(j) + "</purpose>\n");
          fwOutput.write("            <testscript>\n");
          fwOutput.write("                        <a href=\"" + currTestHTMLLink +  "\">" + currTestScript + "</a>\n");
          fwOutput.write("            </testscript>\n");
          fwOutput.write("            <steps>\n");
          fwOutput.write("              <step>\n");
          fwOutput.write("               " + arrayData.getTestSteps(j) + "\n");
          fwOutput.write("              </step>\n");
          fwOutput.write("            </steps>\n");
      String tmpString = new String(arrayData.getTestPreamble(j));
      if(tmpString.length() == 0)
      {
            fwOutput.write("            <preamble>None</preamble>\n");
      }
      else
          {
        fwOutput.write("            <preamble>" + tmpString + "</preamble>\n");
      }
      tmpString = new String(arrayData.getTestPostamble(j));
      if(tmpString.length() == 0)
      {
            fwOutput.write("            <postamble>None</postamble>\n");
      }
      else
          {
        fwOutput.write("            <postamble>" + tmpString + "</postamble>\n");
      }
          fwOutput.write("            <postamble>" + arrayData.getTestPostamble(j) + "</postamble>\n");
          fwOutput.write("            <result>\n");
          fwOutput.write("             " + arrayData.getTestResult(j) + "\n");
          fwOutput.write("            </result>\n");
          fwOutput.write("         </testcase>\n\n");
        }
      }
      fwOutput.write("      </testsuite>\n\n");
    }
    fwOutput.write("    </testgroup>\n");
    fwOutput.write("  </product>\n");
    fwOutput.write("</qa>\n");
    fwOutput.close();
  }
}
opendj-sdk/opends/tests/functional-tests/shared/java/parsingtool/WriteXMLFile_xml.java
New file
@@ -0,0 +1,166 @@
/*
 * 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
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * 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
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  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
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
import java.io.*;
import java.lang.*;
import java.util.ArrayList;
public class WriteXMLFile_xml
{
  private String group;
  private ArrayData arrayData;
  private ArrayList <String> strIndividualSteps;
  public WriteXMLFile_xml(String inGroup)
  {
    group = inGroup;
    strIndividualSteps = null;
  }
  public void MakeXMLFile(ArrayData arrayData, String strDir) throws IOException
  {
    String strDirName = strDir + "/" + group;
    File fileDirName = new File(strDirName);
    if(!fileDirName.isDirectory())
    {
      if(!fileDirName.mkdirs())
      {
    System.out.println("Could not create directory, " + strDirName);
    System.out.println("Exiting.....");
    System.exit(0);
      }
    }
    String strFilename;
    if(group.indexOf("/") < 0)
    {
        strFilename = strDirName + "/" + group + ".xml";
    }
    else
    {
        String tmpStr = new String(group);
        int index = tmpStr.indexOf("/") + 1;
        String subStr = tmpStr.substring(index);
        strFilename = strDirName + "/" + subStr + ".xml";
    }
    File fileOutput = new File(strFilename);
    FileWriter fwOutput = new FileWriter(fileOutput);
    fwOutput.write("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
    fwOutput.write("<?xml-stylesheet type=\"text/xsl\" href=\"" + group + ".xsl\"?>\n");
    fwOutput.write("<qa xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"no-schema-yet.xsd\">\n\n");
    fwOutput.write("  <!-- A section describing each product under test -->\n");
    fwOutput.write("  <product name=\"OpenDS\">\n\n");
    fwOutput.write("    <!-- A section describing each testgroup-->\n");
    fwOutput.write("    <testgroup  name=\"Functional\">\n");
    fwOutput.write("      <groupname>" + arrayData.getGroupName(0) + "</groupname>\n");
    fwOutput.write("      <grouppurpose>" + arrayData.getGroupPurpose(0) + "</grouppurpose>\n");
    fwOutput.write("      <subgroupname>" + arrayData.getSubgroupName(0) + "</subgroupname>\n");
    fwOutput.write("      <category name=\"" + group + "\"/>\n");
    fwOutput.write("      <groupid>" + group + "</groupid>\n");
    fwOutput.write("      <purpose></purpose>\n");
    fwOutput.write("      <version></version>\n");
    fwOutput.write("      <url>https://opends.dev.java.net</url>\n\n");
    fwOutput.write("      <!-- A section describing each testsuite-->\n");
    for(int i = 0; i < arrayData.sizeSuites(); i++)
    {
      String currTestSuite = new String(arrayData.getTestSuiteName(i));
      String currTestGroup = arrayData.getTestGroup(i);
      String currTestScript = arrayData.getTestScript(i);
      String currTestHTMLLink = "";
      fwOutput.write("      <testsuite name=\"" + currTestSuite + "\">\n");
      fwOutput.write("          <purpose>" + arrayData.getTestSuitePurpose(i) + "</purpose>\n");
      fwOutput.write("          <suiteid>" + arrayData.getTestSuiteID(i) + "</suiteid>\n");
      fwOutput.write("          <group>" + arrayData.getTestSuiteGroup(i) + "</group>\n");
      fwOutput.write("         <!-- A section describing each testcase-->\n");
      for(int j = 0; j < arrayData.size(); j++)
      {
    if(currTestSuite.indexOf(arrayData.getTestMarker(j)) == 0)
    {
          fwOutput.write("         <testcase name=\"" + arrayData.getTestName(j) + "\">\n");
          fwOutput.write("            <testid>" + arrayData.getTestID(j) + "</testid>\n");
          fwOutput.write("            <testissue>" + arrayData.getTestIssue(j) + "</testissue>\n");
          fwOutput.write("            <group>" + currTestGroup + "</group>\n");
          fwOutput.write("            <suite>" + currTestSuite.toString() + "</suite>\n");
          fwOutput.write("            <purpose>" + arrayData.getTestPurpose(j) + "</purpose>\n");
          fwOutput.write("            <testscript>" + currTestScript + "</testscript>\n");
          fwOutput.write("            <steps>\n");
          strIndividualSteps = arrayData.getTestSteps(j);
          for(int j2=0; j2<strIndividualSteps.size(); j2++)
          {
                fwOutput.write("              <step>\n");
                if(strIndividualSteps.size() > 1)
                    fwOutput.write(               Integer.toString(j2+1) + ". " + strIndividualSteps.get(j2) + "\n");
                else
                    fwOutput.write(               strIndividualSteps.get(j2) + "\n");
                fwOutput.write("              </step>\n");
          }
          fwOutput.write("            </steps>\n");
      String tmpString = new String(arrayData.getTestPreamble(j));
      if(tmpString.length() == 0)
      {
            fwOutput.write("            <preamble>None</preamble>\n");
      }
      else
          {
        fwOutput.write("            <preamble>" + tmpString + "</preamble>\n");
      }
      tmpString = new String(arrayData.getTestPostamble(j));
      if(tmpString == null || tmpString.length() == 0)
      {
            fwOutput.write("            <postamble>None</postamble>\n");
      }
      else
          {
        fwOutput.write("            <postamble>" + tmpString + "</postamble>\n");
      }
          fwOutput.write("            <postamble>" + arrayData.getTestPostamble(j) + "</postamble>\n");
          fwOutput.write("            <result>\n");
          fwOutput.write("             " + arrayData.getTestResult(j) + "\n");
          fwOutput.write("            </result>\n");
          fwOutput.write("         </testcase>\n\n");
        }
      }
      fwOutput.write("      </testsuite>\n\n");
    }
    fwOutput.write("    </testgroup>\n");
    fwOutput.write("  </product>\n");
    fwOutput.write("</qa>\n");
    fwOutput.close();
  }
}
opendj-sdk/opends/tests/functional-tests/shared/xsl/functestspec-stylesheet.xml
New file
@@ -0,0 +1,293 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
  <xsl:element name="html">
  <xsl:element name="body">
      <xsl:variable name="spec" select="/group/@name"/>
      <xsl:variable name="testgroup" select="document(concat('../docs/tests/specs/',$spec,'/',$spec,'.xml'))/qa/product/testgroup"/>
      <xsl:for-each select="$testgroup">
        <xsl:element name="title">
            <xsl:value-of select="@name"/>
             <xsl:value-of select="' Test Specification'"/>
        </xsl:element>
        <xsl:element name="h2">
            <xsl:attribute name="align">center</xsl:attribute>
            <xsl:value-of select="@name"/>
            <xsl:value-of select="' Test Specification'"/>
        </xsl:element>
        <!-- Test Group Table -->
        <xsl:element name="table">
          <xsl:attribute name="border">1</xsl:attribute>
          <xsl:attribute name="width">80%</xsl:attribute>
         <xsl:element name="tr">
            <xsl:attribute name="bgcolor">yellow</xsl:attribute>
            <xsl:element name="td">
              <xsl:attribute name="width">20%</xsl:attribute>
              <xsl:element name="b">
                <xsl:value-of select="'Test Group'"/>
              </xsl:element>
            </xsl:element>
            <xsl:element name="td">
                <xsl:value-of select="groupname"/>
            </xsl:element>
          </xsl:element>
          <xsl:element name="tr">
            <xsl:element name="td">
              <xsl:attribute name="width">20%</xsl:attribute>
              <xsl:element name="b">
                <xsl:value-of select="'Test Purpose'"/>
              </xsl:element>
            </xsl:element>
            <xsl:element name="td">
                <xsl:value-of select="grouppurpose"/>
            </xsl:element>
          </xsl:element>
        </xsl:element>
        <xsl:element name="br"/>
        <!-- Test Suite List -->
        <xsl:element name="ol">
          <xsl:for-each select="testsuite">
            <xsl:element name="li">
              <xsl:element name="a">
                <xsl:attribute name="href">
                  <xsl:value-of select="concat('#',@name)"/>
                </xsl:attribute>
                <xsl:value-of select="@name"/>
              </xsl:element>
              <xsl:value-of select="concat(' : ',purpose)"/>
            </xsl:element>
          </xsl:for-each>
        </xsl:element>
        <xsl:for-each select="testsuite">
          <!-- Test Suite Header -->
          <xsl:element name="h2">
            <xsl:value-of select="@name"/>
          </xsl:element>
          <!-- Test Suite Anchor -->
          <xsl:element name="a">
            <xsl:attribute name="name">
              <xsl:value-of select="@name"/>
            </xsl:attribute>
          </xsl:element>
          <!-- Test Suite Table -->
          <xsl:element name="table">
            <xsl:attribute name="border">1</xsl:attribute>
            <xsl:attribute name="width">80%</xsl:attribute>
            <xsl:element name="tr">
              <xsl:attribute name="bgcolor">aqua</xsl:attribute>
              <xsl:element name="td">
                <xsl:attribute name="width">20%</xsl:attribute>
                <xsl:element name="b">
                  <xsl:value-of select="'Test Suite Name'"/>
                </xsl:element>
              </xsl:element>
              <xsl:element name="td">
                  <xsl:value-of select="@name"/>
              </xsl:element>
            </xsl:element>
            <xsl:element name="tr">
              <xsl:element name="td">
                <xsl:attribute name="width">20%</xsl:attribute>
                <xsl:element name="b">
                  <xsl:value-of select="'Purpose'"/>
                </xsl:element>
              </xsl:element>
              <xsl:element name="td">
                  <xsl:value-of select="purpose"/>
              </xsl:element>
            </xsl:element>
            <xsl:element name="tr">
              <xsl:element name="td">
                <xsl:attribute name="width">20%</xsl:attribute>
                  <xsl:element name="b">
                    <xsl:value-of select="'Suite Group'"/>
                  </xsl:element>
                </xsl:element>
                <xsl:element name="td">
                  <xsl:value-of select="group"/>
              </xsl:element>
            </xsl:element>
            </xsl:element>
            <xsl:element name="br"/>
            <xsl:for-each select="testcase">
              <!-- Test Case Table -->
              <xsl:element name="table">
                <xsl:attribute name="border">1</xsl:attribute>
                <xsl:attribute name="width">80%</xsl:attribute>
              <!-- Test Name -->
              <xsl:element name="a">
                <xsl:attribute name="name">
                  <xsl:value-of select="testid"/>
                </xsl:attribute>
              </xsl:element>
              <xsl:element name="tr">
                <xsl:attribute name="bgcolor">lightblue</xsl:attribute>
                <xsl:element name="td">
                  <xsl:attribute name="width">20%</xsl:attribute>
                  <xsl:element name="a">
                    <xsl:attribute name="width">20%</xsl:attribute>
                  </xsl:element>
                  <xsl:element name="b">
                    <xsl:value-of select="'Test Name'"/>
                  </xsl:element>
                </xsl:element>
                <xsl:element name="td">
                  <xsl:value-of select="@name"/>
                </xsl:element>
              </xsl:element>
              <!-- Test Purpose -->
              <xsl:element name="tr">
                <xsl:element name="td">
                  <xsl:attribute name="width">20%</xsl:attribute>
                  <xsl:element name="b">
                    <xsl:value-of select="'Test Purpose'"/>
                  </xsl:element>
                </xsl:element>
                <xsl:element name="td">
                  <xsl:value-of select="purpose"/>
                </xsl:element>
              </xsl:element>
              <!-- Test Script -->
              <xsl:element name="tr">
                <xsl:element name="td">
                <xsl:attribute name="width">20%</xsl:attribute>
                  <xsl:element name="b">
                    <xsl:value-of select="'Test Script'"/>
                  </xsl:element>
                </xsl:element>
                <xsl:element name="td">
                  <xsl:element name="a">
                    <xsl:attribute name="href">
                      <xsl:value-of select="concat('https://opends.dev.java.net/source/browse/opends/trunk/opends/tests/functional-tests/testcases/',$spec,'/',testscript)"/>
                    </xsl:attribute>
                    <xsl:value-of select="testscript"/>
                  </xsl:element>
                </xsl:element>
              </xsl:element>
              <!-- Test Issue -->
              <xsl:element name="tr">
                <xsl:element name="td">
                <xsl:attribute name="width">20%</xsl:attribute>
                  <xsl:element name="b">
                    <xsl:value-of select="'Test Issue'"/>
                  </xsl:element>
                </xsl:element>
                <xsl:element name="td">
                  <xsl:element name="a">
                    <xsl:attribute name="href">
                      <xsl:value-of select="concat('https://opends.dev.java.net/issues/show_bug.cgi?id=',testissue)"/>
                    </xsl:attribute>
                    <xsl:value-of select="testissue"/>
                  </xsl:element>
                </xsl:element>
              </xsl:element>
              <!-- Test Preamble -->
              <xsl:element name="tr">
                <xsl:element name="td">
                  <xsl:attribute name="width">20%</xsl:attribute>
                  <xsl:element name="b">
                    <xsl:value-of select="'Preamble'"/>
                  </xsl:element>
                </xsl:element>
                <xsl:element name="td">
                  <xsl:value-of select="preamble"/>
                </xsl:element>
              </xsl:element>
              <!-- Test Steps -->
              <xsl:element name="tr">
                <xsl:element name="td">
                  <xsl:attribute name="width">20%</xsl:attribute>
                  <xsl:element name="b">
                    <xsl:value-of select="'Test Steps'"/>
                  </xsl:element>
                </xsl:element>
                <xsl:element name="td">
                  <xsl:for-each select="steps/step">
                    <xsl:value-of select="."/>
                    <xsl:element name="br"/>
                  </xsl:for-each>
                </xsl:element>
              </xsl:element>
              <!-- Test Postamble -->
              <xsl:element name="tr">
                <xsl:element name="td">
                  <xsl:attribute name="width">20%</xsl:attribute>
                  <xsl:element name="b">
                    <xsl:value-of select="'Postamble'"/>
                  </xsl:element>
                </xsl:element>
                <xsl:element name="td">
                  <xsl:value-of select="postamble"/>
                </xsl:element>
              </xsl:element>
              <!-- Test Result -->
              <xsl:element name="tr">
                <xsl:element name="td">
                  <xsl:attribute name="width">20%</xsl:attribute>
                  <xsl:element name="b">
                    <xsl:value-of select="'Test Result'"/>
                  </xsl:element>
                </xsl:element>
                <xsl:element name="td">
                  <xsl:value-of select="result"/>
                </xsl:element>
              </xsl:element>
            </xsl:element>
            <xsl:element name="br"/>
          </xsl:for-each>
        </xsl:for-each>
    </xsl:for-each>
    </xsl:element>
  </xsl:element>
</xsl:template>
</xsl:stylesheet>
opendj-sdk/opends/tests/functional-tests/shared/xsl/functestspec-stylesheet_security.xml
New file
@@ -0,0 +1,304 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
  <xsl:element name="html">
  <xsl:element name="body">
      <xsl:variable name="spec" select="/group/@name"/>
      <xsl:variable name="testgroup" select="document(concat('../docs/tests/specs/security/',$spec,'/',$spec,'.xml'))/qa/product/testgroup"/>
      <xsl:for-each select="$testgroup">
        <xsl:element name="title">
            <xsl:value-of select="@name"/>
             <xsl:value-of select="' Test Specification'"/>
        </xsl:element>
        <xsl:element name="h2">
            <xsl:attribute name="align">center</xsl:attribute>
            <xsl:value-of select="@name"/>
            <xsl:value-of select="' Test Specification'"/>
        </xsl:element>
        <!-- Test Group Table -->
        <xsl:element name="table">
          <xsl:attribute name="border">1</xsl:attribute>
          <xsl:attribute name="width">80%</xsl:attribute>
        <xsl:element name="tr">
            <xsl:attribute name="bgcolor">yellow</xsl:attribute>
            <xsl:element name="td">
              <xsl:attribute name="width">20%</xsl:attribute>
              <xsl:element name="b">
                <xsl:value-of select="'Test Group'"/>
              </xsl:element>
            </xsl:element>
            <xsl:element name="td">
                <xsl:value-of select="groupname"/>
            </xsl:element>
          </xsl:element>
          <xsl:element name="tr">
            <xsl:element name="td">
              <xsl:attribute name="width">20%</xsl:attribute>
              <xsl:element name="b">
                <xsl:value-of select="'Test Group Purpose'"/>
              </xsl:element>
            </xsl:element>
            <xsl:element name="td">
                <xsl:value-of select="grouppurpose"/>
            </xsl:element>
          </xsl:element>
          <xsl:element name="tr">
            <xsl:element name="td">
              <xsl:attribute name="width">20%</xsl:attribute>
              <xsl:element name="b">
                <xsl:value-of select="'Test Subgroup'"/>
              </xsl:element>
            </xsl:element>
            <xsl:element name="td">
                <xsl:value-of select="subgroupname"/>
            </xsl:element>
          </xsl:element>
        </xsl:element>
        <xsl:element name="br"/>
        <!-- Test Suite List -->
        <xsl:element name="ol">
          <xsl:for-each select="testsuite">
            <xsl:element name="li">
              <xsl:element name="a">
                <xsl:attribute name="href">
                  <xsl:value-of select="concat('#',@name)"/>
                </xsl:attribute>
                <xsl:value-of select="@name"/>
              </xsl:element>
              <xsl:value-of select="concat(' : ',purpose)"/>
            </xsl:element>
          </xsl:for-each>
        </xsl:element>
        <xsl:for-each select="testsuite">
          <!-- Test Suite Header -->
          <xsl:element name="h2">
            <xsl:value-of select="@name"/>
          </xsl:element>
          <!-- Test Suite Anchor -->
          <xsl:element name="a">
            <xsl:attribute name="name">
              <xsl:value-of select="@name"/>
            </xsl:attribute>
          </xsl:element>
          <!-- Test Suite Table -->
          <xsl:element name="table">
            <xsl:attribute name="border">1</xsl:attribute>
            <xsl:attribute name="width">80%</xsl:attribute>
            <xsl:element name="tr">
              <xsl:attribute name="bgcolor">aqua</xsl:attribute>
              <xsl:element name="td">
                <xsl:attribute name="width">20%</xsl:attribute>
                <xsl:element name="b">
                  <xsl:value-of select="'Test Suite Name'"/>
                </xsl:element>
              </xsl:element>
              <xsl:element name="td">
                  <xsl:value-of select="@name"/>
              </xsl:element>
            </xsl:element>
            <xsl:element name="tr">
              <xsl:element name="td">
                <xsl:attribute name="width">20%</xsl:attribute>
                <xsl:element name="b">
                  <xsl:value-of select="'Purpose'"/>
                </xsl:element>
              </xsl:element>
              <xsl:element name="td">
                  <xsl:value-of select="purpose"/>
              </xsl:element>
            </xsl:element>
            <xsl:element name="tr">
              <xsl:element name="td">
                <xsl:attribute name="width">20%</xsl:attribute>
                  <xsl:element name="b">
                    <xsl:value-of select="'Suite Group'"/>
                  </xsl:element>
                </xsl:element>
                <xsl:element name="td">
                  <xsl:value-of select="group"/>
              </xsl:element>
            </xsl:element>
            </xsl:element>
            <xsl:element name="br"/>
            <xsl:for-each select="testcase">
              <!-- Test Case Table -->
              <xsl:element name="table">
                <xsl:attribute name="border">1</xsl:attribute>
                <xsl:attribute name="width">80%</xsl:attribute>
              <!-- Test Name -->
              <xsl:element name="a">
                <xsl:attribute name="name">
                  <xsl:value-of select="testid"/>
                </xsl:attribute>
              </xsl:element>
              <xsl:element name="tr">
                <xsl:attribute name="bgcolor">lightblue</xsl:attribute>
                <xsl:element name="td">
                  <xsl:attribute name="width">20%</xsl:attribute>
                  <xsl:element name="a">
                    <xsl:attribute name="width">20%</xsl:attribute>
                  </xsl:element>
                  <xsl:element name="b">
                    <xsl:value-of select="'Test Name'"/>
                  </xsl:element>
                </xsl:element>
                <xsl:element name="td">
                  <xsl:value-of select="@name"/>
                </xsl:element>
              </xsl:element>
              <!-- Test Purpose -->
              <xsl:element name="tr">
                <xsl:element name="td">
                  <xsl:attribute name="width">20%</xsl:attribute>
                  <xsl:element name="b">
                    <xsl:value-of select="'Test Purpose'"/>
                  </xsl:element>
                </xsl:element>
                <xsl:element name="td">
                  <xsl:value-of select="purpose"/>
                </xsl:element>
              </xsl:element>
              <!-- Test Script -->
              <xsl:element name="tr">
                <xsl:element name="td">
                <xsl:attribute name="width">20%</xsl:attribute>
                  <xsl:element name="b">
                    <xsl:value-of select="'Test Script'"/>
                  </xsl:element>
                </xsl:element>
                <xsl:element name="td">
                  <xsl:element name="a">
                    <xsl:attribute name="href">
                      <xsl:value-of select="concat('https://opends.dev.java.net/source/browse/opends/trunk/opends/tests/functional-tests/testcases/security/',$spec,'/',testscript)"/>
                    </xsl:attribute>
                    <xsl:value-of select="testscript"/>
                  </xsl:element>
                </xsl:element>
              </xsl:element>
              <!-- Test Issue -->
              <xsl:element name="tr">
                <xsl:element name="td">
                <xsl:attribute name="width">20%</xsl:attribute>
                  <xsl:element name="b">
                    <xsl:value-of select="'Test Issue'"/>
                  </xsl:element>
                </xsl:element>
                <xsl:element name="td">
                  <xsl:element name="a">
                    <xsl:attribute name="href">
                      <xsl:value-of select="concat('https://opends.dev.java.net/issues/show_bug.cgi?id=',testissue)"/>
                    </xsl:attribute>
                    <xsl:value-of select="testissue"/>
                  </xsl:element>
                </xsl:element>
              </xsl:element>
              <!-- Test Preamble -->
              <xsl:element name="tr">
                <xsl:element name="td">
                  <xsl:attribute name="width">20%</xsl:attribute>
                  <xsl:element name="b">
                    <xsl:value-of select="'Preamble'"/>
                  </xsl:element>
                </xsl:element>
                <xsl:element name="td">
                  <xsl:value-of select="preamble"/>
                </xsl:element>
              </xsl:element>
              <!-- Test Steps -->
              <xsl:element name="tr">
                <xsl:element name="td">
                  <xsl:attribute name="width">20%</xsl:attribute>
                  <xsl:element name="b">
                    <xsl:value-of select="'Test Steps'"/>
                  </xsl:element>
                </xsl:element>
                <xsl:element name="td">
                  <xsl:for-each select="steps/step">
                    <xsl:value-of select="."/>
                    <xsl:element name="br"/>
                  </xsl:for-each>
                </xsl:element>
              </xsl:element>
              <!-- Test Postamble -->
              <xsl:element name="tr">
                <xsl:element name="td">
                  <xsl:attribute name="width">20%</xsl:attribute>
                  <xsl:element name="b">
                    <xsl:value-of select="'Postamble'"/>
                  </xsl:element>
                </xsl:element>
                <xsl:element name="td">
                  <xsl:value-of select="postamble"/>
                </xsl:element>
              </xsl:element>
              <!-- Test Result -->
              <xsl:element name="tr">
                <xsl:element name="td">
                  <xsl:attribute name="width">20%</xsl:attribute>
                  <xsl:element name="b">
                    <xsl:value-of select="'Test Result'"/>
                  </xsl:element>
                </xsl:element>
                <xsl:element name="td">
                  <xsl:value-of select="result"/>
                </xsl:element>
              </xsl:element>
            </xsl:element>
            <xsl:element name="br"/>
          </xsl:for-each>
        </xsl:for-each>
    </xsl:for-each>
    </xsl:element>
  </xsl:element>
</xsl:template>
</xsl:stylesheet>