本文整理匯總了C#中Orleans.Runtime.Configuration.ClusterConfiguration.CreateNodeConfigurationForSilo方法的典型用法代碼示例。如果您正苦於以下問題:C# ClusterConfiguration.CreateNodeConfigurationForSilo方法的具體用法?C# ClusterConfiguration.CreateNodeConfigurationForSilo怎麽用?C# ClusterConfiguration.CreateNodeConfigurationForSilo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Orleans.Runtime.Configuration.ClusterConfiguration
的用法示例。
在下文中一共展示了ClusterConfiguration.CreateNodeConfigurationForSilo方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: ClassInitialize
public static void ClassInitialize(TestContext testContext)
{
hostName = Dns.GetHostName();
logger = TraceLogger.GetLogger("MembershipTablePluginTests", TraceLogger.LoggerType.Application);
ClusterConfiguration cfg = new ClusterConfiguration();
cfg.LoadFromFile("OrleansConfigurationForTesting.xml");
TraceLogger.Initialize(cfg.CreateNodeConfigurationForSilo("Primary"));
TraceLogger.AddTraceLevelOverride("AzureTableDataManager", Severity.Verbose3);
TraceLogger.AddTraceLevelOverride("OrleansSiloInstanceManager", Severity.Verbose3);
TraceLogger.AddTraceLevelOverride("Storage", Severity.Verbose3);
}
示例2: ServerConfig_LogConsumers
public void ServerConfig_LogConsumers()
{
LogManager.UnInitialize();
string filename = "Config_LogConsumers-OrleansConfiguration.xml";
var cfg = new ClusterConfiguration();
cfg.LoadFromFile(filename);
Assert.AreEqual(filename, cfg.SourceFile);
LogManager.Initialize(cfg.CreateNodeConfigurationForSilo("Primary"));
var actualLogConsumers = LogManager.LogConsumers.Select(x => x.GetType()).ToList();
Xunit.Assert.Contains(typeof(DummyLogConsumer), actualLogConsumers);
Assert.AreEqual(1, actualLogConsumers.Count);
var actualTelemetryConsumers = LogManager.TelemetryConsumers.Select(x => x.GetType()).ToList();
Xunit.Assert.Contains(typeof(TraceTelemetryConsumer), actualTelemetryConsumers);
Xunit.Assert.Contains(typeof(ConsoleTelemetryConsumer), actualTelemetryConsumers);
Assert.AreEqual(2, actualTelemetryConsumers.Count);
}
示例3: LogFile_Write_NotExists
public void LogFile_Write_NotExists()
{
const string siloName = "MyNode4";
const string configFileName = "Config_NonTimestampedLogFileNames.xml";
string logFileName = siloName + ".log";
FileInfo fileInfo = new FileInfo(logFileName);
DeleteIfExists(fileInfo);
Assert.IsFalse(File.Exists(fileInfo.FullName), "Log file should not exist: " + fileInfo.FullName);
long initialSize = 0;
var config = new ClusterConfiguration();
config.LoadFromFile(configFileName);
NodeConfiguration n = config.CreateNodeConfigurationForSilo(siloName);
string fname = n.TraceFileName;
Assert.AreEqual(logFileName, fname);
LogManager.Initialize(n);
Assert.IsTrue(File.Exists(fileInfo.FullName), "Log file exists - before write: " + fileInfo.FullName);
Logger myLogger = LogManager.GetLogger("MyLogger", LoggerType.Application);
myLogger.Info("Write something");
LogManager.Flush();
fileInfo.Refresh(); // Need to refresh cached view of FileInfo
Assert.IsTrue(fileInfo.Exists, "Log file exists - after write: " + fileInfo.FullName);
long currentSize = fileInfo.Length;
Assert.IsTrue(currentSize > initialSize, "Log file {0} should have been written to: Initial size = {1} Current size = {2}", logFileName, initialSize, currentSize);
}
示例4: NodeLogFileNameAlreadyExists
public void NodeLogFileNameAlreadyExists()
{
string siloName = "MyNode2";
string baseLogFileName = siloName + ".log";
string baseLogFileNamePlusOne = siloName + "-1.log";
string expectedLogFileName = baseLogFileName;
string configFileName = "Config_NonTimestampedLogFileNames.xml";
if (File.Exists(baseLogFileName)) File.Delete(baseLogFileName);
if (File.Exists(expectedLogFileName)) File.Delete(expectedLogFileName);
if (!File.Exists(baseLogFileName)) File.Create(baseLogFileName).Close();
var config = new ClusterConfiguration();
config.LoadFromFile(configFileName);
NodeConfiguration n = config.CreateNodeConfigurationForSilo(siloName);
string fname = n.TraceFileName;
Assert.AreEqual(baseLogFileName, fname);
LogManager.Initialize(n);
Assert.IsTrue(File.Exists(baseLogFileName), "Base name log file exists: " + baseLogFileName);
Assert.IsTrue(File.Exists(expectedLogFileName), "Expected name log file exists: " + expectedLogFileName);
Assert.IsFalse(File.Exists(baseLogFileNamePlusOne), "Munged log file exists: " + baseLogFileNamePlusOne);
}
示例5: LogFileName
public void LogFileName()
{
var oc = new ClusterConfiguration();
oc.StandardLoad();
NodeConfiguration n = oc.CreateNodeConfigurationForSilo("Node1");
string fname = n.TraceFileName;
Assert.IsNotNull(fname);
Assert.IsFalse(fname.Contains(":"), "Log file name should not contain colons.");
// Check that .NET is happy with the file name
var f = new FileInfo(fname);
Assert.IsNotNull(f.Name);
Assert.AreEqual(fname, f.Name);
}
示例6: InitSchedulerLogging
internal static void InitSchedulerLogging()
{
LogManager.UnInitialize();
//LogManager.LogConsumers.Add(new LogWriterToConsole());
if (!LogManager.TelemetryConsumers.OfType<ConsoleTelemetryConsumer>().Any())
{
LogManager.TelemetryConsumers.Add(new ConsoleTelemetryConsumer());
}
var traceLevels = new[]
{
Tuple.Create("Scheduler", Severity.Verbose3),
Tuple.Create("Scheduler.WorkerPoolThread", Severity.Verbose2),
};
LogManager.SetTraceLevelOverrides(new List<Tuple<string, Severity>>(traceLevels));
var orleansConfig = new ClusterConfiguration();
orleansConfig.StandardLoad();
NodeConfiguration config = orleansConfig.CreateNodeConfigurationForSilo("Primary");
StatisticsCollector.Initialize(config);
SchedulerStatisticsGroup.Init();
}
示例7: ServerConfig_LogConsumers
public void ServerConfig_LogConsumers()
{
TraceLogger.UnInitialize();
string filename = "Config_LogConsumers-OrleansConfiguration.xml";
var cfg = new ClusterConfiguration();
cfg.LoadFromFile(filename);
Assert.AreEqual(filename, cfg.SourceFile);
TraceLogger.Initialize(cfg.CreateNodeConfigurationForSilo("Primary"));
Assert.AreEqual(1, TraceLogger.LogConsumers.Count, "Number of log consumers: " + string.Join(",", TraceLogger.LogConsumers));
Assert.AreEqual("UnitTests.DummyLogConsumer", TraceLogger.LogConsumers.Last().GetType().FullName, "Log consumer type");
Assert.AreEqual(2, TraceLogger.TelemetryConsumers.Count,
"Number of telemetry consumers: " + string.Join(",", TraceLogger.TelemetryConsumers));
Assert.AreEqual(typeof(TraceTelemetryConsumer).FullName, TraceLogger.TelemetryConsumers.First().GetType().FullName, "TelemetryConsumers consumer type #1");
Assert.AreEqual(typeof(ConsoleTelemetryConsumer).FullName, TraceLogger.TelemetryConsumers.Last().GetType().FullName, "TelemetryConsumers consumer type #1");
}