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 <TTransportInit, TJobQueueCreator, TTransportCreate>(
     QueueConnection queueConnection,
     int producerCount)
     where TTransportInit : ITransportInit, new()
     where TJobQueueCreator : class, IJobQueueCreation
     where TTransportCreate : class, IQueueCreation
 {
     using (var queueCreator =
                new QueueCreationContainer <TTransportInit>())
     {
         var oCreation = queueCreator.GetQueueCreation <TTransportCreate>(queueConnection);
         var scope     = oCreation.Scope;
         using (var queueContainer =
                    new QueueContainer <TTransportInit>(x => x.RegisterNonScopedSingleton(scope)))
         {
             try
             {
                 var tests = new JobSchedulerTestsShared();
                 tests.RunTestMultipleProducers <TTransportInit, TJobQueueCreator>(
                     queueConnection, true, producerCount,
                     queueContainer.CreateTimeSync(queueConnection.Connection),
                     LoggerShared.Create(queueConnection.Queue, GetType().Name), scope);
             }
             finally
             {
                 oCreation.RemoveQueue();
                 oCreation.Dispose();
                 scope?.Dispose();
             }
         }
     }
 }
        public void Run(
            bool interceptors,
            int producerCount)
        {
            var queueName = GenerateQueueName.Create();
            using (var queueContainer = new QueueContainer<SqlServerMessageQueueInit>(x => {
            }))
            {
                try
                {
                    var tests = new JobSchedulerTestsShared();
                    tests.RunTestMultipleProducers<SqlServerMessageQueueInit, SqlServerJobQueueCreation>(queueName,
                        ConnectionInfo.ConnectionString, interceptors, producerCount, queueContainer.CreateTimeSync(ConnectionInfo.ConnectionString));
                }
                finally
                {

                    using (var queueCreator =
                        new QueueCreationContainer<SqlServerMessageQueueInit>())
                    {
                        using (
                            var oCreation =
                                queueCreator.GetQueueCreation<SqlServerMessageQueueCreation>(queueName,
                                    ConnectionInfo.ConnectionString)
                            )
                        {
                            oCreation.RemoveQueue();
                        }
                    }
                }
            }
        }
Ejemplo n.º 4
0
        public void Run(
            bool interceptors,
            int producerCount)
        {
            var queueName = GenerateQueueName.Create();

            using (var queueContainer = new QueueContainer <SqlServerMessageQueueInit>(x => {
            }))
            {
                try
                {
                    var tests = new JobSchedulerTestsShared();
                    tests.RunTestMultipleProducers <SqlServerMessageQueueInit, SqlServerJobQueueCreation>(queueName,
                                                                                                          ConnectionInfo.ConnectionString, interceptors, producerCount, queueContainer.CreateTimeSync(ConnectionInfo.ConnectionString), LoggerShared.Create(queueName, GetType().Name));
                }
                finally
                {
                    using (var queueCreator =
                               new QueueCreationContainer <SqlServerMessageQueueInit>())
                    {
                        using (
                            var oCreation =
                                queueCreator.GetQueueCreation <SqlServerMessageQueueCreation>(queueName,
                                                                                              ConnectionInfo.ConnectionString)
                            )
                        {
                            oCreation.RemoveQueue();
                        }
                    }
                }
            }
        }
        public void RunMultiple(
           bool interceptors,
           int producerCount,
           ConnectionInfoTypes type)
        {
            var queueName = GenerateQueueName.Create();
            var connectionString = new ConnectionInfo(type).ConnectionString;
            using (var queueContainer = new QueueContainer<RedisQueueInit>(x => {
            }))
            {
                try
                {
                    var tests = new JobSchedulerTestsShared();
                    tests.RunTestMultipleProducers<RedisQueueInit, RedisJobQueueCreation>(queueName,
                        connectionString, interceptors, producerCount, queueContainer.CreateTimeSync(connectionString));
                }
                finally
                {

                    using (var queueCreator =
                        new QueueCreationContainer<RedisQueueInit>())
                    {
                        using (
                            var oCreation =
                                queueCreator.GetQueueCreation<RedisQueueCreation>(queueName,
                                    connectionString)
                            )
                        {
                            oCreation.RemoveQueue();
                        }
                    }
                }
            }
        }
Ejemplo n.º 6
0
        public void RunMultiple(
            int producerCount,
            ConnectionInfoTypes type)
        {
            var queueName        = GenerateQueueName.Create();
            var connectionString = new ConnectionInfo(type).ConnectionString;

            using (var queueContainer = new QueueContainer <RedisQueueInit>(x => {
            }))
            {
                try
                {
                    var tests = new JobSchedulerTestsShared();
                    tests.RunTestMultipleProducers <RedisQueueInit, RedisJobQueueCreation>(queueName,
                                                                                           connectionString, true, producerCount, queueContainer.CreateTimeSync(connectionString), LoggerShared.Create(queueName, GetType().Name));
                }
                finally
                {
                    using (var queueCreator =
                               new QueueCreationContainer <RedisQueueInit>())
                    {
                        using (
                            var oCreation =
                                queueCreator.GetQueueCreation <RedisQueueCreation>(queueName,
                                                                                   connectionString)
                            )
                        {
                            oCreation.RemoveQueue();
                        }
                    }
                }
            }
        }
Ejemplo n.º 7
0
        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();
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 8
0
 public void Run <TTransportInit, TJobQueueCreator, TTransportCreate>(
     QueueConnection queueConnection,
     bool interceptors,
     bool dynamic,
     Action <QueueConnection, long, ICreationScope> verify,
     Action <QueueConnection, ICreationScope> setErrorFlag)
     where TTransportInit : ITransportInit, new()
     where TJobQueueCreator : class, IJobQueueCreation
     where TTransportCreate : class, IQueueCreation
 {
     using (var trace = SharedSetup.CreateTrace("jobscheduler"))
     {
         using (var queueCreator =
                    new QueueCreationContainer <TTransportInit>((x) => x.RegisterNonScopedSingleton(trace.Source)))
         {
             var            oCreation = queueCreator.GetQueueCreation <TTransportCreate>(queueConnection);
             ICreationScope scope     = oCreation.Scope;
             using (var queueContainer =
                        new QueueContainer <TTransportInit>(x => x.RegisterNonScopedSingleton(scope).RegisterNonScopedSingleton(trace.Source)))
             {
                 try
                 {
                     var tests = new JobSchedulerTestsShared();
                     if (!dynamic)
                     {
                         tests.RunEnqueueTestCompiled <TTransportInit, TJobQueueCreator>(
                             queueConnection, interceptors,
                             verify, setErrorFlag,
                             queueContainer.CreateTimeSync(queueConnection.Connection),
                             oCreation.Scope, LoggerShared.Create(queueConnection.Queue, GetType().Name));
                     }
                     else
                     {
                         tests.RunEnqueueTestDynamic <TTransportInit, TJobQueueCreator>(
                             queueConnection, interceptors,
                             verify, setErrorFlag,
                             queueContainer.CreateTimeSync(queueConnection.Connection),
                             oCreation.Scope, LoggerShared.Create(queueConnection.Queue, GetType().Name));
                     }
                 }
                 finally
                 {
                     oCreation.RemoveQueue();
                     oCreation.Dispose();
                     scope?.Dispose();
                 }
             }
         }
     }
 }
Ejemplo n.º 9
0
        public void Run(
            bool interceptors,
            bool dynamic,
            bool inMemoryDb)
        {
            using (var queueContainer = new QueueContainer<SqLiteMessageQueueInit>(x => {}))
            {
                using (var connectionInfo = new IntegrationConnectionInfo(inMemoryDb))
                {
                    var queueName = GenerateQueueName.Create();
                    try
                    {
                        var tests = new JobSchedulerTestsShared();
                        if (!dynamic)
                        {
                            tests.RunEnqueueTestCompiled<SqLiteMessageQueueInit, SqliteJobQueueCreation>(queueName,
                                connectionInfo.ConnectionString, interceptors,
                                Helpers.Verify, Helpers.SetError, queueContainer.CreateTimeSync(connectionInfo.ConnectionString));
                        }
                        else
                        {
                            tests.RunEnqueueTestDynamic<SqLiteMessageQueueInit, SqliteJobQueueCreation>(queueName,
                                connectionInfo.ConnectionString, interceptors,
                                Helpers.Verify, Helpers.SetError, queueContainer.CreateTimeSync(connectionInfo.ConnectionString));
                        }
                    }
                    finally
                    {

                        using (var queueCreator =
                            new QueueCreationContainer<SqLiteMessageQueueInit>())
                        {
                            using (
                                var oCreation =
                                    queueCreator.GetQueueCreation<SqLiteMessageQueueCreation>(queueName,
                                        connectionInfo.ConnectionString)
                                )
                            {
                                oCreation.RemoveQueue();
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 10
0
        public void Run(
            bool interceptors,
            bool dynamic,
            ConnectionInfoTypes type)
        {

            var queueName = GenerateQueueName.Create();
            var connectionString = new ConnectionInfo(type).ConnectionString;
            using (var queueContainer = new QueueContainer<RedisQueueInit>(x => { }))
            {
                try
                {
                    var tests = new JobSchedulerTestsShared();
                    if (!dynamic)
                    {
                        tests.RunEnqueueTestCompiled<RedisQueueInit, RedisJobQueueCreation>(queueName,
                            connectionString, interceptors,
                            Helpers.Verify, Helpers.SetError, queueContainer.CreateTimeSync(connectionString));
                    }
                    else
                    {
                        tests.RunEnqueueTestDynamic<RedisQueueInit, RedisJobQueueCreation>(queueName,
                            connectionString, interceptors,
                            Helpers.Verify, Helpers.SetError, queueContainer.CreateTimeSync(connectionString));
                    }
                }
                finally
                {

                    using (var queueCreator =
                        new QueueCreationContainer<RedisQueueInit>())
                    {
                        using (
                            var oCreation =
                                queueCreator.GetQueueCreation<RedisQueueCreation>(queueName,
                                    connectionString)
                            )
                        {
                            oCreation.RemoveQueue();
                        }
                    }
                }
            }
        }
Ejemplo n.º 11
0
        public void Run(
            bool dynamic,
            ConnectionInfoTypes type)
        {
            var queueName        = GenerateQueueName.Create();
            var connectionString = new ConnectionInfo(type).ConnectionString;

            using (var queueContainer = new QueueContainer <RedisQueueInit>(x => { }))
            {
                try
                {
                    var tests = new JobSchedulerTestsShared();
                    if (!dynamic)
                    {
                        tests.RunEnqueueTestCompiled <RedisQueueInit, RedisJobQueueCreation>(queueName,
                                                                                             connectionString, true,
                                                                                             Helpers.Verify, Helpers.SetError, queueContainer.CreateTimeSync(connectionString), null, LoggerShared.Create(queueName, GetType().Name));
                    }
#if NETFULL
                    else
                    {
                        tests.RunEnqueueTestDynamic <RedisQueueInit, RedisJobQueueCreation>(queueName,
                                                                                            connectionString, true,
                                                                                            Helpers.Verify, Helpers.SetError, queueContainer.CreateTimeSync(connectionString), null, LoggerShared.Create(queueName, GetType().Name));
                    }
#endif
                }
                finally
                {
                    using (var queueCreator =
                               new QueueCreationContainer <RedisQueueInit>())
                    {
                        using (
                            var oCreation =
                                queueCreator.GetQueueCreation <RedisQueueCreation>(queueName,
                                                                                   connectionString)
                            )
                        {
                            oCreation.RemoveQueue();
                        }
                    }
                }
            }
        }
Ejemplo n.º 12
0
        public void Run(
            bool interceptors,
            bool dynamic)
        {
            var queueName = GenerateQueueName.Create();

            using (var queueContainer = new QueueContainer <SqlServerMessageQueueInit>(x => {
            }))
            {
                try
                {
                    var tests = new JobSchedulerTestsShared();
                    if (!dynamic)
                    {
                        tests.RunEnqueueTestCompiled <SqlServerMessageQueueInit, SqlServerJobQueueCreation>(queueName,
                                                                                                            ConnectionInfo.ConnectionString, interceptors,
                                                                                                            Helpers.Verify, Helpers.SetError, queueContainer.CreateTimeSync(ConnectionInfo.ConnectionString), null, LoggerShared.Create(queueName, GetType().Name));
                    }
#if NETFULL
                    else
                    {
                        tests.RunEnqueueTestDynamic <SqlServerMessageQueueInit, SqlServerJobQueueCreation>(queueName,
                                                                                                           ConnectionInfo.ConnectionString, interceptors,
                                                                                                           Helpers.Verify, Helpers.SetError, queueContainer.CreateTimeSync(ConnectionInfo.ConnectionString), null, LoggerShared.Create(queueName, GetType().Name));
                    }
#endif
                }
                finally
                {
                    using (var queueCreator =
                               new QueueCreationContainer <SqlServerMessageQueueInit>())
                    {
                        using (
                            var oCreation =
                                queueCreator.GetQueueCreation <SqlServerMessageQueueCreation>(queueName,
                                                                                              ConnectionInfo.ConnectionString)
                            )
                        {
                            oCreation.RemoveQueue();
                        }
                    }
                }
            }
        }
Ejemplo n.º 13
0
 public void Run(
     bool inMemoryDb)
 {
     using (var connectionInfo = new IntegrationConnectionInfo(inMemoryDb))
     {
         var queueName = GenerateQueueName.Create();
         using (var queueCreator =
                    new QueueCreationContainer <SqLiteMessageQueueInit>())
         {
             using (
                 var oCreation =
                     queueCreator.GetQueueCreation <SqLiteMessageQueueCreation>(queueName,
                                                                                connectionInfo.ConnectionString)
                 )
             {
                 using (var queueContainer = new QueueContainer <SqLiteMessageQueueInit>(x => { }))
                 {
                     try
                     {
                         var tests = new JobSchedulerTestsShared();
                         tests.RunEnqueueTestCompiled <SqLiteMessageQueueInit, SqliteJobQueueCreation>(
                             queueName,
                             connectionInfo.ConnectionString, true,
                             Helpers.Verify, Helpers.SetError,
                             queueContainer.CreateTimeSync(connectionInfo.ConnectionString),
                             oCreation.Scope, LoggerShared.Create(queueName, GetType().Name));
                     }
                     finally
                     {
                         oCreation.RemoveQueue();
                     }
                 }
             }
         }
     }
 }