Author: ningjiang
Date: Thu Nov 22 21:07:40 2007
New Revision: 597547
URL: http://svn.apache.org/viewvc?rev=597547&view=rev
Log:
CXF-1217 turn off the DontClosePort, and upgraded Jetty to 6.1.6
Added:
incubator/cxf/trunk/systests/src/test/resources/cxf.xml (with props)
Modified:
incubator/cxf/trunk/parent/pom.xml
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/TestUtilities.java
incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/Messages.properties
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/bus/BusShutdownTest.java
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http_jetty/EngineLifecycleTest.java
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/interceptor/InterceptorFaultTest.java
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom/ClientMtomXopTest.java
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom/MtomPolicyTest.java
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom/MtomServerTest.java
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/SequenceTest.java
Modified: incubator/cxf/trunk/parent/pom.xml
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/parent/pom.xml?rev=597547&r1=597546&r2=597547&view=diff
==============================================================================
--- incubator/cxf/trunk/parent/pom.xml (original)
+++ incubator/cxf/trunk/parent/pom.xml Thu Nov 22 21:07:40 2007
@@ -47,7 +47,7 @@
<jaxb.impl.version>2.1.4</jaxb.impl.version>
<jaxb.xjc.version>2.1.4</jaxb.xjc.version>
<jaxws.version>2.1-1</jaxws.version>
- <jetty.version>6.1.5</jetty.version>
+ <jetty.version>6.1.6</jetty.version>
<saaj.version>1.3</saaj.version>
<saaj.impl.version>1.3</saaj.impl.version>
<spring.version>2.0.6</spring.version>
@@ -242,7 +242,7 @@
connection, on some Linux's, the socket
remains consumed until
some timeout occurs. That may cause some
tests to timeout/hang. -->
<name>org.apache.cxf.transports.http_jetty.DontClosePort</name>
- <value>true</value>
+ <value>false</value>
</property>
</systemProperties>
</configuration>
@@ -993,7 +993,7 @@
connection, on some Linux's, the socket
remains consumed until
some timeout occurs. That may cause
some tests to timeout/hang. -->
<name>org.apache.cxf.transports.http_jetty.DontClosePort</name>
- <value>true</value>
+ <value>false</value>
</property>
</systemProperties>
</configuration>
Modified:
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/TestUtilities.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/TestUtilities.java?rev=597547&r1=597546&r2=597547&view=diff
==============================================================================
---
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/TestUtilities.java
(original)
+++
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/TestUtilities.java
Thu Nov 22 21:07:40 2007
@@ -65,10 +65,12 @@
public class TestUtilities {
private static final Charset UTF8 = Charset.forName("utf-8");
-
+ private static String keepAlive;
+
private static String basedirPath;
protected Bus bus;
protected Class<?> classpathAnchor;
+
/**
* Namespaces for the XPath expressions.
@@ -85,6 +87,19 @@
*/
public TestUtilities(Class<?> classpathReference) {
classpathAnchor = classpathReference;
+ }
+
+ public static void setKeepAliveSystemProperty(boolean setAlive) {
+ keepAlive = System.getProperty("http.keepAlive");
+ System.setProperty("http.keepAlive", Boolean.toString(setAlive));
+ }
+
+ public static void recoverKeepAliveSystemProperty() {
+ if (keepAlive != null) {
+ System.setProperty("http.keepAlive", keepAlive);
+ } else {
+ System.clearProperty("http.keepAlive");
+ }
}
public void addDefaultNamespaces() {
Modified:
incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java?rev=597547&r1=597546&r2=597547&view=diff
==============================================================================
---
incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
(original)
+++
incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
Thu Nov 22 21:07:40 2007
@@ -20,9 +20,8 @@
package org.apache.cxf.transport.http_jetty;
import java.io.IOException;
-import java.net.ServerSocket;
import java.net.URL;
-import java.nio.channels.ServerSocketChannel;
+
import java.security.GeneralSecurityException;
import java.util.List;
import java.util.logging.Level;
@@ -40,7 +39,6 @@
import org.mortbay.jetty.Connector;
import org.mortbay.jetty.Handler;
import org.mortbay.jetty.Server;
-import org.mortbay.jetty.bio.SocketConnector;
import org.mortbay.jetty.handler.ContextHandler;
import org.mortbay.jetty.handler.ContextHandlerCollection;
import org.mortbay.jetty.handler.DefaultHandler;
@@ -284,11 +282,10 @@
if (defaultHandler != null) {
server.addHandler(defaultHandler);
}
- try {
+ try {
+ setReuseAddress(connector);
server.start();
- if (isReuseAddress()) {
- setReuseAddress(connector);
- }
+
AbstractConnector aconn = (AbstractConnector) connector;
if (aconn.getThreadPool() instanceof BoundedThreadPool
&& isSetThreadingParameters()) {
@@ -343,20 +340,11 @@
}
private void setReuseAddress(Connector conn) throws IOException {
- if (conn.getConnection() == null) {
- conn.open(); // it might not be opened.
- }
- ServerSocket socket = null;
- if (conn instanceof SelectChannelConnector) {
- ServerSocketChannel channel = (ServerSocketChannel)
conn.getConnection();
- socket = channel.socket();
- } else if (conn instanceof SocketConnector) {
- socket = (ServerSocket)conn.getConnection();
+ if (conn instanceof AbstractConnector) {
+ ((AbstractConnector)conn).setReuseAddress(isReuseAddress());
} else {
- LOG.info("UNKNOWN_CONNECTOR_MSG");
- return;
- }
- socket.setReuseAddress(true);
+ LOG.log(Level.INFO, "UNKNOWN_CONNECTOR_MSG", new Object[] {conn});
+ }
}
/**
Modified:
incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/Messages.properties
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/Messages.properties?rev=597547&r1=597546&r2=597547&view=diff
==============================================================================
---
incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/Messages.properties
(original)
+++
incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/Messages.properties
Thu Nov 22 21:07:40 2007
@@ -23,4 +23,4 @@
REMOVE_HANDLER_FAILED_MSG = Could not remove cxf jetty handler from Jetty
server: {0}
CAN_NOT_FIND_HANDLER_MSG = Could not find the handler to remove for context
url {0}
FAILED_TO_SHUTDOWN_ENGINE_MSG = Failed to shutdown Jetty server on port
{0,number,####0} because it is still in use
-UNKNOWN_CONNECTOR_MSG = Unknown connector type, can't set the socket
reuseAddress flag.
\ No newline at end of file
+UNKNOWN_CONNECTOR_MSG = Unknown connector type {0}, can't set the socket
reuseAddress flag.
Modified:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/bus/BusShutdownTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/bus/BusShutdownTest.java?rev=597547&r1=597546&r2=597547&view=diff
==============================================================================
---
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/bus/BusShutdownTest.java
(original)
+++
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/bus/BusShutdownTest.java
Thu Nov 22 21:07:40 2007
@@ -28,41 +28,40 @@
import org.apache.cxf.Bus;
import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.cxf.test.TestUtilities;
import org.apache.hello_world_soap_http.Greeter;
import org.apache.hello_world_soap_http.GreeterImpl;
import org.apache.hello_world_soap_http.SOAPService;
-import org.junit.After;
+
+import org.junit.AfterClass;
import org.junit.Assert;
-import org.junit.Before;
+
+import org.junit.BeforeClass;
import org.junit.Test;
public class BusShutdownTest extends Assert {
- private String close;
-
- @Before
- public void setSystemProperties() {
- close =
System.getProperty("org.apache.cxf.transports.http_jetty.DontClosePort");
-
System.setProperty("org.apache.cxf.transports.http_jetty.DontClosePort",
"false");
-
+ @BeforeClass
+ public static void setKeepAliveProperty() {
+ TestUtilities.setKeepAliveSystemProperty(false);
}
- @After
- public void resetSystemProperties() {
- if (close != null) {
-
System.setProperty("org.apache.cxf.transports.http_jetty.DontClosePort", close);
- }
+ @AfterClass
+ public static void cleanKeepAliveProperty() {
+ TestUtilities.recoverKeepAliveSystemProperty();
}
+
+
@Test
public void testStartWorkShutdownWork() throws Exception {
URL wsdlUrl = getClass().getResource("/wsdl/hello_world.wsdl");
assertNotNull("wsdl resource was not found", wsdlUrl);
-
- String serverAddr = "http://localhost:9098/greeter/port";
+ // Since this test always fails in linux box, try to use other port
+ String serverAddr = "http://localhost:40000/greeter/port";
makeTwoWayCallOnNewBus(wsdlUrl, serverAddr);
- Thread.sleep(4000);
+
// verify sutdown cleans the slate and reverts to null state
//
Modified:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http_jetty/EngineLifecycleTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http_jetty/EngineLifecycleTest.java?rev=597547&r1=597546&r2=597547&view=diff
==============================================================================
---
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http_jetty/EngineLifecycleTest.java
(original)
+++
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http_jetty/EngineLifecycleTest.java
Thu Nov 22 21:07:40 2007
@@ -86,6 +86,7 @@
public void setUpBus(boolean includeService) throws Exception {
applicationContext = new GenericApplicationContext();
+ readBeans(new ClassPathResource("cxf.xml"));
readBeans(new ClassPathResource("META-INF/cxf/cxf.xml"));
readBeans(new
ClassPathResource("META-INF/cxf/cxf-extension-soap.xml"));
readBeans(new
ClassPathResource("META-INF/cxf/cxf-extension-http.xml"));
@@ -158,9 +159,7 @@
bus.shutdown(true);
applicationContext.destroy();
applicationContext.close();
- //Waiting for the releasing of the socket
- Thread.sleep(2000);
-
+
}
@@ -221,9 +220,7 @@
shutdownService();
verifyNoServer(8808);
verifyNoServer(8801);
- // For some multicores linux box
- // It will take more time to release the socket
- Thread.sleep(4000);
+
setUpBus(true);
Modified:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/interceptor/InterceptorFaultTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/interceptor/InterceptorFaultTest.java?rev=597547&r1=597546&r2=597547&view=diff
==============================================================================
---
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/interceptor/InterceptorFaultTest.java
(original)
+++
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/interceptor/InterceptorFaultTest.java
Thu Nov 22 21:07:40 2007
@@ -48,12 +48,14 @@
import org.apache.cxf.phase.Phase;
import org.apache.cxf.phase.PhaseComparator;
import org.apache.cxf.phase.PhaseManager;
+import org.apache.cxf.test.TestUtilities;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
import org.apache.cxf.transport.http.HTTPConduit;
import org.apache.cxf.transports.http.configuration.HTTPClientPolicy;
import org.apache.cxf.ws.addressing.MAPAggregator;
import org.junit.After;
+import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -125,7 +127,13 @@
@BeforeClass
public static void startServers() throws Exception {
+ TestUtilities.setKeepAliveSystemProperty(false);
assertTrue("server did not launch correctly",
launchServer(Server.class, true));
+ }
+
+ @AfterClass
+ public static void cleanup() {
+ TestUtilities.recoverKeepAliveSystemProperty();
}
@After
Modified:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom/ClientMtomXopTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom/ClientMtomXopTest.java?rev=597547&r1=597546&r2=597547&view=diff
==============================================================================
---
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom/ClientMtomXopTest.java
(original)
+++
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom/ClientMtomXopTest.java
Thu Nov 22 21:07:40 2007
@@ -42,7 +42,9 @@
import org.apache.cxf.service.Service;
import org.apache.cxf.service.factory.ReflectionServiceFactoryBean;
import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.test.TestUtilities;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
+import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -54,7 +56,13 @@
@BeforeClass
public static void startServers() throws Exception {
+ TestUtilities.setKeepAliveSystemProperty(false);
assertTrue("server did not launch correctly",
launchServer(Server.class));
+ }
+
+ @AfterClass
+ public static void cleanup() {
+ TestUtilities.recoverKeepAliveSystemProperty();
}
/*
Modified:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom/MtomPolicyTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom/MtomPolicyTest.java?rev=597547&r1=597546&r2=597547&view=diff
==============================================================================
---
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom/MtomPolicyTest.java
(original)
+++
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom/MtomPolicyTest.java
Thu Nov 22 21:07:40 2007
@@ -42,6 +42,7 @@
import org.apache.cxf.message.MessageImpl;
import org.apache.cxf.service.model.EndpointInfo;
import org.apache.cxf.test.AbstractCXFTest;
+import org.apache.cxf.test.TestUtilities;
import org.apache.cxf.transport.Conduit;
import org.apache.cxf.transport.ConduitInitiator;
import org.apache.cxf.transport.ConduitInitiatorManager;
@@ -49,10 +50,23 @@
import org.apache.cxf.ws.policy.PolicyEngine;
import org.apache.cxf.ws.policy.WSPolicyFeature;
import org.apache.cxf.ws.policy.selector.FirstAlternativeSelector;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
import org.junit.Test;
public class MtomPolicyTest extends AbstractCXFTest {
+
String address = "http://localhost:9036/EchoService";
+
+ @BeforeClass
+ public static void setKeepAliveProperty() {
+ TestUtilities.setKeepAliveSystemProperty(false);
+ }
+
+ @AfterClass
+ public static void cleanKeepAliveProperty() {
+ TestUtilities.recoverKeepAliveSystemProperty();
+ }
@Test
public void testRequiredMtom() throws Exception {
Modified:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom/MtomServerTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom/MtomServerTest.java?rev=597547&r1=597546&r2=597547&view=diff
==============================================================================
---
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom/MtomServerTest.java
(original)
+++
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom/MtomServerTest.java
Thu Nov 22 21:07:40 2007
@@ -39,6 +39,7 @@
import org.apache.cxf.message.MessageImpl;
import org.apache.cxf.service.model.EndpointInfo;
import org.apache.cxf.test.AbstractCXFTest;
+import org.apache.cxf.test.TestUtilities;
import org.apache.cxf.transport.Conduit;
import org.apache.cxf.transport.ConduitInitiator;
import org.apache.cxf.transport.ConduitInitiatorManager;
@@ -46,11 +47,24 @@
import org.apache.cxf.transport.DestinationFactory;
import org.apache.cxf.transport.DestinationFactoryManager;
import org.apache.cxf.transport.MessageObserver;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
import org.junit.Test;
public class MtomServerTest extends AbstractCXFTest {
+
private static final String HTTP_ID =
"http://schemas.xmlsoap.org/wsdl/http/";
+
+ @BeforeClass
+ public static void setKeepAliveProperty() {
+ TestUtilities.setKeepAliveSystemProperty(false);
+ }
+
+ @AfterClass
+ public static void cleanKeepAliveProperty() {
+ TestUtilities.recoverKeepAliveSystemProperty();
+ }
@Test
public void testMtomRequest() throws Exception {
Modified:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/SequenceTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/SequenceTest.java?rev=597547&r1=597546&r2=597547&view=diff
==============================================================================
---
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/SequenceTest.java
(original)
+++
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/SequenceTest.java
Thu Nov 22 21:07:40 2007
@@ -49,6 +49,7 @@
import org.apache.cxf.systest.ws.util.MessageFlow;
import org.apache.cxf.systest.ws.util.MessageRecorder;
import org.apache.cxf.systest.ws.util.OutMessageRecorder;
+import org.apache.cxf.test.TestUtilities;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
import org.apache.cxf.transport.http.HTTPConduit;
import org.apache.cxf.transports.http.configuration.HTTPClientPolicy;
@@ -60,6 +61,7 @@
import org.apache.cxf.ws.rm.RMProperties;
import org.apache.cxf.ws.rm.soap.RMSoapInterceptor;
import org.junit.After;
+import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
@@ -120,7 +122,13 @@
@BeforeClass
public static void startServers() throws Exception {
+ TestUtilities.setKeepAliveSystemProperty(false);
assertTrue("server did not launch correctly",
launchServer(Server.class));
+ }
+
+ @AfterClass
+ public static void cleanup() {
+ TestUtilities.recoverKeepAliveSystemProperty();
}
Added: incubator/cxf/trunk/systests/src/test/resources/cxf.xml
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/resources/cxf.xml?rev=597547&view=auto
==============================================================================
--- incubator/cxf/trunk/systests/src/test/resources/cxf.xml (added)
+++ incubator/cxf/trunk/systests/src/test/resources/cxf.xml Thu Nov 22 21:07:40
2007
@@ -0,0 +1,30 @@
+<?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="http://cxf.apache.org/transports/http/configuration"
+ xsi:schemaLocation="
+http://cxf.apache.org/transports/http/configuration
http://cxf.apache.org/schemas/configuration/http-conf.xsd
+http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+ <http:conduit name="*.http-conduit">
+ <http:client AllowChunking="false"/>
+ </http:conduit>
+</beans>
\ No newline at end of file
Propchange: incubator/cxf/trunk/systests/src/test/resources/cxf.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/systests/src/test/resources/cxf.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/cxf/trunk/systests/src/test/resources/cxf.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml