forked from apache/rocketmq
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
guyinyou
committed
Oct 10, 2023
1 parent
38d3d5d
commit 7c0da89
Showing
8 changed files
with
274 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
common/src/test/java/org/apache/rocketmq/common/MessageExtBrokerInnerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
package org.apache.rocketmq.common; | ||
|
||
import org.apache.rocketmq.common.message.MessageExtBrokerInner; | ||
import org.junit.Test; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
public class MessageExtBrokerInnerTest { | ||
@Test | ||
public void testDeleteProperty() { | ||
MessageExtBrokerInner messageExtBrokerInner = new MessageExtBrokerInner(); | ||
String propertiesString = ""; | ||
messageExtBrokerInner.setPropertiesString(propertiesString); | ||
messageExtBrokerInner.deleteProperty("KeyA"); | ||
assertThat(messageExtBrokerInner.getPropertiesString()).isEqualTo(""); | ||
|
||
propertiesString = "KeyA\u0001ValueA"; | ||
messageExtBrokerInner.setPropertiesString(propertiesString); | ||
messageExtBrokerInner.deleteProperty("KeyA"); | ||
assertThat(messageExtBrokerInner.getPropertiesString()).isEqualTo(""); | ||
|
||
propertiesString = "KeyA\u0001ValueA\u0002"; | ||
messageExtBrokerInner.setPropertiesString(propertiesString); | ||
messageExtBrokerInner.deleteProperty("KeyA"); | ||
assertThat(messageExtBrokerInner.getPropertiesString()).isEqualTo(""); | ||
|
||
propertiesString = "KeyA\u0001ValueA\u0002KeyA\u0001ValueA"; | ||
messageExtBrokerInner.setPropertiesString(propertiesString); | ||
messageExtBrokerInner.deleteProperty("KeyA"); | ||
assertThat(messageExtBrokerInner.getPropertiesString()).isEqualTo(""); | ||
|
||
propertiesString = "KeyA\u0001ValueA\u0002KeyA\u0001ValueA\u0002"; | ||
messageExtBrokerInner.setPropertiesString(propertiesString); | ||
messageExtBrokerInner.deleteProperty("KeyA"); | ||
assertThat(messageExtBrokerInner.getPropertiesString()).isEqualTo(""); | ||
|
||
propertiesString = "KeyB\u0001ValueB\u0002KeyA\u0001ValueA"; | ||
messageExtBrokerInner.setPropertiesString(propertiesString); | ||
messageExtBrokerInner.deleteProperty("KeyA"); | ||
assertThat(messageExtBrokerInner.getPropertiesString()).isEqualTo("KeyB\u0001ValueB\u0002"); | ||
|
||
propertiesString = "KeyB\u0001ValueB\u0002KeyA\u0001ValueA\u0002"; | ||
messageExtBrokerInner.setPropertiesString(propertiesString); | ||
messageExtBrokerInner.deleteProperty("KeyA"); | ||
assertThat(messageExtBrokerInner.getPropertiesString()).isEqualTo("KeyB\u0001ValueB\u0002"); | ||
|
||
propertiesString = "KeyB\u0001ValueB\u0002KeyA\u0001ValueA\u0002KeyB\u0001ValueB\u0002"; | ||
messageExtBrokerInner.setPropertiesString(propertiesString); | ||
messageExtBrokerInner.deleteProperty("KeyA"); | ||
assertThat(messageExtBrokerInner.getPropertiesString()).isEqualTo("KeyB\u0001ValueB\u0002KeyB\u0001ValueB\u0002"); | ||
|
||
propertiesString = "KeyA\u0001ValueA\u0002KeyB\u0001ValueB\u0002"; | ||
messageExtBrokerInner.setPropertiesString(propertiesString); | ||
messageExtBrokerInner.deleteProperty("KeyA"); | ||
assertThat(messageExtBrokerInner.getPropertiesString()).isEqualTo("KeyB\u0001ValueB\u0002"); | ||
|
||
propertiesString = "KeyA\u0001ValueA\u0002KeyB\u0001ValueB"; | ||
messageExtBrokerInner.setPropertiesString(propertiesString); | ||
messageExtBrokerInner.deleteProperty("KeyA"); | ||
assertThat(messageExtBrokerInner.getPropertiesString()).isEqualTo("KeyB\u0001ValueB"); | ||
|
||
propertiesString = "KeyA\u0001ValueA\u0002KeyB\u0001ValueBKeyA\u0001ValueA\u0002"; | ||
messageExtBrokerInner.setPropertiesString(propertiesString); | ||
messageExtBrokerInner.deleteProperty("KeyA"); | ||
assertThat(messageExtBrokerInner.getPropertiesString()).isEqualTo("KeyB\u0001ValueBKeyA\u0001ValueA\u0002"); | ||
|
||
propertiesString = "KeyA\u0001ValueA\u0002KeyB\u0001ValueBKeyA\u0001"; | ||
messageExtBrokerInner.setPropertiesString(propertiesString); | ||
messageExtBrokerInner.deleteProperty("KeyA"); | ||
assertThat(messageExtBrokerInner.getPropertiesString()).isEqualTo("KeyB\u0001ValueBKeyA\u0001"); | ||
|
||
propertiesString = "KeyA\u0001ValueA\u0002KeyB\u0001ValueBKeyA"; | ||
messageExtBrokerInner.setPropertiesString(propertiesString); | ||
messageExtBrokerInner.deleteProperty("KeyA"); | ||
assertThat(messageExtBrokerInner.getPropertiesString()).isEqualTo("KeyB\u0001ValueBKeyA"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.