本文整理汇总了C#中Orleans.TestingHost.TestingSiloOptions类的典型用法代码示例。如果您正苦于以下问题:C# TestingSiloOptions类的具体用法?C# TestingSiloOptions怎么用?C# TestingSiloOptions使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TestingSiloOptions类属于Orleans.TestingHost命名空间,在下文中一共展示了TestingSiloOptions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Init
protected void Init(int mode = 1)
{
SiloHostConfig = new TestingSiloOptions
{
StartPrimary = true,
ParallelStart = false,
PickNewDeploymentId = true,
StartFreshOrleans = true,
StartSecondary = false,
SiloConfigFile = new FileInfo("OrleansConfigurationForTesting.xml"),
LivenessType = Orleans.Runtime.Configuration.GlobalConfiguration.LivenessProviderType.MembershipTableGrain,
StartClient = true
};
var clientOptions = new TestingClientOptions
{
ProxiedGateway = true,
Gateways = new List<IPEndPoint>(new[]
{
new IPEndPoint(IPAddress.Loopback, TestingSiloHost.ProxyBasePort),
}),
PreferedGatewayIndex = 0
};
ClusterConfig = new ClusterConfiguration();
ClusterConfig.LoadFromFile(new FileInfo("OrleansConfigurationForConsulTesting.xml").FullName);
ClusterConfig.Globals.DataConnectionString = $"host=localhost;datacenter=dc1;mode={mode}";
ClusterConfig.Globals.DataConnectionStringForReminders = $"host=localhost;datacenter=dc1;mode={mode}";
SiloHost = new MyTestingHost(SiloHostConfig, clientOptions);
ConsulMembershipTable = new ConsulSystemStoreProvider();
}
示例2: MyTestingHost
public MyTestingHost(TestingSiloOptions siloOptions, TestingClientOptions clientOptions) :
base(siloOptions, clientOptions)
{
this.siloOptions = siloOptions;
this.clientOptions = clientOptions;
}
示例3: CreateSiloHost
public override TestingSiloHost CreateSiloHost()
{
var siloOptions = new TestingSiloOptions
{
StartFreshOrleans = true,
StartSecondary = false,
SiloConfigFile = new FileInfo("OrleansConfigurationForStreamingDeactivationUnitTests.xml"),
};
var clientOptions = new TestingClientOptions
{
ClientConfigFile = new FileInfo("ClientConfigurationForStreamTesting.xml")
};
return new TestingSiloHost(siloOptions, clientOptions);
}
示例4: Init
private void Init()
{
SiloConfig = new TestingSiloOptions
{
StartPrimary = true,
ParallelStart = true,
PickNewDeploymentId = true,
StartFreshOrleans = true,
StartSecondary = true,
SiloConfigFile = new FileInfo("OrleansConfigurationForConsulTesting.xml"),
LivenessType = Orleans.Runtime.Configuration.GlobalConfiguration.LivenessProviderType.Custom
};
var clientOptions = new TestingClientOptions
{
ProxiedGateway = true,
Gateways = new List<IPEndPoint>(new[]
{
new IPEndPoint(IPAddress.Loopback, TestingSiloHost.ProxyBasePort),
}),
PreferedGatewayIndex = 0
};
SiloHost = new MyTestingHost(SiloConfig, clientOptions);
}
示例5: UnitTestSiloHost
public UnitTestSiloHost(TestingSiloOptions siloOptions)
: base(siloOptions)
{
}
示例6: CreateSiloHost
public override TestingSiloHost CreateSiloHost()
{
TestUtils.CheckForAzureStorage();
var siloOptions = new TestingSiloOptions
{
StartFreshOrleans = true,
StartPrimary = true,
StartSecondary = true,
DataConnectionString = StorageTestConstants.DataConnectionString,
LivenessType = GlobalConfiguration.LivenessProviderType.ZooKeeper,
ReminderServiceType = GlobalConfiguration.ReminderServiceProviderType.ReminderTableGrain
};
return new TestingSiloHost(siloOptions);
}
示例7: LivenessTestsBase
protected LivenessTestsBase(TestingSiloOptions siloOptions)
: base(siloOptions)
{ }
示例8: TestingSiloHost
/// <summary>
/// Start the default Primary and Secondary test silos, plus client in-process,
/// using the specified silo config options.
/// </summary>
protected TestingSiloHost(TestingSiloOptions siloOptions)
: this(siloOptions, new TestingClientOptions())
{
}
示例9: StartOrleansSilo
private SiloHandle StartOrleansSilo(Silo.SiloType type, TestingSiloOptions options, int instanceCount, AppDomain shared = null)
{
return StartOrleansSilo(this, type, options, instanceCount, shared);
}
示例10: AdjustForTest
public static void AdjustForTest(ClusterConfiguration config, TestingSiloOptions options)
{
if (options.AdjustConfig != null) {
options.AdjustConfig(config);
}
config.AdjustForTestEnvironment();
}
示例11: RedeployTestingSiloHost
public void RedeployTestingSiloHost(TestingSiloOptions siloOptions = null, TestingClientOptions clientOptions = null)
{
StopAllSilos();
DeployTestingSiloHost(siloOptions ?? new TestingSiloOptions(), clientOptions ?? new TestingClientOptions());
}
示例12: AdjustForTest
/// <summary> Modify the cluster configurations to the test environment </summary>
/// <param name="config">The cluster configuration to modify</param>
/// <param name="options">the TestingSiloOptions to modify</param>
public static void AdjustForTest(ClusterConfiguration config, TestingSiloOptions options)
{
if (options.AdjustConfig != null) {
options.AdjustConfig(config);
}
config.AdjustForTestEnvironment(TestClusterOptions.FallbackOptions.DefaultExtendedConfiguration["DataConnectionString"]);
}
示例13: BeforeEachTest
public void BeforeEachTest()
{
var siloOptions = new TestingSiloOptions
{
StartFreshOrleans = true,
StartPrimary = true,
StartSecondary = false,
SiloConfigFile = new FileInfo("OrleansConfigurationForConsulTesting.xml"),
LivenessType = GlobalConfiguration.LivenessProviderType.MembershipTableGrain,
ReminderServiceType = GlobalConfiguration.ReminderServiceProviderType.ReminderTableGrain,
DataConnectionString = $"index={remindersIndex};Host=localhost"
};
var clientOptions = new TestingClientOptions
{
ProxiedGateway = true,
Gateways = new List<IPEndPoint>(new[]
{
new IPEndPoint(IPAddress.Loopback, TestingSiloHost.ProxyBasePort),
}),
PreferedGatewayIndex = 0
};
deleteTestIndices();
ClusterConfig = new ClusterConfiguration();
ClusterConfig.LoadFromFile(siloOptions.SiloConfigFile.FullName);
TestReminderTable = new ElasticReminderTable();
ClusterConfig.Globals.DataConnectionStringForReminders = $"index={ remindersIndex};Host=localhost";
SiloHost = new MyTestingHost(siloOptions,clientOptions);
}
示例14: ReminderTests_Base
protected ReminderTests_Base(TestingSiloOptions siloOptions)
: base(siloOptions)
{
log = TraceLogger.GetLogger(this.GetType().Name, TraceLogger.LoggerType.Application);
}
示例15: DeployTestingSiloHost
private void DeployTestingSiloHost(TestingSiloOptions siloOptions, TestingClientOptions clientOptions)
{
siloInitOptions = siloOptions;
clientInitOptions = clientOptions;
AppDomain.CurrentDomain.UnhandledException += ReportUnobservedException;
try
{
InitializeAsync(siloOptions, clientOptions).Wait();
string startMsg = "----------------------------- STARTING NEW UNIT TEST SILO HOST: " + GetType().FullName + " -------------------------------------";
WriteLog(startMsg);
}
catch (TimeoutException te)
{
throw new TimeoutException("Timeout during test initialization", te);
}
catch (Exception ex)
{
Exception baseExc = ex.GetBaseException();
if (baseExc is TimeoutException)
{
throw new TimeoutException("Timeout during test initialization", ex);
}
// IMPORTANT:
// Do NOT re-throw the original exception here, also not as an internal exception inside AggregateException
// Due to the way MS tests works, if the original exception is an Orleans exception,
// it's assembly might not be loaded yet in this phase of the test.
// As a result, we will get "MSTest: Unit Test Adapter threw exception: Type is not resolved for member XXX"
// and will loose the oroginal exception. This makes debugging tests super hard!
// The root cause has to do with us initializing our tests from Test constructor and not from TestInitialize method.
// More details: http://dobrzanski.net/2010/09/20/mstest-unit-test-adapter-threw-exception-type-is-not-resolved-for-member/
throw new Exception(
string.Format("Exception during test initialization: {0}",
TraceLogger.PrintException(baseExc)));
}
}