-
Notifications
You must be signed in to change notification settings - Fork 214
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
Support certificate content in Opensearch Source configuration to sup… #4184
Conversation
…port TLS and truststore on the client. Signed-off-by: Dinu John <[email protected]>
@Test | ||
void provideOpenSearchClient_with_self_signed_certificate() { | ||
try (MockedStatic<TrustStoreProvider> trustStoreProviderMockedStatic = mockStatic(TrustStoreProvider.class)) { | ||
final Path path = mock(Path.class); |
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.
I recommend moving as much out of the try block as possible to make the mocking easier to understand. I believe you can move lines 225-230 out of here.
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.
Done
@Test | ||
void provideElasticSearchClient_with_self_signed_certificate() { | ||
try (MockedStatic<TrustStoreProvider> trustStoreProviderMockedStatic = mockStatic(TrustStoreProvider.class)) { | ||
final Path path = mock(Path.class); |
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.
As with the above, please move lines 243-248 to sit before the try block.
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.
Done
@Test | ||
void createSdkAsyncHttpClient_with_self_signed_certificate() { | ||
try (MockedStatic<TrustStoreProvider> trustStoreProviderMockedStatic = mockStatic(TrustStoreProvider.class)) { | ||
final Path path = mock(Path.class); |
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.
As with the above, please move lines 261-269 to sit before the try block.
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.
Done
@@ -14,6 +14,9 @@ public class ConnectionConfiguration { | |||
@JsonProperty("cert") | |||
private Path certPath; | |||
|
|||
@JsonProperty("certificate_content") |
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.
Should we have a validation on mutual exclusivity?
@AssertTrue
public boolean certificateFileAndContentAreMutuallyExclusive() {
if(certPath == null && certificateContent == null)
return true;
return certPath != null ^ certificateContent != null;
}
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.
Done
Signed-off-by: Dinu John <[email protected]>
Support certificate content in Opensearch Source configuration to support TLS and Truststore for Opensearch client.
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.