wombatu-kun commented on code in PR #10970:
URL: https://github.com/apache/hudi/pull/10970#discussion_r1558520013


##########
hudi-client/hudi-client-common/src/test/java/org/apache/hudi/callback/client/http/TestCallbackHttpClient.java:
##########
@@ -101,43 +107,85 @@ private void mockResponse(int statusCode) {
   }
 
   @Test
-  public void sendPayloadShouldLogWhenRequestFailed() throws IOException {
+  void sendPayloadShouldLogWhenRequestFailed() throws IOException {
     when(httpClient.execute(any())).thenThrow(IOException.class);
 
     HoodieWriteCommitHttpCallbackClient hoodieWriteCommitCallBackHttpClient =
-        new HoodieWriteCommitHttpCallbackClient("fake_api_key", "fake_url", 
httpClient);
-    hoodieWriteCommitCallBackHttpClient.send("{}");
+        new HoodieWriteCommitHttpCallbackClient(FAKE_API_KEY, FAKE_URL, 
httpClient, null);
+    hoodieWriteCommitCallBackHttpClient.send(CALLBACK_MSG);
 
     verify(appender).append(logCaptor.capture());
     assertEquals("Failed to send callback.", 
logCaptor.getValue().getMessage().getFormattedMessage());
     assertEquals(Level.WARN, logCaptor.getValue().getLevel());
   }
 
   @Test
-  public void sendPayloadShouldLogUnsuccessfulSending() {
+  void sendPayloadShouldLogUnsuccessfulSending() {
     mockResponse(401);
     when(httpResponse.toString()).thenReturn("unauthorized");
 
     HoodieWriteCommitHttpCallbackClient hoodieWriteCommitCallBackHttpClient =
-        new HoodieWriteCommitHttpCallbackClient("fake_api_key", "fake_url", 
httpClient);
-    hoodieWriteCommitCallBackHttpClient.send("{}");
+        new HoodieWriteCommitHttpCallbackClient(FAKE_API_KEY, FAKE_URL, 
httpClient, null);
+    hoodieWriteCommitCallBackHttpClient.send(CALLBACK_MSG);
 
     verify(appender).append(logCaptor.capture());
     assertEquals("Failed to send callback message. Response was unauthorized", 
logCaptor.getValue().getMessage().getFormattedMessage());
     assertEquals(Level.WARN, logCaptor.getValue().getLevel());
   }
 
   @Test
-  public void sendPayloadShouldLogSuccessfulSending() {
+  void sendPayloadShouldLogSuccessfulSending() {
     mockResponse(202);
 
+    Map<String, String> customHeaders = new HashMap<>();
+    customHeaders.put("key1", "val1");
+    customHeaders.put("key2", "val2");
     HoodieWriteCommitHttpCallbackClient hoodieWriteCommitCallBackHttpClient =
-        new HoodieWriteCommitHttpCallbackClient("fake_api_key", "fake_url", 
httpClient);
-    hoodieWriteCommitCallBackHttpClient.send("{}");
+        new HoodieWriteCommitHttpCallbackClient(FAKE_API_KEY, FAKE_URL, 
httpClient, customHeaders);
+    hoodieWriteCommitCallBackHttpClient.send(CALLBACK_MSG);
 
     verify(appender).append(logCaptor.capture());
-    
assertTrue(logCaptor.getValue().getMessage().getFormattedMessage().startsWith("Sent
 Callback data"));
+    
assertTrue(logCaptor.getValue().getMessage().getFormattedMessage().startsWith("Sent
 Callback data with 2 custom headers"));
     assertEquals(Level.INFO, logCaptor.getValue().getLevel());
   }
 
+  @Test
+  void testParsingCustomHeaders() {

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to