Changeset 1567 for trunk/autoquest-httpmonitor-test/src/test/java/de/ugoe/cs/autoquest/httpmonitor/AbstractTC.java
- Timestamp:
- 06/13/14 16:57:43 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-httpmonitor-test/src/test/java/de/ugoe/cs/autoquest/httpmonitor/AbstractTC.java
r1561 r1567 83 83 /** */ 84 84 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 } 85 111 86 112 /** … … 182 208 try { 183 209 HttpResponse response = httpclient.execute(httpRequest); 210 211 assertEquals(message, dummyServlet.getRequest()); 184 212 System.err.println(response.getStatusLine()); 185 213 String responseStr = readStreamContentToString(response.getEntity().getContent()); … … 190 218 httpRequest.releaseConnection(); 191 219 } 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();218 220 } 219 221
Note: See TracChangeset
for help on using the changeset viewer.