Skip to content
This repository was archived by the owner on Oct 12, 2023. It is now read-only.

Commit a4e4abb

Browse files
authored
Fix NamespaceClient.GetNamespaceInfoAsync() (#638)
* Parse out MessagingUnits * Add Messaging type as that's what broker reports * Update test for GetNamespaceInfoAsync * Approve API (minor) * Revert "Approve API (minor)" This reverts commit dd9b298. * Remove NamespaceType.Messaging * Implement workaround
1 parent da12ac5 commit a4e4abb

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

src/Microsoft.Azure.ServiceBus/Management/NamespaceInfoExtensions.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,19 @@ private static NamespaceInfo ParseFromEntryElement(XElement xEntry)
5757
case "Alias":
5858
nsInfo.Alias = element.Value;
5959
break;
60+
case "MessagingUnits":
61+
int.TryParse(element.Value, out var units);
62+
nsInfo.MessagingUnits = units;
63+
break;
6064
case "NamespaceType":
6165
if (Enum.TryParse<NamespaceType>(element.Value, out var nsType))
6266
{
6367
nsInfo.NamespaceType = nsType;
6468
}
69+
else if (element.Value == "Messaging") // TODO: workaround till next major as it's a breaking change
70+
{
71+
nsInfo.NamespaceType = NamespaceType.ServiceBus;
72+
}
6573
else
6674
{
6775
nsInfo.NamespaceType = NamespaceType.Others;

src/Microsoft.Azure.ServiceBus/Management/NamespaceType.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public enum NamespaceType
1515

1616
/// <summary>
1717
/// Supported only for backward compatibility.
18-
/// Namespace can contain mixture of messaging entities and notification hubs.
18+
/// Namespace can contain mixture of messaging entities and notification hubs.
1919
/// </summary>
2020
Mixed = 2,
2121

test/Microsoft.Azure.ServiceBus.UnitTests/Management/ManagementClientTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,8 @@ public async Task GetNamespaceInfoTest()
639639
{
640640
var nsInfo = await client.GetNamespaceInfoAsync();
641641
Assert.NotNull(nsInfo);
642-
Assert.Equal(MessagingSku.Standard, nsInfo.MessagingSku); // Most CI systems generally use standard, hence this check just to ensure the API is working.
642+
Assert.Equal(MessagingSku.Standard, nsInfo.MessagingSku); // Most CI systems generally use standard, hence this check just to ensure the API is working.
643+
Assert.Equal(NamespaceType.ServiceBus, nsInfo.NamespaceType); // Common namespace type used for testing is messaging.
643644
}
644645

645646
public void Dispose()

0 commit comments

Comments
 (0)