Package java.io

Examples of java.io.PrintStream


    }

    private void test(final boolean commandLineArgs) throws IOException {
        testIn = new PipedInputStream();
        PipedOutputStream out = new PipedOutputStream(testIn);
        toolOut = new PrintStream(out, true);
        out = new PipedOutputStream();
        testOut = new PrintStream(out, true);
        toolIn = new PipedInputStream(out);
        Task task = new Task() {
            public void call() throws Exception {
                try {
                    Shell shell = new Shell();
View Full Code Here


    private OutputCatcher() {
        html = new HtmlOutputStream(buff);
        out = new DualOutputStream(html, System.out, false);
        err = new DualOutputStream(html, System.err, true);
        System.setOut(new PrintStream(out, true));
        System.setErr(new PrintStream(err, true));
    }
View Full Code Here

        deleteDb("web");
        Connection conn = getConnection("web");
        conn.createStatement().execute("create table test(id int) as select 1");
        conn.close();
        Server server = new Server();
        server.setOut(new PrintStream(new ByteArrayOutputStream()));
        server.runTool("-web", "-webPort", "8182", "-properties", "null", "-tcp", "-tcpPort", "9101");
        try {
            String url = "http://localhost:8182";
            WebClient client;
            String result;
View Full Code Here

        }
    }

    private void testTransfer() throws Exception {
        Server server = new Server();
        server.setOut(new PrintStream(new ByteArrayOutputStream()));
        server.runTool("-web", "-webPort", "8182", "-properties", "null");
        File transfer = new File("transfer");
        transfer.mkdirs();
        try {
            FileOutputStream f = new FileOutputStream("transfer/test.txt");
View Full Code Here

        }
    }

    private void testServer() throws Exception {
        Server server = new Server();
        server.setOut(new PrintStream(new ByteArrayOutputStream()));
        server.runTool("-web", "-webPort", "8182", "-properties", "null", "-tcp", "-tcpPort", "9101");
        try {
            String url = "http://localhost:8182";
            WebClient client;
            String result;
View Full Code Here

        server.stop();
    }

    private void testWebApp() throws Exception {
        Server server = new Server();
        server.setOut(new PrintStream(new ByteArrayOutputStream()));
        server.runTool("-web", "-webPort", "8182", "-properties", "null", "-tcp", "-tcpPort", "9101");
        try {
            String url = "http://localhost:8182";
            WebClient client;
            String result;
View Full Code Here

    private static PrintStream getSummaryStream(String outputDir,
      String summaryName) throws IOException {
  File summaryFile = createSummaryFile(outputDir, summaryName);
  OutputStream os = new FileOutputStream(summaryFile);
  os = new BufferedOutputStream(os);
  return new PrintStream(os);
    }
View Full Code Here

      throw ioe;
  }

  OutputStream os = new FileOutputStream(summaryFile);
  os = new BufferedOutputStream(os);
  return new PrintStream(os);
    }
View Full Code Here

  } else if (testResults.size() > 0) {
      // Create output file
      String outputFileName = generateFileName(querySetID, System
        .currentTimeMillis(), runNumber);
      //           CombinedTestClient.log("Creating output file: " + outputFileName); //$NON-NLS-1$
      PrintStream outputStream = null;
      PrintStream overwriteStream = null;
      try {
    outputStream = getSummaryStream(outputDir, outputFileName);
    overwriteStream = getSummaryStream(outputDir, querySetID, true); //$NON-NLS-1$
      } catch (IOException e) {
    //              logError("Unable to get output stream for file: " + outputFileName); //$NON-NLS-1$
    throw e;
      }

      Date starttest = new Date(testStartTS);
      Date endtest = new Date(endTS);
      long diff = endtest.getTime() - starttest.getTime();

      total_seconds = total_seconds + diff;

      Date diffdate = new Date(diff);

      // endtest - starttest;
      //     
      //    outputStream.println("Start        Time: " + new Date(testStartTS)); //$NON-NLS-1$
      //    outputStream.println("End          Time: " + new Date(endTS)); //$NON-NLS-1$
      // outputStream
      //      .println("Elapsed      Time: " + ((endTS - testStartTS) / 1000) + " seconds"); //$NON-NLS-1$ //$NON-NLS-2$

      addTotalPassFailGen(testname, testResults, starttest, endtest,
        diffdate);
      // Text File output
      printQueryTestResults(outputStream, starttest, endtest, diffdate,
        numberOfClients, TestClient.TSFORMAT, testResults);
      printQueryTestResults(overwriteStream, starttest, endtest,
        diffdate, numberOfClients, TestClient.TSFORMAT, testResults);

      // HTML Vesion of output
      PrintStream htmlStream = getSummaryStream(outputDir, querySetID
        + ".html", true); //$NON-NLS-1$
      printHtmlQueryTestResults(htmlStream, testStartTS, endTS,
        numberOfClients, TestClient.TSFORMAT, testResults);
      htmlStream.close();

      // Wiki Update
      //         CombinedTestUtil.publishResultsToWiki(props, outputDir+File.separator+querySetID+".html", testStartTS, endTS, numberOfClients, testResults); //$NON-NLS-1$ //$NON-NLS-2$

      // Print results according to test type
View Full Code Here

    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

TOP

Related Classes of java.io.PrintStream

Copyright © 2018 www.massapicom. 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.