cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r750302 - /cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSAtomBookTest.java
Date Thu, 05 Mar 2009 02:57:39 GMT
Author: dkulp
Date: Thu Mar  5 02:57:38 2009
New Revision: 750302

URL: http://svn.apache.org/viewvc?rev=750302&view=rev
Log:
Fix another test with sjsxp

Modified:
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSAtomBookTest.java

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSAtomBookTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSAtomBookTest.java?rev=750302&r1=750301&r2=750302&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSAtomBookTest.java (original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSAtomBookTest.java Thu
Mar  5 02:57:38 2009
@@ -85,7 +85,8 @@
             int result = httpclient.executeMethod(post);
             assertEquals(201, result);
             location = post.getResponseHeader("Location").getValue();
-            Document<Entry> entryDoc = abdera.getParser().parse(post.getResponseBodyAsStream());
+            InputStream ins = post.getResponseBodyAsStream();
+            Document<Entry> entryDoc = abdera.getParser().parse(copyIn(ins));
             assertEquals(entryDoc.getRoot().toString(), e.toString());
         } finally {
             post.releaseConnection();
@@ -201,7 +202,7 @@
         HttpClient httpClient = new HttpClient();
         try {
             httpClient.executeMethod(get);           
-            Document<Feed> doc = abdera.getParser().parse(get.getResponseBodyAsStream());
+            Document<Feed> doc = abdera.getParser().parse(copyIn(get.getResponseBodyAsStream()));
             return doc.getRoot();
         } finally {
             get.releaseConnection();
@@ -217,18 +218,22 @@
         HttpClient httpClient = new HttpClient();
         try {
             httpClient.executeMethod(get);           
-            Document<Entry> doc = abdera.getParser().parse(get.getResponseBodyAsStream());
+            Document<Entry> doc = abdera.getParser().parse(copyIn(get.getResponseBodyAsStream()));
             return doc.getRoot();
         } finally {
             get.releaseConnection();
         }
     }
     
-    private String getStringFromInputStream(InputStream in) throws Exception {        
+    private InputStream copyIn(InputStream in) throws Exception {
         CachedOutputStream bos = new CachedOutputStream();
         IOUtils.copy(in, bos);
         in.close();
+        in = bos.getInputStream();
         bos.close();
-        return bos.getOut().toString();        
+        return in;
+    }
+    private String getStringFromInputStream(InputStream in) throws Exception {
+        return IOUtils.toString(in);
     }
 }



Mime
View raw message