You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2012/11/11 14:11:44 UTC

svn commit: r1407970 - in /camel/trunk/components/camel-cxf/src/test: java/org/apache/camel/component/cxf/jaxrs/CxfRsProducerClientFactoryCacheTest.java resources/org/apache/camel/component/cxf/jaxrs/CxfRsProducerClientFactoryCacheTest2.xml

Author: davsclaus
Date: Sun Nov 11 13:11:43 2012
New Revision: 1407970

URL: http://svn.apache.org/viewvc?rev=1407970&view=rev
Log:
Use dynamic port in test

Modified:
    camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducerClientFactoryCacheTest.java
    camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsProducerClientFactoryCacheTest2.xml

Modified: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducerClientFactoryCacheTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducerClientFactoryCacheTest.java?rev=1407970&r1=1407969&r2=1407970&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducerClientFactoryCacheTest.java (original)
+++ camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducerClientFactoryCacheTest.java Sun Nov 11 13:11:43 2012
@@ -38,7 +38,8 @@ import org.springframework.context.suppo
  */
 public class CxfRsProducerClientFactoryCacheTest extends Assert {
     private static int port1 = CXFTestSupport.getPort1(); 
-    
+    private static int port2 = CXFTestSupport.getPort2();
+
     private CamelContext context1;
     private CamelContext context2;
     private ProducerTemplate template1;
@@ -62,11 +63,15 @@ public class CxfRsProducerClientFactoryC
     
     @After
     public void tearDown() throws Exception {
-        context1.stop();
-        template1.stop();
-
-        context2.stop();
-        template2.stop();
+        if (context1 != null) {
+            context1.stop();
+            template1.stop();
+        }
+
+        if (context2 != null) {
+            context2.stop();
+            template2.stop();
+        }
     }
     
     @Test
@@ -84,6 +89,7 @@ public class CxfRsProducerClientFactoryC
                 inMessage.setHeader(Exchange.HTTP_METHOD, "GET");
                 inMessage.setHeader(Exchange.HTTP_PATH, "/customerservice/customers/123");                
                 inMessage.setHeader(CxfConstants.CAMEL_CXF_RS_RESPONSE_CLASS, Customer.class);
+                inMessage.setHeader("port", getPort2());
                 inMessage.setBody(null);                
             }
         });
@@ -100,4 +106,8 @@ public class CxfRsProducerClientFactoryC
     public int getPort1() {
         return port1;
     }
+
+    public int getPort2() {
+        return port2;
+    }
 }

Modified: camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsProducerClientFactoryCacheTest2.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsProducerClientFactoryCacheTest2.xml?rev=1407970&r1=1407969&r2=1407970&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsProducerClientFactoryCacheTest2.xml (original)
+++ camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsProducerClientFactoryCacheTest2.xml Sun Nov 11 13:11:43 2012
@@ -28,7 +28,7 @@
 	http://cxf.apache.org/schemas/configuration/http-conf.xsd ">
 	<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
 
-	<jaxrs:server id="restService" address="https://localhost:8181/CxfRsProducerTest/"
+	<jaxrs:server id="restService" address="https://localhost:${CXFTestSupport.port2}/CxfRsProducerTest/"
 		staticSubresourceResolution="true">
 		<jaxrs:serviceBeans>
 			<ref bean="customerService"/>
@@ -40,13 +40,14 @@
 	<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
 		<route>
 			<from uri="direct://http"/>
-			<to uri="cxfrs://https://localhost:8181/CxfRsProducerTest/"/>
-			
+			<recipientList>
+				<simple>cxfrs://https://localhost:${header.port}/CxfRsProducerTest/</simple>
+			</recipientList>
 		</route>
 	</camelContext>
 
 	<httpj:engine-factory id="tls-config">
-		<httpj:engine port="8181">
+		<httpj:engine port="${CXFTestSupport.port2}">
 			<httpj:tlsServerParameters>
 				<sec:keyManagers keyPassword="password">
 					<sec:keyStore type="JKS" password="password"  file="src/test/resources/org/apache/camel/component/cxf/jaxrs/Bethal.jks"/>