Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BDDFBC1DE for ; Fri, 4 May 2012 09:55:53 +0000 (UTC) Received: (qmail 97087 invoked by uid 500); 4 May 2012 09:55:53 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 96977 invoked by uid 500); 4 May 2012 09:55:53 -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 96963 invoked by uid 99); 4 May 2012 09:55:52 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 May 2012 09:55:52 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED 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; Fri, 04 May 2012 09:55:49 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 27BE9238896F; Fri, 4 May 2012 09:55:28 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1333834 - in /cxf/branches/2.5.x-fixes: ./ systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java Date: Fri, 04 May 2012 09:55:28 -0000 To: commits@cxf.apache.org From: sergeyb@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120504095528.27BE9238896F@eris.apache.org> Author: sergeyb Date: Fri May 4 09:55:27 2012 New Revision: 1333834 URL: http://svn.apache.org/viewvc?rev=1333834&view=rev Log: Merged revisions 1333832 via svnmerge from https://svn.apache.org/repos/asf/cxf/trunk ........ r1333832 | sergeyb | 2012-05-04 10:49:58 +0100 (Fri, 04 May 2012) | 1 line Updating some of JAXRSClientServerBookTest tests not to depend on the state updates ........ Modified: cxf/branches/2.5.x-fixes/ (props changed) cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java Propchange: cxf/branches/2.5.x-fixes/ ------------------------------------------------------------------------------ Merged /cxf/trunk:r1333832 Propchange: cxf/branches/2.5.x-fixes/ ------------------------------------------------------------------------------ Binary property 'svnmerge-integrated' - no diff available. Modified: cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java?rev=1333834&r1=1333833&r2=1333834&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java (original) +++ cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java Fri May 4 09:55:27 2012 @@ -777,8 +777,6 @@ public class BookStore { } book.setId(bookId + 1); - books.put(book.getId(), book); - return Response.ok(book).build(); } @@ -826,8 +824,7 @@ public class BookStore { Response r; if (b != null) { - books.put(book.getId(), book); - r = Response.ok().build(); + r = Response.ok(book).build(); } else { r = Response.notModified().build(); } @@ -844,8 +841,7 @@ public class BookStore { if (b == null) { Book newBook = new Book(); newBook.setId(id); - books.put(newBook.getId(), newBook); - r = Response.ok().build(); + r = Response.ok(newBook).build(); } else { r = Response.notModified().build(); } @@ -868,8 +864,7 @@ public class BookStore { Response r; if (b != null) { - books.put(book.getId(), book); - r = Response.ok().build(); + r = Response.ok(book).build(); } else { r = Response.notModified().build(); } @@ -1012,8 +1007,6 @@ public class BookStore { return new BookSubresourceImpl(); } - @GET - @Path("/reset") public final String init() { books.clear(); cds.clear(); Modified: cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java?rev=1333834&r1=1333833&r2=1333834&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java (original) +++ cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java Fri May 4 09:55:27 2012 @@ -23,7 +23,6 @@ import java.io.File; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.URL; -import java.net.URLConnection; import java.net.URLEncoder; import java.util.ArrayList; import java.util.Collection; @@ -60,7 +59,6 @@ import org.apache.cxf.systest.jaxrs.Book import org.apache.cxf.systest.jaxrs.BookStore.BookInfoInterface; import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase; -import org.junit.After; import org.junit.BeforeClass; import org.junit.Ignore; import org.junit.Test; @@ -74,10 +72,6 @@ public class JAXRSClientServerBookTest e assertTrue("server did not launch correctly", launchServer(BookServer.class, true)); } - @After - public void resetBookServer() throws Exception { - new URL("http://localhost:" + PORT + "/bookstore/reset").openStream().close(); - } @Test public void testWithComplexPath() { @@ -1406,39 +1400,14 @@ public class JAXRSClientServerBookTest e try { int result = httpclient.executeMethod(put); assertEquals(200, result); + InputStream expected = getClass().getResourceAsStream("resources/expected_update_book.txt"); + assertEquals(getStringFromInputStream(expected), + getStringFromInputStream(put.getResponseBodyAsStream())); } finally { // Release current connection to the connection pool once you are // done put.releaseConnection(); } - - // Verify result - endpointAddress = "http://localhost:" + PORT + "/bookstore/books/123"; - URL url = new URL(endpointAddress); - URLConnection connect = url.openConnection(); - connect.addRequestProperty("Accept", "application/xml"); - InputStream in = connect.getInputStream(); - assertNotNull(in); - - InputStream expected = getClass().getResourceAsStream("resources/expected_update_book.txt"); - - assertEquals(getStringFromInputStream(expected), getStringFromInputStream(in)); - - // Roll back changes: - File input1 = new File(getClass().getResource("resources/expected_get_book123.txt").toURI()); - PutMethod put1 = new PutMethod(endpointAddress); - RequestEntity entity1 = new FileRequestEntity(input1, "text/xml; charset=ISO-8859-1"); - put1.setRequestEntity(entity1); - HttpClient httpclient1 = new HttpClient(); - - try { - int result = httpclient1.executeMethod(put); - assertEquals(200, result); - } finally { - // Release current connection to the connection pool once you are - // done - put1.releaseConnection(); - } } @Test @@ -1479,39 +1448,14 @@ public class JAXRSClientServerBookTest e try { int result = httpclient.executeMethod(put); assertEquals(200, result); + InputStream expected = getClass().getResourceAsStream("resources/expected_update_book.txt"); + assertEquals(getStringFromInputStream(expected), + getStringFromInputStream(put.getResponseBodyAsStream())); } finally { // Release current connection to the connection pool once you are // done put.releaseConnection(); } - - // Verify result - endpointAddress = "http://localhost:" + PORT + "/bookstore/books/123"; - URL url = new URL(endpointAddress); - URLConnection connection = url.openConnection(); - connection.addRequestProperty("Accept", "application/xml"); - InputStream in = connection.getInputStream(); - assertNotNull(in); - - InputStream expected = getClass().getResourceAsStream("resources/expected_update_book.txt"); - - assertEquals(getStringFromInputStream(expected), getStringFromInputStream(in)); - - // Roll back changes: - File input1 = new File(getClass().getResource("resources/expected_get_book123.txt").toURI()); - PutMethod put1 = new PutMethod(endpointAddress); - RequestEntity entity1 = new FileRequestEntity(input1, "text/xml; charset=ISO-8859-1"); - put1.setRequestEntity(entity1); - HttpClient httpclient1 = new HttpClient(); - - try { - int result = httpclient1.executeMethod(put); - assertEquals(200, result); - } finally { - // Release current connection to the connection pool once you are - // done - put1.releaseConnection(); - } } @Test