Beispiel #1
0
        public async Task OneTimeSetUp()
        {
            _eventIdProvider = new InMemoryEventIdProvider();
            _serializer      = new JsonNetSerializer();
            _eventSerializer = new EventSerializer(_serializer);
            _eventCache      = new InMemoryEventCache(_eventIdProvider, _eventSerializer);

            var brokerConfiguration = new BrokerageServiceConfiguration()
            {
                HeartbeatEndpoint       = HeartbeatEndpoint,
                StateOfTheWorldEndpoint = StateOfTheWorldEndpoint,
                ToSubscribersEndpoint   = ToSubscribersEndpoint,
                ToPublisherEndpoint     = ToPublishersEndpoint
            };

            _broker = new BrokerageService(brokerConfiguration, LoggerForTests <BrokerageService> .Default(), _eventCache, _serializer);

            await _broker.Run();

            JsonConvert.DefaultSettings = () =>
            {
                var settings = new JsonSerializerSettings
                {
                    Formatting       = Formatting.Indented,
                    TypeNameHandling = TypeNameHandling.Objects,
                    ContractResolver = new CamelCasePropertyNamesContractResolver()
                };

                return(settings);
            };

            await Task.Delay(1000);
        }
        public void OneTimeSetUp()
        {
            _eventIdProvider = new InMemoryEventIdProvider();
            _serializer      = new JsonNetSerializer();
            _eventSerializer = new EventSerializer(_serializer);
            _eventCache      = new InMemoryEventCache(_eventIdProvider, _eventSerializer);

            JsonConvert.DefaultSettings = () =>
            {
                var settings = new JsonSerializerSettings
                {
                    Formatting       = Formatting.Indented,
                    TypeNameHandling = TypeNameHandling.Objects,
                    ContractResolver = new CamelCasePropertyNamesContractResolver()
                };

                return(settings);
            };
        }
Beispiel #3
0
        public async Task OneTimeSetUp()
        {
            _serializer      = new JsonNetSerializer();
            _eventSerializer = new EventSerializer(_serializer);
            _eventIdProvider = new InMemoryEventIdProvider();
            _eventCache      = new InMemoryEventCache(_eventIdProvider, _eventSerializer);
            _cancel          = new CancellationTokenSource();

            JsonConvert.DefaultSettings = () =>
            {
                var settings = new JsonSerializerSettings
                {
                    Formatting       = Formatting.Indented,
                    TypeNameHandling = TypeNameHandling.Objects,
                    ContractResolver = new CamelCasePropertyNamesContractResolver()
                };

                return(settings);
            };

            SetupFakeBroker(_cancel.Token, _eventCache);

            await Task.Delay(1000);
        }
Beispiel #4
0
        public void SetUp()
        {
            _eventIdProvider = new InMemoryEventIdProvider();
            _serializer      = new JsonNetSerializer();
            _eventSerializer = new EventSerializer(_serializer);
            _eventCache      = new InMemoryEventCache(_eventIdProvider, _eventSerializer);

            JsonConvert.DefaultSettings = () =>
            {
                var settings = new JsonSerializerSettings
                {
                    Formatting       = Formatting.Indented,
                    TypeNameHandling = TypeNameHandling.Objects,
                    ContractResolver = new CamelCasePropertyNamesContractResolver()
                };

                return(settings);
            };

            var brokerConfiguration = new BrokerageServiceConfiguration()
            {
                HeartbeatEndpoint       = HeartbeatEndpoint,
                StateOfTheWorldEndpoint = StateOfTheWorldEndpoint,
                ToSubscribersEndpoint   = ToSubscribersEndpoint,
                ToPublisherEndpoint     = ToPublishersEndpoint
            };

            var router = GetBrokerageService(brokerConfiguration);

            var marketConfigurationFxConnect = new MarketConfiguration("FxConnect")
            {
                IsAutoGen         = false,
                BrokerEndpoint    = ToPublishersEndpoint,
                HeartbeatEndpoint = HeartbeatEndpoint,
                HeartbeatDelay    = TimeSpan.FromSeconds(5),
                HeartbeatTimeout  = TimeSpan.FromSeconds(5)
            };

            _market1 = GetMarket(marketConfigurationFxConnect);

            router.Run().Wait();

            Task.Delay(1000).Wait();

            _market1.Run().Wait();

            var cacheConfiguration = new DynamicCacheConfiguration(ToSubscribersEndpoint, StateOfTheWorldEndpoint, HeartbeatEndpoint)
            {
                Subject          = string.Empty,
                HeartbeatDelay   = TimeSpan.FromSeconds(5),
                HeartbeatTimeout = TimeSpan.FromSeconds(5),
                ZmqHighWatermark = 1000,
                UseEventBatching = UseEventBatch,
                DoStoreEvents    = false
            };

            _cache = GetCache(cacheConfiguration);

            _cache.Run().Wait();

            WaitForCachesToCaughtUp(_cache).Wait();
        }