This is an automated email from the ASF dual-hosted git repository.

ffang pushed a commit to branch more-rest-test-new
in repository https://gitbox.apache.org/repos/asf/camel-spring-boot.git

commit 01360d8be9c63717521e3b90b5910e54d11ad0d6
Author: Freeman Fang <freeman.f...@gmail.com>
AuthorDate: Tue Dec 20 16:10:36 2022 -0500

    some clean up
    
    (cherry picked from commit eb628065848af5eca1120d0c0500f5ae2b1b45b1)
---
 components-starter/camel-cxf-rest-starter/pom.xml  |  11 +-
 .../cxf/jaxrs/testbean/CustomException.java        |  27 ----
 .../component/cxf/jaxrs/testbean/Customer.java     |  75 ----------
 .../cxf/jaxrs/testbean/CustomerService.java        | 153 ---------------------
 .../testbean/CustomerServiceNoAnnotations.java     |  25 ----
 .../jaxrs/testbean/CustomerServiceResource.java    |  51 -------
 .../component/cxf/jaxrs/testbean/EchoService.java  |  41 ------
 .../camel/component/cxf/jaxrs/testbean/Order.java  |  67 ---------
 .../component/cxf/jaxrs/testbean/Product.java      |  41 ------
 .../component/cxf/jaxrs/testbean/ServiceUtil.java  |  24 ----
 .../rest/springboot/CxfRsConsumerWithBeanTest.java |  24 ++--
 .../rest/springboot/CxfRsProducerSessionTest.java  |   5 +-
 .../cxf/rest/springboot/CxfRsStreamCacheTest.java  |   7 +-
 .../routes/CxfRsSpringProducerSession.xml          |   4 +-
 14 files changed, 31 insertions(+), 524 deletions(-)

diff --git a/components-starter/camel-cxf-rest-starter/pom.xml 
b/components-starter/camel-cxf-rest-starter/pom.xml
index a8f6000d351..84d470494c8 100644
--- a/components-starter/camel-cxf-rest-starter/pom.xml
+++ b/components-starter/camel-cxf-rest-starter/pom.xml
@@ -40,16 +40,17 @@
       <version>${camel-version}</version>
     </dependency>
     <dependency>
-      <groupId>org.apache.cxf</groupId>
-      <artifactId>cxf-rt-transports-http-undertow</artifactId>
-      <version>${cxf-version}</version>
-      <scope>test</scope>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-cxf-common</artifactId>
+      <version>${camel-version}</version>
+      <type>test-jar</type>
     </dependency>
     <dependency>
       <groupId>org.apache.camel</groupId>
-      <artifactId>camel-cxf-common</artifactId>
+      <artifactId>camel-cxf-spring-rest</artifactId>
       <version>${camel-version}</version>
       <type>test-jar</type>
+      <scope>test</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.camel</groupId>
diff --git 
a/components-starter/camel-cxf-rest-starter/src/test/java/org/apache/camel/component/cxf/jaxrs/testbean/CustomException.java
 
b/components-starter/camel-cxf-rest-starter/src/test/java/org/apache/camel/component/cxf/jaxrs/testbean/CustomException.java
deleted file mode 100644
index 1b34d8d6bf5..00000000000
--- 
a/components-starter/camel-cxf-rest-starter/src/test/java/org/apache/camel/component/cxf/jaxrs/testbean/CustomException.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * 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.
- */
-package org.apache.camel.component.cxf.jaxrs.testbean;
-
-public class CustomException extends Exception {
-
-    private static final long serialVersionUID = 1L;
-
-    public CustomException(String message) {
-        super(message);
-    }
-
-}
diff --git 
a/components-starter/camel-cxf-rest-starter/src/test/java/org/apache/camel/component/cxf/jaxrs/testbean/Customer.java
 
b/components-starter/camel-cxf-rest-starter/src/test/java/org/apache/camel/component/cxf/jaxrs/testbean/Customer.java
deleted file mode 100644
index e0b740c8761..00000000000
--- 
a/components-starter/camel-cxf-rest-starter/src/test/java/org/apache/camel/component/cxf/jaxrs/testbean/Customer.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * 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.
- */
-package org.apache.camel.component.cxf.jaxrs.testbean;
-
-import javax.xml.bind.annotation.XmlRootElement;
-
-import org.apache.camel.util.ObjectHelper;
-
-@XmlRootElement(name = "Customer")
-public class Customer {
-    private long id;
-    private String name;
-
-    public Customer() {
-    }
-
-    public Customer(long id, String name) {
-        setId(id);
-        setName(name);
-    }
-
-    public long getId() {
-        return id;
-    }
-
-    public void setId(long id) {
-        this.id = id;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + (int) (id ^ (id >>> 32));
-        result = prime * result + ((name == null) ? 0 : name.hashCode());
-        return result;
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (!(obj instanceof Customer)) {
-            return false;
-        }
-
-        if (this == obj) {
-            return true;
-        }
-
-        Customer other = (Customer) obj;
-        return id == other.id && ObjectHelper.equal(name, other.name);
-    }
-
-}
diff --git 
a/components-starter/camel-cxf-rest-starter/src/test/java/org/apache/camel/component/cxf/jaxrs/testbean/CustomerService.java
 
b/components-starter/camel-cxf-rest-starter/src/test/java/org/apache/camel/component/cxf/jaxrs/testbean/CustomerService.java
deleted file mode 100644
index c30fd82dd79..00000000000
--- 
a/components-starter/camel-cxf-rest-starter/src/test/java/org/apache/camel/component/cxf/jaxrs/testbean/CustomerService.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * 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.
- */
-package org.apache.camel.component.cxf.jaxrs.testbean;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.atomic.AtomicLong;
-
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.Response;
-
-import org.apache.cxf.common.util.StringUtils;
-
-@Path("/customerservice/")
-public class CustomerService {
-    private final AtomicLong currentId = new AtomicLong(123L);
-    private final Map<Long, Customer> customers = new ConcurrentHashMap<>();
-    private final Map<Long, Order> orders = new ConcurrentHashMap<>();
-
-    public CustomerService() {
-        init();
-    }
-
-    @GET
-    @Path("/customers/{id}/")
-    public Customer getCustomer(@PathParam("id") String id) {
-        long idNumber = Long.parseLong(id);
-        Customer c = customers.get(idNumber);
-        return c;
-    }
-
-    @GET
-    @Path("/customers")
-    public Customer getCustomerByQueryParam(@QueryParam("id") String id) {
-        long idNumber = Long.parseLong(id);
-        Customer c = customers.get(idNumber);
-        return c;
-    }
-
-    @GET
-    @Path("/customers/")
-    @Produces("application/xml")
-    public List<Customer> getCustomers() {
-        List<Customer> list = new ArrayList<>(customers.values());
-        return list;
-    }
-
-    @PUT
-    @Path("/customers/")
-    public Response updateCustomer(Customer customer) {
-        Customer c = customers.get(customer.getId());
-        Response r;
-        if (c != null) {
-            customers.put(customer.getId(), customer);
-            r = Response.ok().build();
-        } else {
-            r = Response.status(406).entity("Cannot find the 
customer!").build();
-        }
-
-        return r;
-    }
-
-    @POST
-    @Path("/customers/")
-    public Response addCustomer(Customer customer) {
-        if (StringUtils.isEmpty(customer.getName())) {
-            return Response.status(422).build();
-        }
-
-        customer.setId(currentId.incrementAndGet());
-
-        customers.put(customer.getId(), customer);
-
-        return Response.ok(customer).build();
-    }
-
-    @POST
-    @Path("/customersUniqueResponseCode/")
-    public Response addCustomerUniqueResponseCode(Customer customer) {
-        customer.setId(currentId.incrementAndGet());
-
-        customers.put(customer.getId(), customer);
-
-        return Response.status(201).entity(customer).build();
-    }
-
-    @DELETE
-    @Path("/customers/{id}/")
-    public Response deleteCustomer(@PathParam("id") String id) {
-        long idNumber = Long.parseLong(id);
-        Customer c = customers.get(idNumber);
-
-        Response r;
-        if (c != null) {
-            r = Response.ok().build();
-            customers.remove(idNumber);
-        } else {
-            r = Response.notModified().build();
-        }
-        if (idNumber == currentId.get()) {
-            currentId.decrementAndGet();
-        }
-        return r;
-    }
-
-    @Path("/orders/{orderId}/")
-    public Order getOrder(@PathParam("orderId") String orderId) {
-        long idNumber = Long.parseLong(orderId);
-        Order c = orders.get(idNumber);
-        return c;
-    }
-
-    final void init() {
-        Customer c = new Customer();
-        c.setName("John");
-        c.setId(123);
-        customers.put(c.getId(), c);
-
-        c = new Customer();
-        c.setName("Dan");
-        c.setId(113);
-        customers.put(c.getId(), c);
-
-        Order o = new Order();
-        o.setDescription("order 223");
-        o.setId(223);
-        orders.put(o.getId(), o);
-    }
-
-}
diff --git 
a/components-starter/camel-cxf-rest-starter/src/test/java/org/apache/camel/component/cxf/jaxrs/testbean/CustomerServiceNoAnnotations.java
 
b/components-starter/camel-cxf-rest-starter/src/test/java/org/apache/camel/component/cxf/jaxrs/testbean/CustomerServiceNoAnnotations.java
deleted file mode 100644
index fa9a395cb96..00000000000
--- 
a/components-starter/camel-cxf-rest-starter/src/test/java/org/apache/camel/component/cxf/jaxrs/testbean/CustomerServiceNoAnnotations.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * 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.
- */
-package org.apache.camel.component.cxf.jaxrs.testbean;
-
-// START SNIPPET: example
-public interface CustomerServiceNoAnnotations {
-
-    Customer getCustomer(String id);
-
-}
-// END SNIPPET: example
diff --git 
a/components-starter/camel-cxf-rest-starter/src/test/java/org/apache/camel/component/cxf/jaxrs/testbean/CustomerServiceResource.java
 
b/components-starter/camel-cxf-rest-starter/src/test/java/org/apache/camel/component/cxf/jaxrs/testbean/CustomerServiceResource.java
deleted file mode 100644
index e36313746a1..00000000000
--- 
a/components-starter/camel-cxf-rest-starter/src/test/java/org/apache/camel/component/cxf/jaxrs/testbean/CustomerServiceResource.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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.
- */
-package org.apache.camel.component.cxf.jaxrs.testbean;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.Response;
-
-// START SNIPPET: example
-@Path("/customerservice/")
-public interface CustomerServiceResource {
-
-    @GET
-    @Path("/customers/{id}/")
-    Customer getCustomer(@PathParam("id") String id);
-
-    @PUT
-    @Path("/customers/")
-    Response updateCustomer(Customer customer);
-
-    @Path("/{id}")
-    @PUT()
-    @Consumes({
-            "application/xml", "text/plain",
-            "application/json" })
-    @Produces({
-            "application/xml", "text/plain",
-            "application/json" })
-    Object invoke(
-            @PathParam("id") String id,
-            String payload);
-}
-// END SNIPPET: example
diff --git 
a/components-starter/camel-cxf-rest-starter/src/test/java/org/apache/camel/component/cxf/jaxrs/testbean/EchoService.java
 
b/components-starter/camel-cxf-rest-starter/src/test/java/org/apache/camel/component/cxf/jaxrs/testbean/EchoService.java
deleted file mode 100644
index abba335cd10..00000000000
--- 
a/components-starter/camel-cxf-rest-starter/src/test/java/org/apache/camel/component/cxf/jaxrs/testbean/EchoService.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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.
- */
-package org.apache.camel.component.cxf.jaxrs.testbean;
-
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.Cookie;
-import javax.ws.rs.core.HttpHeaders;
-import javax.ws.rs.core.NewCookie;
-import javax.ws.rs.core.Response;
-
-@Path("/echoservice/")
-public class EchoService {
-    @Context
-    private HttpHeaders headers;
-
-    @POST
-    @Path("/echo/")
-    public Response echo(String string) {
-        Cookie fooCookie = headers.getCookies().get("foo");
-        if (fooCookie != null && "bar".equals(fooCookie.getValue())) {
-            return Response.ok("Old " + string).build();
-        }
-        return Response.ok("New " + string).cookie(new NewCookie("foo", "bar", 
"/", null, 1, null, -1, false)).build();
-    }
-}
diff --git 
a/components-starter/camel-cxf-rest-starter/src/test/java/org/apache/camel/component/cxf/jaxrs/testbean/Order.java
 
b/components-starter/camel-cxf-rest-starter/src/test/java/org/apache/camel/component/cxf/jaxrs/testbean/Order.java
deleted file mode 100644
index 0ac90a8e5bc..00000000000
--- 
a/components-starter/camel-cxf-rest-starter/src/test/java/org/apache/camel/component/cxf/jaxrs/testbean/Order.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * 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.
- */
-package org.apache.camel.component.cxf.jaxrs.testbean;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.xml.bind.annotation.XmlRootElement;
-
-@XmlRootElement(name = "Order")
-public class Order {
-    private long id;
-    private String description;
-    private Map<Long, Product> products = new HashMap<>();
-
-    public Order() {
-        init();
-    }
-
-    public long getId() {
-        return id;
-    }
-
-    public void setId(long id) {
-        this.id = id;
-    }
-
-    public String getDescription() {
-        return description;
-    }
-
-    public void setDescription(String d) {
-        this.description = d;
-    }
-
-    @GET
-    @Path("products/{productId}/")
-    public Product getProduct(@PathParam("productId") int productId) {
-        Product p = products.get(Long.valueOf(productId));
-        return p;
-    }
-
-    final void init() {
-        Product p = new Product();
-        p.setId(323);
-        p.setDescription("product 323");
-        products.put(p.getId(), p);
-    }
-
-}
diff --git 
a/components-starter/camel-cxf-rest-starter/src/test/java/org/apache/camel/component/cxf/jaxrs/testbean/Product.java
 
b/components-starter/camel-cxf-rest-starter/src/test/java/org/apache/camel/component/cxf/jaxrs/testbean/Product.java
deleted file mode 100644
index d363af1055e..00000000000
--- 
a/components-starter/camel-cxf-rest-starter/src/test/java/org/apache/camel/component/cxf/jaxrs/testbean/Product.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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.
- */
-package org.apache.camel.component.cxf.jaxrs.testbean;
-
-import javax.xml.bind.annotation.XmlRootElement;
-
-@XmlRootElement(name = "Product")
-public class Product {
-    private long id;
-    private String description;
-
-    public long getId() {
-        return id;
-    }
-
-    public void setId(long id) {
-        this.id = id;
-    }
-
-    public String getDescription() {
-        return description;
-    }
-
-    public void setDescription(String d) {
-        this.description = d;
-    }
-}
diff --git 
a/components-starter/camel-cxf-rest-starter/src/test/java/org/apache/camel/component/cxf/jaxrs/testbean/ServiceUtil.java
 
b/components-starter/camel-cxf-rest-starter/src/test/java/org/apache/camel/component/cxf/jaxrs/testbean/ServiceUtil.java
deleted file mode 100644
index 0e2a1b85f45..00000000000
--- 
a/components-starter/camel-cxf-rest-starter/src/test/java/org/apache/camel/component/cxf/jaxrs/testbean/ServiceUtil.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * 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.
- */
-package org.apache.camel.component.cxf.jaxrs.testbean;
-
-public class ServiceUtil {
-    public String invoke(String id, String payload) {
-        return id + payload;
-    }
-
-}
diff --git 
a/components-starter/camel-cxf-rest-starter/src/test/java/org/apache/camel/component/cxf/rest/springboot/CxfRsConsumerWithBeanTest.java
 
b/components-starter/camel-cxf-rest-starter/src/test/java/org/apache/camel/component/cxf/rest/springboot/CxfRsConsumerWithBeanTest.java
index 5fd7a59f3ff..0609dd292a6 100644
--- 
a/components-starter/camel-cxf-rest-starter/src/test/java/org/apache/camel/component/cxf/rest/springboot/CxfRsConsumerWithBeanTest.java
+++ 
b/components-starter/camel-cxf-rest-starter/src/test/java/org/apache/camel/component/cxf/rest/springboot/CxfRsConsumerWithBeanTest.java
@@ -18,6 +18,7 @@ package org.apache.camel.component.cxf.rest.springboot;
 
 
 import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.cxf.common.CXFTestSupport;
 import org.apache.camel.component.cxf.jaxrs.testbean.ServiceUtil;
 import org.apache.camel.spring.boot.CamelAutoConfiguration;
 
@@ -55,6 +56,7 @@ import org.apache.http.util.EntityUtils;
 )
 public class CxfRsConsumerWithBeanTest {
 
+    private int port = CXFTestSupport.getPort1();
     private static final String CXT = "/CxfRsConsumerWithBeanTest";
     private static final String CXF_RS_ENDPOINT_URI
             = "cxfrs://" + CXT
@@ -63,20 +65,12 @@ public class CxfRsConsumerWithBeanTest {
             = "cxfrs://" + CXT
               + 
"/rest2?resourceClasses=org.apache.camel.component.cxf.jaxrs.testbean.CustomerServiceResource";
 
-    @Bean("service")
-    protected ServiceUtil bindToRegistry() {
-        return new ServiceUtil();
-    }
     
-    @Bean
-    public ServletWebServerFactory servletWebServerFactory() {
-        return new UndertowServletWebServerFactory();
-    }
     
     @Test
     public void testPutConsumer() throws Exception {
-        sendPutRequest("http://localhost:8080/services"; + CXT + 
"/rest/customerservice/c20");
-        sendPutRequest("http://localhost:8080/services"; + CXT + 
"/rest2/customerservice/c20");
+        sendPutRequest("http://localhost:"; + port + "/services" + CXT + 
"/rest/customerservice/c20");
+        sendPutRequest("http://localhost:"; + port + "/services" + CXT + 
"/rest2/customerservice/c20");
     }
 
     private void sendPutRequest(String uri) throws Exception {
@@ -102,6 +96,16 @@ public class CxfRsConsumerWithBeanTest {
     @Configuration
     public class TestConfiguration {
 
+        @Bean("service")
+        public ServiceUtil bindToRegistry() {
+            return new ServiceUtil();
+        }
+        
+        @Bean
+        public ServletWebServerFactory servletWebServerFactory() {
+            return new UndertowServletWebServerFactory(port);
+        }
+        
         @Bean
         public RouteBuilder routeBuilder() {
             return new RouteBuilder() {
diff --git 
a/components-starter/camel-cxf-rest-starter/src/test/java/org/apache/camel/component/cxf/rest/springboot/CxfRsProducerSessionTest.java
 
b/components-starter/camel-cxf-rest-starter/src/test/java/org/apache/camel/component/cxf/rest/springboot/CxfRsProducerSessionTest.java
index e01db825e4b..591b310bb2c 100644
--- 
a/components-starter/camel-cxf-rest-starter/src/test/java/org/apache/camel/component/cxf/rest/springboot/CxfRsProducerSessionTest.java
+++ 
b/components-starter/camel-cxf-rest-starter/src/test/java/org/apache/camel/component/cxf/rest/springboot/CxfRsProducerSessionTest.java
@@ -22,6 +22,7 @@ import org.apache.camel.ExchangePattern;
 import org.apache.camel.Message;
 import org.apache.camel.Processor;
 import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.cxf.common.CXFTestSupport;
 import org.apache.camel.component.cxf.common.message.CxfConstants;
 import org.apache.camel.spring.boot.CamelAutoConfiguration;
 
@@ -56,9 +57,11 @@ import 
org.apache.cxf.spring.boot.autoconfigure.CxfAutoConfiguration;
 })
 public class CxfRsProducerSessionTest {
 
+    static int port = CXFTestSupport.getPort1();
+    
     @Bean
     public ServletWebServerFactory servletWebServerFactory() {
-        return new UndertowServletWebServerFactory();
+        return new UndertowServletWebServerFactory(port);
     }
     
     @Test
diff --git 
a/components-starter/camel-cxf-rest-starter/src/test/java/org/apache/camel/component/cxf/rest/springboot/CxfRsStreamCacheTest.java
 
b/components-starter/camel-cxf-rest-starter/src/test/java/org/apache/camel/component/cxf/rest/springboot/CxfRsStreamCacheTest.java
index b0d30fa5fdf..f034b220d69 100644
--- 
a/components-starter/camel-cxf-rest-starter/src/test/java/org/apache/camel/component/cxf/rest/springboot/CxfRsStreamCacheTest.java
+++ 
b/components-starter/camel-cxf-rest-starter/src/test/java/org/apache/camel/component/cxf/rest/springboot/CxfRsStreamCacheTest.java
@@ -23,6 +23,7 @@ import org.apache.camel.Exchange;
 import org.apache.camel.ExtendedExchange;
 import org.apache.camel.ProducerTemplate;
 import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.cxf.common.CXFTestSupport;
 import org.apache.camel.component.cxf.jaxrs.testbean.Customer;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.converter.stream.CachedOutputStream;
@@ -65,9 +66,11 @@ import org.apache.http.util.EntityUtils;
 )
 public class CxfRsStreamCacheTest {
 
+    private static int port = CXFTestSupport.getPort1();
+    
     private static final String PUT_REQUEST = 
"<Customer><name>Mary</name><id>123</id></Customer>";
     private static final String CONTEXT = "/CxfRsStreamCacheTest";
-    private static final String CXT = "8080/services" + CONTEXT;
+    private static final String CXT = port + "/services" + CONTEXT;
     private static final String RESPONSE = "<pong xmlns=\"test/service\"/>";
 
     private String cxfRsEndpointUri = "cxfrs://" + CONTEXT + "?synchronous=" + 
isSynchronous()
@@ -84,7 +87,7 @@ public class CxfRsStreamCacheTest {
     
     @Bean
     public ServletWebServerFactory servletWebServerFactory() {
-        return new UndertowServletWebServerFactory();
+        return new UndertowServletWebServerFactory(port);
     }
     
     
diff --git 
a/components-starter/camel-cxf-rest-starter/src/test/resources/routes/CxfRsSpringProducerSession.xml
 
b/components-starter/camel-cxf-rest-starter/src/test/resources/routes/CxfRsSpringProducerSession.xml
index db00a27e1c8..b671b6f6c21 100644
--- 
a/components-starter/camel-cxf-rest-starter/src/test/resources/routes/CxfRsSpringProducerSession.xml
+++ 
b/components-starter/camel-cxf-rest-starter/src/test/resources/routes/CxfRsSpringProducerSession.xml
@@ -41,11 +41,11 @@
   
   <bean id="echoService" 
class="org.apache.camel.component.cxf.jaxrs.testbean.EchoService" />
 
-  <cxf:rsClient id="rsClientProxy" 
address="http://localhost:8080/services/CxfRsProducerSessionTest/";
+  <cxf:rsClient id="rsClientProxy" 
address="http://localhost:${CXFTestSupport.port1}/services/CxfRsProducerSessionTest/";
     serviceClass="org.apache.camel.component.cxf.jaxrs.testbean.EchoService"
     loggingFeatureEnabled="true" />
    
-  <cxf:rsClient id="rsClientHttp" 
address="http://localhost:8080/services/CxfRsProducerSessionTest/"/>
+  <cxf:rsClient id="rsClientHttp" 
address="http://localhost:${CXFTestSupport.port1}/services/CxfRsProducerSessionTest/"/>
 
 
   <bean id="instanceCookieHandler" 
class="org.apache.camel.http.base.cookie.InstanceCookieHandler"/>

Reply via email to