Skip to content

Commit

Permalink
Feature/350 modernize net60 (#353)
Browse files Browse the repository at this point in the history
  • Loading branch information
idg10 authored Jan 29, 2022
1 parent 6f4e693 commit b147473
Show file tree
Hide file tree
Showing 54 changed files with 1,927 additions and 2,304 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -336,4 +336,5 @@ coverage.cobertura.xml
# VS Code config files
/.vscode

appsettings.json
appsettings.json
*.feature.cs
2 changes: 1 addition & 1 deletion GitVersion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ branches:
- feature
- support
- hotfix
next-version: "1.2"
next-version: "2.0"

6 changes: 0 additions & 6 deletions Solutions/Common.GitHub.proj

This file was deleted.

23 changes: 0 additions & 23 deletions Solutions/Common.NuGet.proj

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Import Project="$(EndjinProjectPropsPath)" Condition="$(EndjinProjectPropsPath) != ''" />

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>

<Nullable>enable</Nullable>
</PropertyGroup>
Expand All @@ -15,13 +15,12 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Corvus.Tenancy.Abstractions" Version="2.0.13" />
<PackageReference Include="Corvus.Tenancy.Abstractions" Version="3.0.0" />
<PackageReference Include="Endjin.RecommendedPractices" Version="1.2.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Menes.Abstractions" Version="2.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="Menes.Abstractions" Version="3.1.2" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
namespace Marain.Operations.Domain
{
using System;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

/// <summary>
/// Information about a long-running operation.
Expand Down Expand Up @@ -73,7 +71,6 @@ public Operation(
/// <summary>
/// Gets or sets the current status of this operation.
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public OperationStatus Status { get; set; }

/// <summary>
Expand Down
8 changes: 4 additions & 4 deletions Solutions/Marain.Operations.Api.Specs/Bindings/ApiBindings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static class ApiBindings
public static readonly string ControlApiBaseUrl = $"http://localhost:{ControlApiPort}";

[BeforeFeature(Order = BindingSequence.FunctionStartup)]
public static Task StartApis(FeatureContext featureContext)
public static async Task StartApis(FeatureContext featureContext)
{
FunctionsController functionsController = FunctionsBindings.GetFunctionsController(featureContext);
FunctionConfiguration functionConfiguration = FunctionsBindings.GetFunctionConfiguration(featureContext);
Expand All @@ -34,16 +34,16 @@ public static Task StartApis(FeatureContext featureContext)
functionConfiguration.CopyToEnvironmentVariables(configuration.AsEnumerable());
functionConfiguration.EnvironmentVariables.Add("ExternalServices:OperationsStatus", StatusApiBaseUrl);

return Task.WhenAll(
await Task.WhenAll(
functionsController.StartFunctionsInstance(
"Marain.Operations.ControlHost.Functions",
ControlApiPort,
"netcoreapp3.1",
"net6.0",
configuration: functionConfiguration),
functionsController.StartFunctionsInstance(
"Marain.Operations.StatusHost.Functions",
StatusApiPort,
"netcoreapp3.1",
"net6.0",
configuration: functionConfiguration));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,21 @@
namespace Marain.Operations.Api.Specs.Bindings
{
using System;

using Corvus.Configuration;
using Corvus.Identity.ManagedServiceIdentity.ClientAuthentication;
using Corvus.Testing.SpecFlow;

using Marain.Operations.Client.OperationsControl;
using Marain.Tenancy.Client;

using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;

using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Serialization;

using TechTalk.SpecFlow;

[Binding]
Expand All @@ -37,7 +42,8 @@ public static void PerFeatureContainerSetup(FeatureContext featureContext)
services.AddJsonNetSerializerSettingsProvider();
services.AddJsonNetPropertyBag();
services.AddJsonNetCultureInfoConverter();
services.AddSingleton<JsonConverter>(new StringEnumConverter(true));
services.AddJsonNetDateTimeOffsetToIso8601AndUnixTimeConverter();
services.AddSingleton<JsonConverter>(new StringEnumConverter(new CamelCaseNamingStrategy()));

// Tenancy service client.
TenancyClientOptions tenancyConfiguration = config.GetSection("TenancyClient").Get<TenancyClientOptions>();
Expand All @@ -53,10 +59,9 @@ public static void PerFeatureContainerSetup(FeatureContext featureContext)
services.AddTenantProviderServiceClient(false);

// Token source, to provide authentication when accessing external services.
services.AddAzureManagedIdentityBasedTokenSource(new AzureManagedIdentityTokenSourceOptions
{
AzureServicesAuthConnectionString = config["AzureServicesAuthConnectionString"],
});
string azureServicesAuthConnectionString = config["AzureServicesAuthConnectionString"];
services.AddServiceIdentityAzureTokenCredentialSourceFromLegacyConnectionString(azureServicesAuthConnectionString);
services.AddMicrosoftRestAdapterForServiceIdentityAccessTokenSource();

// Marain tenancy management, required to create transient client/service tenants.
services.AddMarainTenantManagement();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,25 @@ namespace Marain.Operations.Api.Specs.Bindings
{
using System;
using System.Threading.Tasks;

using Azure.Storage.Blobs;

using Corvus.Azure.Cosmos.Tenancy;
using Corvus.Azure.Storage.Tenancy;
using Corvus.Storage.Azure.BlobStorage.Tenancy;
using Corvus.Tenancy;
using Corvus.Testing.AzureFunctions;
using Corvus.Testing.AzureFunctions.SpecFlow;
using Corvus.Testing.SpecFlow;

using Marain.Operations.Storage.Blob;
using Marain.TenantManagement.EnrollmentConfiguration;
using Marain.TenantManagement.Testing;
using Microsoft.Azure.Storage.Blob;

using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;

using TechTalk.SpecFlow;

/// <summary>
Expand Down Expand Up @@ -75,8 +81,11 @@ public static async Task TearDownTenants(FeatureContext featureContext)

await featureContext.RunAndStoreExceptionsAsync(async () =>
{
ITenantCloudBlobContainerFactory cloudBlobContainerFactory = ContainerBindings.GetServiceProvider(featureContext).GetRequiredService<ITenantCloudBlobContainerFactory>();
CloudBlobContainer testContainer = await cloudBlobContainerFactory.GetBlobContainerForTenantAsync(tenantManager.PrimaryTransientClient, OperationsRepository.ContainerDefinition).ConfigureAwait(false);
IBlobContainerSourceWithTenantLegacyTransition cloudBlobContainerFactory = ContainerBindings.GetServiceProvider(featureContext).GetRequiredService<IBlobContainerSourceWithTenantLegacyTransition>();
BlobContainerClient testContainer = await cloudBlobContainerFactory.GetBlobContainerClientFromTenantAsync(
tenantManager.PrimaryTransientClient,
OperationsRepository.OperationsV2ConfigKey,
OperationsRepository.OperationsV3ConfigKey).ConfigureAwait(false);
await testContainer.DeleteIfExistsAsync().ConfigureAwait(false);
}).ConfigureAwait(false);

Expand Down
Loading

0 comments on commit b147473

Please sign in to comment.