protected override void ConfigureTestCluster(TestClusterBuilder builder) { builder.ConfigureHostConfiguration(TestDefaultConfiguration.ConfigureHostConfiguration); builder.AddSiloBuilderConfigurator <SiloInvokerTestSiloBuilderConfigurator>(); builder.AddClientBuilderConfigurator <ClientConfigurator>(); }
internal override void AddSiloBuilderConfigurator(TestClusterBuilder builder) { builder.AddSiloBuilderConfigurator <GrainRecoverySiloBuilderConfigurator>(); base.AddSiloBuilderConfigurator(builder); }
protected override void ConfigureTestCluster(TestClusterBuilder builder) { builder.ConfigureHostConfiguration(TestDefaultConfiguration.ConfigureHostConfiguration); builder.AddSiloBuilderConfigurator <StartupTaskSiloConfigurator>(); }
protected override void ConfigureTestCluster(TestClusterBuilder builder) { this.ServiceId = builder.Options.ServiceId; builder.Options.InitialSilosCount = 4; builder.AddSiloBuilderConfigurator <SiloHostConfigurator>(); }
protected override void ConfigureTestCluster(TestClusterBuilder builder) { builder.Options.InitialSilosCount = 4; builder.AddSiloBuilderConfigurator <SiloConfigurator>(); builder.AddClientBuilderConfigurator <ClientConfiguretor>(); }
internal override void AddSiloBuilderConfigurator(TestClusterBuilder builder) => builder.AddSiloBuilderConfigurator <SiloBuilderConfiguratorWfDSMILZ>();
protected override void ConfigureTestCluster(TestClusterBuilder builder) { builder.CreateSiloAsync = AppDomainSiloHandle.Create; builder.AddClientBuilderConfigurator <BuilderConfigurator>(); builder.AddSiloBuilderConfigurator <BuilderConfigurator>(); }
protected override void ConfigureTestCluster(TestClusterBuilder builder) { builder.Options.InitialSilosCount = 5; builder.AddSiloBuilderConfigurator <Tests.DistributedTM.MemoryTransactionsFixture.SiloBuilderConfigurator>(); }
protected override void ConfigureTestCluster(TestClusterBuilder builder) { builder.Options.GatewayPerSilo = false; builder.Options.InitialSilosCount = 2; builder.AddSiloBuilderConfigurator <HostBuilderConfigurator>(); }
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 }
protected override void ConfigureTestCluster(TestClusterBuilder builder) { TestFixture.CheckForAzureStorage(TestDefaultConfiguration.DataConnectionString); builder.Options.InitialSilosCount = 5; builder.AddSiloBuilderConfigurator <TestFixture.SiloBuilderConfigurator>(); }
protected override void ConfigureTestCluster(TestClusterBuilder builder) { ZookeeperTestUtils.EnsureZooKeeper(); builder.AddSiloBuilderConfigurator <SiloBuilderConfigurator>(); }
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); }
protected override void ConfigureTestCluster(TestClusterBuilder builder) { builder.AddSiloBuilderConfigurator <MySiloBuilderConfigurator>(); builder.AddClientBuilderConfigurator <MyClientBuilderConfigurator>(); }
protected override void ConfigureTestCluster(TestClusterBuilder builder) { builder.ConfigureLegacyConfiguration(legacy => AdjustClusterConfiguration(legacy.ClusterConfiguration)); builder.AddSiloBuilderConfigurator <MySiloBuilderConfigurator>(); }
protected override void ConfigureTestCluster(TestClusterBuilder builder) { builder.AddSiloBuilderConfigurator <SkewedClockConfigurator>(); base.ConfigureTestCluster(builder); }
protected override void ConfigureTestCluster(TestClusterBuilder builder) { TestUtils.CheckForAzureStorage(); builder.Options.InitialSilosCount = siloCount; builder.AddSiloBuilderConfigurator <SiloBuilderConfigurator>(); }
internal virtual void AddSiloBuilderConfigurator(TestClusterBuilder builder) => builder.AddSiloBuilderConfigurator <SiloBuilderConfiguratorWf>();
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>(); }
protected override void ConfigureTestCluster(TestClusterBuilder builder) { builder.Options.GatewayPerSilo = false; builder.AddSiloBuilderConfigurator <MySiloBuilderConfigurator>(); builder.AddClientBuilderConfigurator <MyClientBuilderConfigurator>(); }
protected override void ConfigureTestCluster(TestClusterBuilder builder) { TestUtils.CheckForAzureStorage(); builder.AddSiloBuilderConfigurator <MySiloBuilderConfigurator>(); builder.AddClientBuilderConfigurator <MyClientBuilderConfigurator>(); }
protected override void ConfigureTestCluster(TestClusterBuilder builder) { ConsulTestUtils.EnsureConsul(); builder.AddSiloBuilderConfigurator <SiloBuilderConfigurator>(); builder.AddClientBuilderConfigurator <ClientBuilderConfigurator>(); }
protected override void ConfigureTestCluster(TestClusterBuilder builder) { builder.AddSiloBuilderConfigurator <SiloConfigurator>(); }
protected override void ConfigureTestCluster(TestClusterBuilder builder) { builder.Options.UseInMemoryTransport = false; builder.Options.InitialSilosCount = 1; builder.AddSiloBuilderConfigurator <SiloBuilderConfigurator>(); }