Package org.apache.ace.agent

Examples of org.apache.ace.agent.ConfigurationHandler


    }

    @SuppressWarnings("deprecation")
    @Test
    public void testExcludeEvent() throws Exception {
        ConfigurationHandler configurationHandler = m_agentContext.getHandler(ConfigurationHandler.class);
        configureAgent(configurationHandler, AgentConstants.CONFIG_LOGGING_EXCLUDE_EVENTS, "1001,1002");

        FrameworkEvent event = new FrameworkEvent(32, new Object());

        FeedbackHandler feedbackHandler = m_agentContext.getHandler(FeedbackHandler.class);
View Full Code Here


        assertFeedbackChannelsNotPresent(feedbackHandler, NON_EXISTING_CHANNEL);
    }

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

        configureAgent(configurationHandler, CONFIG_FEEDBACK_CHANNELS, AUDITLOG);

        FeedbackHandler feedbackHandler = m_agentContextImpl.getHandler(FeedbackHandler.class);
View Full Code Here

        assertFeedbackChannelsPresent(feedbackHandler, AUDITLOG);
    }

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

        configureAgent(configurationHandler, CONFIG_FEEDBACK_CHANNELS, AUDITLOG);

        FeedbackHandler feedbackHandler = m_agentContextImpl.getHandler(FeedbackHandler.class);
View Full Code Here

        assertFeedbackChannelsPresent(feedbackHandler, AUDITLOG, CUSTOMCHANNEL);
    }

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

        configureAgent(configurationHandler, CONFIG_FEEDBACK_CHANNELS, AUDITLOG_AND_CUSTOMCHANNEL);

        FeedbackHandler feedbackHandler = m_agentContextImpl.getHandler(FeedbackHandler.class);
View Full Code Here

        verifyTestMocks();
    }

    @Test
    public void testAvailableIdentification() throws Exception {
        ConfigurationHandler configurationHandler = m_agentContext.getHandler(ConfigurationHandler.class);
        reset(configurationHandler);
        expect(configurationHandler.get(eq(AgentConstants.CONFIG_IDENTIFICATION_AGENTID), anyObject(String.class)))
            .andReturn("qqq").once();
        replay(configurationHandler);
        IdentificationHandler identificationHandler = m_agentContext.getHandler(IdentificationHandler.class);
        assertEquals(identificationHandler.getAgentId(), "qqq");
    }
View Full Code Here

        assertEquals(identificationHandler.getAgentId(), "qqq");
    }

    @Test
    public void testUpdatedIdentification() throws Exception {
        ConfigurationHandler configurationHandler = m_agentContext.getHandler(ConfigurationHandler.class);
        reset(configurationHandler);
        expect(configurationHandler.get(eq(AgentConstants.CONFIG_IDENTIFICATION_AGENTID), anyObject(String.class)))
            .andReturn("qqq").once();
        expect(configurationHandler.get(eq(AgentConstants.CONFIG_IDENTIFICATION_AGENTID), anyObject(String.class)))
            .andReturn("yyy").once();
        replay(configurationHandler);
        IdentificationHandler identificationHandler = m_agentContext.getHandler(IdentificationHandler.class);
        assertEquals(identificationHandler.getAgentId(), "qqq");
        assertEquals(identificationHandler.getAgentId(), "yyy");
View Full Code Here

        assertEquals(identificationHandler.getAgentId(), "yyy");
    }

    @Test
    public void testNoIdentification() throws Exception {
        ConfigurationHandler configurationHandler = m_agentContext.getHandler(ConfigurationHandler.class);
        reset(configurationHandler);
        expect(configurationHandler.get(eq(AgentConstants.CONFIG_IDENTIFICATION_AGENTID), anyObject(String.class)))
            .andReturn(null).once();
        replay(configurationHandler);
        IdentificationHandler identificationHandler = m_agentContext.getHandler(IdentificationHandler.class);
        assertNull(identificationHandler.getAgentId());
    }
View Full Code Here

        assertNull(identificationHandler.getAgentId());
    }

    @Test
    public void testEmptyIdentification() throws Exception {
        ConfigurationHandler configurationHandler = m_agentContext.getHandler(ConfigurationHandler.class);
        reset(configurationHandler);
        expect(configurationHandler.get(eq(AgentConstants.CONFIG_IDENTIFICATION_AGENTID), anyObject(String.class)))
            .andReturn(null).once();
        replay(configurationHandler);
        IdentificationHandler identificationHandler = m_agentContext.getHandler(IdentificationHandler.class);
        assertNull(identificationHandler.getAgentId());
    }
View Full Code Here

    @Test
    public void testBasicAuthFORBIDDEN() throws Exception {
        Map<String, String> props = new HashMap<String, String>();
        props.put(AgentConstants.CONFIG_CONNECTION_AUTHTYPE, Types.NONE.name());

        ConfigurationHandler configurationHandler = m_agentContext.getHandler(ConfigurationHandler.class);
        configurationHandler.putAll(props);

        ConnectionHandler connectionHandler = m_agentContext.getHandler(ConnectionHandler.class);
        HttpURLConnection connection = (HttpURLConnection) connectionHandler.getConnection(m_basicAuthURL);

        assertEquals(connection.getResponseCode(), HttpServletResponse.SC_FORBIDDEN);
View Full Code Here

        Map<String, String> props = new HashMap<String, String>();
        props.put(AgentConstants.CONFIG_CONNECTION_AUTHTYPE, Types.BASIC.name());
        props.put(AgentConstants.CONFIG_CONNECTION_USERNAME, USERNAME);
        props.put(AgentConstants.CONFIG_CONNECTION_PASSWORD, PASSWORD);

        ConfigurationHandler configurationHandler = m_agentContext.getHandler(ConfigurationHandler.class);
        configurationHandler.putAll(props);

        ConnectionHandler connectionHandler = m_agentContext.getHandler(ConnectionHandler.class);

        HttpURLConnection connection = (HttpURLConnection) connectionHandler.getConnection(m_basicAuthURL);
        assertEquals(connection.getResponseCode(), HttpServletResponse.SC_OK);
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.