public void RunMultiple( bool interceptors, int producerCount, ConnectionInfoTypes type) { var queueName = GenerateQueueName.Create(); var connectionString = new ConnectionInfo(type).ConnectionString; using (var queueContainer = new QueueContainer<RedisQueueInit>(x => { })) { try { var tests = new JobSchedulerTestsShared(); tests.RunTestMultipleProducers<RedisQueueInit, RedisJobQueueCreation>(queueName, connectionString, interceptors, producerCount, queueContainer.CreateTimeSync(connectionString)); } finally { using (var queueCreator = new QueueCreationContainer<RedisQueueInit>()) { using ( var oCreation = queueCreator.GetQueueCreation<RedisQueueCreation>(queueName, connectionString) ) { oCreation.RemoveQueue(); } } } } }
public void Run(int messageCount, int timeOut, int workerCount, ConnectionInfoTypes type, LinqMethodTypes linqMethodTypes) { var queueName = GenerateQueueName.Create(); var logProvider = LoggerShared.Create(queueName, GetType().Name); var connectionString = new ConnectionInfo(type).ConnectionString; using ( var queueCreator = new QueueCreationContainer<RedisQueueInit>( serviceRegister => serviceRegister.Register(() => logProvider, LifeStyles.Singleton))) { try { //create data var id = Guid.NewGuid(); var producer = new ProducerMethodShared(); if (linqMethodTypes == LinqMethodTypes.Compiled) { producer.RunTestCompiled<RedisQueueInit>(queueName, connectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, id, GenerateMethod.CreateNoOpCompiled, 0); } else { producer.RunTestDynamic<RedisQueueInit>(queueName, connectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, id, GenerateMethod.CreateNoOpDynamic, 0); } //process data var consumer = new ConsumerMethodPoisonMessageShared(); consumer.RunConsumer<RedisQueueInit>(queueName, connectionString, false, workerCount, logProvider, timeOut, messageCount, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(12)); ValidateErrorCounts(queueName, connectionString, messageCount); using ( var count = new VerifyQueueRecordCount(queueName, connectionString)) { count.Verify(messageCount, true, 2); } } finally { using ( var oCreation = queueCreator.GetQueueCreation<RedisQueueCreation>(queueName, connectionString) ) { oCreation.RemoveQueue(); } } } }
public void Run(int messageCount, int runtime, int timeOut, int workerCount, ConnectionInfoTypes type, LinqMethodTypes linqMethodTypes) { var queueName = GenerateQueueName.Create(); var logProvider = LoggerShared.Create(queueName, GetType().Name); var connectionString = new ConnectionInfo(type).ConnectionString; using ( var queueCreator = new QueueCreationContainer<RedisQueueInit>( serviceRegister => serviceRegister.Register(() => logProvider, LifeStyles.Singleton))) { try { var id = Guid.NewGuid(); var producer = new ProducerMethodShared(); if (linqMethodTypes == LinqMethodTypes.Compiled) { producer.RunTestCompiled<RedisQueueInit>(queueName, connectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, id, GenerateMethod.CreateCancelCompiled, runtime); } else { producer.RunTestDynamic<RedisQueueInit>(queueName, connectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, id, GenerateMethod.CreateCancelDynamic, runtime); } var consumer = new ConsumerMethodHeartBeatShared(); consumer.RunConsumer<RedisQueueInit>(queueName, connectionString, false, logProvider, runtime, messageCount, workerCount, timeOut, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(12), id); using (var count = new VerifyQueueRecordCount(queueName, connectionString)) { count.Verify(0, false, -1); } GenerateMethod.ClearCancel(id); } finally { using ( var oCreation = queueCreator.GetQueueCreation<RedisQueueCreation>(queueName, connectionString) ) { oCreation.RemoveQueue(); } } } }
public void Run( bool interceptors, bool dynamic, ConnectionInfoTypes type) { var queueName = GenerateQueueName.Create(); var connectionString = new ConnectionInfo(type).ConnectionString; using (var queueContainer = new QueueContainer<RedisQueueInit>(x => { })) { try { var tests = new JobSchedulerTestsShared(); if (!dynamic) { tests.RunEnqueueTestCompiled<RedisQueueInit, RedisJobQueueCreation>(queueName, connectionString, interceptors, Helpers.Verify, Helpers.SetError, queueContainer.CreateTimeSync(connectionString)); } else { tests.RunEnqueueTestDynamic<RedisQueueInit, RedisJobQueueCreation>(queueName, connectionString, interceptors, Helpers.Verify, Helpers.SetError, queueContainer.CreateTimeSync(connectionString)); } } finally { using (var queueCreator = new QueueCreationContainer<RedisQueueInit>()) { using ( var oCreation = queueCreator.GetQueueCreation<RedisQueueCreation>(queueName, connectionString) ) { oCreation.RemoveQueue(); } } } } }
public void Run(int messageCount, int runtime, int timeOut, int workerCount, bool async, ConnectionInfoTypes type, LinqMethodTypes linqMethodTypes) { var queueNameSend = GenerateQueueName.Create(); var logProviderSend = LoggerShared.Create(queueNameSend, GetType().Name); var connectionString = new ConnectionInfo(type).ConnectionString; using (var queueCreatorSend = new QueueCreationContainer<RedisQueueInit>( serviceRegister => serviceRegister.Register(() => logProviderSend, LifeStyles.Singleton))) { try { var id = Guid.NewGuid(); var rpc = new RpcMethodShared <RedisQueueInit, FakeResponse, RedisQueueRpcConnection>(); rpc.Run(queueNameSend, queueNameSend, connectionString, connectionString, logProviderSend, logProviderSend, runtime, messageCount, workerCount, timeOut, async, new RedisQueueRpcConnection(connectionString, queueNameSend), TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(12), id, linqMethodTypes); using (var count = new VerifyQueueRecordCount(queueNameSend, connectionString)) { count.Verify(0, false, -1); } } finally { using ( var oCreation = queueCreatorSend.GetQueueCreation<RedisQueueCreation>(queueNameSend, connectionString) ) { oCreation.RemoveQueue(); } } } }
public async void Run( int messageCount, bool interceptors, bool batchSending, ConnectionInfoTypes type, LinqMethodTypes linqMethodTypes) { var id = Guid.NewGuid(); var queueName = GenerateQueueName.Create(); var logProvider = LoggerShared.Create(queueName, GetType().Name); var producer = new ProducerMethodAsyncShared(); var connectionString = new ConnectionInfo(type).ConnectionString; using ( var queueCreator = new QueueCreationContainer<RedisQueueInit>( serviceRegister => serviceRegister.Register(() => logProvider, LifeStyles.Singleton))) { try { await producer.RunTest<RedisQueueInit>(queueName, connectionString, interceptors, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, batchSending, 0, id, linqMethodTypes); } finally { using ( var oCreation = queueCreator.GetQueueCreation<RedisQueueCreation>(queueName, connectionString) ) { oCreation.RemoveQueue(); } } } }
public void Run(int messageCount, int runtime, int timeOut, int workerCount, int readerCount, int queueSize, int messageType, ConnectionInfoTypes type, LinqMethodTypes linqMethodTypes) { if (Factory == null) { Factory = CreateFactory(workerCount, queueSize); } var queueName = GenerateQueueName.Create(); var logProvider = LoggerShared.Create(queueName, GetType().Name); var connectionString = new ConnectionInfo(type).ConnectionString; using (var queueCreator = new QueueCreationContainer<RedisQueueInit>( serviceRegister => serviceRegister.Register(() => logProvider, LifeStyles.Singleton))) { try { var id = Guid.NewGuid(); if (messageType == 1) { var producer = new ProducerMethodAsyncShared(); producer.RunTest<RedisQueueInit>(queueName, connectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, runtime, id, linqMethodTypes).Wait(timeOut); var consumer = new ConsumerMethodAsyncShared {Factory = Factory}; consumer.RunConsumer<RedisQueueInit>(queueName, connectionString, false, logProvider, runtime, messageCount, timeOut, readerCount, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(12), id); } else if (messageType == 2) { var producer = new ProducerMethodAsyncShared(); producer.RunTest<RedisQueueInit>(queueName, connectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, runtime, id, linqMethodTypes).Wait(timeOut); var consumer = new ConsumerMethodAsyncShared {Factory = Factory}; consumer.RunConsumer<RedisQueueInit>(queueName, connectionString, false, logProvider, runtime, messageCount, timeOut, readerCount, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(12), id); } else if (messageType == 3) { var producer = new ProducerMethodAsyncShared(); producer.RunTest<RedisQueueInit>(queueName, connectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, runtime, id, linqMethodTypes).Wait(timeOut); var consumer = new ConsumerMethodAsyncShared { Factory = Factory}; consumer.RunConsumer<RedisQueueInit>(queueName, connectionString, false, logProvider, runtime, messageCount, timeOut, readerCount, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(12), id); } using (var count = new VerifyQueueRecordCount(queueName, connectionString)) { count.Verify(0, false, -1); } } finally { using ( var oCreation = queueCreator.GetQueueCreation<RedisQueueCreation>(queueName, connectionString) ) { oCreation.RemoveQueue(); } } } }
public void Run( int messageCount, bool interceptors, bool batchSending, bool enableDelay, bool enableExpiration, ConnectionInfoTypes type, LinqMethodTypes linqMethodTypes) { var queueName = GenerateQueueName.Create(); var logProvider = LoggerShared.Create(queueName, GetType().Name); var producer = new ProducerMethodShared(); var connectionString = new ConnectionInfo(type).ConnectionString; using ( var queueCreator = new QueueCreationContainer<RedisQueueInit>( serviceRegister => serviceRegister.Register(() => logProvider, LifeStyles.Singleton))) { try { var id = Guid.NewGuid(); if (enableExpiration && enableDelay) { if (linqMethodTypes == LinqMethodTypes.Compiled) { producer.RunTestCompiled<RedisQueueInit>(queueName, connectionString, interceptors, messageCount, logProvider, Helpers.GenerateDelayExpiredData, Helpers.Verify, batchSending, id, GenerateMethod.CreateCompiled, 0); } else { producer.RunTestDynamic<RedisQueueInit>(queueName, connectionString, interceptors, messageCount, logProvider, Helpers.GenerateDelayExpiredData, Helpers.Verify, batchSending, id, GenerateMethod.CreateDynamic, 0); } } else if (enableDelay) { if (linqMethodTypes == LinqMethodTypes.Compiled) { producer.RunTestCompiled<RedisQueueInit>(queueName, connectionString, interceptors, messageCount, logProvider, Helpers.GenerateDelayData, Helpers.Verify, batchSending, id, GenerateMethod.CreateCompiled, 0); } else { producer.RunTestDynamic<RedisQueueInit>(queueName, connectionString, interceptors, messageCount, logProvider, Helpers.GenerateDelayData, Helpers.Verify, batchSending, id, GenerateMethod.CreateDynamic, 0); } } else if (enableExpiration) { if (linqMethodTypes == LinqMethodTypes.Compiled) { producer.RunTestCompiled<RedisQueueInit>(queueName, connectionString, interceptors, messageCount, logProvider, Helpers.GenerateExpiredData, Helpers.Verify, batchSending, id, GenerateMethod.CreateCompiled, 0); } else { producer.RunTestDynamic<RedisQueueInit>(queueName, connectionString, interceptors, messageCount, logProvider, Helpers.GenerateExpiredData, Helpers.Verify, batchSending, id, GenerateMethod.CreateDynamic, 0); } } else { if (linqMethodTypes == LinqMethodTypes.Compiled) { producer.RunTestCompiled<RedisQueueInit>(queueName, connectionString, interceptors, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, batchSending, id, GenerateMethod.CreateCompiled, 0); } else { producer.RunTestDynamic<RedisQueueInit>(queueName, connectionString, interceptors, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, batchSending, id, GenerateMethod.CreateDynamic, 0); } } } finally { using ( var oCreation = queueCreator.GetQueueCreation<RedisQueueCreation>(queueName, connectionString) ) { oCreation.RemoveQueue(); } } } }