cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1371778 - in /cxf/trunk: systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/ systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/swa/ testutils/src/main/java/org/apache/cxf/testutil/common/
Date Fri, 10 Aug 2012 17:29:37 GMT
Author: dkulp
Date: Fri Aug 10 17:29:37 2012
New Revision: 1371778

URL: http://svn.apache.org/viewvc?rev=1371778&view=rev
Log:
Add support to the embedded broker an such to pass extra params to the broker url to work
around AMQ-3879 to try and make the tests more reliable.

Modified:
    cxf/trunk/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java
    cxf/trunk/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/Server.java
    cxf/trunk/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/swa/ClientServerSwaTest.java
    cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/EmbeddedJMSBrokerLauncher.java

Modified: cxf/trunk/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java?rev=1371778&r1=1371777&r2=1371778&view=diff
==============================================================================
--- cxf/trunk/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java
(original)
+++ cxf/trunk/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java
Fri Aug 10 17:29:37 2012
@@ -110,7 +110,7 @@ public class JMSClientServerTest extends
     
     @BeforeClass
     public static void startServers() throws Exception {
-        broker = new EmbeddedJMSBrokerLauncher("vm://JMSClientServerTest");
+        broker = new EmbeddedJMSBrokerLauncher("vm://JMSClientServerTest?jms.watchTopicAdvisories=false");
         launchServer(broker);
         launchServer(new Server(broker));
         createStaticBus();
@@ -1203,7 +1203,7 @@ public class JMSClientServerTest extends
             + "?jndiInitialContextFactory"
             + "=org.apache.activemq.jndi.ActiveMQInitialContextFactory"
             + "&jndiConnectionFactoryName=ConnectionFactory&jndiURL=" 
-            + broker.getBrokerURL();
+            + broker.getEncodedBrokerURL();
         if (messageType != null) {
             address = address + "&messageType=" + messageType;
         }

Modified: cxf/trunk/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/Server.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/Server.java?rev=1371778&r1=1371777&r2=1371778&view=diff
==============================================================================
--- cxf/trunk/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/Server.java
(original)
+++ cxf/trunk/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/Server.java
Fri Aug 10 17:29:37 2012
@@ -90,7 +90,7 @@ public class Server extends AbstractBusT
                          + "?jndiInitialContextFactory"
                          + "=org.apache.activemq.jndi.ActiveMQInitialContextFactory"
                          + "&jndiConnectionFactoryName=ConnectionFactory&jndiURL="
-                         + broker.getBrokerURL();
+                         + broker.getEncodedBrokerURL();
         Endpoint.publish(address1, spec1);
         
         Object spec2 = new GreeterSpecWithPortError();
@@ -98,7 +98,7 @@ public class Server extends AbstractBusT
             + "?jndiInitialContextFactory"
             + "=org.apache.activemq.jndi.ActiveMQInitialContextFactory"
             + "&jndiConnectionFactoryName=ConnectionFactory&jndiURL="
-            + broker.getBrokerURL();
+            + broker.getEncodedBrokerURL();
         Endpoint.publish(address2, spec2);
         
         initNoWsdlServer();
@@ -113,7 +113,7 @@ public class Server extends AbstractBusT
             + "?jndiInitialContextFactory"
             + "=org.apache.activemq.jndi.ActiveMQInitialContextFactory"
             + "&jndiConnectionFactoryName=ConnectionFactory&jndiURL="
-            +  broker.getBrokerURL();
+            +  broker.getEncodedBrokerURL();
         Hello implementor = new HelloImpl();
         JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
         svrFactory.setServiceClass(Hello.class);

Modified: cxf/trunk/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/swa/ClientServerSwaTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/swa/ClientServerSwaTest.java?rev=1371778&r1=1371777&r2=1371778&view=diff
==============================================================================
--- cxf/trunk/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/swa/ClientServerSwaTest.java
(original)
+++ cxf/trunk/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/swa/ClientServerSwaTest.java
Fri Aug 10 17:29:37 2012
@@ -55,7 +55,7 @@ public class ClientServerSwaTest extends
                 factory.setTransportId("http://cxf.apache.org/transports/jms");
                 factory.setServiceName(new QName("http://cxf.apache.org/swa", "SwAService"));
                 factory.setEndpointName(new QName("http://cxf.apache.org/swa", "SwAServiceHttpPort"));
-                factory.setAddress(ADDRESS + broker.getBrokerURL());
+                factory.setAddress(ADDRESS + broker.getEncodedBrokerURL());
                 factory.setServiceBean(new SwAServiceImpl());
                 factory.create().start();
             } catch (Exception e) {
@@ -67,7 +67,7 @@ public class ClientServerSwaTest extends
 
     @BeforeClass
     public static void startServers() throws Exception {
-        broker = new EmbeddedJMSBrokerLauncher("vm://ClientServerSwaTest");
+        broker = new EmbeddedJMSBrokerLauncher("vm://ClientServerSwaTest?jms.watchTopicAdvisories=false");
         System.setProperty("EmbeddedBrokerURL", broker.getBrokerURL());
         launchServer(broker);
         launchServer(new Server());
@@ -84,7 +84,7 @@ public class ClientServerSwaTest extends
         factory.setTransportId("http://cxf.apache.org/transports/jms");
         factory.setServiceName(new QName("http://cxf.apache.org/swa", "SwAService"));
         factory.setEndpointName(new QName("http://cxf.apache.org/swa", "SwAServiceHttpPort"));
-        factory.setAddress(ADDRESS + broker.getBrokerURL());
+        factory.setAddress(ADDRESS + broker.getEncodedBrokerURL());
         factory.getOutInterceptors().add(new LoggingOutInterceptor());
         SwAService port = factory.create(SwAService.class);
         

Modified: cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/EmbeddedJMSBrokerLauncher.java
URL: http://svn.apache.org/viewvc/cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/EmbeddedJMSBrokerLauncher.java?rev=1371778&r1=1371777&r2=1371778&view=diff
==============================================================================
--- cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/EmbeddedJMSBrokerLauncher.java
(original)
+++ cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/EmbeddedJMSBrokerLauncher.java
Fri Aug 10 17:29:37 2012
@@ -54,18 +54,36 @@ public class EmbeddedJMSBrokerLauncher e
     public String getBrokerURL() {
         return brokerUrl1;
     }
+    public String getEncodedBrokerURL() {
+        StringBuilder b = new StringBuilder(brokerUrl1.length());
+        for (int x = 0; x < brokerUrl1.length(); x++) {
+            char c = brokerUrl1.charAt(x);
+            switch (c) {
+            case '?':
+                b.append("%3F");
+                break;
+            default:
+                b.append(c);
+            }               
+        }
+        return b.toString();
+    }
     public void updateWsdl(Bus b, String wsdlLocation) { 
-        updateWsdlExtensors(b, wsdlLocation, brokerUrl1);
+        updateWsdlExtensors(b, wsdlLocation, brokerUrl1, getEncodedBrokerURL());
     }
     
     public static void updateWsdlExtensors(Bus bus, 
                                            String wsdlLocation) {
-        updateWsdlExtensors(bus, wsdlLocation, "tcp://localhost:" + PORT);
+        updateWsdlExtensors(bus, wsdlLocation, "tcp://localhost:" + PORT, null);
     }
     public static void updateWsdlExtensors(Bus bus, 
                                            String wsdlLocation,
-                                           String url) {
+                                           String url,
+                                           String encodedUrl) {
         try {
+            if (encodedUrl == null) {
+                encodedUrl = url;
+            }
             if (bus == null) {
                 bus = BusFactory.getThreadDefaultBus();
             }
@@ -85,7 +103,7 @@ public class EmbeddedJMSBrokerLauncher e
                             if (idx != -1) {
                                 int idx2 = add.indexOf("&", idx);
                                 add = add.substring(0, idx)
-                                    + "jndiURL=" + url
+                                    + "jndiURL=" + encodedUrl
                                     + (idx2 == -1 ? "" : add.substring(idx2));
                                 ((SOAPAddress)e).setLocationURI(add);
                             }



Mime
View raw message