mirror of https://github.com/dapr/dotnet-sdk.git
topicmetadata should allow adding empty strings (#940)
* topicmetadata should allow adding empty strings Signed-off-by: saberwang <saberwang@hotmail.com> * fix test errors Signed-off-by: saberwang <saberwang@hotmail.com>
This commit is contained in:
parent
2ab1b7cee0
commit
0998b0dd4d
|
|
@ -29,7 +29,7 @@ namespace Dapr
|
||||||
public TopicMetadataAttribute(string name, string value)
|
public TopicMetadataAttribute(string name, string value)
|
||||||
{
|
{
|
||||||
ArgumentVerifier.ThrowIfNullOrEmpty(name, nameof(name));
|
ArgumentVerifier.ThrowIfNullOrEmpty(name, nameof(name));
|
||||||
ArgumentVerifier.ThrowIfNullOrEmpty(value, nameof(value));
|
ArgumentVerifier.ThrowIfNull(value, nameof(value));
|
||||||
Name = name;
|
Name = name;
|
||||||
Value = value;
|
Value = value;
|
||||||
}
|
}
|
||||||
|
|
@ -44,7 +44,7 @@ namespace Dapr
|
||||||
{
|
{
|
||||||
ArgumentVerifier.ThrowIfNullOrEmpty(id, nameof(name));
|
ArgumentVerifier.ThrowIfNullOrEmpty(id, nameof(name));
|
||||||
ArgumentVerifier.ThrowIfNullOrEmpty(name, nameof(name));
|
ArgumentVerifier.ThrowIfNullOrEmpty(name, nameof(name));
|
||||||
ArgumentVerifier.ThrowIfNullOrEmpty(value, nameof(value));
|
ArgumentVerifier.ThrowIfNull(value, nameof(value));
|
||||||
Id = id;
|
Id = id;
|
||||||
Name = name;
|
Name = name;
|
||||||
Value = value;
|
Value = value;
|
||||||
|
|
|
||||||
|
|
@ -92,6 +92,14 @@ namespace Dapr.AspNetCore.IntegrationTest.App
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Topic("pubsub", "metadataseparatorbyemptytring")]
|
||||||
|
[HttpPost("/topicmetadataseparatorattrbyemptytring")]
|
||||||
|
[TopicMetadata("n1", "v1")]
|
||||||
|
[TopicMetadata("n1", "")]
|
||||||
|
public void TopicMetadataSeparatorByemptytring ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
[Topic("pubsub", "splitTopicAttr", true)]
|
[Topic("pubsub", "splitTopicAttr", true)]
|
||||||
[HttpPost("/splitTopics")]
|
[HttpPost("/splitTopics")]
|
||||||
public void SplitTopic()
|
public void SplitTopic()
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ namespace Dapr.AspNetCore.IntegrationTest
|
||||||
var json = await JsonSerializer.DeserializeAsync<JsonElement>(stream);
|
var json = await JsonSerializer.DeserializeAsync<JsonElement>(stream);
|
||||||
|
|
||||||
json.ValueKind.Should().Be(JsonValueKind.Array);
|
json.ValueKind.Should().Be(JsonValueKind.Array);
|
||||||
json.GetArrayLength().Should().Be(17);
|
json.GetArrayLength().Should().Be(18);
|
||||||
|
|
||||||
var subscriptions = new List<(string PubsubName, string Topic, string Route, string rawPayload, string match, string metadata, string DeadLetterTopic)>();
|
var subscriptions = new List<(string PubsubName, string Topic, string Route, string rawPayload, string match, string metadata, string DeadLetterTopic)>();
|
||||||
|
|
||||||
|
|
@ -116,7 +116,7 @@ namespace Dapr.AspNetCore.IntegrationTest
|
||||||
subscriptions.Should().Contain(("pubsub", "metadata", "multiMetadataTopicAttr", string.Empty, string.Empty, "n1=v1;n2=v2,v3", string.Empty));
|
subscriptions.Should().Contain(("pubsub", "metadata", "multiMetadataTopicAttr", string.Empty, string.Empty, "n1=v1;n2=v2,v3", string.Empty));
|
||||||
subscriptions.Should().Contain(("pubsub", "metadata.1", "multiMetadataTopicAttr", "true", string.Empty, "n1=v1", string.Empty));
|
subscriptions.Should().Contain(("pubsub", "metadata.1", "multiMetadataTopicAttr", "true", string.Empty, "n1=v1", string.Empty));
|
||||||
subscriptions.Should().Contain(("pubsub", "splitMetadataTopicBuilder", "splitMetadataTopics", string.Empty, string.Empty, "n1=v1;n2=v1", string.Empty));
|
subscriptions.Should().Contain(("pubsub", "splitMetadataTopicBuilder", "splitMetadataTopics", string.Empty, string.Empty, "n1=v1;n2=v1", string.Empty));
|
||||||
|
subscriptions.Should().Contain(("pubsub", "metadataseparatorbyemptytring", "topicmetadataseparatorattrbyemptytring", string.Empty, string.Empty, "n1=v1,", string.Empty));
|
||||||
// Test priority route sorting
|
// Test priority route sorting
|
||||||
var eTopic = subscriptions.FindAll(e => e.Topic == "E");
|
var eTopic = subscriptions.FindAll(e => e.Topic == "E");
|
||||||
eTopic.Count.Should().Be(3);
|
eTopic.Count.Should().Be(3);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue