public void Run( int messageCount, bool interceptors, bool enableDelayedProcessing, bool enableHeartBeat, bool enableMessageExpiration, bool enablePriority, bool enableStatus, bool enableStatusTable, bool additionalColumn, bool inMemoryDb, bool enableChaos) { using (var connectionInfo = new IntegrationConnectionInfo(inMemoryDb)) { var queueName = GenerateQueueName.Create(); var producer = new DotNetWorkQueue.IntegrationTests.Shared.Producer.Implementation.SimpleProducer(); producer.Run <SqLiteMessageQueueInit, FakeMessage, SqLiteMessageQueueCreation>(new QueueConnection(queueName, connectionInfo.ConnectionString), messageCount, interceptors, enableChaos, false, x => Helpers.SetOptions(x, enableDelayedProcessing, enableHeartBeat, enableMessageExpiration, enablePriority, enableStatus, enableStatusTable, additionalColumn), Helpers.GenerateData, Helpers.Verify); } }
public void Run(int messageCount, int timeOut, int workerCount, int readerCount, int queueSize, bool inMemoryDb, LinqMethodTypes linqMethodTypes) { using (var connectionInfo = new IntegrationConnectionInfo(inMemoryDb)) { var queueName = GenerateQueueName.Create(); var logProvider = LoggerShared.Create(queueName, GetType().Name); using (var queueCreator = new QueueCreationContainer <SqLiteMessageQueueInit>( serviceRegister => serviceRegister.Register(() => logProvider, LifeStyles.Singleton))) { try { using ( var oCreation = queueCreator.GetQueueCreation <SqLiteMessageQueueCreation>(queueName, connectionInfo.ConnectionString) ) { oCreation.Options.EnableDelayedProcessing = true; oCreation.Options.EnableHeartBeat = true; oCreation.Options.EnableStatus = true; oCreation.Options.EnableStatusTable = true; var result = oCreation.CreateQueue(); Assert.True(result.Success, result.ErrorMessage); //create data var producer = new ProducerMethodShared(); var id = Guid.NewGuid(); if (linqMethodTypes == LinqMethodTypes.Compiled) { producer.RunTestCompiled <SqLiteMessageQueueInit>(queueName, connectionInfo.ConnectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, id, GenerateMethod.CreateNoOpCompiled, 0, oCreation.Scope); } else { producer.RunTestDynamic <SqLiteMessageQueueInit>(queueName, connectionInfo.ConnectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, id, GenerateMethod.CreateNoOpDynamic, 0, oCreation.Scope); } //process data var consumer = new ConsumerMethodAsyncPoisonMessageShared(); consumer.RunConsumer <SqLiteMessageQueueInit>(queueName, connectionInfo.ConnectionString, false, workerCount, logProvider, timeOut, readerCount, queueSize, messageCount, TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(35), "second(*%10)"); ValidateErrorCounts(queueName, connectionInfo.ConnectionString, messageCount); new VerifyQueueRecordCount(queueName, connectionInfo.ConnectionString, oCreation.Options).Verify(messageCount, true, true); } } finally { using ( var oCreation = queueCreator.GetQueueCreation <SqLiteMessageQueueCreation>(queueName, connectionInfo.ConnectionString) ) { oCreation.RemoveQueue(); } } } } }
public void Run(int messageCount, int runtime, int timeOut, int workerCount, int readerCount, int queueSize, int messageType, ConnectionInfoTypes type) { SchedulerContainer schedulerContainer = null; if (Factory == null) { Factory = CreateFactory(workerCount, queueSize, out schedulerContainer); } 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 { if (messageType == 1) { var producer = new ProducerAsyncShared(); producer.RunTestAsync <RedisQueueInit, FakeMessage>(queueName, connectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, null).Wait(timeOut * 1000 / 2); var consumer = new ConsumerAsyncShared <FakeMessage> { Factory = Factory }; consumer.RunConsumer <RedisQueueInit>(queueName, connectionString, false, logProvider, runtime, messageCount, timeOut, readerCount, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(12), "second(*%3)"); } else if (messageType == 2) { var producer = new ProducerAsyncShared(); producer.RunTestAsync <RedisQueueInit, FakeMessageA>(queueName, connectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, null).Wait(timeOut * 1000 / 2); var consumer = new ConsumerAsyncShared <FakeMessageA> { Factory = Factory }; consumer.RunConsumer <RedisQueueInit>(queueName, connectionString, false, logProvider, runtime, messageCount, timeOut, readerCount, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(12), "second(*%3)"); } else if (messageType == 3) { var producer = new ProducerAsyncShared(); producer.RunTestAsync <RedisQueueInit, FakeMessageB>(queueName, connectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, null).Wait(timeOut * 1000 / 2); var consumer = new ConsumerAsyncShared <FakeMessageB> { Factory = Factory }; consumer.RunConsumer <RedisQueueInit>(queueName, connectionString, false, logProvider, runtime, messageCount, timeOut, readerCount, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(12), "second(*%3)"); } using (var count = new VerifyQueueRecordCount(queueName, connectionString)) { count.Verify(0, false, -1); } } finally { schedulerContainer?.Dispose(); using ( var oCreation = queueCreator.GetQueueCreation <RedisQueueCreation>(queueName, connectionString) ) { oCreation.RemoveQueue(); } } } }
public void Run(int messageCount, int runtime, int timeOut, int workerCount, bool inMemoryDb, bool enableChaos) { using (var connectionInfo = new IntegrationConnectionInfo(inMemoryDb)) { var queueName = GenerateQueueName.Create(); var logProvider = LoggerShared.Create(queueName, GetType().Name); using ( var queueCreator = new QueueCreationContainer <SqLiteMessageQueueInit>( serviceRegister => serviceRegister.Register(() => logProvider, LifeStyles.Singleton))) { try { using ( var oCreation = queueCreator.GetQueueCreation <SqLiteMessageQueueCreation>(queueName, connectionInfo.ConnectionString) ) { oCreation.Options.EnableDelayedProcessing = true; oCreation.Options.EnableHeartBeat = true; oCreation.Options.EnableStatus = true; oCreation.Options.EnableStatusTable = true; var result = oCreation.CreateQueue(); Assert.True(result.Success, result.ErrorMessage); var producer = new ProducerMethodMultipleDynamicShared(); var id = Guid.NewGuid(); producer.RunTestDynamic <SqLiteMessageQueueInit>(queueName, connectionInfo.ConnectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, id, GenerateMethod.CreateMultipleDynamic, runtime, oCreation.Scope, false); var consumer = new ConsumerMethodShared(); consumer.RunConsumer <SqLiteMessageQueueInit>(queueName, connectionInfo.ConnectionString, false, logProvider, runtime, messageCount, workerCount, timeOut, TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(35), id, "second(*%10)", enableChaos); new VerifyQueueRecordCount(queueName, connectionInfo.ConnectionString, oCreation.Options) .Verify(0, false, false); } } finally { using ( var oCreation = queueCreator.GetQueueCreation <SqLiteMessageQueueCreation>(queueName, connectionInfo.ConnectionString) ) { oCreation.RemoveQueue(); } } } } }
public void Run(int messageCount, int runtime, int timeOut, int workerCount, bool useTransactions, bool async) { var queueNameSend = GenerateQueueName.Create(); var queueNameReceive = GenerateQueueName.Create(); var logProviderSend = LoggerShared.Create(queueNameSend, GetType().Name); var logProviderReceive = LoggerShared.Create(queueNameReceive, GetType().Name); using (var queueCreatorReceive = new QueueCreationContainer <PostgreSqlMessageQueueInit>( serviceRegister => serviceRegister.Register(() => logProviderReceive, LifeStyles.Singleton))) { using (var queueCreatorSend = new QueueCreationContainer <PostgreSqlMessageQueueInit>( serviceRegister => serviceRegister.Register(() => logProviderSend, LifeStyles.Singleton))) { try { using ( var oCreationReceive = queueCreatorReceive.GetQueueCreation <PostgreSqlMessageQueueCreation>(queueNameReceive, ConnectionInfo.ConnectionString) ) { oCreationReceive.Options.EnableDelayedProcessing = true; oCreationReceive.Options.EnableHeartBeat = !useTransactions; oCreationReceive.Options.EnableHoldTransactionUntilMessageCommitted = useTransactions; oCreationReceive.Options.EnableStatus = !useTransactions; oCreationReceive.Options.EnableStatusTable = true; oCreationReceive.Options.QueueType = QueueTypes.RpcReceive; var resultReceive = oCreationReceive.CreateQueue(); Assert.True(resultReceive.Success, resultReceive.ErrorMessage); using ( var oCreation = queueCreatorSend.GetQueueCreation <PostgreSqlMessageQueueCreation>(queueNameSend, ConnectionInfo.ConnectionString) ) { oCreation.Options.EnableDelayedProcessing = true; oCreation.Options.EnableHeartBeat = !useTransactions; oCreation.Options.EnableHoldTransactionUntilMessageCommitted = useTransactions; oCreation.Options.EnableStatus = !useTransactions; oCreation.Options.EnableStatusTable = true; oCreation.Options.QueueType = QueueTypes.RpcSend; var result = oCreation.CreateQueue(); Assert.True(result.Success, result.ErrorMessage); var rpc = new RpcShared <PostgreSqlMessageQueueInit, FakeResponse, FakeMessage, PostgreSqlRpcConnection>(); rpc.Run(queueNameReceive, queueNameSend, ConnectionInfo.ConnectionString, ConnectionInfo.ConnectionString, logProviderReceive, logProviderSend, runtime, messageCount, workerCount, timeOut, async, new PostgreSqlRpcConnection(ConnectionInfo.ConnectionString, queueNameSend, ConnectionInfo.ConnectionString, queueNameReceive), TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(12), "second(*%3)"); new VerifyQueueRecordCount(queueNameSend, oCreation.Options).Verify(0, false, false); new VerifyQueueRecordCount(queueNameReceive, oCreationReceive.Options).Verify(0, false, false); } } } finally { using ( var oCreation = queueCreatorSend.GetQueueCreation <PostgreSqlMessageQueueCreation>(queueNameSend, ConnectionInfo.ConnectionString) ) { oCreation.RemoveQueue(); } using ( var oCreation = queueCreatorReceive.GetQueueCreation <PostgreSqlMessageQueueCreation>(queueNameReceive, ConnectionInfo.ConnectionString) ) { oCreation.RemoveQueue(); } } } } }
public void Run(int messageCount, int timeOut, int workerCount, int readerCount, int queueSize, bool inMemoryDb, bool enableChaos) { using (var connectionInfo = new IntegrationConnectionInfo(inMemoryDb)) { var queueName = GenerateQueueName.Create(); var logProvider = LoggerShared.Create(queueName, GetType().Name); using ( var queueCreator = new QueueCreationContainer <SqLiteMessageQueueInit>( serviceRegister => serviceRegister.Register(() => logProvider, LifeStyles.Singleton))) { try { using ( var oCreation = queueCreator.GetQueueCreation <SqLiteMessageQueueCreation>(queueName, connectionInfo.ConnectionString) ) { oCreation.Options.EnableDelayedProcessing = true; oCreation.Options.EnableHeartBeat = true; oCreation.Options.EnableStatus = true; oCreation.Options.EnableStatusTable = true; var result = oCreation.CreateQueue(); Assert.True(result.Success, result.ErrorMessage); //create data var producer = new ProducerShared(); producer.RunTest <SqLiteMessageQueueInit, FakeMessage>(queueName, connectionInfo.ConnectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, oCreation.Scope, false); //process data var consumer = new ConsumerAsyncErrorShared <FakeMessage>(); consumer.RunConsumer <SqLiteMessageQueueInit>(queueName, connectionInfo.ConnectionString, false, logProvider, messageCount, workerCount, timeOut, queueSize, readerCount, TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(35), "second(*%10)", null, enableChaos); ValidateErrorCounts(queueName, connectionInfo.ConnectionString, messageCount); new VerifyQueueRecordCount(queueName, connectionInfo.ConnectionString, oCreation.Options).Verify(messageCount, true, false); //don't purge consumer.PurgeErrorMessages <SqLiteMessageQueueInit>(queueName, connectionInfo.ConnectionString, false, logProvider, false); ValidateErrorCounts(queueName, connectionInfo.ConnectionString, messageCount); //purge error messages and verify that count is 0 consumer.PurgeErrorMessages <SqLiteMessageQueueInit>(queueName, connectionInfo.ConnectionString, false, logProvider, true); ValidateErrorCounts(queueName, connectionInfo.ConnectionString, 0); } } finally { using ( var oCreation = queueCreator.GetQueueCreation <SqLiteMessageQueueCreation>(queueName, connectionInfo.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.RunTestAsync <RedisQueueInit>(queueName, connectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, runtime, id, linqMethodTypes, null, false).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, "second(*%3)", false); } else if (messageType == 2) { var producer = new ProducerMethodAsyncShared(); producer.RunTestAsync <RedisQueueInit>(queueName, connectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, runtime, id, linqMethodTypes, null, false).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, "second(*%3)", false); } else if (messageType == 3) { var producer = new ProducerMethodAsyncShared(); producer.RunTestAsync <RedisQueueInit>(queueName, connectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, runtime, id, linqMethodTypes, null, false).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, "second(*%3)", false); } 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 enableDelayedProcessing, bool enableHeartBeat, bool enableMessageExpiration, bool enablePriority, bool enableStatus, bool enableStatusTable, bool additionalColumn, bool inMemoryDb, LinqMethodTypes linqMethodTypes, bool enableChaos) { using (var connectionInfo = new IntegrationConnectionInfo(inMemoryDb)) { var queueName = GenerateQueueName.Create(); var logProvider = LoggerShared.Create(queueName, GetType().Name); using (var queueCreator = new QueueCreationContainer <SqLiteMessageQueueInit>( serviceRegister => serviceRegister.Register(() => logProvider, LifeStyles.Singleton))) { try { using ( var oCreation = queueCreator.GetQueueCreation <SqLiteMessageQueueCreation>(queueName, connectionInfo.ConnectionString) ) { oCreation.Options.EnableDelayedProcessing = enableDelayedProcessing; oCreation.Options.EnableHeartBeat = enableHeartBeat; oCreation.Options.EnableMessageExpiration = enableMessageExpiration; oCreation.Options.EnablePriority = enablePriority; oCreation.Options.EnableStatus = enableStatus; oCreation.Options.EnableStatusTable = enableStatusTable; if (additionalColumn) { oCreation.Options.AdditionalColumns.Add(new Column("OrderID", ColumnTypes.Integer, true, null)); } var result = oCreation.CreateQueue(); Assert.True(result.Success, result.ErrorMessage); var id = Guid.NewGuid(); var producer = new ProducerMethodShared(); if (linqMethodTypes == LinqMethodTypes.Compiled) { producer.RunTestCompiled <SqLiteMessageQueueInit>(queueName, connectionInfo.ConnectionString, interceptors, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, id, GenerateMethod.CreateCompiled, 0, oCreation.Scope, enableChaos); } else { producer.RunTestDynamic <SqLiteMessageQueueInit>(queueName, connectionInfo.ConnectionString, interceptors, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, id, GenerateMethod.CreateDynamic, 0, oCreation.Scope, enableChaos); } } } finally { using ( var oCreation = queueCreator.GetQueueCreation <SqLiteMessageQueueCreation>(queueName, connectionInfo.ConnectionString) ) { oCreation.RemoveQueue(); } } } } }
public void Run(int messageCount, int runtime, int timeOut, int workerCount, int readerCount, int queueSize, int messageType, LinqMethodTypes linqMethodTypes) { if (Factory == null) { Factory = CreateFactory(workerCount, queueSize); } using (var connectionInfo = new IntegrationConnectionInfo()) { var queueName = GenerateQueueName.Create(); var logProvider = LoggerShared.Create(queueName, GetType().Name); using (var queueCreator = new QueueCreationContainer <MemoryMessageQueueInit>( serviceRegister => serviceRegister.Register(() => logProvider, LifeStyles.Singleton))) { try { using ( var oCreation = queueCreator.GetQueueCreation <MessageQueueCreation>(queueName, connectionInfo.ConnectionString) ) { var result = oCreation.CreateQueue(); Assert.True(result.Success, result.ErrorMessage); if (messageType == 1) { var id = Guid.NewGuid(); var producer = new ProducerMethodAsyncShared(); producer.RunTestAsync <MemoryMessageQueueInit>(queueName, connectionInfo.ConnectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, runtime, id, linqMethodTypes, oCreation.Scope).Wait(timeOut); var consumer = new ConsumerMethodAsyncShared { Factory = Factory }; consumer.RunConsumer <MemoryMessageQueueInit>(queueName, connectionInfo.ConnectionString, false, logProvider, runtime, messageCount, timeOut, readerCount, TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(35), id, "second(*%10)"); } else if (messageType == 2) { var id = Guid.NewGuid(); var producer = new ProducerMethodAsyncShared(); producer.RunTestAsync <MemoryMessageQueueInit>(queueName, connectionInfo.ConnectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, runtime, id, linqMethodTypes, oCreation.Scope).Wait(timeOut); var consumer = new ConsumerMethodAsyncShared { Factory = Factory }; consumer.RunConsumer <MemoryMessageQueueInit>(queueName, connectionInfo.ConnectionString, false, logProvider, runtime, messageCount, timeOut, readerCount, TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(35), id, "second(*%10)"); } else if (messageType == 3) { var id = Guid.NewGuid(); var producer = new ProducerMethodAsyncShared(); producer.RunTestAsync <MemoryMessageQueueInit>(queueName, connectionInfo.ConnectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, runtime, id, linqMethodTypes, oCreation.Scope).Wait(timeOut); var consumer = new ConsumerMethodAsyncShared { Factory = Factory }; consumer.RunConsumer <MemoryMessageQueueInit>(queueName, connectionInfo.ConnectionString, false, logProvider, runtime, messageCount, timeOut, readerCount, TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(35), id, "second(*%10)"); } new VerifyQueueRecordCount().Verify(oCreation.Scope, 0, true); } } finally { using ( var oCreation = queueCreator.GetQueueCreation <MessageQueueCreation>(queueName, connectionInfo.ConnectionString) ) { oCreation.RemoveQueue(); } } } } }
public void Run(int messageCount, int runtime, int timeOut, int workerCount, bool async, bool inMemoryDb) { var queueNameSend = GenerateQueueName.Create(); var queueNameReceive = GenerateQueueName.Create(); var logProviderSend = LoggerShared.Create(queueNameSend, GetType().Name); var logProviderReceive = LoggerShared.Create(queueNameReceive, GetType().Name); using (var connectionInfo = new IntegrationConnectionInfo(inMemoryDb)) { using (var queueCreatorReceive = new QueueCreationContainer <SqLiteMessageQueueInit>( serviceRegister => serviceRegister.Register(() => logProviderReceive, LifeStyles.Singleton))) { using (var queueCreatorSend = new QueueCreationContainer <SqLiteMessageQueueInit>( serviceRegister => serviceRegister.Register(() => logProviderSend, LifeStyles.Singleton))) { try { using ( var oCreationReceive = queueCreatorReceive.GetQueueCreation <SqLiteMessageQueueCreation>(queueNameReceive, connectionInfo.ConnectionString) ) { oCreationReceive.Options.EnableDelayedProcessing = true; oCreationReceive.Options.EnableHeartBeat = true; oCreationReceive.Options.EnableStatus = true; oCreationReceive.Options.EnableStatusTable = true; oCreationReceive.Options.QueueType = QueueTypes.RpcReceive; var resultReceive = oCreationReceive.CreateQueue(); Assert.True(resultReceive.Success, resultReceive.ErrorMessage); using ( var oCreation = queueCreatorSend.GetQueueCreation <SqLiteMessageQueueCreation>(queueNameSend, connectionInfo.ConnectionString) ) { oCreation.Options.EnableDelayedProcessing = true; oCreation.Options.EnableHeartBeat = true; oCreation.Options.EnableStatus = true; oCreation.Options.EnableStatusTable = true; oCreation.Options.QueueType = QueueTypes.RpcSend; var result = oCreation.CreateQueue(); Assert.True(result.Success, result.ErrorMessage); var rpc = new RpcShared <SqLiteMessageQueueInit, FakeResponse, FakeMessage, SqLiteRpcConnection>(); rpc.Run(queueNameReceive, queueNameSend, connectionInfo.ConnectionString, connectionInfo.ConnectionString, logProviderReceive, logProviderSend, runtime, messageCount, workerCount, timeOut, async, new SqLiteRpcConnection(connectionInfo.ConnectionString, queueNameSend, connectionInfo.ConnectionString, queueNameReceive, new DbDataSource()), TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(35), "second(*%10)"); new VerifyQueueRecordCount(queueNameSend, connectionInfo.ConnectionString, oCreation.Options).Verify(0, false, false); new VerifyQueueRecordCount(queueNameReceive, connectionInfo.ConnectionString, oCreationReceive.Options).Verify(0, false, false); } } } finally { using ( var oCreation = queueCreatorSend.GetQueueCreation <SqLiteMessageQueueCreation>(queueNameSend, connectionInfo.ConnectionString) ) { oCreation.RemoveQueue(); } using ( var oCreation = queueCreatorReceive.GetQueueCreation <SqLiteMessageQueueCreation>(queueNameReceive, connectionInfo.ConnectionString) ) { oCreation.RemoveQueue(); } } } } } }
public void Run(int messageCount, int timeOut, int workerCount, int readerCount, int queueSize, 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.CreateErrorCompiled, 0, null, false); } #if NETFULL else { producer.RunTestDynamic <RedisQueueInit>(queueName, connectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, id, GenerateMethod.CreateErrorDynamic, 0, null, false); } #endif //process data var consumer = new ConsumerMethodAsyncErrorShared(); consumer.RunConsumer <RedisQueueInit>(queueName, connectionString, false, logProvider, messageCount, workerCount, timeOut, queueSize, readerCount, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(12), id, "second(*%3)", false); ValidateErrorCounts(queueName, messageCount, connectionString); using ( var count = new VerifyQueueRecordCount(queueName, connectionString)) { count.Verify(messageCount, false, 2); } consumer.PurgeErrorMessages <RedisQueueInit>(queueName, connectionString, false, logProvider, false); ValidateErrorCounts(queueName, messageCount, connectionString); //purge error messages and verify that count is 0 consumer.PurgeErrorMessages <RedisQueueInit>(queueName, connectionString, false, logProvider, true); ValidateErrorCounts(queueName, 0, connectionString); } 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, null); } #if NETFULL else { producer.RunTestDynamic <RedisQueueInit>(queueName, connectionString, interceptors, messageCount, logProvider, Helpers.GenerateDelayExpiredData, Helpers.Verify, batchSending, id, GenerateMethod.CreateDynamic, 0, null); } #endif } else if (enableDelay) { if (linqMethodTypes == LinqMethodTypes.Compiled) { producer.RunTestCompiled <RedisQueueInit>(queueName, connectionString, interceptors, messageCount, logProvider, Helpers.GenerateDelayData, Helpers.Verify, batchSending, id, GenerateMethod.CreateCompiled, 0, null); } #if NETFULL else { producer.RunTestDynamic <RedisQueueInit>(queueName, connectionString, interceptors, messageCount, logProvider, Helpers.GenerateDelayData, Helpers.Verify, batchSending, id, GenerateMethod.CreateDynamic, 0, null); } #endif } else if (enableExpiration) { if (linqMethodTypes == LinqMethodTypes.Compiled) { producer.RunTestCompiled <RedisQueueInit>(queueName, connectionString, interceptors, messageCount, logProvider, Helpers.GenerateExpiredData, Helpers.Verify, batchSending, id, GenerateMethod.CreateCompiled, 0, null); } #if NETFULL else { producer.RunTestDynamic <RedisQueueInit>(queueName, connectionString, interceptors, messageCount, logProvider, Helpers.GenerateExpiredData, Helpers.Verify, batchSending, id, GenerateMethod.CreateDynamic, 0, null); } #endif } else { if (linqMethodTypes == LinqMethodTypes.Compiled) { producer.RunTestCompiled <RedisQueueInit>(queueName, connectionString, interceptors, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, batchSending, id, GenerateMethod.CreateCompiled, 0, null); } #if NETFULL else { producer.RunTestDynamic <RedisQueueInit>(queueName, connectionString, interceptors, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, batchSending, id, GenerateMethod.CreateDynamic, 0, null); } #endif } } finally { using ( var oCreation = queueCreator.GetQueueCreation <RedisQueueCreation>(queueName, connectionString) ) { oCreation.RemoveQueue(); } } } }
public void Run(int messageCount, int timeOut, int workerCount, int readerCount, int queueSize, bool useTransactions, LinqMethodTypes linqMethodTypes, bool enableChaos) { var queueName = GenerateQueueName.Create(); var logProvider = LoggerShared.Create(queueName, GetType().Name); using ( var queueCreator = new QueueCreationContainer <SqlServerMessageQueueInit>( serviceRegister => serviceRegister.Register(() => logProvider, LifeStyles.Singleton))) { try { using ( var oCreation = queueCreator.GetQueueCreation <SqlServerMessageQueueCreation>(queueName, ConnectionInfo.ConnectionString) ) { oCreation.Options.EnableDelayedProcessing = true; oCreation.Options.EnableHeartBeat = !useTransactions; oCreation.Options.EnableHoldTransactionUntilMessageCommitted = useTransactions; oCreation.Options.EnableStatus = !useTransactions; oCreation.Options.EnableStatusTable = true; var result = oCreation.CreateQueue(); Assert.True(result.Success, result.ErrorMessage); var id = Guid.NewGuid(); //create data var producer = new ProducerMethodShared(); if (linqMethodTypes == LinqMethodTypes.Compiled) { producer.RunTestCompiled <SqlServerMessageQueueInit>(queueName, ConnectionInfo.ConnectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, id, GenerateMethod.CreateErrorCompiled, 0, oCreation.Scope, false); } #if NETFULL else { producer.RunTestDynamic <SqlServerMessageQueueInit>(queueName, ConnectionInfo.ConnectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, id, GenerateMethod.CreateErrorDynamic, 0, oCreation.Scope, false); } #endif //process data var consumer = new ConsumerMethodAsyncErrorShared(); consumer.RunConsumer <SqlServerMessageQueueInit>(queueName, ConnectionInfo.ConnectionString, false, logProvider, messageCount, workerCount, timeOut, queueSize, readerCount, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(12), id, "second(*%3)", enableChaos); ValidateErrorCounts(queueName, messageCount); new VerifyQueueRecordCount(queueName, oCreation.Options).Verify(messageCount, true, false); //don't purge consumer.PurgeErrorMessages <SqlServerMessageQueueInit>(queueName, ConnectionInfo.ConnectionString, false, logProvider, false); ValidateErrorCounts(queueName, messageCount); //purge error messages and verify that count is 0 consumer.PurgeErrorMessages <SqlServerMessageQueueInit>(queueName, ConnectionInfo.ConnectionString, false, logProvider, true); ValidateErrorCounts(queueName, 0); } } finally { using ( var oCreation = queueCreator.GetQueueCreation <SqlServerMessageQueueCreation>(queueName, ConnectionInfo.ConnectionString) ) { oCreation.RemoveQueue(); } } } }
public void Run(int messageCount, int timeOut, int workerCount, ConnectionInfoTypes type, bool route) { 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 if (route) { var producer = new ProducerShared(); producer.RunTest <RedisQueueInit, FakeMessage>(queueName, connectionString, false, messageCount, logProvider, Helpers.GenerateRouteData, Helpers.Verify, false, null, false); } else { var producer = new ProducerShared(); producer.RunTest <RedisQueueInit, FakeMessage>(queueName, connectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, null, false); } //process data var defaultRoute = route ? Helpers.DefaultRoute : null; var consumer = new ConsumerErrorShared <FakeMessage>(); consumer.RunConsumer <RedisQueueInit>(queueName, connectionString, false, logProvider, workerCount, timeOut, messageCount, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(12), "second(*%3)", defaultRoute, false); ValidateErrorCounts(queueName, connectionString, messageCount); using ( var count = new VerifyQueueRecordCount(queueName, connectionString)) { count.Verify(messageCount, true, 2); } consumer.PurgeErrorMessages <RedisQueueInit>(queueName, connectionString, false, logProvider, false); //table should be empty now ValidateErrorCounts(queueName, connectionString, messageCount); //purge error records consumer.PurgeErrorMessages <RedisQueueInit>(queueName, connectionString, false, logProvider, true); //table should be empty now ValidateErrorCounts(queueName, connectionString, 0); } 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, bool useTransactions, int messageType) { SchedulerContainer schedulerContainer = null; if (Factory == null) { Factory = CreateFactory(workerCount, queueSize, out schedulerContainer); } var queueName = GenerateQueueName.Create(); var logProvider = LoggerShared.Create(queueName, GetType().Name); using (var queueCreator = new QueueCreationContainer <SqlServerMessageQueueInit>( serviceRegister => serviceRegister.Register(() => logProvider, LifeStyles.Singleton))) { try { using ( var oCreation = queueCreator.GetQueueCreation <SqlServerMessageQueueCreation>(queueName, ConnectionInfo.ConnectionString) ) { oCreation.Options.EnableDelayedProcessing = true; oCreation.Options.EnableHeartBeat = !useTransactions; oCreation.Options.EnableHoldTransactionUntilMessageCommitted = useTransactions; oCreation.Options.EnableStatus = !useTransactions; oCreation.Options.EnableStatusTable = true; var result = oCreation.CreateQueue(); Assert.True(result.Success, result.ErrorMessage); if (messageType == 1) { var producer = new ProducerAsyncShared(); producer.RunTestAsync <SqlServerMessageQueueInit, FakeMessage>(queueName, ConnectionInfo.ConnectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, oCreation.Scope).Wait(timeOut / 2 * 1000); var consumer = new ConsumerAsyncShared <FakeMessage> { Factory = Factory }; consumer.RunConsumer <SqlServerMessageQueueInit>(queueName, ConnectionInfo.ConnectionString, false, logProvider, runtime, messageCount, timeOut, readerCount, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(12), "second(*%3)"); } else if (messageType == 2) { var producer = new ProducerAsyncShared(); producer.RunTestAsync <SqlServerMessageQueueInit, FakeMessageA>(queueName, ConnectionInfo.ConnectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, oCreation.Scope).Wait(timeOut / 2 * 1000); var consumer = new ConsumerAsyncShared <FakeMessageA> { Factory = Factory }; consumer.RunConsumer <SqlServerMessageQueueInit>(queueName, ConnectionInfo.ConnectionString, false, logProvider, runtime, messageCount, timeOut, readerCount, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(12), "second(*%3)"); } else if (messageType == 3) { var producer = new ProducerAsyncShared(); producer.RunTestAsync <SqlServerMessageQueueInit, FakeMessageB>(queueName, ConnectionInfo.ConnectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, oCreation.Scope).Wait(timeOut / 2 * 1000); var consumer = new ConsumerAsyncShared <FakeMessageB> { Factory = Factory }; consumer.RunConsumer <SqlServerMessageQueueInit>(queueName, ConnectionInfo.ConnectionString, false, logProvider, runtime, messageCount, timeOut, readerCount, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(12), "second(*%10)"); } new VerifyQueueRecordCount(queueName, oCreation.Options).Verify(0, false, false); } } finally { schedulerContainer?.Dispose(); using ( var oCreation = queueCreator.GetQueueCreation <SqlServerMessageQueueCreation>(queueName, ConnectionInfo.ConnectionString) ) { oCreation.RemoveQueue(); } } } }
public void Run(int messageCount, int runtime, int timeOut, int workerCount, bool useTransactions, LinqMethodTypes linqMethodTypes) { var queueName = GenerateQueueName.Create(); var logProvider = LoggerShared.Create(queueName, GetType().Name); using ( var queueCreator = new QueueCreationContainer <PostgreSqlMessageQueueInit>( serviceRegister => serviceRegister.Register(() => logProvider, LifeStyles.Singleton))) { try { using ( var oCreation = queueCreator.GetQueueCreation <PostgreSqlMessageQueueCreation>(queueName, ConnectionInfo.ConnectionString) ) { oCreation.Options.EnableDelayedProcessing = true; oCreation.Options.EnableHeartBeat = !useTransactions; oCreation.Options.EnableHoldTransactionUntilMessageCommitted = useTransactions; oCreation.Options.EnableStatus = !useTransactions; oCreation.Options.EnableStatusTable = true; var result = oCreation.CreateQueue(); Assert.True(result.Success, result.ErrorMessage); var id = Guid.NewGuid(); //create data var producer = new ProducerMethodShared(); if (linqMethodTypes == LinqMethodTypes.Compiled) { producer.RunTestCompiled <PostgreSqlMessageQueueInit>(queueName, ConnectionInfo.ConnectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, id, GenerateMethod.CreateRollBackCompiled, runtime, oCreation.Scope); } #if NETFULL else { producer.RunTestDynamic <PostgreSqlMessageQueueInit>(queueName, ConnectionInfo.ConnectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, id, GenerateMethod.CreateRollBackDynamic, runtime, oCreation.Scope); } #endif //process data var consumer = new ConsumerMethodRollBackShared(); consumer.RunConsumer <PostgreSqlMessageQueueInit>(queueName, ConnectionInfo.ConnectionString, false, workerCount, logProvider, timeOut, runtime, messageCount, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(12), "second(*%3)", id); new VerifyQueueRecordCount(queueName, oCreation.Options).Verify(0, false, false); GenerateMethod.ClearRollback(id); } } finally { using ( var oCreation = queueCreator.GetQueueCreation <PostgreSqlMessageQueueCreation>(queueName, ConnectionInfo.ConnectionString) ) { oCreation.RemoveQueue(); } } } }
public void Run(int messageCount, int runtime, int timeOut, int workerCount, LinqMethodTypes linqMethodTypes) { using (var connectionInfo = new IntegrationConnectionInfo()) { var queueName = GenerateQueueName.Create(); var logProvider = LoggerShared.Create(queueName, GetType().Name); using ( var queueCreator = new QueueCreationContainer <MemoryMessageQueueInit>( serviceRegister => serviceRegister.Register(() => logProvider, LifeStyles.Singleton))) { try { using ( var oCreation = queueCreator.GetQueueCreation <MessageQueueCreation>(queueName, connectionInfo.ConnectionString) ) { var result = oCreation.CreateQueue(); Assert.True(result.Success, result.ErrorMessage); var producer = new ProducerMethodShared(); var id = Guid.NewGuid(); if (linqMethodTypes == LinqMethodTypes.Compiled) { producer.RunTestCompiled <MemoryMessageQueueInit>(queueName, connectionInfo.ConnectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, id, GenerateMethod.CreateCompiled, runtime, oCreation.Scope); } #if NETFULL else { producer.RunTestDynamic <MemoryMessageQueueInit>(queueName, connectionInfo.ConnectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, id, GenerateMethod.CreateDynamic, runtime, oCreation.Scope); } #endif var consumer = new ConsumerMethodShared(); consumer.RunConsumer <MemoryMessageQueueInit>(queueName, connectionInfo.ConnectionString, false, logProvider, runtime, messageCount, workerCount, timeOut, TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(35), id, "second(*%10)"); new VerifyQueueRecordCount().Verify(oCreation.Scope, 0, true); } } finally { using ( var oCreation = queueCreator.GetQueueCreation <MessageQueueCreation>(queueName, connectionInfo.ConnectionString) ) { oCreation.RemoveQueue(); } } } } }
public void Run(int messageCount, int timeOut, int workerCount, bool useTransactions, bool enableChaos) { var queueName = GenerateQueueName.Create(); var logProvider = LoggerShared.Create(queueName, GetType().Name); using (var queueCreator = new QueueCreationContainer <PostgreSqlMessageQueueInit>( serviceRegister => serviceRegister.Register(() => logProvider, LifeStyles.Singleton))) { try { using ( var oCreation = queueCreator.GetQueueCreation <PostgreSqlMessageQueueCreation>(queueName, ConnectionInfo.ConnectionString) ) { oCreation.Options.EnableDelayedProcessing = true; oCreation.Options.EnableHeartBeat = !useTransactions; oCreation.Options.EnableHoldTransactionUntilMessageCommitted = useTransactions; oCreation.Options.EnableStatus = !useTransactions; oCreation.Options.EnableStatusTable = true; var result = oCreation.CreateQueue(); Assert.True(result.Success, result.ErrorMessage); //create data var producer = new ProducerShared(); producer.RunTest <PostgreSqlMessageQueueInit, FakeMessage>(queueName, ConnectionInfo.ConnectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, oCreation.Scope, false); //process data var consumer = new ConsumerErrorShared <FakeMessage>(); consumer.RunConsumer <PostgreSqlMessageQueueInit>(queueName, ConnectionInfo.ConnectionString, false, logProvider, workerCount, timeOut, messageCount, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(12), "second(*%3)", null, enableChaos); ValidateErrorCounts(queueName, messageCount); new VerifyQueueRecordCount(queueName, oCreation.Options).Verify(messageCount, true, false); //run, but don't purge consumer.PurgeErrorMessages <PostgreSqlMessageQueueInit>(queueName, ConnectionInfo.ConnectionString, false, logProvider, false); ValidateErrorCounts(queueName, messageCount); //purge error records consumer.PurgeErrorMessages <PostgreSqlMessageQueueInit>(queueName, ConnectionInfo.ConnectionString, false, logProvider, true); //table should be empty now ValidateErrorCounts(queueName, 0); } } finally { using ( var oCreation = queueCreator.GetQueueCreation <PostgreSqlMessageQueueCreation>(queueName, ConnectionInfo.ConnectionString) ) { oCreation.RemoveQueue(); } } } }
public void Run( int messageCount, bool interceptors, bool enableDelayedProcessing, bool enableHeartBeat, bool enableHoldTransactionUntilMessageCommitted, bool enableMessageExpiration, bool enablePriority, bool enableStatus, bool enableStatusTable, bool additionalColumn) { var queueName = GenerateQueueName.Create(); var logProvider = LoggerShared.Create(queueName, GetType().Name); using (var queueCreator = new QueueCreationContainer <SqlServerMessageQueueInit>( serviceRegister => serviceRegister.Register(() => logProvider, LifeStyles.Singleton))) { try { using ( var oCreation = queueCreator.GetQueueCreation <SqlServerMessageQueueCreation>(queueName, ConnectionInfo.ConnectionString) ) { oCreation.Options.EnableDelayedProcessing = enableDelayedProcessing; oCreation.Options.EnableHeartBeat = enableHeartBeat; oCreation.Options.EnableMessageExpiration = enableMessageExpiration; oCreation.Options.EnableHoldTransactionUntilMessageCommitted = enableHoldTransactionUntilMessageCommitted; oCreation.Options.EnablePriority = enablePriority; oCreation.Options.EnableStatus = enableStatus; oCreation.Options.EnableStatusTable = enableStatusTable; if (additionalColumn) { oCreation.Options.AdditionalColumns.Add(new Column("OrderID", ColumnTypes.Int, true, null)); } var result = oCreation.CreateQueue(); Assert.True(result.Success, result.ErrorMessage); var producer = new ProducerShared(); producer.RunTest <SqlServerMessageQueueInit, FakeMessage>(queueName, ConnectionInfo.ConnectionString, interceptors, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, oCreation.Scope); } } finally { using ( var oCreation = queueCreator.GetQueueCreation <SqlServerMessageQueueCreation>(queueName, ConnectionInfo.ConnectionString) ) { oCreation.RemoveQueue(); } } } }