Package org.apache.qpid.server.protocol

Examples of org.apache.qpid.server.protocol.AMQConnectionModel


        while (!_registry.isEmpty())
        {
            Iterator<AMQConnectionModel> itr = _registry.iterator();
            while(itr.hasNext())
            {
                AMQConnectionModel connection = itr.next();
                try
                {
                    connection.close(AMQConstant.CONNECTION_FORCED, replyText);
                }
                catch (Exception e)
                {
                    _logger.warn("Exception closing connection " + connection.getConnectionId() + " from " + connection.getRemoteAddressString(), e);
                }
                finally
                {
                    itr.remove();
                }
View Full Code Here


        String virtualHostName = getName();

        VirtualHost<?, ?, ?> virtualHost = createVirtualHost(virtualHostName);
        assertEquals("Unexpected state", State.ACTIVE, virtualHost.getState());

        AMQConnectionModel connection = createMockProtocolConnection(virtualHost);

        assertEquals("Unexpected number of connections before connection registered", 0, virtualHost.getChildren(Connection.class).size());

        ((RegistryChangeListener)virtualHost).connectionRegistered(connection);
View Full Code Here

        String virtualHostName = getName();

        VirtualHost<?, ?, ?> virtualHost = createVirtualHost(virtualHostName);
        assertEquals("Unexpected state", State.ACTIVE, virtualHost.getState());

        AMQConnectionModel connection = createMockProtocolConnection(virtualHost);

        assertEquals("Unexpected number of connections before connection registered", 0, virtualHost.getChildren(Connection.class).size());

        ((RegistryChangeListener)virtualHost).connectionRegistered(connection);
View Full Code Here

        return host;
    }

    private AMQConnectionModel createMockProtocolConnection(final VirtualHost<?, ?, ?> virtualHost)
    {
        final AMQConnectionModel connection = mock(AMQConnectionModel.class);
        when(connection.getVirtualHost()).thenReturn(virtualHost);
        when(connection.getRemoteAddressString()).thenReturn("peer:1234");
        return connection;
    }
View Full Code Here

        final Iterator<AMQConnectionModel> connections =
                        ((ServerConnection)conn).getVirtualHost().getConnectionRegistry().getConnections().iterator();
        while(connections.hasNext())
        {
            final AMQConnectionModel amqConnectionModel = (AMQConnectionModel) connections.next();
            if (userId.equals(amqConnectionModel.getUserName()) && !amqConnectionModel.isSessionNameUnique(name))
            {
                return false;
            }
        }
        return true;
View Full Code Here

    public void close()
    {
        _logger.debug("Closing connection registry :" + _registry.size() + " connections.");
        while (!_registry.isEmpty())
        {
            AMQConnectionModel connection = _registry.get(0);
            closeConnection(connection, AMQConstant.CONNECTION_FORCED, "Broker is shutting down");
        }
    }
View Full Code Here

        queueArguments.put(Queue.NAME, queueName);
        queueArguments.put(Queue.DURABLE, durable);
        queueArguments.put(Queue.LIFETIME_POLICY, LifetimePolicy.PERMANENT);
        queueArguments.put(Queue.EXCLUSIVE, exclusive ? ExclusivityPolicy.CONTAINER : ExclusivityPolicy.NONE);
        AMQSessionModel sessionModel = mock(AMQSessionModel.class);
        AMQConnectionModel connectionModel = mock(AMQConnectionModel.class);
        when(sessionModel.getConnectionModel()).thenReturn(connectionModel);
        when(connectionModel.getRemoteContainerName()).thenReturn(queueOwner);
        SessionPrincipal principal = new SessionPrincipal(sessionModel);
        AMQQueue<?> queue = Subject.doAs(new Subject(true,
                                                     Collections.singleton(principal),
                                                     Collections.emptySet(),
                                                     Collections.emptySet()),
View Full Code Here

        String virtualHostName = getName();

        VirtualHost<?, ?, ?> virtualHost = createVirtualHost(virtualHostName);
        assertEquals("Unexpected state", State.ACTIVE, virtualHost.getState());

        AMQConnectionModel connection = createMockProtocolConnection(virtualHost);

        assertEquals("Unexpected number of connections before connection registered", 0, virtualHost.getChildren(Connection.class).size());

        ((RegistryChangeListener)virtualHost).connectionRegistered(connection);
View Full Code Here

        String virtualHostName = getName();

        VirtualHost<?, ?, ?> virtualHost = createVirtualHost(virtualHostName);
        assertEquals("Unexpected state", State.ACTIVE, virtualHost.getState());

        AMQConnectionModel connection = createMockProtocolConnection(virtualHost);

        assertEquals("Unexpected number of connections before connection registered", 0, virtualHost.getChildren(Connection.class).size());

        ((RegistryChangeListener)virtualHost).connectionRegistered(connection);
View Full Code Here

        return host;
    }

    private AMQConnectionModel createMockProtocolConnection(final VirtualHost<?, ?, ?> virtualHost)
    {
        final AMQConnectionModel connection = mock(AMQConnectionModel.class);
        when(connection.getVirtualHost()).thenReturn(virtualHost);
        when(connection.getRemoteAddressString()).thenReturn("peer:1234");
        return connection;
    }
View Full Code Here

TOP

Related Classes of org.apache.qpid.server.protocol.AMQConnectionModel

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.