diff --git a/core/BusinessLogic/BusinessLogic.csproj b/core/BusinessLogic/BusinessLogic.csproj index cbb0c9d43..5ce7dfb33 100644 --- a/core/BusinessLogic/BusinessLogic.csproj +++ b/core/BusinessLogic/BusinessLogic.csproj @@ -21,6 +21,7 @@ + diff --git a/core/BusinessLogic/Repositories/Repos.cs b/core/BusinessLogic/Repositories/Repos.cs index ebe79fc73..e5bf103b4 100644 --- a/core/BusinessLogic/Repositories/Repos.cs +++ b/core/BusinessLogic/Repositories/Repos.cs @@ -1,7 +1,7 @@ using DFM.Authentication; using DFM.BusinessLogic.Response; -using DFM.Exchange.Exporter; using DFM.BusinessLogic.Validators; +using DFM.Files; namespace DFM.BusinessLogic.Repositories { diff --git a/core/BusinessLogic/Repositories/WipeRepository.cs b/core/BusinessLogic/Repositories/WipeRepository.cs index 044fb58e9..0d24241a3 100644 --- a/core/BusinessLogic/Repositories/WipeRepository.cs +++ b/core/BusinessLogic/Repositories/WipeRepository.cs @@ -8,6 +8,7 @@ using DFM.Entities.Bases; using DFM.Entities.Enums; using DFM.Exchange.Exporter; +using DFM.Files; using Keon.Util.Crypto; using Keon.Util.DB; using Keon.Util.Extensions; diff --git a/core/BusinessLogic/ServiceAccess.cs b/core/BusinessLogic/ServiceAccess.cs index 79f10af92..50a26a326 100644 --- a/core/BusinessLogic/ServiceAccess.cs +++ b/core/BusinessLogic/ServiceAccess.cs @@ -1,8 +1,8 @@ using System.Runtime.CompilerServices; using DFM.BusinessLogic.Repositories; using DFM.BusinessLogic.Services; -using DFM.Exchange.Exporter; using DFM.BusinessLogic.Validators; +using DFM.Files; using DFM.Queue; [assembly: InternalsVisibleTo("DFM.BusinessLogic.Tests")] diff --git a/core/Core.sln b/core/Core.sln index 339c7aa40..7d07334de 100644 --- a/core/Core.sln +++ b/core/Core.sln @@ -42,6 +42,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Queue", "Queue\Queue.csproj EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Queue.TestApp", "Tests\Queue.TestApp\Queue.TestApp.csproj", "{60CC8C3A-E427-418D-BF79-279DB588BAE2}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Files", "Files\Files.csproj", "{2D492082-2389-4EB9-8345-3F8E6022B6CB}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution BrowserTests|Any CPU = BrowserTests|Any CPU @@ -143,6 +145,12 @@ Global {60CC8C3A-E427-418D-BF79-279DB588BAE2}.Debug|Any CPU.Build.0 = Debug|Any CPU {60CC8C3A-E427-418D-BF79-279DB588BAE2}.Release|Any CPU.ActiveCfg = Release|Any CPU {60CC8C3A-E427-418D-BF79-279DB588BAE2}.Release|Any CPU.Build.0 = Release|Any CPU + {2D492082-2389-4EB9-8345-3F8E6022B6CB}.BrowserTests|Any CPU.ActiveCfg = Debug|Any CPU + {2D492082-2389-4EB9-8345-3F8E6022B6CB}.BrowserTests|Any CPU.Build.0 = Debug|Any CPU + {2D492082-2389-4EB9-8345-3F8E6022B6CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2D492082-2389-4EB9-8345-3F8E6022B6CB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2D492082-2389-4EB9-8345-3F8E6022B6CB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2D492082-2389-4EB9-8345-3F8E6022B6CB}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/core/Exchange/Exchange.csproj b/core/Exchange/Exchange.csproj index d3712678d..fcc4b1bd8 100644 --- a/core/Exchange/Exchange.csproj +++ b/core/Exchange/Exchange.csproj @@ -9,7 +9,6 @@ - diff --git a/core/Files/Files.csproj b/core/Files/Files.csproj new file mode 100644 index 000000000..1b89fc848 --- /dev/null +++ b/core/Files/Files.csproj @@ -0,0 +1,21 @@ + + + + net8.0 + enable + enable + DFM.$(MSBuildProjectName) + DFM.$(MSBuildProjectName.Replace(" ", "_")) + 12.1.0.0 + 12.1.0.0 + + + + + + + + + + + diff --git a/core/Exchange/Exporter/IFileService.cs b/core/Files/IFileService.cs similarity index 77% rename from core/Exchange/Exporter/IFileService.cs rename to core/Files/IFileService.cs index 3c7039025..3823a17ab 100644 --- a/core/Exchange/Exporter/IFileService.cs +++ b/core/Files/IFileService.cs @@ -1,6 +1,4 @@ -using System; - -namespace DFM.Exchange.Exporter; +namespace DFM.Files; public interface IFileService { diff --git a/core/Exchange/Exporter/LocalFileService.cs b/core/Files/LocalFileService.cs similarity index 80% rename from core/Exchange/Exporter/LocalFileService.cs rename to core/Files/LocalFileService.cs index 61a8d0adf..56253c513 100644 --- a/core/Exchange/Exporter/LocalFileService.cs +++ b/core/Files/LocalFileService.cs @@ -1,16 +1,13 @@ -using System; -using System.IO; -using CsvHelper.Configuration; -using DFM.Generic; +using DFM.Generic; -namespace DFM.Exchange.Exporter +namespace DFM.Files { public class LocalFileService : IFileService { public LocalFileService() { if (!Cfg.S3.LocalFilled) - throw new ConfigurationException("Must have section S3 whole configured for local files"); + throw new SystemError("Must have section S3 whole configured for local files"); } public void Upload(String path) diff --git a/core/Exchange/Exporter/S3Service.cs b/core/Files/S3Service.cs similarity index 87% rename from core/Exchange/Exporter/S3Service.cs rename to core/Files/S3Service.cs index 3afbcc19a..9f2f4d5d3 100644 --- a/core/Exchange/Exporter/S3Service.cs +++ b/core/Files/S3Service.cs @@ -1,20 +1,17 @@ -using System; -using System.IO; -using System.Net; +using System.Net; using Amazon; using Amazon.S3; using Amazon.S3.Transfer; -using CsvHelper.Configuration; using DFM.Generic; -namespace DFM.Exchange.Exporter +namespace DFM.Files { public class S3Service : IDisposable, IFileService { public S3Service() { if (!Cfg.S3.S3Filled) - throw new ConfigurationException("Must have section S3 whole configured for aws"); + throw new SystemError("Must have section S3 whole configured for aws"); var region = RegionEndpoint.GetBySystemName(Cfg.S3.Region); var accessKey = Cfg.S3.AccessKey; diff --git a/core/Queue/LocalQueueService.cs b/core/Queue/LocalQueueService.cs index 91ebd0215..ee13a9d0d 100644 --- a/core/Queue/LocalQueueService.cs +++ b/core/Queue/LocalQueueService.cs @@ -7,6 +7,12 @@ namespace DFM.Queue; public class LocalQueueService : IQueueService { + public LocalQueueService() + { + if (!Cfg.SQS.LocalFilled) + throw new SystemError("Must have section SQS whole configured for local files"); + } + private IDictionary> queues = new Dictionary> { diff --git a/core/Queue/SQSService.cs b/core/Queue/SQSService.cs index 8977983a5..4ce25d911 100644 --- a/core/Queue/SQSService.cs +++ b/core/Queue/SQSService.cs @@ -12,6 +12,9 @@ public class SQSService : IQueueService, IDisposable { public SQSService() { + if (!Cfg.SQS.SQSFilled) + throw new SystemError("Must have section SQS whole configured for aws"); + var region = RegionEndpoint.GetBySystemName(Cfg.SQS.Region); var accessKey = Cfg.SQS.AccessKey; var secretKey = Cfg.SQS.SecretKey; diff --git a/core/Tests/BusinessLogic/Steps/BaseStep.cs b/core/Tests/BusinessLogic/Steps/BaseStep.cs index db8002b3c..a9580d095 100644 --- a/core/Tests/BusinessLogic/Steps/BaseStep.cs +++ b/core/Tests/BusinessLogic/Steps/BaseStep.cs @@ -10,7 +10,7 @@ using DFM.Entities; using DFM.Entities.Bases; using DFM.Entities.Enums; -using DFM.Exchange.Exporter; +using DFM.Files; using DFM.Generic; using DFM.Generic.Datetime; using DFM.Queue; @@ -34,7 +34,7 @@ protected BaseStep(ScenarioContext context) private protected static Valids valids; private protected static Repos repos; - private protected static IFileService fileService; + private protected static LocalFileService fileService; private protected static LocalQueueService queueService; private static String logFileName;