diff --git a/Conductor/Client/ApiClient.cs b/Conductor/Client/ApiClient.cs index e6bbe06..55ae679 100644 --- a/Conductor/Client/ApiClient.cs +++ b/Conductor/Client/ApiClient.cs @@ -149,7 +149,7 @@ private RestRequest PrepareRequest( /// /// Makes the HTTP request (Sync). - /// If the token is expired then retrying the api call with refreshed Token + /// If the token is expired then retrying the api call with refreshed Token /// /// URL path. /// HTTP method. @@ -200,12 +200,10 @@ private RestResponse RetryRestClientCallApi(String path, Method method, List - /// Convert params to key/value pairs. + /// Convert params to key/value pairs. /// Use collectionFormat to properly format lists and collections. /// /// Key name. diff --git a/Tests/Worker/AnnotatedWorkerTest.cs b/Tests/Worker/AnnotatedWorkerTest.cs index 43581b2..9fba260 100644 --- a/Tests/Worker/AnnotatedWorkerTest.cs +++ b/Tests/Worker/AnnotatedWorkerTest.cs @@ -15,6 +15,7 @@ namespace Tests.Worker public class AnnotatedWorkerTest { private readonly MetadataResourceApi _metaDataClient; + private readonly WorkflowResourceApi _workflowClient; private readonly WorkflowExecutor _workflowExecutor; private const string WORKFLOW_NAME = "test-annotation"; @@ -24,12 +25,14 @@ public class AnnotatedWorkerTest public AnnotatedWorkerTest() { _metaDataClient = ApiExtensions.GetClient(); + _workflowClient = ApiExtensions.GetClient(); var config = new Configuration(); _workflowExecutor = new WorkflowExecutor(config); //dev local testing - //var _orkesApiClient = new OrkesApiClient(config, new OrkesAuthenticationSettings(Constants.KEY_ID, Constants.KEY_SECRET)); + // var _orkesApiClient = new OrkesApiClient(config, new OrkesAuthenticationSettings(Constants.KEY_ID, Constants.KEY_SECRET)); //_metaDataClient = _orkesApiClient.GetClient(); + //_workflowClient = _orkesApiClient.GetClient(); } [Fact] @@ -115,7 +118,7 @@ private ConductorWorkflow GetConductorWorkflow() } /// - /// Registers and starts a workflow + /// Registers and starts a workflow /// /// /// @@ -123,9 +126,9 @@ private ConductorWorkflow GetConductorWorkflow() private void RegisterAndStartWorkflow(ConductorWorkflow workflow, List taskDefs, Dictionary inputData = default) { _metaDataClient.RegisterTaskDef(taskDefs); - _workflowExecutor.RegisterWorkflow(workflow, true); + _metaDataClient.UpdateWorkflowDefinitions(new List(1) { workflow }); - StartWorkflowRequest startWorkflow = new StartWorkflowRequest() + StartWorkflowRequest startWorkflowRequest = new StartWorkflowRequest() { Name = workflow.Name, Input = inputData, @@ -134,7 +137,7 @@ private void RegisterAndStartWorkflow(ConductorWorkflow workflow, List CreatedBy = Constants.OWNER_EMAIL }; - _workflowExecutor.StartWorkflow(startWorkflow); + _workflowClient.StartWorkflow(startWorkflowRequest); var waitHandle = new ManualResetEvent(false); var backgroundTask = System.Threading.Tasks.Task.Run(async () => await Conductor.Examples.Utils.WorkerUtil.StartBackGroundTask(waitHandle)); waitHandle.WaitOne(); diff --git a/Tests/Worker/TestWorkflows.cs b/Tests/Worker/TestWorkflows.cs index afdc6e5..66692af 100644 --- a/Tests/Worker/TestWorkflows.cs +++ b/Tests/Worker/TestWorkflows.cs @@ -5,7 +5,6 @@ using Conductor.Client.Models; using Conductor.Definition; using Conductor.Definition.TaskType; -using Conductor.Executor; using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; @@ -17,19 +16,20 @@ public class TestWorkflows { private readonly OrkesApiClient _orkesApiClient; private readonly WorkflowResourceApi workflowClient; - private readonly WorkflowExecutor _workflowExecutor; + private readonly MetadataResourceApi _metaDataClient; private ILogger _logger; public TestWorkflows() { var config = new Configuration(); - _workflowExecutor = new WorkflowExecutor(config); workflowClient = ApiExtensions.GetClient(); + _metaDataClient = ApiExtensions.GetClient(); _logger = ApplicationLogging.CreateLogger(); //For local testing //_orkesApiClient = new OrkesApiClient(config, new OrkesAuthenticationSettings(Constants.KEY_ID, Constants.KEY_SECRET)); //workflowClient = _orkesApiClient.GetClient(); + // _metaDataClient = _orkesApiClient.GetClient(); } [Fact] @@ -71,7 +71,7 @@ public void TestWorkflowExecution() new TaskMock{ ExecutionTime= 1, Status = TaskMock.StatusEnum.COMPLETED, QueueWaitTime= 10, Output = new Dictionary {{"key", "http.output"}}} }; - _workflowExecutor.RegisterWorkflow(workflow, true); + _metaDataClient.UpdateWorkflowDefinitions(new List(1) { workflow }); var testRequest = new WorkflowTestRequest(name: workflow.Name, version: workflow.Version, taskRefToMockOutput: taskRefToMockOutput, workflowDef: workflow); var run = workflowClient.TestWorkflow(testRequest);