-
Notifications
You must be signed in to change notification settings - Fork 6
NIAD-3208: CustomTrustStore refactoring to exclude weird dependencies #1054
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
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
17f625a
changing from autowired field to constructor initizalization
ORybak5 994587f
checkstyle
ORybak5 1d376d2
suppress false positive alarms sent by spotbugs
ORybak5 e7f7430
refactoring to relax dependency injection rules
ORybak5 e25a07d
increasing test coverage
ORybak5 51ee91a
remove test which is inconsistent between localhost and GitHub Actions
ORybak5 37af7bc
checkstyle
ORybak5 602d88d
addressing PR comments
ORybak5 e2a0359
throws an exception if s3Client can't be initialized
ORybak5 5038aae
removal of an unnecessary bean tagging
ORybak5 706dce1
checkstyle
ORybak5 593f436
making log entry more descriptive
ORybak5 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
service/src/test/java/uk/nhs/adaptors/gp2gp/common/configuration/AppInitializerTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| package uk.nhs.adaptors.gp2gp.common.configuration; | ||
|
|
||
| import org.junit.jupiter.api.BeforeEach; | ||
| import org.junit.jupiter.api.Test; | ||
| import uk.nhs.adaptors.gp2gp.common.storage.StorageConnectorConfiguration; | ||
| import javax.naming.ConfigurationException; | ||
| import static org.junit.jupiter.api.Assertions.assertEquals; | ||
| import static org.junit.jupiter.api.Assertions.assertThrows; | ||
|
|
||
| class AppInitializerTest { | ||
|
|
||
| public static final String EXPECTED_ERROR_MESSAGE = "S3Client cannot be instantiated: " | ||
| + "Trust store URL is either not set or does not start with the 's3://' prefix."; | ||
| private AppInitializer appInitializer; | ||
| private StorageConnectorConfiguration storageConnectorConfiguration; | ||
|
|
||
| @BeforeEach | ||
| void setUp() { | ||
| storageConnectorConfiguration = new StorageConnectorConfiguration(); | ||
| } | ||
|
|
||
| @Test | ||
| void getNullWhenTrustStoreUrlDoesNotExists() { | ||
|
|
||
| storageConnectorConfiguration.setTrustStoreUrl(null); | ||
| appInitializer = new AppInitializer(storageConnectorConfiguration); | ||
|
|
||
| Exception exception = assertThrows(ConfigurationException.class, () -> appInitializer.getS3Client()); | ||
|
|
||
| assertEquals(EXPECTED_ERROR_MESSAGE, exception.getMessage()); | ||
| } | ||
|
|
||
| @Test | ||
| void getNullWhenTrustStoreUrlDoesNotStartWithS3Prefix() { | ||
|
|
||
| storageConnectorConfiguration.setTrustStoreUrl("http://localhost"); | ||
| appInitializer = new AppInitializer(storageConnectorConfiguration); | ||
|
|
||
| Exception exception = assertThrows(ConfigurationException.class, () -> appInitializer.getS3Client()); | ||
|
|
||
| assertEquals(EXPECTED_ERROR_MESSAGE, exception.getMessage()); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Minor, why not put it in the existing
@BeforeAll?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.
yes, I can do