Skip to content

Commit 015258f

Browse files
committed
Adapt stream-to-AMQP interop tests to message containers
See rabbitmq/rabbitmq-server#9830, rabbitmq/rabbitmq-website#1747
1 parent 85c51e2 commit 015258f

File tree

1 file changed

+26
-13
lines changed

1 file changed

+26
-13
lines changed

Diff for: src/test/java/com/rabbitmq/stream/impl/AmqpInteroperabilityTest.java

+26-13
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// Copyright (c) 2020-2023 Broadcom. All Rights Reserved. The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
1+
// Copyright (c) 2020-2023 Broadcom. All Rights Reserved. The term "Broadcom" refers to Broadcom
2+
// Inc. and/or its subsidiaries.
23
//
34
// This software, the RabbitMQ Stream Java client library, is dual-licensed under the
45
// Mozilla Public License 2.0 ("MPL"), and the Apache License version 2 ("ASL").
@@ -416,22 +417,13 @@ void publishToStreamConsumeFromStreamQueue(Codec codec, TestInfo info) {
416417
d -> {
417418
assertThat(d.getProperties().getMessageId()).isNull();
418419
assertThat(d.getProperties().getCorrelationId()).isNull();
419-
assertThat(
420-
d.getProperties()
421-
.getHeaders()
422-
.get("x-message-id")
423-
.toString()
424-
.getBytes(UTF8))
420+
assertThat(d.getProperties().getHeaders().get("x-message-id"))
425421
.isEqualTo("the message ID".getBytes(UTF8));
426-
assertThat(
427-
d.getProperties()
428-
.getHeaders()
429-
.get("x-correlation-id")
430-
.toString()
431-
.getBytes(UTF8))
422+
assertThat(d.getProperties().getHeaders().get("x-correlation-id"))
432423
.isEqualTo("the correlation ID".getBytes(UTF8));
433424
}),
434425
mo(
426+
BEFORE_MESSAGE_CONTAINERS,
435427
mb -> {
436428
mb.properties()
437429
.messageId(
@@ -454,6 +446,27 @@ void publishToStreamConsumeFromStreamQueue(Codec codec, TestInfo info) {
454446
"x-correlation-id",
455447
LongStringHelper.asLongString(
456448
StringUtils.repeat("b", 300).getBytes(UTF8)));
449+
}),
450+
mo(
451+
AFTER_MESSAGE_CONTAINERS,
452+
mb -> {
453+
mb.properties()
454+
.messageId(
455+
StringUtils.repeat("a", 300)
456+
.getBytes(UTF8)); // larger than 091 shortstr
457+
mb.properties()
458+
.correlationId(
459+
StringUtils.repeat("b", 300)
460+
.getBytes(UTF8)); // larger than 091 shortstr
461+
},
462+
d -> {
463+
assertThat(d.getProperties().getMessageId()).isNull();
464+
assertThat(d.getProperties().getCorrelationId()).isNull();
465+
assertThat(d.getProperties().getHeaders())
466+
.containsEntry(
467+
"x-message-id", StringUtils.repeat("a", 300).getBytes(UTF8))
468+
.containsEntry(
469+
"x-correlation-id", StringUtils.repeat("b", 300).getBytes(UTF8));
457470
}));
458471

459472
testMessageOperations

0 commit comments

Comments
 (0)