Author: chatellier Date: 2009-02-27 17:58:49 +0000 (Fri, 27 Feb 2009) New Revision: 285 Modified: jrst/trunk/src/test/java/org/codelutin/jrst/Compare.java jrst/trunk/src/test/java/org/codelutin/jrst/JRSTGeneratorTest.java jrst/trunk/src/test/java/org/codelutin/jrst/ThreadRedirection.java Log: Update test, use StringBuffer to read docutils process output. Modified: jrst/trunk/src/test/java/org/codelutin/jrst/Compare.java =================================================================== --- jrst/trunk/src/test/java/org/codelutin/jrst/Compare.java 2009-02-27 17:57:27 UTC (rev 284) +++ jrst/trunk/src/test/java/org/codelutin/jrst/Compare.java 2009-02-27 17:58:49 UTC (rev 285) @@ -74,11 +74,10 @@ ThreadRedirection t = new ThreadRedirection(p); t.start(); p.waitFor(); // On attend que le processus ce termine - //String strPython = t.getSortit().replaceAll("null", ""); t.stop(); p.destroy(); SAXReader sr = new SAXReader(); - Document docPython = sr.read(new StringReader(t.getSortit())); + Document docPython = sr.read(new StringReader(t.getOutput())); String diff = test(docRst, docPython); String sDocRst = indent(docRst); // On indente String sDocPython = indent(docPython); Modified: jrst/trunk/src/test/java/org/codelutin/jrst/JRSTGeneratorTest.java =================================================================== --- jrst/trunk/src/test/java/org/codelutin/jrst/JRSTGeneratorTest.java 2009-02-27 17:57:27 UTC (rev 284) +++ jrst/trunk/src/test/java/org/codelutin/jrst/JRSTGeneratorTest.java 2009-02-27 17:58:49 UTC (rev 285) @@ -147,7 +147,7 @@ test1.delete(); } - @Ignore + @Test public void testRstToPDF() throws Exception { if (log.isInfoEnabled()) { Modified: jrst/trunk/src/test/java/org/codelutin/jrst/ThreadRedirection.java =================================================================== --- jrst/trunk/src/test/java/org/codelutin/jrst/ThreadRedirection.java 2009-02-27 17:57:27 UTC (rev 284) +++ jrst/trunk/src/test/java/org/codelutin/jrst/ThreadRedirection.java 2009-02-27 17:58:49 UTC (rev 285) @@ -26,60 +26,33 @@ * Class qui redirige la sortie standard pour la laisser en interne */ public class ThreadRedirection extends Thread { - String str; - String errors; - Process process; + protected StringBuffer str; + protected Process process; public ThreadRedirection(Process p) { process = p; + str = new StringBuffer(); } public void run() { try { BufferedReader reader = new BufferedReader(new InputStreamReader( process.getInputStream())); - BufferedReader readerErrors = new BufferedReader( - new InputStreamReader(process.getErrorStream())); try { String line; while ((line = reader.readLine()) != null) { - if (!line.equals("null")) { - str += "\n" + line; - } + str.append(line + "\n"); } } finally { reader.close(); } - try { - String line; - while ((line = readerErrors.readLine()) != null) { - if (!line.equals(null)) { - errors += "\n" + line; - } - } - - } finally { - reader.close(); - } } catch (IOException ioe) { ioe.printStackTrace(); } } - public String getSortit() { - - String result = ""; - for (String l : str.split("\n")) - if (!l.equals("null")) { - result += l + "\n"; - } - - return result; + public String getOutput() { + return str.toString(); } - - public String getErrors() { - return errors; - } - }