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

Use WireMock for Dropbox integration tests #4047

Open
jamesnetherton opened this issue Aug 25, 2022 · 5 comments
Open

Use WireMock for Dropbox integration tests #4047

jamesnetherton opened this issue Aug 25, 2022 · 5 comments

Comments

@jamesnetherton
Copy link
Contributor

Not sure if it is possible or not but it'd be worth investigating to see if we have the tests run on the CI build without requiring real credentials.

@djcoleman
Copy link
Contributor

At first I thought this was going to be a fairly quick task based on the Geocoder tests, but I found myself heading down a warren of rabbit holes with this.

In order to test the Dropbox extension with Wiremock, the wiremock server URL must be passed to the dropbox client within the Camel component.

I first tried creating an instance of DbxClientV2 (the client supplied by the Dropbox SDK), but it had limited support for passing in a new host - I had to access a private constructor via reflection to be able to pass in the Wiremock URL as well as the credentials.

The next issue was setting the client in the Camel component. I had to create a sub-class of the DropboxComponent and register that in place of the original. The sub-class overrode the createEndpoint method that first called the parent implementation and then accessed the DropboxConfiguration object, to which I could pass the DbxClientV2 object.

However, this still did not work as the DbxClientV2 object doesn't handle port numbers - it only expects hostnames, so URL creation fails.

I don't know if the Wiremock proxy support can be used to create an alias that can be used instead of localhost:{randomPort}, but I've spent more time than I'd intended on this already.

@ppalaga
Copy link
Contributor

ppalaga commented Jan 24, 2023

Thanks for your patient investigation, @djcoleman !

We should perhaps try our luck asking the Dropbox client team for a proper base URI support? https://github.com/dropbox/dropbox-sdk-java/issues

@djcoleman
Copy link
Contributor

I found a question from 2019 on dropboxforum.com requesting WireMock support. The responder acknowledged the problem and promised to submit a feature request, although he didn't make any commitments to implementing it.

I don't see any tickets in the dropbox-sdk-java issues list already though, so I can submit a request myself and see if anything happens.

@ppalaga
Copy link
Contributor

ppalaga commented Jan 30, 2023

@djcoleman could you please paste the Dropbox issue URL here?

@djcoleman
Copy link
Contributor

Here it is: dropbox/dropbox-sdk-java#487

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

No branches or pull requests

3 participants