some fixes to the PR change requests
This commit is contained in:
parent
f9923b5ca1
commit
80ce9995a8
|
|
@ -63,7 +63,7 @@ namespace Elsa.Activities.Http
|
|||
Category = PropertyCategories.Advanced,
|
||||
UIHint = ActivityInputUIHints.CodeEditor,
|
||||
OptionsProvider = typeof(HttpEndpoint))]
|
||||
public string? Schema { get; set; }
|
||||
public string? Schema { get; set; }
|
||||
|
||||
[ActivityInput(
|
||||
Hint = "Check to allow authenticated requests only",
|
||||
|
|
@ -76,19 +76,14 @@ namespace Elsa.Activities.Http
|
|||
Hint = "Provide a policy to evaluate. If the policy fails, the request is forbidden.",
|
||||
SupportedSyntaxes = new[] { SyntaxNames.Literal, SyntaxNames.JavaScript, SyntaxNames.Liquid },
|
||||
Category = "Security"
|
||||
)]
|
||||
)]
|
||||
public string? Policy { get; set; }
|
||||
|
||||
[ActivityOutput(Hint = "The received HTTP request.")]
|
||||
public HttpRequestModel? Output { get; set; }
|
||||
|
||||
protected override IActivityExecutionResult OnExecute(ActivityExecutionContext context)
|
||||
{
|
||||
var isTest = context.WorkflowExecutionContext.WorkflowInstance.GetMetadata("isTest");
|
||||
var result = context.WorkflowExecutionContext.IsFirstPass && !Convert.ToBoolean(isTest) ? ExecuteInternal(context) : Suspend();
|
||||
protected override IActivityExecutionResult OnExecute(ActivityExecutionContext context) => context.WorkflowExecutionContext.IsFirstPass ? ExecuteInternal(context) : Suspend();
|
||||
|
||||
return result;
|
||||
}
|
||||
protected override IActivityExecutionResult OnResume(ActivityExecutionContext context) => ExecuteInternal(context);
|
||||
|
||||
private IActivityExecutionResult ExecuteInternal(ActivityExecutionContext context)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Elsa.Events;
|
||||
using MediatR;
|
||||
|
||||
namespace Elsa.Server.Api.Handlers
|
||||
{
|
||||
public class ConfigureWorkflowContextForTestHandler : INotificationHandler<WorkflowExecuting>
|
||||
{
|
||||
public Task Handle(WorkflowExecuting notification, CancellationToken cancellationToken)
|
||||
{
|
||||
var isTest = Convert.ToBoolean(notification.WorkflowExecutionContext.WorkflowInstance.GetMetadata("isTest"));
|
||||
|
||||
// If we are in test mode, we always block on the first activity.
|
||||
if (isTest)
|
||||
notification.WorkflowExecutionContext.CompletePass();
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -20,7 +20,7 @@ namespace Elsa.Services
|
|||
{
|
||||
var sut = new WorkflowExecutionContextForWorkflowBlueprintFactory(serviceProvider, workflowFactory);
|
||||
Mock.Get(workflowFactory)
|
||||
.Setup(x => x.InstantiateAsync(workflowBlueprint, default, default, default, default, default, default))
|
||||
.Setup(x => x.InstantiateAsync(workflowBlueprint, default, default, default, default))
|
||||
.Returns(() => Task.FromResult(instance));
|
||||
|
||||
var result = await sut.CreateWorkflowExecutionContextAsync(workflowBlueprint);
|
||||
|
|
|
|||
Loading…
Reference in a new issue