-
-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #353 from Lombiq/issue/OCORE-136
Cache folder configuration for Azure and AWS Image Caches (Lombiq Technologies: OCORE-136)
- Loading branch information
Showing
9 changed files
with
139 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
tests/ImageSharp.Web.Tests/Processing/AWSS3StorageCacheCacheFolderServerTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright (c) Six Labors. | ||
// Licensed under the Six Labors Split License. | ||
|
||
using SixLabors.ImageSharp.Web.Tests.TestUtilities; | ||
using Xunit.Abstractions; | ||
|
||
namespace SixLabors.ImageSharp.Web.Tests.Processing; | ||
|
||
public class AWSS3StorageCacheCacheFolderServerTests : ServerTestBase<AWSS3StorageCacheCacheFolderTestServerFixture> | ||
{ | ||
public AWSS3StorageCacheCacheFolderServerTests(AWSS3StorageCacheCacheFolderTestServerFixture fixture, ITestOutputHelper outputHelper) | ||
: base(fixture, outputHelper, TestConstants.AWSTestImage) | ||
{ | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
tests/ImageSharp.Web.Tests/Processing/AzureBlobStorageCacheCacheFolderServerTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright (c) Six Labors. | ||
// Licensed under the Six Labors Split License. | ||
|
||
using SixLabors.ImageSharp.Web.Tests.TestUtilities; | ||
using Xunit.Abstractions; | ||
|
||
namespace SixLabors.ImageSharp.Web.Tests.Processing; | ||
|
||
public class AzureBlobStorageCacheCacheFolderServerTests : ServerTestBase<AzureBlobStorageCacheCacheFolderTestServerFixture> | ||
{ | ||
public AzureBlobStorageCacheCacheFolderServerTests(AzureBlobStorageCacheCacheFolderTestServerFixture fixture, ITestOutputHelper outputHelper) | ||
: base(fixture, outputHelper, TestConstants.AzureTestImage) | ||
{ | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
tests/ImageSharp.Web.Tests/TestUtilities/AWSS3StorageCacheCacheFolderTestServerFixture.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Copyright (c) Six Labors. | ||
// Licensed under the Six Labors Split License. | ||
|
||
using Amazon.S3; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using SixLabors.ImageSharp.Web.Caching.AWS; | ||
using SixLabors.ImageSharp.Web.DependencyInjection; | ||
using SixLabors.ImageSharp.Web.Providers.AWS; | ||
|
||
namespace SixLabors.ImageSharp.Web.Tests.TestUtilities; | ||
|
||
public class AWSS3StorageCacheCacheFolderTestServerFixture : TestServerFixture | ||
{ | ||
protected override void ConfigureCustomServices(IServiceCollection services, IImageSharpBuilder builder) | ||
=> builder | ||
.Configure<AWSS3StorageImageProviderOptions>(o => | ||
o.S3Buckets.Add( | ||
new AWSS3BucketClientOptions | ||
{ | ||
Endpoint = TestConstants.AWSEndpoint, | ||
BucketName = TestConstants.AWSBucketName, | ||
AccessKey = TestConstants.AWSAccessKey, | ||
AccessSecret = TestConstants.AWSAccessSecret, | ||
Region = TestConstants.AWSRegion, | ||
Timeout = TestConstants.AWSTimeout, | ||
})) | ||
.AddProvider(AWSS3StorageImageProviderFactory.Create) | ||
.Configure<AWSS3StorageCacheOptions>(o => | ||
{ | ||
o.Endpoint = TestConstants.AWSEndpoint; | ||
o.BucketName = TestConstants.AWSCacheBucketName; | ||
o.AccessKey = TestConstants.AWSAccessKey; | ||
o.AccessSecret = TestConstants.AWSAccessSecret; | ||
o.Region = TestConstants.AWSRegion; | ||
o.Timeout = TestConstants.AWSTimeout; | ||
o.CacheFolder = TestConstants.AWSCacheFolder; | ||
|
||
AWSS3StorageCache.CreateIfNotExists(o, S3CannedACL.Private); | ||
}) | ||
.SetCache<AWSS3StorageCache>(); | ||
} |
33 changes: 33 additions & 0 deletions
33
...s/ImageSharp.Web.Tests/TestUtilities/AzureBlobStorageCacheCacheFolderTestServerFixture.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright (c) Six Labors. | ||
// Licensed under the Six Labors Split License. | ||
|
||
using Azure.Storage.Blobs.Models; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using SixLabors.ImageSharp.Web.Caching.Azure; | ||
using SixLabors.ImageSharp.Web.DependencyInjection; | ||
using SixLabors.ImageSharp.Web.Providers.Azure; | ||
|
||
namespace SixLabors.ImageSharp.Web.Tests.TestUtilities; | ||
|
||
public class AzureBlobStorageCacheCacheFolderTestServerFixture : TestServerFixture | ||
{ | ||
protected override void ConfigureCustomServices(IServiceCollection services, IImageSharpBuilder builder) | ||
=> builder | ||
.Configure<AzureBlobStorageImageProviderOptions>(o => | ||
o.BlobContainers.Add( | ||
new AzureBlobContainerClientOptions | ||
{ | ||
ConnectionString = TestConstants.AzureConnectionString, | ||
ContainerName = TestConstants.AzureContainerName | ||
})) | ||
.AddProvider(AzureBlobStorageImageProviderFactory.Create) | ||
.Configure<AzureBlobStorageCacheOptions>(o => | ||
{ | ||
o.ConnectionString = TestConstants.AzureConnectionString; | ||
o.ContainerName = TestConstants.AzureCacheContainerName; | ||
o.CacheFolder = TestConstants.AzureCacheFolder; | ||
|
||
AzureBlobStorageCache.CreateIfNotExists(o, PublicAccessType.None); | ||
}) | ||
.SetCache<AzureBlobStorageCache>(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters