From aaf5dfcd95c398a2465de08ad5ece92dc457f19d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E4=BA=91=E9=87=91YunjinXu?= Date: Wed, 25 Dec 2024 13:40:54 +0800 Subject: [PATCH] refactor(Dtmworkflow): correct typo in WorkflowGlobalTransaction class name - Rename WorlflowGlobalTransaction to WorkflowGlobalTransaction - Update references in ServiceCollectionExtensions, WfTestController, and tests --- samples/DtmSample/Controllers/WfTestController.cs | 4 ++-- src/Dtmworkflow/ServiceCollectionExtensions.cs | 4 ++-- ...Transaction.cs => WorkflowGlobalTransaction.cs} | 6 +++--- tests/Dtmworkflow.Tests/WorkflowHttpTests.cs | 14 +++++++------- 4 files changed, 14 insertions(+), 14 deletions(-) rename src/Dtmworkflow/{WorlflowGlobalTransaction.cs => WorkflowGlobalTransaction.cs} (92%) diff --git a/samples/DtmSample/Controllers/WfTestController.cs b/samples/DtmSample/Controllers/WfTestController.cs index ae87c3f..752f0ac 100644 --- a/samples/DtmSample/Controllers/WfTestController.cs +++ b/samples/DtmSample/Controllers/WfTestController.cs @@ -23,10 +23,10 @@ public class WfTestController : ControllerBase { private readonly ILogger _logger; - private readonly WorlflowGlobalTransaction _globalTransaction; + private readonly WorkflowGlobalTransaction _globalTransaction; private readonly AppSettings _settings; - public WfTestController(ILogger logger, IOptions optionsAccs, WorlflowGlobalTransaction transaction) + public WfTestController(ILogger logger, IOptions optionsAccs, WorkflowGlobalTransaction transaction) { _logger = logger; _settings = optionsAccs.Value; diff --git a/src/Dtmworkflow/ServiceCollectionExtensions.cs b/src/Dtmworkflow/ServiceCollectionExtensions.cs index 9f574c9..55d759b 100644 --- a/src/Dtmworkflow/ServiceCollectionExtensions.cs +++ b/src/Dtmworkflow/ServiceCollectionExtensions.cs @@ -21,7 +21,7 @@ public static IServiceCollection AddDtmWorkflow(this IServiceCollection services services.AddDtmGrpc(setupAction); services.TryAddSingleton(); - services.TryAddSingleton(); + services.TryAddSingleton(); return services; } @@ -32,7 +32,7 @@ public static IServiceCollection AddDtmWorkflow(this IServiceCollection services services.AddDtmGrpc(configuration, sectionName); services.TryAddSingleton(); - services.TryAddSingleton(); + services.TryAddSingleton(); return services; } diff --git a/src/Dtmworkflow/WorlflowGlobalTransaction.cs b/src/Dtmworkflow/WorkflowGlobalTransaction.cs similarity index 92% rename from src/Dtmworkflow/WorlflowGlobalTransaction.cs rename to src/Dtmworkflow/WorkflowGlobalTransaction.cs index 131fdb3..ce4bbec 100644 --- a/src/Dtmworkflow/WorlflowGlobalTransaction.cs +++ b/src/Dtmworkflow/WorkflowGlobalTransaction.cs @@ -6,17 +6,17 @@ namespace Dtmworkflow { - public class WorlflowGlobalTransaction + public class WorkflowGlobalTransaction { private readonly Dictionary _handlers; private readonly IWorkflowFactory _workflowFactory; private readonly ILogger _logger; - public WorlflowGlobalTransaction(IWorkflowFactory workflowFactory, ILoggerFactory loggerFactory) + public WorkflowGlobalTransaction(IWorkflowFactory workflowFactory, ILoggerFactory loggerFactory) { this._handlers = new Dictionary(); this._workflowFactory = workflowFactory; - this._logger = loggerFactory.CreateLogger(); + this._logger = loggerFactory.CreateLogger(); } public async Task Execute(string name, string gid, byte[] data, bool isHttp = true) diff --git a/tests/Dtmworkflow.Tests/WorkflowHttpTests.cs b/tests/Dtmworkflow.Tests/WorkflowHttpTests.cs index e4df8e9..4f77140 100644 --- a/tests/Dtmworkflow.Tests/WorkflowHttpTests.cs +++ b/tests/Dtmworkflow.Tests/WorkflowHttpTests.cs @@ -27,7 +27,7 @@ public async void Execute_Should_Succeed_When_PWF_Succeed() factory.Setup(x => x.NewWorkflow(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())).Returns(wf.Object); - var wfgt = new WorlflowGlobalTransaction(factory.Object, NullLoggerFactory.Instance); + var wfgt = new WorkflowGlobalTransaction(factory.Object, NullLoggerFactory.Instance); var wfName = nameof(Execute_Should_Succeed_When_PWF_Succeed); var gid = Guid.NewGuid().ToString("N"); @@ -56,7 +56,7 @@ public async void Execute_Should_Throw_DtmFailureException_When_PWF_Failed() factory.Setup(x => x.NewWorkflow(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())).Returns(wf.Object); - var wfgt = new WorlflowGlobalTransaction(factory.Object, NullLoggerFactory.Instance); + var wfgt = new WorkflowGlobalTransaction(factory.Object, NullLoggerFactory.Instance); var wfName = nameof(Execute_Should_Throw_DtmFailureException_When_PWF_Failed); var gid = Guid.NewGuid().ToString("N"); @@ -90,7 +90,7 @@ public async void Execute_Should_Succeed_When_PWF_Submitted_And_Progress_Not_Fai factory.Setup(x => x.NewWorkflow(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())).Returns(wf.Object); - var wfgt = new WorlflowGlobalTransaction(factory.Object, NullLoggerFactory.Instance); + var wfgt = new WorkflowGlobalTransaction(factory.Object, NullLoggerFactory.Instance); var wfName = nameof(Execute_Should_Succeed_When_PWF_Submitted_And_Progress_Not_Failed); var gid = Guid.NewGuid().ToString("N"); @@ -125,7 +125,7 @@ public async void Execute_Should_ThrowException_When_WfFunc2_ThrowException() factory.Setup(x => x.NewWorkflow(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())).Returns(wf.Object); - var wfgt = new WorlflowGlobalTransaction(factory.Object, NullLoggerFactory.Instance); + var wfgt = new WorkflowGlobalTransaction(factory.Object, NullLoggerFactory.Instance); var wfName = nameof(Execute_Should_ThrowException_When_WfFunc2_ThrowException); var gid = Guid.NewGuid().ToString("N"); @@ -159,7 +159,7 @@ public async void Execute_Should_Return_Null_When_WfFunc2_ThrowDtmFailureExcepti factory.Setup(x => x.NewWorkflow(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())).Returns(wf.Object); - var wfgt = new WorlflowGlobalTransaction(factory.Object, NullLoggerFactory.Instance); + var wfgt = new WorkflowGlobalTransaction(factory.Object, NullLoggerFactory.Instance); var wfName = nameof(Execute_Should_Return_Null_When_WfFunc2_ThrowDtmFailureException); var gid = Guid.NewGuid().ToString("N"); @@ -192,7 +192,7 @@ public async void Rollback_Should_Be_Executed() factory.Setup(x => x.NewWorkflow(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())).Returns(wf.Object); - var wfgt = new WorlflowGlobalTransaction(factory.Object, NullLoggerFactory.Instance); + var wfgt = new WorkflowGlobalTransaction(factory.Object, NullLoggerFactory.Instance); var wfName = nameof(Rollback_Should_Be_Executed); var gid = Guid.NewGuid().ToString("N"); @@ -232,7 +232,7 @@ public async void Commit_Should_Be_Executed() factory.Setup(x => x.NewWorkflow(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())).Returns(wf.Object); - var wfgt = new WorlflowGlobalTransaction(factory.Object, NullLoggerFactory.Instance); + var wfgt = new WorkflowGlobalTransaction(factory.Object, NullLoggerFactory.Instance); var wfName = nameof(Commit_Should_Be_Executed); var gid = Guid.NewGuid().ToString("N");