From 80b83cacd934003d93f490c4470c00194cd6fad5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Dywicki?= Date: Mon, 30 Sep 2024 14:28:45 +0200 Subject: [PATCH] Attempt to stabilize OPC UA chunk factory tests. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Related to #1764. Signed-off-by: Ɓukasz Dywicki --- .../apache/plc4x/java/opcua/protocol/chunk/ChunkFactory.java | 5 +++-- .../plc4x/java/opcua/protocol/chunk/ChunkFactoryTest.java | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/protocol/chunk/ChunkFactory.java b/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/protocol/chunk/ChunkFactory.java index a86f514956f..5b2146796cb 100644 --- a/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/protocol/chunk/ChunkFactory.java +++ b/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/protocol/chunk/ChunkFactory.java @@ -30,7 +30,8 @@ public class ChunkFactory { - public static int SYMMETRIC_SECURITY_HEADER_SIZE = 4; + public static final int ASYMMETRIC_SECURITY_HEADER_SIZE = 59; + public static final int SYMMETRIC_SECURITY_HEADER_SIZE = 4; public Chunk create(boolean asymmetric, Conversation conversation) { return create(asymmetric, @@ -48,7 +49,7 @@ public Chunk create(boolean asymmetric, boolean encrypted, boolean signed, Secur if (securityPolicy == SecurityPolicy.NONE) { return new Chunk( - asymmetric ? 59 : SYMMETRIC_SECURITY_HEADER_SIZE, + asymmetric ? ASYMMETRIC_SECURITY_HEADER_SIZE : SYMMETRIC_SECURITY_HEADER_SIZE, 1, 1, securityPolicy.getSymmetricSignatureSize(), diff --git a/plc4j/drivers/opcua/src/test/java/org/apache/plc4x/java/opcua/protocol/chunk/ChunkFactoryTest.java b/plc4j/drivers/opcua/src/test/java/org/apache/plc4x/java/opcua/protocol/chunk/ChunkFactoryTest.java index c59b80efb21..89c44b75332 100644 --- a/plc4j/drivers/opcua/src/test/java/org/apache/plc4x/java/opcua/protocol/chunk/ChunkFactoryTest.java +++ b/plc4j/drivers/opcua/src/test/java/org/apache/plc4x/java/opcua/protocol/chunk/ChunkFactoryTest.java @@ -26,6 +26,7 @@ import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; +import java.util.concurrent.ConcurrentHashMap; import org.apache.plc4x.java.opcua.TestCertificateGenerator; import org.apache.plc4x.java.opcua.readwrite.MessageSecurityMode; import org.apache.plc4x.java.opcua.readwrite.OpcuaProtocolLimits; @@ -40,7 +41,7 @@ @Disabled("Disabled flaky test. Tracking issue at https://github.com/apache/plc4x/issues/1764") class ChunkFactoryTest { - public static final Map> CERTIFICATES = new HashMap<>(); + public static final Map> CERTIFICATES = new ConcurrentHashMap<>(); private OpcuaProtocolLimits limits = new OpcuaProtocolLimits( 8196,