activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r799706 [2/2] - in /activemq/trunk/activemq-core/src: main/java/org/apache/activemq/broker/ main/java/org/apache/activemq/broker/jmx/ main/java/org/apache/activemq/broker/region/ main/java/org/apache/activemq/broker/view/ main/java/org/apac...
Date Fri, 31 Jul 2009 19:19:07 GMT
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/region/cursors/NegativeQueueTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/region/cursors/NegativeQueueTest.java?rev=799706&r1=799705&r2=799706&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/region/cursors/NegativeQueueTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/region/cursors/NegativeQueueTest.java
Fri Jul 31 19:19:07 2009
@@ -236,9 +236,8 @@
         
         ObjectName queueViewMBeanName = new ObjectName("org.apache.activemq" + ":Type=Queue,Destination="
+ 
             queue.getQueueName() + ",BrokerName=localhost");
-        QueueViewMBean proxy = (QueueViewMBean)MBeanServerInvocationHandler.newProxyInstance(
-                broker.getManagementContext().getMBeanServer(), 
-            queueViewMBeanName, QueueViewMBean.class, true);
+        QueueViewMBean proxy = (QueueViewMBean) broker.getManagementContext().newProxyInstance(queueViewMBeanName,
+                QueueViewMBean.class, true);
      
         return proxy;
     }

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/MessageExpirationReaperTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/MessageExpirationReaperTest.java?rev=799706&r1=799705&r2=799706&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/MessageExpirationReaperTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/MessageExpirationReaperTest.java
Fri Jul 31 19:19:07 2009
@@ -2,17 +2,6 @@
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
-
-import javax.jms.ConnectionFactory;
-import javax.jms.MessageProducer;
-import javax.jms.Queue;
-import javax.jms.QueueBrowser;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.management.MBeanServer;
-import javax.management.MBeanServerInvocationHandler;
-import javax.management.ObjectName;
-
 import org.apache.activemq.ActiveMQConnection;
 import org.apache.activemq.ActiveMQConnectionFactory;
 import org.apache.activemq.broker.BrokerService;
@@ -23,6 +12,13 @@
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
+import javax.jms.ConnectionFactory;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.QueueBrowser;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.management.ObjectName;
 
 /**
  * Test to determine if expired messages are being reaped if there is
@@ -122,7 +118,6 @@
     }
     
     protected DestinationViewMBean createView(ActiveMQDestination destination) throws Exception
{
-        MBeanServer mbeanServer = broker.getManagementContext().getMBeanServer();
         String domain = "org.apache.activemq";
         ObjectName name;
         if (destination.isQueue()) {
@@ -130,6 +125,7 @@
         } else {
             name = new ObjectName(domain + ":BrokerName=" + brokerName + ",Type=Topic,Destination="
+ destinationName);
         }
-        return (DestinationViewMBean)MBeanServerInvocationHandler.newProxyInstance(mbeanServer,
name, DestinationViewMBean.class, true);
+        return (DestinationViewMBean) broker.getManagementContext().newProxyInstance(name,
DestinationViewMBean.class,
+                true);
     }
 }

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompTest.java?rev=799706&r1=799705&r2=799706&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompTest.java
Fri Jul 31 19:19:07 2009
@@ -16,6 +16,15 @@
  */
 package org.apache.activemq.transport.stomp;
 
+import org.apache.activemq.ActiveMQConnectionFactory;
+import org.apache.activemq.CombinationTestSupport;
+import org.apache.activemq.broker.BrokerFactory;
+import org.apache.activemq.broker.BrokerService;
+import org.apache.activemq.broker.jmx.BrokerViewMBean;
+import org.apache.activemq.command.ActiveMQQueue;
+import org.apache.activemq.command.ActiveMQTextMessage;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import java.io.IOException;
 import java.net.Socket;
 import java.net.SocketTimeoutException;
@@ -25,7 +34,6 @@
 import java.util.HashMap;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
-
 import javax.jms.BytesMessage;
 import javax.jms.Connection;
 import javax.jms.JMSException;
@@ -35,20 +43,8 @@
 import javax.jms.ObjectMessage;
 import javax.jms.Session;
 import javax.jms.TextMessage;
-import javax.management.MBeanServer;
-import javax.management.MBeanServerInvocationHandler;
 import javax.management.ObjectName;
 
-import org.apache.activemq.ActiveMQConnectionFactory;
-import org.apache.activemq.CombinationTestSupport;
-import org.apache.activemq.broker.BrokerFactory;
-import org.apache.activemq.broker.BrokerService;
-import org.apache.activemq.broker.jmx.BrokerViewMBean;
-import org.apache.activemq.command.ActiveMQQueue;
-import org.apache.activemq.command.ActiveMQTextMessage;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
 public class StompTest extends CombinationTestSupport {
     private static final Log LOG = LogFactory.getLog(StompTest.class);
 
@@ -882,12 +878,11 @@
     
     public void testDurableUnsub() throws Exception {
     	// get broker JMX view
-        MBeanServer mbeanServer = broker.getManagementContext().getMBeanServer();
-        
+                
         String domain = "org.apache.activemq";
         ObjectName brokerName = new ObjectName(domain + ":Type=Broker,BrokerName=localhost");
         
-    	BrokerViewMBean view = (BrokerViewMBean)MBeanServerInvocationHandler.newProxyInstance(mbeanServer,
brokerName, BrokerViewMBean.class, true);    	
+    	BrokerViewMBean view = (BrokerViewMBean)broker.getManagementContext().newProxyInstance(brokerName,
BrokerViewMBean.class, true);    	
     	
     	// connect
         String frame = "CONNECT\n" + "login: system\n" + "passcode: manager\nclient-id:test\n\n"
+ Stomp.NULL;

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/ExpiredMessagesTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/ExpiredMessagesTest.java?rev=799706&r1=799705&r2=799706&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/ExpiredMessagesTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/ExpiredMessagesTest.java
Fri Jul 31 19:19:07 2009
@@ -16,21 +16,6 @@
  */
 package org.apache.activemq.usecases;
 
-import java.io.File;
-import java.util.concurrent.atomic.AtomicLong;
-
-import javax.jms.Connection;
-import javax.jms.DeliveryMode;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import javax.management.MBeanServer;
-import javax.management.MBeanServerInvocationHandler;
-import javax.management.ObjectName;
-
-import junit.framework.Test;
-
 import org.apache.activemq.ActiveMQConnectionFactory;
 import org.apache.activemq.CombinationTestSupport;
 import org.apache.activemq.broker.BrokerService;
@@ -44,6 +29,16 @@
 import org.apache.activemq.util.Wait;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import java.io.File;
+import java.util.concurrent.atomic.AtomicLong;
+import javax.jms.Connection;
+import javax.jms.DeliveryMode;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.management.ObjectName;
+import junit.framework.Test;
 
 public class ExpiredMessagesTest extends CombinationTestSupport {
 
@@ -289,16 +284,18 @@
     }
 
     protected DestinationViewMBean createView(ActiveMQDestination destination) throws Exception
{
-		 MBeanServer mbeanServer = broker.getManagementContext().getMBeanServer();
-		 String domain = "org.apache.activemq";
-		 ObjectName name;
-		if (destination.isQueue()) {
-			name = new ObjectName(domain + ":BrokerName=localhost,Type=Queue,Destination=" + destination.getPhysicalName());
-		} else {
-			name = new ObjectName(domain + ":BrokerName=localhost,Type=Topic,Destination=" + destination.getPhysicalName());
-		}
-		return (DestinationViewMBean)MBeanServerInvocationHandler.newProxyInstance(mbeanServer,
name, DestinationViewMBean.class, true);
-	}
+        String domain = "org.apache.activemq";
+        ObjectName name;
+        if (destination.isQueue()) {
+            name = new ObjectName(domain + ":BrokerName=localhost,Type=Queue,Destination="
+                    + destination.getPhysicalName());
+        } else {
+            name = new ObjectName(domain + ":BrokerName=localhost,Type=Topic,Destination="
+                    + destination.getPhysicalName());
+        }
+        return (DestinationViewMBean) broker.getManagementContext().newProxyInstance(name,
DestinationViewMBean.class,
+                true);
+    }
 
 	protected void tearDown() throws Exception {
 		connection.stop();

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/ExpiredMessagesWithNoConsumerTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/ExpiredMessagesWithNoConsumerTest.java?rev=799706&r1=799705&r2=799706&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/ExpiredMessagesWithNoConsumerTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/ExpiredMessagesWithNoConsumerTest.java
Fri Jul 31 19:19:07 2009
@@ -16,21 +16,6 @@
  */
 package org.apache.activemq.usecases;
 
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
-import javax.jms.Connection;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageListener;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import javax.management.MBeanServer;
-import javax.management.MBeanServerInvocationHandler;
-import javax.management.ObjectName;
-
-import junit.framework.Test;
-
 import org.apache.activemq.ActiveMQConnectionFactory;
 import org.apache.activemq.CombinationTestSupport;
 import org.apache.activemq.broker.BrokerService;
@@ -42,6 +27,16 @@
 import org.apache.activemq.util.Wait;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import javax.jms.Connection;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageListener;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.management.ObjectName;
+import junit.framework.Test;
 
 
 public class ExpiredMessagesWithNoConsumerTest extends CombinationTestSupport {
@@ -248,16 +243,16 @@
     }
 
 	protected DestinationViewMBean createView(ActiveMQDestination destination) throws Exception
{
-		 MBeanServer mbeanServer = broker.getManagementContext().getMBeanServer();
-		 String domain = "org.apache.activemq";
-		 ObjectName name;
-		if (destination.isQueue()) {
-			name = new ObjectName(domain + ":BrokerName=localhost,Type=Queue,Destination=test");
-		} else {
-			name = new ObjectName(domain + ":BrokerName=localhost,Type=Topic,Destination=test");
-		}
-		return (DestinationViewMBean)MBeanServerInvocationHandler.newProxyInstance(mbeanServer,
name, DestinationViewMBean.class, true);
-	}
+        String domain = "org.apache.activemq";
+        ObjectName name;
+        if (destination.isQueue()) {
+            name = new ObjectName(domain + ":BrokerName=localhost,Type=Queue,Destination=test");
+        } else {
+            name = new ObjectName(domain + ":BrokerName=localhost,Type=Topic,Destination=test");
+        }
+        return (DestinationViewMBean) broker.getManagementContext().newProxyInstance(name,
DestinationViewMBean.class,
+                true);
+    }
 
 	protected void tearDown() throws Exception {
 		connection.stop();

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/xbean/ManagementContextXBeanConfigTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/xbean/ManagementContextXBeanConfigTest.java?rev=799706&r1=799705&r2=799706&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/xbean/ManagementContextXBeanConfigTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/xbean/ManagementContextXBeanConfigTest.java
Fri Jul 31 19:19:07 2009
@@ -16,18 +16,14 @@
  */
 package org.apache.activemq.xbean;
 
+import org.apache.activemq.broker.BrokerFactory;
+import org.apache.activemq.broker.BrokerService;
+import org.apache.activemq.util.JMXSupport;
 import java.net.URI;
 import java.util.Hashtable;
-
-import javax.management.MBeanServer;
 import javax.management.ObjectName;
-
 import junit.framework.TestCase;
 
-import org.apache.activemq.broker.BrokerFactory;
-import org.apache.activemq.broker.BrokerService;
-import org.apache.activemq.util.JMXSupport;
-
 /**
  * @version $Revision: 1.1 $
  */
@@ -36,19 +32,14 @@
     protected BrokerService brokerService;
 
     public void testManagmentContextConfiguredCorrectly() throws Exception {
-
         assertEquals(2011, brokerService.getManagementContext().getConnectorPort());
         assertEquals("test.domain", brokerService.getManagementContext().getJmxDomainName());
-
-        MBeanServer beanServer = brokerService.getManagementContext().getMBeanServer();
-
         // Make sure the broker is registered in the right jmx domain.
         Hashtable<String, String> map = new Hashtable<String, String>();
         map.put("Type", "Broker");
         map.put("BrokerName", JMXSupport.encodeObjectNamePart("localhost"));
         ObjectName on = new ObjectName("test.domain", map);
-
-        Object value = beanServer.getAttribute(on, "TotalEnqueueCount");
+        Object value = brokerService.getManagementContext().getAttribute(on, "TotalEnqueueCount");
         assertNotNull(value);
     }
 



Mime
View raw message