Skip to content

Commit

Permalink
refactor(Dtmworkflow): correct typo in WorkflowGlobalTransaction clas…
Browse files Browse the repository at this point in the history
…s name

- Rename WorlflowGlobalTransaction to WorkflowGlobalTransaction
- Update references in ServiceCollectionExtensions, WfTestController, and tests
  • Loading branch information
wooln committed Dec 25, 2024
1 parent 2aae239 commit aaf5dfc
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions samples/DtmSample/Controllers/WfTestController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ public class WfTestController : ControllerBase
{

private readonly ILogger<WfTestController> _logger;
private readonly WorlflowGlobalTransaction _globalTransaction;
private readonly WorkflowGlobalTransaction _globalTransaction;
private readonly AppSettings _settings;

public WfTestController(ILogger<WfTestController> logger, IOptions<AppSettings> optionsAccs, WorlflowGlobalTransaction transaction)
public WfTestController(ILogger<WfTestController> logger, IOptions<AppSettings> optionsAccs, WorkflowGlobalTransaction transaction)
{
_logger = logger;
_settings = optionsAccs.Value;
Expand Down
4 changes: 2 additions & 2 deletions src/Dtmworkflow/ServiceCollectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public static IServiceCollection AddDtmWorkflow(this IServiceCollection services
services.AddDtmGrpc(setupAction);

services.TryAddSingleton<IWorkflowFactory, WorkflowFactory>();
services.TryAddSingleton<WorlflowGlobalTransaction>();
services.TryAddSingleton<WorkflowGlobalTransaction>();

Check warning on line 24 in src/Dtmworkflow/ServiceCollectionExtensions.cs

View check run for this annotation

Codecov / codecov/patch

src/Dtmworkflow/ServiceCollectionExtensions.cs#L24

Added line #L24 was not covered by tests

return services;
}
Expand All @@ -32,7 +32,7 @@ public static IServiceCollection AddDtmWorkflow(this IServiceCollection services
services.AddDtmGrpc(configuration, sectionName);

services.TryAddSingleton<IWorkflowFactory, WorkflowFactory>();
services.TryAddSingleton<WorlflowGlobalTransaction>();
services.TryAddSingleton<WorkflowGlobalTransaction>();

Check warning on line 35 in src/Dtmworkflow/ServiceCollectionExtensions.cs

View check run for this annotation

Codecov / codecov/patch

src/Dtmworkflow/ServiceCollectionExtensions.cs#L35

Added line #L35 was not covered by tests

return services;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@

namespace Dtmworkflow
{
public class WorlflowGlobalTransaction
public class WorkflowGlobalTransaction
{
private readonly Dictionary<string, WfItem> _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<string, WfItem>();
this._workflowFactory = workflowFactory;
this._logger = loggerFactory.CreateLogger<WorlflowGlobalTransaction>();
this._logger = loggerFactory.CreateLogger<WorkflowGlobalTransaction>();
}

public async Task<byte[]> Execute(string name, string gid, byte[] data, bool isHttp = true)
Expand Down
14 changes: 7 additions & 7 deletions tests/Dtmworkflow.Tests/WorkflowHttpTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public async void Execute_Should_Succeed_When_PWF_Succeed()

factory.Setup(x => x.NewWorkflow(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<byte[]>(), It.IsAny<bool>())).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");
Expand Down Expand Up @@ -56,7 +56,7 @@ public async void Execute_Should_Throw_DtmFailureException_When_PWF_Failed()

factory.Setup(x => x.NewWorkflow(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<byte[]>(), It.IsAny<bool>())).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");
Expand Down Expand Up @@ -90,7 +90,7 @@ public async void Execute_Should_Succeed_When_PWF_Submitted_And_Progress_Not_Fai

factory.Setup(x => x.NewWorkflow(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<byte[]>(), It.IsAny<bool>())).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");
Expand Down Expand Up @@ -125,7 +125,7 @@ public async void Execute_Should_ThrowException_When_WfFunc2_ThrowException()

factory.Setup(x => x.NewWorkflow(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<byte[]>(), It.IsAny<bool>())).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");
Expand Down Expand Up @@ -159,7 +159,7 @@ public async void Execute_Should_Return_Null_When_WfFunc2_ThrowDtmFailureExcepti

factory.Setup(x => x.NewWorkflow(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<byte[]>(), It.IsAny<bool>())).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");
Expand Down Expand Up @@ -192,7 +192,7 @@ public async void Rollback_Should_Be_Executed()

factory.Setup(x => x.NewWorkflow(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<byte[]>(), It.IsAny<bool>())).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");
Expand Down Expand Up @@ -232,7 +232,7 @@ public async void Commit_Should_Be_Executed()

factory.Setup(x => x.NewWorkflow(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<byte[]>(), It.IsAny<bool>())).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");
Expand Down

0 comments on commit aaf5dfc

Please sign in to comment.