org.apache.qpid.test.utils
Class JMXTestUtils

java.lang.Object
  extended by org.apache.qpid.test.utils.JMXTestUtils

public class JMXTestUtils
extends Object

JMX access for tests.


Field Summary
(package private)  JMXConnector _jmxc
           
(package private)  MBeanServerConnection _mbsc
           
(package private)  QpidBrokerTestCase _test
           
 
Constructor Summary
JMXTestUtils(QpidBrokerTestCase test, String user, String password)
           
 
Method Summary
 void close()
           
 void createExchange(String virtualHostName, String name, String type, boolean durable)
          Create a non-durable exchange with the requested name
 void createQueue(String virtualHostName, String name, String owner, boolean durable)
          Create a non-durable queue (with no owner) that is named after the creating test.
 void deleteQueue(String virtualHostName, String queueName)
          Unregisters the Queue bindings, removes the subscriptions and unregisters from the managed objects.
 String[] getAvailableLoggerLevels()
          Get list of available logger levels.
 org.apache.qpid.management.common.mbeans.ConfigurationManagement getConfigurationManagement()
           
 ObjectName getExchangeObjectName(String virtualHostName, String exchange)
          Retrive the ObjectName for the given Exchange on a VirtualHost.
 org.apache.qpid.management.common.mbeans.LoggingManagement getLoggingManagement()
           
 org.apache.qpid.management.common.mbeans.ManagedBroker getManagedBroker(String virtualHost)
           
 org.apache.qpid.management.common.mbeans.ManagedExchange getManagedExchange(String exchangeName)
           
<T> T
getManagedObject(Class<T> managedClass, ObjectName objectName)
           
<T> T
getManagedObject(Class<T> managedClass, String queryString)
           
 org.apache.qpid.management.common.mbeans.ManagedQueue getManagedQueue(String queueName)
           
 ObjectName getQueueObjectName(String virtualHostName, String queue)
          Retrive the ObjectName for the given Queue on a Virtualhost.
 String getRuntimeRootLoggerLevel()
          Get root logger level.
 org.apache.qpid.management.common.mbeans.UserManagement getUserManagement()
           
 ObjectName getVirtualHostManagerObjectName(String vhostName)
          Retrive the ObjectName for a Virtualhost.
 void open()
           
 void reloadConfigFile()
          Reload logging config file.
 void setRuntimeLoggerLevel(String logger, String level)
          Sets the logging level.
 void setRuntimeRootLoggerLevel(String level)
          Set root logger level.
 void setUp()
           
 void unregisterExchange(String virtualHostName, String exchange)
          Unregisters all the channels, queuebindings etc and unregisters this exchange from managed objects.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_test

QpidBrokerTestCase _test

_mbsc

MBeanServerConnection _mbsc

_jmxc

JMXConnector _jmxc
Constructor Detail

JMXTestUtils

public JMXTestUtils(QpidBrokerTestCase test,
                    String user,
                    String password)
Method Detail

setUp

public void setUp()
           throws IOException,
                  ConfigurationException,
                  Exception
Throws:
IOException
ConfigurationException
Exception

open

public void open()
          throws Exception
Throws:
Exception

close

public void close()
           throws IOException
Throws:
IOException

createExchange

public void createExchange(String virtualHostName,
                           String name,
                           String type,
                           boolean durable)
                    throws JMException,
                           IOException,
                           MBeanException
Create a non-durable exchange with the requested name

Throws:
JMException - if a exchange with this name already exists
IOException - if there is a problem with the JMX Connection
MBeanException - if there is another problem creating the exchange

createQueue

public void createQueue(String virtualHostName,
                        String name,
                        String owner,
                        boolean durable)
                 throws JMException,
                        MBeanException,
                        IOException
Create a non-durable queue (with no owner) that is named after the creating test.

Throws:
JMException - if a queue with this name already exists
IOException - if there is a problem with the JMX Connection
MBeanException - if there is another problem creating the exchange

unregisterExchange

public void unregisterExchange(String virtualHostName,
                               String exchange)
                        throws IOException,
                               JMException,
                               MBeanException
Unregisters all the channels, queuebindings etc and unregisters this exchange from managed objects.

Throws:
JMException - if an exchange with this name does not exist
IOException - if there is a problem with the JMX Connection
MBeanException - if there is another problem creating the exchange

deleteQueue

public void deleteQueue(String virtualHostName,
                        String queueName)
                 throws IOException,
                        JMException,
                        MBeanException
Unregisters the Queue bindings, removes the subscriptions and unregisters from the managed objects.

Throws:
JMException - if a queue with this name does not exist
IOException - if there is a problem with the JMX Connection
MBeanException - if there is another problem creating the exchange

setRuntimeLoggerLevel

public void setRuntimeLoggerLevel(String logger,
                                  String level)
                           throws IOException,
                                  JMException,
                                  MBeanException
Sets the logging level.

Throws:
JMException
IOException - if there is a problem with the JMX Connection
MBeanException

reloadConfigFile

public void reloadConfigFile()
                      throws IOException,
                             JMException,
                             MBeanException
Reload logging config file.

Throws:
JMException
IOException - if there is a problem with the JMX Connection
MBeanException

getAvailableLoggerLevels

public String[] getAvailableLoggerLevels()
                                  throws IOException,
                                         JMException,
                                         MBeanException
Get list of available logger levels.

Throws:
JMException
IOException - if there is a problem with the JMX Connection
MBeanException

setRuntimeRootLoggerLevel

public void setRuntimeRootLoggerLevel(String level)
                               throws IOException,
                                      JMException,
                                      MBeanException
Set root logger level.

Throws:
JMException
IOException - if there is a problem with the JMX Connection
MBeanException

getRuntimeRootLoggerLevel

public String getRuntimeRootLoggerLevel()
                                 throws IOException,
                                        JMException,
                                        MBeanException
Get root logger level.

Throws:
JMException
IOException - if there is a problem with the JMX Connection
MBeanException

getVirtualHostManagerObjectName

public ObjectName getVirtualHostManagerObjectName(String vhostName)
Retrive the ObjectName for a Virtualhost. This is then used to create a proxy to the ManagedBroker MBean.

Parameters:
virtualHostName - the VirtualHost to retrieve
Returns:
the ObjectName for the VirtualHost

getQueueObjectName

public ObjectName getQueueObjectName(String virtualHostName,
                                     String queue)
Retrive the ObjectName for the given Queue on a Virtualhost. This is then used to create a proxy to the ManagedQueue MBean.

Parameters:
virtualHostName - the VirtualHost the Queue is on
queue - The Queue to retireve
Returns:
the ObjectName for the given queue on the VirtualHost

getExchangeObjectName

public ObjectName getExchangeObjectName(String virtualHostName,
                                        String exchange)
Retrive the ObjectName for the given Exchange on a VirtualHost. This is then used to create a proxy to the ManagedExchange MBean.

Parameters:
virtualHostName - the VirtualHost the Exchange is on
exchange - the Exchange to retireve e.g. 'direct'
Returns:
the ObjectName for the given Exchange on the VirtualHost

getManagedObject

public <T> T getManagedObject(Class<T> managedClass,
                              String queryString)

getManagedObject

public <T> T getManagedObject(Class<T> managedClass,
                              ObjectName objectName)

getManagedBroker

public org.apache.qpid.management.common.mbeans.ManagedBroker getManagedBroker(String virtualHost)

getManagedExchange

public org.apache.qpid.management.common.mbeans.ManagedExchange getManagedExchange(String exchangeName)

getManagedQueue

public org.apache.qpid.management.common.mbeans.ManagedQueue getManagedQueue(String queueName)

getLoggingManagement

public org.apache.qpid.management.common.mbeans.LoggingManagement getLoggingManagement()
                                                                                throws MalformedObjectNameException
Throws:
MalformedObjectNameException

getConfigurationManagement

public org.apache.qpid.management.common.mbeans.ConfigurationManagement getConfigurationManagement()
                                                                                            throws MalformedObjectNameException
Throws:
MalformedObjectNameException

getUserManagement

public org.apache.qpid.management.common.mbeans.UserManagement getUserManagement()
                                                                          throws MalformedObjectNameException
Throws:
MalformedObjectNameException


Licensed to the Apache Software Foundation