You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2012/05/14 18:40:34 UTC

svn commit: r1338280 - in /cxf/trunk: parent/ systests/transports/ systests/transports/src/test/java/org/apache/cxf/systest/http/ systests/transports/src/test/java/org/apache/cxf/systest/http/auth/ systests/transports/src/test/java/org/apache/cxf/syste...

Author: dkulp
Date: Mon May 14 16:40:34 2012
New Revision: 1338280

URL: http://svn.apache.org/viewvc?rev=1338280&view=rev
Log:
More cleanup so systests/transports can be forkmode once

Modified:
    cxf/trunk/parent/pom.xml
    cxf/trunk/systests/transports/pom.xml
    cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/HTTPConduitTest.java
    cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/auth/DigestAuthTest.java
    cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http_jetty/EngineLifecycleTest.java
    cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http_jetty/continuations/ClientServerWrappedContinuationTest.java
    cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/multitransport/MultiTransportClientServerTest.java
    cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/servlet/NoSpringServletClientTest.java

Modified: cxf/trunk/parent/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/parent/pom.xml?rev=1338280&r1=1338279&r2=1338280&view=diff
==============================================================================
--- cxf/trunk/parent/pom.xml (original)
+++ cxf/trunk/parent/pom.xml Mon May 14 16:40:34 2012
@@ -392,10 +392,6 @@
                             <derby.system.home>${basedir}/target/derby</derby.system.home>
                             <spring.validation.mode>${cxf.spring.validation.mode}</spring.validation.mode>
                             <server.launcher.vmargs>${cxf.server.launcher.vmargs}</server.launcher.vmargs>
-                            <!-- If we close the port after a client in the same JVM has opened a keep-alive
-                            connection, on some Linux's, the socket remains consumed until
-                            some timeout occurs.   That may cause some tests to timeout/hang. -->
-                            <org.apache.cxf.transports.http_jetty.DontClosePort>false</org.apache.cxf.transports.http_jetty.DontClosePort>
                         </systemPropertyVariables>
                     </configuration>
                 </plugin>

Modified: cxf/trunk/systests/transports/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/transports/pom.xml?rev=1338280&r1=1338279&r2=1338280&view=diff
==============================================================================
--- cxf/trunk/systests/transports/pom.xml (original)
+++ cxf/trunk/systests/transports/pom.xml Mon May 14 16:40:34 2012
@@ -283,8 +283,5 @@
         </dependency>
 
     </dependencies>
-    <properties>
-        <cxf.surefire.fork.mode>pertest</cxf.surefire.fork.mode>
-    </properties>
 
 </project>

Modified: cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/HTTPConduitTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/HTTPConduitTest.java?rev=1338280&r1=1338279&r2=1338280&view=diff
==============================================================================
--- cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/HTTPConduitTest.java (original)
+++ cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/HTTPConduitTest.java Mon May 14 16:40:34 2012
@@ -69,6 +69,7 @@ import org.apache.cxf.transports.http.co
 import org.apache.hello_world.Greeter;
 import org.apache.hello_world.services.SOAPService;
 
+import org.junit.AfterClass;
 import org.junit.Test;
 
 import org.springframework.context.ApplicationContext;
@@ -199,6 +200,7 @@ public class HTTPConduitTest extends Abs
         if (servers.contains(name)) {
             return true;
         }
+        Bus bus = BusFactory.getThreadDefaultBus(false);
         URL serverC =
             Server.class.getResource("resources/" + name + ".cxf");
         boolean server = launchServer(Server.class, null,
@@ -210,8 +212,22 @@ public class HTTPConduitTest extends Abs
         if (server) {
             servers.add(name);
         }
+        BusFactory.setDefaultBus(null);
+        BusFactory.setThreadDefaultBus(bus);
         return server;
     }
+    
+    @AfterClass
+    public static void cleanUp() {
+        Bus b = BusFactory.getDefaultBus(false);
+        if (b != null) {
+            b.shutdown(true);
+        }
+        b = BusFactory.getThreadDefaultBus(false);
+        if (b != null) {
+            b.shutdown(true);
+        }
+    }
 
     public static KeyStore getKeyStore(String ksType, String file, String ksPassword)
         throws GeneralSecurityException,

Modified: cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/auth/DigestAuthTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/auth/DigestAuthTest.java?rev=1338280&r1=1338279&r2=1338280&view=diff
==============================================================================
--- cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/auth/DigestAuthTest.java (original)
+++ cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/auth/DigestAuthTest.java Mon May 14 16:40:34 2012
@@ -49,10 +49,11 @@ public class DigestAuthTest extends Abst
     }
     
     @BeforeClass
-    public static void startServer() {
+    public static void startServer() throws Exception {
         launchServer(DigestServer.class, true);
+        createStaticBus();
     }
-
+    
     @Test    
     public void testDigestAuth() throws Exception {
         URL wsdl = getClass().getResource("../resources/greeting.wsdl");

Modified: cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http_jetty/EngineLifecycleTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http_jetty/EngineLifecycleTest.java?rev=1338280&r1=1338279&r2=1338280&view=diff
==============================================================================
--- cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http_jetty/EngineLifecycleTest.java (original)
+++ cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http_jetty/EngineLifecycleTest.java Mon May 14 16:40:34 2012
@@ -46,9 +46,7 @@ import org.apache.cxf.transport.http_jet
 import org.eclipse.jetty.server.Handler;
 import org.eclipse.jetty.webapp.WebAppContext;
 
-import org.junit.After;
 import org.junit.Assert;
-import org.junit.Before;
 import org.junit.Test;
 
 import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
@@ -64,33 +62,13 @@ import org.springframework.core.io.Resou
 public class EngineLifecycleTest extends Assert {
     private static final String PORT1 = TestUtil.getPortNumber(EngineLifecycleTest.class, 1);
     private static final String PORT2 = TestUtil.getPortNumber(EngineLifecycleTest.class, 2);
-    private String close;
-    private GenericApplicationContext applicationContext;
-    
-    
+    private GenericApplicationContext applicationContext;    
         
     private void readBeans(Resource beanResource) {
         XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(applicationContext);
         reader.loadBeanDefinitions(beanResource);
     }
     
-    @Before 
-    public void setSystemProperties() {
-        close = System.getProperty("org.apache.cxf.transports.http_jetty.DontClosePort");        
-        //System.setProperty("org.apache.cxf.transports.http_jetty.DontClosePort", "false");
-        System.clearProperty("org.apache.cxf.transports.http_jetty.DontClosePort");
-        
-    }
-    
-    @After
-    public void resetSystemProperties() {
-        if (close != null) {
-            System.setProperty("org.apache.cxf.transports.http_jetty.DontClosePort", close);
-        } else {
-            System.clearProperty("org.apache.cxf.transports.http_jetty.DontClosePort");
-        }
-    }
-    
     public void setUpBus(boolean includeService) throws Exception {
         applicationContext = new GenericApplicationContext();
         readBeans(new ClassPathResource("/org/apache/cxf/systest/http_jetty/cxf.xml"));

Modified: cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http_jetty/continuations/ClientServerWrappedContinuationTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http_jetty/continuations/ClientServerWrappedContinuationTest.java?rev=1338280&r1=1338279&r2=1338280&view=diff
==============================================================================
--- cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http_jetty/continuations/ClientServerWrappedContinuationTest.java (original)
+++ cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http_jetty/continuations/ClientServerWrappedContinuationTest.java Mon May 14 16:40:34 2012
@@ -52,6 +52,7 @@ public class ClientServerWrappedContinua
         protected void run() {
             SpringBusFactory bf = new SpringBusFactory();
             Bus bus = bf.createBus(SERVER_CONFIG_FILE);
+            setBus(bus);
             BusFactory.setDefaultBus(bus);
             
             Object implementor = new HelloImplWithWrapppedContinuation();
@@ -93,6 +94,7 @@ public class ClientServerWrappedContinua
         assertNotNull(service);
         final HelloContinuation helloPort = service.getHelloContinuationPort();
         doTest(helloPort);
+        bus.shutdown(true);
     }
         
     @Test
@@ -109,6 +111,7 @@ public class ClientServerWrappedContinua
         assertNotNull(service);
         final HelloContinuation helloPort = service.getHelloContinuationPort();
         doTest(helloPort);
+        bus.shutdown(true);
     }
 
     private void doTest(final HelloContinuation helloPort) throws Exception {

Modified: cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/multitransport/MultiTransportClientServerTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/multitransport/MultiTransportClientServerTest.java?rev=1338280&r1=1338279&r2=1338280&view=diff
==============================================================================
--- cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/multitransport/MultiTransportClientServerTest.java (original)
+++ cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/multitransport/MultiTransportClientServerTest.java Mon May 14 16:40:34 2012
@@ -98,7 +98,7 @@ public class MultiTransportClientServerT
                    launchServer(EmbeddedJMSBrokerLauncher.class, props, null));
 
         assertTrue("server did not launch correctly", launchServer(MyServer.class, true));
-        
+        createStaticBus();
     }
     
     // the purpose of this test shows how one service include two ports with different

Modified: cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/servlet/NoSpringServletClientTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/servlet/NoSpringServletClientTest.java?rev=1338280&r1=1338279&r2=1338280&view=diff
==============================================================================
--- cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/servlet/NoSpringServletClientTest.java (original)
+++ cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/servlet/NoSpringServletClientTest.java Mon May 14 16:40:34 2012
@@ -46,6 +46,7 @@ public class NoSpringServletClientTest e
     @BeforeClass
     public static void startServers() throws Exception {
         assertTrue("server did not launch correctly", launchServer(NoSpringServletServer.class));
+        createStaticBus();
     }
 
     @Test