Examples of PrintStream


Examples of java.io.PrintStream

    PROP_SUMMARY_PRT_DIR);
  // if (summarydir != null) {
  // outputDir = summarydir;
  // }

  PrintStream outputStream = null;
  Writer overallsummary = null;
  Writer overallsummaryerrors = null;
  try {
      outputStream = getSummaryStream(summarydir,
        "Summary_" + querysetname + "_" + scenario_name, true); //$NON-NLS-1$
     
      overallsummary = getOverallSummaryStream(summarydir);
      overallsummaryerrors = getOverallSummaryErrorsStream(summarydir);
  } catch (IOException e) {
      e.printStackTrace();
      //              logError("Unable to get output stream for file: " + outputFileName); //$NON-NLS-1$
      throw e;
  }

  outputStream
    .println("Scenario " + scenario_name + " Summary [" + this.resultMode + "]"); //$NON-NLS-1$
  outputStream.println("Query Set Name " + querysetname); //$NON-NLS-1$
  outputStream.println("=================="); //$NON-NLS-1$

  outputStream.println("Number of Test Query Sets: " + total_querysets); //$NON-NLS-1$ //$NON-NLS-2$

  outputStream.println("=================="); //$NON-NLS-1$
  outputStream.println("Test Query Set"); //$NON-NLS-1$
  outputStream
    .println("\t" + "Name" + "\t\t\t\t" + "Pass" + "\t" + "Fail" + "\t" + "Total" + "\t" + "Time(sec)"); //$NON-NLS-1$

  if (!this.query_sets.isEmpty()) {
      // sort so that like failed queries are show together
      Collections.sort(this.query_sets);
     
      for (Iterator<String> it = this.query_sets.iterator(); it.hasNext();) {
    outputStream.println(it.next()); //$NON-NLS-1$ //$NON-NLS-2$
      }

  }
  outputStream.println("=================="); //$NON-NLS-1$

  outputStream.println("\t" + "Totals" + "\t\t\t\t" + total_pass + "\t"
    + total_fail + "\t" + total_queries + "\t" + total_seconds
    / 1000);
 
 
  try {
      overallsummary.write( pad(scenario_name, 30, ' ') + " \t" + total_pass + "\t" + total_fail + "\t" + total_queries + "\n");
      overallsummary.flush();

  } catch (IOException ioe) {
      ioe.printStackTrace();
  } finally {                       // always close the file
      try {
    overallsummary.close();
      } catch (IOException ioe2) {
      // just ignore it
      }
  } //

  // outputStream
  //      .println("Number of Queries: " + total_queries); //$NON-NLS-1$ //$NON-NLS-2$
  // outputStream
  //      .println("Number Passed    : " + total_pass); //$NON-NLS-1$ //$NON-NLS-2$
  // outputStream
  //      .println("Number Failed    : " + total_fail); //$NON-NLS-1$ //$NON-NLS-2$

  if (!this.failed_queries.isEmpty()) {
      // sort so that like failed queries are show together
      Collections.sort(this.failed_queries);

      outputStream.println("\n\n=================="); //$NON-NLS-1$
      outputStream.println("Failed Queries"); //$NON-NLS-1$ 
     
      overallsummaryerrors.write("\n" + scenario_name + "\n");


      for (Iterator<String> it = this.failed_queries.iterator(); it
        .hasNext();) {
    String error = it.next();
    outputStream.println("\t - " + error); //$NON-NLS-1$ //$NON-NLS-2$
    // write all errors to the summary file
    overallsummaryerrors.write("\t\t" + error + "\n");


      }
     
    try {
        overallsummaryerrors.flush();

    } catch (IOException ioe) {
        ioe.printStackTrace();
    } finally {                       // always close the file
        try {
      overallsummaryerrors.close();
        } catch (IOException ioe2) {
        // just ignore it
        }
    } //

      outputStream.println("=================="); //$NON-NLS-1$

  }

  outputStream.close();

    }
View Full Code Here

Examples of java.io.PrintStream

  public static void compareResultSet(String testName, ResultSet... rs)
      throws FileNotFoundException, SQLException, IOException {
    FileOutputStream actualOut = null;
        BufferedReader expectedIn = null;
        PrintStream stream = null;
        try {
          if (REPLACE_EXPECTED) {
              File actual = new File(UnitTestUtil.getTestDataPath() + "/" +testName+".expected"); //$NON-NLS-1$ //$NON-NLS-2$
              actualOut = new FileOutputStream(actual);
          } else {
              if (WRITE_ACTUAL_RESULTS_TO_FILE) {
                  File actual = new File(UnitTestUtil.getTestDataPath() + "/" +testName+".actual"); //$NON-NLS-1$ //$NON-NLS-2$
                  actualOut = new FileOutputStream(actual);
              }
              File expected = new File(UnitTestUtil.getTestDataPath() + "/"+testName+".expected"); //$NON-NLS-1$ //$NON-NLS-2$
              expectedIn = new BufferedReader(new FileReader(expected));
          }
          PrintStream defaultStream = null;
          if (PRINT_RESULTSETS_TO_CONSOLE) {
              defaultStream = new PrintStream(System.out) {
                  // SYS.out should be protected from being closed.
                  public void close() {}
              };
          }
          stream = ResultSetUtil.getPrintStream(actualOut, expectedIn, defaultStream);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.