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

DropwizardTestSupport not compatible with Failsafe 2.19 #1709

Closed
cowwoc opened this issue Aug 25, 2016 · 4 comments
Closed

DropwizardTestSupport not compatible with Failsafe 2.19 #1709

cowwoc opened this issue Aug 25, 2016 · 4 comments

Comments

@cowwoc
Copy link

cowwoc commented Aug 25, 2016

Failsafe 2.19 now runs tests out of JAR files: https://issues.apache.org/jira/browse/SUREFIRE-855

DropwizardTestSupport assumes that configPath can be a String (the file path) but this isn't possible for config files located inside JAR files.

The only way I can think of fixing this is to replace String configPath with a URI, then open an InputStream to read the config file whether it resides in target/classes or inside a JAR file.

However, you just released version 1.0.0 and this sounds like a breaking change ;)

@cowwoc cowwoc changed the title DropwizardTestSupport not compatible with Surefire 2.19 DropwizardTestSupport not compatible with Failsafe 2.19 Aug 25, 2016
@evnm
Copy link
Member

evnm commented Aug 27, 2016

Thanks for reporting the issue, Gili.

Rather than change the type of the configPath field, perhaps we could add a new io.dropwizard.configuration.ConfigurationSourceProvider which produces an InputStream from a file within a JAR. The configPath string could be formatted according to the JAR protocol expected by java.net.URL (i.e. "jar:file:/path/to/some.jar!/path/to/file").

DropwizardTestSupport could then optionally invoke Bootstrap#setConfigurationSourceProvider depending on the state of configPath.

Would you be interested in bringing this change to a PR?

@cowwoc
Copy link
Author

cowwoc commented Aug 30, 2016

That could work. Unfortunately this is too elaborate for me to be able to provide a PR for (too busy at work) so I am afraid I will have to leave the implementation to you.

@Tibor17
Copy link

Tibor17 commented Nov 4, 2016

@cowwoc
@evnm
I am from Maven Surefire project. I see you have mentioned Jira issue 855. If you need to have any support just let me know.

@cowwoc
Copy link
Author

cowwoc commented Nov 4, 2016

Hi @Tibor17,

I am not actively working on this issue as I have bigger fish to fry at the moment. For now, I am just passively interested in this issue's resolution.

aeolus added a commit to aeolus/dropwizard that referenced this issue Nov 17, 2016
choose proper configurationSourceProvider for configPath in DropwizardTestSupport
joschi added a commit that referenced this issue Mar 3, 2019
* Allow specifying ConfigurationSourceProvider in DropwizardTestSupport, DropwizardAppRule, and DropwizardAppExtension
* Mark constructors with `Optional<String>` for configuration file as deprecated in favor of nullable versions
  * See https://rules.sonarsource.com/java/RSPEC-3553
* Better exceptions when initializing the test application fails
* Clean up tests and remove redundant test applications

Closes #1709
Closes #1830
joschi added a commit that referenced this issue Mar 3, 2019
* Allow specifying ConfigurationSourceProvider in DropwizardTestSupport, DropwizardAppRule, and DropwizardAppExtension
* Mark constructors with `Optional<String>` for configuration file as deprecated in favor of nullable versions
  * See https://rules.sonarsource.com/java/RSPEC-3553
* Better exceptions when initializing the test application fails
* Clean up tests and remove redundant test applications

Closes #1709
Closes #1830
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants