Skip to content

Commit

Permalink
CAMEL-12541: Test object reference and no need for version check anymore
Browse files Browse the repository at this point in the history
Version check was removed as we already move to 2.6.x
  • Loading branch information
willianantunes authored and WillemJiang committed May 28, 2018
1 parent c12137f commit 574f39c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 73 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.apache.camel.component.cxf.spring.SpringJAXRSClientFactoryBean;
import org.apache.camel.component.cxf.spring.SpringJAXRSServerFactoryBean;
import org.apache.camel.test.spring.CamelSpringTestSupport;
import org.apache.cxf.version.Version;
import org.junit.Test;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
Expand Down Expand Up @@ -75,11 +74,12 @@ public void testCreateCxfRsClientFactoryBeanProgrammatically() {
CxfRsEndpoint endpoint = resolveMandatoryEndpoint("cxfrs://bean://" + BEAN_SERVICE_ENDPOINT_NAME, CxfRsEndpoint.class);
SpringJAXRSClientFactoryBean cfb = (SpringJAXRSClientFactoryBean)endpoint.createJAXRSClientFactoryBean();

assertNotSame("Got the same object but must be different", super.applicationContext.getBean(BEAN_SERVICE_ENDPOINT_NAME), cfb);
assertEquals("Got the wrong address", BEAN_SERVICE_ADDRESS, cfb.getAddress());
assertNotNull("Service class must not be null", cfb.getServiceClass());
assertEquals("Got the wrong ServiceClass", CustomerService.class, cfb.getServiceClass());
assertEquals("Got the wrong username", BEAN_SERVICE_USERNAME, cfb.getUsername());
assertEquals("Got the wrong password", BEAN_SERVICE_PASSWORD, cfb.getPassword());
assertEquals("Got the wrong password", BEAN_SERVICE_PASSWORD, cfb.getPassword());
}

public static SpringJAXRSClientFactoryBean serviceEndpoint() {
Expand All @@ -94,17 +94,9 @@ public static SpringJAXRSClientFactoryBean serviceEndpoint() {
}

@Override
protected AbstractXmlApplicationContext createApplicationContext() {
String version = Version.getCurrentVersion();

ClassPathXmlApplicationContext applicationContext = null;

if (version.startsWith("2") && (version.contains("2.5") || version.contains("2.4"))) {
applicationContext = new ClassPathXmlApplicationContext(new String("org/apache/camel/component/cxf/jaxrs/CxfRsSpringEndpointBeans.xml"));
} else {
applicationContext = new ClassPathXmlApplicationContext(new String("org/apache/camel/component/cxf/jaxrs/CxfRsSpringEndpointBeans-2.6.xml"));
}
protected AbstractXmlApplicationContext createApplicationContext() {

ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext(new String("org/apache/camel/component/cxf/jaxrs/CxfRsSpringEndpointBeans.xml"));
emulateBeanRegistrationProgrammatically(applicationContext);

return applicationContext;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,31 @@
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
">
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">


<cxf:rsServer id="rsServer" address="http://localhost:9000/router"
serviceClass="org.apache.camel.component.cxf.jaxrs.testbean.CustomerService"
loggingFeatureEnabled="true" loggingSizeLimit="200">
<cxf:properties>
<entry key="aKey" value="aValue"/>
</cxf:properties>
<cxf:providers>
<ref bean="jsonProvider"/>
</cxf:providers>
<cxf:inInterceptors>
<bean class="org.apache.camel.component.cxf.jaxrs.TestInInterceptor"/>
</cxf:inInterceptors>
</cxf:rsServer>

<cxf:rsClient id="rsClient" address="http://localhost:9002/helloworld"
serviceClass="org.apache.camel.component.cxf.jaxrs.testbean.CustomerService"/>
serviceClass="org.apache.camel.component.cxf.jaxrs.testbean.CustomerService">
<cxf:inInterceptors>
<bean class="org.apache.camel.component.cxf.jaxrs.TestInInterceptor"/>
</cxf:inInterceptors>
</cxf:rsClient>

<bean id="jsonProvider" class="org.apache.cxf.jaxrs.provider.JSONProvider"/>
<bean id="jsonProvider" class="org.apache.cxf.jaxrs.provider.json.JSONProvider"/>

<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
</camelContext>
Expand Down

0 comments on commit 574f39c

Please sign in to comment.