Skip to content

Make Lookup instantiatable with a default constructor retaining the original behavior#750

Merged
bruno-garcia merged 6 commits into
getsentry:masterfrom
metlos:lookup-refactor
Aug 14, 2019
Merged

Make Lookup instantiatable with a default constructor retaining the original behavior#750
bruno-garcia merged 6 commits into
getsentry:masterfrom
metlos:lookup-refactor

Conversation

@metlos

@metlos metlos commented Aug 6, 2019

Copy link
Copy Markdown
Contributor

This should help with the testability of majority of other parts of the codebase because we can start introducing overloads accepting the new SentryConfiguration instance instead of statically calling Lookup (which implements the SentryConfiguration interface).

SentryConfiguration being an interface makes it trivially mockable without resorting to the ugliness needed to mock JNDI look up et al.

Note that I didn't implement any new tests yet to check the new capabilities of Lookup nor did I update any existing code or tests to take advantage of it. That said, Lookup itself uses the new code and the testsuite seems to be passing with it.

@metlos

metlos commented Aug 6, 2019

Copy link
Copy Markdown
Contributor Author

I've created this merely as a draft PR because of the lack of tests for the new functionality. Let's discuss the implementation approach in the meantime :)

Comment thread sentry/src/main/java/io/sentry/config/FileResourceLoader.java
Comment thread sentry/src/main/java/io/sentry/config/Lookup.java
metlos added 3 commits August 8, 2019 00:34
location configurable.

Also made the prefixes of env vars, system properties and JNDI names
containing the individual configuration properties configurable.

Got rid of the superfluous SentryConfiguration interface and
PropertiesConfigurationprovider.
@metlos metlos marked this pull request as ready for review August 12, 2019 22:20
@metlos

metlos commented Aug 13, 2019

Copy link
Copy Markdown
Contributor Author

Note that I've started using Mockito in the new tests, for better or worse. IMHO, it is a de-facto industry standard and doesn't allow for the insanity of mocking system classes like jmockit does. IMHO, that's for good reasons.

@bruno-garcia bruno-garcia merged commit 94af124 into getsentry:master Aug 14, 2019
@metlos metlos deleted the lookup-refactor branch August 14, 2019 09:25
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