private void RunTest(string queueName, int messageCount, int queueCount, ILogProvider logProvider, Guid id, int runTime, LinqMethodTypes linqMethodTypes) { var tasks = new List<Task>(queueCount); for (var i = 0; i < queueCount; i++) { var producer = new ProducerMethodShared(); switch (linqMethodTypes) { case LinqMethodTypes.Dynamic: tasks.Add( new Task( () => producer.RunTestDynamic<PostgreSqlMessageQueueInit>(queueName, ConnectionInfo.ConnectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.NoVerification, true, false, id, GenerateMethod.CreateDynamic, runTime))); break; case LinqMethodTypes.Compiled: tasks.Add( new Task( () => producer.RunTestCompiled<PostgreSqlMessageQueueInit>(queueName, ConnectionInfo.ConnectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.NoVerification, true, false, id, GenerateMethod.CreateCompiled, runTime))); break; } } tasks.AsParallel().ForAll(x => x.Start()); Task.WaitAll(tasks.ToArray()); }
private async Task RunProducerInternalAsync( IProducerMethodQueue queue, long messageCount, Func <QueueProducerConfiguration, AdditionalMessageData> generateData, bool sendViaBatch, int runTime, Guid id, LinqMethodTypes methodType) { var numberOfJobs = Convert.ToInt32(messageCount); switch (methodType) { case LinqMethodTypes.Compiled: { var jobs = Enumerable.Range(0, numberOfJobs) .Select(i => GenerateMethod.CreateCompiled(id, runTime)); await RunProducerInternalAsync(queue, generateData, sendViaBatch, jobs, numberOfJobs) .ConfigureAwait(false); } break; #if NETFULL case LinqMethodTypes.Dynamic: { var jobs = Enumerable.Range(0, numberOfJobs) .Select(i => GenerateMethod.CreateDynamic(id, runTime)); await RunProducerInternalAsync(queue, generateData, sendViaBatch, jobs, numberOfJobs) .ConfigureAwait(false); } break; #endif } }
public void Run <TTransportInit, TTransportCreate>( QueueConnection queueConnection, int messageCount, int queueCount, LinqMethodTypes linqMethodTypes, bool enableChaos, Func <QueueProducerConfiguration, AdditionalMessageData> generateData, Action <QueueConnection, IBaseTransportOptions, ICreationScope, int, string> verifyQueueCount) where TTransportInit : ITransportInit, new() where TTransportCreate : class, IQueueCreation { var logProvider = LoggerShared.Create(queueConnection.Queue, GetType().Name); using (var queueCreator = new QueueCreationContainer <TTransportInit>( serviceRegister => serviceRegister.Register(() => logProvider, LifeStyles.Singleton))) { ICreationScope scope = null; var oCreation = queueCreator.GetQueueCreation <TTransportCreate>(queueConnection); try { var result = oCreation.CreateQueue(); Assert.True(result.Success, result.ErrorMessage); scope = oCreation.Scope; RunTest <TTransportInit>(queueConnection, messageCount, queueCount, logProvider, linqMethodTypes, oCreation.Scope, enableChaos, generateData); LoggerShared.CheckForErrors(queueConnection.Queue); verifyQueueCount(queueConnection, oCreation.BaseTransportOptions, scope, messageCount * queueCount, null); } finally { oCreation.RemoveQueue(); oCreation.Dispose(); scope?.Dispose(); } } }
#pragma warning disable xUnit1013 // Public method should be marked as test public void RunWithFactory(int messageCount, int runtime, int timeOut, int workerCount, int readerCount, int queueSize, #pragma warning restore xUnit1013 // Public method should be marked as test int messageType, ITaskFactory factory, LinqMethodTypes linqMethodTypes) { Factory = factory; Run(messageCount, runtime, timeOut, workerCount, readerCount, queueSize, messageType, linqMethodTypes); }
public void Run( int messageCount, bool interceptors, bool enableDelayedProcessing, bool enableHeartBeat, bool enableHoldTransactionUntilMessageCommitted, bool enableMessageExpiration, bool enablePriority, bool enableStatus, bool enableStatusTable, bool additionalColumn, LinqMethodTypes linqMethodTypes, bool enableChaos) { var queueName = GenerateQueueName.Create(); var consumer = new DotNetWorkQueue.IntegrationTests.Shared.ProducerMethod.Implementation.SimpleMethodProducer(); consumer.Run <SqlServerMessageQueueInit, SqlServerMessageQueueCreation>(new QueueConnection(queueName, ConnectionInfo.ConnectionString), messageCount, linqMethodTypes, interceptors, enableChaos, false, x => Helpers.SetOptions(x, enableDelayedProcessing, !enableHoldTransactionUntilMessageCommitted, enableHoldTransactionUntilMessageCommitted, enableMessageExpiration, enablePriority, !enableHoldTransactionUntilMessageCommitted, enableStatusTable, additionalColumn), Helpers.GenerateData, Helpers.Verify); }
public async Task 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 consumer = new DotNetWorkQueue.IntegrationTests.Shared.ProducerMethod.Implementation. SimpleMethodProducerAsync(); await consumer.Run <SqLiteMessageQueueInit, SqLiteMessageQueueCreation>(new QueueConnection(queueName, connectionInfo.ConnectionString), messageCount, linqMethodTypes, interceptors, enableChaos, false, x => Helpers.SetOptions(x, enableDelayedProcessing, enableHeartBeat, enableMessageExpiration, enablePriority, enableStatus, enableStatusTable, additionalColumn, false), Helpers.GenerateData, Helpers.Verify).ConfigureAwait(false); } }
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 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, null, false); } #if NETFULL else { producer.RunTestDynamic <RedisQueueInit>(queueName, connectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, id, GenerateMethod.CreateNoOpDynamic, 0, null, false); } #endif //process data var consumer = new ConsumerMethodPoisonMessageShared(); consumer.RunConsumer <RedisQueueInit>(queueName, connectionString, false, workerCount, logProvider, timeOut, messageCount, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(12), "second(*%3)", false); 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, LinqMethodTypes linqMethodTypes, bool enableChaos) { var queueName = GenerateQueueName.Create(); var consumer = new DotNetWorkQueue.IntegrationTests.Shared.ProducerMethod.Implementation.MultiMethodProducer(); consumer.Run <SqlServerMessageQueueInit, SqlServerMessageQueueCreation>(new QueueConnection(queueName, ConnectionInfo.ConnectionString), messageCount, 10, linqMethodTypes, enableChaos, Helpers.GenerateData, VerifyQueueCount); }
public void Run( int messageCount, 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 id = Guid.NewGuid(); var producer = new ProducerMethodShared(); if (linqMethodTypes == LinqMethodTypes.Compiled) { producer.RunTestCompiled <MemoryMessageQueueInit>(queueName, connectionInfo.ConnectionString, true, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, id, GenerateMethod.CreateCompiled, 0, oCreation.Scope, false); } #if NETFULL else { producer.RunTestDynamic <MemoryMessageQueueInit>(queueName, connectionInfo.ConnectionString, true, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, id, GenerateMethod.CreateDynamic, 0, oCreation.Scope, false); } #endif } } finally { using ( var oCreation = queueCreator.GetQueueCreation <MessageQueueCreation>(queueName, connectionInfo.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.GenerateExpiredData, Helpers.Verify, false, id, GenerateMethod.CreateCompiled, runtime, null); } #if NETFULL else { producer.RunTestDynamic <RedisQueueInit>(queueName, connectionString, false, messageCount, logProvider, Helpers.GenerateExpiredData, Helpers.Verify, false, id, GenerateMethod.CreateDynamic, runtime, null); } #endif Thread.Sleep(2000); var consumer = new ConsumerMethodExpiredMessageShared(); consumer.RunConsumer <RedisQueueInit>(queueName, connectionString, false, logProvider, runtime, messageCount, workerCount, timeOut, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(12), "second(*%10)", 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 <TTransportInit, TTransportCreate>( QueueConnection queueConnection, int messageCount, LinqMethodTypes linqMethodTypes, bool interceptors, bool enableChaos, bool sendViaBatch, Action <TTransportCreate> setOptions, Func <QueueProducerConfiguration, AdditionalMessageData> generateData, Action <QueueConnection, QueueProducerConfiguration, long, ICreationScope> verify) where TTransportInit : ITransportInit, new() where TTransportCreate : class, IQueueCreation { var logProvider = LoggerShared.Create(queueConnection.Queue, GetType().Name); using (var queueCreator = new QueueCreationContainer <TTransportInit>( serviceRegister => serviceRegister.Register(() => logProvider, LifeStyles.Singleton))) { ICreationScope scope = null; var oCreation = queueCreator.GetQueueCreation <TTransportCreate>(queueConnection); try { setOptions(oCreation); var result = oCreation.CreateQueue(); Assert.True(result.Success, result.ErrorMessage); scope = oCreation.Scope; var id = Guid.NewGuid(); var producer = new ProducerMethodShared(); if (linqMethodTypes == LinqMethodTypes.Compiled) { producer.RunTestCompiled <TTransportInit>(queueConnection, interceptors, messageCount, logProvider, generateData, verify, sendViaBatch, id, GenerateMethod.CreateCompiled, 0, oCreation.Scope, enableChaos); } else { producer.RunTestDynamic <TTransportInit>(queueConnection, interceptors, messageCount, logProvider, generateData, verify, sendViaBatch, id, GenerateMethod.CreateDynamic, 0, oCreation.Scope, enableChaos); } } finally { oCreation.RemoveQueue(); oCreation.Dispose(); scope?.Dispose(); } } }
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(int messageCount, int timeOut, int workerCount, ConnectionInfoTypes type, LinqMethodTypes linqMethodTypes) { var queueName = GenerateQueueName.Create(); var connectionString = new ConnectionInfo(type).ConnectionString; var consumer = new DotNetWorkQueue.IntegrationTests.Shared.ConsumerMethod.Implementation.ConsumerMethodErrorTable(); consumer.Run <RedisQueueInit, RedisQueueCreation>(new QueueConnection(queueName, connectionString), messageCount, timeOut, workerCount, linqMethodTypes, false, x => { }, Helpers.GenerateData, Helpers.Verify, VerifyQueueCount, ValidateErrorCounts); }
public void Run(int messageCount, int runtime, int timeOut, int workerCount, LinqMethodTypes linqMethodTypes, bool enableChaos) { var queueName = GenerateQueueName.Create(); var consumer = new DotNetWorkQueue.IntegrationTests.Shared.ConsumerMethod.Implementation.ConsumerMethodCancelWork(); consumer.Run <SqlServerMessageQueueInit, SqlServerMessageQueueCreation>(new QueueConnection(queueName, ConnectionInfo.ConnectionString), messageCount, runtime, timeOut, workerCount, linqMethodTypes, enableChaos, x => Helpers.SetOptions(x, true, true, false, false, false, true, true, false), Helpers.GenerateData, Helpers.Verify, Helpers.VerifyQueueCount); }
public void Run(int messageCount, int runtime, int timeOut, int workerCount, int readerCount, int queueSize, int messageType, ConnectionInfoTypes type, LinqMethodTypes linqMethodTypes) { var queueName = GenerateQueueName.Create(); var connectionString = new ConnectionInfo(type).ConnectionString; var consumer = new DotNetWorkQueue.IntegrationTests.Shared.ConsumerMethodAsync.Implementation. SimpleMethodConsumerAsync(); consumer.Run <RedisQueueInit, RedisQueueCreation>(new QueueConnection(queueName, connectionString), messageCount, runtime, timeOut, workerCount, readerCount, queueSize, messageType, linqMethodTypes, false, x => { }, Helpers.GenerateData, Helpers.Verify, VerifyQueueCount); }
public void Run(LinqMethodTypes linqMethodTypes) { using (var connectionInfo = new IntegrationConnectionInfo()) { var queueName = GenerateQueueName.Create(); var consumer = new DotNetWorkQueue.IntegrationTests.Shared.ProducerMethod.Implementation.MultiMethodProducer(); consumer.Run <MemoryMessageQueueInit, MessageQueueCreation>(new QueueConnection(queueName, connectionInfo.ConnectionString), 100, 10, linqMethodTypes, false, Helpers.GenerateData, VerifyQueueCount); } }
public void Run(int messageCount, int timeOut, int workerCount, bool useTransactions, LinqMethodTypes linqMethodTypes, bool enableChaos) { var queueName = GenerateQueueName.Create(); var consumer = new DotNetWorkQueue.IntegrationTests.Shared.ConsumerMethod.Implementation.ConsumerMethodErrorTable(); consumer.Run <PostgreSqlMessageQueueInit, PostgreSqlMessageQueueCreation>(new QueueConnection(queueName, ConnectionInfo.ConnectionString), messageCount, timeOut, workerCount, linqMethodTypes, enableChaos, x => Helpers.SetOptions(x, true, !useTransactions, useTransactions, false, false, !useTransactions, true, false), Helpers.GenerateData, Helpers.Verify, Helpers.VerifyQueueCount, ValidateErrorCounts); }
public void Run(int messageCount, int runtime, int timeOut, int workerCount, LinqMethodTypes linqMethodTypes) { using (var connectionInfo = new IntegrationConnectionInfo()) { var queueName = GenerateQueueName.Create(); var consumer = new DotNetWorkQueue.IntegrationTests.Shared.ConsumerMethod.Implementation. SimpleMethodConsumer(); consumer.Run <MemoryMessageQueueInit, MessageQueueCreation>(new QueueConnection(queueName, connectionInfo.ConnectionString), messageCount, runtime, timeOut, workerCount, linqMethodTypes, false, x => { }, Helpers.GenerateData, Helpers.Verify, VerifyQueueCount); } }
public void Run(int messageCount, int runtime, int timeOut, int workerCount, LinqMethodTypes linqMethodTypes, bool enableChaos, IntegrationConnectionInfo.ConnectionTypes connectionType) { using (var connectionInfo = new IntegrationConnectionInfo(connectionType)) { var queueName = GenerateQueueName.Create(); var consumer = new DotNetWorkQueue.IntegrationTests.Shared.ConsumerMethod.Implementation. ConsumerMethodExpiredMessage(); consumer.Run <LiteDbMessageQueueInit, LiteDbMessageQueueCreation>(new QueueConnection(queueName, connectionInfo.ConnectionString), messageCount, runtime, timeOut, workerCount, linqMethodTypes, enableChaos, x => Helpers.SetOptions(x, true, true, true), Helpers.GenerateData, Helpers.Verify, Helpers.VerifyQueueCount); } }
private async Task RunProducerAsync( IProducerMethodQueue queue, QueueConnection queueConnection, long messageCount, Func <QueueProducerConfiguration, AdditionalMessageData> generateData, Action <QueueConnection, QueueProducerConfiguration, long, ICreationScope> verify, bool sendViaBatch, int runTime, Guid id, LinqMethodTypes type, ICreationScope scope) { await RunProducerInternalAsync(queue, messageCount, generateData, sendViaBatch, runTime, id, type) .ConfigureAwait(false); LoggerShared.CheckForErrors(queueConnection.Queue); verify(queueConnection, queue.Configuration, messageCount, scope); }
public async Task Run( int messageCount, LinqMethodTypes linqMethodTypes) { using (var connectionInfo = new IntegrationConnectionInfo()) { var queueName = GenerateQueueName.Create(); var consumer = new DotNetWorkQueue.IntegrationTests.Shared.ProducerMethod.Implementation. SimpleMethodProducerAsync(); await consumer.Run <MemoryMessageQueueInit, MessageQueueCreation>(new QueueConnection(queueName, connectionInfo.ConnectionString), messageCount, linqMethodTypes, false, false, true, x => { }, Helpers.GenerateData, Verify).ConfigureAwait(false); } }
public async Task Run( int messageCount, bool interceptors, bool batchSending, ConnectionInfoTypes type, LinqMethodTypes linqMethodTypes) { var queueName = GenerateQueueName.Create(); var connectionString = new ConnectionInfo(type).ConnectionString; var consumer = new DotNetWorkQueue.IntegrationTests.Shared.ProducerMethod.Implementation.SimpleMethodProducerAsync(); await consumer.Run <RedisQueueInit, RedisQueueCreation>(new QueueConnection(queueName, connectionString), messageCount, linqMethodTypes, interceptors, false, batchSending, x => { }, Helpers.GenerateData, Helpers.Verify).ConfigureAwait(false); }
public void Run(int messageCount, int timeOut, int workerCount, int readerCount, int queueSize, bool inMemoryDb, LinqMethodTypes linqMethodTypes, bool enableChaos) { using (var connectionInfo = new IntegrationConnectionInfo(inMemoryDb)) { var queueName = GenerateQueueName.Create(); var consumer = new DotNetWorkQueue.IntegrationTests.Shared.ConsumerMethodAsync.Implementation. ConsumerMethodAsyncPoisonMessage(); consumer.Run <SqLiteMessageQueueInit, SqLiteMessageQueueCreation>(new QueueConnection(queueName, connectionInfo.ConnectionString), messageCount, timeOut, workerCount, readerCount, queueSize, linqMethodTypes, enableChaos, x => Helpers.SetOptions(x, false, true, false, false, true, true, false), Helpers.GenerateData, Helpers.Verify, Helpers.VerifyQueueCount, ValidateErrorCounts); } }
public async void Run( int messageCount, 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 ProducerMethodAsyncShared(); var id = Guid.NewGuid(); await producer.RunTestAsync <MemoryMessageQueueInit>(queueName, connectionInfo.ConnectionString, true, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, 0, id, linqMethodTypes, oCreation.Scope, false).ConfigureAwait(false); } } finally { using ( var oCreation = queueCreator.GetQueueCreation <MessageQueueCreation>(queueName, connectionInfo.ConnectionString) ) { oCreation.RemoveQueue(); } } } } }
public void RunWithFactory <TTransportInit, TTransportCreate>( QueueConnection queueConnection, int messageCount, int runtime, int timeOut, int workerCount, int readerCount, int queueSize, int messageType, ITaskFactory factory, LinqMethodTypes linqMethodTypes, bool enableChaos, Action <TTransportCreate> setOptions, Func <QueueProducerConfiguration, AdditionalMessageData> generateData, Action <QueueConnection, QueueProducerConfiguration, long, ICreationScope> verify, Action <QueueConnection, IBaseTransportOptions, ICreationScope, int, bool, bool> verifyQueueCount) where TTransportInit : ITransportInit, new() where TTransportCreate : class, IQueueCreation { Factory = factory; Run <TTransportInit, TTransportCreate>(queueConnection, messageCount, runtime, timeOut, workerCount, readerCount, queueSize, messageType, linqMethodTypes, enableChaos, setOptions, generateData, verify, verifyQueueCount); }
public async Task RunTestAsync <TTransportInit>(QueueConnection queueConnection, bool addInterceptors, long messageCount, ILogger logProvider, Func <QueueProducerConfiguration, AdditionalMessageData> generateData, Action <QueueConnection, QueueProducerConfiguration, long, ICreationScope> verify, bool sendViaBatch, int runTime, Guid id, LinqMethodTypes linqMethodTypes, ICreationScope scope, bool enableChaos) where TTransportInit : ITransportInit, new() { using (var trace = SharedSetup.CreateTrace("producer")) { using (var metrics = new Metrics.Metrics(queueConnection.Queue)) { var addInterceptorProducer = InterceptorAdding.No; if (addInterceptors) { addInterceptorProducer = InterceptorAdding.Yes; } using ( var creator = SharedSetup.CreateCreator <TTransportInit>(addInterceptorProducer, logProvider, metrics, false, enableChaos, scope, trace.Source) ) { //create the queue using (var queue = creator .CreateMethodProducer(queueConnection)) { await RunProducerAsync(queue, queueConnection, messageCount, generateData, verify, sendViaBatch, runTime, id, linqMethodTypes, scope).ConfigureAwait(false); } VerifyMetrics.VerifyProducedAsyncCount(queueConnection.Queue, metrics.GetCurrentMetrics(), messageCount); } } } }
public void Run(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) ) { var result = oCreation.CreateQueue(); Assert.True(result.Success, result.ErrorMessage); RunTest(queueName, 100, 10, logProvider, connectionInfo.ConnectionString, linqMethodTypes); LoggerShared.CheckForErrors(queueName); new VerifyQueueData(queueName, connectionInfo.ConnectionString, oCreation.Options).Verify(100 * 10, null); } } finally { using ( var oCreation = queueCreator.GetQueueCreation<SqLiteMessageQueueCreation>(queueName, connectionInfo.ConnectionString) ) { oCreation.RemoveQueue(); } } } } }
private void RunTest(string queueName, int messageCount, int queueCount, ILogProvider logProvider, string connectionString, LinqMethodTypes linqMethodTypes) { var tasks = new List<Task>(queueCount); for (var i = 0; i < queueCount; i++) { var id = Guid.NewGuid(); var producer = new ProducerMethodShared(); if (linqMethodTypes == LinqMethodTypes.Compiled) { tasks.Add(new Task(() => producer.RunTestCompiled<SqLiteMessageQueueInit>(queueName, connectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.NoVerification, true, false, id, GenerateMethod.CreateCompiled, 0))); } else { tasks.Add(new Task(() => producer.RunTestDynamic<SqLiteMessageQueueInit>(queueName, connectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.NoVerification, true, false, id, GenerateMethod.CreateDynamic, 0))); } } tasks.AsParallel().ForAll(x => x.Start()); Task.WaitAll(tasks.ToArray()); }
public void Run( int messageCount, bool interceptors, bool enableDelayedProcessing, bool enableMessageExpiration, bool enableStatusTable, LinqMethodTypes linqMethodTypes, bool enableChaos, IntegrationConnectionInfo.ConnectionTypes connectionType) { using (var connectionInfo = new IntegrationConnectionInfo(connectionType)) { var queueName = GenerateQueueName.Create(); var consumer = new DotNetWorkQueue.IntegrationTests.Shared.ProducerMethod.Implementation.SimpleMethodProducer(); consumer.Run <LiteDbMessageQueueInit, LiteDbMessageQueueCreation>(new QueueConnection(queueName, connectionInfo.ConnectionString), messageCount, linqMethodTypes, interceptors, enableChaos, true, x => Helpers.SetOptions(x, enableDelayedProcessing, enableMessageExpiration, enableStatusTable), Helpers.GenerateData, Helpers.Verify); } }
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, 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, "second(*%3)"); using (var count = new VerifyQueueRecordCount(queueNameSend, connectionString)) { count.Verify(0, false, -1); } } finally { using ( var oCreation = queueCreatorSend.GetQueueCreation <RedisQueueCreation>(queueNameSend, connectionString) ) { oCreation.RemoveQueue(); } } } }
public void Run(int messageCount, 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) ) { var result = oCreation.CreateQueue(); Assert.True(result.Success, result.ErrorMessage); RunTest(queueName, messageCount, 10, logProvider, connectionInfo.ConnectionString, linqMethodTypes, oCreation.Scope, enableChaos); LoggerShared.CheckForErrors(queueName); new VerifyQueueData(queueName, connectionInfo.ConnectionString, oCreation.Options).Verify(messageCount * 10, null); } } finally { using ( var oCreation = queueCreator.GetQueueCreation <SqLiteMessageQueueCreation>(queueName, connectionInfo.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 void Run(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); RunTest(queueName, 100, 10, logProvider, connectionInfo.ConnectionString, linqMethodTypes, oCreation.Scope); LoggerShared.CheckForErrors(queueName); } } finally { using ( var oCreation = queueCreator.GetQueueCreation <MessageQueueCreation>(queueName, connectionInfo.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 connectionString = new ConnectionInfo(type).ConnectionString; var consumer = new DotNetWorkQueue.IntegrationTests.Shared.ProducerMethod.Implementation.SimpleMethodProducer(); if (enableExpiration && enableDelay) { consumer.Run<RedisQueueInit, RedisQueueCreation>(new QueueConnection(queueName, connectionString), messageCount, linqMethodTypes, interceptors, false, batchSending, creation => { }, Helpers.GenerateDelayExpiredData, Verify); } else if (enableDelay) { consumer.Run<RedisQueueInit, RedisQueueCreation>(new QueueConnection(queueName, connectionString), messageCount, linqMethodTypes, interceptors, false, batchSending, creation => { }, Helpers.GenerateDelayData, Verify); } else if (enableExpiration) { consumer.Run<RedisQueueInit, RedisQueueCreation>(new QueueConnection(queueName, connectionString), messageCount, linqMethodTypes, interceptors, false, batchSending, creation => { }, Helpers.GenerateExpiredData, Verify); } else { consumer.Run<RedisQueueInit, RedisQueueCreation>(new QueueConnection(queueName, connectionString), messageCount, linqMethodTypes, interceptors, false, batchSending, creation => { }, Helpers.GenerateData, Verify); } }
public void Run(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) ) { var result = oCreation.CreateQueue(); Assert.True(result.Success, result.ErrorMessage); RunTest(queueName, 1000, 10, logProvider, Guid.NewGuid(), 0, linqMethodTypes, null); LoggerShared.CheckForErrors(queueName); new VerifyQueueData(queueName, oCreation.Options).Verify(1000 * 10, null); } } finally { using ( var oCreation = queueCreator.GetQueueCreation <PostgreSqlMessageQueueCreation>(queueName, ConnectionInfo.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, ITaskFactory factory, ConnectionInfoTypes type, LinqMethodTypes linqMethodTypes) { Factory = factory; Run(messageCount, runtime, timeOut, workerCount, readerCount, queueSize, messageType, type, linqMethodTypes); }
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(); } } } }
public void Run(int messageCount, int runtime, int timeOut, int workerCount, int readerCount, int queueSize, bool useTransactions, int messageType, ITaskFactory factory, LinqMethodTypes linqMethodTypes) { Factory = factory; Run(messageCount, runtime, timeOut, workerCount, readerCount, queueSize, useTransactions, messageType, linqMethodTypes); }
public void Run(int messageCount, int runtime, int timeOut, int workerCount, int readerCount, int queueSize, bool useTransactions, int messageType, LinqMethodTypes linqMethodTypes) { if (Factory == null) { Factory = CreateFactory(workerCount, queueSize); } 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.EnableHoldTransactionUntilMessageCommited = useTransactions; oCreation.Options.EnableStatus = !useTransactions; oCreation.Options.EnableStatusTable = true; var result = oCreation.CreateQueue(); Assert.True(result.Success, result.ErrorMessage); var id = Guid.NewGuid(); if (messageType == 1) { var producer = new ProducerMethodAsyncShared(); producer.RunTest<SqlServerMessageQueueInit>(queueName, ConnectionInfo.ConnectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, runtime, id, linqMethodTypes).Wait(timeOut); var consumer = new ConsumerMethodAsyncShared {Factory = Factory}; consumer.RunConsumer<SqlServerMessageQueueInit>(queueName, ConnectionInfo.ConnectionString, false, logProvider, runtime, messageCount, timeOut, readerCount, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(12), id); } else if (messageType == 2) { var producer = new ProducerMethodAsyncShared(); producer.RunTest<SqlServerMessageQueueInit>(queueName, ConnectionInfo.ConnectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, runtime, id, linqMethodTypes).Wait(timeOut); var consumer = new ConsumerMethodAsyncShared {Factory = Factory}; consumer.RunConsumer<SqlServerMessageQueueInit>(queueName, ConnectionInfo.ConnectionString, false, logProvider, runtime, messageCount, timeOut, readerCount, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(12), id); } else if (messageType == 3) { var producer = new ProducerMethodAsyncShared(); producer.RunTest<SqlServerMessageQueueInit>(queueName, ConnectionInfo.ConnectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, runtime, id, linqMethodTypes).Wait(timeOut); var consumer = new ConsumerMethodAsyncShared {Factory = Factory}; consumer.RunConsumer<SqlServerMessageQueueInit>(queueName, ConnectionInfo.ConnectionString, false, logProvider, runtime, messageCount, timeOut, readerCount, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(12), id); } new VerifyQueueRecordCount(queueName, oCreation.Options).Verify(0, false, false); } } finally { using ( var oCreation = queueCreator.GetQueueCreation<SqlServerMessageQueueCreation>(queueName, ConnectionInfo.ConnectionString) ) { oCreation.RemoveQueue(); } } } }
public async void Run( int messageCount, bool interceptors, bool enableDelayedProcessing, bool enableHeartBeat, bool enableHoldTransactionUntilMessageCommited, bool enableMessageExpiration, bool enablePriority, bool enableStatus, bool enableStatusTable, bool additionalColumn, 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 = enableDelayedProcessing; oCreation.Options.EnableHeartBeat = enableHeartBeat; oCreation.Options.EnableMessageExpiration = enableMessageExpiration; oCreation.Options.EnableHoldTransactionUntilMessageCommited = enableHoldTransactionUntilMessageCommited; oCreation.Options.EnablePriority = enablePriority; oCreation.Options.EnableStatus = enableStatus; oCreation.Options.EnableStatusTable = enableStatusTable; if (additionalColumn) { oCreation.Options.AdditionalColumns.Add(new Column("OrderID", ColumnTypes.Integer, false)); } var result = oCreation.CreateQueue(); Assert.True(result.Success, result.ErrorMessage); var id = Guid.NewGuid(); var producer = new ProducerMethodAsyncShared(); await producer.RunTest<PostgreSqlMessageQueueInit>(queueName, ConnectionInfo.ConnectionString, interceptors, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, 0, id, linqMethodTypes); } } finally { using ( var oCreation = queueCreator.GetQueueCreation<PostgreSqlMessageQueueCreation>(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.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, 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.EnableMessageExpiration = true; oCreation.Options.EnableDelayedProcessing = true; oCreation.Options.EnableHeartBeat = !useTransactions; oCreation.Options.EnableHoldTransactionUntilMessageCommited = useTransactions; oCreation.Options.EnableStatus = !useTransactions; oCreation.Options.EnableStatusTable = true; var result = oCreation.CreateQueue(); Assert.True(result.Success, result.ErrorMessage); var id = Guid.NewGuid(); var producer = new ProducerMethodShared(); if (linqMethodTypes == LinqMethodTypes.Compiled) { producer.RunTestCompiled<PostgreSqlMessageQueueInit>(queueName, ConnectionInfo.ConnectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, id, GenerateMethod.CreateCompiled, runtime); } else { producer.RunTestDynamic<PostgreSqlMessageQueueInit>(queueName, ConnectionInfo.ConnectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, id, GenerateMethod.CreateDynamic, runtime); } var consumer = new ConsumerMethodExpiredMessageShared(); consumer.RunConsumer<PostgreSqlMessageQueueInit>(queueName, ConnectionInfo.ConnectionString, false, logProvider, runtime, messageCount, workerCount, timeOut, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(12), id); new VerifyQueueRecordCount(queueName, oCreation.Options).Verify(0, false, false); } } finally { using ( var oCreation = queueCreator.GetQueueCreation<PostgreSqlMessageQueueCreation>(queueName, ConnectionInfo.ConnectionString) ) { oCreation.RemoveQueue(); } } } }
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.CreateErrorCompiled, 0); } else { producer.RunTestDynamic<SqLiteMessageQueueInit>(queueName, connectionInfo.ConnectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, id, GenerateMethod.CreateErrorDynamic, 0); } //process data var consumer = new ConsumerMethodAsyncErrorShared(); consumer.RunConsumer<SqLiteMessageQueueInit>(queueName,connectionInfo.ConnectionString, false, logProvider, messageCount, workerCount, timeOut, queueSize, readerCount, TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(35), id); ValidateErrorCounts(queueName, connectionInfo.ConnectionString, messageCount); new VerifyQueueRecordCount(queueName, connectionInfo.ConnectionString, oCreation.Options).Verify(messageCount, true, false); } } finally { using ( var oCreation = queueCreator.GetQueueCreation<SqLiteMessageQueueCreation>(queueName, connectionInfo.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) { 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, false, null)); } var result = oCreation.CreateQueue(); Assert.True(result.Success, result.ErrorMessage); var producer = new ProducerMethodShared(); var id = Guid.NewGuid(); if (linqMethodTypes == LinqMethodTypes.Compiled) { producer.RunTestCompiled<SqLiteMessageQueueInit>(queueName, connectionInfo.ConnectionString, interceptors, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, true, id, GenerateMethod.CreateCompiled, 0); } else { producer.RunTestDynamic<SqLiteMessageQueueInit>(queueName, connectionInfo.ConnectionString, interceptors, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, true, id, GenerateMethod.CreateDynamic, 0); } } } 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, LinqMethodTypes linqMethodTypes) { 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.EnableHoldTransactionUntilMessageCommited = 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.EnableHoldTransactionUntilMessageCommited = 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 id = Guid.NewGuid(); var rpc = new RpcMethodShared <PostgreSqlMessageQueueInit, FakeResponse, 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), id, linqMethodTypes); 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(); } } } } }