Ignore:
Timestamp:
06/13/14 16:57:43 (10 years ago)
Author:
pharms
Message:
  • next solved issue with reused buffers
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/autoquest-httpmonitor-test/src/test/java/de/ugoe/cs/autoquest/httpmonitor/AbstractTC.java

    r1561 r1567  
    8383    /** */ 
    8484    private static Tomcat tomcat = new Tomcat(); 
     85     
     86    /** 
     87     *  
     88     */ 
     89    static String readStreamContentToString(InputStream stream) throws IOException { 
     90        return readToString(new BufferedReader(new InputStreamReader(stream))); 
     91    } 
     92     
     93    /** 
     94     *  
     95     */ 
     96    static String readToString(BufferedReader reader) throws IOException { 
     97        StringBuffer message = new StringBuffer(); 
     98         
     99        String line = reader.readLine(); 
     100        while (line != null) { 
     101            System.err.println(line); 
     102            if (message.length() > 0) { 
     103                message.append('\n'); 
     104            } 
     105            message.append(line); 
     106            line = reader.readLine(); 
     107        } 
     108         
     109        return message.toString(); 
     110    } 
    85111 
    86112    /** 
     
    182208        try { 
    183209            HttpResponse response = httpclient.execute(httpRequest); 
     210             
     211            assertEquals(message, dummyServlet.getRequest()); 
    184212            System.err.println(response.getStatusLine()); 
    185213            String responseStr = readStreamContentToString(response.getEntity().getContent()); 
     
    190218            httpRequest.releaseConnection(); 
    191219        } 
    192     } 
    193      
    194     /** 
    195      *  
    196      */ 
    197     protected String readStreamContentToString(InputStream stream) throws IOException { 
    198         return readToString(new BufferedReader(new InputStreamReader(stream))); 
    199     } 
    200      
    201     /** 
    202      *  
    203      */ 
    204     protected String readToString(BufferedReader reader) throws IOException { 
    205         StringBuffer message = new StringBuffer(); 
    206          
    207         String line = reader.readLine(); 
    208         while (line != null) { 
    209             System.err.println(line); 
    210             if (message.length() > 0) { 
    211                 message.append('\n'); 
    212             } 
    213             message.append(line); 
    214             line = reader.readLine(); 
    215         } 
    216          
    217         return message.toString(); 
    218220    } 
    219221     
Note: See TracChangeset for help on using the changeset viewer.