This is an automated email from the ASF dual-hosted git repository. xyz pushed a commit to branch branch-3.0 in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/branch-3.0 by this push: new 7636e8989f4 [fix][client] Fix breaking changes for the deprecated methods of TopicMessageIdImpl (#20163) 7636e8989f4 is described below commit 7636e8989f4d3fc24fce69a356d54e1c550945ed Author: Yunze Xu <xyzinfern...@163.com> AuthorDate: Sat Apr 22 10:58:05 2023 +0800 [fix][client] Fix breaking changes for the deprecated methods of TopicMessageIdImpl (#20163) (cherry picked from commit 6036dcce8d48f8e1ae311153eeb625f51c5aa827) --- .../java/org/apache/pulsar/client/impl/TopicMessageIdImpl.java | 2 +- .../org/apache/pulsar/client/impl/TopicMessageIdImplTest.java | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/TopicMessageIdImpl.java b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/TopicMessageIdImpl.java index 00fe12b62b1..3dc9b23e93e 100644 --- a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/TopicMessageIdImpl.java +++ b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/TopicMessageIdImpl.java @@ -62,7 +62,7 @@ public class TopicMessageIdImpl implements MessageIdAdv, TopicMessageId { @Deprecated public MessageId getInnerMessageId() { - return new MessageIdImpl(getLedgerId(), getEntryId(), getPartitionIndex()); + return msgId; } @Override diff --git a/pulsar-client/src/test/java/org/apache/pulsar/client/impl/TopicMessageIdImplTest.java b/pulsar-client/src/test/java/org/apache/pulsar/client/impl/TopicMessageIdImplTest.java index daf49f0e775..1ddd47af91d 100644 --- a/pulsar-client/src/test/java/org/apache/pulsar/client/impl/TopicMessageIdImplTest.java +++ b/pulsar-client/src/test/java/org/apache/pulsar/client/impl/TopicMessageIdImplTest.java @@ -20,6 +20,7 @@ package org.apache.pulsar.client.impl; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNotEquals; +import static org.testng.Assert.assertSame; import org.testng.annotations.Test; @@ -54,4 +55,12 @@ public class TopicMessageIdImplTest { assertNotEquals(topicMsgId1, topicMsgId2); } + @Test + public void testDeprecatedMethods() { + BatchMessageIdImpl msgId = new BatchMessageIdImpl(1, 2, 3, 4); + TopicMessageIdImpl topicMsgId = new TopicMessageIdImpl("topic-partition-0", "topic", msgId); + assertSame(topicMsgId.getInnerMessageId(), msgId); + assertEquals(topicMsgId.getTopicPartitionName(), topicMsgId.getOwnerTopic()); + assertEquals(topicMsgId.getTopicName(), "topic"); + } }