예제 #1
0
        public async Task Prepare_DocuSign_Events_For_Storage_Envelope_Run()
        {
            var runUrl = GetTerminalRunUrl();

            var dataDTO = await HealthMonitor_FixtureData.Prepare_DocuSign_Events_For_Storage_v1_InitialConfiguration_Fr8DataDTO(this);

            var date        = DateTime.Now.ToString(DateTimeFormatInfo.InvariantInfo.ShortDatePattern);
            var envelopeId  = Guid.NewGuid().ToString();
            var accountId   = "*****@*****.**";
            var eventId     = Guid.NewGuid().ToString();
            var recipientId = Guid.NewGuid().ToString();

            var envelopePayload = HealthMonitor_FixtureData.GetEnvelopePayload();


            AddPayloadCrate(
                dataDTO,
                new EventReportCM()
            {
                EventPayload = envelopePayload,
                EventNames   = "Receive Envelope"
            }
                );

            AddOperationalStateCrate(dataDTO, new OperationalStateCM());

            var responsePayloadDTO =
                await HttpPostAsync <Fr8DataDTO, PayloadDTO>(runUrl, dataDTO);

            var crateStorage = Crate.GetStorage(responsePayloadDTO);

            Assert.AreEqual(1, crateStorage.CrateContentsOfType <DocuSignEnvelopeCM_v2>(x => x.Label == "DocuSign Envelope").Count());
        }
        //[ExpectedException(
        //    ExpectedException = typeof(RestfulServiceException),
        //    ExpectedMessage = @"{""status"":""terminal_error"",""message"":""One or more errors occurred.""}"
        //)]
        public async Task Send_DocuSign_Envelope_FollowUp_Configuration_NoAuth()
        {
            var configureUrl = GetTerminalConfigureUrl();

            var dataDTO = await HealthMonitor_FixtureData.Send_DocuSign_Envelope_v1_Example_Fr8DataDTO(this);

            var responseActionDTO = await HttpPostAsync <Fr8DataDTO, ActivityDTO>(configureUrl, dataDTO);

            var storage = Crate.GetStorage(responseActionDTO);

            SendDocuSignEnvelope_SelectFirstTemplate(storage);

            using (var crateStorage = Crate.GetUpdatableStorage(dataDTO.ActivityDTO))
            {
                crateStorage.Replace(storage);
            }

            dataDTO.ActivityDTO.AuthToken = null;

            var response = await HttpPostAsync <Fr8DataDTO, ActivityDTO>(configureUrl, dataDTO);

            Assert.NotNull(response);
            Assert.NotNull(response.CrateStorage);
            Assert.NotNull(response.CrateStorage.Crates);
            Assert.True(response.CrateStorage.Crates.Any(x => x.ManifestType == "Standard Authentication"));
        }
        public async void Run_With_Plan_Payload_Initial_Run()
        {
            var configureUrl     = GetTerminalConfigureUrl();
            var requestActionDTO = CreateRequestActivityFixture();

            var dataDTO = new Fr8DataDTO {
                ActivityDTO = requestActionDTO
            };

            var responseActionDTO = await HttpPostAsync <Fr8DataDTO, ActivityDTO>(configureUrl, dataDTO);

            var operationalState = new OperationalStateCM();

            operationalState.CallStack.PushFrame(new OperationalStateCM.StackFrame());
            AddOperationalStateCrate(dataDTO, operationalState);
            var runUrl = GetTerminalRunUrl();

            dataDTO.ActivityDTO = responseActionDTO;
            var runResponse = await HttpPostAsync <Fr8DataDTO, PayloadDTO>(runUrl, dataDTO);

            Assert.NotNull(runResponse);
            var crateStorage          = Crate.GetStorage(runResponse);
            var operationalStateCrate = crateStorage.CrateContentsOfType <OperationalStateCM>().Single();

            Assert.AreEqual(ActivityResponse.RequestSuspend.ToString(), operationalStateCrate.CurrentActivityResponse.Type);
        }
예제 #4
0
        public async Task Monitor_DocuSign_FollowUp_Configuration_RecipientValue()
        {
            var configureUrl = GetTerminalConfigureUrl();

            var activityDTO = await GetActivityDTO_WithRecipientValue();

            var dataDTO = new Fr8DataDTO {
                ActivityDTO = activityDTO
            };
            var responseActionDTO =
                await HttpPostAsync <Fr8DataDTO, ActivityDTO>(
                    configureUrl,
                    dataDTO
                    );

            var crateStorage = Crate.GetStorage(responseActionDTO);

            var availableFields = crateStorage
                                  .CrateContentsOfType <CrateDescriptionCM>(x => x.Label == "Runtime Available Crates")
                                  .Single();

            Assert.AreEqual(1, availableFields.CrateDescriptions.Count, "Unexpected number of available crates");

            Assert.AreEqual(7, availableFields.CrateDescriptions[0].Fields.Count, "Unexpected number of available fields");
        }
        public void Run_With_Plan_Payload_Second_Run()
        {
            var configureUrl     = GetTerminalConfigureUrl();
            var requestActionDTO = CreateRequestActivityFixture();
            var dataDTO          = new Fr8DataDTO {
                ActivityDTO = requestActionDTO
            };

            dataDTO.ActivityDTO = HttpPostAsync <Fr8DataDTO, ActivityDTO>(configureUrl, dataDTO).Result;
            SetDuration(dataDTO.ActivityDTO);
            var runUrl           = GetTerminalRunUrl();
            var operationalState = new OperationalStateCM();

            operationalState.CallStack.PushFrame(new OperationalStateCM.StackFrame {
                CurrentActivityExecutionPhase = OperationalStateCM.ActivityExecutionPhase.ProcessingChildren
            });
            operationalState.CallStack.PushFrame(new OperationalStateCM.StackFrame {
                CurrentActivityExecutionPhase = OperationalStateCM.ActivityExecutionPhase.WasNotExecuted
            });
            operationalState.CallStack.StoreLocalData("Delay", "suspended");
            AddOperationalStateCrate(dataDTO, operationalState);

            var runResponse = HttpPostAsync <Fr8DataDTO, PayloadDTO>(runUrl, dataDTO).Result;

            Assert.NotNull(runResponse);
            var crateStorage          = Crate.GetStorage(runResponse);
            var operationalStateCrate = crateStorage.CrateContentsOfType <OperationalStateCM>().Single();

            Assert.AreEqual(ActivityResponse.Success.ToString(), operationalStateCrate.CurrentActivityResponse.Type);
        }
예제 #6
0
        private bool IsContainerAvailable(Guid planId)
        {
            using (var uow = ObjectFactory.GetInstance <IUnitOfWork>())
            {
                var container = uow.ContainerRepository
                                .GetQuery()
                                .Where(x => x.PlanId == planId)
                                .FirstOrDefault();

                if (container != null)
                {
                    var crateStorage          = Crate.GetStorage(container.CrateStorage);
                    var monitorActivityResult = crateStorage
                                                .CrateContentsOfType <StandardTableDataCM>(x => x.Label == "Lead Created/Updated on Salesforce.com")
                                                .FirstOrDefault();

                    if (monitorActivityResult != null)
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
        public async Task Post_To_Chatter_Run_With_ValidParameter_Check_PayloadDto_OperationalState()
        {
            //Arrange
            var authToken = terminalIntegrationTests.Fixtures.HealthMonitor_FixtureData.Salesforce_AuthToken().Result;
            var initialConfigActionDto = await PerformInitialConfiguration();

            initialConfigActionDto.AuthToken = authToken;
            var dataDTO = new Fr8DataDTO {
                ActivityDTO = initialConfigActionDto
            };

            AddOperationalStateCrate(dataDTO, new OperationalStateCM());

            //Act
            var responseOperationalState = await HttpPostAsync <Fr8DataDTO, PayloadDTO>(GetTerminalRunUrl(), dataDTO);

            //Assert
            Assert.IsNotNull(responseOperationalState);
            var newFeedIdCrate = Crate.GetStorage(responseOperationalState)
                                 .CratesOfType <StandardPayloadDataCM>()
                                 .SingleOrDefault();

            Assert.IsNotNull(newFeedIdCrate, "Feed is not created");
            Assert.IsTrue(await _container.GetInstance <SalesforceManager>().Delete(SalesforceObjectType.FeedItem,
                                                                                    newFeedIdCrate.Content.PayloadObjects[0].PayloadObject[0].Value, new AuthorizationToken {
                Token = authToken.Token, AdditionalAttributes = authToken.AdditionalAttributes
            }), "Test feed created is not deleted");
        }
        public void CheckIfPayloadHasNeedsAuthenticationError(PayloadDTO payload)
        {
            var storage            = Crate.GetStorage(payload);
            var operationalStateCM = storage.CrateContentsOfType <OperationalStateCM>().Single();

            Assert.AreEqual(ActivityResponse.Error, operationalStateCM.CurrentActivityResponse);
            Assert.AreEqual(ActionErrorCode.NO_AUTH_TOKEN_PROVIDED, operationalStateCM.CurrentActivityErrorCode);
            Assert.AreEqual("No AuthToken provided.", operationalStateCM.CurrentActivityErrorMessage);
        }
        public void AddCrate <T>(ActivityDTO activityDTO, T crateManifest, string label)
        {
            var crateStorage = Crate.GetStorage(activityDTO.ExplicitData);

            var crate = Crate <T> .FromContent(label, crateManifest);

            crateStorage.Add(crate);

            activityDTO.ExplicitData = Crate.CrateStorageAsStr(crateStorage);
        }
        public async Task Publish_To_Slack_v1_Initial_Configuration_Check_Crate_Structure_NoAuth()
        {
            // Act
            var responseActionDTO = await ConfigureInitial(false);

            var crateStorage = Crate.GetStorage(responseActionDTO);

            Assert.AreEqual(1, crateStorage.Count, "Configuration response for not-autheticated call should contain only one crate");
            Assert.AreEqual(1, crateStorage.CratesOfType <StandardAuthenticationCM>().Count(), "Configuration response for non-autheticated call doesn't contain Standard Authentication crate");
        }
예제 #11
0
        public async Task MonitorChannel_InitialConfigurationWithoutAuth_ReturnAuthenticationCrate()
        {
            var configureUrl   = GetTerminalConfigureUrl();
            var requestDataDTO = HealthMonitor_FixtureData.Monitor_Channel_v1_InitialConfiguration_Fr8DataDTO();

            requestDataDTO.ActivityDTO.AuthToken = null;
            var responseActivityDTO = await HttpPostAsync <Fr8DataDTO, ActivityDTO>(configureUrl, requestDataDTO);

            var authCrate = Crate.GetStorage(responseActivityDTO).FirstCrateOrDefault <StandardAuthenticationCM>();

            Assert.IsNotNull(authCrate, "Authentication crate is not found in unauthenticated request response");
        }
        public async Task Post_To_Chatter_Initial_Configuration_Check_Crate_Structure()
        {
            //Act
            var initialConfigActionDto = await PerformInitialConfiguration();

            //Assert
            Assert.IsNotNull(initialConfigActionDto.CrateStorage, "Initial Configuration of Post To Chatter activity contains no crate storage");
            var storage = Crate.GetStorage(initialConfigActionDto);

            Assert.AreEqual(2, storage.Count, "Number of configuration crates not populated correctly");
            Assert.IsNotNull(storage.FirstCrateOrDefault <StandardConfigurationControlsCM>(), "Configuration controls crate is not found in activity storage");
            Assert.IsNotNull(storage.FirstCrateOrDefault <CrateDescriptionCM>(), "Crate with runtime crates desriptions is not found in activity storage");
        }
예제 #13
0
        public async Task MonitorChannel_WhenMessageComesNotFromMonitoredChannel_ProcessingIsTerminated()
        {
            var runUrl  = GetTerminalRunUrl();
            var dataDTO = await GetConfiguredActivityWithChannelSelected("random");

            AddOperationalStateCrate(dataDTO, new OperationalStateCM());
            var responsePayloadDTO = await HttpPostAsync <Fr8DataDTO, PayloadDTO>(runUrl, dataDTO);

            var storage            = Crate.GetStorage(responsePayloadDTO);
            var operationalStateCM = storage.CrateContentsOfType <OperationalStateCM>().Single();

            Assert.AreEqual(ActivityResponse.RequestTerminate.ToString(), operationalStateCM.CurrentActivityResponse.Type, "No downstream activities should run if message comes from the wrong channel");
        }
        public async Task Convert_TableData_To_AccountingTransactions()
        {
            //Arrange
            var configureUrl = GetTerminalConfigureUrl();
            var runUrl       = GetTerminalRunUrl();
            var dataDTO      =
                HealthMonitor_FixtureData.Convert_TableData_To_AccountingTransactions_v1_InitialConfiguration_Fr8DataDTO();
            var firstResponseActionDTO = await HttpPostAsync <Fr8DataDTO, ActivityDTO>(
                configureUrl,
                dataDTO
                );

            dataDTO.ActivityDTO = firstResponseActionDTO;

            var curAccountsCrate  = HealthMonitor_FixtureData.ChartOfAccounts_Test1();
            var curTableDataCrate = HealthMonitor_FixtureData.StandardTableData_Test1();

            AddUpstreamCrate(dataDTO, curTableDataCrate, "DocuSignTableDataMappedToQuickbooks");
            using (var crateStorage = Crate.GetUpdatableStorage(dataDTO.ActivityDTO))
            {
                crateStorage.Add(Fr8.Infrastructure.Data.Crates.Crate.FromContent("ChartOfAccounts", curAccountsCrate));
            }

            //Act
            using (var crateStorage = Crate.GetUpdatableStorage(dataDTO.ActivityDTO))
            {
                var controls = crateStorage
                               .CrateContentsOfType <StandardConfigurationControlsCM>()
                               .Single();
                //Set the button group data
                var radioGroup = (RadioButtonGroup)controls.FindByName("DebitCredit");
                radioGroup.Radios[0].Selected = true;
                radioGroup.Radios[1].Selected = false;
                //Set first distribution line data to controls
                var firstLineGroup = (RadioButtonGroup)controls.FindByName("Line1");
                firstLineGroup.Radios[0].Selected = true;
                firstLineGroup.Radios[1].Selected = false;
                //Set debit account name to the control
                firstLineGroup.Radios[0].Controls[0].Value = "Accounts Payable";
                //Set memo
                var memoTextBox = controls.FindByName("Memo");
                memoTextBox.Value = "The testing transactions";
                crateStorage.Remove <StandardAccountingTransactionCM>();
                crateStorage.Add(Fr8.Infrastructure.Data.Crates.Crate.FromContent("StandardConfigurationControlsCM", controls));
                AddOperationalStateCrate(dataDTO, new OperationalStateCM());
                dataDTO.ActivityDTO.AuthToken = HealthMonitor_FixtureData.QuickBooks_AuthTokenDTO();
            }
            var payloadDTO = await HttpPostAsync <Fr8DataDTO, PayloadDTO>(runUrl, dataDTO);

            AssertControls(Crate.GetStorage(payloadDTO).FirstCrateContentOrDefault <StandardAccountingTransactionCM>());
        }
예제 #15
0
        public async Task MonitorChannel_WhenAllChannelsAreMonitored_AnyMessageIsProcessed()
        {
            var runUrl  = GetTerminalRunUrl();
            var dataDTO = await GetConfiguredActivityWithChannelSelected();

            AddOperationalStateCrate(dataDTO, new OperationalStateCM());
            var responsePayloadDTO = await HttpPostAsync <Fr8DataDTO, PayloadDTO>(runUrl, dataDTO);

            var crateStorage = Crate.GetStorage(responsePayloadDTO);
            var slackPayload = crateStorage.CrateContentsOfType <StandardPayloadDataCM>(x => x.Label == Monitor_Channel_v1.ResultPayloadCrateLabel).FirstOrDefault();

            Assert.IsNotNull(slackPayload, "Payload doesn't contain message received from non-specific channel");
            Assert.AreEqual(1, slackPayload.AllValues().Where(a => a.Key == "text" && a.Value == "test").Count(), "Payload content doesn't match received message");
        }
        public void CheckIfPayloadHasNeedsAuthenticationError(PayloadDTO payload)
        {
            var storage            = Crate.GetStorage(payload);
            var operationalStateCM = storage.CrateContentsOfType <OperationalStateCM>().Single();

            //extract current error message from current activity response
            ErrorDTO errorMessage;

            operationalStateCM.CurrentActivityResponse.TryParseErrorDTO(out errorMessage);

            Assert.AreEqual(ActivityResponse.Error.ToString(), operationalStateCM.CurrentActivityResponse.Type);
            Assert.AreEqual(ActivityErrorCode.AUTH_TOKEN_NOT_PROVIDED_OR_INVALID.ToString(), errorMessage.ErrorCode);
            Assert.AreEqual("No AuthToken provided.", errorMessage.Message);
        }
        public Task <List <ActivityTemplateDTO> > GetActivityTemplates(bool getLatestsVersionsOnly = false)
        {
            var searchLabel = LabelPrefix + "_ActivityTemplate";

            var crateStorage      = Crate.GetStorage(ExplicitData);
            var activityTemplates = crateStorage
                                    .Where(x => x.Label == searchLabel)
                                    .Select(x => JsonConvert.DeserializeObject <ActivityTemplateDTO>(
                                                x.Get <KeyValueListCM>().Values[0].Value
                                                )
                                            )
                                    .ToList();

            return(Task.FromResult(activityTemplates));
        }
        public Task <List <Crate <TManifest> > > GetCratesByDirection <TManifest>(Guid activityId, CrateDirection direction)
        {
            var searchLabel = direction == CrateDirection.Upstream
                ? LabelPrefix + "_UpstreamCrate"
                : LabelPrefix + "_DownstreamCrate";

            var crateStorage = Crate.GetStorage(ExplicitData);
            var crates       = crateStorage
                               .CratesOfType <TManifest>(x => x.Label.StartsWith(searchLabel))
                               .ToList();

            StripLabelPrefix(crates, searchLabel);

            return(Task.FromResult(crates));
        }
        public async Task Write_To_Sql_Server_FollowUp_Configuration_Check_Crate_Structure_Incorrect_ConnectionString()
        {
            var configureUrl = GetTerminalConfigureUrl();

            var fr8DataDTO = HealthMonitor_FixtureData.Write_To_Sql_Server_v1_InitialConfiguration_Fr8DataDTO();

            var responseActionDTO =
                await HttpPostAsync <Fr8DataDTO, ActivityDTO>(
                    configureUrl,
                    fr8DataDTO
                    );


            var storage = Crate.GetStorage(responseActionDTO);

            var controlDefinitionDTO =
                storage.CratesOfType <StandardConfigurationControlsCM>()
                .Select(x => x.Content.FindByName("connection_string")).ToArray();

            //provide incorrect connection string
            controlDefinitionDTO[0].Value = FixtureData.TestConnectionString3().Value;

            using (var updatableStorage = Crate.GetUpdatableStorage(responseActionDTO))
            {
                updatableStorage.Replace(storage);
            }
            fr8DataDTO.ActivityDTO = responseActionDTO;
            responseActionDTO      =
                await HttpPostAsync <Fr8DataDTO, ActivityDTO>(
                    configureUrl,
                    fr8DataDTO
                    );

            Assert.NotNull(responseActionDTO);
            Assert.NotNull(responseActionDTO.CrateStorage);
            var crateStorage = Crate.FromDto(responseActionDTO.CrateStorage);

            //There will be no DesignTimeCrate only Configuration crate
            Assert.AreEqual(1, crateStorage.Count);
            Assert.AreEqual(1, crateStorage.CratesOfType <StandardConfigurationControlsCM>().Count());
            var controls = crateStorage.CrateContentsOfType <StandardConfigurationControlsCM>().Single();

            AssertConfigureControls(controls);
            //Check that Error message is shown
            var connStringTextBox = (TextBox)controls.Controls[0];

            Assert.AreEqual("Incorrect Connection String", connStringTextBox.Value);
        }
예제 #20
0
        public async Task Write_To_Log_Run_WithInvalidPapertrailUrl_ShouldReturnError()
        {
            //Arrange
            var runUrl = GetTerminalRunUrl();

            //prepare the action DTO with valid target URL
            var activityDTO = await GetActivityDTO_LogToPapertrailIntegrationTest();

            var dataDTO = new Fr8DataDTO {
                ActivityDTO = activityDTO
            };

            //make the target URL as invalid
            using (var crateStorage = Crate.GetUpdatableStorage(activityDTO))
            {
                var controls = crateStorage.CrateContentsOfType <StandardConfigurationControlsCM>().Single();

                var targetUrlTextBox = (TextBox)controls.Controls[0];
                targetUrlTextBox.Value = "InvalidUrl";
            }

            //add the Log Message in upstream action
            AddPayloadCrate(dataDTO,
                            new StandardLoggingCM
            {
                Item =
                    new List <LogItemDTO>
                {
                    new LogItemDTO {
                        Data = "Integration Test Log Message on " + DateTime.Now, IsLogged = false
                    }
                }
            });

            AddOperationalStateCrate(dataDTO, new OperationalStateCM());

            //Act
            var payload = await HttpPostAsync <Fr8DataDTO, PayloadDTO>(runUrl, dataDTO);

            var      storage            = Crate.GetStorage(payload);
            var      operationalStateCM = storage.CrateContentsOfType <OperationalStateCM>().Single();
            ErrorDTO errorMessage;

            operationalStateCM.CurrentActivityResponse.TryParseErrorDTO(out errorMessage);

            Assert.AreEqual(ActivityResponse.Error.ToString(), operationalStateCM.CurrentActivityResponse.Type);
            Assert.AreEqual("Papertrail URL and PORT are not in the correct format. The given URL is InvalidUrl", errorMessage.Message);
        }
        private async Task <ActivityDTO> ConfigurationRequest()
        {
            var configureUrl = GetTerminalConfigureUrl();

            var requestDataDTO = HealthMonitor_FixtureData.Publish_To_Slack_v1_InitialConfiguration_Fr8DataDTO();

            var responseActionDTO = await HttpPostAsync <Fr8DataDTO, ActivityDTO>(configureUrl, requestDataDTO);

            var storage = Crate.GetStorage(responseActionDTO);

            using (var crateStorage = Crate.GetUpdatableStorage(requestDataDTO.ActivityDTO))
            {
                crateStorage.Replace(storage);
            }

            return(await HttpPostAsync <Fr8DataDTO, ActivityDTO>(configureUrl, requestDataDTO));
        }
        protected void AddHubCrate <T>(Fr8DataDTO dataDTO, T crateManifest, string label, string innerLabel)
        {
            var crateStorage = Crate.GetStorage(dataDTO.ExplicitData);

            var fullLabel = label;

            if (!string.IsNullOrEmpty(innerLabel))
            {
                fullLabel += "_" + innerLabel;
            }

            var crate = Crate <T> .FromContent(fullLabel, crateManifest);

            crateStorage.Add(crate);

            dataDTO.ExplicitData = Crate.CrateStorageAsStr(crateStorage);
        }
        public async Task Write_To_Sql_Server_FollowUp_Configuration_Check_Crate_Structure()
        {
            var configureUrl = GetTerminalConfigureUrl();

            var fr8DataDTO = HealthMonitor_FixtureData.Write_To_Sql_Server_v1_InitialConfiguration_Fr8DataDTO();

            var responseActionDTO =
                await HttpPostAsync <Fr8DataDTO, ActivityDTO>(
                    configureUrl,
                    fr8DataDTO
                    );


            var storage = Crate.GetStorage(responseActionDTO);

            var controlDefinitionDTO =
                storage.CratesOfType <StandardConfigurationControlsCM>()
                .Select(x => x.Content.FindByName("connection_string")).ToArray();

            controlDefinitionDTO[0].Value = FixtureData.TestConnectionString2().Value;

            using (var updatableStorage = Crate.GetUpdatableStorage(responseActionDTO))
            {
                updatableStorage.Replace(storage);
            }
            fr8DataDTO.ActivityDTO = responseActionDTO;
            responseActionDTO      =
                await HttpPostAsync <Fr8DataDTO, ActivityDTO>(
                    configureUrl,
                    fr8DataDTO
                    );

            Assert.NotNull(responseActionDTO);
            Assert.NotNull(responseActionDTO.CrateStorage);

            var crateStorage = Crate.FromDto(responseActionDTO.CrateStorage);

            Assert.AreEqual(1, crateStorage.Count);
            Assert.AreEqual(1, crateStorage.CratesOfType <StandardConfigurationControlsCM>().Count());

            AssertConfigureControls(crateStorage.CrateContentsOfType <StandardConfigurationControlsCM>().Single());
        }
예제 #24
0
        public async Task Write_To_Log_Run_WithUpstreamActivityLog_ValidTargetUrl_ShouldLogMessage()
        {
            //Arrange
            var runUrl = GetTerminalRunUrl();

            //prepare action DTO with valid target URL
            var activityDTO = await GetActivityDTO_LogToPapertrailIntegrationTest();

            var dataDTO = new Fr8DataDTO {
                ActivityDTO = activityDTO
            };

            //add the log message in upstream action
            AddPayloadCrate(dataDTO,
                            new StandardLoggingCM
            {
                Item =
                    new List <LogItemDTO>
                {
                    new LogItemDTO {
                        Data = "Integration Test Log Message on " + DateTime.Now, IsLogged = false
                    }
                }
            });

            AddOperationalStateCrate(dataDTO, new OperationalStateCM());

            //Act
            var responsePayloadDTO =
                await HttpPostAsync <Fr8DataDTO, PayloadDTO>(runUrl, dataDTO);

            //Assert the returned paylod contains the log messages with IsLogged is set to True.
            var loggedMessageCrate = Crate.GetStorage(responsePayloadDTO).Single(x => x.Label.Equals("Log Messages"));

            Assert.IsTrue(loggedMessageCrate.IsOfType <StandardLoggingCM>(), "The returned logged message crate is not of type Standard Logging Manifest.");

            var loggedMessage = loggedMessageCrate.Get <StandardLoggingCM>();

            Assert.AreEqual(1, loggedMessage.Item.Count, "The number of logged message is not 1.");
            Assert.IsTrue(loggedMessage.Item[0].IsLogged, "The logging did not happen and the log message is not stored in Papertrail");
        }
        public Task <PayloadDTO> GetPayload(Guid containerId)
        {
            var payload = new PayloadDTO(containerId)
            {
                CrateStorage = new CrateStorageDTO()
            };

            var crateStorage = Crate.GetStorage(ExplicitData);

            using (var updatableStorage = Crate.GetUpdatableStorage(payload))
            {
                var crates = crateStorage
                             .Where(x => x.Label.StartsWith(LabelPrefix + "_PayloadCrate"))
                             .ToList();

                StripLabelPrefix(crates, LabelPrefix + "_PayloadCrate");

                updatableStorage.AddRange(crates);
            }

            return(Task.FromResult(payload));
        }
        public async Task ConnectToSql_Run()
        {
            var runUrl = GetTerminalRunUrl();

            var dataDTO = FixtureData.ConnectToSql_InitialConfiguration_Fr8DataDTO();

            AddOperationalStateCrate(dataDTO, new OperationalStateCM());

            AddPayloadCrate(
                dataDTO,
                new EventReportCM()
                );

            var responsePayloadDTO =
                await HttpPostAsync <Fr8DataDTO, PayloadDTO>(runUrl, dataDTO);

            Assert.NotNull(responsePayloadDTO);

            var crateStorage = Crate.GetStorage(responsePayloadDTO);

            Assert.AreEqual(2, crateStorage.Count);
        }
예제 #27
0
        public async Task MonitorForNewMediaPosted_Run_Without_EventPayload_Should_Terminate()
        {
            var configureUrl = GetTerminalConfigureUrl();
            var responseDTO  = await CompleteInitialConfiguration();

            responseDTO.AuthToken = FixtureData.Instagram_AuthToken();
            var dataDTO = new Fr8DataDTO
            {
                ActivityDTO = responseDTO
            };

            var runUrl = GetTerminalRunUrl();

            AddOperationalStateCrate(dataDTO, new OperationalStateCM());
            //nothing should change on followup
            var responsePayload = await HttpPostAsync <Fr8DataDTO, PayloadDTO>(runUrl, dataDTO);

            var crateStorage       = Crate.GetStorage(responsePayload);
            var operationalStateCM = crateStorage.CrateContentsOfType <OperationalStateCM>().Single();

            Assert.AreEqual(ActivityResponse.RequestTerminate.ToString(), operationalStateCM.CurrentActivityResponse.Type, "Activity response is not terminate");
        }
예제 #28
0
        public async Task Monitor_DocuSign_Run_TemplateValue()
        {
            var envelopeId = Guid.NewGuid().ToString();

            var configureUrl = GetTerminalConfigureUrl();
            var runUrl       = GetTerminalRunUrl();

            var activityDTO = await GetActivityDTO_WithTemplateValue();

            var authToken = await HealthMonitor_FixtureData.DocuSign_AuthToken(this);

            activityDTO.Item1.AuthToken = authToken;

            var dataDTO = new Fr8DataDTO {
                ActivityDTO = activityDTO.Item1
            };
            var preparedActionDTO = await HttpPostAsync <Fr8DataDTO, ActivityDTO>(configureUrl, dataDTO);

            dataDTO.ActivityDTO = preparedActionDTO;
            AddOperationalStateCrate(dataDTO, new OperationalStateCM());

            AddPayloadCrate(
                dataDTO,
                new EventReportCM
            {
                EventPayload = HealthMonitor_FixtureData.GetEnvelopePayload()
            }
                );

            preparedActionDTO.AuthToken = authToken;

            var responsePayloadDTO = await HttpPostAsync <Fr8DataDTO, PayloadDTO>(runUrl, dataDTO);

            var crateStorage    = Crate.GetStorage(responsePayloadDTO);
            var docuSignPayload = crateStorage.CrateContentsOfType <StandardPayloadDataCM>(x => x.Label == "DocuSign Envelope Fields").SingleOrDefault();

            Assert.IsNotNull(docuSignPayload, "Crate with DocuSign envelope fields was not found in payload");
            Assert.AreEqual(16, docuSignPayload.AllValues().Count(), "DocuSign envelope fields count doesn't match expected value");
        }
예제 #29
0
        public async Task Write_To_Log_Run_WithoutLogMessageInUpstreamActivity_ShouldThrowException()
        {
            //Arrange
            var runUrl = GetTerminalRunUrl();

            //prepare action DTO with valid target URL
            var activityDTO = await GetActivityDTO_LogToPapertrailIntegrationTest();

            var dataDTO = new Fr8DataDTO {
                ActivityDTO = activityDTO
            };

            AddOperationalStateCrate(dataDTO, new OperationalStateCM());
            //Act
            var responsePayloadDTO = await HttpPostAsync <Fr8DataDTO, PayloadDTO>(runUrl, dataDTO);

            var      storage = Crate.GetStorage(responsePayloadDTO.CrateStorage);
            var      opState = storage.CrateContentsOfType <OperationalStateCM>().FirstOrDefault();
            ErrorDTO error   = opState.CurrentActivityResponse.TryParseErrorDTO(out error) ? error : null;

            Assert.IsTrue(error.Message.Contains("Sequence contains no elements"), $"Invalid error message: {error.Message}");
        }
예제 #30
0
        public async Task Get_Google_Sheet_Data_v1_Run_OneRow_ResponseContainsExtractedFields()
        {
            //Arrange
            var runUrl = GetTerminalRunUrl();
            HealthMonitor_FixtureData fixture = new HealthMonitor_FixtureData();
            var requestActionDTO = fixture.Get_Google_Sheet_Data_v1_Followup_Configuration_Request_ActivityDTO_With_Crates();

            fixture.Get_Google_Sheet_Data_v1_AddPayload(requestActionDTO, "OneRow_WithHeader");
            var dataDTO = new Fr8DataDTO {
                ActivityDTO = requestActionDTO
            };

            AddOperationalStateCrate(dataDTO, new OperationalStateCM());
            ////Act
            var response = await HttpPostAsync <Fr8DataDTO, PayloadDTO>(runUrl, dataDTO);

            var storage        = Crate.GetStorage(response);
            var tableDataCrate = storage.CratesOfType <StandardTableDataCM>().Single();

            ////Assert
            Assert.AreEqual("Spreadsheet Data from \"OneRow_WithHeader\"", tableDataCrate.Label);
        }