Exemplo n.º 1
0
        public async Task WarehouseAdd()
        {
            var url       = GetHubApiBaseUrl() + "warehouses";
            var dataToAdd = new ManifestDescriptionCM()
            {
                Id   = Guid.NewGuid().ToString(),
                Name = "test envelope added by WarehouseAdd test",
            };

            var crateStorage = new CrateStorage(Fr8.Infrastructure.Data.Crates.Crate.FromContent(null, dataToAdd));

            await HttpPostAsync <CrateStorageDTO, object>(url, CrateStorageSerializer.Default.ConvertToDto(crateStorage));

            using (var uow = ObjectFactory.GetInstance <IUnitOfWork>())
            {
                var user = uow.UserRepository
                           .GetQuery()
                           .FirstOrDefault(x => x.UserName == TestUserEmail);

                Assert.NotNull(user, "Could not find test user in the database.");

                var addedEnvelope = uow.MultiTenantObjectRepository.Query <ManifestDescriptionCM>(user.Id, x => x.Id == dataToAdd.Id).FirstOrDefault();

                Assert.NotNull(addedEnvelope, "Failed to add new record to Warehouse using API");

                uow.MultiTenantObjectRepository.Delete <ManifestDescriptionCM>(user.Id, x => x.Id == dataToAdd.Id);

                Assert.AreEqual(dataToAdd.Name, addedEnvelope.Name, "Invalid value of Name property for stored data");
            }
        }
Exemplo n.º 2
0
        private ICrateStorage CreateConfiguredStorage()
        {
            var storage = new CrateStorage();

            storage.Add(Fr8.Infrastructure.Data.Crates.Crate.FromContent("Config", new Query_DocuSign_v1.ActivityUi()));

            return(storage);
        }
Exemplo n.º 3
0
        public async Task AddOrUpdateWarehouse(params Manifest[] manifests)
        {
            var url = $"{GetHubUrlWithApiVersion()}/warehouses";
            var uri = new Uri(url);

            var crateStorage = new CrateStorage(manifests.Select(x => Crate.FromContent(null, x)));
            var payload      = CrateStorageSerializer.Default.ConvertToDto(crateStorage);

            await _restfulServiceClient.PostAsync(uri, payload);
        }
Exemplo n.º 4
0
        public static ICrateStorage GetDirectMessageEventPayload()
        {
            var payload = new CrateStorage();

            payload.Add(Crate.FromContent(string.Empty, new OperationalStateCM()));
            var eventReport = new EventReportCM();

            eventReport.EventPayload.Add(Crate.FromContent(string.Empty, new StandardPayloadDataCM(new KeyValueDTO("channel_id", "D001"), new KeyValueDTO("user_name", "notuser"))));
            payload.Add(Crate.FromContent(string.Empty, eventReport));
            return(payload);
        }
Exemplo n.º 5
0
        public static ICrateStorage CrateStorageDTO()
        {
            var fieldDTO = new TextBox();

            fieldDTO.Name     = "connection_string";
            fieldDTO.Required = true;
            fieldDTO.Label    = "SQL Connection String";

            ICrateStorage curCrateStorage = new CrateStorage();

            curCrateStorage.Add("Configuration Data for WriteToAzureSqlServer", new StandardConfigurationControlsCM(fieldDTO));

            return(curCrateStorage);
        }
Exemplo n.º 6
0
        private ICrateStorage ExtractEventPayload(Envelope curEventEnvelope)
        {
            var stroage = new CrateStorage();

            var payloadDataCM = new StandardPayloadDataCM();

            foreach (var curNotification in curEventEnvelope.Body.Notifications.NotificationList)
            {
                payloadDataCM.PayloadObjects.Add(new PayloadObjectDTO(CreateKeyValuePairList(curNotification)));
            }

            var payloadCrate = Crate.FromContent("Salesforce Event Notification Payload", payloadDataCM);

            stroage.Add(payloadCrate);

            return(stroage);
        }
        private async Task ConfigureNestedActivities(ActivityUi actionUi)
        {
            var config = new Query_DocuSign_v1.ActivityUi
            {
                Folder     = { Value = actionUi.Folder.Value },
                Status     = { Value = actionUi.Status.Value },
                SearchText = { Value = actionUi.SearchText.Value }
            };

            var template = (await FindTemplates(x => x.Name == "Query_DocuSign"))
                           .FirstOrDefault();

            if (template == null)
            {
                throw new Exception("Can't find activity template: Query_DocuSign");
            }

            var storage = new CrateStorage(Crate.FromContent("Config", config))
            {
                Crate.FromContent(TerminalActivityBase.ConfigurationControlsLabel, new StandardConfigurationControlsCM(
                                      new TextArea
                {
                    IsReadOnly = true,
                    Label      = "",
                    Value      = "<p>This activity is managed by the parent activity</p>"
                }))
            };

            var activity = ActivityPayload.ChildrenActivities.OfType <ActivityPayload>().FirstOrDefault();

            if (activity == null)
            {
                activity = new ActivityPayload
                {
                    ActivityTemplate = Mapper.Map <ActivityTemplateSummaryDTO>(template),
                    Name             = template.Label,
                    Ordering         = 1,
                };

                ActivityPayload.ChildrenActivities.Add(activity);
            }
            activity.CrateStorage = storage;
        }
Exemplo n.º 8
0
        public override void SetUp()
        {
            base.SetUp();

            AutoMapperBootstrapper.ConfigureAutoMapper();
            ObjectFactory.Configure(x => x.AddRegistry <StructureMapBootStrapper.TestMode>());
            ObjectFactory.Configure(x => x.For <IActivityStore>().Use <ActivityStore>().Singleton());

            var crateStorage        = new CrateStorage(Crate.FromContent("", new OperationalStateCM()));
            var crateDTO            = CrateManager.ToDto(crateStorage);
            var hubCommunicatorMock = new Mock <IHubCommunicator>();

            hubCommunicatorMock.Setup(x => x.GetPayload(It.IsAny <Guid>()))
            .ReturnsAsync(new PayloadDTO(Guid.NewGuid())
            {
                CrateStorage = crateDTO
            });

            ObjectFactory.Configure(cfg => cfg.For <IHubCommunicator>().Use(hubCommunicatorMock.Object));

            CrateManagerHelper = new CrateManager();
            _activityExecutor  = ObjectFactory.GetInstance <ActivityExecutor>();
            _activityStore     = ObjectFactory.GetInstance <IActivityStore>();
            var activityTemplateSummary = new ActivityTemplateSummaryDTO
            {
                Name            = ExplicitTerminalActivityMock.ActivityTemplate.Name,
                Version         = ExplicitTerminalActivityMock.ActivityTemplate.Version,
                TerminalName    = ExplicitTerminalActivityMock.ActivityTemplate.Terminal.Name,
                TerminalVersion = ExplicitTerminalActivityMock.ActivityTemplate.Terminal.Version
            };

            if (_activityStore.GetFactory(activityTemplateSummary.Name, activityTemplateSummary.Version) == null)
            {
                _activityStore.RegisterActivity <ExplicitTerminalActivityMock>(ExplicitTerminalActivityMock.ActivityTemplate);
            }
        }
Exemplo n.º 9
0
 public EventReportCM()
     : base(MT.StandardEventReport)
 {
     EventPayload = new CrateStorage();
     //EventPayload = new List<CrateDTO>();
 }