cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peterjo...@apache.org
Subject svn commit: r797192 - in /cxf/trunk/systests/src/test/java/org/apache/cxf/systest: jaxrs/JAXRSClientServerSpringBookTest.java jaxrs/resources/expected_add_book_aegis.txt type_test/AbstractTypeTestClient.java
Date Thu, 23 Jul 2009 19:11:47 GMT
Author: peterjones
Date: Thu Jul 23 19:11:47 2009
New Revision: 797192

URL: http://svn.apache.org/viewvc?rev=797192&view=rev
Log:
[CXF-2353] Updated test to check Book fields rather than do a string comparison.
Resolves test failure with ibm jdk.

Removed:
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/resources/expected_add_book_aegis.txt
Modified:
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/type_test/AbstractTypeTestClient.java

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java?rev=797192&r1=797191&r2=797192&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
(original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
Thu Jul 23 19:11:47 2009
@@ -26,6 +26,7 @@
 import java.net.Socket;
 import java.net.URL;
 import java.net.URLConnection;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -41,6 +42,7 @@
 import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
 import org.apache.cxf.jaxrs.client.WebClient;
 import org.apache.cxf.jaxrs.ext.xml.XMLSource;
+import org.apache.cxf.jaxrs.provider.AegisElementProvider;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
 
 import org.junit.BeforeClass;
@@ -158,6 +160,22 @@
         assertEquals(getStringFromInputStream(expected), getStringFromInputStream(in));
     }
     
+    private void getBookAegis(String endpointAddress, String type) throws Exception {
+        getBookAegis(endpointAddress, type, null);
+    }
+    
+    private void getBookAegis(String endpointAddress, String type, String mHeader) throws
Exception {
+        WebClient client = WebClient.create(endpointAddress,
+            Collections.singletonList(new AegisElementProvider()));
+        if (mHeader != null) {
+            client = client.header("X-HTTP-Method-Override", mHeader);
+        }
+        Book book = client.accept(type).get(Book.class);
+
+        assertEquals(124L, book.getId());
+        assertEquals("CXF in Action - 2", book.getName());
+    }
+    
     @Test
     public void testAddInvalidXmlBook() throws Exception {
         
@@ -208,13 +226,13 @@
                "resources/expected_get_book123.txt");
                 
     }
-    
+
     @Test
     public void testGetBookAegis() throws Exception {
         
         String endpointAddress =
             "http://localhost:9080/the/thebooks4/bookstore/books/aegis"; 
-        getBook(endpointAddress, "resources/expected_add_book_aegis.txt", "application/xml");

+        getBookAegis(endpointAddress, "application/xml"); 
     }
     
     @Test
@@ -222,7 +240,7 @@
         
         String endpointAddress =
             "http://localhost:9080/the/thebooks4/bookstore/books/aegis/retrieve?_method=RETRIEVE";

-        getBook(endpointAddress, "resources/expected_add_book_aegis.txt", "application/xml");

+        getBookAegis(endpointAddress, "application/xml"); 
     }
     
     @Test
@@ -230,7 +248,7 @@
         
         String endpointAddress =
             "http://localhost:9080/the/thebooks4/bookstore/books/aegis/retrieve"; 
-        getBook(endpointAddress, "resources/expected_add_book_aegis.txt", "application/xml",
"RETRIEVE"); 
+        getBookAegis(endpointAddress, "application/xml", "RETRIEVE"); 
     }
     
     @Test
@@ -253,9 +271,7 @@
         String aegisData = sb.toString();
         s.getInputStream().close();
         s.close();
-        String expected = getStringFromInputStream(
-                              getClass().getResourceAsStream("resources/expected_add_book_aegis.txt"));
-        assertTrue(aegisData.contains(expected));
+        assertTrue(aegisData.contains("CXF in Action - 2"));
         
     }
     

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/type_test/AbstractTypeTestClient.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/type_test/AbstractTypeTestClient.java?rev=797192&r1=797191&r2=797192&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/type_test/AbstractTypeTestClient.java
(original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/type_test/AbstractTypeTestClient.java
Thu Jul 23 19:11:47 2009
@@ -743,10 +743,7 @@
         yOrig.setHour(22);
         yOrig.setMinute(4);
         yOrig.setSecond(15);
-        // XXX - Setting the millisecond part here seems to cause
-        // a xerces validation error with the ibm jdk. That should
-        // be valid.
-        // yOrig.setMillisecond(250);
+        yOrig.setMillisecond(250);
 
         Holder<XMLGregorianCalendar> y = new Holder<XMLGregorianCalendar>(yOrig);
         Holder<XMLGregorianCalendar> z = new Holder<XMLGregorianCalendar>();
@@ -820,7 +817,7 @@
 
     @Test
     public void testGMonth() throws Exception {
-        if (!shouldRunTest("GMonth")) {
+        if (!shouldRunTest("GMonth")) { 
             return;
         }
         javax.xml.datatype.DatatypeFactory datatypeFactory = javax.xml.datatype.DatatypeFactory.newInstance();



Mime
View raw message