Example #1
0
        public ServiceLocator(
            [NotNull] IZooKeeperClient zooKeeperClient,
            [CanBeNull] ServiceLocatorSettings settings = null,
            [CanBeNull] ILog log = null)
        {
            this.zooKeeperClient = zooKeeperClient;
            this.settings        = settings ?? new ServiceLocatorSettings();
            this.log             = (log ?? LogProvider.Get()).ForContext <ServiceLocator>();

            pathHelper = new ServiceDiscoveryPathHelper(this.settings.ZooKeeperNodesPrefix, this.settings.ZooKeeperNodesPathEscaper);

            eventsQueue         = new ActionsQueue(this.log);
            environmentsStorage = new EnvironmentsStorage(zooKeeperClient, pathHelper, eventsQueue, log);
            applicationsStorage = new ApplicationsStorage(zooKeeperClient, pathHelper, eventsQueue, log);
        }
Example #2
0
 private static void ShouldReturnImmediately(ApplicationsStorage storage, string environment, string application, ServiceTopology topology)
 {
     storage.Get(environment, application).ServiceTopology.Should().BeEquivalentTo(topology);
 }
Example #3
0
        private static void ShouldReturn(ApplicationsStorage storage, string environment, string application, ServiceTopology topology)
        {
            Action assertion = () => { ShouldReturnImmediately(storage, environment, application, topology); };

            assertion.ShouldPassIn(DefaultTimeout);
        }