예제 #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);
        }
예제 #2
0
 private static void ShouldReturnImmediately(ApplicationsStorage storage, string environment, string application, ServiceTopology topology)
 {
     storage.Get(environment, application).ServiceTopology.Should().BeEquivalentTo(topology);
 }
예제 #3
0
        private static void ShouldReturn(ApplicationsStorage storage, string environment, string application, ServiceTopology topology)
        {
            Action assertion = () => { ShouldReturnImmediately(storage, environment, application, topology); };

            assertion.ShouldPassIn(DefaultTimeout);
        }