[ 
https://issues.apache.org/jira/browse/BEAM-14000?focusedWorklogId=761790&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-761790
 ]

ASF GitHub Bot logged work on BEAM-14000:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 25/Apr/22 13:14
            Start Date: 25/Apr/22 13:14
    Worklog Time Spent: 10m 
      Work Description: nishantjain91 commented on code in PR #17297:
URL: https://github.com/apache/beam/pull/17297#discussion_r857612803


##########
sdks/java/io/elasticsearch-tests/elasticsearch-tests-common/src/test/java/org/apache/beam/sdk/io/elasticsearch/ElasticsearchIOTestCommon.java:
##########
@@ -1229,4 +1230,16 @@ void testWriteWithIsDeletedFnWithoutPartialUpdate() 
throws Exception {
     assertEquals(numDocs / 2, currentNumDocs);
     assertEquals(0, countByScientistName(connectionConfiguration, restClient, 
"Darwin", null));
   }
+
+  void testValidSSLAndUsernameConfiguration(String filePath) throws Exception {
+    ConnectionConfiguration configWithSsl =
+        connectionConfiguration
+            .withUsername("username")
+            .withPassword("password")
+            .withKeystorePassword("qwerty")
+            .withKeystorePath(filePath);
+
+    RestClient restClient = configWithSsl.createClient();
+    Assert.assertNotNull("rest client should not be null", restClient);

Review Comment:
   @egalpin I am not sure how to test that. we do not have access to  
HttpAsyncClient  present in restclient. And resclientbuilder is private to 
createclient method.
   
   We might be able to use reflection to get access or we can test it against 
an es cluster which works with ssl and username/password. But not sure, any of 
these are good methods.
   
   Let me know how we should proceed for this.
   





Issue Time Tracking
-------------------

    Worklog Id:     (was: 761790)
    Time Spent: 2h 20m  (was: 2h 10m)

> Elastic search IO doesnot work when both username/password and keystore are 
> used
> --------------------------------------------------------------------------------
>
>                 Key: BEAM-14000
>                 URL: https://issues.apache.org/jira/browse/BEAM-14000
>             Project: Beam
>          Issue Type: Bug
>          Components: sdk-java-core
>            Reporter: nishant jain
>            Priority: P2
>          Time Spent: 2h 20m
>  Remaining Estimate: 0h
>
> When using both username/password and ssl keystore, ElasticSearchIO doesnot 
> Create correct restclient.
>  
> Firstly, it sets HttpClientConfigCallback using httpAsyncClientBuilder if 
> username and passowrd is used. Afterwards, it will replace 
> HttpClientConfigCallback to httpClientBuilder is ssl store is used, hence 
> losing the credentials provider



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to