Examples of PrintStream


Examples of java.io.PrintStream

    }

    public void test() throws Exception {
        Shell shell = new Shell();
        ByteArrayOutputStream buff = new ByteArrayOutputStream();
        shell.setOut(new PrintStream(buff));
        shell.runTool("-url", "jdbc:h2:mem:", "-driver", "org.h2.Driver",
                "-user", "sa", "-password", "sa", "-properties", "null", "-sql", "select 'Hello ' || 'World' as hi");
        String s = new String(buff.toByteArray());
        assertContains(s, "HI");
        assertContains(s, "Hello World");
        assertContains(s, "(1 row, ");

        shell = new Shell();
        buff = new ByteArrayOutputStream();
        shell.setOut(new PrintStream(buff));
        shell.runTool("-help");
        s = new String(buff.toByteArray());
        assertContains(s, "Interactive command line tool to access a database using JDBC.");

        test(true);
View Full Code Here

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

Examples of java.io.PrintStream

    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

Examples of java.io.PrintStream

        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

Examples of java.io.PrintStream

        }
    }

    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

Examples of java.io.PrintStream

        }
    }

    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

Examples of java.io.PrintStream

        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

Examples of java.io.PrintStream

    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

Examples of java.io.PrintStream

      throw ioe;
  }

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

Examples of java.io.PrintStream

  } 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
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.