Return-Path: Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: (qmail 22591 invoked from network); 23 Jul 2009 19:15:20 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 23 Jul 2009 19:15:20 -0000 Received: (qmail 89676 invoked by uid 500); 23 Jul 2009 19:13:51 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 88082 invoked by uid 500); 23 Jul 2009 19:13:46 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 87874 invoked by uid 99); 23 Jul 2009 19:12:12 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Jul 2009 19:12:12 +0000 X-ASF-Spam-Status: No, hits=-1998.5 required=10.0 tests=ALL_TRUSTED,WEIRD_PORT X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Jul 2009 19:12:09 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id BA1BC23888DC; Thu, 23 Jul 2009 19:11:47 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@cxf.apache.org From: peterjones@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090723191147.BA1BC23888DC@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 y = new Holder(yOrig); Holder z = new Holder(); @@ -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();