Skip to content

Commit ed65854

Browse files
Revert "Merge pull request #828 from ig-sinicyn/feature/message-properties-do-not-throw"
This reverts commit 7ed249c, reversing changes made to c9e36dc.
1 parent 7ed249c commit ed65854

File tree

4 files changed

+8
-49
lines changed

4 files changed

+8
-49
lines changed

projects/RabbitMQ.Client/client/api/PublicationAddress.cs

-8
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,6 @@ public PublicationAddress(string exchangeType, string exchangeName, string routi
106106
/// </summary>
107107
public static PublicationAddress Parse(string uriLikeString)
108108
{
109-
// Callers such as IBasicProperties.ReplyToAddress
110-
// expect null result for invalid input.
111-
// The regex.Match() throws on null arguments so we perform explicit check here
112-
if (uriLikeString == null)
113-
{
114-
return null;
115-
}
116-
117109
Match match = PSEUDO_URI_PARSER.Match(uriLikeString);
118110
if (match.Success)
119111
{

projects/Unit/TestBasicProperties.cs

-31
Original file line numberDiff line numberDiff line change
@@ -120,36 +120,5 @@ public void TestNullableProperties_CanWrite(
120120
Assert.AreEqual(isCorrelationIdPresent, propertiesFromStream.IsCorrelationIdPresent());
121121
Assert.AreEqual(isMessageIdPresent, propertiesFromStream.IsMessageIdPresent());
122122
}
123-
124-
[Test]
125-
public void TestProperties_ReplyTo(
126-
[Values(null, "foo_1", "fanout://name/key")] string replyTo
127-
)
128-
{
129-
// Arrange
130-
var subject = new Framing.BasicProperties
131-
{
132-
133-
// Act
134-
ReplyTo = replyTo,
135-
};
136-
137-
// Assert
138-
bool isReplyToPresent = replyTo != null;
139-
string replyToAddress = PublicationAddress.Parse(replyTo)?.ToString();
140-
Assert.AreEqual(isReplyToPresent, subject.IsReplyToPresent());
141-
142-
var writer = new Impl.ContentHeaderPropertyWriter(new byte[1024]);
143-
subject.WritePropertiesTo(ref writer);
144-
145-
// Read from Stream
146-
var propertiesFromStream = new Framing.BasicProperties();
147-
var reader = new Impl.ContentHeaderPropertyReader(writer.Memory.Slice(0, writer.Offset));
148-
propertiesFromStream.ReadPropertiesFrom(ref reader);
149-
150-
Assert.AreEqual(replyTo, propertiesFromStream.ReplyTo);
151-
Assert.AreEqual(isReplyToPresent, propertiesFromStream.IsReplyToPresent());
152-
Assert.AreEqual(replyToAddress, propertiesFromStream.ReplyToAddress?.ToString());
153-
}
154123
}
155124
}

projects/Unit/TestPropertiesClone.cs

+8-9
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,10 @@ private void TestBasicPropertiesClone(BasicProperties bp)
6868
bp.ContentType = "foo_1";
6969
bp.ContentEncoding = "foo_2";
7070
bp.Headers = new Dictionary<string, object>
71-
{
72-
{ "foo_3", "foo_4" },
73-
{ "foo_5", "foo_6" }
74-
};
71+
{
72+
{ "foo_3", "foo_4" },
73+
{ "foo_5", "foo_6" }
74+
};
7575
bp.DeliveryMode = 2;
7676
// Persistent also changes DeliveryMode's value to 2
7777
bp.Persistent = true;
@@ -123,7 +123,6 @@ private void TestBasicPropertiesClone(BasicProperties bp)
123123
Assert.AreEqual(12, bpClone.Priority);
124124
Assert.AreEqual("foo_7", bpClone.CorrelationId);
125125
Assert.AreEqual("foo_8", bpClone.ReplyTo);
126-
Assert.AreEqual(null, bpClone.ReplyToAddress);
127126
Assert.AreEqual("foo_9", bpClone.Expiration);
128127
Assert.AreEqual("foo_10", bpClone.MessageId);
129128
Assert.AreEqual(new AmqpTimestamp(123), bpClone.Timestamp);
@@ -142,10 +141,10 @@ private void TestBasicPropertiesNoneClone(BasicProperties bp)
142141
bp.ContentType = "foo_1";
143142
bp.ContentEncoding = "foo_2";
144143
bp.Headers = new Dictionary<string, object>
145-
{
146-
{ "foo_3", "foo_4" },
147-
{ "foo_5", "foo_6" }
148-
};
144+
{
145+
{ "foo_3", "foo_4" },
146+
{ "foo_5", "foo_6" }
147+
};
149148
bp.DeliveryMode = 2;
150149
// Persistent also changes DeliveryMode's value to 2
151150
bp.Persistent = true;

projects/Unit/TestPublicationAddress.cs

-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ public void TestParseOk()
5959
[Test]
6060
public void TestParseFail()
6161
{
62-
Assert.IsNull(PublicationAddress.Parse(null));
6362
Assert.IsNull(PublicationAddress.Parse("not a valid uri"));
6463
}
6564

0 commit comments

Comments
 (0)