Package org.apache.qpid.management.common.mbeans

Examples of org.apache.qpid.management.common.mbeans.ManagedQueue


        final Object messageGroupKey = "test";
        final Map<String, Object> arguments = Collections.singletonMap(SimpleAMQQueue.QPID_GROUP_HEADER_KEY, messageGroupKey);
        managedBroker.createNewQueue(queueName, null, true, arguments);

        final ManagedQueue managedQueue = _jmxUtils.getManagedQueue(queueName);

        assertNotNull("Manager queue expected to be available", managedQueue);
        assertEquals("Unexpected message group key", messageGroupKey, managedQueue.getMessageGroupKey());
        assertEquals("Unexpected message group sharing", false, managedQueue.isMessageGroupSharedGroups());
    }
View Full Code Here


        final Map<String, Object> arguments = new HashMap<String, Object>(2);
        arguments.put(SimpleAMQQueue.QPID_GROUP_HEADER_KEY, messageGroupKey);
        arguments.put(SimpleAMQQueue.QPID_SHARED_MSG_GROUP, SimpleAMQQueue.SHARED_MSG_GROUP_ARG_VALUE);
        managedBroker.createNewQueue(queueName, null, true, arguments);

        final ManagedQueue managedQueue = _jmxUtils.getManagedQueue(queueName);

        assertNotNull("Manager queue expected to be available", managedQueue);
        assertEquals("Unexpected message group key", messageGroupKey, managedQueue.getMessageGroupKey());
        assertEquals("Unexpected message group sharing", true, managedQueue.isMessageGroupSharedGroups());
    }
View Full Code Here

                    "VirtualHost=\"" + QPID_VHOST_NAME + "\"," +
                    "name=\"" + Utils.getTenantBasedQueueName(messageBoxID) + "\",*");
            Set<ObjectName> set = mBeanServer.queryNames(objectName, null);

            if (set.size() > 0) {
                ManagedQueue managedQueue =
                        MBeanServerInvocationHandler.newProxyInstance(mBeanServer,
                                                                      (ObjectName) set.toArray()[0],
                                                                      ManagedQueue.class, false);
                count = managedQueue.getMessageCount();
            }

            return count;
        } catch (MalformedObjectNameException e) {
            throw new MessageBoxException(e);
View Full Code Here

            fail("Unable to establish JMX connection, test cannot proceed");
        }

        try
        {
            ManagedQueue dursubQueue = jmxUtils.getManagedQueue("clientid" + ":" + SUB_NAME);
            assertEquals("DurableSubscription backing queue should have 1 message on it initially",
                          new Integer(1), dursubQueue.getMessageCount());
           
            // Create a connection and start it
            TopicConnection connection = (TopicConnection) getConnection();
            connection.start();
           
            // Send messages which don't match and do match the selector, checking message count
            TopicSession pubSession = connection.createTopicSession(true, org.apache.qpid.jms.Session.SESSION_TRANSACTED);
            Topic topic = pubSession.createTopic(TOPIC_NAME);
            TopicPublisher publisher = pubSession.createPublisher(topic);
           
            BDBStoreUpgradeTestPreparer.publishMessages(pubSession, publisher, topic, DeliveryMode.PERSISTENT, 1*1024, 1, "false");
            pubSession.commit();
            assertEquals("DurableSubscription backing queue should still have 1 message on it",
                        new Integer(1), dursubQueue.getMessageCount());
           
            BDBStoreUpgradeTestPreparer.publishMessages(pubSession, publisher, topic, DeliveryMode.PERSISTENT, 1*1024, 1, "true");
            pubSession.commit();
            assertEquals("DurableSubscription backing queue should now have 2 messages on it",
                        new Integer(2), dursubQueue.getMessageCount());

            dursubQueue.clearQueue();
            pubSession.close();
        }
        finally
        {
            jmxUtils.close();
View Full Code Here

            fail("Unable to establish JMX connection, test cannot proceed");
        }

        try
        {
            ManagedQueue queue = jmxUtils.getManagedQueue(QUEUE_NAME);
            assertFalse("Queue should not have been marked as Exclusive during upgrade", queue.isExclusive());

            ManagedQueue dursubQueue = jmxUtils.getManagedQueue("clientid" + ":" + SUB_NAME);
            assertTrue("DurableSubscription backing queue should have been marked as Exclusive during upgrade", dursubQueue.isExclusive());
        }
        finally
        {
            jmxUtils.close();
        }
View Full Code Here

     * @throws IOException if there is a problem with the JMX connection
     */
    private void validateQueueViaJMX(String queueName, String owner, boolean durable, boolean autoDelete)
            throws JMException, IOException
    {
        ManagedQueue managedQueue = _jmxUtils.
                getManagedObject(ManagedQueue.class,
                                 _jmxUtils.getQueueObjectName(VIRTUALHOST_NAME,
                                                              queueName));

        assertEquals(queueName, managedQueue.getName());
        assertEquals(String.valueOf(owner), managedQueue.getOwner());
        assertEquals(durable, managedQueue.isDurable());
        assertEquals(autoDelete, managedQueue.isAutoDelete());
    }
View Full Code Here

        producer = producerSession.createProducer(queue);
       
        Thread.sleep(1000);
       
        //Create a JMX MBean proxy for the queue
        ManagedQueue queueMBean = _jmxUtils.getManagedObject(ManagedQueue.class, _jmxUtils.getQueueObjectName("test", queueName));
        assertNotNull(queueMBean);
       
        //check current attribute values are 0 as expected
        assertTrue("Capacity was not the expected value", queueMBean.getCapacity() == 0L);
        assertTrue("FlowResumeCapacity was not the expected value", queueMBean.getFlowResumeCapacity() == 0L);
       
        //set new values that will cause flow control to be active, and the queue to become overfull after 1 message is sent
        queueMBean.setCapacity(250L);
        queueMBean.setFlowResumeCapacity(250L);
        assertTrue("Capacity was not the expected value", queueMBean.getCapacity() == 250L);
        assertTrue("FlowResumeCapacity was not the expected value", queueMBean.getFlowResumeCapacity() == 250L);
        assertFalse("Queue should not be overfull", queueMBean.isFlowOverfull());
       
        // try to send 2 messages (should block after 1)
        _sentMessages.set(0);
        sendMessagesAsync(producer, producerSession, 2, 50L);

        Thread.sleep(2000);

        //check only 1 message was sent, and queue is overfull
        assertEquals("Incorrect number of message sent before blocking", 1, _sentMessages.get());
        assertTrue("Queue should be overfull", queueMBean.isFlowOverfull());
       
        //raise the attribute values, causing the queue to become underfull and allow the second message to be sent.
        queueMBean.setCapacity(300L);
        queueMBean.setFlowResumeCapacity(300L);
       
        Thread.sleep(2000);

        //check second message was sent, and caused the queue to become overfull again
        assertEquals("Second message was not sent after lifting FlowResumeCapacity", 2, _sentMessages.get());
        assertTrue("Queue should be overfull", queueMBean.isFlowOverfull());
       
        //raise capacity above queue depth, check queue remains overfull as FlowResumeCapacity still exceeded
        queueMBean.setCapacity(700L);
        assertTrue("Queue should be overfull", queueMBean.isFlowOverfull());
       
        //receive a message, check queue becomes underfull
       
        consumer = consumerSession.createConsumer(queue);
        consumerConnection.start();
       
        consumer.receive();
       
        //perform a synchronous op on the connection
        ((AMQSession) consumerSession).sync();
       
        assertFalse("Queue should not be overfull", queueMBean.isFlowOverfull());
       
        consumer.receive();
    }
View Full Code Here

        Queue queue = _session.createQueue(getTestQueueName());
        createQueueOnBroker(queue);

        final String queueName = queue.getQueueName();

        final ManagedQueue managedQueue = _jmxUtils.getManagedQueue(queueName);
        assertEquals("Unexpected name", queueName, managedQueue.getName());
        assertEquals("Unexpected queue type", "standard", managedQueue.getQueueType());
    }
View Full Code Here

    {
        Queue tmpQueue = _session.createTemporaryQueue();

        final String queueName = tmpQueue.getQueueName();

        final ManagedQueue managedQueue = _jmxUtils.getManagedQueue(queueName);
        assertNotNull(_connection.getClientID());
        assertEquals("Unexpected owner", _connection.getClientID(), managedQueue.getOwner());
    }
View Full Code Here

        Queue nonExclusiveQueue = _session.createQueue(getTestQueueName());
        createQueueOnBroker(nonExclusiveQueue);

        final String queueName = nonExclusiveQueue.getQueueName();

        final ManagedQueue managedQueue = _jmxUtils.getManagedQueue(queueName);
        assertNull("Unexpected owner", managedQueue.getOwner());
    }
View Full Code Here

TOP

Related Classes of org.apache.qpid.management.common.mbeans.ManagedQueue

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.