Examples of InMemoryDiscoveryClient


Examples of io.airlift.discovery.client.testing.InMemoryDiscoveryClient

                        discoveryBinder(binder).bindHttpSelector(serviceType("apple"));
                    }
                }
        );

        InMemoryDiscoveryClient discoveryClient = injector.getInstance(InMemoryDiscoveryClient.class);
        discoveryClient.announce(ImmutableSet.of(serviceAnnouncement("apple").addProperty("http", "fake://server-http").build()));

        HttpServiceSelector selector = injector.getInstance(Key.get(HttpServiceSelector.class, serviceType("apple")));
        assertEquals(getOnlyElement(selector.selectHttpService()), URI.create("fake://server-http"));

        ServiceSelectorManager manager = injector.getInstance(ServiceSelectorManager.class);
View Full Code Here

Examples of io.airlift.discovery.client.testing.InMemoryDiscoveryClient

                        discoveryBinder(binder).bindHttpSelector("apple");
                    }
                }
        );

        InMemoryDiscoveryClient discoveryClient = injector.getInstance(InMemoryDiscoveryClient.class);
        discoveryClient.announce(ImmutableSet.of(serviceAnnouncement("apple").addProperty("https", "fake://server-https").build()));

        HttpServiceSelector selector = injector.getInstance(Key.get(HttpServiceSelector.class, serviceType("apple")));
        assertEquals(getOnlyElement(selector.selectHttpService()), URI.create("fake://server-https"));
    }
View Full Code Here

Examples of io.airlift.discovery.client.testing.InMemoryDiscoveryClient

                        discoveryBinder(binder).bindHttpSelector("apple");
                    }
                }
        );

        InMemoryDiscoveryClient discoveryClient = injector.getInstance(InMemoryDiscoveryClient.class);
        discoveryClient.announce(ImmutableSet.of(serviceAnnouncement("apple").addProperty("http", "fake://server-http").build(),
                serviceAnnouncement("apple").addProperty("https", "fake://server-https").build()));

        HttpServiceSelector selector = injector.getInstance(Key.get(HttpServiceSelector.class, serviceType("apple")));
        assertEquals(selector.selectHttpService(), ImmutableList.of(URI.create("fake://server-https"), URI.create("fake://server-http")));
    }
View Full Code Here

Examples of io.airlift.discovery.client.testing.InMemoryDiscoveryClient

                        discoveryBinder(binder).bindHttpSelector("apple");
                    }
                }
        );

        InMemoryDiscoveryClient discoveryClient = injector.getInstance(InMemoryDiscoveryClient.class);
        discoveryClient.announce(ImmutableSet.of(serviceAnnouncement("apple").addProperty("foo", "fake://server-https").build()));

        HttpServiceSelector selector = injector.getInstance(Key.get(HttpServiceSelector.class, serviceType("apple")));
        assertEquals(selector.selectHttpService(), ImmutableList.of());
    }
View Full Code Here

Examples of io.airlift.discovery.client.testing.InMemoryDiscoveryClient

                        discoveryBinder(binder).bindHttpSelector("apple");
                    }
                }
        );

        InMemoryDiscoveryClient discoveryClient = injector.getInstance(InMemoryDiscoveryClient.class);
        discoveryClient.announce(ImmutableSet.of(serviceAnnouncement("apple").addProperty("http", ":::INVALID:::").build()));
        discoveryClient.announce(ImmutableSet.of(serviceAnnouncement("apple").addProperty("https", ":::INVALID:::").build()));

        HttpServiceSelector selector = injector.getInstance(Key.get(HttpServiceSelector.class, serviceType("apple")));
        assertEquals(selector.selectHttpService(), ImmutableList.of());
    }
View Full Code Here

Examples of io.airlift.discovery.client.testing.InMemoryDiscoveryClient

    @Test
    public void testBasics()
    {
        CachingServiceSelector serviceSelector = new CachingServiceSelector("type",
                new ServiceSelectorConfig().setPool("pool"),
                new InMemoryDiscoveryClient(nodeInfo),
                executor);

        Assert.assertEquals(serviceSelector.getType(), "type");
        Assert.assertEquals(serviceSelector.getPool(), "pool");
    }
View Full Code Here

Examples of io.airlift.discovery.client.testing.InMemoryDiscoveryClient

    @Test
    public void testNotStartedEmpty()
    {
        CachingServiceSelector serviceSelector = new CachingServiceSelector("type",
                new ServiceSelectorConfig().setPool("pool"),
                new InMemoryDiscoveryClient(nodeInfo),
                executor);

        Assert.assertEquals(serviceSelector.selectAllServices(), ImmutableList.of());
    }
View Full Code Here

Examples of io.airlift.discovery.client.testing.InMemoryDiscoveryClient

    public void testStartedEmpty()
            throws Exception
    {
        CachingServiceSelector serviceSelector = new CachingServiceSelector("type",
                new ServiceSelectorConfig().setPool("pool"),
                new InMemoryDiscoveryClient(nodeInfo),
                executor);

        serviceSelector.start();

        Assert.assertEquals(serviceSelector.selectAllServices(), ImmutableList.of());
View Full Code Here

Examples of io.airlift.discovery.client.testing.InMemoryDiscoveryClient

    }

    @Test
    public void testNotStartedWithServices()
    {
        InMemoryDiscoveryClient discoveryClient = new InMemoryDiscoveryClient(nodeInfo);
        discoveryClient.addDiscoveredService(APPLE_1_SERVICE);
        discoveryClient.addDiscoveredService(APPLE_2_SERVICE);
        discoveryClient.addDiscoveredService(DIFFERENT_TYPE);
        discoveryClient.addDiscoveredService(DIFFERENT_POOL);

        CachingServiceSelector serviceSelector = new CachingServiceSelector("apple",
                new ServiceSelectorConfig().setPool("pool"),
                discoveryClient,
                executor);
View Full Code Here

Examples of io.airlift.discovery.client.testing.InMemoryDiscoveryClient

    @Test
    public void testStartedWithServices()
            throws Exception
    {
        InMemoryDiscoveryClient discoveryClient = new InMemoryDiscoveryClient(nodeInfo);
        discoveryClient.addDiscoveredService(APPLE_1_SERVICE);
        discoveryClient.addDiscoveredService(APPLE_2_SERVICE);
        discoveryClient.addDiscoveredService(DIFFERENT_TYPE);
        discoveryClient.addDiscoveredService(DIFFERENT_POOL);

        CachingServiceSelector serviceSelector = new CachingServiceSelector("apple",
                new ServiceSelectorConfig().setPool("pool"),
                discoveryClient,
                executor);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.