예제 #1
0
        public void RunTest <TTransportInit, TMessage>(QueueConnection queueConnection,
                                                       bool addInterceptors,
                                                       long messageCount,
                                                       ILogger logProvider,
                                                       Func <QueueProducerConfiguration, AdditionalMessageData> generateData,
                                                       Action <QueueConnection, QueueProducerConfiguration, long, ICreationScope> verify,
                                                       bool sendViaBatch, bool validateMetricCounts,
                                                       ICreationScope scope, bool enableChaos)
            where TTransportInit : ITransportInit, new()
            where TMessage : class
        {
            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
                                   .CreateProducer
                                   <TMessage>(queueConnection))
                        {
                            RunProducer(queue, queueConnection, messageCount, generateData, verify, sendViaBatch,
                                        scope);
                        }

                        if (validateMetricCounts)
                        {
                            VerifyMetrics.VerifyProducedCount(queueConnection.Queue, metrics.GetCurrentMetrics(),
                                                              messageCount);
                        }
                    }
                }
            }
        }
        public void RunTestCompiled <TTransportInit>(QueueConnection queueConnection,
                                                     bool addInterceptors,
                                                     long messageCount,
                                                     ILogger logProvider,
                                                     Func <QueueProducerConfiguration, AdditionalMessageData> generateData,
                                                     Action <QueueConnection, QueueProducerConfiguration, long, ICreationScope> verify,
                                                     bool sendViaBatch, bool validateMetricCounts, Guid id,
                                                     Func <Guid, int, Expression <Action <IReceivedMessage <MessageExpression>, IWorkerNotification> > >
                                                     generateTestMethod, int runTime, ICreationScope scope, bool enableChaos)
            where TTransportInit : ITransportInit, new()
        {
            using (var trace = SharedSetup.CreateTrace("producer-method"))
            {
                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))
                        {
                            RunProducerCompiled(queue, queueConnection, messageCount, generateData, verify,
                                                sendViaBatch, id,
                                                generateTestMethod, runTime, scope);
                        }

                        if (validateMetricCounts)
                        {
                            VerifyMetrics.VerifyProducedCount(queueConnection.Queue, metrics.GetCurrentMetrics(),
                                                              messageCount);
                        }
                    }
                }
            }
        }
예제 #3
0
        public void RunTest <TTransportInit, TMessage>(string queueName,
                                                       string connectionString,
                                                       bool addInterceptors,
                                                       long messageCount,
                                                       ILogProvider logProvider,
                                                       Func <QueueProducerConfiguration, AdditionalMessageData> generateData,
                                                       Action <string, string, QueueProducerConfiguration, long, ICreationScope> verify,
                                                       bool sendViaBatch, bool validateMetricCounts,
                                                       ICreationScope scope)
            where TTransportInit : ITransportInit, new()
            where TMessage : class
        {
            using (var metrics = new Metrics.Metrics(queueName))
            {
                var addInterceptorProducer = InterceptorAdding.No;
                if (addInterceptors)
                {
                    addInterceptorProducer = InterceptorAdding.Yes;
                }
                using (
                    var creator = SharedSetup.CreateCreator <TTransportInit>(addInterceptorProducer, logProvider, metrics)
                    )
                {
                    //create the queue
                    using (var queue =
                               creator
                               .CreateProducer
                               <TMessage>(queueName, connectionString))
                    {
                        RunProducer(queue, queueName, messageCount, generateData, verify, sendViaBatch, scope);
                    }

                    if (validateMetricCounts)
                    {
                        VerifyMetrics.VerifyProducedCount(queueName, metrics.GetCurrentMetrics(), messageCount);
                    }
                }
            }
        }
예제 #4
0
 public void RunTestDynamic <TTransportInit>(string queueName,
                                             string connectionString,
                                             bool addInterceptors,
                                             long messageCount,
                                             ILogProvider logProvider,
                                             Func <QueueProducerConfiguration, AdditionalMessageData> generateData,
                                             Action <string, string, QueueProducerConfiguration, long, ICreationScope> verify,
                                             bool sendViaBatch, bool validateMetricCounts, Guid id,
                                             Func <Guid, int, int, LinqExpressionToRun> generateTestMethod,
                                             int runTime, ICreationScope scope, bool enableChaos)
     where TTransportInit : ITransportInit, new()
 {
     using (var metrics = new Metrics.Metrics(queueName))
     {
         var addInterceptorProducer = InterceptorAdding.No;
         if (addInterceptors)
         {
             addInterceptorProducer = InterceptorAdding.Yes;
         }
         using (
             var creator = SharedSetup.CreateCreator <TTransportInit>(addInterceptorProducer, logProvider, metrics, false, enableChaos)
             )
         {
             //create the queue
             using (var queue =
                        creator
                        .CreateMethodProducer(queueName, connectionString))
             {
                 RunProducerDynamic(queue, queueName, messageCount, generateData, verify, sendViaBatch, id,
                                    generateTestMethod, runTime, scope);
             }
             if (validateMetricCounts)
             {
                 VerifyMetrics.VerifyProducedCount(queueName, metrics.GetCurrentMetrics(), messageCount);
             }
         }
     }
 }