예제 #1
0
        public void Setup()
        {
            if (_endpointFactoryConfigurator != null)
            {
                ConfigurationResult result = ConfigurationResultImpl.CompileResults(_endpointFactoryConfigurator.Validate());

                try
                {
                    EndpointFactory = _endpointFactoryConfigurator.CreateEndpointFactory();
                    _endpointCache  = new EndpointCache(EndpointFactory);
                    EndpointCache   = new EndpointCacheProxy(_endpointCache);
                }
                catch (Exception ex)
                {
                    throw new ConfigurationException(result, "An exception was thrown during endpoint cache creation", ex);
                }
            }

            ServiceBusFactory.ConfigureDefaultSettings(x =>
            {
                x.SetEndpointCache(EndpointCache);
                x.SetConcurrentConsumerLimit(4);
                x.SetReceiveTimeout(TimeSpan.FromMilliseconds(50));
                x.EnableAutoStart();
                x.DisablePerformanceCounters();
            });

            EstablishContext();
        }
        public void ActivityTestFixtureFixtureTeardown()
        {
            foreach (ActivityTestContext activityTestContext in ActivityTestContexts.Values)
            {
                activityTestContext.Dispose();
            }

            LocalBus.Dispose();

            if (_cancellationTokenSource != null)
            {
                _cancellationTokenSource.Dispose();
            }
            if (_timer != null)
            {
                _timer.Dispose();
            }

            _endpointCache.Clear();

            if (EndpointCache != null)
            {
                EndpointCache.Dispose();
                EndpointCache = null;
            }

            ServiceBusFactory.ConfigureDefaultSettings(x => { x.SetEndpointCache(null); });
        }
예제 #3
0
        public void Setup()
        {
            if (EndpointFactoryConfigurator != null)
            {
                IConfigurationResult result = ConfigurationResult.CompileResults(EndpointFactoryConfigurator.Validate());

                try
                {
                    EndpointFactory             = EndpointFactoryConfigurator.CreateEndpointFactory();
                    EndpointFactoryConfigurator = null;

                    _endpointCache = new EndpointCache(EndpointFactory);
                    EndpointCache  = new EndpointCacheProxy(_endpointCache);
                }
                catch (Exception ex)
                {
                    throw new ConfigurationException(result, "An exception was thrown during endpoint cache creation", ex);
                }
            }

            ServiceBusFactory.ConfigureDefaultSettings(x =>
            {
                x.SetEndpointCache(EndpointCache);
                x.SetConcurrentConsumerLimit(4);
                x.SetReceiveTimeout(150.Milliseconds());
                x.EnableAutoStart();
            });
        }
예제 #4
0
        public void FixtureTeardown()
        {
            if (EndpointCache != null)
            {
                EndpointCache.Dispose();
                EndpointCache = null;
            }

            ServiceBusFactory.ConfigureDefaultSettings(x => x.SetEndpointCache(null));
        }
예제 #5
0
        public void FixtureTeardown()
        {
            TeardownBuses();

            if (EndpointCache != null)
            {
                _endpointCache.Dispose();
                _endpointCache = null;
                EndpointCache  = null;
            }

            ServiceBusFactory.ConfigureDefaultSettings(x => { x.SetEndpointCache(null); });
        }
예제 #6
0
        public void ActivityTextFixtureSetup()
        {
            if (_endpointFactoryConfigurator != null)
            {
                ConfigurationResult result =
                    ConfigurationResultImpl.CompileResults(_endpointFactoryConfigurator.Validate());

                try
                {
                    EndpointFactory = _endpointFactoryConfigurator.CreateEndpointFactory();

                    _endpointCache = new EndpointCache(EndpointFactory);

                    EndpointCache = new EndpointCacheProxy(_endpointCache);
                }
                catch (Exception ex)
                {
                    throw new ConfigurationException(result, "An exception was thrown during endpoint cache creation",
                                                     ex);
                }
            }

            ServiceBusFactory.ConfigureDefaultSettings(x =>
            {
                x.SetEndpointCache(EndpointCache);
                x.SetConcurrentConsumerLimit(4);
                x.SetReceiveTimeout(50.Milliseconds());
                x.EnableAutoStart();
            });

            LocalUri = new Uri(BaseUri, "local");

            AddCommandContext <DispatchMessageConsumer, DispatchMessage>(() =>
            {
                var agent = new MessageDispatchAgent(LocalBus);

                return(new DispatchMessageConsumer(agent));
            });

            SetupCommands();

            LocalBus = CreateServiceBus(ConfigureLocalBus);

            DispatchEndpoint = LocalBus.GetEndpoint(GetActivityContext <DispatchMessage>().ExecuteUri);
        }
        public void ActivityTextFixtureSetup()
        {
            if (_endpointFactoryConfigurator != null)
            {
                ConfigurationResult result =
                    ConfigurationResultImpl.CompileResults(_endpointFactoryConfigurator.Validate());

                try
                {
                    EndpointFactory = _endpointFactoryConfigurator.CreateEndpointFactory();

                    _endpointCache = new EndpointCache(EndpointFactory);

                    EndpointCache = new EndpointCacheProxy(_endpointCache);
                }
                catch (Exception ex)
                {
                    throw new ConfigurationException(result, "An exception was thrown during endpoint cache creation",
                                                     ex);
                }
            }

            ServiceBusFactory.ConfigureDefaultSettings(x =>
            {
                x.SetEndpointCache(EndpointCache);
                x.SetConcurrentConsumerLimit(4);
                x.SetReceiveTimeout(50.Milliseconds());
                x.EnableAutoStart();
            });

            LocalUri = new Uri(BaseUri, "local");

            SetupActivities();

            LocalBus = CreateServiceBus(ConfigureLocalBus);
        }
예제 #8
0
        protected EndpointTestScenarioImpl(IEndpointFactory endpointFactory)
        {
            _received  = new ReceivedMessageListImpl();
            _sent      = new SentMessageListImpl();
            _skipped   = new ReceivedMessageListImpl();
            _published = new PublishedMessageListImpl();

            _endpoints = new Dictionary <Uri, EndpointTestDecorator>();

            EndpointFactory = new EndpointFactoryTestDecorator(endpointFactory, this);

            _endpointCache = new EndpointCache(EndpointFactory);

            EndpointCache = new EndpointCacheProxy(_endpointCache);

            ServiceBusFactory.ConfigureDefaultSettings(x =>
            {
                x.SetEndpointCache(EndpointCache);
                x.SetConcurrentConsumerLimit(4);
                x.SetConcurrentReceiverLimit(1);
                x.SetReceiveTimeout(50.Milliseconds());
                x.EnableAutoStart();
            });
        }
예제 #9
0
        protected virtual void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }
            if (disposing)
            {
                _sent.Dispose();
                _received.Dispose();

                _endpointCache.Clear();

                if (EndpointCache != null)
                {
                    EndpointCache.Dispose();
                    EndpointCache = null;
                }

                ServiceBusFactory.ConfigureDefaultSettings(x => x.SetEndpointCache(null));
            }

            _disposed = true;
        }