public async Task MutateStateAsync(string container, string blobName, WorkflowState newState) { var newStateText = $"{newState.ToString().ToLowerInvariant()}"; var containerReference = blobClient.GetContainerReference(container); var blob = containerReference.GetBlockBlobReference(blobName); var oldStateText = blobName.Substring(0, blobName.IndexOf('/')); logger.LogInformation($"Mutating state from '{oldStateText}' to '{newStateText}' for {blob.Uri.AbsoluteUri}"); var newBlobName = blobName.Replace(oldStateText, $"{newState.ToString().ToLowerInvariant()}"); var data = await blob.DownloadTextAsync(); await UploadFileTextAsync(data, container, newBlobName); await blob.DeleteIfExistsAsync(); }
public void CalendarItemUpdate(Appointment appointment, WorkflowState workflowState, bool resetBody) { Outlook.AppointmentItem item = AppointmentItemFind(appointment.GlobalId, appointment.Start); item.Body = appointment.Body; item.Location = workflowState.ToString(); #region item.Categories = 'workflowState'... switch (workflowState) { case WorkflowState.Planned: item.Categories = null; break; case WorkflowState.Processed: item.Categories = "Processing"; break; case WorkflowState.Created: item.Categories = "Processing"; break; case WorkflowState.Sent: item.Categories = "Sent"; break; case WorkflowState.Retrived: item.Categories = "Retrived"; break; case WorkflowState.Completed: item.Categories = "Completed"; break; case WorkflowState.Canceled: item.Categories = "Canceled"; break; case WorkflowState.Revoked: item.Categories = "Revoked"; break; case WorkflowState.Failed_to_expection: item.Categories = "Error"; break; case WorkflowState.Failed_to_intrepid: item.Categories = "Error"; break; } #endregion if (resetBody) { item.Body = UnitTest_CalendarBody(); } item.Save(); log.LogStandard("Not Specified", PrintAppointment(item) + " updated to " + workflowState.ToString()); }
public async Task <List <string> > GetByStateAsync(string container, WorkflowState state) { var containerReference = blobClient.GetContainerReference(container); var blobs = await GetBlobsWithPrefixAsync(containerReference, state.ToString().ToLowerInvariant()); return(blobs.Select(b => b.Name).ToList()); }
/// <summary> /// Return all blobs for a given state, except readme files /// </summary> /// <param name="state">Workflow state to query for</param> /// <returns></returns> public async Task <IEnumerable <CloudBlockBlob> > GetWorkflowsByStateAsync(WorkflowState state) { var containerReference = blobClient.GetContainerReference(WorkflowsContainerName); var lowercaseState = state.ToString().ToLowerInvariant(); var blobs = await GetBlobsWithPrefixAsync(containerReference, lowercaseState); var readmeBlobName = $"{lowercaseState}/readme.txt"; return(blobs.Where(blob => !blob.Name.Equals(readmeBlobName, StringComparison.OrdinalIgnoreCase))); }
public async void ExceptionCaughtAndRethrownAsWorkflowActionException() { // Arrange var stepThatThrowsException = new ExceptionalStep(); // Actsert var exeception = await Assert.ThrowsAsync <WorkflowActionException <SimpleWorkflowState> >(async() => await stepThatThrowsException.Execute(_workflowState)); Assert.True(exeception.InnerException is NotImplementedException); Assert.Equal(_workflowState.ToString(), exeception.WorkflowState.ToString()); }
/// <inheritdoc /> public async Task <IEnumerable <TriggerFile> > GetWorkflowsByStateAsync(WorkflowState state) { var containerReference = blobClient.GetContainerReference(WorkflowsContainerName); var lowercaseState = state.ToString().ToLowerInvariant(); var blobs = await GetBlobsWithPrefixAsync(containerReference, lowercaseState); var readmeBlobName = $"{lowercaseState}/readme.txt"; return(blobs .Where(blob => !blob.Name.Equals(readmeBlobName, StringComparison.OrdinalIgnoreCase)) .Where(blob => blob.Properties.LastModified.HasValue) .Select(blob => new TriggerFile { Uri = blob.Uri.AbsoluteUri, ContainerName = WorkflowsContainerName, Name = blob.Name, LastModified = blob.Properties.LastModified.Value })); }
public bool AppointmentsUpdate(string globalId, WorkflowState workflowState, string body, string expectionString, string response) { try { using (var db = GetContextO()) { var match = db.appointments.SingleOrDefault(x => x.global_id == globalId); if (match == null) { return(false); } match.workflow_state = workflowState.ToString(); match.updated_at = DateTime.Now; match.completed = 0; #region match.body = body ... if (body != null) { match.body = body; } #endregion match.response = response; match.expectionString = expectionString; match.version = match.version + 1; db.SaveChanges(); db.appointment_versions.Add(MapAppointmentVersions(match)); db.SaveChanges(); return(true); } } catch (Exception ex) { log.LogException("Not Specified", t.GetMethodName() + " failed", ex, false); return(false); } }
public appointments AppointmentsFindOne(WorkflowState workflowState) { try { using (var db = GetContextO()) { var match = db.appointments.FirstOrDefault(x => x.workflow_state == workflowState.ToString()); return(match); } } catch (Exception ex) { log.LogException("Not Specified", t.GetMethodName() + " failed", ex, false); return(null); } }
public async Task <IEnumerable <CloudBlockBlob> > GetWorkflowsByStateAsync(WorkflowState state) { var containerReference = blobClient.GetContainerReference(WorkflowsContainerName); return(await GetBlobsWithPrefixAsync(containerReference, state.ToString().ToLowerInvariant())); }