Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CAMEL-12541: rsClient does not work programmatically, only with XML #2350

Merged
merged 3 commits into from
May 28, 2018

Conversation

willianantunes
Copy link
Contributor

@willianantunes willianantunes commented May 27, 2018

When the endpoint is created with the bean (see here how it's found) it is always available and is used for the consumer approach (see the method newJAXRSServerFactoryBean).

Now the same behavior is used for producer approach as nowadays we always return a new instance of SpringJAXRSClientFactoryBean.

When the endpoint is created the bean is always available and is used
for the consumer approach (newJAXRSServerFactoryBean). Now the same
behavior is used for producer approach (newJAXRSClientFactoryBean).
@willianantunes
Copy link
Contributor Author

willianantunes commented May 27, 2018

Before creating this PR I'd run the tests and re-ran after inserting the fix to make sure if it was OK or not.

I believe CxfRsProducerAddressOverrideTest.testAddressMultiOverride is now breaking because LRUSoftCache returns the wrong stored object here when the test executes line 166.

@willianantunes
Copy link
Contributor Author

willianantunes commented May 27, 2018

When the cache works properly it has the following:

{
    http://localhost:1101/CxfRsProducerNonExistingAddressOverrideTest=org.apache.camel.component.cxf.spring.SpringJAXRSClientFactoryBean@625487a6, 
    http://localhost:1101/CxfRsProducerAddressOverrideTest=org.apache.camel.component.cxf.spring.SpringJAXRSClientFactoryBean@36224f93
}

See that each value is a different object (625487a6 and 36224f93). But when I run a test with this PR I get the following:

{
    http://localhost:1101/CxfRsProducerNonExistingAddressOverrideTest=org.apache.camel.component.cxf.spring.SpringJAXRSClientFactoryBean@ab58eea1, 
    http://localhost:1101/CxfRsProducerAddressOverrideTest=org.apache.camel.component.cxf.spring.SpringJAXRSClientFactoryBean@ab58eea1
}

Both keys have the same object (ab58eea1). That's why the test is breaking.

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

ClassPathXmlApplicationContext applicationContext = null;

if (version.startsWith("2") && (version.contains("2.5") || version.contains("2.4"))) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This version check could be removed as we already move to 2.6.x

public void testCreateCxfRsClientFactoryBeanProgrammatically() {

CxfRsEndpoint endpoint = resolveMandatoryEndpoint("cxfrs://bean://" + BEAN_SERVICE_ENDPOINT_NAME, CxfRsEndpoint.class);
SpringJAXRSClientFactoryBean cfb = (SpringJAXRSClientFactoryBean)endpoint.createJAXRSClientFactoryBean();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we may need to check the instance of cfb is not the one we set before.

Version check was removed as we already move to 2.6.x
@WillemJiang WillemJiang merged commit 574f39c into apache:master May 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants