You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@eventmesh.apache.org by jo...@apache.org on 2022/11/28 03:41:09 UTC

[incubator-eventmesh] branch master updated: [ISSUE #2252]Reliance on default encoding [WebHookProcessorTest] (#2271)

This is an automated email from the ASF dual-hosted git repository.

jonyang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-eventmesh.git


The following commit(s) were added to refs/heads/master by this push:
     new 4bb3d4d9d [ISSUE #2252]Reliance on default encoding [WebHookProcessorTest] (#2271)
4bb3d4d9d is described below

commit 4bb3d4d9db5ba781be95ba8fa1ca560ae72f3be5
Author: CalebZYC <42...@users.noreply.github.com>
AuthorDate: Mon Nov 28 11:41:04 2022 +0800

    [ISSUE #2252]Reliance on default encoding [WebHookProcessorTest] (#2271)
    
    add UTF-8 Encoding
---
 .../eventmesh/runtime/protocol/processor/WebHookProcessorTest.java  | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/eventmesh-runtime/src/test/java/org/apache/eventmesh/runtime/protocol/processor/WebHookProcessorTest.java b/eventmesh-runtime/src/test/java/org/apache/eventmesh/runtime/protocol/processor/WebHookProcessorTest.java
index 52bdb9f16..d1c915ac6 100644
--- a/eventmesh-runtime/src/test/java/org/apache/eventmesh/runtime/protocol/processor/WebHookProcessorTest.java
+++ b/eventmesh-runtime/src/test/java/org/apache/eventmesh/runtime/protocol/processor/WebHookProcessorTest.java
@@ -30,6 +30,8 @@ import org.apache.eventmesh.webhook.receive.storage.HookConfigOperationManage;
 
 import org.apache.commons.lang3.StringUtils;
 
+import java.nio.charset.StandardCharsets;
+
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
@@ -84,7 +86,7 @@ public class WebHookProcessorTest {
             Assert.assertTrue(StringUtils.isNoneBlank(msgSendToMq.getId()));
             Assert.assertEquals("www.github.com", msgSendToMq.getSource().getPath());
             Assert.assertEquals("github.ForkEvent", msgSendToMq.getType());
-            Assert.assertEquals(BytesCloudEventData.wrap("\"mock_data\":0".getBytes()), msgSendToMq.getData());
+            Assert.assertEquals(BytesCloudEventData.wrap("\"mock_data\":0".getBytes(StandardCharsets.UTF_8)), msgSendToMq.getData());
         } catch (Exception e) {
             Assert.fail(e.getMessage());
         }
@@ -92,7 +94,7 @@ public class WebHookProcessorTest {
 
     private HttpRequest buildMockWebhookRequest() {
         ByteBuf buffer = Unpooled.buffer();
-        buffer.writeBytes("\"mock_data\":0".getBytes());
+        buffer.writeBytes("\"mock_data\":0".getBytes(StandardCharsets.UTF_8));
 
         FullHttpRequest request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, "/webhook/github/eventmesh/all", buffer);
         request.headers().set("content-type", "application/json");


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: commits-help@eventmesh.apache.org