-
Notifications
You must be signed in to change notification settings - Fork 0
Added E2E integration tests #45
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 4 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
168a9b1
Added E2E integration tests
srivanimuddineni 2afd3f4
Resolved review comments on Naming conventions
srivanimuddineni 0f9d078
Added improvements for stubs, callback wiremock
srivanimuddineni aeefe25
Added test profile
srivanimuddineni e627a25
Resolved review comments for folder naming and constants reusability
srivanimuddineni 17e94d4
Added CodeQL rule java/insecure-trustmanager is excluded via .github/…
srivanimuddineni a9242a1
Added improvements for retry(callback),stubs refactor to specfic serv…
srivanimuddineni cbad6f1
Added final to variable
srivanimuddineni 9948cc4
Changes to avoid catching generic exceptions in try-catch blocks
srivanimuddineni 52e0be6
relaxed tls for wiremock
srivanimuddineni 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
39 changes: 39 additions & 0 deletions
39
src/test/java/uk/gov/hmcts/cp/subscription/config/SSLTrustingRestTemplateConfig.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,39 @@ | ||
| package uk.gov.hmcts.cp.subscription.config; | ||
|
|
||
| import jakarta.annotation.PostConstruct; | ||
| import org.springframework.context.annotation.Configuration; | ||
|
|
||
| import javax.net.ssl.HttpsURLConnection; | ||
| import javax.net.ssl.SSLContext; | ||
| import javax.net.ssl.TrustManager; | ||
| import javax.net.ssl.X509TrustManager; | ||
|
|
||
| import java.security.SecureRandom; | ||
| import java.security.cert.X509Certificate; | ||
|
|
||
| @Configuration | ||
| public class SSLTrustingRestTemplateConfig { | ||
|
|
||
| private static final X509TrustManager TRUST_ALL = new X509TrustManager() { | ||
| @Override | ||
| public void checkClientTrusted(X509Certificate[] chain, String authType) { | ||
| } | ||
|
|
||
| @Override | ||
| public void checkServerTrusted(X509Certificate[] chain, String authType) { | ||
| } | ||
|
|
||
| @Override | ||
| public X509Certificate[] getAcceptedIssuers() { | ||
| return new X509Certificate[0]; | ||
| } | ||
| }; | ||
|
|
||
| @PostConstruct | ||
| public void trustAllSsl() throws Exception { | ||
| var ssl = SSLContext.getInstance("TLS"); | ||
| ssl.init(null, new TrustManager[]{TRUST_ALL}, new SecureRandom()); | ||
| HttpsURLConnection.setDefaultSSLSocketFactory(ssl.getSocketFactory()); | ||
| HttpsURLConnection.setDefaultHostnameVerifier((hostname, session) -> true); | ||
| } | ||
| } | ||
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.