Package com.proofpoint.node

Examples of com.proofpoint.node.NodeInfo


    @Test
    public void testTestingNodePresentEnvironment()
    {
        Injector injector = Guice.createInjector(new TestingNodeModule(Optional.of("foo")), new ApplicationNameModule("test-application"));
        NodeInfo nodeInfo = injector.getInstance(NodeInfo.class);

        assertNotNull(nodeInfo);
        assertEquals(nodeInfo.getEnvironment(), "foo");
    }
View Full Code Here


    @Test
    public void testTestingNodeAbsentEnvironment()
    {
        Injector injector = Guice.createInjector(new TestingNodeModule(Optional.<String>absent()), new ApplicationNameModule("test-application"));
        NodeInfo nodeInfo = injector.getInstance(NodeInfo.class);

        assertNotNull(nodeInfo);
        assertTrue(nodeInfo.getEnvironment().matches("test\\d+"));
    }
View Full Code Here

    }

    @Test
    public void testBuilderNodeInfo()
    {
        NodeInfo nodeInfo = new NodeInfo("test-application", new NodeConfig().setEnvironment("test").setPool("pool"));

        ServiceDescriptor expected = new ServiceDescriptor(
                UUID.fromString("12345678-1234-1234-1234-123456789012"),
                nodeInfo.getNodeId(),
                "type",
                nodeInfo.getPool(),
                "location",
                ServiceState.STOPPED,
                ImmutableMap.of("a", "apple", "b", "banana"));

        ServiceDescriptor actual = serviceDescriptor(expected.getType())
View Full Code Here

    public void testNullServiceInventory()
            throws Exception
    {
        HttpServiceBalancerImpl balancer = mock(HttpServiceBalancerImpl.class);
        ServiceInventory serviceInventory = new ServiceInventory(new ServiceInventoryConfig(),
                new DiscoveryClientConfig(), new NodeInfo("test"),
                JsonCodec.jsonCodec(ServiceDescriptorsRepresentation.class),
                balancer);

        assertEquals(Iterables.size(serviceInventory.getServiceDescriptors()), 0);
        serviceInventory.updateServiceInventory();
View Full Code Here

            throws Exception
    {
        HttpServiceBalancerImpl balancer = mock(HttpServiceBalancerImpl.class);
        ServiceInventory serviceInventory = new ServiceInventory(new ServiceInventoryConfig(),
                new DiscoveryClientConfig().setDiscoveryServiceURI(URI.create("https://example.com:4111")),
                new NodeInfo("test"),
                JsonCodec.jsonCodec(ServiceDescriptorsRepresentation.class),
                balancer);

        ArgumentCaptor<Set> captor = ArgumentCaptor.forClass(Set.class);
        verify(balancer).updateHttpUris(captor.capture());
View Full Code Here

        ServiceInventoryConfig serviceInventoryConfig = new ServiceInventoryConfig()
                .setServiceInventoryUri(Resources.getResource("service-inventory.json").toURI());

        ServiceInventory serviceInventory = new ServiceInventory(serviceInventoryConfig,
                new DiscoveryClientConfig().setDiscoveryServiceURI(URI.create("http://example.com:4111")),
                new NodeInfo("test"),
                JsonCodec.jsonCodec(ServiceDescriptorsRepresentation.class),
                balancer);

        assertEquals(Iterables.size(serviceInventory.getServiceDescriptors()), 3);
        assertEquals(Iterables.size(serviceInventory.getServiceDescriptors("discovery")), 2);
View Full Code Here

    @BeforeMethod
    protected void setUp()
            throws Exception
    {
        executor = new ScheduledThreadPoolExecutor(10, daemonThreadsNamed("Discovery-%s"));
        nodeInfo = new NodeInfo("environment");
        discoveryClient = new InMemoryDiscoveryClient(nodeInfo);
        serviceSelector = new CachingServiceSelector("apple",
                new ServiceSelectorConfig().setPool("pool"),
                nodeInfo);
        updater = new ServiceDescriptorsUpdater(serviceSelector, "apple",
View Full Code Here

    @Test
    public void testDefaultToNodePool()
    {
        serviceSelector = new CachingServiceSelector("apple",
                new ServiceSelectorConfig(),
                new NodeInfo("test-application", new NodeConfig().setEnvironment("environment").setPool("nodepool")));
        assertEquals(serviceSelector.getType(), "apple");
        assertEquals(serviceSelector.getPool(), "nodepool");
    }
View Full Code Here

        discoveryClient.addDiscoveredService(DIFFERENT_TYPE);
        discoveryClient.addDiscoveredService(DIFFERENT_POOL);

        updater = new ServiceDescriptorsUpdater(serviceSelector, "apple",
                new ServiceSelectorConfig(),
                new NodeInfo("test-application", new NodeConfig().setEnvironment("environment").setPool("pool")),
                discoveryClient,
                executor);
        updater.start();

        Thread.sleep(100);
View Full Code Here

    @BeforeMethod
    protected void setUp()
            throws Exception
    {
        executor = new ScheduledThreadPoolExecutor(10, daemonThreadsNamed("Discovery-%s"));
        nodeInfo = new NodeInfo("environment");
        discoveryClient = new InMemoryDiscoveryClient(nodeInfo);
        httpServiceBalancer = mock(HttpServiceBalancerImpl.class);
        updater = new ServiceDescriptorsUpdater(new HttpServiceBalancerListenerAdapter(httpServiceBalancer),
                "apple",
                new ServiceSelectorConfig().setPool("pool"),
View Full Code Here

TOP

Related Classes of com.proofpoint.node.NodeInfo

Copyright © 2018 www.massapicom. 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.