From 255517749b4bc452ba55cebfc09190582706b8e7 Mon Sep 17 00:00:00 2001 From: Hemant Tanwar Date: Thu, 19 Nov 2020 23:37:46 -0800 Subject: [PATCH] Rename getAmqpAnnotatedMessage to getRawAmqpMessage (#17712) Rename getAmqpAnnotatedMessage to getRawAmqpMessage --- .../servicebus/ServiceBusMessage.java | 18 +++--- .../ServiceBusMessageSerializer.java | 10 +-- .../servicebus/ServiceBusReceivedMessage.java | 4 +- .../ServiceBusMessageSerializerTest.java | 6 +- .../servicebus/ServiceBusMessageTest.java | 64 +++++++++---------- .../ServiceBusReceivedMessageTest.java | 12 ++-- ...BusReceiverAsyncClientIntegrationTest.java | 4 +- 7 files changed, 59 insertions(+), 59 deletions(-) diff --git a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusMessage.java b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusMessage.java index 661fa7f84c47d..60462b6992166 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusMessage.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusMessage.java @@ -115,11 +115,11 @@ public ServiceBusMessage(BinaryData body) { public ServiceBusMessage(ServiceBusReceivedMessage receivedMessage) { Objects.requireNonNull(receivedMessage, "'receivedMessage' cannot be null."); - final AmqpMessageBodyType bodyType = receivedMessage.getAmqpAnnotatedMessage().getBody().getBodyType(); + final AmqpMessageBodyType bodyType = receivedMessage.getRawAmqpMessage().getBody().getBodyType(); AmqpMessageBody amqpMessageBody; switch (bodyType) { case DATA: - amqpMessageBody = AmqpMessageBody.fromData(receivedMessage.getAmqpAnnotatedMessage().getBody() + amqpMessageBody = AmqpMessageBody.fromData(receivedMessage.getRawAmqpMessage().getBody() .getFirstData()); break; case SEQUENCE: @@ -136,7 +136,7 @@ public ServiceBusMessage(ServiceBusReceivedMessage receivedMessage) { this.amqpAnnotatedMessage = new AmqpAnnotatedMessage(amqpMessageBody); // set properties - final AmqpMessageProperties receivedProperties = receivedMessage.getAmqpAnnotatedMessage().getProperties(); + final AmqpMessageProperties receivedProperties = receivedMessage.getRawAmqpMessage().getProperties(); final AmqpMessageProperties newProperties = amqpAnnotatedMessage.getProperties(); newProperties.setMessageId(receivedProperties.getMessageId()); newProperties.setUserId(receivedProperties.getUserId()); @@ -153,7 +153,7 @@ public ServiceBusMessage(ServiceBusReceivedMessage receivedMessage) { newProperties.setReplyToGroupId(receivedProperties.getReplyToGroupId()); // copy header except for delivery count which should be set to null - final AmqpMessageHeader receivedHeader = receivedMessage.getAmqpAnnotatedMessage().getHeader(); + final AmqpMessageHeader receivedHeader = receivedMessage.getRawAmqpMessage().getHeader(); final AmqpMessageHeader newHeader = this.amqpAnnotatedMessage.getHeader(); newHeader.setPriority(receivedHeader.getPriority()); newHeader.setTimeToLive(receivedHeader.getTimeToLive()); @@ -161,7 +161,7 @@ public ServiceBusMessage(ServiceBusReceivedMessage receivedMessage) { newHeader.setFirstAcquirer(receivedHeader.isFirstAcquirer()); // copy message annotations except for broker set ones - final Map receivedAnnotations = receivedMessage.getAmqpAnnotatedMessage() + final Map receivedAnnotations = receivedMessage.getRawAmqpMessage() .getMessageAnnotations(); final Map newAnnotations = this.amqpAnnotatedMessage.getMessageAnnotations(); @@ -178,7 +178,7 @@ public ServiceBusMessage(ServiceBusReceivedMessage receivedMessage) { } // copy delivery annotations - final Map receivedDelivery = receivedMessage.getAmqpAnnotatedMessage().getDeliveryAnnotations(); + final Map receivedDelivery = receivedMessage.getRawAmqpMessage().getDeliveryAnnotations(); final Map newDelivery = this.amqpAnnotatedMessage.getDeliveryAnnotations(); for (Map.Entry entry: receivedDelivery.entrySet()) { @@ -186,7 +186,7 @@ public ServiceBusMessage(ServiceBusReceivedMessage receivedMessage) { } // copy Footer - final Map receivedFooter = receivedMessage.getAmqpAnnotatedMessage().getFooter(); + final Map receivedFooter = receivedMessage.getRawAmqpMessage().getFooter(); final Map newFooter = this.amqpAnnotatedMessage.getFooter(); for (Map.Entry entry: receivedFooter.entrySet()) { @@ -194,7 +194,7 @@ public ServiceBusMessage(ServiceBusReceivedMessage receivedMessage) { } // copy application properties except for broker set ones - final Map receivedApplicationProperties = receivedMessage.getAmqpAnnotatedMessage() + final Map receivedApplicationProperties = receivedMessage.getRawAmqpMessage() .getApplicationProperties(); final Map newApplicationProperties = this.amqpAnnotatedMessage.getApplicationProperties(); @@ -215,7 +215,7 @@ public ServiceBusMessage(ServiceBusReceivedMessage receivedMessage) { * * @return the amqp message. */ - public AmqpAnnotatedMessage getAmqpAnnotatedMessage() { + public AmqpAnnotatedMessage getRawAmqpMessage() { return amqpAnnotatedMessage; } diff --git a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusMessageSerializer.java b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusMessageSerializer.java index b40757aec219e..e9d59f9deed10 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusMessageSerializer.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusMessageSerializer.java @@ -148,7 +148,7 @@ public Message serialize(T object) { amqpMessage.setReplyToGroupId(brokeredMessage.getReplyToSessionId()); amqpMessage.setGroupId(brokeredMessage.getSessionId()); - final AmqpMessageProperties brokeredProperties = brokeredMessage.getAmqpAnnotatedMessage().getProperties(); + final AmqpMessageProperties brokeredProperties = brokeredMessage.getRawAmqpMessage().getProperties(); amqpMessage.setContentEncoding(brokeredProperties.getContentEncoding()); if (brokeredProperties.getGroupSequence() != null) { @@ -166,10 +166,10 @@ public Message serialize(T object) { } //set footer - amqpMessage.setFooter(new Footer(brokeredMessage.getAmqpAnnotatedMessage().getFooter())); + amqpMessage.setFooter(new Footer(brokeredMessage.getRawAmqpMessage().getFooter())); //set header - AmqpMessageHeader header = brokeredMessage.getAmqpAnnotatedMessage().getHeader(); + AmqpMessageHeader header = brokeredMessage.getRawAmqpMessage().getHeader(); if (header.getDeliveryCount() != null) { amqpMessage.setDeliveryCount(header.getDeliveryCount()); } @@ -203,7 +203,7 @@ public Message serialize(T object) { // Set Delivery Annotations. final Map deliveryAnnotationsMap = new HashMap<>(); - final Map deliveryAnnotations = brokeredMessage.getAmqpAnnotatedMessage() + final Map deliveryAnnotations = brokeredMessage.getRawAmqpMessage() .getDeliveryAnnotations(); for (Map.Entry deliveryEntry : deliveryAnnotations.entrySet()) { deliveryAnnotationsMap.put(Symbol.valueOf(deliveryEntry.getKey()), deliveryEntry.getValue()); @@ -355,7 +355,7 @@ private ServiceBusReceivedMessage deserializeMessage(Message amqpMessage) { bytes = EMPTY_BYTE_ARRAY; } final ServiceBusReceivedMessage brokeredMessage = new ServiceBusReceivedMessage(BinaryData.fromBytes(bytes)); - AmqpAnnotatedMessage brokeredAmqpAnnotatedMessage = brokeredMessage.getAmqpAnnotatedMessage(); + AmqpAnnotatedMessage brokeredAmqpAnnotatedMessage = brokeredMessage.getRawAmqpMessage(); // Application properties ApplicationProperties applicationProperties = amqpMessage.getApplicationProperties(); diff --git a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusReceivedMessage.java b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusReceivedMessage.java index f11dc60bc3302..07eed93959781 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusReceivedMessage.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusReceivedMessage.java @@ -57,7 +57,7 @@ public final class ServiceBusReceivedMessage { * * @return the {@link AmqpAnnotatedMessage} representing amqp message. */ - public AmqpAnnotatedMessage getAmqpAnnotatedMessage() { + public AmqpAnnotatedMessage getRawAmqpMessage() { return amqpAnnotatedMessage; } @@ -407,7 +407,7 @@ public long getSequenceNumber() { * @return Session Id of the {@link ServiceBusReceivedMessage}. */ public String getSessionId() { - return getAmqpAnnotatedMessage().getProperties().getGroupId(); + return getRawAmqpMessage().getProperties().getGroupId(); } /** diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusMessageSerializerTest.java b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusMessageSerializerTest.java index f946aef033442..e4ca2d53fb0c9 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusMessageSerializerTest.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusMessageSerializerTest.java @@ -117,9 +117,9 @@ void deserializeMessage() { assertEquals(message.getContentType(), actualMessage.getContentType()); assertEquals(message.getCorrelationId(), actualMessage.getCorrelationId()); - assertValues(expectedMessageAnnotations, actualMessage.getAmqpAnnotatedMessage().getMessageAnnotations()); - assertValues(expectedDeliveryAnnotations, actualMessage.getAmqpAnnotatedMessage().getDeliveryAnnotations()); - assertValues(expectedFooterValues, actualMessage.getAmqpAnnotatedMessage().getFooter()); + assertValues(expectedMessageAnnotations, actualMessage.getRawAmqpMessage().getMessageAnnotations()); + assertValues(expectedDeliveryAnnotations, actualMessage.getRawAmqpMessage().getDeliveryAnnotations()); + assertValues(expectedFooterValues, actualMessage.getRawAmqpMessage().getFooter()); // Verifying our application properties are the same. assertEquals(APPLICATION_PROPERTIES.size(), actualMessage.getApplicationProperties().size()); diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusMessageTest.java b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusMessageTest.java index 013888fd5889e..989f808518f92 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusMessageTest.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusMessageTest.java @@ -59,12 +59,12 @@ public void copyConstructorTest() { final ServiceBusReceivedMessage expected = new ServiceBusReceivedMessage(PAYLOAD_BINARY); - expected.getAmqpAnnotatedMessage().getMessageAnnotations().put(SEQUENCE_NUMBER_ANNOTATION_NAME.getValue(), "10"); - expected.getAmqpAnnotatedMessage().getMessageAnnotations().put(DEAD_LETTER_SOURCE_KEY_ANNOTATION_NAME.getValue(), "abc"); - expected.getAmqpAnnotatedMessage().getMessageAnnotations().put(ENQUEUED_SEQUENCE_NUMBER_ANNOTATION_NAME.getValue(), "11"); - expected.getAmqpAnnotatedMessage().getMessageAnnotations().put(ENQUEUED_TIME_UTC_ANNOTATION_NAME.getValue(), "11"); - expected.getAmqpAnnotatedMessage().getApplicationProperties().put(DEAD_LETTER_DESCRIPTION_ANNOTATION_NAME.getValue(), "abc"); - expected.getAmqpAnnotatedMessage().getApplicationProperties().put(DEAD_LETTER_REASON_ANNOTATION_NAME.getValue(), "abc"); + expected.getRawAmqpMessage().getMessageAnnotations().put(SEQUENCE_NUMBER_ANNOTATION_NAME.getValue(), "10"); + expected.getRawAmqpMessage().getMessageAnnotations().put(DEAD_LETTER_SOURCE_KEY_ANNOTATION_NAME.getValue(), "abc"); + expected.getRawAmqpMessage().getMessageAnnotations().put(ENQUEUED_SEQUENCE_NUMBER_ANNOTATION_NAME.getValue(), "11"); + expected.getRawAmqpMessage().getMessageAnnotations().put(ENQUEUED_TIME_UTC_ANNOTATION_NAME.getValue(), "11"); + expected.getRawAmqpMessage().getApplicationProperties().put(DEAD_LETTER_DESCRIPTION_ANNOTATION_NAME.getValue(), "abc"); + expected.getRawAmqpMessage().getApplicationProperties().put(DEAD_LETTER_REASON_ANNOTATION_NAME.getValue(), "abc"); expected.setSubject(expectedSubject); expected.setTo(expectedTo); expected.setReplyTo(expectedReplyTo); @@ -74,12 +74,12 @@ public void copyConstructorTest() { expected.setTimeToLive(expectedTimeToLive); expected.setPartitionKey(expectedPartitionKey); - expected.getAmqpAnnotatedMessage().getHeader().setPriority(expectedPriority); + expected.getRawAmqpMessage().getHeader().setPriority(expectedPriority); - final Map expectedFooter = expected.getAmqpAnnotatedMessage().getFooter(); + final Map expectedFooter = expected.getRawAmqpMessage().getFooter(); expectedFooter.put("foo-1", expectedFooterValue); - final Map expectedDeliveryAnnotations = expected.getAmqpAnnotatedMessage().getDeliveryAnnotations(); + final Map expectedDeliveryAnnotations = expected.getRawAmqpMessage().getDeliveryAnnotations(); expectedDeliveryAnnotations.put("da-1", expectedDeliveryAnnotationsValue); final Map expectedApplicationProperties = expected.getApplicationProperties(); @@ -98,14 +98,14 @@ public void copyConstructorTest() { expected.setPartitionKey("new-p-key"); // Change original values - expected.getAmqpAnnotatedMessage().getHeader().setPriority((short) (expectedPriority + 1)); + expected.getRawAmqpMessage().getHeader().setPriority((short) (expectedPriority + 1)); expectedFooter.put("foo-1", expectedFooterValue + "-changed"); - expected.getAmqpAnnotatedMessage().getDeliveryAnnotations().put("da-1", expectedDeliveryAnnotationsValue + "-changed"); - expected.getAmqpAnnotatedMessage().getApplicationProperties().put("ap-1", expectedApplicationValue + "-changed"); + expected.getRawAmqpMessage().getDeliveryAnnotations().put("da-1", expectedDeliveryAnnotationsValue + "-changed"); + expected.getRawAmqpMessage().getApplicationProperties().put("ap-1", expectedApplicationValue + "-changed"); // Assert - assertNotSame(expected.getAmqpAnnotatedMessage(), actual.getAmqpAnnotatedMessage()); + assertNotSame(expected.getRawAmqpMessage(), actual.getRawAmqpMessage()); // Validate updated values assertEquals(expectedSubject, actual.getSubject()); @@ -117,21 +117,21 @@ public void copyConstructorTest() { assertEquals(expectedPartitionKey, actual.getPartitionKey()); // Following values should be reset. - assertNull(actual.getAmqpAnnotatedMessage().getMessageAnnotations().get(LOCKED_UNTIL_KEY_ANNOTATION_NAME.getValue())); - assertNull(actual.getAmqpAnnotatedMessage().getMessageAnnotations().get(SEQUENCE_NUMBER_ANNOTATION_NAME.getValue())); - assertNull(actual.getAmqpAnnotatedMessage().getMessageAnnotations().get(DEAD_LETTER_SOURCE_KEY_ANNOTATION_NAME.getValue())); - assertNull(actual.getAmqpAnnotatedMessage().getMessageAnnotations().get(ENQUEUED_SEQUENCE_NUMBER_ANNOTATION_NAME.getValue())); - assertNull(actual.getAmqpAnnotatedMessage().getMessageAnnotations().get(ENQUEUED_TIME_UTC_ANNOTATION_NAME.getValue())); + assertNull(actual.getRawAmqpMessage().getMessageAnnotations().get(LOCKED_UNTIL_KEY_ANNOTATION_NAME.getValue())); + assertNull(actual.getRawAmqpMessage().getMessageAnnotations().get(SEQUENCE_NUMBER_ANNOTATION_NAME.getValue())); + assertNull(actual.getRawAmqpMessage().getMessageAnnotations().get(DEAD_LETTER_SOURCE_KEY_ANNOTATION_NAME.getValue())); + assertNull(actual.getRawAmqpMessage().getMessageAnnotations().get(ENQUEUED_SEQUENCE_NUMBER_ANNOTATION_NAME.getValue())); + assertNull(actual.getRawAmqpMessage().getMessageAnnotations().get(ENQUEUED_TIME_UTC_ANNOTATION_NAME.getValue())); - assertNull(actual.getAmqpAnnotatedMessage().getApplicationProperties().get(DEAD_LETTER_DESCRIPTION_ANNOTATION_NAME.getValue())); - assertNull(actual.getAmqpAnnotatedMessage().getApplicationProperties().get(DEAD_LETTER_REASON_ANNOTATION_NAME.getValue())); - assertNull(actual.getAmqpAnnotatedMessage().getHeader().getDeliveryCount()); + assertNull(actual.getRawAmqpMessage().getApplicationProperties().get(DEAD_LETTER_DESCRIPTION_ANNOTATION_NAME.getValue())); + assertNull(actual.getRawAmqpMessage().getApplicationProperties().get(DEAD_LETTER_REASON_ANNOTATION_NAME.getValue())); + assertNull(actual.getRawAmqpMessage().getHeader().getDeliveryCount()); // Testing , updating original message did not change copied message values.. - assertEquals(expectedPriority, actual.getAmqpAnnotatedMessage().getHeader().getPriority()); - assertEquals(expectedFooterValue, actual.getAmqpAnnotatedMessage().getFooter().get("foo-1").toString()); - assertEquals(expectedDeliveryAnnotationsValue, actual.getAmqpAnnotatedMessage().getDeliveryAnnotations().get("da-1").toString()); - assertEquals(expectedApplicationValue, actual.getAmqpAnnotatedMessage().getApplicationProperties().get("ap-1").toString()); + assertEquals(expectedPriority, actual.getRawAmqpMessage().getHeader().getPriority()); + assertEquals(expectedFooterValue, actual.getRawAmqpMessage().getFooter().get("foo-1").toString()); + assertEquals(expectedDeliveryAnnotationsValue, actual.getRawAmqpMessage().getDeliveryAnnotations().get("da-1").toString()); + assertEquals(expectedApplicationValue, actual.getRawAmqpMessage().getApplicationProperties().get("ap-1").toString()); } @@ -176,15 +176,15 @@ public void copyConstructorModifyAfterCopyTest() { // Assert // Validate updated values - assertEquals(expectedSubject, originalMessage.getAmqpAnnotatedMessage().getProperties().getSubject()); - assertEquals(expectedTo, originalMessage.getAmqpAnnotatedMessage().getProperties().getTo().toString()); - assertEquals(expectedReplyTo, originalMessage.getAmqpAnnotatedMessage().getProperties().getReplyTo().toString()); - assertEquals(expectedReplyToSessionId, originalMessage.getAmqpAnnotatedMessage().getProperties().getReplyToGroupId()); - assertEquals(expectedCorrelationId, originalMessage.getAmqpAnnotatedMessage().getProperties().getCorrelationId().toString()); + assertEquals(expectedSubject, originalMessage.getRawAmqpMessage().getProperties().getSubject()); + assertEquals(expectedTo, originalMessage.getRawAmqpMessage().getProperties().getTo().toString()); + assertEquals(expectedReplyTo, originalMessage.getRawAmqpMessage().getProperties().getReplyTo().toString()); + assertEquals(expectedReplyToSessionId, originalMessage.getRawAmqpMessage().getProperties().getReplyToGroupId()); + assertEquals(expectedCorrelationId, originalMessage.getRawAmqpMessage().getProperties().getCorrelationId().toString()); - assertEquals(expectedTimeToLive, originalMessage.getAmqpAnnotatedMessage().getHeader().getTimeToLive()); + assertEquals(expectedTimeToLive, originalMessage.getRawAmqpMessage().getHeader().getTimeToLive()); - assertEquals(expectedPartitionKey, originalMessage.getAmqpAnnotatedMessage().getMessageAnnotations().get(PARTITION_KEY_ANNOTATION_NAME.getValue())); + assertEquals(expectedPartitionKey, originalMessage.getRawAmqpMessage().getMessageAnnotations().get(PARTITION_KEY_ANNOTATION_NAME.getValue())); } /** diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusReceivedMessageTest.java b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusReceivedMessageTest.java index d68db35652ce8..510d7a0b2a256 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusReceivedMessageTest.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusReceivedMessageTest.java @@ -106,7 +106,7 @@ public void toServiceBusMessageTest() { originalMessage.setReplyToSessionId("rsessionid"); originalMessage.setSubject("subject"); originalMessage.setTo("to"); - final Map originalMessageAnnotations = originalMessage.getAmqpAnnotatedMessage().getMessageAnnotations(); + final Map originalMessageAnnotations = originalMessage.getRawAmqpMessage().getMessageAnnotations(); originalMessageAnnotations.put(DEAD_LETTER_SOURCE_KEY_ANNOTATION_NAME.getValue(), "message annotations"); originalMessageAnnotations.put(ENQUEUED_SEQUENCE_NUMBER_ANNOTATION_NAME.getValue(), Long.valueOf(3)); originalMessageAnnotations.put(LOCKED_UNTIL_KEY_ANNOTATION_NAME.getValue(), new Date(Instant.now().toEpochMilli())); @@ -114,11 +114,11 @@ public void toServiceBusMessageTest() { originalMessageAnnotations.put(SEQUENCE_NUMBER_ANNOTATION_NAME.getValue(), Long.valueOf(3)); - final Map originalApplicationProperties = originalMessage.getAmqpAnnotatedMessage().getApplicationProperties(); + final Map originalApplicationProperties = originalMessage.getRawAmqpMessage().getApplicationProperties(); originalApplicationProperties.put(DEAD_LETTER_DESCRIPTION_ANNOTATION_NAME.getValue(), "description"); originalApplicationProperties.put(DEAD_LETTER_REASON_ANNOTATION_NAME.getValue(), "description"); - originalMessage.getAmqpAnnotatedMessage().getHeader().setDeliveryCount(Long.valueOf(5)); + originalMessage.getRawAmqpMessage().getHeader().setDeliveryCount(Long.valueOf(5)); // Act final ServiceBusMessage actual = new ServiceBusMessage(originalMessage); @@ -137,14 +137,14 @@ public void toServiceBusMessageTest() { assertEquals(originalMessage.getTo(), actual.getTo()); // Following values should be cleaned up. - assertNullValues(actual.getAmqpAnnotatedMessage().getMessageAnnotations(), DEAD_LETTER_SOURCE_KEY_ANNOTATION_NAME, + assertNullValues(actual.getRawAmqpMessage().getMessageAnnotations(), DEAD_LETTER_SOURCE_KEY_ANNOTATION_NAME, ENQUEUED_SEQUENCE_NUMBER_ANNOTATION_NAME, LOCKED_UNTIL_KEY_ANNOTATION_NAME, SEQUENCE_NUMBER_ANNOTATION_NAME, ENQUEUED_TIME_UTC_ANNOTATION_NAME); - assertNullValues(actual.getAmqpAnnotatedMessage().getApplicationProperties(), DEAD_LETTER_DESCRIPTION_ANNOTATION_NAME, + assertNullValues(actual.getRawAmqpMessage().getApplicationProperties(), DEAD_LETTER_DESCRIPTION_ANNOTATION_NAME, DEAD_LETTER_REASON_ANNOTATION_NAME); - assertNull(actual.getAmqpAnnotatedMessage().getHeader().getDeliveryCount()); + assertNull(actual.getRawAmqpMessage().getHeader().getDeliveryCount()); } public void assertNullValues(Map dataMap, AmqpMessageConstant... keys) { diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusReceiverAsyncClientIntegrationTest.java b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusReceiverAsyncClientIntegrationTest.java index 86bca3652b76c..02adb5a6b5675 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusReceiverAsyncClientIntegrationTest.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusReceiverAsyncClientIntegrationTest.java @@ -1038,7 +1038,7 @@ void receiveAndValidateProperties(MessagingEntityType entityType) { final ServiceBusMessage message = TestUtils.getServiceBusMessage(CONTENTS_BYTES, messageId); - final AmqpAnnotatedMessage amqpAnnotatedMessage = message.getAmqpAnnotatedMessage(); + final AmqpAnnotatedMessage amqpAnnotatedMessage = message.getRawAmqpMessage(); amqpAnnotatedMessage.getMessageAnnotations().putAll(expectedAmqpProperties.getMessageAnnotations()); amqpAnnotatedMessage.getApplicationProperties().putAll(expectedAmqpProperties.getApplicationProperties()); amqpAnnotatedMessage.getDeliveryAnnotations().putAll(expectedAmqpProperties.getDeliveryAnnotations()); @@ -1071,7 +1071,7 @@ void receiveAndValidateProperties(MessagingEntityType entityType) { StepVerifier.create(receiver.receiveMessages()) .assertNext(received -> { assertNotNull(received.getLockToken()); - AmqpAnnotatedMessage actual = received.getAmqpAnnotatedMessage(); + AmqpAnnotatedMessage actual = received.getRawAmqpMessage(); try { assertArrayEquals(CONTENTS_BYTES, message.getBody().toBytes()); assertEquals(expectedAmqpProperties.getHeader().getPriority(), actual.getHeader().getPriority());