Esempio n. 1
0
        protected override void SetUp()
        {
            MsmqUtil.Delete(InputQueueName);

            _handlerActivator = new BuiltinHandlerActivator();

            _bus = Configure.With(_handlerActivator)
                .Logging(l => l.Console())
                .Transport(t =>
                {
                    t.UseMsmq(InputQueueName)
                        .OnCreated(queue =>
                        {
                            queue.ResetPermissions();

                            var user = new SecurityIdentifier(WellKnownSidType.WorldSid, null)
                                .Translate(typeof(NTAccount))
                                .ToString();

                            queue.SetPermissions(user, MessageQueueAccessRights.FullControl);
                        });
                })
                .Routing(r => r.TypeBased().Map<string>(InputQueueName))
                .Options(o => o.SetNumberOfWorkers(1))
                .Start();

            Using(_bus);
        }
        protected override void DoTearDown()
        {
            disposables.ForEach(d => d.Dispose());

            MsmqUtil.Delete(AzureReceiverInputQueueName);
            MsmqUtil.Delete(MsmqSenderInputQueueName);
        }
Esempio n. 3
0
        protected override void DoTearDown()
        {
            timeoutService.Stop();

            MsmqUtil.Delete(SagaBusInputQueueName);
            MsmqUtil.Delete(ServiceBusInputQueueName);
        }
Esempio n. 4
0
        protected override void DoTearDown()
        {
            CleanUpTrackedDisposables();

            MsmqUtil.Delete(AzureReceiverInputQueueName);
            MsmqUtil.Delete(MsmqSenderInputQueueName);
        }
Esempio n. 5
0
        protected override void DoTearDown()
        {
            Console.WriteLine("Tearing down the service");
            service.Stop();

            MsmqUtil.Delete(DestinationQueueName);
        }
Esempio n. 6
0
 protected override void DoTearDown()
 {
     CleanUpTrackedDisposables();
     MsmqUtil.Delete(InputQueueName);
     MsmqUtil.Delete(ErrorQueueName);
     base.DoTearDown();
 }
Esempio n. 7
0
 static void DeleteQueueIfExists()
 {
     if (MessageQueue.Exists(MsmqUtil.GetPath(QueueName)))
     {
         MsmqUtil.Delete(QueueName);
     }
 }
Esempio n. 8
0
 protected override IDuplexTransport CreateTransport(string inputQueueName)
 {
     RegisterForDisposal(new DisposableAction(() => MsmqUtil.Delete(inputQueueName)));
     RegisterForDisposal(new DisposableAction(() => MsmqUtil.Delete(ErrorQueueName)));
     MsmqUtil.EnsureMessageQueueExists(MsmqUtil.GetPath(ErrorQueueName));
     return(new MsmqMessageQueue(inputQueueName).PurgeInputQueue());
 }
        protected override void DoTearDown()
        {
            stuffToDispose.ForEach(d => d.Dispose());

            MsmqUtil.Delete(SenderQueueName);
            MsmqUtil.Delete(ReceiverQueueName);
            MsmqUtil.Delete(ErrorQueueName);
        }
Esempio n. 10
0
        protected override void DoTearDown()
        {
            CleanUpTrackedDisposables();

            MsmqUtil.Delete(SenderQueueName);
            MsmqUtil.Delete(ReceiverQueueName);
            MsmqUtil.Delete(ErrorQueueName);
        }
        protected override void SetUp()
        {
            MsmqUtil.Delete(_inputQueueName);

            Configure.With(Using(new BuiltinHandlerActivator()))
            .Transport(t => t.UseMsmq(_inputQueueName))
            .Start();
        }
Esempio n. 12
0
        protected override void DoSetUp()
        {
            MsmqUtil.Delete(DestinationQueueName);

            Console.WriteLine("Creating new service");
            service = new InboundService(ListenUri, DestinationQueueName);
            service.Start();
        }
Esempio n. 13
0
        protected override void DoSetUp()
        {
            MsmqUtil.Delete(SenderInputQueueName);
            MsmqUtil.Delete(ReceiverInputQueueName);
            MsmqUtil.Delete(ErrorQueueName);

            MsmqUtil.EnsureMessageQueueExists(MsmqUtil.GetPath(ErrorQueueName));
        }
Esempio n. 14
0
        static void DeleteQueue(string queueName)
        {
            if (!MsmqUtil.QueueExists(queueName))
            {
                return;
            }

            MsmqUtil.Delete(queueName);
        }
Esempio n. 15
0
        protected override void DoTearDown()
        {
            gatewayInDmz.Stop();
            gatewayInside.Stop();

            MsmqUtil.Delete(PriceDeskInputQueue);
            MsmqUtil.Delete(OrderSystemInputQueue);
            MsmqUtil.Delete(GatewayListeningQueue);
        }
        public void CleanUp()
        {
            _disposables.ForEach(d => d.Dispose());
            _disposables.Clear();

            foreach (var queue in _queuesToDelete)
            {
                MsmqUtil.Delete(queue);
            }

            _queuesToDelete.Clear();
        }
        public void TearDown()
        {
            try
            {
                DoTearDown();
            }
            finally
            {
                toDispose.ForEach(b => b.Dispose());
            }

            MsmqUtil.Delete(ErrorQueueName);
        }
        protected override void SetUp()
        {
            MsmqUtil.Delete(_inputQueueName);

            Configure.With(Using(new BuiltinHandlerActivator()))
            .Transport(t => t.UseMsmq(_inputQueueName))
            .Options(opt =>
            {
                opt.Decorate <IMsmqHeaderSerializer>(p => new MangledMessageIngoreSerializer());
            })
            .Serialization(c => c.Register(_ => new StaticMessageDeserializer()))
            .Start();
        }
Esempio n. 19
0
        protected override void SetUp()
        {
            var queueName = TestConfig.QueueName("expressperf");

            MsmqUtil.Delete(queueName);

            _activator = Using(new BuiltinHandlerActivator());

            _bus = Configure.With(_activator)
                   .Logging(l => l.ColoredConsole(LogLevel.Info))
                   .Transport(t => t.UseMsmq(queueName))
                   .Options(o => o.SetMaxParallelism(100))
                   .Start();
        }
Esempio n. 20
0
        protected override void DoTearDown()
        {
            var queuesToDelete = new[]
            {
                InputQueue,
                ErrorQueue,
                AuditQueue
            }.Where(MsmqUtil.QueueExists);

            foreach (var queue in queuesToDelete)
            {
                MsmqUtil.Delete(queue);
            }
        }
Esempio n. 21
0
        public IBus GetBus <TMessage>(string inputQueueAddress, Func <TMessage, Task> handler)
        {
            var queueName = TestConfig.GetName(inputQueueAddress);

            MsmqUtil.Delete(queueName);

            var builtinHandlerActivator = new BuiltinHandlerActivator();

            builtinHandlerActivator.Handle(handler);

            var bus = Configure.With(builtinHandlerActivator)
                      .Transport(t => t.UseMsmq(queueName))
                      .Options(o => o.SetNumberOfWorkers(10))
                      .Start();

            _stuffToDispose.Add(bus);

            return(bus);
        }
Esempio n. 22
0
        protected override void DoSetUp()
        {
            MsmqUtil.Delete(SagaBusInputQueueName);
            MsmqUtil.Delete(ServiceBusInputQueueName);

            // this is the bus hosting the saga
            sagaHandlerActivator = new HandlerActivatorForTesting();
            sagaPersister        = new InMemorySagaPersister();
            sagaBus = CreateBus(SagaBusInputQueueName, sagaHandlerActivator, new InMemorySubscriptionStorage(), sagaPersister, "error").Start(1);

            // this is the "service bus", i.e. just some request/reply-enabled service somewhere
            serviceHandlerActivator = new HandlerActivatorForTesting();
            serviceBus = CreateBus(ServiceBusInputQueueName, serviceHandlerActivator).Start(1);

            // this is just a bus from the outside that can initiate everything
            initiatorBus = CreateBus("test.autocorrelation.initiator", new HandlerActivatorForTesting()).Start(1);

            timeoutService = new TimeoutService(new InMemoryTimeoutStorage());
            timeoutService.Start();
        }
Esempio n. 23
0
        protected override void DoSetUp()
        {
            RebusLoggerFactory.Current = new ConsoleLoggerFactory(false)
            {
                MinLevel = LogLevel.Warn
            };

            MsmqUtil.Delete(PriceDeskInputQueue);
            MsmqUtil.Delete(OrderSystemInputQueue);
            MsmqUtil.Delete(GatewayListeningQueue);

            // this one is in DMZ
            pricedesk = CreateBus(PriceDeskInputQueue, new HandlerActivatorForTesting());

            // and this one is inside
            orderSystemHandlerActivator = new HandlerActivatorForTesting();
            ordersystem = CreateBus(OrderSystemInputQueue, orderSystemHandlerActivator);

            // so we set up a one-way gateway service on each side:
            gatewayInDmz = new GatewayService
            {
                ListenQueue    = GatewayListeningQueue,
                DestinationUri = "http://localhost:18080",
            };
            gatewayInside = new GatewayService
            {
                ListenUri        = "http://+:18080",
                DestinationQueue = OrderSystemInputQueue
            };

            gatewayInDmz.Start();
            gatewayInside.Start();

            pricedesk.Start(1);
            ordersystem.Start(1);
        }
Esempio n. 24
0
        public void CanInjectMessageContext()
        {
            // since the built-in container adapter does not support ctor injection, we can't test this
            if (typeof(TFactory) == typeof(BuiltinContainerAdapterFactory))
            {
                return;
            }

            SomeHandler.Reset();

            factory.Register <IHandleMessages <string>, SomeHandler>();

            try
            {
                using (var bus = Configure.With(adapter)
                                 .Logging(l => l.ColoredConsole(LogLevel.Warn))
                                 .Transport(t => t.UseMsmq("test.containeradapter.input", "error"))
                                 .CreateBus()
                                 .Start())
                {
                    bus.SendLocal("hello there!");

                    var timeout = 5.Seconds();
                    if (!SomeHandler.WaitieThingie.WaitOne(timeout))
                    {
                        Assert.Fail("Did not receive message within {0} timeout", timeout);
                    }

                    SomeHandler.HadContext.ShouldBe(true);
                }
            }
            finally
            {
                MsmqUtil.Delete("test.containeradapter.input");
            }
        }
Esempio n. 25
0
 protected override void DoSetUp()
 {
     MsmqUtil.Delete(SenderInputQueueName);
     MsmqUtil.Delete(ReceiverInputQueueName);
 }
Esempio n. 26
0
 protected override void DoTearDown()
 {
     MsmqUtil.Delete(InputQueueName);
 }
Esempio n. 27
0
 protected override void DoSetUp()
 {
     MsmqUtil.Delete(InputQueueName);
 }
Esempio n. 28
0
 protected override void TearDown()
 {
     MsmqUtil.Delete(_queueName);
     MsmqUtil.Delete(_queueNameTimeoutManager);
 }
Esempio n. 29
0
 protected override void DoTearDown()
 {
     MsmqUtil.Delete(SenderInputQueueName);
     MsmqUtil.Delete(ReceiverInputQueueName);
     MsmqUtil.Delete(ErrorQueueName);
 }