You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by eg...@apache.org on 2009/02/26 19:15:13 UTC

svn commit: r748255 - in /cxf/branches/2.1.x-fixes: rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/ systests/src/test/java/org/apache/cxf/systest/http_jetty/ systests/src/test/java/org/apache/cxf/systest/ws/addressing/

Author: eglynn
Date: Thu Feb 26 18:15:12 2009
New Revision: 748255

URL: http://svn.apache.org/viewvc?rev=748255&view=rev
Log:
Added http_jetty/ThreadPoolTest

Added:
    cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/GreeterImpl.java
    cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/Server.java
    cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/ThreadPoolTest.java
    cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/server.xml
Modified:
    cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
    cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/ws/addressing/MAPTest.java
    cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/ws/addressing/server.xml

Modified: cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java?rev=748255&r1=748254&r2=748255&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java (original)
+++ cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java Thu Feb 26 18:15:12 2009
@@ -305,7 +305,6 @@
                 server.start();
                
                 AbstractConnector aconn = (AbstractConnector) connector;
-                System.out.println("\n\n ** pool: " + aconn.getThreadPool() + " *** \n\n");
                 if (isSetThreadingParameters()) {
                     if (aconn.getThreadPool() instanceof BoundedThreadPool) {
                         BoundedThreadPool pool = (BoundedThreadPool)aconn.getThreadPool();

Added: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/GreeterImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/GreeterImpl.java?rev=748255&view=auto
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/GreeterImpl.java (added)
+++ cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/GreeterImpl.java Thu Feb 26 18:15:12 2009
@@ -0,0 +1,148 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.systest.http_jetty;
+
+import java.util.Date;
+import java.util.concurrent.Future;
+
+import javax.jws.WebService;
+import javax.xml.ws.AsyncHandler;
+import javax.xml.ws.Response;
+
+import org.apache.hello_world_soap_http.BadRecordLitFault;
+import org.apache.hello_world_soap_http.Greeter;
+import org.apache.hello_world_soap_http.NoSuchCodeLitFault;
+import org.apache.hello_world_soap_http.types.BareDocumentResponse;
+import org.apache.hello_world_soap_http.types.GreetMeLaterResponse;
+import org.apache.hello_world_soap_http.types.GreetMeResponse;
+import org.apache.hello_world_soap_http.types.GreetMeSometimeResponse;
+import org.apache.hello_world_soap_http.types.SayHiResponse;
+import org.apache.hello_world_soap_http.types.TestDocLitFaultResponse;
+import org.apache.hello_world_soap_http.types.TestNillableResponse;
+
+
+@WebService(serviceName = "SOAPServiceAddressing", 
+            portName = "SoapPort", 
+            endpointInterface = "org.apache.hello_world_soap_http.Greeter", 
+            targetNamespace = "http://apache.org/hello_world_soap_http",
+            wsdlLocation = "testutils/hello_world.wsdl")
+public class GreeterImpl implements Greeter {
+
+    public String greetMe(String me) {
+        return null;
+    }
+
+    public String greetMeLater(long delay) {
+        System.out.println("\n\n*** GreetMeLater called with: " + delay
+                           + " at: " + new Date().toString()
+                           + "***\n\n");
+        if (delay > 0) {
+            try {
+                Thread.sleep(delay);
+            } catch (InterruptedException ex) {
+                // ignore
+            }
+        }
+        return "Hello, finally";
+    }
+
+    public void greetMeOneWay(String requestType) {   
+    }
+
+    public String sayHi() {
+        return null;
+    }
+    
+    public void testDocLitFault(String faultType) throws BadRecordLitFault, NoSuchCodeLitFault {
+    }
+
+    public BareDocumentResponse testDocLitBare(String in) {
+        return null;
+    }
+
+    public String greetMeSometime(String me) {
+        return null;
+    }
+    
+    public Future<?>  greetMeSometimeAsync(String requestType, 
+                                           AsyncHandler<GreetMeSometimeResponse> asyncHandler) { 
+        return null; 
+    }
+    
+    public Response<GreetMeSometimeResponse> greetMeSometimeAsync(String requestType) { 
+        return null; 
+    }
+    
+    public Response<TestDocLitFaultResponse> testDocLitFaultAsync(String faultType) {  
+        return null; 
+    }
+    
+    public Future<?> testDocLitFaultAsync(String faultType, AsyncHandler ah) {  
+        return null; 
+    }
+    
+    public Future<?> testDocLitBareAsync(String bare, AsyncHandler ah) {
+        return null;
+    }
+    
+    public Response<BareDocumentResponse> testDocLitBareAsync(String bare) {
+        return null;
+    }
+    
+    public Future<?> greetMeAsync(String requestType, AsyncHandler<GreetMeResponse> asyncHandler) { 
+        return null; 
+    }
+    
+    public Response<GreetMeResponse> greetMeAsync(String requestType) { 
+        return null; 
+    }
+    
+    public Future<?> greetMeLaterAsync(long requestType, AsyncHandler<GreetMeLaterResponse> asyncHandler) { 
+        return null; 
+    }
+    
+    public Response<GreetMeLaterResponse> greetMeLaterAsync(long requestType) { 
+        return null; 
+    }
+    
+    public Future<?> sayHiAsync(AsyncHandler<SayHiResponse> asyncHandler) { 
+        return null; 
+    }
+    
+    public Response<SayHiResponse> sayHiAsync() { 
+        return null; 
+    }
+
+    public String testNillable(String nillElem, int intElem) {
+        return null;
+    }
+
+    public Response<TestNillableResponse> testNillableAsync(String nillElem,
+                                                            int intElem) {
+        return null;
+    }
+    
+    public Future<?> testNillableAsync(String nillElem, 
+                                       int intElem,
+                                       AsyncHandler<TestNillableResponse> asyncHandler) {
+        return null;
+    }
+    
+}

Added: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/Server.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/Server.java?rev=748255&view=auto
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/Server.java (added)
+++ cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/Server.java Thu Feb 26 18:15:12 2009
@@ -0,0 +1,56 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.systest.http_jetty;
+
+
+import javax.xml.ws.Endpoint;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+
+
+public class Server extends AbstractBusTestServerBase  {
+    static final String ADDRESS = "http://localhost:9077/SoapContext/SoapPort";
+
+    protected void run()  {
+
+        SpringBusFactory factory = new SpringBusFactory();
+        Bus bus = factory.createBus("org/apache/cxf/systest/http_jetty/server.xml");
+        BusFactory.setDefaultBus(bus);
+        setBus(bus);
+
+        GreeterImpl implementor = new GreeterImpl();
+        Endpoint.publish(ADDRESS, implementor);
+    }
+        
+    public static void main(String[] args) {
+        try { 
+            Server s = new Server(); 
+            s.start();
+        } catch (Exception ex) {
+            ex.printStackTrace();
+            System.exit(-1);
+        } finally { 
+            System.out.println("done!");
+        }
+    }
+}

Added: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/ThreadPoolTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/ThreadPoolTest.java?rev=748255&view=auto
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/ThreadPoolTest.java (added)
+++ cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/ThreadPoolTest.java Thu Feb 26 18:15:12 2009
@@ -0,0 +1,80 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.systest.http_jetty;
+
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.BindingProvider;
+
+import org.apache.cxf.testutil.common.AbstractClientServerTestBase;
+import org.apache.hello_world_soap_http.Greeter;
+import org.apache.hello_world_soap_http.SOAPService;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Tests thread pool config.
+ */
+
+public class ThreadPoolTest extends AbstractClientServerTestBase {
+    private static final QName SERVICE_NAME = 
+        new QName("http://apache.org/hello_world_soap_http", "SOAPServiceAddressing");
+
+    private Greeter greeter;
+
+    @BeforeClass
+    public static void startServers() throws Exception {
+        assertTrue("server did not launch correctly", 
+                   launchServer(Server.class, false));
+    }
+
+    @Before
+    public void setUp() throws Exception {
+        URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
+        greeter = new SOAPService(wsdl, SERVICE_NAME).getPort(Greeter.class);
+        BindingProvider bp = (BindingProvider)greeter;
+        bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
+                                   Server.ADDRESS);
+    }
+
+    @Test
+    public void testFallbackThreadPoolConfig() throws Exception { 
+        Runnable r = new Runnable() {
+            public void run() {
+                greeter.greetMeLater(5 * 1000);
+            }
+        };
+        Thread[] invokers = new Thread[5];
+        long start = System.currentTimeMillis();
+        for (int i = 0; i < invokers.length; i++) {
+            invokers[i] = new Thread(r);
+            invokers[i].setDaemon(true);
+            invokers[i].start();
+        }
+        for (int i = 0; i < invokers.length; i++) {
+            invokers[i].join(15 * 1000);
+        }
+        long end = System.currentTimeMillis();
+        assertTrue("unexpected duration: " + (end - start),
+                   end - start > 10 * 1000L);
+    }
+}

Added: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/server.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/server.xml?rev=748255&view=auto
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/server.xml (added)
+++ cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/server.xml Thu Feb 26 18:15:12 2009
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+ 
+  http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:http-jetty="http://cxf.apache.org/transports/http-jetty/configuration"
+       xsi:schemaLocation="
+http://cxf.apache.org/transports/http-jetty/configuration http://cxf.apache.org/schemas/configuration/http-jetty.xsd
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
+  
+    <http-jetty:engine-factory bus="cxf">
+        <http-jetty:engine port="0">
+	    <http-jetty:threadingParameters minThreads="1" maxThreads="3"/>   
+        </http-jetty:engine>
+    </http-jetty:engine-factory>
+
+</beans>
+

Modified: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/ws/addressing/MAPTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/ws/addressing/MAPTest.java?rev=748255&r1=748254&r2=748255&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/ws/addressing/MAPTest.java (original)
+++ cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/ws/addressing/MAPTest.java Thu Feb 26 18:15:12 2009
@@ -21,7 +21,6 @@
 
 import java.lang.reflect.UndeclaredThrowableException;
 import org.apache.hello_world_soap_http.BadRecordLitFault;
-import org.junit.Ignore;
 import org.junit.Test;
 
 
@@ -66,29 +65,5 @@
             }
         }
     }
-
-    @Test
-    @Ignore("move to separate test")
-    public void testFallbackThreadPoolConfig() throws Exception { 
-        Runnable r = new Runnable() {
-            public void run() {
-                greeter.greetMeLater(5 * 1000);
-            }
-        };
-        Thread[] invokers = new Thread[5];
-        long start = System.currentTimeMillis();
-        for (int i = 0; i < invokers.length; i++) {
-            invokers[i] = new Thread(r);
-            invokers[i].setDaemon(true);
-            invokers[i].start();
-        }
-        for (int i = 0; i < invokers.length; i++) {
-            invokers[i].join(15 * 1000);
-        }
-        long end = System.currentTimeMillis();
-        assertTrue("unexpected duration: " + (end - start),
-                   end - start > 9 * 1000L);
-    }
-
 }
 

Modified: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/ws/addressing/server.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/ws/addressing/server.xml?rev=748255&r1=748254&r2=748255&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/ws/addressing/server.xml (original)
+++ cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/ws/addressing/server.xml Thu Feb 26 18:15:12 2009
@@ -19,17 +19,9 @@
 -->
 <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xmlns:http-jetty="http://cxf.apache.org/transports/http-jetty/configuration"
        xsi:schemaLocation="
-http://cxf.apache.org/transports/http-jetty/configuration http://cxf.apache.org/schemas/configuration/http-jetty.xsd
 http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
   
-    <http-jetty:engine-factory bus="cxf">
-        <http-jetty:engine port="0">
-	    <http-jetty:threadingParameters minThreads="1" maxThreads="2"/>   
-        </http-jetty:engine>
-    </http-jetty:engine-factory>
-    
     <import resource="wsa_interceptors.xml"/>
 </beans>