public MazeTaskWriter(XmlWriter xmlWriter, ITaskComponentResolver componentResolver, IXmlSerializerCache serializerCache) { _xmlWriter = xmlWriter; _componentResolver = componentResolver; _serializerCache = serializerCache; _namespaces = new XmlSerializerNamespaces(); _namespaces.Add(string.Empty, string.Empty); }
public CommandExecutionManager(IRestClient restClient, ITaskComponentResolver taskComponentResolver, IXmlSerializerCache xmlSerializerCache, IServiceProvider serviceProvider) { _restClient = restClient; _taskComponentResolver = taskComponentResolver; _xmlSerializerCache = xmlSerializerCache; _serviceProvider = serviceProvider; PendingCommands = new ObservableCollection <PendingCommandViewModel>(); }
public async Task <IActionResult> ExecuteTask([FromServices] ITaskComponentResolver taskComponentResolver, [FromServices] IXmlSerializerCache serializerCache, [FromServices] IExecuteTaskAction executeTaskAction) { var reader = new MazeTaskReader(Request.Body, taskComponentResolver, serializerCache); var task = reader.ReadTask(); var result = await executeTaskAction.BizActionAsync(task); return(BizActionStatus(executeTaskAction, () => Ok(result))); }
public async Task <IActionResult> CreateOrUpdateTask([FromServices] ITaskComponentResolver taskComponentResolver, [FromServices] IXmlSerializerCache serializerCache) { var mazeTask = new MazeTaskReader(Request.Body, taskComponentResolver, serializerCache); var task = mazeTask.ReadTask(); await _clientTaskManager.AddOrUpdateTask(task); return(Ok()); }
public ExecuteTaskAction(IMazeTaskManagerManagement management, IConnectionManager connectionManager, AppDbContext dbContext, ITaskComponentResolver taskComponentResolver, IXmlSerializerCache xmlSerializerCache, IHubContext <AdministrationHub> hubContext) { _management = management; _connectionManager = connectionManager; _dbContext = dbContext; _taskComponentResolver = taskComponentResolver; _xmlSerializerCache = xmlSerializerCache; _hubContext = hubContext; }
public static async Task <MazeTask> FetchTaskAsync(Guid taskId, ITaskComponentResolver taskComponentResolver, IXmlSerializerCache xmlSerializerCache, IRestClient restClient) { using (var response = await CreateRequest(HttpVerb.Get, taskId.ToString("N")).Execute(restClient)) using (var stream = await response.Content.ReadAsStreamAsync()) { var taskReader = new MazeTaskReader(stream, taskComponentResolver, xmlSerializerCache); return(taskReader.ReadTask()); } }
public async Task <IActionResult> CreateTask([FromServices] ITaskComponentResolver taskComponentResolver, [FromServices] IXmlSerializerCache serializerCache, [FromServices] ICreateTaskAction createTaskAction, [FromServices] IHubContext <AdministrationHub> hubContext) { var reader = new MazeTaskReader(Request.Body, taskComponentResolver, serializerCache); var task = reader.ReadTask(); await createTaskAction.BizActionAsync(task); return(await BizActionStatus(createTaskAction, async() => { await hubContext.Clients.All.SendAsync(HubEventNames.TaskCreated, task.Id); return Ok(); })); }
public static async Task <TaskSessionsInfo> ExecuteTask(MazeTask mazeTask, ITaskComponentResolver componentResolver, IXmlSerializerCache xmlCache, IRestClient restClient) { using (var taskMemoryStream = new MemoryStream()) { var taskWriter = new MazeTaskWriter(taskMemoryStream, componentResolver, xmlCache); taskWriter.Write(mazeTask, TaskDetails.Client); taskMemoryStream.Position = 0; var stream = new StreamContent(taskMemoryStream); stream.Headers.ContentEncoding.Add("xml"); return(await CreateRequest(HttpVerb.Post, "execute", stream).Execute(restClient).Return <TaskSessionsInfo>()); } }
public static async Task Update(MazeTask mazeTask, ITaskComponentResolver componentResolver, IXmlSerializerCache xmlCache, IRestClient restClient) { using (var taskMemoryStream = new MemoryStream()) { var taskWriter = new MazeTaskWriter(taskMemoryStream, componentResolver, xmlCache); taskWriter.Write(mazeTask, TaskDetails.Server); taskMemoryStream.Position = 0; var stream = new StreamContent(taskMemoryStream); stream.Headers.ContentEncoding.Add("xml"); await CreateRequest(HttpVerb.Put, mazeTask.Id, stream).Execute(restClient); } }
public async Task <IActionResult> ExecuteTask([FromServices] ITaskComponentResolver taskComponentResolver, [FromServices] IXmlSerializerCache serializerCache) { var mazeTask = new MazeTaskReader(Request.Body, taskComponentResolver, serializerCache); var task = mazeTask.ReadTask(); var memoryStorage = new MemoryTaskStorage(); await _clientTaskManager.TriggerNow(task, SessionKey.Create("Execute"), memoryStorage); return(Ok(new TaskSessionsInfo { Sessions = memoryStorage.Sessions.Select(x => new TaskSessionDto { TaskReferenceId = x.TaskReferenceId, TaskSessionId = x.TaskSessionId, Description = x.Description, CreatedOn = x.CreatedOn }).ToList(), Executions = memoryStorage.Executions.Select(x => new TaskExecutionDto { TaskExecutionId = x.TaskExecutionId, TaskReferenceId = x.TaskReferenceId, TaskSessionId = x.TaskSessionId, CreatedOn = x.CreatedOn }).ToList(), Results = memoryStorage.CommandResults.Select(x => new CommandResultDto { CommandResultId = x.CommandResultId, TaskExecutionId = x.TaskExecutionId, CommandName = x.CommandName, Result = x.Result, Status = x.Status, FinishedAt = x.FinishedAt }).ToList() })); }
/// <summary> /// Maze task file reader /// </summary> /// <param name="stream">Maze task file stream.</param> /// <param name="componentResolver">The service resolver used to resolve the task services</param> /// <param name="leaveStreamOpen">Leave the stream open</param> /// <param name="xmlSerializerCache">The xml serializer cache for deserialization</param> public MazeTaskReader(Stream stream, ITaskComponentResolver componentResolver, IXmlSerializerCache xmlSerializerCache, bool leaveStreamOpen) : base(stream, leaveStreamOpen) { _componentResolver = componentResolver; _xmlSerializerCache = xmlSerializerCache; }
/// <summary> /// Maze task file reader /// </summary> /// <param name="xml">Maze task file xml data.</param> /// <param name="componentResolver">The service resolver used to resolve the task services</param> /// <param name="xmlSerializerCache">The xml serializer cache for deserialization</param> public MazeTaskReader(XDocument xml, ITaskComponentResolver componentResolver, IXmlSerializerCache xmlSerializerCache) : base(xml) { _componentResolver = componentResolver; _xmlSerializerCache = xmlSerializerCache; }
/// <summary> /// Maze task file reader /// </summary> /// <param name="stream">Maze task file stream.</param> /// <param name="componentResolver">The service resolver used to resolve the task services</param> /// <param name="xmlSerializerCache">The xml serializer cache for deserialization</param> public MazeTaskReader(Stream stream, ITaskComponentResolver componentResolver, IXmlSerializerCache xmlSerializerCache) : this(stream, componentResolver, xmlSerializerCache, false) { }
/// <summary> /// Maze task file reader. /// </summary> public MazeTaskReader(string path, ITaskComponentResolver componentResolver, IXmlSerializerCache xmlSerializerCache) : base(path) { _componentResolver = componentResolver; _xmlSerializerCache = xmlSerializerCache; }
public MazeTaskWriter(Stream stream, ITaskComponentResolver componentResolver, IXmlSerializerCache serializerCache) : this( XmlWriter.Create(stream, new XmlWriterSettings { OmitXmlDeclaration = false, Indent = false }), componentResolver, serializerCache) { }