Author: dkulp
Date: Tue Feb 14 18:33:35 2012
New Revision: 1244151
URL: http://svn.apache.org/viewvc?rev=1244151&view=rev
Log:
Merged revisions 1242895 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r1242895 | dkulp | 2012-02-10 14:27:37 -0500 (Fri, 10 Feb 2012) | 2 lines
More updates to system tests to fix the last remaining usage of ports in
the 8000-9999 range and the 61500 JMS port.
........
Modified:
cxf/branches/2.5.x-fixes/ (props changed)
cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/failover/FailoverTest.java
cxf/branches/2.5.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/ProviderXMLClientServerTest.java
cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/corba/CorbaTest.java
cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom/ClientMtomXopWithJMSTest.java
cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom/ServerWithJMS.java
cxf/branches/2.5.x-fixes/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractClientServerTestBase.java
cxf/branches/2.5.x-fixes/testutils/src/main/java/org/apache/cxf/testutil/common/ServerLauncher.java
cxf/branches/2.5.x-fixes/testutils/src/main/java/org/apache/cxf/testutil/common/TestUtil.java
Propchange: cxf/branches/2.5.x-fixes/
('svn:mergeinfo' removed)
Propchange: cxf/branches/2.5.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified:
cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/failover/FailoverTest.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/failover/FailoverTest.java?rev=1244151&r1=1244150&r2=1244151&view=diff
==============================================================================
---
cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/failover/FailoverTest.java
(original)
+++
cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/failover/FailoverTest.java
Tue Feb 14 18:33:35 2012
@@ -52,7 +52,8 @@ import org.junit.Test;
* Tests failover within a static cluster.
*/
public class FailoverTest extends AbstractBusClientServerTestBase {
-
+ public static final String NON_PORT = allocatePort(FailoverTest.class);
+
@BeforeClass
public static void startServers() throws Exception {
assertTrue("server did not launch correctly",
@@ -153,14 +154,14 @@ public class FailoverTest extends Abstra
@Test(expected = ClientWebApplicationException.class)
public void testSequentialStrategyFailure() throws Exception {
FailoverFeature feature =
- getFeature(false, false, "http://localhost:8182/non-existent");
+ getFeature(false, false, "http://localhost:" + NON_PORT +
"/non-existent");
strategyTest(Server.ADDRESS1, feature, null, null, false, false,
false);
}
@Test
public void testSequentialStrategyWithRetries() throws Exception {
- String address = "http://localhost:8182/non-existent";
- String address2 = "http://localhost:8182/non-existent2";
+ String address = "http://localhost:" + NON_PORT + "/non-existent";
+ String address2 = "http://localhost:" + NON_PORT + "/non-existent2";
FailoverFeature feature = new FailoverFeature();
List<String> alternateAddresses = new ArrayList<String>();
Modified:
cxf/branches/2.5.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/ProviderXMLClientServerTest.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/ProviderXMLClientServerTest.java?rev=1244151&r1=1244150&r2=1244151&view=diff
==============================================================================
---
cxf/branches/2.5.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/ProviderXMLClientServerTest.java
(original)
+++
cxf/branches/2.5.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/ProviderXMLClientServerTest.java
Tue Feb 14 18:33:35 2012
@@ -97,6 +97,7 @@ public class ProviderXMLClientServerTest
DOMSource.class, Service.Mode.PAYLOAD);
try {
+ setAddress(disp, ADDRESS);
result = disp.invoke(reqMsg);
fail("should have a schema validation exception of some sort");
} catch (Exception ex) {
Modified:
cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/corba/CorbaTest.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/corba/CorbaTest.java?rev=1244151&r1=1244150&r2=1244151&view=diff
==============================================================================
---
cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/corba/CorbaTest.java
(original)
+++
cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/corba/CorbaTest.java
Tue Feb 14 18:33:35 2012
@@ -38,7 +38,8 @@ import org.junit.Test;
*/
public class CorbaTest extends AbstractBusClientServerTestBase {
-
+ public static final String PORT = Server.PERSIST_PORT;
+
private static final QName SERVICE_NAME =
new QName("http://cxf.apache.org/hello_world_corba",
"GreeterCORBAService");
Modified:
cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom/ClientMtomXopWithJMSTest.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom/ClientMtomXopWithJMSTest.java?rev=1244151&r1=1244150&r2=1244151&view=diff
==============================================================================
---
cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom/ClientMtomXopWithJMSTest.java
(original)
+++
cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom/ClientMtomXopWithJMSTest.java
Tue Feb 14 18:33:35 2012
@@ -53,7 +53,8 @@ import org.junit.BeforeClass;
import org.junit.Test;
public class ClientMtomXopWithJMSTest extends AbstractBusClientServerTestBase {
-
+ public static final String JMS_PORT = EmbeddedJMSBrokerLauncher.PORT;
+
public static final QName MTOM_PORT = new
QName("http://cxf.apache.org/mime", "TestMtomJMSPort");
public static final QName MTOM_SERVICE = new
QName("http://cxf.apache.org/mime", "TestMtomJMSService");
@@ -71,7 +72,7 @@ public class ClientMtomXopWithJMSTest ex
assertTrue("server did not launch correctly",
launchServer(EmbeddedJMSBrokerLauncher.class, props, null));
TestUtilities.setKeepAliveSystemProperty(false);
- assertTrue("server did not launch correctly",
launchServer(ServerWithJMS.class, true));
+ assertTrue("server did not launch correctly",
launchServer(ServerWithJMS.class));
}
@AfterClass
Modified:
cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom/ServerWithJMS.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom/ServerWithJMS.java?rev=1244151&r1=1244150&r2=1244151&view=diff
==============================================================================
---
cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom/ServerWithJMS.java
(original)
+++
cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom/ServerWithJMS.java
Tue Feb 14 18:33:35 2012
@@ -21,11 +21,14 @@ package org.apache.cxf.systest.mtom;
import javax.xml.ws.soap.SOAPBinding;
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
import org.apache.cxf.endpoint.Endpoint;
import org.apache.cxf.interceptor.LoggingInInterceptor;
import org.apache.cxf.interceptor.LoggingOutInterceptor;
import org.apache.cxf.jaxws.EndpointImpl;
import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+import org.apache.cxf.testutil.common.EmbeddedJMSBrokerLauncher;
public class ServerWithJMS extends AbstractBusTestServerBase {
@@ -33,6 +36,9 @@ public class ServerWithJMS extends Abstr
Object implementor = new TestMtomJMSImpl();
String address = "http://not.required.for.jms";
try {
+ Bus bus = BusFactory.getDefaultBus();
+ EmbeddedJMSBrokerLauncher.updateWsdlExtensors(bus,
"testutils/mtom_xop.wsdl");
+
EndpointImpl jaxep = (EndpointImpl)
javax.xml.ws.Endpoint.publish(address, implementor);
Endpoint ep = jaxep.getServer().getEndpoint();
ep.getInInterceptors().add(new TestMultipartMessageInterceptor());
@@ -43,7 +49,7 @@ public class ServerWithJMS extends Abstr
jaxWsSoapBinding.setMTOMEnabled(true);
} catch (Exception e) {
- Thread.currentThread().interrupt();
+ throw new RuntimeException(e);
}
}
Modified:
cxf/branches/2.5.x-fixes/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractClientServerTestBase.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractClientServerTestBase.java?rev=1244151&r1=1244150&r2=1244151&view=diff
==============================================================================
---
cxf/branches/2.5.x-fixes/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractClientServerTestBase.java
(original)
+++
cxf/branches/2.5.x-fixes/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractClientServerTestBase.java
Tue Feb 14 18:33:35 2012
@@ -69,7 +69,7 @@ public abstract class AbstractClientServ
ServerLauncher sl = new ServerLauncher(clz.getName());
ok = sl.launchServer();
assertTrue("server failed to launch", ok);
- launchers.add(sl);
+ launchers.add(0, sl);
} catch (IOException ex) {
ex.printStackTrace();
fail("failed to launch server " + clz);
@@ -83,7 +83,7 @@ public abstract class AbstractClientServ
ServerLauncher sl = new ServerLauncher(clz.getName(), inProcess);
ok = sl.launchServer();
assertTrue("server failed to launch", ok);
- launchers.add(sl);
+ launchers.add(0, sl);
} catch (IOException ex) {
ex.printStackTrace();
fail("failed to launch server " + clz);
@@ -101,7 +101,7 @@ public abstract class AbstractClientServ
ServerLauncher sl = new ServerLauncher(clz.getName(), props, args,
inProcess);
ok = sl.launchServer();
assertTrue("server failed to launch", ok);
- launchers.add(sl);
+ launchers.add(0, sl);
} catch (IOException ex) {
ex.printStackTrace();
fail("failed to launch server " + clz);
Modified:
cxf/branches/2.5.x-fixes/testutils/src/main/java/org/apache/cxf/testutil/common/ServerLauncher.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/testutils/src/main/java/org/apache/cxf/testutil/common/ServerLauncher.java?rev=1244151&r1=1244150&r2=1244151&view=diff
==============================================================================
---
cxf/branches/2.5.x-fixes/testutils/src/main/java/org/apache/cxf/testutil/common/ServerLauncher.java
(original)
+++
cxf/branches/2.5.x-fixes/testutils/src/main/java/org/apache/cxf/testutil/common/ServerLauncher.java
Tue Feb 14 18:33:35 2012
@@ -167,7 +167,11 @@ public class ServerLauncher {
if (null != properties) {
for (Map.Entry<String, String> entry :
properties.entrySet()) {
old.put(entry.getKey(),
System.getProperty(entry.getKey()));
- System.setProperty(entry.getKey(), entry.getValue());
+ if (entry.getValue() == null) {
+ System.clearProperty(entry.getKey());
+ } else {
+ System.setProperty(entry.getKey(),
entry.getValue());
+ }
}
}
Modified:
cxf/branches/2.5.x-fixes/testutils/src/main/java/org/apache/cxf/testutil/common/TestUtil.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/testutils/src/main/java/org/apache/cxf/testutil/common/TestUtil.java?rev=1244151&r1=1244150&r2=1244151&view=diff
==============================================================================
---
cxf/branches/2.5.x-fixes/testutils/src/main/java/org/apache/cxf/testutil/common/TestUtil.java
(original)
+++
cxf/branches/2.5.x-fixes/testutils/src/main/java/org/apache/cxf/testutil/common/TestUtil.java
Tue Feb 14 18:33:35 2012
@@ -31,9 +31,22 @@ import java.util.Properties;
public final class TestUtil {
private static boolean useRandomPorts =
Boolean.getBoolean("useRandomPorts");
- private static int portNum = 9000;
+ private static int portNum = -1;
private static Properties ports = new Properties();
+ static {
+ int pn = 9000;
+ while (portNum == -1) {
+ try {
+ ServerSocket sock = new ServerSocket(pn);
+ sock.close();
+ portNum = pn;
+ } catch (IOException ex) {
+ pn += 100;
+ }
+ }
+ }
+
private TestUtil() {
//Complete
}