You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2025/01/03 19:27:34 UTC

(camel) branch camel-4.8.x updated: Fixed netty tests

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

davsclaus pushed a commit to branch camel-4.8.x
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/camel-4.8.x by this push:
     new 52563442a46 Fixed netty tests
52563442a46 is described below

commit 52563442a46b94e8678f1250415fd25d3e357f00
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Jan 3 20:26:27 2025 +0100

    Fixed netty tests
---
 .../camel/component/netty/MainNettyCustomCodecTest.java      | 12 ++++++++----
 .../camel/component/netty/ObjectSerializationTest.java       |  2 +-
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/components/camel-netty/src/test/java/org/apache/camel/component/netty/MainNettyCustomCodecTest.java b/components/camel-netty/src/test/java/org/apache/camel/component/netty/MainNettyCustomCodecTest.java
index 3873dcf32e9..dedcfa42c43 100644
--- a/components/camel-netty/src/test/java/org/apache/camel/component/netty/MainNettyCustomCodecTest.java
+++ b/components/camel-netty/src/test/java/org/apache/camel/component/netty/MainNettyCustomCodecTest.java
@@ -18,13 +18,14 @@ package org.apache.camel.component.netty;
 
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.main.Main;
-import org.junit.jupiter.api.Assertions;
+import org.apache.camel.util.ObjectHelper;
 import org.junit.jupiter.api.Test;
 
 public class MainNettyCustomCodecTest extends BaseNettyTest {
 
     // use reaadble bytes
-    private byte[] data = new byte[] { 65, 66, 67, 68, 69, 70, 71, 72, 73, 0, 0 };
+    private byte[] data_eol = new byte[] { 65, 66, 67, 68, 69, 70, 71, 72, 73, 0, 0 };
+    private byte[] data = new byte[] { 65, 66, 67, 68, 69, 70, 71, 72, 73 };
 
     @Test
     public void testMain() throws Exception {
@@ -42,11 +43,14 @@ public class MainNettyCustomCodecTest extends BaseNettyTest {
                 from(uri).to("log:input")
                         .process(e -> {
                             byte[] local = e.getMessage().getBody(byte[].class);
-                            Assertions.assertEquals(data, local);
+                            boolean eq = ObjectHelper.equalByteArray(data, local);
+                            if (!eq) {
+                                throw new IllegalArgumentException("Data received is not as expected");
+                            }
                         });
 
                 from("timer:once?repeatCount=1")
-                        .setBody().constant(data)
+                        .setBody().constant(data_eol) // include null terminator
                         .to(uri);
             }
         });
diff --git a/components/camel-netty/src/test/java/org/apache/camel/component/netty/ObjectSerializationTest.java b/components/camel-netty/src/test/java/org/apache/camel/component/netty/ObjectSerializationTest.java
index ce79706a033..1a251bd7b12 100644
--- a/components/camel-netty/src/test/java/org/apache/camel/component/netty/ObjectSerializationTest.java
+++ b/components/camel-netty/src/test/java/org/apache/camel/component/netty/ObjectSerializationTest.java
@@ -51,7 +51,7 @@ public class ObjectSerializationTest extends BaseNettyTest {
     public void testObjectSerializationFailureByDefault() {
         Date date = new Date();
         try {
-            template.requestBody("netty:tcp://localhost:{{port}}?sync=true&encoders=#encoder", date, Date.class);
+            Object o = template.requestBody("netty:tcp://localhost:{{port}}?sync=true&encoders=#encoder", date, Date.class);
             fail("Should have thrown exception");
         } catch (CamelExecutionException e) {
             // expected