コード例 #1
0
        public void TestInitialize()
        {
            client = TestHelpers.CreateTaskHubClient();

            taskHub = TestHelpers.CreateTaskHub();
            taskHub.orchestrationService.CreateAsync(true).Wait();
        }
コード例 #2
0
        public void TestInitialize()
        {
            this.client = TestHelpers.CreateTaskHubClient();

            this.taskHub = TestHelpers.CreateTaskHub();

            this.taskHub.orchestrationService.CreateAsync(true).Wait();

            this.taskHubNoCompression = TestHelpers.CreateTaskHubNoCompression();
        }
コード例 #3
0
        public void TestInitialize()
        {
            if (!TestContext.TestName.Contains("TestHost"))
            {
                client = TestHelpers.CreateTaskHubClient();

                taskHub = TestHelpers.CreateTaskHub(TimeSpan.FromSeconds(30));
                taskHub.orchestrationService.CreateAsync(true).Wait();
            }
        }
コード例 #4
0
        public void TestInitialize()
        {
            this.client = TestHelpers.CreateTaskHubClient();
            this.orchestrationService = this.client.ServiceClient as ServiceBusOrchestrationService;
            this.queryClient          = this.orchestrationService?.InstanceStore as AzureTableInstanceStore;

            this.taskHub = TestHelpers.CreateTaskHub();

            this.taskHub.orchestrationService.CreateAsync(true).Wait();
        }
コード例 #5
0
 public void TestInitialize()
 {
     if (!TestContext.TestName.Contains("TestHost"))
     {
         client  = TestHelpers.CreateTaskHubClient();
         taskHub = TestHelpers.CreateTaskHub();
         taskHubNoCompression = TestHelpers.CreateTaskHubNoCompression();
         taskHub.orchestrationService.CreateAsync(true).Wait();
     }
 }
コード例 #6
0
        public async Task MultipleConcurrentRoleStartsTestNoInitialHub()
        {
            // Make sure we cleanup we start from scratch
            await this.taskHub.StopAsync(true);

            await this.taskHub.orchestrationService.DeleteAsync();

            const int ConcurrentClientsAndHubs = 4;
            var       rnd = new Random();

            var          clients = new List <TaskHubClient>(ConcurrentClientsAndHubs);
            var          workers = new List <TaskHubWorker>(ConcurrentClientsAndHubs);
            IList <Task> tasks   = new List <Task>();

            for (var i = 0; i < ConcurrentClientsAndHubs; i++)
            {
                clients.Add(TestHelpers.CreateTaskHubClient());
                workers.Add(TestHelpers.CreateTaskHub(new ServiceBusOrchestrationServiceSettings
                {
                    TaskOrchestrationDispatcherSettings = { DispatcherCount = 4 },
                    TrackingDispatcherSettings          = { DispatcherCount = 4 },
                    TaskActivityDispatcherSettings      = { DispatcherCount = 4 }
                }));
                tasks.Add(workers[i].orchestrationService.CreateIfNotExistsAsync());
            }

            await Task.WhenAll(tasks);

            GenerationBasicOrchestration.Result = 0;
            GenerationBasicTask.GenerationCount = 0;

            // ReSharper disable once UnusedVariable
            TaskHubWorker selectedHub    = workers[(rnd.Next(ConcurrentClientsAndHubs))];
            TaskHubClient selectedClient = clients[(rnd.Next(ConcurrentClientsAndHubs))];

            tasks.Clear();
            for (var i = 0; i < ConcurrentClientsAndHubs; i++)
            {
                tasks.Add(workers[i].AddTaskOrchestrations(typeof(GenerationBasicOrchestration))
                          .AddTaskActivities(new GenerationBasicTask())
                          .StartAsync());
            }

            await Task.WhenAll(tasks);

            OrchestrationInstance instance = await selectedClient.CreateOrchestrationInstanceAsync(typeof(GenerationBasicOrchestration), 4);

            OrchestrationState state = await selectedClient.WaitForOrchestrationAsync(instance, TimeSpan.FromSeconds(60), CancellationToken.None);

            Assert.IsNotNull(state);
            Assert.AreEqual(OrchestrationStatus.Completed, state.OrchestrationStatus, TestHelpers.GetInstanceNotCompletedMessage(this.client, instance, 60));
            Assert.AreEqual(4, GenerationBasicOrchestration.Result, "Orchestration Result is wrong!!!");
            await Task.WhenAll(workers.Select(worker => worker.StopAsync(true)));
        }
コード例 #7
0
        public void TestInitialize()
        {
            var r = new Random();

            tableClient = new AzureTableClient("test00" + r.Next(0, 10000),
                                               "UseDevelopmentStorage=true;DevelopmentStorageProxyUri=http://127.0.0.1:10002/");
            tableClient.CreateTableIfNotExistsAsync().Wait();

            client = TestHelpers.CreateTaskHubClient();

            taskHub = TestHelpers.CreateTaskHub();

            taskHub.orchestrationService.CreateAsync(true).Wait();
        }
コード例 #8
0
        public async Task TestCreateIfNew()
        {
            taskHub = TestHelpers.CreateTaskHub();
            var service = taskHub.orchestrationService as ServiceBusOrchestrationService;

            Assert.IsNotNull(service);

            await service.CreateAsync();

            await service.CreateIfNotExistsAsync();

            Assert.IsTrue(await service.HubExistsAsync());
            await service.DeleteAsync();

            Assert.IsFalse(await service.HubExistsAsync());
        }
コード例 #9
0
        public async Task TestOrchestrationCount()
        {
            taskHub = TestHelpers.CreateTaskHub();
            client  = TestHelpers.CreateTaskHubClient();
            var service = taskHub.orchestrationService as ServiceBusOrchestrationService;

            Assert.IsNotNull(service);
            await service.CreateAsync();

            await client.CreateOrchestrationInstanceAsync("foo", "1.0", null);

            await client.CreateOrchestrationInstanceAsync("foo1", "1.0", null);

            await client.CreateOrchestrationInstanceAsync("foo2", "1.0", null);

            Assert.IsTrue(service.GetPendingOrchestrationsCount() == 3);
            await service.DeleteAsync();
        }
コード例 #10
0
        public async Task TestMaxDeliveryCountIfNew()
        {
            var settings = new ServiceBusOrchestrationServiceSettings
            {
                MaxTaskActivityDeliveryCount      = 100,
                MaxTaskOrchestrationDeliveryCount = 100,
                MaxTrackingDeliveryCount          = 100
            };

            taskHub = TestHelpers.CreateTaskHub(settings);
            var service = taskHub.orchestrationService as ServiceBusOrchestrationService;

            Assert.IsNotNull(service);
            await service.CreateIfNotExistsAsync();

            Dictionary <string, int> retQueues = await service.GetHubQueueMaxDeliveryCountsAsync();

            Assert.AreEqual(settings.MaxTaskActivityDeliveryCount, retQueues["TaskOrchestration"]);
            Assert.AreEqual(settings.MaxTaskOrchestrationDeliveryCount, retQueues["TaskActivity"]);
            Assert.AreEqual(settings.MaxTrackingDeliveryCount, retQueues["Tracking"]);

            await service.DeleteAsync();
        }