/* * 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 * * * Copyright 2008 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("\n"); fwOutput.write("\n"); fwOutput.write("\n\n"); fwOutput.write(" \n"); fwOutput.write(" \n\n"); fwOutput.write(" \n"); fwOutput.write(" \n"); fwOutput.write(" \n"); fwOutput.write(" " + group + "\n"); fwOutput.write(" \n"); fwOutput.write(" \n"); fwOutput.write(" http://samsonite.central.sun.com/" + group + "\n\n"); fwOutput.write(" \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(" \n"); fwOutput.write(" " + arrayData.getTestSuitePurpose(i) + "\n"); fwOutput.write(" " + arrayData.getTestSuiteID(i) + "\n"); fwOutput.write(" " + arrayData.getTestSuiteGroup(i) + "\n\n"); fwOutput.write(" \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(" \n"); fwOutput.write(" " + arrayData.getTestID(j) + "\n"); //fwOutput.write(" " + arrayData.getTestIssue(j) + "\n"); fwOutput.write(" " + currTestGroup + "\n"); fwOutput.write(" " + currTestSuite.toString() + "\n"); fwOutput.write(" " + arrayData.getTestPurpose(j) + "\n"); fwOutput.write(" \n"); fwOutput.write(" " + currTestScript + "\n"); fwOutput.write(" \n"); fwOutput.write(" \n"); fwOutput.write(" \n"); fwOutput.write(" " + arrayData.getTestSteps(j) + "\n"); fwOutput.write(" \n"); fwOutput.write(" \n"); String tmpString = new String(arrayData.getTestPreamble(j)); if(tmpString.length() == 0) { fwOutput.write(" None\n"); } else { fwOutput.write(" " + tmpString + "\n"); } tmpString = new String(arrayData.getTestPostamble(j)); if(tmpString.length() == 0) { fwOutput.write(" None\n"); } else { fwOutput.write(" " + tmpString + "\n"); } fwOutput.write(" " + arrayData.getTestPostamble(j) + "\n"); fwOutput.write(" \n"); fwOutput.write(" " + arrayData.getTestResult(j) + "\n"); fwOutput.write(" \n"); fwOutput.write(" \n\n"); } } fwOutput.write(" \n\n"); } fwOutput.write(" \n"); fwOutput.write(" \n"); fwOutput.write("\n"); fwOutput.close(); } }