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

Commit

Permalink
Fix NamespaceClient.GetNamespaceInfoAsync() (#638)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
SeanFeldman authored Feb 12, 2019
1 parent da12ac5 commit a4e4abb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,19 @@ private static NamespaceInfo ParseFromEntryElement(XElement xEntry)
case "Alias":
nsInfo.Alias = element.Value;
break;
case "MessagingUnits":
int.TryParse(element.Value, out var units);
nsInfo.MessagingUnits = units;
break;
case "NamespaceType":
if (Enum.TryParse<NamespaceType>(element.Value, out var nsType))
{
nsInfo.NamespaceType = nsType;
}
else if (element.Value == "Messaging") // TODO: workaround till next major as it's a breaking change
{
nsInfo.NamespaceType = NamespaceType.ServiceBus;
}
else
{
nsInfo.NamespaceType = NamespaceType.Others;
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.Azure.ServiceBus/Management/NamespaceType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public enum NamespaceType

/// <summary>
/// Supported only for backward compatibility.
/// Namespace can contain mixture of messaging entities and notification hubs.
/// Namespace can contain mixture of messaging entities and notification hubs.
/// </summary>
Mixed = 2,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,8 @@ public async Task GetNamespaceInfoTest()
{
var nsInfo = await client.GetNamespaceInfoAsync();
Assert.NotNull(nsInfo);
Assert.Equal(MessagingSku.Standard, nsInfo.MessagingSku); // Most CI systems generally use standard, hence this check just to ensure the API is working.
Assert.Equal(MessagingSku.Standard, nsInfo.MessagingSku); // Most CI systems generally use standard, hence this check just to ensure the API is working.
Assert.Equal(NamespaceType.ServiceBus, nsInfo.NamespaceType); // Common namespace type used for testing is messaging.
}

public void Dispose()
Expand Down

0 comments on commit a4e4abb

Please sign in to comment.