コード例 #1
0
 protected override void ConfigureTestCluster(TestClusterBuilder builder)
 {
     builder.ConfigureHostConfiguration(TestDefaultConfiguration.ConfigureHostConfiguration);
     builder.AddSiloBuilderConfigurator <SiloInvokerTestSiloBuilderConfigurator>();
     builder.AddClientBuilderConfigurator <ClientConfigurator>();
 }
コード例 #2
0
 internal override void AddSiloBuilderConfigurator(TestClusterBuilder builder)
 {
     builder.AddSiloBuilderConfigurator <GrainRecoverySiloBuilderConfigurator>();
     base.AddSiloBuilderConfigurator(builder);
 }
コード例 #3
0
 protected override void ConfigureTestCluster(TestClusterBuilder builder)
 {
     builder.ConfigureHostConfiguration(TestDefaultConfiguration.ConfigureHostConfiguration);
     builder.AddSiloBuilderConfigurator <StartupTaskSiloConfigurator>();
 }
コード例 #4
0
 protected override void ConfigureTestCluster(TestClusterBuilder builder)
 {
     this.ServiceId = builder.Options.ServiceId;
     builder.Options.InitialSilosCount = 4;
     builder.AddSiloBuilderConfigurator <SiloHostConfigurator>();
 }
コード例 #5
0
 protected override void ConfigureTestCluster(TestClusterBuilder builder)
 {
     builder.Options.InitialSilosCount = 4;
     builder.AddSiloBuilderConfigurator <SiloConfigurator>();
     builder.AddClientBuilderConfigurator <ClientConfiguretor>();
 }
コード例 #6
0
 internal override void AddSiloBuilderConfigurator(TestClusterBuilder builder) => builder.AddSiloBuilderConfigurator <SiloBuilderConfiguratorWfDSMILZ>();
コード例 #7
0
 protected override void ConfigureTestCluster(TestClusterBuilder builder)
 {
     builder.CreateSiloAsync = AppDomainSiloHandle.Create;
     builder.AddClientBuilderConfigurator <BuilderConfigurator>();
     builder.AddSiloBuilderConfigurator <BuilderConfigurator>();
 }
コード例 #8
0
 protected override void ConfigureTestCluster(TestClusterBuilder builder)
 {
     builder.Options.InitialSilosCount = 5;
     builder.AddSiloBuilderConfigurator <Tests.DistributedTM.MemoryTransactionsFixture.SiloBuilderConfigurator>();
 }
コード例 #9
0
 protected override void ConfigureTestCluster(TestClusterBuilder builder)
 {
     builder.Options.GatewayPerSilo    = false;
     builder.Options.InitialSilosCount = 2;
     builder.AddSiloBuilderConfigurator <HostBuilderConfigurator>();
 }
コード例 #10
0
ファイル: TestFixture.cs プロジェクト: Alex-Lin/orleans
 protected override void ConfigureTestCluster(TestClusterBuilder builder)
 {
     builder.AddSiloBuilderConfigurator <ErrorInjectorConfigurator>();
     base.ConfigureTestCluster(builder);
 }
 protected override void ConfigureTestCluster(TestClusterBuilder builder)
 {
     builder.Options.InitialSilosCount = 1;
     builder.AddSiloBuilderConfigurator <TestSiloBuilderConfigurator>();
     //Orleans would use ASP.NET DI container solution by default, so no need to configure ServiceProviderFactory here
 }
コード例 #12
0
 protected override void ConfigureTestCluster(TestClusterBuilder builder)
 {
     TestFixture.CheckForAzureStorage(TestDefaultConfiguration.DataConnectionString);
     builder.Options.InitialSilosCount = 5;
     builder.AddSiloBuilderConfigurator <TestFixture.SiloBuilderConfigurator>();
 }
コード例 #13
0
        protected override void ConfigureTestCluster(TestClusterBuilder builder)
        {
            ZookeeperTestUtils.EnsureZooKeeper();

            builder.AddSiloBuilderConfigurator <SiloBuilderConfigurator>();
        }
コード例 #14
0
        public async Task ShouldBeAbleToCheckStatus()
        {
            bool onOrleansTaskScheduler   = false,
                 onTheadPoolTaskScheduler = false;

            // setup mocks for DI
            ConfigureContainer = builder =>
            {
                var strategyMock = new Mock <ICrawlerStrategy>();
                strategyMock.Setup(strategy => strategy.ProcessRequestAsync(
                                       It.IsAny <CrawlRequestBase>(),
                                       It.IsAny <CancellationToken>()))
                .Returns(async(CrawlRequestBase req, Func <CrawlStateSnapshot, Task> saveProgress, CancellationToken token) =>
                {
                    // mock that we're now processing
                    await saveProgress(new HyperlinkCrawlStateSnapshot(CrawlJobStatus.Running));

                    // assert that we are in the Orleans TaskScheduler
                    onOrleansTaskScheduler = TaskScheduler.Default != TaskScheduler.Current;

                    // simulates Dataflow blocks by running on ThreadPool threads
                    // Task.Run automatically uses the ThreadPool TaskScheduler
                    await Task.Run(async() =>
                    {
                        onTheadPoolTaskScheduler = TaskScheduler.Default == TaskScheduler.Current;
                        await Task.Delay(TimeSpan.FromSeconds(5));
                    });
                });

                var strategyFactoryMock = new Mock <ICrawlerStrategyFactory>();
                strategyFactoryMock.Setup(factory => factory.Create(It.IsAny <CrawlRequestBase>()))
                .Returns(strategyMock.Object);

                builder.RegisterInstance(strategyMock.Object)
                .As <ICrawlerStrategy>();

                builder.RegisterInstance(strategyFactoryMock.Object)
                .As <ICrawlerStrategyFactory>();
            };

            var clusterBuilder = new TestClusterBuilder(1);

            clusterBuilder.AddClientBuilderConfigurator <TestSiloBuilder>();
            clusterBuilder.AddSiloBuilderConfigurator <TestSiloBuilder>();
            _cluster = clusterBuilder.Build();
            _cluster.Deploy();

            var request = new HyperlinkCrawlRequest("http://host.com/");

            // Enqueue request from client
            var manager = _cluster.Client.GetGrain <IManageCrawlRequests>(request.Id);
            var status  = await manager.Enqueue(request);

            Assert.Equal(CrawlJobStatus.Pending, status);

            // simulate Silo/Hangfire Worker thread (ie. non-threadpool thread)
            // don't await since we want to test that we can re-enter the Grain to check
            // the status of the job
            var processing = Task.Factory.StartNew(async() =>
            {
                var crawler = _cluster.GrainFactory.GetGrain <IProcessCrawlRequests>(request.Id);
                await crawler.Process(request);
            },
                                                   TaskCreationOptions.LongRunning).Unwrap();

            // allow the processing task to start working
            await Task.Delay(TimeSpan.FromSeconds(1));

            status = await manager.AsReference <IProcessCrawlRequests>().GetStatus();

            await processing; // ~4 seconds; see Task.Delay in mock strategy above - 1 second

            Assert.Equal(CrawlJobStatus.Running, status);

            // assert that ICrawlerStrategy.ProcessRequestAsync runs on Orleans TaskScheduler
            Assert.True(onOrleansTaskScheduler);

            // assert that Dataflow blocks use ThreadPool threads;
            // escaping single-threaded execution model
            Assert.True(onTheadPoolTaskScheduler);
        }
コード例 #15
0
 protected override void ConfigureTestCluster(TestClusterBuilder builder)
 {
     builder.AddSiloBuilderConfigurator <MySiloBuilderConfigurator>();
     builder.AddClientBuilderConfigurator <MyClientBuilderConfigurator>();
 }
コード例 #16
0
 protected override void ConfigureTestCluster(TestClusterBuilder builder)
 {
     builder.ConfigureLegacyConfiguration(legacy => AdjustClusterConfiguration(legacy.ClusterConfiguration));
     builder.AddSiloBuilderConfigurator <MySiloBuilderConfigurator>();
 }
コード例 #17
0
 protected override void ConfigureTestCluster(TestClusterBuilder builder)
 {
     builder.AddSiloBuilderConfigurator <SkewedClockConfigurator>();
     base.ConfigureTestCluster(builder);
 }
コード例 #18
0
 protected override void ConfigureTestCluster(TestClusterBuilder builder)
 {
     TestUtils.CheckForAzureStorage();
     builder.Options.InitialSilosCount = siloCount;
     builder.AddSiloBuilderConfigurator <SiloBuilderConfigurator>();
 }
コード例 #19
0
 internal virtual void AddSiloBuilderConfigurator(TestClusterBuilder builder) => builder.AddSiloBuilderConfigurator <SiloBuilderConfiguratorWf>();
コード例 #20
0
 protected override void ConfigureTestCluster(TestClusterBuilder builder)
 {
     builder.Options.ConnectionTransport = ConnectionTransportType.TcpSocket;
     builder.Options.InitialSilosCount   = 1;
     builder.AddSiloBuilderConfigurator <SiloBuilderConfigurator>();
 }
 protected override void ConfigureTestCluster(TestClusterBuilder builder)
 {
     builder.Options.InitialSilosCount = 1;
     builder.AddSiloBuilderConfigurator <TestSiloBuilderConfigurator>();
 }
コード例 #22
0
 protected override void ConfigureTestCluster(TestClusterBuilder builder)
 {
     builder.Options.GatewayPerSilo = false;
     builder.AddSiloBuilderConfigurator <MySiloBuilderConfigurator>();
     builder.AddClientBuilderConfigurator <MyClientBuilderConfigurator>();
 }
コード例 #23
0
 protected override void ConfigureTestCluster(TestClusterBuilder builder)
 {
     TestUtils.CheckForAzureStorage();
     builder.AddSiloBuilderConfigurator <MySiloBuilderConfigurator>();
     builder.AddClientBuilderConfigurator <MyClientBuilderConfigurator>();
 }
コード例 #24
0
 protected override void ConfigureTestCluster(TestClusterBuilder builder)
 {
     ConsulTestUtils.EnsureConsul();
     builder.AddSiloBuilderConfigurator <SiloBuilderConfigurator>();
     builder.AddClientBuilderConfigurator <ClientBuilderConfigurator>();
 }
コード例 #25
0
 protected override void ConfigureTestCluster(TestClusterBuilder builder)
 {
     builder.AddSiloBuilderConfigurator <SiloConfigurator>();
 }
コード例 #26
0
 protected override void ConfigureTestCluster(TestClusterBuilder builder)
 {
     builder.Options.UseInMemoryTransport = false;
     builder.Options.InitialSilosCount    = 1;
     builder.AddSiloBuilderConfigurator <SiloBuilderConfigurator>();
 }