-
Notifications
You must be signed in to change notification settings - Fork 5k
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
CAMEL-12541: rsClient does not work programmatically, only with XML #2350
Conversation
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).
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. |
When the cache works properly it has the following:
See that each value is a different object (625487a6 and 36224f93). But when I run a test with this PR I get the following:
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"))) { |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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
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.