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

[Event Hubs Client] Move Blob Checkpoint Store to Shared #18395

Merged
merged 1 commit into from
Feb 3, 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 @@ -241,7 +241,11 @@ partial void OwnershipNotClaimable(string partitionId,
/// <param name="consumerGroup">The name of the consumer group the ownership is associated with.</param>
/// <param name="ownerIdentifier">The identifier of the processor that attempted to claim the ownership for.</param>
///
partial void OwnershipClaimed(string partitionId, string fullyQualifiedNamespace, string eventHubName, string consumerGroup, string ownerIdentifier) =>
partial void OwnershipClaimed(string partitionId,
string fullyQualifiedNamespace,
string eventHubName,
string consumerGroup,
string ownerIdentifier) =>
Logger.OwnershipClaimed(partitionId, fullyQualifiedNamespace, eventHubName, consumerGroup, ownerIdentifier);

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,18 @@
<PackageReference Include="NUnit" />
<PackageReference Include="NUnit3TestAdapter" />
<PackageReference Include="Polly" />
<PackageReference Include="System.Memory.Data" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the comment about 5.3.0 still apply? To remove this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope. It's all stable now. It's just a question of ownership of that package and what repo it will live in, longer term.

<PackageReference Include="System.Net.WebSockets.Client" />
<PackageReference Include="System.Threading.Tasks.Extensions" />
<PackageReference Include="System.ValueTuple" />

<!-- This package will be removed when v5.3.0 is released for GA as the dependency will be available from Core -->
<PackageReference Include="System.Memory.Data" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="$(AzureCoreTestFramework)" />
<ProjectReference Include="..\src\Azure.Messaging.EventHubs.Processor.csproj" />
</ItemGroup>

<!-- TEMP: Use a project reference to Data; remove when published"-->
<!-- END TEMP-->

<!-- Import Event Hubs shared source -->
<Import Project="$(MSBuildThisFileDirectory)..\..\Azure.Messaging.EventHubs.Shared\src\Azure.Messaging.EventHubs.Shared.Testing.projitems" Label="Testing" />

<Import Project="$(MSBuildThisFileDirectory)..\..\Azure.Messaging.EventHubs.Shared\src\Azure.Messaging.EventHubs.Shared.BlobStorageTesting.projitems" Label="BlobStorageTesting" />
</Project>

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
<HasSharedItems>true</HasSharedItems>
<SharedGUID>b9a2bfb3-5636-45b8-9e94-f429ebf3fc1d</SharedGUID>
</PropertyGroup>

<PropertyGroup>
<Import_RootNamespace>Azure.Messaging.EventHubs.Tests</Import_RootNamespace>
</PropertyGroup>

<ItemGroup>
<Compile Include="$(MSBuildThisfileDirectory)BlobStorageTesting\*.cs" Link="SharedSource\Testing\%(Filename)%(Extension)" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.CSharp.targets" />

<!-- Import shared source groups -->
<Import Project="Azure.Messaging.EventHubs.Shared.Authorization.projitems" Label="Authorization" />
<Import Project="Azure.Messaging.EventHubs.Shared.BlobCheckpointStore.projitems" Label="BlobCheckpointStore" />
<Import Project="Azure.Messaging.EventHubs.Shared.BlobStorageTesting.projitems" Label="BlobStorageTesting" />
<Import Project="Azure.Messaging.EventHubs.Shared.Core.projitems" Label="Core" />
<Import Project="Azure.Messaging.EventHubs.Shared.Diagnostics.projitems" Label="Diagnostics" />
<Import Project="Azure.Messaging.EventHubs.Shared.Authorization.projitems" Label="Authorization" />
<Import Project="Azure.Messaging.EventHubs.Shared.Processor.projitems" Label="Processor" />
<Import Project="Azure.Messaging.EventHubs.Shared.Testing.projitems" Label="Testing" />
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
using System.Runtime.CompilerServices;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Azure.Messaging.EventHubs.Tests;
using Microsoft.Azure.Management.ResourceManager;
using Microsoft.Azure.Management.Storage;
using Microsoft.Azure.Management.Storage.Models;
using Microsoft.Rest;

namespace Azure.Messaging.EventHubs.Processor.Tests
namespace Azure.Messaging.EventHubs.Tests
{
/// <summary>
/// Provides a dynamically created Azure blob container instance which exists only in the context
Expand All @@ -32,7 +31,7 @@ public sealed class StorageScope : IAsyncDisposable
private static readonly Uri AzureResourceManagerUri = new Uri(EventHubsTestEnvironment.Instance.ResourceManagerUrl);

/// <summary>Serves as a sentinel flag to denote when the instance has been disposed.</summary>
private bool _disposed = false;
private volatile bool _disposed = false;

/// <summary>
/// The name of the blob storage container that was created.
Expand Down Expand Up @@ -64,7 +63,7 @@ public async ValueTask DisposeAsync()

var resourceGroup = EventHubsTestEnvironment.Instance.ResourceGroup;
var storageAccount = StorageTestEnvironment.Instance.StorageAccountName;
var token = await ResourceManager.AquireManagementTokenAsync().ConfigureAwait(false);
var token = await ResourceManager.AcquireManagementTokenAsync().ConfigureAwait(false);
var client = new StorageManagementClient(AzureResourceManagerUri, new TokenCredentials(token)) { SubscriptionId = EventHubsTestEnvironment.Instance.SubscriptionId };

try
Expand Down Expand Up @@ -103,7 +102,7 @@ public static async Task<StorageScope> CreateAsync([CallerMemberName] string cal

var resourceGroup = EventHubsTestEnvironment.Instance.ResourceGroup;
var storageAccount = StorageTestEnvironment.Instance.StorageAccountName;
var token = await ResourceManager.AquireManagementTokenAsync().ConfigureAwait(false);
var token = await ResourceManager.AcquireManagementTokenAsync().ConfigureAwait(false);

string CreateName() => $"{ Guid.NewGuid().ToString("D").Substring(0, 13) }-{ caller }";

Expand All @@ -125,7 +124,7 @@ public static async Task<StorageScope> CreateAsync([CallerMemberName] string cal
{
var subscription = EventHubsTestEnvironment.Instance.SubscriptionId;
var resourceGroup = EventHubsTestEnvironment.Instance.ResourceGroup;
var token = await ResourceManager.AquireManagementTokenAsync().ConfigureAwait(false);
var token = await ResourceManager.AcquireManagementTokenAsync().ConfigureAwait(false);

static string CreateName() => $"neteventhubs{ Guid.NewGuid().ToString("N").Substring(0, 12) }";

Expand All @@ -152,7 +151,7 @@ public static async Task DeleteStorageAccountAsync(string accountName)
{
var subscription = EventHubsTestEnvironment.Instance.SubscriptionId;
var resourceGroup = EventHubsTestEnvironment.Instance.ResourceGroup;
var token = await ResourceManager.AquireManagementTokenAsync().ConfigureAwait(false);
var token = await ResourceManager.AcquireManagementTokenAsync().ConfigureAwait(false);

using (var client = new StorageManagementClient(AzureResourceManagerUri, new TokenCredentials(token)) { SubscriptionId = subscription })
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using System.Threading.Tasks;
using Azure.Core.TestFramework;

namespace Azure.Messaging.EventHubs.Processor.Tests
namespace Azure.Messaging.EventHubs.Tests
{
/// <summary>
/// Represents the ambient environment for Azure storage resource in which the test suite is
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public sealed class EventHubScope : IAsyncDisposable
private static readonly Uri AzureResourceManagerUri = new Uri(EventHubsTestEnvironment.Instance.ResourceManagerUrl);

/// <summary>Serves as a sentinel flag to denote when the instance has been disposed.</summary>
private bool _disposed = false;
private volatile bool _disposed = false;

/// <summary>
/// The name of the Event Hub that was created.
Expand Down Expand Up @@ -88,7 +88,7 @@ public async ValueTask DisposeAsync()

var resourceGroup = EventHubsTestEnvironment.Instance.ResourceGroup;
var eventHubNamespace = EventHubsTestEnvironment.Instance.EventHubsNamespace;
var token = await ResourceManager.AquireManagementTokenAsync().ConfigureAwait(false);
var token = await ResourceManager.AcquireManagementTokenAsync().ConfigureAwait(false);
var client = new EventHubManagementClient(AzureResourceManagerUri, new TokenCredentials(token)) { SubscriptionId = EventHubsTestEnvironment.Instance.SubscriptionId };

try
Expand Down Expand Up @@ -147,7 +147,7 @@ public static Task<EventHubScope> CreateAsync(int partitionCount,
{
var subscription = EventHubsTestEnvironment.Instance.SubscriptionId;
var resourceGroup = EventHubsTestEnvironment.Instance.ResourceGroup;
var token = await ResourceManager.AquireManagementTokenAsync().ConfigureAwait(false);
var token = await ResourceManager.AcquireManagementTokenAsync().ConfigureAwait(false);

string CreateName() => $"net-eventhubs-{ Guid.NewGuid().ToString("D") }";

Expand All @@ -174,7 +174,7 @@ public static async Task DeleteNamespaceAsync(string namespaceName)
{
var subscription = EventHubsTestEnvironment.Instance.SubscriptionId;
var resourceGroup = EventHubsTestEnvironment.Instance.ResourceGroup;
var token = await ResourceManager.AquireManagementTokenAsync().ConfigureAwait(false);
var token = await ResourceManager.AcquireManagementTokenAsync().ConfigureAwait(false);

using (var client = new EventHubManagementClient(AzureResourceManagerUri, new TokenCredentials(token)) { SubscriptionId = subscription })
{
Expand Down Expand Up @@ -218,7 +218,7 @@ private static Task<EventHubScope> BuildScope(int partitionCount,
///
private static async Task<EventHubScope> BuildScopeFromExistingEventHub()
{
var token = await ResourceManager.AquireManagementTokenAsync().ConfigureAwait(false);
var token = await ResourceManager.AcquireManagementTokenAsync().ConfigureAwait(false);

using (var client = new EventHubManagementClient(AzureResourceManagerUri, new TokenCredentials(token)) { SubscriptionId = EventHubsTestEnvironment.Instance.SubscriptionId })
{
Expand Down Expand Up @@ -253,7 +253,7 @@ private static async Task<EventHubScope> BuildScopeWithNewEventHub(int partition
var groups = (consumerGroups ?? Enumerable.Empty<string>()).ToList();
var resourceGroup = EventHubsTestEnvironment.Instance.ResourceGroup;
var eventHubNamespace = EventHubsTestEnvironment.Instance.EventHubsNamespace;
var token = await ResourceManager.AquireManagementTokenAsync().ConfigureAwait(false);
var token = await ResourceManager.AcquireManagementTokenAsync().ConfigureAwait(false);

string CreateName() => $"{ Guid.NewGuid().ToString("D").Substring(0, 13) }-{ caller }";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public async Task<string> QueryResourceGroupLocationAsync(string accessToken,
///
/// <returns>The token to use for management operations against the Event Hubs Live test namespace.</returns>
///
public async Task<string> AquireManagementTokenAsync()
public async Task<string> AcquireManagementTokenAsync()
{
var token = s_managementToken;
var authority = new Uri(new Uri(EventHubsTestEnvironment.Instance.AuthorityHostUrl), EventHubsTestEnvironment.Instance.TenantId).ToString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,16 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Azure.Storage.Blobs" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="Microsoft.Azure.Management.EventHub" />
<PackageReference Include="Microsoft.Azure.Management.Storage" />
<PackageReference Include="Microsoft.Azure.Management.ResourceManager" />
<PackageReference Include="Microsoft.Azure.Services.AppAuthentication" />
<PackageReference Include="Moq" />
<PackageReference Include="NUnit" />
<PackageReference Include="NUnit3TestAdapter" />
<PackageReference Include="Moq" />
<PackageReference Include="Polly" />
</ItemGroup>

<ItemGroup>
Expand All @@ -29,17 +35,13 @@
</ItemGroup>

<!-- Import Event Hubs shared source -->
<Import Project="..\src\Azure.Messaging.EventHubs.Shared.Authorization.projitems" Label="Authorization" />
<Import Project="..\src\Azure.Messaging.EventHubs.Shared.BlobCheckpointStore.projitems" Label="CheckpointStore" />
<Import Project="..\src\Azure.Messaging.EventHubs.Shared.Core.projitems" Label="Core" />
<Import Project="..\src\Azure.Messaging.EventHubs.Shared.Diagnostics.projitems" Label="Diagnostics" />
<Import Project="..\src\Azure.Messaging.EventHubs.Shared.Authorization.projitems" Label="Authorization" />
<Import Project="..\src\Azure.Messaging.EventHubs.Shared.Processor.projitems" Label="Processor" />

<ItemGroup>
<Compile Include="..\src\Testing\EventDataExtensions.cs" Link="SharedSource\Testing\EventDataExtensions.cs" />
<Compile Include="..\src\Testing\InMemoryStorageManager.cs" Link="SharedSource\Testing\InMemoryStorageManager.cs" />
<Compile Include="..\src\Testing\MockEventData.cs" Link="SharedSource\Testing\MockEventData.cs" />
<Compile Include="..\src\Testing\TaskExtensions.cs" Link="SharedSource\Testing\TaskExtensions.cs" />
</ItemGroup>
<Import Project="..\src\Azure.Messaging.EventHubs.Shared.Testing.projitems" Label="Testing" />
<Import Project="..\src\Azure.Messaging.EventHubs.Shared.BlobStorageTesting.projitems" Label="BlobStorageTesting" />

<!--Embed the shared resources -->
<ItemGroup>
Expand Down
Loading