Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Service Bus Cient] Client Properties Mockability Fix #18254

Merged
merged 1 commit into from
Jan 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -192,15 +192,15 @@ public static partial class ServiceBusModelFactory
public partial class ServiceBusProcessor : System.IAsyncDisposable
{
protected ServiceBusProcessor() { }
public bool AutoCompleteMessages { get { throw null; } }
public string EntityPath { get { throw null; } }
public string FullyQualifiedNamespace { get { throw null; } }
public bool IsClosed { get { throw null; } }
public bool IsProcessing { get { throw null; } }
public System.TimeSpan MaxAutoLockRenewalDuration { get { throw null; } }
public int MaxConcurrentCalls { get { throw null; } }
public int PrefetchCount { get { throw null; } }
public Azure.Messaging.ServiceBus.ServiceBusReceiveMode ReceiveMode { get { throw null; } }
public virtual bool AutoCompleteMessages { get { throw null; } }
public virtual string EntityPath { get { throw null; } }
public virtual string FullyQualifiedNamespace { get { throw null; } }
public virtual bool IsClosed { get { throw null; } }
public virtual bool IsProcessing { get { throw null; } }
public virtual System.TimeSpan MaxAutoLockRenewalDuration { get { throw null; } }
public virtual int MaxConcurrentCalls { get { throw null; } }
public virtual int PrefetchCount { get { throw null; } }
public virtual Azure.Messaging.ServiceBus.ServiceBusReceiveMode ReceiveMode { get { throw null; } }
public event System.Func<Azure.Messaging.ServiceBus.ProcessErrorEventArgs, System.Threading.Tasks.Task> ProcessErrorAsync { add { } remove { } }
public event System.Func<Azure.Messaging.ServiceBus.ProcessMessageEventArgs, System.Threading.Tasks.Task> ProcessMessageAsync { add { } remove { } }
public virtual System.Threading.Tasks.Task CloseAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
Expand Down Expand Up @@ -266,11 +266,11 @@ public enum ServiceBusReceiveMode
public partial class ServiceBusReceiver : System.IAsyncDisposable
{
protected ServiceBusReceiver() { }
public string EntityPath { get { throw null; } }
public virtual string EntityPath { get { throw null; } }
public virtual string FullyQualifiedNamespace { get { throw null; } }
public virtual bool IsClosed { get { throw null; } }
public int PrefetchCount { get { throw null; } }
public Azure.Messaging.ServiceBus.ServiceBusReceiveMode ReceiveMode { get { throw null; } }
public virtual int PrefetchCount { get { throw null; } }
public virtual Azure.Messaging.ServiceBus.ServiceBusReceiveMode ReceiveMode { get { throw null; } }
public virtual System.Threading.Tasks.Task AbandonMessageAsync(Azure.Messaging.ServiceBus.ServiceBusReceivedMessage message, System.Collections.Generic.IDictionary<string, object> propertiesToModify = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task CloseAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task CompleteMessageAsync(Azure.Messaging.ServiceBus.ServiceBusReceivedMessage message, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
Expand Down Expand Up @@ -336,7 +336,7 @@ protected ServiceBusRetryPolicy() { }
public partial class ServiceBusSender : System.IAsyncDisposable
{
protected ServiceBusSender() { }
public string EntityPath { get { throw null; } }
public virtual string EntityPath { get { throw null; } }
public virtual string FullyQualifiedNamespace { get { throw null; } }
public virtual bool IsClosed { get { throw null; } }
public virtual System.Threading.Tasks.Task CancelScheduledMessageAsync(long sequenceNumber, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
Expand All @@ -360,16 +360,16 @@ protected ServiceBusSender() { }
public partial class ServiceBusSessionProcessor : System.IAsyncDisposable
{
protected ServiceBusSessionProcessor() { }
public bool AutoCompleteMessages { get { throw null; } }
public string EntityPath { get { throw null; } }
public string FullyQualifiedNamespace { get { throw null; } }
public bool IsClosed { get { throw null; } }
public bool IsProcessing { get { throw null; } }
public System.TimeSpan MaxAutoLockRenewalDuration { get { throw null; } }
public int MaxConcurrentCallsPerSession { get { throw null; } }
public int MaxConcurrentSessions { get { throw null; } }
public int PrefetchCount { get { throw null; } }
public Azure.Messaging.ServiceBus.ServiceBusReceiveMode ReceiveMode { get { throw null; } }
public virtual bool AutoCompleteMessages { get { throw null; } }
public virtual string EntityPath { get { throw null; } }
public virtual string FullyQualifiedNamespace { get { throw null; } }
public virtual bool IsClosed { get { throw null; } }
public virtual bool IsProcessing { get { throw null; } }
public virtual System.TimeSpan MaxAutoLockRenewalDuration { get { throw null; } }
public virtual int MaxConcurrentCallsPerSession { get { throw null; } }
public virtual int MaxConcurrentSessions { get { throw null; } }
public virtual int PrefetchCount { get { throw null; } }
public virtual Azure.Messaging.ServiceBus.ServiceBusReceiveMode ReceiveMode { get { throw null; } }
public event System.Func<Azure.Messaging.ServiceBus.ProcessErrorEventArgs, System.Threading.Tasks.Task> ProcessErrorAsync { add { } remove { } }
public event System.Func<Azure.Messaging.ServiceBus.ProcessSessionMessageEventArgs, System.Threading.Tasks.Task> ProcessMessageAsync { add { } remove { } }
public event System.Func<Azure.Messaging.ServiceBus.ProcessSessionEventArgs, System.Threading.Tasks.Task> SessionClosingAsync { add { } remove { } }
Expand Down Expand Up @@ -405,8 +405,8 @@ public ServiceBusSessionProcessorOptions() { }
public partial class ServiceBusSessionReceiver : Azure.Messaging.ServiceBus.ServiceBusReceiver
{
protected ServiceBusSessionReceiver() { }
public string SessionId { get { throw null; } }
public System.DateTimeOffset SessionLockedUntil { get { throw null; } }
public virtual string SessionId { get { throw null; } }
public virtual System.DateTimeOffset SessionLockedUntil { get { throw null; } }
public virtual System.Threading.Tasks.Task<System.BinaryData> GetSessionStateAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task RenewSessionLockAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task SetSessionStateAsync(System.BinaryData sessionState, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
Expand Down
18 changes: 9 additions & 9 deletions sdk/servicebus/Azure.Messaging.ServiceBus/src/Processor/ServiceBusProcessor.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ public class ServiceBusProcessor : IAsyncDisposable
/// Gets the fully qualified Service Bus namespace that the receiver is associated with. This is likely
/// to be similar to <c>{yournamespace}.servicebus.windows.net</c>.
/// </summary>
public string FullyQualifiedNamespace => _connection.FullyQualifiedNamespace;
public virtual string FullyQualifiedNamespace => _connection.FullyQualifiedNamespace;

/// <summary>
/// Gets the path of the Service Bus entity that the processor is connected to, specific to the
/// Service Bus namespace that contains it.
/// </summary>
public string EntityPath { get; private set; }
public virtual string EntityPath { get; private set; }

/// <summary>
/// Gets the ID to identify this processor. This can be used to correlate logs and exceptions.
Expand All @@ -73,7 +73,7 @@ public class ServiceBusProcessor : IAsyncDisposable
/// <summary>
/// Gets the <see cref="ReceiveMode"/> used to specify how messages are received. Defaults to PeekLock mode.
/// </summary>
public ServiceBusReceiveMode ReceiveMode { get; }
public virtual ServiceBusReceiveMode ReceiveMode { get; }

/// <summary>
/// Gets whether the processor is configured to process session entities.
Expand All @@ -85,7 +85,7 @@ public class ServiceBusProcessor : IAsyncDisposable
/// during processing. This is intended to help maximize throughput by allowing the
/// processor to receive from a local cache rather than waiting on a service request.
/// </summary>
public int PrefetchCount { get; }
public virtual int PrefetchCount { get; }

/// <summary>
/// Gets whether or not this processor is currently processing messages.
Expand All @@ -94,7 +94,7 @@ public class ServiceBusProcessor : IAsyncDisposable
/// <value>
/// <c>true</c> if the processor is processing messages; otherwise, <c>false</c>.
/// </value>
public bool IsProcessing => ActiveReceiveTask != null;
public virtual bool IsProcessing => ActiveReceiveTask != null;

private readonly ServiceBusProcessorOptions _options;

Expand All @@ -109,7 +109,7 @@ public class ServiceBusProcessor : IAsyncDisposable
/// </summary>
///
/// <value>The maximum number of concurrent calls to the message handler.</value>
public int MaxConcurrentCalls { get; }
public virtual int MaxConcurrentCalls { get; }

/// <summary>
/// Gets a value that indicates whether the processor should automatically
Expand All @@ -120,7 +120,7 @@ public class ServiceBusProcessor : IAsyncDisposable
///
/// <value>true to complete the message processing automatically on
/// successful execution of the operation; otherwise, false.</value>
public bool AutoCompleteMessages { get; }
public virtual bool AutoCompleteMessages { get; }

/// <summary>
/// Gets the maximum duration within which the lock will be renewed automatically. This
Expand All @@ -131,7 +131,7 @@ public class ServiceBusProcessor : IAsyncDisposable
///
/// <remarks>The message renew can continue for sometime in the background
/// after completion of message and result in a few false MessageLockLostExceptions temporarily.</remarks>
public TimeSpan MaxAutoLockRenewalDuration { get; }
public virtual TimeSpan MaxAutoLockRenewalDuration { get; }

/// <summary>
/// The instance of <see cref="ServiceBusEventSource" /> which can be mocked for testing.
Expand All @@ -147,7 +147,7 @@ public class ServiceBusProcessor : IAsyncDisposable
/// <value>
/// <c>true</c> if the processor is closed; otherwise, <c>false</c>.
/// </value>
public bool IsClosed
public virtual bool IsClosed
{
get => _closed;
private set => _closed = value;
Expand Down
20 changes: 10 additions & 10 deletions sdk/servicebus/Azure.Messaging.ServiceBus/src/Processor/ServiceBusSessionProcessor.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class ServiceBusSessionProcessor : IAsyncDisposable
private readonly ServiceBusProcessor _innerProcessor;

/// <inheritdoc cref="ServiceBusProcessor.EntityPath"/>
public string EntityPath => _innerProcessor.EntityPath;
public virtual string EntityPath => _innerProcessor.EntityPath;

/// <summary>
/// Gets the ID to identify this processor. This can be used to correlate logs and exceptions.
Expand All @@ -37,16 +37,16 @@ public class ServiceBusSessionProcessor : IAsyncDisposable
internal string Identifier => _innerProcessor.Identifier;

/// <inheritdoc cref="ServiceBusProcessor.ReceiveMode"/>
public ServiceBusReceiveMode ReceiveMode => _innerProcessor.ReceiveMode;
public virtual ServiceBusReceiveMode ReceiveMode => _innerProcessor.ReceiveMode;

/// <inheritdoc cref="ServiceBusProcessor.PrefetchCount"/>
public int PrefetchCount => _innerProcessor.PrefetchCount;
public virtual int PrefetchCount => _innerProcessor.PrefetchCount;

/// <inheritdoc cref="ServiceBusProcessor.IsProcessing"/>
public bool IsProcessing => _innerProcessor.IsProcessing;
public virtual bool IsProcessing => _innerProcessor.IsProcessing;

/// <inheritdoc cref="ServiceBusProcessor.AutoCompleteMessages"/>
public bool AutoCompleteMessages => _innerProcessor.AutoCompleteMessages;
public virtual bool AutoCompleteMessages => _innerProcessor.AutoCompleteMessages;

/// <summary>
/// Indicates whether or not this <see cref="ServiceBusSessionProcessor"/> has been closed.
Expand All @@ -55,7 +55,7 @@ public class ServiceBusSessionProcessor : IAsyncDisposable
/// <value>
/// <c>true</c> if the processor is closed; otherwise, <c>false</c>.
/// </value>
public bool IsClosed => _innerProcessor.IsClosed;
public virtual bool IsClosed => _innerProcessor.IsClosed;

/// <summary>
/// Gets the maximum duration within which the session lock will be
Expand All @@ -67,21 +67,21 @@ public class ServiceBusSessionProcessor : IAsyncDisposable
/// <remarks>The session lock renewal can continue for sometime in the background
/// after completion of message and result in a few false SessionLockLost exceptions temporarily.
/// </remarks>
public TimeSpan MaxAutoLockRenewalDuration => _innerProcessor.MaxAutoLockRenewalDuration;
public virtual TimeSpan MaxAutoLockRenewalDuration => _innerProcessor.MaxAutoLockRenewalDuration;

/// <summary>Gets the maximum number of sessions that will be processed concurrently by the processor.
/// The default value is 8.</summary>
public int MaxConcurrentSessions => _innerProcessor.MaxConcurrentSessions;
public virtual int MaxConcurrentSessions => _innerProcessor.MaxConcurrentSessions;

/// <summary>
/// Gets the maximum number of calls to the callback the processor will initiate per session.
/// Thus the total number of callbacks will be equal to MaxConcurrentSessions * MaxConcurrentCallsPerSession.
/// The default value is 1.
/// </summary>
public int MaxConcurrentCallsPerSession => _innerProcessor.MaxConcurrentCallsPerSession;
public virtual int MaxConcurrentCallsPerSession => _innerProcessor.MaxConcurrentCallsPerSession;

/// <inheritdoc cref="ServiceBusProcessor.FullyQualifiedNamespace"/>
public string FullyQualifiedNamespace => _innerProcessor.FullyQualifiedNamespace;
public virtual string FullyQualifiedNamespace => _innerProcessor.FullyQualifiedNamespace;

internal ServiceBusSessionProcessor(
ServiceBusConnection connection,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ public class ServiceBusReceiver : IAsyncDisposable
/// The path of the Service Bus entity that the receiver is connected to, specific to the
/// Service Bus namespace that contains it.
/// </summary>
public string EntityPath { get; }
public virtual string EntityPath { get; }

/// <summary>
/// The <see cref="ReceiveMode"/> used to specify how messages are received. Defaults to PeekLock mode.
/// </summary>
public ServiceBusReceiveMode ReceiveMode { get; }
public virtual ServiceBusReceiveMode ReceiveMode { get; }

/// <summary>
/// Indicates whether the receiver entity is session enabled.
Expand All @@ -51,7 +51,7 @@ public class ServiceBusReceiver : IAsyncDisposable
/// whether a processing is currently active, intended to help maximize throughput by allowing the receiver to receive
/// from a local cache rather than waiting on a service request.
/// </summary>
public int PrefetchCount { get; }
public virtual int PrefetchCount { get; }

/// <summary>
/// Gets the ID to identify this client. This can be used to correlate logs and exceptions.
Expand Down
4 changes: 2 additions & 2 deletions sdk/servicebus/Azure.Messaging.ServiceBus/src/Receiver/ServiceBusSessionReceiver.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ public class ServiceBusSessionReceiver : ServiceBusReceiver
/// <summary>
/// The Session Id associated with the receiver.
/// </summary>
public string SessionId => InnerReceiver.SessionId;
public virtual string SessionId => InnerReceiver.SessionId;

/// <summary>
/// Gets the <see cref="DateTimeOffset"/> that the receiver's session is locked until.
/// </summary>
public DateTimeOffset SessionLockedUntil => InnerReceiver.SessionLockedUntil;
public virtual DateTimeOffset SessionLockedUntil => InnerReceiver.SessionLockedUntil;

/// <summary>
/// Creates a session receiver which can be used to interact with all messages with the same sessionId.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class ServiceBusSender : IAsyncDisposable
/// Service Bus namespace that contains it.
/// </summary>
///
public string EntityPath { get; }
public virtual string EntityPath { get; }

/// <summary>
/// Indicates whether or not this <see cref="ServiceBusSender"/> has been closed.
Expand Down