Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
EngincanV committed Sep 5, 2024
1 parent fdcba83 commit df1705f
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Volo.Abp.BlobStoring.Google;

public class DefaultGoogleBlobNameCalculator: IGoogleBlobNameCalculator, ITransientDependency
public class DefaultGoogleBlobNameCalculator : IGoogleBlobNameCalculator, ITransientDependency
{
protected ICurrentTenant CurrentTenant { get; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ public static GoogleBlobProviderConfiguration GetGoogleConfiguration(

public static BlobContainerConfiguration UseGoogle(
this BlobContainerConfiguration containerConfiguration,
Action<GoogleBlobProviderConfiguration> azureConfigureAction)
Action<GoogleBlobProviderConfiguration> googleConfigureAction)
{
containerConfiguration.ProviderType = typeof(GoogleBlobProvider);
containerConfiguration.NamingNormalizers.TryAdd<GoogleBlobNamingNormalizer>();

azureConfigureAction(new GoogleBlobProviderConfiguration(containerConfiguration));
googleConfigureAction(new GoogleBlobProviderConfiguration(containerConfiguration));

return containerConfiguration;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace Volo.Abp.BlobStoring.Google;

public class GoogleBlobNamingNormalizer: IBlobNamingNormalizer, ITransientDependency
public class GoogleBlobNamingNormalizer : IBlobNamingNormalizer, ITransientDependency
{
/// <summary>
/// https://cloud.google.com/storage/docs/buckets#naming
Expand Down Expand Up @@ -83,7 +83,7 @@ protected virtual string RemoveInvalidStartEndCharacters(string containerName)
if (!char.IsLetterOrDigit(containerName[0]))
{
containerName = containerName.Substring(1);
return RemoveInvalidStartEndCharacters( containerName);
return RemoveInvalidStartEndCharacters(containerName);
}

if (!char.IsLetterOrDigit(containerName[containerName.Length - 1]))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public async override Task SaveAsync(BlobProviderSaveArgs args)
var blobName = GoogleBlobNameCalculator.Calculate(args);
var containerName = GetContainerName(args);

if(await BlobExistsAsync(args, blobName) && !args.OverrideExisting)
if (await BlobExistsAsync(args, blobName) && !args.OverrideExisting)
{
throw new BlobAlreadyExistsException($"Saving BLOB '{args.BlobName}' does already exists in the container '{GetContainerName(args)}'! Set {nameof(args.OverrideExisting)} if it should be overwritten.");
}
Expand All @@ -54,7 +54,6 @@ public async override Task<bool> DeleteAsync(BlobProviderDeleteArgs args)
{
return true;
}


return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Volo.Abp.BlobStoring.Google;


/// <summary>
/// This module will not try to connect to azure.
/// This module will not try to connect to Google Cloud Storage.
/// </summary>
[DependsOn(
typeof(AbpBlobStoringGoogleModule),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ public class GoogleBlobNameCalculator_Tests : AbpBlobStoringGoogleTestCommonBase
private readonly IGoogleBlobNameCalculator _calculator;
private readonly ICurrentTenant _currentTenant;

private const string AzureContainerName = "/";
private const string AzureSeparator = "/";
private const string GoogleContainerName = "/";
private const string GoogleSeparator = "/";

public GoogleBlobNameCalculator_Tests()
{
Expand All @@ -24,7 +24,7 @@ public void Default_Settings()
{
_calculator.Calculate(
GetArgs("my-container", "my-blob")
).ShouldBe($"host{AzureSeparator}my-blob");
).ShouldBe($"host{GoogleSeparator}my-blob");
}

[Fact]
Expand All @@ -36,7 +36,7 @@ public void Default_Settings_With_TenantId()
{
_calculator.Calculate(
GetArgs("my-container", "my-blob")
).ShouldBe($"tenants{AzureSeparator}{tenantId:D}{AzureSeparator}my-blob");
).ShouldBe($"tenants{GoogleSeparator}{tenantId:D}{GoogleSeparator}my-blob");
}
}

Expand Down

0 comments on commit df1705f

Please sign in to comment.