public void Run( int producerCount, bool inMemoryDb) { using (var connectionInfo = new IntegrationConnectionInfo(inMemoryDb)) { var queueName = GenerateQueueName.Create(); using (var queueContainer = new QueueContainer <SqLiteMessageQueueInit>(x => { })) { try { var tests = new JobSchedulerTestsShared(); tests.RunTestMultipleProducers <SqLiteMessageQueueInit, SqliteJobQueueCreation>(queueName, connectionInfo.ConnectionString, true, producerCount, queueContainer.CreateTimeSync(connectionInfo.ConnectionString), LoggerShared.Create(queueName, GetType().Name)); } finally { using (var queueCreator = new QueueCreationContainer <SqLiteMessageQueueInit>()) { using ( var oCreation = queueCreator.GetQueueCreation <SqLiteMessageQueueCreation>(queueName, connectionInfo.ConnectionString) ) { oCreation.RemoveQueue(); } } } } } }
public void Run(int messageCount, int timeOut, int workerCount, 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, oCreation.Scope); } //process data var consumer = new ConsumerMethodErrorShared(); consumer.RunConsumer <SqLiteMessageQueueInit>(queueName, connectionInfo.ConnectionString, false, logProvider, workerCount, timeOut, messageCount, TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(35), id, "second(*%10)"); 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 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, int readerCount, int queueSize, bool inMemoryDb) { 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); //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)); 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, int timeOut, int workerCount) { 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); //create data var producer = new ProducerShared(); producer.RunTest <MemoryMessageQueueInit, FakeMessage>(queueName, connectionInfo.ConnectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, oCreation.Scope, false); //process data var consumer = new ConsumerErrorShared <FakeMessage>(); consumer.RunConsumer <MemoryMessageQueueInit>(queueName, connectionInfo.ConnectionString, false, logProvider, workerCount, timeOut, messageCount, TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(35), "second(*%10)", null, false); ValidateErrorCounts(oCreation.Scope, messageCount); new VerifyQueueRecordCount().Verify(oCreation.Scope, messageCount, false); //purge error records consumer.PurgeErrorMessages <MemoryMessageQueueInit>(queueName, connectionInfo.ConnectionString, false, logProvider, true); //memory queue doesn't actually keep errors, so nothing to check for... } } finally { using ( var oCreation = queueCreator.GetQueueCreation <MessageQueueCreation>(queueName, connectionInfo.ConnectionString) ) { oCreation.RemoveQueue(); } } } } }
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, 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.EnableMessageExpiration = true; 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 ProducerShared(); producer.RunTest <SqLiteMessageQueueInit, FakeMessage>(queueName, connectionInfo.ConnectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, oCreation.Scope, false); var consumer = new ConsumerExpiredMessageShared <FakeMessage>(); consumer.RunConsumer <SqLiteMessageQueueInit>(queueName, connectionInfo.ConnectionString, false, logProvider, runtime, messageCount, workerCount, timeOut, TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(35), "second(*%10)", null, 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) { 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 ProducerMethodMultipleDynamicShared(); var id = Guid.NewGuid(); producer.RunTestDynamic <MemoryMessageQueueInit>(queueName, connectionInfo.ConnectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, id, GenerateMethod.CreateMultipleDynamic, runtime, oCreation.Scope); 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, bool inMemoryDb, bool enableChaos) { using (var connectionInfo = new IntegrationConnectionInfo(inMemoryDb)) { var queueName = GenerateQueueName.Create(); var producer = new DotNetWorkQueue.IntegrationTests.Shared.Producer.Implementation.MultiProducer(); producer.Run <SqLiteMessageQueueInit, FakeMessage, SqLiteMessageQueueCreation>(new QueueConnection(queueName, connectionInfo.ConnectionString), messageCount, enableChaos, 10, x => { }, Helpers.GenerateData, Helpers.Verify, VerifyQueueData); } }
public void Run(int messageCount, bool inMemoryDb, LinqMethodTypes linqMethodTypes, bool enableChaos) { using (var connectionInfo = new IntegrationConnectionInfo(inMemoryDb)) { var queueName = GenerateQueueName.Create(); var consumer = new DotNetWorkQueue.IntegrationTests.Shared.ProducerMethod.Implementation.MultiMethodProducer(); consumer.Run <SqLiteMessageQueueInit, SqLiteMessageQueueCreation>(new QueueConnection(queueName, connectionInfo.ConnectionString), messageCount, 10, linqMethodTypes, enableChaos, Helpers.GenerateData, VerifyQueueCount); } }
public void Run() { using (var connectionInfo = new IntegrationConnectionInfo()) { var queueName = GenerateQueueName.Create(); var producer = new DotNetWorkQueue.IntegrationTests.Shared.Producer.Implementation.MultiProducer(); producer.Run <MemoryMessageQueueInit, FakeMessage, MessageQueueCreation>(new QueueConnection(queueName, connectionInfo.ConnectionString), 100, false, 10, x => { }, Helpers.GenerateData, Verify, VerifyQueueData); } }
public async Task Run(int messageCount, int runtime, int timeOut, int workerCount, int readerCount, int queueSize) { using (var connectionInfo = new IntegrationConnectionInfo()) { var consumer = new DotNetWorkQueue.IntegrationTests.Shared.ConsumerAsync.Implementation.MultiConsumerAsync(); await consumer.Run <MemoryMessageQueueInit, MessageQueueCreation>(GetConnections(connectionInfo.ConnectionString), messageCount, runtime, timeOut, workerCount, readerCount, queueSize, false, x => { }, Helpers.GenerateData, Helpers.Verify, VerifyQueueCount).ConfigureAwait(false); } }
public void Run(int messageCount, int runtime, int timeOut, int readerCount, bool inMemoryDb, int routeCount) { 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; oCreation.Options.EnableRoute = true; var result = oCreation.CreateQueue(); Assert.True(result.Success, result.ErrorMessage); var routeTest = new RouteTestsShared(); routeTest.RunTest<SqLiteMessageQueueInit, FakeMessageA>(queueName, connectionInfo.ConnectionString, true, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, GenerateRoutes(routeCount), runtime, timeOut, readerCount, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(12)); new VerifyQueueRecordCount(queueName, connectionInfo.ConnectionString, oCreation.Options).Verify(0, false, false); } } finally { using ( var oCreation = queueCreator.GetQueueCreation<SqLiteMessageQueueCreation>(queueName, connectionInfo.ConnectionString) ) { oCreation.RemoveQueue(); } } } } }
public async Task Run(int messageCount, int runtime, int timeOut, int workerCount, int readerCount, int queueSize, bool enableChaos, IntegrationConnectionInfo.ConnectionTypes connectionType) { using (var connectionInfo = new IntegrationConnectionInfo(connectionType)) { var consumer = new DotNetWorkQueue.IntegrationTests.Shared.ConsumerAsync.Implementation.MultiConsumerAsync(); await consumer.Run <LiteDbMessageQueueInit, LiteDbMessageQueueCreation>(GetConnections(connectionInfo.ConnectionString), messageCount, runtime, timeOut, workerCount, readerCount, queueSize, enableChaos, x => Helpers.SetOptions(x, false, false, true), Helpers.GenerateData, Helpers.Verify, Helpers.VerifyQueueCount).ConfigureAwait(false); } }
public void Run(int messageCount, int runtime, int timeOut, int workerCount) { using (var connectionInfo = new IntegrationConnectionInfo()) { var queueName = GenerateQueueName.Create(); var producer = new DotNetWorkQueue.IntegrationTests.Shared.Consumer.Implementation.SimpleConsumer(); producer.Run <MemoryMessageQueueInit, FakeMessage, MessageQueueCreation>(new QueueConnection(queueName, connectionInfo.ConnectionString), messageCount, runtime, timeOut, workerCount, false, x => { }, Helpers.GenerateData, Helpers.Verify, VerifyQueueCount); } }
public void Run(int messageCount, int runtime, int timeOut, int workerCount, bool enableChaos, IntegrationConnectionInfo.ConnectionTypes connectionType) { using (var connectionInfo = new IntegrationConnectionInfo(connectionType)) { var queueName = GenerateQueueName.Create(); var consumer = new DotNetWorkQueue.IntegrationTests.Shared.Consumer.Implementation.SimpleConsumer(); consumer.Run <LiteDbMessageQueueInit, FakeMessage, LiteDbMessageQueueCreation>(new QueueConnection(queueName, connectionInfo.ConnectionString), messageCount, runtime, timeOut, workerCount, enableChaos, x => { }, Helpers.GenerateData, Helpers.Verify, Helpers.VerifyQueueCount); } }
public void Run(int messageCount, int runtime, int timeOut, int readerCount, bool inMemoryDb, int routeCount) { 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; oCreation.Options.EnableRoute = true; var result = oCreation.CreateQueue(); Assert.True(result.Success, result.ErrorMessage); var routeTest = new RouteTestsShared(); routeTest.RunTest <SqLiteMessageQueueInit, FakeMessageA>(queueName, connectionInfo.ConnectionString, true, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, GenerateRoutes(routeCount), runtime, timeOut, readerCount, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(12), oCreation.Scope, "second(*%3)"); 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 readerCount, int routeCount, bool enableChaos, IntegrationConnectionInfo.ConnectionTypes connectionType) { using (var connectionInfo = new IntegrationConnectionInfo(connectionType)) { var queueName = GenerateQueueName.Create(); var consumer = new DotNetWorkQueue.IntegrationTests.Shared.Route.Implementation.RouteMultiTests(); consumer.Run <LiteDbMessageQueueInit, LiteDbMessageQueueCreation>(new QueueConnection(queueName, connectionInfo.ConnectionString), messageCount, runtime, timeOut, readerCount, routeCount, enableChaos, x => { Helpers.SetOptions(x, false, false, true, true); }, Helpers.GenerateData, Helpers.Verify, Helpers.VerifyQueueCount); } using (var connectionInfo = new IntegrationConnectionInfo(connectionType)) { var queueName = GenerateQueueName.Create(); var logProvider = LoggerShared.Create(queueName, GetType().Name); using (var queueCreator = new QueueCreationContainer <LiteDbMessageQueueInit>( serviceRegister => serviceRegister.Register(() => logProvider, LifeStyles.Singleton))) { var queueConnection = new DotNetWorkQueue.Configuration.QueueConnection(queueName, connectionInfo.ConnectionString); ICreationScope scope = null; var oCreation = queueCreator.GetQueueCreation <LiteDbMessageQueueCreation>(queueConnection); try { oCreation.Options.EnableStatusTable = true; oCreation.Options.EnableRoute = true; var result = oCreation.CreateQueue(); Assert.True(result.Success, result.ErrorMessage); scope = oCreation.Scope; var routeTest = new RouteMultiTestsShared(); routeTest.RunTest <LiteDbMessageQueueInit, FakeMessageA>(queueConnection, true, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, GenerateRoutes(routeCount, 1), GenerateRoutes(routeCount, routeCount + 1), runtime, timeOut, readerCount, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(12), oCreation.Scope, "second(*%3)", enableChaos); new VerifyQueueRecordCount(queueName, connectionInfo.ConnectionString, oCreation.Options, scope) .Verify(0, false, false); } finally { oCreation?.RemoveQueue(); oCreation?.Dispose(); scope?.Dispose(); } } } }
public void Run(int messageCount, int timeOut, int workerCount, int readerCount, int queueSize) { using (var connectionInfo = new IntegrationConnectionInfo()) { var queueName = GenerateQueueName.Create(); var consumer = new DotNetWorkQueue.IntegrationTests.Shared.ConsumerAsync.Implementation.ConsumerAsyncErrorTable(); consumer.Run <MemoryMessageQueueInit, FakeMessage, MessageQueueCreation>(new QueueConnection(queueName, connectionInfo.ConnectionString), messageCount, timeOut, workerCount, readerCount, queueSize, false, x => { }, Helpers.GenerateData, Helpers.Verify, Helpers.VerifyQueueCount, ValidateErrorCounts); } }
public void Run( bool dynamic) { using (var connectionInfo = new IntegrationConnectionInfo()) { var queueName = GenerateQueueName.Create(); var consumer = new DotNetWorkQueue.IntegrationTests.Shared.JobScheduler.Implementation.JobSchedulerTests(); consumer.Run <MemoryMessageQueueInit, JobQueueCreation, MessageQueueCreation>(new QueueConnection(queueName, connectionInfo.ConnectionString), false, dynamic, Helpers.Verify, Helpers.SetError); } }
public void Run(int messageCount, int runtime, int timeOut, int readerCount, bool inMemoryDb, int routeCount, bool enableChaos) { using (var connectionInfo = new IntegrationConnectionInfo(inMemoryDb)) { var queueName = GenerateQueueName.Create(); var producer = new DotNetWorkQueue.IntegrationTests.Shared.Route.Implementation.RouteTests(); producer.Run <SqLiteMessageQueueInit, SqLiteMessageQueueCreation>(new QueueConnection(queueName, connectionInfo.ConnectionString), messageCount, runtime, timeOut, readerCount, routeCount, enableChaos, x => Helpers.SetOptions(x, false, true, false, false, true, true, false, true), Helpers.GenerateData, Helpers.Verify, Helpers.VerifyQueueCount); } }
public void Run(int messageCount, int timeOut, int workerCount, bool inMemoryDb, bool enableChaos) { using (var connectionInfo = new IntegrationConnectionInfo(inMemoryDb)) { var queueName = GenerateQueueName.Create(); var consumer = new DotNetWorkQueue.IntegrationTests.Shared.Consumer.Implementation.ConsumerErrorTable(); consumer.Run <SqLiteMessageQueueInit, FakeMessage, SqLiteMessageQueueCreation>(new QueueConnection(queueName, connectionInfo.ConnectionString), messageCount, timeOut, workerCount, enableChaos, x => Helpers.SetOptions(x, true, true, false, false, true, true, false), Helpers.GenerateData, Helpers.Verify, Helpers.VerifyQueueCount, ValidateErrorCounts); } }
public void Run( int producerCount, bool inMemoryDb) { using (var connectionInfo = new IntegrationConnectionInfo(inMemoryDb)) { var queueName = GenerateQueueName.Create(); var consumer = new DotNetWorkQueue.IntegrationTests.Shared.JobScheduler.Implementation.JobSchedulerMultipleTests(); consumer.Run <SqLiteMessageQueueInit, SqliteJobQueueCreation, SqLiteMessageQueueCreation>( new QueueConnection(queueName, connectionInfo.ConnectionString), producerCount); } }
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 producerCount) { using (var connectionInfo = new IntegrationConnectionInfo(IntegrationConnectionInfo.ConnectionTypes.Direct)) { var queueName = GenerateQueueName.Create(); var consumer = new DotNetWorkQueue.IntegrationTests.Shared.JobScheduler.Implementation.JobSchedulerMultipleTests(); consumer.Run <LiteDbMessageQueueInit, LiteDbJobQueueCreation, LiteDbMessageQueueCreation>(new QueueConnection(queueName, connectionInfo.ConnectionString), producerCount); } }
public void Run( int messageCount, bool interceptors) { using (var connectionInfo = new IntegrationConnectionInfo()) { var queueName = GenerateQueueName.Create(); var producer = new DotNetWorkQueue.IntegrationTests.Shared.Producer.Implementation.SimpleProducer(); producer.Run <MemoryMessageQueueInit, FakeMessage, MessageQueueCreation>(new QueueConnection(queueName, connectionInfo.ConnectionString), messageCount, interceptors, false, false, x => { }, Helpers.GenerateData, Helpers.Verify); } }
public void Run( bool dynamic) { using (var connectionInfo = new IntegrationConnectionInfo()) { var queueName = GenerateQueueName.Create(); using (var queueCreator = new QueueCreationContainer <MemoryMessageQueueInit>()) { using ( var oCreation = queueCreator.GetQueueCreation <MessageQueueCreation>(queueName, connectionInfo.ConnectionString) ) { using (var queueContainer = new QueueContainer <MemoryMessageQueueInit>(x => { })) { try { var tests = new JobSchedulerTestsShared(); if (!dynamic) { tests.RunEnqueueTestCompiled <MemoryMessageQueueInit, JobQueueCreation>( queueName, connectionInfo.ConnectionString, true, Helpers.Verify, Helpers.SetError, queueContainer.CreateTimeSync(connectionInfo.ConnectionString), oCreation.Scope, LoggerShared.Create(queueName, GetType().Name)); } #if NETFULL else { tests.RunEnqueueTestDynamic <MemoryMessageQueueInit, JobQueueCreation>( queueName, connectionInfo.ConnectionString, true, Helpers.Verify, Helpers.SetError, queueContainer.CreateTimeSync(connectionInfo.ConnectionString), oCreation.Scope, LoggerShared.Create(queueName, GetType().Name)); } #endif } finally { oCreation.RemoveQueue(); } } } } } }
public void Run(int messageCount, int timeOut, int workerCount, int readerCount, int queueSize, bool enableChaos, IntegrationConnectionInfo.ConnectionTypes connectionType) { using (var connectionInfo = new IntegrationConnectionInfo(connectionType)) { var queueName = GenerateQueueName.Create(); var consumer = new DotNetWorkQueue.IntegrationTests.Shared.ConsumerAsync.Implementation.ConsumerAsyncErrorTable(); consumer.Run <LiteDbMessageQueueInit, FakeMessage, LiteDbMessageQueueCreation>(new QueueConnection(queueName, connectionInfo.ConnectionString), messageCount, timeOut, workerCount, readerCount, queueSize, enableChaos, x => Helpers.SetOptions(x, true, false, true), Helpers.GenerateData, Helpers.Verify, Helpers.VerifyQueueCount, ValidateErrorCounts); } }
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. ConsumerMethodHeartbeat(); consumer.Run <LiteDbMessageQueueInit, LiteDbMessageQueueCreation>(new QueueConnection(queueName, connectionInfo.ConnectionString), messageCount, runtime, timeOut, workerCount, linqMethodTypes, enableChaos, x => Helpers.SetOptions(x, true, false, true), Helpers.GenerateData, Helpers.Verify, Helpers.VerifyQueueCount); } }
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 void Run(int messageCount, int runtime, 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. ConsumerMethodAsyncRollBack(); consumer.Run <SqLiteMessageQueueInit, SqLiteMessageQueueCreation>(new QueueConnection(queueName, connectionInfo.ConnectionString), messageCount, runtime, timeOut, workerCount, readerCount, queueSize, linqMethodTypes, enableChaos, x => Helpers.SetOptions(x, true, true, false, false, true, true, false), Helpers.GenerateData, Helpers.Verify, Helpers.VerifyQueueCount); } }
public void Run( int messageCount, bool interceptors, bool enableStatusTable, bool enableChaos, IntegrationConnectionInfo.ConnectionTypes connectionType) { using (var connectionInfo = new IntegrationConnectionInfo(connectionType)) { var queueName = GenerateQueueName.Create(); var producer = new DotNetWorkQueue.IntegrationTests.Shared.Producer.Implementation.SimpleProducer(); producer.Run <LiteDbMessageQueueInit, FakeMessage, LiteDbMessageQueueCreation>(new QueueConnection(queueName, connectionInfo.ConnectionString), messageCount, interceptors, enableChaos, false, x => x.Options.EnableStatusTable = enableStatusTable, Helpers.GenerateData, Helpers.Verify); } }
public void Run(bool inMemoryDb) { 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); 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(); } } } } }
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), TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(35)); 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 runtime, int timeOut, int workerCount, int readerCount, int queueSize, int messageType, bool inMemoryDb) { SchedulerContainer schedulerContainer = null; if (Factory == null) { Factory = CreateFactory(workerCount, queueSize, out schedulerContainer); } 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); if (messageType == 1) { var producer = new ProducerAsyncShared(); producer.RunTest<SqLiteMessageQueueInit, FakeMessage>(queueName, connectionInfo.ConnectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false).Wait(timeOut / 2 * 1000); var consumer = new ConsumerAsyncShared<FakeMessage> { Factory = Factory }; consumer.RunConsumer<SqLiteMessageQueueInit>(queueName, connectionInfo.ConnectionString, false, logProvider, runtime, messageCount, timeOut, readerCount, TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(35)); } else if (messageType == 2) { var producer = new ProducerAsyncShared(); producer.RunTest<SqLiteMessageQueueInit, FakeMessageA>(queueName, connectionInfo.ConnectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false).Wait(timeOut / 2 * 1000); var consumer = new ConsumerAsyncShared<FakeMessageA> { Factory = Factory }; consumer.RunConsumer<SqLiteMessageQueueInit>(queueName, connectionInfo.ConnectionString, false, logProvider, runtime, messageCount, timeOut, readerCount, TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(35)); } else if (messageType == 3) { var producer = new ProducerAsyncShared(); producer.RunTest<SqLiteMessageQueueInit, FakeMessageB>(queueName, connectionInfo.ConnectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false).Wait(timeOut / 2 * 1000); var consumer = new ConsumerAsyncShared<FakeMessageB> { Factory = Factory }; consumer.RunConsumer<SqLiteMessageQueueInit>(queueName, connectionInfo.ConnectionString, false, logProvider, runtime, messageCount, timeOut, readerCount, TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(35)); } new VerifyQueueRecordCount(queueName, connectionInfo.ConnectionString, oCreation.Options).Verify(0, false, false); } } finally { schedulerContainer?.Dispose(); 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) { 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 ProducerShared(); producer.RunTest<SqLiteMessageQueueInit, FakeMessage>(queueName, connectionInfo.ConnectionString, interceptors, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, true); } } finally { using ( var oCreation = queueCreator.GetQueueCreation<SqLiteMessageQueueCreation>(queueName, connectionInfo.ConnectionString) ) { oCreation.RemoveQueue(); } } } } }