本文整理汇总了C#中Orleans.Runtime.Configuration.ClusterConfiguration.TryGetNodeConfigurationForSilo方法的典型用法代码示例。如果您正苦于以下问题:C# ClusterConfiguration.TryGetNodeConfigurationForSilo方法的具体用法?C# ClusterConfiguration.TryGetNodeConfigurationForSilo怎么用?C# ClusterConfiguration.TryGetNodeConfigurationForSilo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Orleans.Runtime.Configuration.ClusterConfiguration
的用法示例。
在下文中一共展示了ClusterConfiguration.TryGetNodeConfigurationForSilo方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Config_NewConfigTest
public void Config_NewConfigTest()
{
TextReader input = File.OpenText("Config_TestSiloConfig.xml");
ClusterConfiguration config = new ClusterConfiguration();
config.Load(input);
input.Close();
Assert.AreEqual<int>(2, config.Globals.SeedNodes.Count, "Seed node count is incorrect");
Assert.AreEqual<IPEndPoint>(new IPEndPoint(IPAddress.Loopback, 11111), config.Globals.SeedNodes[0], "First seed node is set incorrectly");
Assert.AreEqual<IPEndPoint>(new IPEndPoint(IPAddress.IPv6Loopback, 22222), config.Globals.SeedNodes[1], "Second seed node is set incorrectly");
Assert.AreEqual<int>(12345, config.Defaults.Port, "Default port is set incorrectly");
Assert.AreEqual<string>("UnitTests.General.TestStartup,Tester", config.Defaults.StartupTypeName);
NodeConfiguration nc;
bool hasNodeConfig = config.TryGetNodeConfigurationForSilo("Node1", out nc);
Assert.IsTrue(hasNodeConfig, "Node Node1 has config");
Assert.AreEqual<int>(11111, nc.Port, "Port is set incorrectly for node Node1");
Assert.IsTrue(nc.IsPrimaryNode, "Node1 should be primary node");
Assert.IsTrue(nc.IsSeedNode, "Node1 should be seed node");
Assert.IsFalse(nc.IsGatewayNode, "Node1 should not be gateway node");
Assert.AreEqual<string>("UnitTests.General.TestStartup,Tester", nc.StartupTypeName, "Startup type should be copied automatically");
hasNodeConfig = config.TryGetNodeConfigurationForSilo("Node2", out nc);
Assert.IsTrue(hasNodeConfig, "Node Node2 has config");
Assert.AreEqual<int>(22222, nc.Port, "Port is set incorrectly for node Node2");
Assert.IsFalse(nc.IsPrimaryNode, "Node2 should not be primary node");
Assert.IsTrue(nc.IsSeedNode, "Node2 should be seed node");
Assert.IsTrue(nc.IsGatewayNode, "Node2 should be gateway node");
hasNodeConfig = config.TryGetNodeConfigurationForSilo("Store", out nc);
Assert.IsTrue(hasNodeConfig, "Node Store has config");
Assert.AreEqual<int>(12345, nc.Port, "IP port is set incorrectly for node Store");
Assert.IsFalse(nc.IsPrimaryNode, "Store should not be primary node");
Assert.IsFalse(nc.IsSeedNode, "Store should not be seed node");
Assert.IsFalse(nc.IsGatewayNode, "Store should not be gateway node");
//IPAddress[] ips = Dns.GetHostAddresses("");
//IPEndPoint ep = new IPEndPoint(IPAddress.Loopback, 12345);
//for (int i = 0; i < ips.Length; i++)
//{
// if ((ips[i].AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) && !IPAddress.Loopback.Equals(ips[i]))
// {
// ep = new IPEndPoint(ips[i], 12345);
// break;
// }
//}
//Assert.AreEqual<IPEndPoint>(ep, nc.Endpoint, "IP endpoint is set incorrectly for node Store");
}
示例2: Limits_ServerConfig_NotSpecified_WithDefault
public void Limits_ServerConfig_NotSpecified_WithDefault()
{
const string filename = "Config_LogConsumers-OrleansConfiguration.xml";
var orleansConfig = new ClusterConfiguration();
orleansConfig.LoadFromFile(filename);
NodeConfiguration config;
bool hasNodeConfig = orleansConfig.TryGetNodeConfigurationForSilo("Primary", out config);
Assert.IsTrue(hasNodeConfig, "Node Primary has config");
string limitName;
LimitValue limit;
for (int i = 1; i <= 3; i++)
{
limitName = "NotPresent" + i;
limit = config.LimitManager.GetLimit(limitName, i);
Assert.IsNotNull(limit);
Assert.AreEqual(limitName, limit.Name, "Limit name " + i);
Assert.AreEqual(i, limit.SoftLimitThreshold, "Soft limit " + i);
Assert.AreEqual(0, limit.HardLimitThreshold, "No Hard limit " + i);
}
for (int i = 1; i <= 3; i++)
{
limitName = "NotPresent" + i;
limit = config.LimitManager.GetLimit(limitName, i, 2 * i);
Assert.IsNotNull(limit);
Assert.AreEqual(limitName, limit.Name, "Limit name " + i);
Assert.AreEqual(i, limit.SoftLimitThreshold, "Soft limit " + i);
Assert.AreEqual(2 * i, limit.HardLimitThreshold, "Hard limit " + i);
}
}
示例3: Limits_ServerConfig
public void Limits_ServerConfig()
{
const string filename = "Config_LogConsumers-OrleansConfiguration.xml";
var orleansConfig = new ClusterConfiguration();
orleansConfig.LoadFromFile(filename);
NodeConfiguration config;
bool hasNodeConfig = orleansConfig.TryGetNodeConfigurationForSilo("Primary", out config);
Assert.IsTrue(hasNodeConfig, "Node Primary has config");
string limitName;
LimitValue limit;
//Assert.IsTrue(config.LimitManager.LimitValues.Count >= 3, "Number of LimitValues: " + string.Join(",", config.LimitValues));
for (int i = 1; i <= 3; i++)
{
limitName = "Limit" + i;
limit = config.LimitManager.GetLimit(limitName);
Assert.IsNotNull(limit);
Assert.AreEqual(limitName, limit.Name, "Limit name " + i);
Assert.AreEqual(i, limit.SoftLimitThreshold, "Soft limit " + i);
Assert.AreEqual(2 * i, limit.HardLimitThreshold, "Hard limit " + i);
}
limitName = "NoHardLimit";
limit = config.LimitManager.GetLimit(limitName);
Assert.IsNotNull(limit);
Assert.AreEqual(limitName, limit.Name, "Limit name " + limitName);
Assert.AreEqual(4, limit.SoftLimitThreshold, "Soft limit " + limitName);
Assert.AreEqual(0, limit.HardLimitThreshold, "Hard limit " + limitName);
}
示例4: Limits_ServerConfig_NotSpecified
public void Limits_ServerConfig_NotSpecified()
{
const string filename = "Config_LogConsumers-OrleansConfiguration.xml";
var orleansConfig = new ClusterConfiguration();
orleansConfig.LoadFromFile(filename);
NodeConfiguration config;
bool hasNodeConfig = orleansConfig.TryGetNodeConfigurationForSilo("Primary", out config);
Assert.IsTrue(hasNodeConfig, "Node Primary has config");
string limitName = "NotPresent";
LimitValue limit = config.LimitManager.GetLimit(limitName);
Assert.AreEqual(0, limit.SoftLimitThreshold);
Assert.AreEqual(0, limit.HardLimitThreshold);
Assert.AreEqual(limitName, limit.Name);
}
示例5: Limits_LimitsManager_ServerConfig
public void Limits_LimitsManager_ServerConfig()
{
const string filename = "Config_LogConsumers-OrleansConfiguration.xml";
var orleansConfig = new ClusterConfiguration();
orleansConfig.LoadFromFile(filename);
NodeConfiguration config;
bool hasNodeConfig = orleansConfig.TryGetNodeConfigurationForSilo("Primary", out config);
Assert.True(hasNodeConfig, "Node Primary has config");
string limitName;
LimitValue limit;
for (int i = 1; i <= 3; i++)
{
limitName = "Limit" + i;
limit = config.LimitManager.GetLimit(limitName);
Assert.NotNull(limit);
Assert.Equal(limitName, limit.Name); // Limit name " + i
Assert.Equal(i, limit.SoftLimitThreshold); // Soft limit " + i
Assert.Equal(2 * i, limit.HardLimitThreshold); // Hard limit " + i
}
limitName = "NoHardLimit";
limit = config.LimitManager.GetLimit(limitName);
Assert.NotNull(limit);
Assert.Equal(limitName, limit.Name); // Limit name " + limitName
Assert.Equal(4, limit.SoftLimitThreshold); // Soft limit " + limitName
Assert.Equal(0, limit.HardLimitThreshold); // No Hard limit " + limitName
limitName = "NotPresent";
limit = config.LimitManager.GetLimit(limitName);
Assert.NotNull(limit);
Assert.Equal(limitName, limit.Name); // Limit name " + limitName
Assert.Equal(0, limit.SoftLimitThreshold); // No Soft limit " + limitName
Assert.Equal(0, limit.HardLimitThreshold); // No Hard limit " + limitName
}