Package org.apache.qpid.server.model

Examples of org.apache.qpid.server.model.Session


        int unacknowledgedMessages = 2;
        long localTransactionBegins = 1;
        boolean transactional = true;
        boolean blocked = false;

        Session mockSession = createMockedSession(channelId, unacknowledgedMessages, localTransactionBegins, blocked);

        when(_mockConnection.getSessions()).thenReturn(Collections.singletonList(mockSession));

        TabularData table = _connectionMBean.channels();
        assertEquals("Unexpected number of rows in table", 1, table.size());
View Full Code Here


        int unacknowledgedMessages = 2;
        long localTransactionBegins = 0;
        boolean transactional  = false;
        boolean blocked = false;

        Session mockSession = createMockedSession(channelId, unacknowledgedMessages, localTransactionBegins, blocked);

        when(_mockConnection.getSessions()).thenReturn(Collections.singletonList(mockSession));

        TabularData table = _connectionMBean.channels();
        assertEquals("Unexpected number of rows in table", 1, table.size());
View Full Code Here

        int unacknowledgedMessages = 2;
        long localTransactionBegins = 0;
        boolean transactional  = false;
        boolean blocked = true;

        Session mockSession = createMockedSession(channelId, unacknowledgedMessages, localTransactionBegins, blocked);

        when(_mockConnection.getSessions()).thenReturn(Collections.singletonList(mockSession));

        TabularData table = _connectionMBean.channels();
        assertEquals("Unexpected number of rows in table", 1, table.size());
View Full Code Here

        assertEquals("Unexpected flow blocked", flowBlocked, row.get(ManagedConnection.FLOW_BLOCKED));
    }

    private Session createMockedSession(int channelId, int unacknowledgedMessages, long localTransactionBegins, boolean blocked)
    {
        Session mockSession = mock(Session.class);
        Statistics mockSessionStatistics = mock(Statistics.class);
        when(mockSessionStatistics.getStatistic(Session.LOCAL_TRANSACTION_BEGINS)).thenReturn(localTransactionBegins);
        when(mockSessionStatistics.getStatistic(Session.UNACKNOWLEDGED_MESSAGES)).thenReturn(unacknowledgedMessages);

        when(mockSession.getStatistics()).thenReturn(mockSessionStatistics);
        when(mockSession.getAttribute(Session.CHANNEL_ID)).thenReturn(channelId);
        when(mockSession.getAttribute(Session.PRODUCER_FLOW_BLOCKED)).thenReturn(blocked);
        return mockSession;
    }
View Full Code Here

        int unacknowledgedMessages = 2;
        long localTransactionBegins = 1;
        boolean transactional = true;
        boolean blocked = false;

        Session mockSession = createMockedSession(channelId, unacknowledgedMessages, localTransactionBegins, blocked);

        when(_mockConnection.getSessions()).thenReturn(Collections.singletonList(mockSession));

        TabularData table = _connectionMBean.channels();
        assertEquals("Unexpected number of rows in table", 1, table.size());
View Full Code Here

        int unacknowledgedMessages = 2;
        long localTransactionBegins = 0;
        boolean transactional  = false;
        boolean blocked = false;

        Session mockSession = createMockedSession(channelId, unacknowledgedMessages, localTransactionBegins, blocked);

        when(_mockConnection.getSessions()).thenReturn(Collections.singletonList(mockSession));

        TabularData table = _connectionMBean.channels();
        assertEquals("Unexpected number of rows in table", 1, table.size());
View Full Code Here

        int unacknowledgedMessages = 2;
        long localTransactionBegins = 0;
        boolean transactional  = false;
        boolean blocked = true;

        Session mockSession = createMockedSession(channelId, unacknowledgedMessages, localTransactionBegins, blocked);

        when(_mockConnection.getSessions()).thenReturn(Collections.singletonList(mockSession));

        TabularData table = _connectionMBean.channels();
        assertEquals("Unexpected number of rows in table", 1, table.size());
View Full Code Here

        assertEquals("Unexpected flow blocked", flowBlocked, row.get(ManagedConnection.FLOW_BLOCKED));
    }

    private Session createMockedSession(int channelId, int unacknowledgedMessages, long localTransactionBegins, boolean blocked)
    {
        Session mockSession = mock(Session.class);
        when(mockSession.getLocalTransactionBegins()).thenReturn(localTransactionBegins);
        when(mockSession.getUnacknowledgedMessages()).thenReturn((long)unacknowledgedMessages);

        when(mockSession.getStatistics()).thenReturn(Collections.emptyMap());
        when(mockSession.getAttribute(Session.CHANNEL_ID)).thenReturn(channelId);
        when(mockSession.getAttribute(Session.PRODUCER_FLOW_BLOCKED)).thenReturn(blocked);
        return mockSession;
    }
View Full Code Here

TOP

Related Classes of org.apache.qpid.server.model.Session

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.