cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1346533 - in /cxf/trunk/systests/jaxrs: ./ src/test/java/org/apache/cxf/systest/jaxrs/ src/test/java/org/apache/cxf/systest/jaxrs/resources/
Date Tue, 05 Jun 2012 18:57:41 GMT
Author: dkulp
Date: Tue Jun  5 18:57:40 2012
New Revision: 1346533

URL: http://svn.apache.org/viewvc?rev=1346533&view=rev
Log:
jaxrs to forkmode once
Major update is to AtomPush to manually configure the single logger to
leave the rest of the logging subsystem at the defaults.

Modified:
    cxf/trunk/systests/jaxrs/pom.xml
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceJacksonSpringProviderTest.java
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerStreamingTest.java
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerUserResourceTest.java
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSContinuationsTest.java
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSDataBindingTest.java
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSLoggingAtomPullSpringTest.java
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSLoggingAtomPushTest.java
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/logging_atompush.properties
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/logging_atompush_atompub.properties
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/logging_atompush_batch.properties

Modified: cxf/trunk/systests/jaxrs/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/pom.xml?rev=1346533&r1=1346532&r2=1346533&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/pom.xml (original)
+++ cxf/trunk/systests/jaxrs/pom.xml Tue Jun  5 18:57:40 2012
@@ -32,10 +32,6 @@
     <version>2.6.2-SNAPSHOT</version>
     <url>http://cxf.apache.org</url>
     
-    <properties>
-        <cxf.surefire.fork.mode>pertest</cxf.surefire.fork.mode>
-    </properties>
-    
     <dependencies>
         <dependency>
             <groupId>xalan</groupId>

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceJacksonSpringProviderTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceJacksonSpringProviderTest.java?rev=1346533&r1=1346532&r2=1346533&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceJacksonSpringProviderTest.java
(original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceJacksonSpringProviderTest.java
Tue Jun  5 18:57:40 2012
@@ -41,6 +41,7 @@ public class JAXRSClientServerResourceJa
         AbstractResourceInfo.clearAllMaps();
         assertTrue("server did not launch correctly",
                    launchServer(BookServerResourceJacksonSpringProviders.class, true));
+        createStaticBus();
     }
     
     @Test

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java?rev=1346533&r1=1346532&r2=1346533&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
(original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
Tue Jun  5 18:57:40 2012
@@ -68,6 +68,7 @@ public class JAXRSClientServerSpringBook
         AbstractResourceInfo.clearAllMaps();
         assertTrue("server did not launch correctly", 
                    launchServer(BookServerSpring.class, true));
+        createStaticBus();
     }
     
     @Test

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerStreamingTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerStreamingTest.java?rev=1346533&r1=1346532&r2=1346533&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerStreamingTest.java
(original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerStreamingTest.java
Tue Jun  5 18:57:40 2012
@@ -101,6 +101,7 @@ public class JAXRSClientServerStreamingT
         //keep out of process due to stack traces testing failures
         assertTrue("server did not launch correctly",
                    launchServer(Server.class));
+        createStaticBus();
     }
     
     @Test

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerUserResourceTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerUserResourceTest.java?rev=1346533&r1=1346532&r2=1346533&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerUserResourceTest.java
(original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerUserResourceTest.java
Tue Jun  5 18:57:40 2012
@@ -112,6 +112,7 @@ public class JAXRSClientServerUserResour
         AbstractResourceInfo.clearAllMaps();
         assertTrue("server did not launch correctly",
                    launchServer(Server.class, true));
+        createStaticBus();
     }
     
     @Test

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSContinuationsTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSContinuationsTest.java?rev=1346533&r1=1346532&r2=1346533&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSContinuationsTest.java
(original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSContinuationsTest.java
Tue Jun  5 18:57:40 2012
@@ -41,6 +41,7 @@ public class JAXRSContinuationsTest exte
     @BeforeClass
     public static void startServers() throws Exception {
         AbstractResourceInfo.clearAllMaps();
+        createStaticBus();
         assertTrue("server did not launch correctly",
                    launchServer(BookContinuationServer.class, true));
     }

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSDataBindingTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSDataBindingTest.java?rev=1346533&r1=1346532&r2=1346533&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSDataBindingTest.java
(original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSDataBindingTest.java
Tue Jun  5 18:57:40 2012
@@ -50,6 +50,7 @@ public class JAXRSDataBindingTest extend
         AbstractResourceInfo.clearAllMaps();
         assertTrue("server did not launch correctly", 
                    launchServer(BookDataBindingServer.class, true));
+        createStaticBus();
     }
     
     

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSLoggingAtomPullSpringTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSLoggingAtomPullSpringTest.java?rev=1346533&r1=1346532&r2=1346533&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSLoggingAtomPullSpringTest.java
(original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSLoggingAtomPullSpringTest.java
Tue Jun  5 18:57:40 2012
@@ -46,14 +46,14 @@ import org.apache.cxf.management.web.log
 import org.apache.cxf.management.web.logging.ReadWriteLogStorage;
 import org.apache.cxf.management.web.logging.ReadableLogStorage;
 import org.apache.cxf.management.web.logging.atom.AtomPullServer;
-import org.apache.cxf.testutil.common.AbstractClientServerTestBase;
+import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
 
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Ignore;
 import org.junit.Test;
 
-public class JAXRSLoggingAtomPullSpringTest extends AbstractClientServerTestBase {
+public class JAXRSLoggingAtomPullSpringTest extends AbstractBusClientServerTestBase {
     public static final int PORT = SpringServer.PORT;
 
     private static JAXBContext context; 
@@ -82,6 +82,7 @@ public class JAXRSLoggingAtomPullSpringT
         System.setProperty("systemtests.jaxrs.logs.folder", resourceDir);
         launchServer(SpringServer.class, true);
         context = JAXBContext.newInstance(org.apache.cxf.management.web.logging.LogRecord.class);
+        createStaticBus();
     }
 
     @Ignore

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSLoggingAtomPushTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSLoggingAtomPushTest.java?rev=1346533&r1=1346532&r2=1346533&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSLoggingAtomPushTest.java
(original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSLoggingAtomPushTest.java
Tue Jun  5 18:57:40 2012
@@ -21,6 +21,7 @@ package org.apache.cxf.systest.jaxrs;
 import java.io.ByteArrayInputStream;
 import java.io.InputStream;
 import java.util.Arrays;
+import java.util.Collection;
 import java.util.List;
 import java.util.Queue;
 import java.util.concurrent.ConcurrentLinkedQueue;
@@ -62,8 +63,8 @@ import org.junit.Test;
 
 public class JAXRSLoggingAtomPushTest extends Assert {
     public static final String PORT = TestUtil.getPortNumber(JAXRSLoggingAtomPushTest.class);
-    
-    private static final Logger LOG = LogUtils.getL7dLogger(JAXRSLoggingAtomPushTest.class);
+    public static final Logger LOG = LogUtils.getL7dLogger(JAXRSLoggingAtomPushTest.class);
+
     private static Server server;
     
     
@@ -89,6 +90,15 @@ public class JAXRSLoggingAtomPushTest ex
         ins.close();
         s = s.replaceAll("9080", PORT);
         lm.readConfiguration(new ByteArrayInputStream(s.getBytes("UTF-8")));
+        
+        for (Handler h : LOG.getHandlers()) {
+            LOG.removeHandler(h);
+            h.close();
+        }
+        if (lm.getProperty(JAXRSLoggingAtomPushTest.class.getName() + ".handlers") != null)
{
+            LOG.addHandler(new AtomPushHandler());
+        }
+        LOG.setUseParentHandlers(false);
     }
 
     private static void logSixEvents(Logger log) {
@@ -109,16 +119,17 @@ public class JAXRSLoggingAtomPushTest ex
 
     @AfterClass
     public static void afterClass() throws Exception {
-        if (server != null) {
-            server.destroy();
-        }
         LogManager lm = LogManager.getLogManager();
         try {
+            lm.reset();
             // restoring original configuration to not use tested logging handlers
             lm.readConfiguration();
         } catch (Exception e) {
             // ignore missing config file
         }
+        if (server != null) {
+            server.destroy();
+        }
     }
 
     @Before
@@ -126,6 +137,17 @@ public class JAXRSLoggingAtomPushTest ex
         Resource.clear();
     }
 
+    private void waitForFeeds(Collection<?> c, int count) throws Exception {
+        int iter = 0;
+        while (c.size() < count) {
+            Thread.sleep(100);
+            iter++;
+            if (iter > 30) {
+                return;
+            }
+        }
+    }
+    
     @Test
     public void testPrivateLogger() throws Exception {
         configureLogging("resources/logging_atompush_disabled.properties");
@@ -137,7 +159,7 @@ public class JAXRSLoggingAtomPushTest ex
         log.setLevel(Level.ALL);
         logSixEvents(log);
         // need to wait: multithreaded and client-server journey
-        Thread.sleep(3000);
+        waitForFeeds(Resource.feeds, 3);
         // 6 events / 2 element batch = 3 feeds expected
         assertEquals("Different logged events count;", 3, Resource.feeds.size());
     }
@@ -157,7 +179,7 @@ public class JAXRSLoggingAtomPushTest ex
         log.setLevel(Level.ALL);
         logSixEvents(log);
         // need to wait: multithreaded and client-server journey
-        Thread.sleep(3000);
+        waitForFeeds(Resource.feeds, 3);
         // 6 events / 2 element batch = 3 feeds expected
         assertEquals("Different logged events count;", 3, Resource.feeds.size());
     }
@@ -165,18 +187,18 @@ public class JAXRSLoggingAtomPushTest ex
     @Test
     public void testOneElementBatch() throws Exception {
         configureLogging("resources/logging_atompush.properties");
-        logSixEvents(LOG);
+        logSixEvents(LogUtils.getL7dLogger(JAXRSLoggingAtomPushTest.class));
         // need to wait: multithreaded and client-server journey
-        Thread.sleep(3000);
+        waitForFeeds(Resource.feeds, 6);
         assertEquals("Different logged events count;", 6, Resource.feeds.size());
     }
 
     @Test
     public void testMultiElementBatch() throws Exception {
         configureLogging("resources/logging_atompush_batch.properties");
-        logSixEvents(LOG);
+        logSixEvents(LogUtils.getL7dLogger(JAXRSLoggingAtomPushTest.class));
         // need to wait: multithreaded and client-server journey
-        Thread.sleep(3000);
+        waitForFeeds(Resource.feeds, 2);
         // 6 events / 3 element batch = 2 feeds expected
         assertEquals("Different logged events count;", 2, Resource.feeds.size());
     }
@@ -213,9 +235,9 @@ public class JAXRSLoggingAtomPushTest ex
     @Test
     public void testAtomPubEntries() throws Exception {
         configureLogging("resources/logging_atompush_atompub.properties");
-        logSixEvents(LOG);
+        logSixEvents(LogUtils.getL7dLogger(JAXRSLoggingAtomPushTest.class));
         // need to wait: multithreaded and client-server journey
-        Thread.sleep(3000);
+        waitForFeeds(Resource.entries, 6);
         // 6 events logged as entries
         assertEquals("Different logged events count;", 6, Resource.entries.size());
     }

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/logging_atompush.properties
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/logging_atompush.properties?rev=1346533&r1=1346532&r2=1346533&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/logging_atompush.properties
(original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/logging_atompush.properties
Tue Jun  5 18:57:40 2012
@@ -1,28 +1,7 @@
-# Atom logger plus echo on console
-handlers = org.apache.cxf.management.web.logging.atom.AtomPushHandler, java.util.logging.ConsoleHandler
-
-# Set the default logging level for the root logger
-.level = ALL
-
 # Set logging levels for the package-named loggers 
-org.apache.cxf.systest.jaxrs.level = ALL
-
-# Need to turn off logging from surrounding environment to properly count log entries in
tests
-# (specified sub-entries since root level overrides sub-levels... yes, JUL is dumb :)
-org.apache.cxf.jaxrs.level = OFF
-org.apache.cxf.phase.level = OFF
-org.apache.cxf.service.level = OFF
-org.apache.cxf.interceptor.level = OFF
-org.apache.cxf.transport.level = OFF
-org.apache.cxf.bus.level = OFF
-org.apache.cxf.configuration.level = OFF
-org.apache.cxf.endpoint.level = OFF
-org.apache.cxf.resource.level = OFF
-org.springframework.level = OFF
-org.mortbay.level = OFF
-org.eclipse.level = OFF
-org.apache.axiom.level = OFF
-org.apache.cxf.ws.policy.level = OFF
+org.apache.cxf.systest.jaxrs.JAXRSLoggingAtomPushTest.level = ALL
+org.apache.cxf.systest.jaxrs.JAXRSLoggingAtomPushTest.handlers = org.apache.cxf.management.web.logging.atom.AtomPushHandler
+org.apache.cxf.systest.jaxrs.JAXRSLoggingAtomPushTest.useParentHandlers = false
 
 # Atom handler specific settings
 org.apache.cxf.management.web.logging.atom.AtomPushHandler.url = http://localhost:9080

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/logging_atompush_atompub.properties
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/logging_atompush_atompub.properties?rev=1346533&r1=1346532&r2=1346533&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/logging_atompush_atompub.properties
(original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/logging_atompush_atompub.properties
Tue Jun  5 18:57:40 2012
@@ -1,28 +1,7 @@
-# Atom logger plus echo on console
-handlers = org.apache.cxf.management.web.logging.atom.AtomPushHandler, java.util.logging.ConsoleHandler
-
-# Set the default logging level for the root logger
-.level = ALL
-
 # Set logging levels for the package-named loggers 
-org.apache.cxf.systest.jaxrs.level = ALL
-
-# Need to turn off logging from surrounding environment to properly count log entries in
tests
-# (specified sub-entries since root level overrides sub-levels... yes, JUL is dumb :)
-org.apache.cxf.jaxrs.level = OFF
-org.apache.cxf.phase.level = OFF
-org.apache.cxf.service.level = OFF
-org.apache.cxf.interceptor.level = OFF
-org.apache.cxf.transport.level = OFF
-org.apache.cxf.bus.level = OFF
-org.apache.cxf.configuration.level = OFF
-org.apache.cxf.endpoint.level = OFF
-org.apache.cxf.resource.level = OFF
-org.springframework.level = OFF
-org.mortbay.level = OFF
-org.eclipse.level = OFF
-org.apache.axiom.level = OFF
-org.apache.cxf.ws.policy.level = OFF
+org.apache.cxf.systest.jaxrs.JAXRSLoggingAtomPushTest.level = ALL
+org.apache.cxf.systest.jaxrs.JAXRSLoggingAtomPushTest.handlers = org.apache.cxf.management.web.logging.atom.AtomPushHandler
+org.apache.cxf.systest.jaxrs.JAXRSLoggingAtomPushTest.useParentHandlers = false
 
 # Atom handler specific settings
 org.apache.cxf.management.web.logging.atom.AtomPushHandler.url = http://localhost:9080/atomPub

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/logging_atompush_batch.properties
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/logging_atompush_batch.properties?rev=1346533&r1=1346532&r2=1346533&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/logging_atompush_batch.properties
(original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/logging_atompush_batch.properties
Tue Jun  5 18:57:40 2012
@@ -1,27 +1,8 @@
-# Atom logger plus echo on console
-handlers = org.apache.cxf.management.web.logging.atom.AtomPushHandler, java.util.logging.ConsoleHandler
-
-# Set the default logging level for the root logger
-.level = ALL
 
 # Set logging levels for the package-named loggers 
-org.apache.cxf.systest.jaxrs.level = ALL
-
-# Need to turn off logging from surrounding environment to properly count log entries in
tests
-# (specified sub-entries since root level overrides sub-levels... yes, JUL is dumb :)
-org.apache.cxf.jaxrs.level = OFF
-org.apache.cxf.phase.level = OFF
-org.apache.cxf.service.level = OFF
-org.apache.cxf.interceptor.level = OFF
-org.apache.cxf.transport.level = OFF
-org.apache.cxf.bus.level = OFF
-org.apache.cxf.configuration.level = OFF
-org.apache.cxf.endpoint.level = OFF
-org.apache.cxf.resource.level = OFF
-org.springframework.level = OFF
-org.mortbay.level = OFF
-org.eclipse.level = OFF
-org.apache.axiom.level = OFF
+org.apache.cxf.systest.jaxrs.JAXRSLoggingAtomPushTest.level = ALL
+org.apache.cxf.systest.jaxrs.JAXRSLoggingAtomPushTest.handlers = org.apache.cxf.management.web.logging.atom.AtomPushHandler
+org.apache.cxf.systest.jaxrs.JAXRSLoggingAtomPushTest.useParentHandlers = false
 
 # Atom handler specific settings
 org.apache.cxf.management.web.logging.atom.AtomPushHandler.url = http://localhost:9080



Mime
View raw message