cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r556568 - in /incubator/cxf/trunk: systests/src/test/java/org/apache/cxf/systest/rest/ systests/src/test/java/org/apache/cxf/systest/rest/resources/ testutils/src/main/java/org/apache/cxf/customer/book/
Date Mon, 16 Jul 2007 09:15:42 GMT
Author: jliu
Date: Mon Jul 16 02:15:41 2007
New Revision: 556568

URL: http://svn.apache.org/viewvc?view=rev&rev=556568
Log:
Have to add @WebService(targetNamespace = "http://book.acme.com") in order to get Rest server
working (was mentioned in the mailing list). However, the result returned by addBook() does
not seem correct to me. 

Added:
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/resources/expected_add_book_json.txt
  (with props)
Modified:
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/RestClientServerBookTest.java
    incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/book/BookService.java

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/RestClientServerBookTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/RestClientServerBookTest.java?view=diff&rev=556568&r1=556567&r2=556568
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/RestClientServerBookTest.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/RestClientServerBookTest.java
Mon Jul 16 02:15:41 2007
@@ -38,7 +38,6 @@
 import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
 import org.junit.BeforeClass;
-import org.junit.Ignore;
 import org.junit.Test;
 
 
@@ -116,29 +115,27 @@
     }  
     
     @Test
-    @Ignore("Have not figured out yet why this does not work")
     public void testAddBookJSON() throws Exception {
         String endpointAddress =
             "http://localhost:9080/json/books"; 
 
         String inputFile = getClass().getResource("resources/add_book_json.txt").getFile();
        
         File input =  new File(inputFile);
-        // Prepare HTTP post
         PostMethod post = new PostMethod(endpointAddress);
-        // Request content will be retrieved directly
-        // from the input stream
         RequestEntity entity = new FileRequestEntity(input, "text/plain; charset=ISO-8859-1");
         post.setRequestEntity(entity);
-        // Get HTTP client
         HttpClient httpclient = new HttpClient();
-        // Execute request
+        
         try {
             int result = httpclient.executeMethod(post);
-            // Display status code
             System.out.println("Response status code: " + result);
-            // Display response
             System.out.println("Response body: ");
             System.out.println(post.getResponseBodyAsString());
+            
+            //InputStream expected = getClass().getResourceAsStream("resources/expected_add_book_json.txt");
+            
+            //FIXME: result returned is not correct: {"acme.addBookResponse":"2"}
+            //assertEquals(getStringFromInputStream(expected), post.getResponseBodyAsString());
         } finally {
             // Release current connection to the connection pool once you are done
             post.releaseConnection();

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/resources/expected_add_book_json.txt
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/resources/expected_add_book_json.txt?view=auto&rev=556568
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/resources/expected_add_book_json.txt
(added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/resources/expected_add_book_json.txt
Mon Jul 16 02:15:41 2007
@@ -0,0 +1 @@
+{"acme.book":"2"}
\ No newline at end of file

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/resources/expected_add_book_json.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/resources/expected_add_book_json.txt
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/book/BookService.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/book/BookService.java?view=diff&rev=556568&r1=556567&r2=556568
==============================================================================
--- incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/book/BookService.java
(original)
+++ incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/book/BookService.java
Mon Jul 16 02:15:41 2007
@@ -29,7 +29,7 @@
 import org.codehaus.jra.Post;
 import org.codehaus.jra.Put;
 
-@WebService
+@WebService(targetNamespace = "http://book.acme.com")
 public interface BookService {
 
     @Get



Mime
View raw message