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 2007/10/22 23:01:59 UTC
svn commit: r587248 - in /incubator/cxf/branches/2.0.x-fixes: ./
systests/src/test/java/org/apache/cxf/systest/http_jetty/
Author: dkulp
Date: Mon Oct 22 14:01:58 2007
New Revision: 587248
URL: http://svn.apache.org/viewvc?rev=587248&view=rev
Log:
Merged revisions 586804 via svnmerge from
https://svn.apache.org/repos/asf/incubator/cxf/trunk
........
r586804 | bimargulies | 2007-10-20 17:22:18 -0400 (Sat, 20 Oct 2007) | 3 lines
Add test case for use of reusaddr. Willem expected this to NPE, but it
passes. Perhaps someone else can make it more studly.
........
Modified:
incubator/cxf/branches/2.0.x-fixes/ (props changed)
incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/EngineLifecycleTest.java
incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/jetty-engine.xml
incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/server-lifecycle-beans.xml
Propchange: incubator/cxf/branches/2.0.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/EngineLifecycleTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/EngineLifecycleTest.java?rev=587248&r1=587247&r2=587248&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/EngineLifecycleTest.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/EngineLifecycleTest.java Mon Oct 22 14:01:58 2007
@@ -22,12 +22,15 @@
import java.io.FileInputStream;
import java.io.InputStream;
import java.net.HttpURLConnection;
+import java.net.ServerSocket;
+import java.net.SocketException;
import java.net.URL;
import java.net.URLConnection;
import java.util.Properties;
import org.apache.cxf.Bus;
+import org.apache.cxf.endpoint.Server;
import org.apache.cxf.endpoint.ServerImpl;
import org.apache.cxf.endpoint.ServerRegistry;
import org.apache.cxf.helpers.IOUtils;
@@ -79,12 +82,6 @@
applicationContext.refresh();
}
- public void launchService() throws Exception {
- applicationContext = new GenericApplicationContext();
- readBeans(new ClassPathResource("server-lifecycle-beans.xml", getClass()));
- applicationContext.refresh();
- }
-
private void invokeService() {
DummyInterface client = (DummyInterface) applicationContext.getBean("dummy-client");
assertEquals("We should get out put from this client", "hello world", client.echo("hello world"));
@@ -128,7 +125,9 @@
return furl.toString();
}
- public void shutdownService() throws Exception {
+ public void shutdownService() throws Exception {
+ Bus bus = (Bus)applicationContext.getBean("cxf");
+ bus.shutdown(true);
applicationContext.destroy();
applicationContext.close();
}
@@ -159,16 +158,41 @@
invokeService();
shutdownService();
}
+
+ private void setReuseAddrForServer(int port) throws SocketException {
+ Bus bus = (Bus)applicationContext.getBean("cxf");
+ boolean turnedOnReuseAddr = false;
+ ServerRegistry sr = bus.getExtension(ServerRegistry.class);
+ for (Server server : sr.getServers()) {
+ ServerImpl si = (ServerImpl) server;
+ JettyHTTPDestination jhd = (JettyHTTPDestination) si.getDestination();
+ JettyHTTPServerEngine e = (JettyHTTPServerEngine) jhd.getEngine();
+ if (e.getConnector().getPort() == port) {
+ ServerSocket socket = (ServerSocket)e.getConnector().getConnection();
+ socket.setReuseAddress(true);
+ turnedOnReuseAddr = true;
+ }
+ }
+ assertTrue(turnedOnReuseAddr); // insure that we actually found the server for 8801 and did the deed.
+
+ }
+ /**
+ *
+ * @throws Exception
+ */
@Test
public void testServerUpDownUp() throws Exception {
- setUpBus(false);
- launchService();
+ setUpBus(true);
+ setReuseAddrForServer(8801);
+
getTestHtml();
invokeService();
shutdownService();
- launchService();
+ setUpBus(true);
+ setReuseAddrForServer(8801);
+
invokeService();
getTestHtml();
Modified: incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/jetty-engine.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/jetty-engine.xml?rev=587248&r1=587247&r2=587248&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/jetty-engine.xml (original)
+++ incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/jetty-engine.xml Mon Oct 22 14:01:58 2007
@@ -33,6 +33,13 @@
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<httpj:engine-factory bus="cxf">
+ <httpj:engine port='8801'>
+ <httpj:connector>
+ <bean class="org.mortbay.jetty.bio.SocketConnector">
+ <property name="port" value="8801"/>
+ </bean>
+ </httpj:connector>
+ </httpj:engine>
<httpj:engine port="8808">
<httpj:handlers>
<bean class="org.mortbay.jetty.handler.RequestLogHandler">
Modified: incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/server-lifecycle-beans.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/server-lifecycle-beans.xml?rev=587248&r1=587247&r2=587248&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/server-lifecycle-beans.xml (original)
+++ incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/server-lifecycle-beans.xml Mon Oct 22 14:01:58 2007
@@ -41,11 +41,19 @@
<!-- define a service factory that supports both JAX-WS annotations and also Aegis files. -->
<bean id='jaxws-and-aegis-service-factory' class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean"
- scope='prototype'>
+ scope='prototype'>
<property name="dataBinding" ref="aegisBean" />
</bean>
<jaxws:endpoint id="dummy-service-endpoint" implementor="org.apache.cxf.systest.http_jetty.Dummy" address="http://localhost:8808/Dummy">
+ <jaxws:serviceFactory>
+ <ref bean='jaxws-and-aegis-service-factory' />
+ </jaxws:serviceFactory>
+ </jaxws:endpoint>
+
+ <jaxws:endpoint id="dummy-8801-service-endpoint"
+ implementor="org.apache.cxf.systest.http_jetty.Dummy"
+ address="http://localhost:8801/Dummy">
<jaxws:serviceFactory>
<ref bean='jaxws-and-aegis-service-factory' />
</jaxws:serviceFactory>