activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject svn commit: r1026092 - in /activemq/trunk/activemq-core/src: main/java/org/apache/activemq/broker/jmx/BrokerView.java test/java/org/apache/activemq/usecases/AuthorizationFromAdminViewTest.java
Date Thu, 21 Oct 2010 18:17:43 GMT
Author: gtully
Date: Thu Oct 21 18:17:42 2010
New Revision: 1026092

URL: http://svn.apache.org/viewvc?rev=1026092&view=rev
Log:
seems to be regression from: https://issues.apache.org/activemq/browse/AMQ-2970 - but there
is some mix up with the creation of an admin connection context. having the BrokerView do
the right thing works for the moment... but this needs some more eyes, test shows the issue
when context is missing

Added:
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/AuthorizationFromAdminViewTest.java
  (with props)
Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/BrokerView.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/BrokerView.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/BrokerView.java?rev=1026092&r1=1026091&r2=1026092&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/BrokerView.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/BrokerView.java
Thu Oct 21 18:17:42 2010
@@ -37,6 +37,7 @@ import org.apache.activemq.command.Consu
 import org.apache.activemq.command.ConsumerInfo;
 import org.apache.activemq.command.RemoveSubscriptionInfo;
 import org.apache.activemq.network.NetworkConnector;
+import org.apache.activemq.security.SecurityContext;
 
 /**
  * @version $Revision$
@@ -313,6 +314,7 @@ public class BrokerView implements Broke
     protected static ConnectionContext createAdminConnectionContext(Broker broker) {
         ConnectionContext context = new ConnectionContext();
         context.setBroker(broker);
+        context.setSecurityContext(SecurityContext.BROKER_SECURITY_CONTEXT);
         return context;
     }
     

Added: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/AuthorizationFromAdminViewTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/AuthorizationFromAdminViewTest.java?rev=1026092&view=auto
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/AuthorizationFromAdminViewTest.java
(added)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/AuthorizationFromAdminViewTest.java
Thu Oct 21 18:17:42 2010
@@ -0,0 +1,55 @@
+/* 
+ * AuthorizationFromAdminViewTest 
+ * Date: Oct 21, 2010 
+ * Copyright: Sony BMG 
+ * Created by: baraza 
+ */
+package org.apache.activemq.usecases;
+
+import org.apache.activemq.ActiveMQConnectionFactory;
+import org.apache.activemq.broker.BrokerFactory;
+import org.apache.activemq.broker.BrokerPlugin;
+import org.apache.activemq.broker.BrokerService;
+import org.apache.activemq.security.AuthorizationPlugin;
+import org.apache.activemq.security.SimpleAuthorizationMap;
+
+public class AuthorizationFromAdminViewTest extends org.apache.activemq.TestSupport {
+
+    private BrokerService broker;
+
+    protected ActiveMQConnectionFactory createConnectionFactory() throws Exception {
+        return new ActiveMQConnectionFactory("vm://" + getName());
+    }
+
+    protected void setUp() throws Exception {
+        createBroker();
+        super.setUp();
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+        destroyBroker();
+    }
+
+    private void createBroker() throws Exception {
+        broker = BrokerFactory.createBroker("broker:(vm://localhost)");
+        broker.setPersistent(false);
+        broker.setBrokerName(getName());
+
+        AuthorizationPlugin plugin = new AuthorizationPlugin();
+        plugin.setMap(new SimpleAuthorizationMap());
+        BrokerPlugin[] plugins = new BrokerPlugin[] {plugin};
+        broker.setPlugins(plugins);
+
+        broker.start();
+    }
+
+    private void destroyBroker() throws Exception {
+        if (broker != null)
+            broker.stop();
+    }
+
+    public void testAuthorizationFromAdminView() throws Exception {
+        broker.getAdminView().addQueue(getDestinationString());
+    }
+}

Propchange: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/AuthorizationFromAdminViewTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/AuthorizationFromAdminViewTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date



Mime
View raw message