cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1212154 - in /cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs: BookStore.java JAXRSClientServerBookTest.java
Date Thu, 08 Dec 2011 21:59:49 GMT
Author: dkulp
Date: Thu Dec  8 21:59:48 2011
New Revision: 1212154

URL: http://svn.apache.org/viewvc?rev=1212154&view=rev
Log:
On java7, the test methods are executed in a different order and state
in the singleton bookestore leaks across tests and causes failures.
Add a reset that is called after each test to reset the singleton back
to its empty state.

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

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java?rev=1212154&r1=1212153&r2=1212154&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java (original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java Thu
Dec  8 21:59:48 2011
@@ -976,7 +976,14 @@ public class BookStore {
         return new BookSubresourceImpl();
     }
     
-    final void init() {
+    @GET
+    @Path("/reset")
+    public final String init() {
+        books.clear();
+        cds.clear();
+        bookId = 123;
+        cdId = 123;        
+        
         Book book = new Book();
         book.setId(bookId);
         book.setName("CXF in Action");
@@ -990,6 +997,7 @@ public class BookStore {
         cd1.setId(++cdId);
         cd1.setName("BICYCLE RACE");
         cds.put(cd1.getId(), cd1);
+        return "OK";
     }
     
     @XmlJavaTypeAdapter(BookInfoAdapter2.class)

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java?rev=1212154&r1=1212153&r2=1212154&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
(original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
Thu Dec  8 21:59:48 2011
@@ -60,6 +60,7 @@ 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;
@@ -73,6 +74,10 @@ 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 testMalformedAcceptType() {



Mime
View raw message