Try to fix the CI test error of CxfRsRelayTest

Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/678eb77f
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/678eb77f
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/678eb77f

Branch: refs/heads/camel-2.12.x
Commit: 678eb77fff5ecacf678b8249edcc18b717ed29af
Parents: 61b1714
Author: Willem Jiang <willem.ji...@gmail.com>
Authored: Wed Aug 27 15:40:22 2014 +0800
Committer: Willem Jiang <willem.ji...@gmail.com>
Committed: Wed Aug 27 15:43:50 2014 +0800

----------------------------------------------------------------------
 .../component/cxf/jaxrs/CxfRsRelayTest.java     | 36 +++++++++++---------
 .../component/cxf/jaxrs/CxfRsSpringRelay.xml    |  9 +++--
 2 files changed, 25 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/678eb77f/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsRelayTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsRelayTest.java
 
b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsRelayTest.java
index 1e05ff4..3033a81 100644
--- 
a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsRelayTest.java
+++ 
b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsRelayTest.java
@@ -33,6 +33,7 @@ import javax.ws.rs.Produces;
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.cxf.CXFTestSupport;
 import org.apache.camel.spring.Main;
 import org.apache.camel.test.junit4.TestSupport;
 import org.apache.cxf.helpers.IOUtils;
@@ -41,6 +42,7 @@ import org.apache.cxf.jaxrs.ext.multipart.Multipart;
 import org.junit.Test;
 
 public class CxfRsRelayTest extends TestSupport {
+    private static int port6 = CXFTestSupport.getPort6(); 
     /**
      * A sample service "interface" (technically, it is a class since we will
      * use proxy-client. That interface exposes three methods over-loading each
@@ -94,6 +96,22 @@ public class CxfRsRelayTest extends TestSupport {
         try {
             
main.setApplicationContextUri("org/apache/camel/component/cxf/jaxrs/CxfRsSpringRelay.xml");
             main.start();
+            Thread t = new Thread(new Runnable() {
+                /**
+                 * Sends a request to the first endpoint in the route
+                 */
+                public void run() {
+                    try {
+                        JAXRSClientFactory.create("http://localhost:"; + port6 
+ "/CxfRsRelayTest/rest", UploadService.class)
+                            
.upload(CamelRouteBuilder.class.getResourceAsStream(SAMPLE_CONTENT_PATH),
+                                    SAMPLE_NAME);
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                        throw new RuntimeException(e);
+                    }
+                }
+            });
+            t.start();
             LATCH.await(10, TimeUnit.SECONDS);
             assertEquals(SAMPLE_NAME, name);
             StringWriter writer = new StringWriter();
@@ -124,23 +142,7 @@ public class CxfRsRelayTest extends TestSupport {
                     LATCH.countDown();
                 }
             });
-            Thread t = new Thread(new Runnable() {
-                /**
-                 * Sends a request to the first endpoint in the route
-                 */
-                public void run() {
-                    try {
-                        
JAXRSClientFactory.create(getContext().getEndpoint("upload1", 
CxfRsEndpoint.class)
-                                                      .getAddress(), 
UploadService.class)
-                            
.upload(CamelRouteBuilder.class.getResourceAsStream(SAMPLE_CONTENT_PATH),
-                                    SAMPLE_NAME);
-                    } catch (Exception e) {
-                        e.printStackTrace();
-                        throw new RuntimeException(e);
-                    }
-                }
-            });
-            t.start();
+            
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/678eb77f/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRelay.xml
----------------------------------------------------------------------
diff --git 
a/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRelay.xml
 
b/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRelay.xml
index a7d5adc..97b5ede 100644
--- 
a/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRelay.xml
+++ 
b/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRelay.xml
@@ -21,6 +21,9 @@
        xsi:schemaLocation="http://camel.apache.org/schema/cxf 
http://camel.apache.org/schema/cxf/camel-cxf.xsd
                         http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans.xsd
                         http://camel.apache.org/schema/spring 
http://camel.apache.org/schema/spring/camel-spring.xsd";>
+       
+       <bean 
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
+       
        <bean id="builder"
                
class="org.apache.camel.component.cxf.jaxrs.CxfRsRelayTest.CamelRouteBuilder" />
        <camel:camelContext id="cxfrs_context">
@@ -32,13 +35,13 @@
                <camel:endpoint id="upload2Client"
                        uri="cxfrs:bean:rsClient2?httpClientAPI=false" />
        </camel:camelContext>
-       <cxf:rsServer id="rsServer1" address="http://localhost:9002/rest";
+       <cxf:rsServer id="rsServer1" 
address="http://localhost:${CXFTestSupport.port6}/CxfRsRelayTest/rest";
                
serviceClass="org.apache.camel.component.cxf.jaxrs.CxfRsRelayTest.UploadService"
                loggingFeatureEnabled="true" loggingSizeLimit="5000" />
-       <cxf:rsServer id="rsServer2" address="http://localhost:9002/rast";
+       <cxf:rsServer id="rsServer2" 
address="http://localhost:${CXFTestSupport.port6}/CxfRsRelayTest/rast";
                
serviceClass="org.apache.camel.component.cxf.jaxrs.CxfRsRelayTest.UploadService"
                loggingFeatureEnabled="true" loggingSizeLimit="5000" />
-       <cxf:rsClient id="rsClient2" address="http://localhost:9002/rast";
+       <cxf:rsClient id="rsClient2" 
address="http://localhost:${CXFTestSupport.port6}/CxfRsRelayTest/rast";
                
serviceClass="org.apache.camel.component.cxf.jaxrs.CxfRsRelayTest.UploadService"
                loggingFeatureEnabled="true" loggingSizeLimit="5000" />
 </beans>
\ No newline at end of file

Reply via email to