public void Register(ProviderCategoryConfiguration category) { var config = new ProviderConfiguration(properties, type.FullName, "Boot" + type.FullName); var peskyField1 = GetPrivateField("childConfigurations"); var peskyField2 = GetPrivateField("childProviders"); peskyField1.SetValue(config, new List <ProviderConfiguration>()); peskyField2.SetValue(config, new List <IProvider>()); category.Providers.Add(config.Name, config); }
private bool ExtractFireAndForgetDeliveryProperty() { ClusterConfiguration orleansConfig = new ClusterConfiguration(); orleansConfig.LoadFromFile(Fixture.SiloConfig.FullName); ProviderCategoryConfiguration providerConfigs = orleansConfig.Globals.ProviderConfigurations["Stream"]; IProviderConfiguration provider = providerConfigs.Providers[SingleStreamTestRunner.SMS_STREAM_PROVIDER_NAME]; string fireAndForgetProperty = null; bool fireAndForget = false; if (provider.Properties.TryGetValue(SimpleMessageStreamProvider.FIRE_AND_FORGET_DELIVERY, out fireAndForgetProperty)) { fireAndForget = Boolean.Parse(fireAndForgetProperty); } return(fireAndForget); }
public void ClientConfig_SqlServer_StatsProvider() { const string filename = "DevTestClientConfiguration.xml"; ClientConfiguration config = ClientConfiguration.LoadFromFile(filename); output.WriteLine(config); Assert.Equal(1, config.ProviderConfigurations.Count); // Number of Providers Types Assert.Equal("Statistics", config.ProviderConfigurations.Keys.First()); // Client Stats Providers ProviderCategoryConfiguration statsProviders = config.ProviderConfigurations["Statistics"]; Assert.Equal(1, statsProviders.Providers.Count); // Number of Stats Providers Assert.Equal("SQL", statsProviders.Providers.Keys.First()); // Stats provider name ProviderConfiguration providerConfig = (ProviderConfiguration)statsProviders.Providers["SQL"]; // Note: Use string here instead of typeof(SqlStatisticsPublisher).FullName to prevent cascade load of this type Assert.Equal("Orleans.Providers.SqlServer.SqlStatisticsPublisher", providerConfig.Type); // Stats provider class name }
void RegisterBootstrappers() { var category = cluster.Globals.ProviderConfigurations.Find("Bootstrap"); if (category == null) { category = new ProviderCategoryConfiguration { Name = "Bootstrap", Providers = new Dictionary <string, IProviderConfiguration>() }; cluster.Globals.ProviderConfigurations.Add("Bootstrap", category); } foreach (var bootstrapper in bootstrappers) { bootstrapper.Register(category); } }
public void SiloConfig_AdoNet_StatsProvider() { const string filename = "DevTestServerConfiguration.xml"; var config = new ClusterConfiguration(); config.LoadFromFile(filename); output.WriteLine(config); Assert.Equal(2, config.Globals.ProviderConfigurations.Count); // Number of Providers Types Assert.True(config.Globals.ProviderConfigurations.Keys.Contains("Statistics")); // Stats Providers ProviderCategoryConfiguration statsProviders = config.Globals.ProviderConfigurations["Statistics"]; Assert.Equal(1, statsProviders.Providers.Count); // Number of Stats Providers Assert.Equal("SQL", statsProviders.Providers.Keys.First()); // Stats provider name ProviderConfiguration providerConfig = (ProviderConfiguration)statsProviders.Providers["SQL"]; // Note: Use string here instead of typeof(SqlStatisticsPublisher).FullName to prevent cascade load of this type Assert.Equal("Orleans.Providers.AdoNet.AdoNetStatisticsPublisher", providerConfig.Type); // Stats provider class name }
private static void ValidateProviderConfigs(ProviderCategoryConfiguration providerConfigs, int numProviders) { Assert.NotNull(providerConfigs); // Null provider configs Assert.NotNull(providerConfigs.Providers); // Null providers Assert.Equal(numProviders, providerConfigs.Providers.Count); // Num provider configs }
static void Main(string[] args) { // First, configure and start a local silo var siloConfig = ClusterConfiguration.LocalhostPrimarySilo(); var props = new Dictionary <string, string> { { "UseJsonFormat", "true" } }; IProviderConfiguration pConfig = new ProviderConfiguration(props, "Orleans.Storage.DynamoDBStorageProvider", "DynamoDBStorage"); var catConfig = new ProviderCategoryConfiguration("Storage") { Providers = new Dictionary <string, IProviderConfiguration> { { "DynamoDBStorage", pConfig } } }; siloConfig.Globals.ProviderConfigurations.Add("Storage", catConfig); //siloConfig.Add.AddMemoryStorageProvider(); //siloConfig.LoadFromFile("DevTestServerConfiguration.xml"); var silo = new SiloHost("TestSilo", siloConfig); //silo.ConfigFileName = "DevTestServerConfiguration.xml"; silo.InitializeOrleansSilo(); silo.StartOrleansSilo(); Console.WriteLine("Silo started."); // Then configure and connect a client. var clientConfig = ClientConfiguration.LocalhostSilo(); var client = new ClientBuilder().UseConfiguration(clientConfig).Build(); client.Connect().Wait(); Console.WriteLine("Client connected."); // // This is the place for your test code. // var usr1 = new User() { Id = Guid.Parse("8ac512e4-a618-4ba0-b69b-c3051d53888a"), Nickname = "eugene" }; var usr2 = new User() { Id = Guid.Parse("8ac512e4-a618-4ba0-b69b-c3051d53888b"), Nickname = "petro" }; var usr1Grain = client.GetGrain <IUserGrain>(usr1.Id); var usr2Grain = client.GetGrain <IUserGrain>(usr2.Id); usr1Grain.Create(usr1).Wait(); usr2Grain.Create(usr2).Wait(); var chatRoom = new ChatRoom() { Id = Guid.Parse("8ac512e4-a618-4ba0-b69b-c3051d53888c"), Name = "eugene&petro" }; var chatRoomGrain = client.GetGrain <IChatRoomGrain>(chatRoom.Id); chatRoomGrain.Create(chatRoom).Wait(); chatRoomGrain.Join(usr1Grain, usr2Grain).Wait(); SubscribeToMessageNotifications(client, chatRoom, chatRoomGrain); usr1Grain.SendMsg("Hi, group!", chatRoomGrain).Wait(); var msgs = chatRoomGrain.GetMessages().Result; Console.WriteLine("\nPress Enter to terminate..."); Console.ReadLine(); // Shut down client.Close(); silo.ShutdownOrleansSilo(); }