Modified: qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ManagedQueue.java URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ManagedQueue.java?rev=1355072&r1=1355071&r2=1355072&view=diff ============================================================================== --- qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ManagedQueue.java (original) +++ qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ManagedQueue.java Thu Jun 28 16:46:12 2012 @@ -63,9 +63,14 @@ public interface ManagedQueue String ENCODING = "Encoding"; String CONTENT = "Content"; List<String> VIEW_MSG_CONTENT_COMPOSITE_ITEM_NAMES_DESC = Collections.unmodifiableList(Arrays.asList(MSG_AMQ_ID, MIME, ENCODING, CONTENT)); - + + /** Date/time format used for message expiration and message timestamp formatting */ + String JMSTIMESTAMP_DATETIME_FORMAT = "MM-dd-yy HH:mm:ss.SSS z"; + //Individual attribute name constants static final String ATTR_NAME = "Name"; + static final String ATTR_DESCRIPTION = "Description"; + static final String ATTR_QUEUE_TYPE = "QueueType"; static final String ATTR_OWNER = "Owner"; static final String ATTR_MAX_MSG_AGE = "MaximumMessageAge"; static final String ATTR_MAX_MSG_COUNT = "MaximumMessageCount"; @@ -92,6 +97,8 @@ public interface ManagedQueue new HashSet<String>( Arrays.asList( ATTR_NAME, + ATTR_QUEUE_TYPE, + ATTR_DESCRIPTION, ATTR_OWNER, ATTR_MAX_MSG_AGE, ATTR_MAX_MSG_COUNT, @@ -235,7 +242,7 @@ public interface ManagedQueue * Tells the maximum number of messages that can be stored in the queue. * This is useful in setting the notifications or taking required * action is the number of message increase this limit. - * @return maximum muber of message allowed to be stored in the queue. + * @return maximum nuumber of message allowed to be stored in the queue. * @throws IOException */ Long getMaximumMessageCount() throws IOException; @@ -287,13 +294,33 @@ public interface ManagedQueue */ @MBeanAttribute(name="Capacity", description="The flow control Capacity (Bytes) of the queue") void setCapacity(Long value) throws IOException, IllegalArgumentException; + + /** + * Gets the free text queue description. + * @since Qpid JMX API 2.5 + */ + String getDescription(); + + /** + * Sets the free text queue description. + * @since Qpid JMX API 2.5 + */ + @MBeanAttribute(name="Description", description="Free text description of the queue") + void setDescription(String string); + + /** + * Gets the queue type + * @since Qpid JMX API 2.5 + */ + @MBeanAttribute(name="QueueType", description="Type of the queue e.g. standard, priority, etc") + String getQueueType(); /** * Returns the current flow control FlowResumeCapacity of the queue in bytes. * * @since Qpid JMX API 1.6 * @return Capacity below which flow resumes in bytes - * @throws IOException + * @throws IOExceptionm */ Long getFlowResumeCapacity() throws IOException; @@ -332,7 +359,7 @@ public interface ManagedQueue * @since Qpid JMX API 2.0 * @param exclusive the capacity in bytes * @throws IOException - * @throws JMException + * @throws JMException */ @MBeanAttribute(name="Exclusive", description="Whether the queue is Exclusive or not") void setExclusive(boolean exclusive) throws IOException, JMException; @@ -341,10 +368,13 @@ public interface ManagedQueue * Sets the Alternate Exchange for the queue, for use in dead letter queue functionality. * * @since Qpid JMX API 2.4 - * @param the name of the exchange to use. Specifying null or the empty string will clear the alternate exchange. + * @param exchangeName the name of the exchange to use. Specifying null or the empty string will clear the + * alternate exchange. * @throws IOException + * @throws JMException */ - void setAlternateExchange(String exchangeName) throws IOException; + @MBeanAttribute(name="AlternateExchange", description="Alternate exchange for the queue") + void setAlternateExchange(String exchangeName) throws IOException, JMException; /** * Returns the name of the Alternate Exchange for the queue, or null if there isn't one. @@ -353,7 +383,6 @@ public interface ManagedQueue * @return the name of the Alternate Exchange for the queue, or null if there isn't one * @throws IOException */ - @MBeanAttribute(name="AlternateExchange", description="Alternate exchange for the queue") String getAlternateExchange() throws IOException; //********** Operations *****************// @@ -473,4 +502,5 @@ public interface ManagedQueue @MBeanOperationParameter(name="to MessageId", description="to MessageId")long toMessageId, @MBeanOperationParameter(name= ManagedQueue.TYPE, description="to Queue Name")String toQueue) throws IOException, JMException; + }
Modified: qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ServerInformation.java URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ServerInformation.java?rev=1355072&r1=1355071&r2=1355072&view=diff ============================================================================== --- qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ServerInformation.java (original) +++ qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ServerInformation.java Thu Jun 28 16:46:12 2012 @@ -46,7 +46,7 @@ public interface ServerInformation * Qpid JMX API 1.1 can be assumed. */ int QPID_JMX_API_MAJOR_VERSION = 2; - int QPID_JMX_API_MINOR_VERSION = 4; + int QPID_JMX_API_MINOR_VERSION = 5; /** Modified: qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ApplicationRegistry.java URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ApplicationRegistry.java?rev=1355072&r1=1355071&r2=1355072&view=diff ============================================================================== --- qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ApplicationRegistry.java (original) +++ qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ApplicationRegistry.java Thu Jun 28 16:46:12 2012 @@ -47,7 +47,7 @@ public abstract class ApplicationRegistr //max supported broker management interface supported by this release of the management console public static final int SUPPORTED_QPID_JMX_API_MAJOR_VERSION = 2; - public static final int SUPPORTED_QPID_JMX_API_MINOR_VERSION = 4; + public static final int SUPPORTED_QPID_JMX_API_MINOR_VERSION = 5; public static final String DATA_DIR = System.getProperty("user.home") + File.separator + ".qpidmc"; Modified: qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/ViewUtility.java URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/ViewUtility.java?rev=1355072&r1=1355071&r2=1355072&view=diff ============================================================================== --- qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/ViewUtility.java (original) +++ qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/ViewUtility.java Thu Jun 28 16:46:12 2012 @@ -404,13 +404,8 @@ public class ViewUtility private static void convertByteArray(FormToolkit toolkit, Composite compositeHolder, CompositeData data, String itemName, String encoding) { - Byte[] arrayItems = (Byte[])data.get(itemName); - byte[] byteArray = new byte[arrayItems.length]; + byte[] byteArray = getByteArray(data, itemName); - for (int i = 0; i < arrayItems.length; i++) - { - byteArray[i] = arrayItems[i]; - } try { String textMessage = new String(byteArray, encoding); @@ -427,6 +422,27 @@ public class ViewUtility } } + private static byte[] getByteArray(CompositeData data, String itemName) + { + byte[] byteArray; + Object binaryData = data.get(itemName); + + if(binaryData instanceof byte[]) + { + byteArray = (byte[]) binaryData; + } + else + { + Byte[] objectArray = (Byte[]) binaryData; + byteArray = new byte[objectArray.length]; + for(int i = 0; i < objectArray.length; i++) + { + byteArray[i] = objectArray[i]; + } + } + return byteArray; + } + private static Shell getShell() { Shell shell = Display.getCurrent().getActiveShell(); @@ -462,13 +478,8 @@ public class ViewUtility private static void handleBinaryMessageContent(FormToolkit toolkit, Composite compositeHolder, CompositeData data, String itemName, String encoding) { final String thisEncoding = encoding; - final Byte[] arrayItems = (Byte[]) data.get(itemName); - final byte[] byteArray = new byte[arrayItems.length]; - for (int i = 0; i < arrayItems.length; i++) - { - byteArray[i] = arrayItems[i]; - } + final byte[] byteArray = getByteArray(data, itemName); try { Modified: qpid/trunk/qpid/java/module.xml URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/module.xml?rev=1355072&r1=1355071&r2=1355072&view=diff ============================================================================== --- qpid/trunk/qpid/java/module.xml (original) +++ qpid/trunk/qpid/java/module.xml Thu Jun 28 16:46:12 2012 @@ -52,6 +52,7 @@ <property name="module.results" location="${build.results}/${module}"/> <property name="module.failed" location="${module.results}/FAILED"/> <property name="module.src" location="src/main/java"/> + <property name="module.src.resources" location="src/main/resources"/> <property name="module.test.src" location="src/test/java"/> <property name="module.bin" location="bin"/> <property name="module.etc" location="etc"/> @@ -443,12 +444,17 @@ <target name="build" depends="jar,jar-tests,jar-sources,libs,copy-bin,copy-etc,postbuild" description="compile and copy resources into build tree"/> <target name="jar.manifest" depends="compile" if="module.manifest"> - <jar destfile="${module.jar}" basedir="${module.classes}" manifest="${module.manifest}"/> + <jar destfile="${module.jar}" basedir="${module.classes}" manifest="${module.manifest}"> + <metainf dir="${project.root}/resources/" /> + <metainf dir="${module.src.resources}" erroronmissingdir="false"/> + </jar> </target> <target name="jar.nomanifest" depends="compile" unless="module.manifest"> + <jar destfile="${module.jar}" basedir="${module.classes}"> <metainf dir="${project.root}/resources/" /> + <metainf dir="${module.src.resources}" erroronmissingdir="false"/> </jar> </target> Modified: qpid/trunk/qpid/java/systests/build.xml URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/build.xml?rev=1355072&r1=1355071&r2=1355072&view=diff ============================================================================== --- qpid/trunk/qpid/java/systests/build.xml (original) +++ qpid/trunk/qpid/java/systests/build.xml Thu Jun 28 16:46:12 2012 @@ -32,7 +32,7 @@ nn - or more contributor license agreeme </or> </condition> - <property name="module.depends" value="client management/common broker broker/test common amqp-1-0-common common/test jca ${systests.optional.depends}"/> + <property name="module.depends" value="client management/common broker broker/test common amqp-1-0-common common/test jca broker-plugins/management ${systests.optional.depends}"/> <property name="module.test.src" location="src/main/java"/> <property name="module.test.excludes" value="**/DropInTest.java,**/TestClientControlledTest.java"/> Modified: qpid/trunk/qpid/java/systests/etc/config-systests-settings.xml URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/etc/config-systests-settings.xml?rev=1355072&r1=1355071&r2=1355072&view=diff ============================================================================== --- qpid/trunk/qpid/java/systests/etc/config-systests-settings.xml (original) +++ qpid/trunk/qpid/java/systests/etc/config-systests-settings.xml Thu Jun 28 16:46:12 2012 @@ -56,6 +56,9 @@ <keyStorePath>${QPID_HOME}/../test-profiles/test_resources/ssl/java_broker_keystore.jks</keyStorePath> <keyStorePassword>password</keyStorePassword> </ssl> + <http> + <enabled>false</enabled> + </http> </management> <advanced> <framesize>65535</framesize> Modified: qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/ModelTest.java URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/ModelTest.java?rev=1355072&r1=1355071&r2=1355072&view=diff ============================================================================== --- qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/ModelTest.java (original) +++ qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/ModelTest.java Thu Jun 28 16:46:12 2012 @@ -333,7 +333,7 @@ public class ModelTest extends QpidBroke queueName)); assertEquals(queueName, managedQueue.getName()); - assertEquals(String.valueOf(owner), managedQueue.getOwner()); + assertEquals(owner, managedQueue.getOwner()); assertEquals(durable, managedQueue.isDurable()); assertEquals(autoDelete, managedQueue.isAutoDelete()); } Modified: qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/security/acl/ExternalACLJMXTest.java URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/security/acl/ExternalACLJMXTest.java?rev=1355072&r1=1355071&r2=1355072&view=diff ============================================================================== --- qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/security/acl/ExternalACLJMXTest.java (original) +++ qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/security/acl/ExternalACLJMXTest.java Thu Jun 28 16:46:12 2012 @@ -19,7 +19,6 @@ package org.apache.qpid.server.security.acl; import org.apache.qpid.management.common.mbeans.ServerInformation; -import org.apache.qpid.server.management.ManagedObject; import org.apache.qpid.server.security.access.ObjectType; import org.apache.qpid.test.utils.JMXTestUtils; @@ -30,7 +29,7 @@ import java.lang.management.RuntimeMXBea * Tests that access to the JMX interface is governed only by {@link ObjectType#METHOD}/{@link ObjectType#ALL} * rules and AMQP rights have no effect. * - * Ensures that objects outside the Qpid domain ({@link ManagedObject#DOMAIN}) are not governed by the ACL model. + * Ensures that objects outside the Qpid domain are not governed by the ACL model. */ public class ExternalACLJMXTest extends AbstractACLTestCase { Added: qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/stats/StatisticsReportingTest.java URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/stats/StatisticsReportingTest.java?rev=1355072&view=auto ============================================================================== --- qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/stats/StatisticsReportingTest.java (added) +++ qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/stats/StatisticsReportingTest.java Thu Jun 28 16:46:12 2012 @@ -0,0 +1,158 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.qpid.server.stats; + +import org.apache.qpid.AMQException; +import org.apache.qpid.client.AMQConnection; +import org.apache.qpid.client.AMQDestination; +import org.apache.qpid.client.AMQQueue; +import org.apache.qpid.client.AMQSession; +import org.apache.qpid.exchange.ExchangeDefaults; +import org.apache.qpid.framing.AMQShortString; +import org.apache.qpid.test.utils.QpidBrokerTestCase; +import org.apache.qpid.util.LogMonitor; + +import java.util.List; + +import javax.jms.Connection; +import javax.jms.Destination; +import javax.jms.JMSException; +import javax.jms.MessageProducer; +import javax.jms.Session; +import javax.jms.TextMessage; + +/** + * Test generation of message/data statistics reporting and the ability + * to control from the configuration file. + */ +public class StatisticsReportingTest extends QpidBrokerTestCase +{ + protected LogMonitor _monitor; + protected static final String USER = "admin"; + + protected Connection _test, _dev, _local; + protected String _queueName = "statistics"; + protected Destination _queue; + protected String _brokerUrl; + + @Override + public void setUp() throws Exception + { + setConfigurationProperty("statistics.generation.broker", "true"); + setConfigurationProperty("statistics.generation.virtualhosts", "true"); + + if (getName().equals("testEnabledStatisticsReporting")) + { + setConfigurationProperty("statistics.reporting.period", "10"); + } + + _monitor = new LogMonitor(_outputFile); + + super.setUp(); + + _brokerUrl = getBroker().toString(); + _test = new AMQConnection(_brokerUrl, USER, USER, "clientid", "test"); + _dev = new AMQConnection(_brokerUrl, USER, USER, "clientid", "development"); + _local = new AMQConnection(_brokerUrl, USER, USER, "clientid", "localhost"); + + _test.start(); + _dev.start(); + _local.start(); + + } + + @Override + public void tearDown() throws Exception + { + _test.close(); + _dev.close(); + _local.close(); + + super.tearDown(); + } + + /** + * Test enabling reporting. + */ + public void testEnabledStatisticsReporting() throws Exception + { + sendUsing(_test, 10, 100); + sendUsing(_dev, 20, 100); + sendUsing(_local, 15, 100); + + Thread.sleep(10 * 1000); // 15s + + List<String> brokerStatsData = _monitor.findMatches("BRK-1008"); + List<String> brokerStatsMessages = _monitor.findMatches("BRK-1009"); + List<String> vhostStatsData = _monitor.findMatches("VHT-1003"); + List<String> vhostStatsMessages = _monitor.findMatches("VHT-1004"); + + assertEquals("Incorrect number of broker data stats log messages", 2, brokerStatsData.size()); + assertEquals("Incorrect number of broker message stats log messages", 2, brokerStatsMessages.size()); + assertEquals("Incorrect number of virtualhost data stats log messages", 6, vhostStatsData.size()); + assertEquals("Incorrect number of virtualhost message stats log messages", 6, vhostStatsMessages.size()); + } + + /** + * Test not enabling reporting. + */ + public void testNotEnabledStatisticsReporting() throws Exception + { + sendUsing(_test, 10, 100); + sendUsing(_dev, 20, 100); + sendUsing(_local, 15, 100); + + Thread.sleep(10 * 1000); // 15s + + List<String> brokerStatsData = _monitor.findMatches("BRK-1008"); + List<String> brokerStatsMessages = _monitor.findMatches("BRK-1009"); + List<String> vhostStatsData = _monitor.findMatches("VHT-1003"); + List<String> vhostStatsMessages = _monitor.findMatches("VHT-1004"); + + assertEquals("Incorrect number of broker data stats log messages", 0, brokerStatsData.size()); + assertEquals("Incorrect number of broker message stats log messages", 0, brokerStatsMessages.size()); + assertEquals("Incorrect number of virtualhost data stats log messages", 0, vhostStatsData.size()); + assertEquals("Incorrect number of virtualhost message stats log messages", 0, vhostStatsMessages.size()); + } + + private void sendUsing(Connection con, int number, int size) throws Exception + { + Session session = con.createSession(false, Session.AUTO_ACKNOWLEDGE); + createQueue(session); + MessageProducer producer = session.createProducer(_queue); + String content = new String(new byte[size]); + TextMessage msg = session.createTextMessage(content); + for (int i = 0; i < number; i++) + { + producer.send(msg); + } + } + + private void createQueue(Session session) throws AMQException, JMSException + { + _queue = new AMQQueue(ExchangeDefaults.DIRECT_EXCHANGE_NAME, _queueName); + if (!((AMQSession<?,?>) session).isQueueBound((AMQDestination) _queue)) + { + ((AMQSession<?,?>) session).createQueue(new AMQShortString(_queueName), false, true, false, null); + ((AMQSession<?,?>) session).declareAndBind((AMQDestination) new AMQQueue(ExchangeDefaults.DIRECT_EXCHANGE_NAME, _queueName)); + } + } +} Modified: qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/store/QuotaMessageStore.java URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/store/QuotaMessageStore.java?rev=1355072&r1=1355071&r2=1355072&view=diff ============================================================================== --- qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/store/QuotaMessageStore.java (original) +++ qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/store/QuotaMessageStore.java Thu Jun 28 16:46:12 2012 @@ -171,4 +171,10 @@ public class QuotaMessageStore extends N } } } + + @Override + public String getStoreType() + { + return "QUOTA"; + } } Modified: qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/store/SlowMessageStore.java URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/store/SlowMessageStore.java?rev=1355072&r1=1355071&r2=1355072&view=diff ============================================================================== --- qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/store/SlowMessageStore.java (original) +++ qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/store/SlowMessageStore.java Thu Jun 28 16:46:12 2012 @@ -24,7 +24,6 @@ import org.apache.commons.configuration. import org.apache.log4j.Logger; import org.apache.qpid.AMQStoreException; -import org.apache.qpid.framing.AMQShortString; import org.apache.qpid.framing.FieldTable; import org.apache.qpid.server.binding.Binding; import org.apache.qpid.server.exchange.Exchange; @@ -370,4 +369,10 @@ public class SlowMessageStore implements return _realStore.getStoreLocation(); } + @Override + public String getStoreType() + { + return "SLOW"; + } + } Modified: qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/BrokerClosesClientConnectionTest.java URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/BrokerClosesClientConnectionTest.java?rev=1355072&r1=1355071&r2=1355072&view=diff ============================================================================== --- qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/BrokerClosesClientConnectionTest.java (original) +++ qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/BrokerClosesClientConnectionTest.java Thu Jun 28 16:46:12 2012 @@ -26,7 +26,6 @@ import java.util.concurrent.TimeUnit; import org.apache.qpid.AMQConnectionClosedException; import org.apache.qpid.AMQDisconnectedException; import org.apache.qpid.client.AMQConnection; -import org.apache.qpid.management.jmx.ManagedConnectionMBeanTest; import org.apache.qpid.test.utils.QpidBrokerTestCase; import org.apache.qpid.transport.ConnectionException; Modified: qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/JMXTestUtils.java URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/JMXTestUtils.java?rev=1355072&r1=1355071&r2=1355072&view=diff ============================================================================== --- qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/JMXTestUtils.java (original) +++ qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/JMXTestUtils.java Thu Jun 28 16:46:12 2012 @@ -33,11 +33,15 @@ import org.apache.qpid.management.common import org.apache.qpid.management.common.mbeans.ServerInformation; import org.apache.qpid.management.common.mbeans.UserManagement; +import javax.management.InstanceNotFoundException; import javax.management.JMException; +import javax.management.ListenerNotFoundException; import javax.management.MBeanException; import javax.management.MBeanServerConnection; import javax.management.MBeanServerInvocationHandler; import javax.management.MalformedObjectNameException; +import javax.management.NotificationFilter; +import javax.management.NotificationListener; import javax.management.ObjectName; import javax.management.remote.JMXConnector; import java.io.IOException; @@ -50,8 +54,8 @@ import java.util.Set; */ public class JMXTestUtils { - private static final String DEFAULT_PASSWORD = "admin"; - private static final String DEFAULT_USERID = "admin"; + public static final String DEFAULT_PASSWORD = "admin"; + public static final String DEFAULT_USERID = "admin"; private MBeanServerConnection _mbsc; private JMXConnector _jmxc; @@ -101,6 +105,18 @@ public class JMXTestUtils } } + public void addNotificationListener(ObjectName name, NotificationListener listener, NotificationFilter filter, Object handback) + throws InstanceNotFoundException, IOException + { + _mbsc.addNotificationListener(name, listener, filter, handback); + } + + public void removeNotificationListener(ObjectName name, NotificationListener listener) + throws InstanceNotFoundException, IOException, ListenerNotFoundException + { + _mbsc.removeNotificationListener(name, listener); + } + /** * Create a non-durable exchange with the requested name * @@ -144,7 +160,6 @@ public class JMXTestUtils throws IOException, JMException, MBeanException { ManagedBroker managedBroker = getManagedBroker(virtualHostName); - managedBroker.unregisterExchange(exchange); } @@ -160,87 +175,81 @@ public class JMXTestUtils throws IOException, JMException, MBeanException { ManagedBroker managedBroker = getManagedBroker(virtualHostName); - managedBroker.deleteQueue(queueName); } - + /** - * Sets the logging level. + * Sets the logging level. * * @throws JMException * @throws IOException if there is a problem with the JMX Connection * @throws MBeanException */ public void setRuntimeLoggerLevel(String logger, String level) - throws IOException, JMException, MBeanException + throws IOException, JMException, MBeanException { LoggingManagement loggingManagement = getLoggingManagement(); - loggingManagement.setRuntimeLoggerLevel(logger, level); } - + /** - * Reload logging config file. + * Reload logging config file. * * @throws JMException * @throws IOException if there is a problem with the JMX Connection * @throws MBeanException */ public void reloadConfigFile() - throws IOException, JMException, MBeanException + throws IOException, JMException, MBeanException { LoggingManagement loggingManagement = getLoggingManagement(); - loggingManagement.reloadConfigFile(); } /** - * Get list of available logger levels. + * Get list of available logger levels. * * @throws JMException * @throws IOException if there is a problem with the JMX Connection * @throws MBeanException */ public String[] getAvailableLoggerLevels() - throws IOException, JMException, MBeanException + throws IOException, JMException, MBeanException { LoggingManagement loggingManagement = getLoggingManagement(); - return loggingManagement.getAvailableLoggerLevels(); } - + /** - * Set root logger level. + * Set root logger level. * * @throws JMException * @throws IOException if there is a problem with the JMX Connection * @throws MBeanException */ public void setRuntimeRootLoggerLevel(String level) - throws IOException, JMException, MBeanException + throws IOException, JMException, MBeanException { LoggingManagement loggingManagement = getLoggingManagement(); - loggingManagement.setRuntimeRootLoggerLevel(level); } - + /** - * Get root logger level. + * Get root logger level. * * @throws JMException * @throws IOException if there is a problem with the JMX Connection * @throws MBeanException */ public String getRuntimeRootLoggerLevel() - throws IOException, JMException, MBeanException + throws IOException, JMException, MBeanException { LoggingManagement loggingManagement = getLoggingManagement(); - return loggingManagement.getRuntimeRootLoggerLevel(); } /** - * Retrive the ObjectName for a Virtualhost. + * Retrieve the ObjectName for a Virtualhost. * * This is then used to create a proxy to the ManagedBroker MBean. * @@ -261,12 +270,12 @@ public class JMXTestUtils // We have verified we have only one value in objectNames so return it ObjectName objectName = objectNames.iterator().next(); - _test.getLogger().info("Loading: " + objectName); + _test.getLogger().info("Loading: " + objectName); return objectName; } /** - * Retrive the ObjectName for the given Queue on a Virtualhost. + * Retrieve the ObjectName for the given Queue on a Virtualhost. * * This is then used to create a proxy to the ManagedQueue MBean. * @@ -289,7 +298,7 @@ public class JMXTestUtils // We have verified we have only one value in objectNames so return it ObjectName objectName = objectNames.iterator().next(); - _test.getLogger().info("Loading: " + objectName); + _test.getLogger().info("Loading: " + objectName); return objectName; } @@ -317,7 +326,7 @@ public class JMXTestUtils // We have verified we have only one value in objectNames so return it ObjectName objectName = objectNames.iterator().next(); - _test.getLogger().info("Loading: " + objectName); + _test.getLogger().info("Loading: " + objectName); return objectName; } @@ -330,7 +339,7 @@ public class JMXTestUtils _test.assertEquals("Unexpected number of objects matching " + managedClass + " returned", 1, objectNames.size()); ObjectName objectName = objectNames.iterator().next(); - _test.getLogger().info("Loading: " + objectName); + _test.getLogger().info("Loading: " + objectName); return getManagedObject(managedClass, objectName); } @@ -363,34 +372,34 @@ public class JMXTestUtils { return getManagedObject(ManagedBroker.class, getVirtualHostManagerObjectName(virtualHost)); } - + public ManagedExchange getManagedExchange(String exchangeName) { - ObjectName objectName = getExchangeObjectName("test", exchangeName); + ObjectName objectName = getExchangeObjectName("test", exchangeName); return MBeanServerInvocationHandler.newProxyInstance(_mbsc, objectName, ManagedExchange.class, false); } - + public ManagedQueue getManagedQueue(String queueName) { ObjectName objectName = getQueueObjectName("test", queueName); return getManagedObject(ManagedQueue.class, objectName); } - public LoggingManagement getLoggingManagement() throws MalformedObjectNameException + public LoggingManagement getLoggingManagement() throws MalformedObjectNameException { - ObjectName objectName = new ObjectName("org.apache.qpid:type=LoggingManagement,name=LoggingManagement"); + ObjectName objectName = new ObjectName("org.apache.qpid:type=LoggingManagement,name=LoggingManagement"); return getManagedObject(LoggingManagement.class, objectName); } - - public ConfigurationManagement getConfigurationManagement() throws MalformedObjectNameException + + public ConfigurationManagement getConfigurationManagement() throws MalformedObjectNameException { - ObjectName objectName = new ObjectName("org.apache.qpid:type=ConfigurationManagement,name=ConfigurationManagement"); + ObjectName objectName = new ObjectName("org.apache.qpid:type=ConfigurationManagement,name=ConfigurationManagement"); return getManagedObject(ConfigurationManagement.class, objectName); } - - public UserManagement getUserManagement() throws MalformedObjectNameException + + public UserManagement getUserManagement() throws MalformedObjectNameException { - ObjectName objectName = new ObjectName("org.apache.qpid:type=UserManagement,name=UserManagement"); + ObjectName objectName = new ObjectName("org.apache.qpid:type=UserManagement,name=UserManagement"); return getManagedObject(UserManagement.class, objectName); } Modified: qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java?rev=1355072&r1=1355071&r2=1355072&view=diff ============================================================================== --- qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java (original) +++ qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java Thu Jun 28 16:46:12 2012 @@ -83,6 +83,10 @@ public class QpidBrokerTestCase extends INTERNAL /** Test case starts an embedded broker within this JVM */, SPAWNED /** Test case spawns a new broker as a separate process */ } + + public static final String GUEST_USERNAME = "guest"; + public static final String GUEST_PASSWORD = "guest"; + protected final static String QpidHome = System.getProperty("QPID_HOME"); protected File _configFile = new File(System.getProperty("broker.config")); @@ -1095,7 +1099,7 @@ public class QpidBrokerTestCase extends public Connection getConnection() throws JMSException, NamingException { - return getConnection("guest", "guest"); + return getConnection(GUEST_USERNAME, GUEST_PASSWORD); } public Connection getConnection(ConnectionURL url) throws JMSException Modified: qpid/trunk/qpid/java/test-profiles/CPPExcludes URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/test-profiles/CPPExcludes?rev=1355072&r1=1355071&r2=1355072&view=diff ============================================================================== --- qpid/trunk/qpid/java/test-profiles/CPPExcludes (original) +++ qpid/trunk/qpid/java/test-profiles/CPPExcludes Thu Jun 28 16:46:12 2012 @@ -101,11 +101,8 @@ org.apache.qpid.server.logging.subjects. org.apache.qpid.server.logging.actors.* // CPP Broker does not have a JMX interface to test -org.apache.qpid.management.jmx.* -org.apache.qpid.server.queue.AMQQueueMBeanTest#* -org.apache.qpid.server.exchange.ExchangeMBeanTest#* -org.apache.qpid.server.AMQBrokerManagerMBeanTest#* -org.apache.qpid.server.protocol.AMQProtocolSessionMBeanTest#* +org.apache.qpid.server.jmx.mbeans.* +org.apache.qpid.systest.management.jmx.* // JMX is used in this test for validation org.apache.qpid.server.queue.ModelTest#* @@ -159,8 +156,6 @@ org.apache.qpid.test.unit.transacted.Tra org.apache.qpid.test.unit.transacted.TransactionTimeoutTest#* // Java broker only -org.apache.qpid.server.logging.management.LoggingManagementMBeanTest#* -org.apache.qpid.server.management.AMQUserManagementMBeanTest#* org.apache.qpid.server.SupportedProtocolVersionsTest#* Modified: qpid/trunk/qpid/java/test-profiles/Java010Excludes URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/test-profiles/Java010Excludes?rev=1355072&r1=1355071&r2=1355072&view=diff ============================================================================== --- qpid/trunk/qpid/java/test-profiles/Java010Excludes (original) +++ qpid/trunk/qpid/java/test-profiles/Java010Excludes Thu Jun 28 16:46:12 2012 @@ -65,3 +65,8 @@ org.apache.qpid.client.failover.AddressB // QPID-3604: Immediate Prefetch no longer supported by 0-10 org.apache.qpid.client.AsynchMessageListenerTest#testImmediatePrefetchWithMessageListener +// QPID-4090: Can't connect from Java Client to Java Broker when Broker uses Base64MD5PasswordFilePrincipalDatabase principal database (0-10 protocol only) +org.apache.qpid.systest.management.jmx.UserManagementWithBase64MD5PasswordsTest#testJmsLoginForNewUser +org.apache.qpid.systest.management.jmx.UserManagementWithBase64MD5PasswordsTest#testJmsLoginNotPossibleForDeletedUser +org.apache.qpid.systest.management.jmx.UserManagementWithBase64MD5PasswordsTest#testJmsLoginForPasswordChangedUser +org.apache.qpid.systest.management.jmx.UserManagementWithBase64MD5PasswordsTest#testReload Modified: qpid/trunk/qpid/java/test-profiles/JavaPre010Excludes URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/test-profiles/JavaPre010Excludes?rev=1355072&r1=1355071&r2=1355072&view=diff ============================================================================== --- qpid/trunk/qpid/java/test-profiles/JavaPre010Excludes (original) +++ qpid/trunk/qpid/java/test-profiles/JavaPre010Excludes Thu Jun 28 16:46:12 2012 @@ -70,3 +70,8 @@ org.apache.qpid.test.unit.ct.DurableSubs org.apache.qpid.ra.QpidRAConnectionTest#* org.apache.qpid.ra.QpidRAXAResourceTest#* +// These tests rely on new address syntax +org.apache.qpid.systest.management.jmx.QueueManagementTest#testGetSetAlternateExchange +org.apache.qpid.systest.management.jmx.QueueManagementTest#testRemoveAlternateExchange +org.apache.qpid.systest.management.jmx.QueueManagementTest#testAlternateExchangeSurvivesRestart + Modified: qpid/trunk/qpid/java/test-profiles/JavaTransientExcludes URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/test-profiles/JavaTransientExcludes?rev=1355072&r1=1355071&r2=1355072&view=diff ============================================================================== --- qpid/trunk/qpid/java/test-profiles/JavaTransientExcludes (original) +++ qpid/trunk/qpid/java/test-profiles/JavaTransientExcludes Thu Jun 28 16:46:12 2012 @@ -42,3 +42,6 @@ org.apache.qpid.server.store.MessageStor org.apache.qpid.server.store.berkeleydb.* org.apache.qpid.server.store.DurableConfigurationStoreTest#* + +org.apache.qpid.systest.management.jmx.QueueManagementTest#testAlternateExchangeSurvivesRestart +org.apache.qpid.systest.management.jmx.QueueManagementTest#testQueueDescriptionSurvivesRestart --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
