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();
                            }
                        }
                    }
                }
            }
        }
Exemple #2
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();
                 }
             }
         }
     }
 }
        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();
                            }
                        }
                    }
                }
            }
        }
        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();
                        }
                    }
                }
            }
        }
Exemple #5
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();
                        }
                    }
                }
            }
        }
        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();
                        }
                    }
                }
            }
        }