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

Commit 6cc56bd

Browse files
authored
Merge pull request #172 from Azure/dev
0.0.6-preview Release
2 parents 9c4f5e5 + 6371331 commit 6cc56bd

File tree

65 files changed

+2893
-432
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+2893
-432
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,4 +202,5 @@ Buildx86retail.dat
202202

203203
#OpenCover
204204
/build/OpenCoverReport/*
205-
/build/coverage.xml
205+
/build/coverage.xml
206+
test/Microsoft.Azure.ServiceBus.UnitTests/API/ApiApprovals.ApproveAzureServiceBus.received.txt

LICENSE

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
MIT License
1+
MIT License
22

33
Copyright © Microsoft Corporation 2016
44

@@ -18,4 +18,8 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
21+
SOFTWARE.
22+
23+
Third Party Programs: The software may include third party programs that Microsoft, not the third party,
24+
licenses to you under this agreement. Notices, if any, for the third party programs are included for your
25+
information only.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
|Build/Package|Status|
1010
|------|-------------|
11-
|master|[![Build status](https://ci.appveyor.com/api/projects/status/anpaipqto58ka5lk/branch/master?svg=true)](https://ci.appveyor.com/project/jtaubensee/azure-service-bus-dotnet/branch/master) [![codecov](https://codecov.io/gh/Azure/azure-service-bus-dotnet/branch/master/graph/badge.svg)](https://codecov.io/gh/Azure/azure-service-bus-dotnet)|
12-
|dev|[![Build status](https://ci.appveyor.com/api/projects/status/anpaipqto58ka5lk/branch/master?svg=true)](https://ci.appveyor.com/project/jtaubensee/azure-service-bus-dotnet/branch/dev) [![codecov](https://codecov.io/gh/Azure/azure-service-bus-dotnet/branch/dev/graph/badge.svg)](https://codecov.io/gh/Azure/azure-service-bus-dotnet)|
11+
|master|[![Build status](https://ci.appveyor.com/api/projects/status/anpaipqto58ka5lk/branch/master?svg=true)](https://ci.appveyor.com/project/vinaysurya/azure-service-bus-dotnet/branch/master) [![codecov](https://codecov.io/gh/Azure/azure-service-bus-dotnet/branch/master/graph/badge.svg)](https://codecov.io/gh/Azure/azure-service-bus-dotnet)|
12+
|dev|[![Build status](https://ci.appveyor.com/api/projects/status/anpaipqto58ka5lk/branch/master?svg=true)](https://ci.appveyor.com/project/vinaysurya/azure-service-bus-dotnet/branch/dev) [![codecov](https://codecov.io/gh/Azure/azure-service-bus-dotnet/branch/dev/graph/badge.svg)](https://codecov.io/gh/Azure/azure-service-bus-dotnet)|
1313
|Microsoft.Azure.ServiceBus|[![NuGet Version and Downloads count](https://buildstats.info/nuget/Microsoft.Azure.ServiceBus?includePreReleases=true)](https://www.nuget.org/packages/Microsoft.Azure.ServiceBus/)|
1414

1515
This is the next generation Service Bus .NET client library that focuses on queues & topics. If you are looking for Event Hubs and Relay clients, follow the below links:

appveyor.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,22 @@ branches:
33
only:
44
- master
55
- dev
6+
skip_tags: true
7+
matrix:
8+
fast_finish: true
69
image: Visual Studio 2017
710
environment:
811
azure-service-bus-dotnet/ClientSecret:
9-
secure: /8H7C81iNS+gVi7LhJCEOPUlNaa30y4KcY4nw/g2C4HGxOv6SrcroyDvMnqD+5GN
12+
secure: yO+qgkyY5FO/4a7rMRl60F5eMTrz03L6r3oD/VCzgKhtuYW5APmgvd9Wu+AHM8T7
1013
azure-service-bus-dotnet/TenantId:
11-
secure: xohonz/X8PPLOVIdT3ch2C5XeSa30RwR6NuXFh4e85svXT1mJNGGO1HQEGxCk3wp
14+
secure: qHryGNZnkslfefQBj8zMZPNhrxSuoe1NJVauNidhhvVLTGi194jotblSTmExuTKQ
1215
azure-service-bus-dotnet/AppId:
13-
secure: c+H140oRJfHtmFHZxSRLWocv5AU0q33X7kgMcTcXxhJvtVhk2WAk1dRQkSN+SyoA
16+
secure: sTox3GxT9oqRUhCe56citfJdYQmdUVMaZlAevCJ0xnC0nV9LyR8+gC/I4Ji/FKoU
1417
matrix:
1518
# First build
1619
- DotNetRunTime: netcoreapp1.0
1720
azure-service-bus-dotnet/CodeCovSecret:
18-
secure: 4/S+CQQJP+gBYrAOj6c1zg3GBMbhKofjIbqq7z6GeVUIWDJCd3ATGsDRT4++bruM
21+
secure: m5MmSzWEul80WJWHp+aznaNNgbQpIYcYfSTBNcPMWO2qgPmTls0OjXezx1KoJGTi
1922
# Second build
2023
- DotNetRunTime: net46
2124
azure-service-bus-dotnet/SkipCodeCoverage: true
@@ -26,4 +29,4 @@ artifacts:
2629
- path: .\build\artifacts\*
2730
build_script:
2831
- ps: .\build\build.ps1
29-
test: off
32+
test: off

src/Microsoft.Azure.ServiceBus/Amqp/AmqpConnectionHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace Microsoft.Azure.ServiceBus.Amqp
88
using Microsoft.Azure.Amqp.Sasl;
99
using Microsoft.Azure.Amqp.Transport;
1010

11-
public class AmqpConnectionHelper
11+
internal class AmqpConnectionHelper
1212
{
1313
const string CbsSaslMechanismName = "MSSBCBS";
1414

src/Microsoft.Azure.ServiceBus/Amqp/AmqpExceptionHelper.cs

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,10 @@ public static AmqpSymbol GetResponseErrorCondition(AmqpMessage response, AmqpRes
6262
public static AmqpResponseStatusCode GetResponseStatusCode(this AmqpMessage responseMessage)
6363
{
6464
AmqpResponseStatusCode responseStatusCode = AmqpResponseStatusCode.Unused;
65-
if (responseMessage != null)
65+
object statusCodeValue = responseMessage?.ApplicationProperties.Map[ManagementConstants.Response.StatusCode];
66+
if (statusCodeValue is int && Enum.IsDefined(typeof(AmqpResponseStatusCode), statusCodeValue))
6667
{
67-
object statusCodeValue = responseMessage.ApplicationProperties.Map[ManagementConstants.Response.StatusCode];
68-
if (statusCodeValue is int && Enum.IsDefined(typeof(AmqpResponseStatusCode), statusCodeValue))
69-
{
70-
responseStatusCode = (AmqpResponseStatusCode)statusCodeValue;
71-
}
68+
responseStatusCode = (AmqpResponseStatusCode)statusCodeValue;
7269
}
7370

7471
return responseStatusCode;
@@ -179,31 +176,23 @@ public static Exception GetClientException(Exception exception, string reference
179176

180177
string message = builder.ToString();
181178

182-
if (exception is SocketException || exception is IOException)
179+
switch (exception)
183180
{
184-
return new ServiceBusCommunicationException(message, exception);
185-
}
181+
case SocketException _:
182+
case IOException _:
183+
return new ServiceBusCommunicationException(message, exception);
186184

187-
if (exception is AmqpException)
188-
{
189-
AmqpException amqpException = exception as AmqpException;
190-
return ToMessagingContractException(amqpException.Error);
191-
}
185+
case AmqpException amqpException:
186+
return ToMessagingContractException(amqpException.Error);
192187

193-
if (exception is OperationCanceledException)
194-
{
195-
AmqpException amqpException = exception.InnerException as AmqpException;
196-
if (amqpException != null)
197-
{
188+
case OperationCanceledException operationCanceledException when operationCanceledException.InnerException is AmqpException amqpException:
198189
return ToMessagingContractException(amqpException.Error);
199-
}
200190

201-
return new ServiceBusException(true, message, exception);
202-
}
191+
case OperationCanceledException _:
192+
return new ServiceBusException(true, message, exception);
203193

204-
if (exception is TimeoutException && referenceId != null)
205-
{
206-
return new TimeoutException(message, exception);
194+
case TimeoutException _ when referenceId != null:
195+
return new TimeoutException(message, exception);
207196
}
208197

209198
return exception;

src/Microsoft.Azure.ServiceBus/Amqp/AmqpLinkCreator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace Microsoft.Azure.ServiceBus.Amqp
88
using Microsoft.Azure.Amqp;
99
using Microsoft.Azure.Amqp.Framing;
1010

11-
public abstract class AmqpLinkCreator
11+
internal abstract class AmqpLinkCreator
1212
{
1313
readonly string entityPath;
1414
readonly ServiceBusConnection serviceBusConnection;

src/Microsoft.Azure.ServiceBus/Amqp/AmqpMessageConverter.cs

Lines changed: 33 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -362,23 +362,23 @@ public static SBMessage AmqpMessageToSBMessage(AmqpMessage amqpMessage)
362362
public static AmqpMap GetRuleDescriptionMap(RuleDescription description)
363363
{
364364
AmqpMap ruleDescriptionMap = new AmqpMap();
365-
if (description.Filter is SqlFilter)
366-
{
367-
AmqpMap filterMap = GetSqlFilterMap(description.Filter as SqlFilter);
368-
ruleDescriptionMap[ManagementConstants.Properties.SqlFilter] = filterMap;
369-
}
370-
else if (description.Filter is CorrelationFilter)
371-
{
372-
AmqpMap correlationFilterMap = GetCorrelationFilterMap(description.Filter as CorrelationFilter);
373-
ruleDescriptionMap[ManagementConstants.Properties.CorrelationFilter] = correlationFilterMap;
374-
}
375-
else
365+
366+
switch (description.Filter)
376367
{
377-
throw new NotSupportedException(
378-
Resources.RuleFilterNotSupported.FormatForUser(
379-
description.Filter.GetType(),
380-
nameof(SqlFilter),
381-
nameof(CorrelationFilter)));
368+
case SqlFilter sqlFilter:
369+
AmqpMap filterMap = GetSqlFilterMap(sqlFilter);
370+
ruleDescriptionMap[ManagementConstants.Properties.SqlFilter] = filterMap;
371+
break;
372+
case CorrelationFilter correlationFilter:
373+
AmqpMap correlationFilterMap = GetCorrelationFilterMap(correlationFilter);
374+
ruleDescriptionMap[ManagementConstants.Properties.CorrelationFilter] = correlationFilterMap;
375+
break;
376+
default:
377+
throw new NotSupportedException(
378+
Resources.RuleFilterNotSupported.FormatForUser(
379+
description.Filter.GetType(),
380+
nameof(SqlFilter),
381+
nameof(CorrelationFilter)));
382382
}
383383

384384
AmqpMap amqpAction = GetRuleActionMap(description.Action as SqlRuleAction);
@@ -431,29 +431,29 @@ static bool TryGetAmqpObjectFromNetObject(object netObject, MappingType mappingT
431431
amqpObject = new DescribedType((AmqpSymbol)TimeSpanName, ((TimeSpan)netObject).Ticks);
432432
break;
433433
case PropertyValueType.Unknown:
434-
if (netObject is Stream)
434+
if (netObject is Stream netObjectAsStream)
435435
{
436436
if (mappingType == MappingType.ApplicationProperty)
437437
{
438-
amqpObject = StreamToBytes((Stream)netObject);
438+
amqpObject = StreamToBytes(netObjectAsStream);
439439
}
440440
}
441441
else if (mappingType == MappingType.ApplicationProperty)
442442
{
443443
throw Fx.Exception.AsError(new SerializationException(Resources.FailedToSerializeUnsupportedType.FormatForUser(netObject.GetType().FullName)));
444444
}
445-
else if (netObject is byte[])
445+
else if (netObject is byte[] netObjectAsByteArray)
446446
{
447-
amqpObject = new ArraySegment<byte>((byte[])netObject);
447+
amqpObject = new ArraySegment<byte>(netObjectAsByteArray);
448448
}
449449
else if (netObject is IList)
450450
{
451451
// Array is also an IList
452452
amqpObject = netObject;
453453
}
454-
else if (netObject is IDictionary)
454+
else if (netObject is IDictionary netObjectAsDictionary)
455455
{
456-
amqpObject = new AmqpMap((IDictionary)netObject);
456+
amqpObject = new AmqpMap(netObjectAsDictionary);
457457
}
458458
break;
459459
}
@@ -490,13 +490,13 @@ static bool TryGetNetObjectFromAmqpObject(object amqpObject, MappingType mapping
490490
netObject = amqpObject;
491491
break;
492492
case PropertyValueType.Unknown:
493-
if (amqpObject is AmqpSymbol)
493+
if (amqpObject is AmqpSymbol amqpObjectAsAmqpSymbol)
494494
{
495-
netObject = ((AmqpSymbol)amqpObject).Value;
495+
netObject = (amqpObjectAsAmqpSymbol).Value;
496496
}
497-
else if (amqpObject is ArraySegment<byte>)
497+
else if (amqpObject is ArraySegment<byte> amqpObjectAsArraySegment)
498498
{
499-
ArraySegment<byte> binValue = (ArraySegment<byte>)amqpObject;
499+
ArraySegment<byte> binValue = amqpObjectAsArraySegment;
500500
if (binValue.Count == binValue.Array.Length)
501501
{
502502
netObject = binValue.Array;
@@ -508,33 +508,31 @@ static bool TryGetNetObjectFromAmqpObject(object amqpObject, MappingType mapping
508508
netObject = buffer;
509509
}
510510
}
511-
else if (amqpObject is DescribedType)
511+
else if (amqpObject is DescribedType amqpObjectAsDescribedType)
512512
{
513-
DescribedType describedType = (DescribedType)amqpObject;
514-
if (describedType.Descriptor is AmqpSymbol)
513+
if (amqpObjectAsDescribedType.Descriptor is AmqpSymbol)
515514
{
516-
AmqpSymbol symbol = (AmqpSymbol)describedType.Descriptor;
515+
AmqpSymbol symbol = (AmqpSymbol)amqpObjectAsDescribedType.Descriptor;
517516
if (symbol.Equals((AmqpSymbol)UriName))
518517
{
519-
netObject = new Uri((string)describedType.Value);
518+
netObject = new Uri((string)amqpObjectAsDescribedType.Value);
520519
}
521520
else if (symbol.Equals((AmqpSymbol)TimeSpanName))
522521
{
523-
netObject = new TimeSpan((long)describedType.Value);
522+
netObject = new TimeSpan((long)amqpObjectAsDescribedType.Value);
524523
}
525524
else if (symbol.Equals((AmqpSymbol)DateTimeOffsetName))
526525
{
527-
netObject = new DateTimeOffset(new DateTime((long)describedType.Value, DateTimeKind.Utc));
526+
netObject = new DateTimeOffset(new DateTime((long)amqpObjectAsDescribedType.Value, DateTimeKind.Utc));
528527
}
529528
}
530529
}
531530
else if (mappingType == MappingType.ApplicationProperty)
532531
{
533532
throw Fx.Exception.AsError(new SerializationException(Resources.FailedToSerializeUnsupportedType.FormatForUser(amqpObject.GetType().FullName)));
534533
}
535-
else if (amqpObject is AmqpMap)
534+
else if (amqpObject is AmqpMap map)
536535
{
537-
AmqpMap map = (AmqpMap)amqpObject;
538536
Dictionary<string, object> dictionary = new Dictionary<string, object>();
539537
foreach (var pair in map)
540538
{

src/Microsoft.Azure.ServiceBus/Amqp/AmqpRequestMessage.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace Microsoft.Azure.ServiceBus.Amqp
88
using Azure.Amqp.Encoding;
99
using Azure.Amqp.Framing;
1010

11-
public sealed class AmqpRequestMessage
11+
internal sealed class AmqpRequestMessage
1212
{
1313
readonly AmqpMessage requestMessage;
1414

src/Microsoft.Azure.ServiceBus/Amqp/AmqpRequestResponseLinkCreator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace Microsoft.Azure.ServiceBus.Amqp
55
{
66
using Microsoft.Azure.Amqp;
77

8-
public class AmqpRequestResponseLinkCreator : AmqpLinkCreator
8+
internal class AmqpRequestResponseLinkCreator : AmqpLinkCreator
99
{
1010
readonly string entityPath;
1111

0 commit comments

Comments
 (0)