Package org.apache.ace.agent

Examples of org.apache.ace.agent.ConfigurationHandler


        clearTestMocks();
    }

    @Test
    public void testAvailableURL() throws Exception {
        ConfigurationHandler configurationHandler = m_agentContext.getHandler(ConfigurationHandler.class);

        configureAgent(configurationHandler, AgentConstants.CONFIG_DISCOVERY_SERVERURLS, m_availableURL.toExternalForm(), AgentConstants.CONFIG_DISCOVERY_CHECKING, "true");

        DiscoveryHandler discoveryHandler = m_agentContext.getHandler(DiscoveryHandler.class);
        assertEquals(discoveryHandler.getServerUrl(), m_availableURL);
View Full Code Here


        assertEquals(discoveryHandler.getServerUrl(), m_availableURL);
    }

    @Test
    public void testUnavailableURL_unavailable() throws Exception {
        ConfigurationHandler configurationHandler = m_agentContext.getHandler(ConfigurationHandler.class);

        configureAgent(configurationHandler, AgentConstants.CONFIG_DISCOVERY_SERVERURLS, m_unavailableURL.toExternalForm(), AgentConstants.CONFIG_DISCOVERY_CHECKING, "true");

        DiscoveryHandler discoveryHandler = m_agentContext.getHandler(DiscoveryHandler.class);
        assertNull(discoveryHandler.getServerUrl());
View Full Code Here

        assertNull(discoveryHandler.getServerUrl());
    }

    @Test
    public void testUnavailableAfterConfigUpdate() throws Exception {
        ConfigurationHandler configurationHandler = m_agentContext.getHandler(ConfigurationHandler.class);

        configureAgent(configurationHandler, AgentConstants.CONFIG_DISCOVERY_SERVERURLS, m_availableURL.toExternalForm(), AgentConstants.CONFIG_DISCOVERY_CHECKING, "true");

        DiscoveryHandler discoveryHandler = m_agentContext.getHandler(DiscoveryHandler.class);
        assertEquals(discoveryHandler.getServerUrl(), m_availableURL);
View Full Code Here

        assertNull(discoveryHandler.getServerUrl());
    }

    @Test
    public void testAvailableAfterConfigUpdate() throws Exception {
        ConfigurationHandler configurationHandler = m_agentContext.getHandler(ConfigurationHandler.class);

        configureAgent(configurationHandler, AgentConstants.CONFIG_DISCOVERY_SERVERURLS, m_unavailableURL.toExternalForm(), AgentConstants.CONFIG_DISCOVERY_CHECKING, "true");

        DiscoveryHandler discoveryHandler = m_agentContext.getHandler(DiscoveryHandler.class);
        assertNull(discoveryHandler.getServerUrl());
View Full Code Here

        assertEquals(discoveryHandler.getServerUrl(), m_availableURL);
    }

    @Test
    public void testAvailableAfterUnavailableURL() throws Exception {
        ConfigurationHandler configurationHandler = m_agentContext.getHandler(ConfigurationHandler.class);

        configureAgent(configurationHandler, AgentConstants.CONFIG_DISCOVERY_SERVERURLS, m_unavailableURL.toExternalForm() + "," + m_availableURL.toExternalForm(), AgentConstants.CONFIG_DISCOVERY_CHECKING, "true");

        DiscoveryHandler discoveryHandler = m_agentContext.getHandler(DiscoveryHandler.class);
        assertEquals(discoveryHandler.getServerUrl(), m_availableURL);
View Full Code Here

        assertEquals(discoveryHandler.getServerUrl(), m_availableURL);
    }

    @Test
    public void testEmptyURLConfig() throws Exception {
        ConfigurationHandler configurationHandler = m_agentContext.getHandler(ConfigurationHandler.class);

        configureAgent(configurationHandler, AgentConstants.CONFIG_DISCOVERY_SERVERURLS, "", AgentConstants.CONFIG_DISCOVERY_CHECKING, "true");

        DiscoveryHandler discoveryHandler = m_agentContext.getHandler(DiscoveryHandler.class);
        assertNull(discoveryHandler.getServerUrl());
View Full Code Here

        assertNull(discoveryHandler.getServerUrl());
    }

    @Test
    public void testBadURLConfig() throws Exception {
        ConfigurationHandler configurationHandler = m_agentContext.getHandler(ConfigurationHandler.class);

        configureAgent(configurationHandler, AgentConstants.CONFIG_DISCOVERY_SERVERURLS, "invalidURL", AgentConstants.CONFIG_DISCOVERY_CHECKING, "true");

        DiscoveryHandler discoveryHandler = m_agentContext.getHandler(DiscoveryHandler.class);
        assertNull(discoveryHandler.getServerUrl());
View Full Code Here

        clearTestMocks();
    }

    @Test
    public void testConfigBooleanProps() throws Exception {
        ConfigurationHandler configurationHandler = new ConfigurationHandlerImpl(m_context);

        resetConfigurationHandler(configurationHandler);

        configurationHandler = m_agentContextImpl.getHandler(ConfigurationHandler.class);

        configureAgent(configurationHandler, "boolean1", "true", "boolean2", "false");

        assertEquals(configurationHandler.getBoolean("boolean1", false), true);
        assertEquals(configurationHandler.getBoolean("boolean2", true), false);

        assertEquals(configurationHandler.getBoolean("booleanX", true), true);
        assertEquals(configurationHandler.getBoolean("booleanY", false), false);
    }
View Full Code Here

        assertEquals(configurationHandler.getBoolean("booleanY", false), false);
    }

    @Test
    public void testConfigClean() throws Exception {
        ConfigurationHandler configurationHandler = new ConfigurationHandlerImpl(m_context);

        resetConfigurationHandler(configurationHandler);

        configurationHandler = m_agentContextImpl.getHandler(ConfigurationHandler.class);

        assertEquals(configurationHandler.get("key1", "default1"), "default1");

        // should be persisted
        configurationHandler = new ConfigurationHandlerImpl(m_context);

        resetConfigurationHandler(configurationHandler);

        configurationHandler = m_agentContextImpl.getHandler(ConfigurationHandler.class);

        assertEquals(configurationHandler.get("key1", "default1"), "default1");
    }
View Full Code Here

        assertEquals(configurationHandler.get("key1", "default1"), "default1");
    }

    @Test
    public void testConfigLongProps() throws Exception {
        ConfigurationHandler configurationHandler = new ConfigurationHandlerImpl(m_context);

        resetConfigurationHandler(configurationHandler);

        configurationHandler = m_agentContextImpl.getHandler(ConfigurationHandler.class);

        configureAgent(configurationHandler, "long1", "42", "long2", "4");

        assertEquals(configurationHandler.getLong("long1", 0l), 42);
        assertEquals(configurationHandler.getLong("long2", 0l), 4l);

        assertEquals(configurationHandler.getLong("longX", 42l), 42l);
    }
View Full Code Here

TOP

Related Classes of org.apache.ace.agent.ConfigurationHandler

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.