You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by or...@apache.org on 2013/04/26 19:09:58 UTC

svn commit: r1476298 - in /qpid/branches/0.22/qpid/java: ./ broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/ broker-plugins/management-http/src/main/java/resources/ broker-plugins/management-http/src/main/java/reso...

Author: orudyy
Date: Fri Apr 26 17:09:56 2013
New Revision: 1476298

URL: http://svn.apache.org/r1476298
Log:
QPID-4777: Add UI to view and edit web management configuration
    
merged from trunk r1476288


Added:
    qpid/branches/0.22/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Plugin.js
      - copied unchanged from r1476288, qpid/trunk/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Plugin.js
    qpid/branches/0.22/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/plugin/
      - copied from r1476288, qpid/trunk/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/plugin/
    qpid/branches/0.22/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/plugin/managementhttp.js
      - copied unchanged from r1476288, qpid/trunk/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/plugin/managementhttp.js
    qpid/branches/0.22/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/plugin/managementjmx.js
      - copied unchanged from r1476288, qpid/trunk/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/plugin/managementjmx.js
    qpid/branches/0.22/qpid/java/broker-plugins/management-http/src/main/java/resources/plugin/
      - copied from r1476288, qpid/trunk/qpid/java/broker-plugins/management-http/src/main/java/resources/plugin/
    qpid/branches/0.22/qpid/java/broker-plugins/management-http/src/main/java/resources/plugin/showManagementHttp.html
      - copied unchanged from r1476288, qpid/trunk/qpid/java/broker-plugins/management-http/src/main/java/resources/plugin/showManagementHttp.html
    qpid/branches/0.22/qpid/java/broker-plugins/management-http/src/main/java/resources/plugin/showManagementJmx.html
      - copied unchanged from r1476288, qpid/trunk/qpid/java/broker-plugins/management-http/src/main/java/resources/plugin/showManagementJmx.html
    qpid/branches/0.22/qpid/java/broker-plugins/management-http/src/main/java/resources/showPlugin.html
      - copied unchanged from r1476288, qpid/trunk/qpid/java/broker-plugins/management-http/src/main/java/resources/showPlugin.html
    qpid/branches/0.22/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/HttpManagementRestTest.java
      - copied unchanged from r1476288, qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/HttpManagementRestTest.java
Modified:
    qpid/branches/0.22/qpid/java/   (props changed)
    qpid/branches/0.22/qpid/java/broker/   (props changed)
    qpid/branches/0.22/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java
    qpid/branches/0.22/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/controller.js
    qpid/branches/0.22/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/treeView.js
    qpid/branches/0.22/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/HttpManagementFactoryTest.java
    qpid/branches/0.22/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/HttpManagementTest.java
    qpid/branches/0.22/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/JMXManagement.java
    qpid/branches/0.22/qpid/java/broker/src/main/java/org/apache/qpid/server/model/adapter/AbstractPluginAdapter.java
    qpid/branches/0.22/qpid/java/build.xml
    qpid/branches/0.22/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/AccessControlProviderRestTest.java
    qpid/branches/0.22/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/AnonymousAccessRestTest.java
    qpid/branches/0.22/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BasicAuthRestTest.java
    qpid/branches/0.22/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/QpidRestTestCase.java
    qpid/branches/0.22/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/BrokerACLTest.java
    qpid/branches/0.22/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/GroupRestACLTest.java
    qpid/branches/0.22/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/UserRestACLTest.java

Propchange: qpid/branches/0.22/qpid/java/
------------------------------------------------------------------------------
  Merged /qpid/trunk/qpid/java:r1476288

Propchange: qpid/branches/0.22/qpid/java/broker/
------------------------------------------------------------------------------
  Merged /qpid/trunk/qpid/java/broker:r1476288

Modified: qpid/branches/0.22/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.22/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java?rev=1476298&r1=1476297&r2=1476298&view=diff
==============================================================================
--- qpid/branches/0.22/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java (original)
+++ qpid/branches/0.22/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java Fri Apr 26 17:09:56 2013
@@ -138,15 +138,11 @@ public class HttpManagement extends Abst
         put(PluginFactory.PLUGIN_TYPE, String.class);
     }});
 
-    private final Broker _broker;
-
     private Server _server;
 
     public HttpManagement(UUID id, Broker broker, Map<String, Object> attributes)
     {
-        super(id, DEFAULTS, MapValueConverter.convert(attributes, ATTRIBUTE_TYPES), broker.getTaskExecutor());
-        _broker = broker;
-        addParent(Broker.class, broker);
+        super(id, DEFAULTS, MapValueConverter.convert(attributes, ATTRIBUTE_TYPES), broker);
     }
 
     @Override
@@ -169,7 +165,7 @@ public class HttpManagement extends Abst
     {
         CurrentActor.get().message(ManagementConsoleMessages.STARTUP(OPERATIONAL_LOGGING_NAME));
 
-        Collection<Port> httpPorts = getHttpPorts(_broker.getPorts());
+        Collection<Port> httpPorts = getHttpPorts(getBroker().getPorts());
         _server = createServer(httpPorts);
         try
         {
@@ -195,7 +191,7 @@ public class HttpManagement extends Abst
             }
             catch (Exception e)
             {
-                throw new RuntimeException("Failed to stop http management on port " + getHttpPorts(_broker.getPorts()));
+                throw new RuntimeException("Failed to stop http management on port " + getHttpPorts(getBroker().getPorts()));
             }
         }
 
@@ -203,12 +199,6 @@ public class HttpManagement extends Abst
     }
 
     /** Added for testing purposes */
-    Broker getBroker()
-    {
-        return _broker;
-    }
-
-    /** Added for testing purposes */
     int getSessionTimeout()
     {
         return (Integer)getAttribute(TIME_OUT);
@@ -272,7 +262,7 @@ public class HttpManagement extends Abst
         server.setHandler(root);
 
         // set servlet context attributes for broker and configuration
-        root.getServletContext().setAttribute(HttpManagementUtil.ATTR_BROKER, _broker);
+        root.getServletContext().setAttribute(HttpManagementUtil.ATTR_BROKER, getBroker());
         root.getServletContext().setAttribute(HttpManagementUtil.ATTR_MANAGEMENT_CONFIGURATION, this);
 
         FilterHolder restAuthorizationFilter = new FilterHolder(new ForbiddingAuthorisationFilter());
@@ -297,6 +287,7 @@ public class HttpManagement extends Abst
         addRestServlet(root, "session", VirtualHost.class, Connection.class, Session.class);
         addRestServlet(root, "keystore", KeyStore.class);
         addRestServlet(root, "truststore", TrustStore.class);
+        addRestServlet(root, "plugin", Plugin.class);
 
         root.addServlet(new ServletHolder(new StructureServlet()), "/rest/structure");
         root.addServlet(new ServletHolder(new MessageServlet()), "/rest/message/*");
@@ -438,7 +429,7 @@ public class HttpManagement extends Abst
     @Override
     public SubjectCreator getSubjectCreator(SocketAddress localAddress)
     {
-        return _broker.getSubjectCreator(localAddress);
+        return getBroker().getSubjectCreator(localAddress);
     }
 
 }

Modified: qpid/branches/0.22/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/controller.js
URL: http://svn.apache.org/viewvc/qpid/branches/0.22/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/controller.js?rev=1476298&r1=1476297&r2=1476298&view=diff
==============================================================================
--- qpid/branches/0.22/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/controller.js (original)
+++ qpid/branches/0.22/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/controller.js Fri Apr 26 17:09:56 2013
@@ -33,16 +33,19 @@ define(["dojo/dom",
         "qpid/management/TrustStore",
         "qpid/management/AccessControlProvider",
         "qpid/management/Port",
+        "qpid/management/Plugin",
         "dojo/ready",
         "dojo/domReady!"],
-       function (dom, registry, ContentPane, Broker, VirtualHost, Exchange, Queue, Connection, AuthProvider, GroupProvider, Group, KeyStore, TrustStore, AccessControlProvider, Port, ready) {
+       function (dom, registry, ContentPane, Broker, VirtualHost, Exchange, Queue, Connection, AuthProvider,
+                 GroupProvider, Group, KeyStore, TrustStore, AccessControlProvider, Port, Plugin, ready) {
            var controller = {};
 
            var constructors = { broker: Broker, virtualhost: VirtualHost, exchange: Exchange,
                                 queue: Queue, connection: Connection,
                                 authenticationprovider: AuthProvider, groupprovider: GroupProvider,
                                 group: Group, keystore: KeyStore, truststore: TrustStore,
-                                accesscontrolprovider: AccessControlProvider, port: Port};
+                                accesscontrolprovider: AccessControlProvider, port: Port,
+                                plugin: Plugin};
 
            var tabDiv = dom.byId("managedViews");
 

Modified: qpid/branches/0.22/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/treeView.js
URL: http://svn.apache.org/viewvc/qpid/branches/0.22/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/treeView.js?rev=1476298&r1=1476297&r2=1476298&view=diff
==============================================================================
--- qpid/branches/0.22/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/treeView.js (original)
+++ qpid/branches/0.22/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/treeView.js Fri Apr 26 17:09:56 2013
@@ -282,6 +282,8 @@ define(["dojo/_base/xhr",
                  controller.show("truststore", details.truststore, {broker: {type:"broker", name:""}});
                } else if (details.type == 'accesscontrolprovider') {
                  controller.show("accesscontrolprovider", details.accesscontrolprovider, {broker: {type:"broker", name:""}});
+               } else if (details.type == 'plugin') {
+                 controller.show("plugin", details.plugin, {broker: {type:"broker", name:""}});
                }
            };
 

Modified: qpid/branches/0.22/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/HttpManagementFactoryTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.22/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/HttpManagementFactoryTest.java?rev=1476298&r1=1476297&r2=1476298&view=diff
==============================================================================
--- qpid/branches/0.22/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/HttpManagementFactoryTest.java (original)
+++ qpid/branches/0.22/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/HttpManagementFactoryTest.java Fri Apr 26 17:09:56 2013
@@ -54,7 +54,7 @@ public class HttpManagementFactoryTest e
 
         HttpManagement management = (HttpManagement) _pluginFactory.createInstance(_id, _attributes, _broker);
 
-        assertEquals(_broker, management.getBroker());
+        assertEquals(_broker, management.getParent(Broker.class));
         assertEquals(SESSION_TIMEOUT, management.getSessionTimeout());
     }
 

Modified: qpid/branches/0.22/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/HttpManagementTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.22/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/HttpManagementTest.java?rev=1476298&r1=1476297&r2=1476298&view=diff
==============================================================================
--- qpid/branches/0.22/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/HttpManagementTest.java (original)
+++ qpid/branches/0.22/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/HttpManagementTest.java Fri Apr 26 17:09:56 2013
@@ -55,11 +55,6 @@ public class HttpManagementTest extends 
         _management = new HttpManagement(_id, _broker, attributes);
     }
 
-    public void testGetBroker()
-    {
-        assertEquals("Unexpected broker", _broker, _management.getBroker());
-    }
-
     public void testGetSessionTimeout()
     {
         assertEquals("Unexpected session timeout", 10000l, _management.getSessionTimeout());

Modified: qpid/branches/0.22/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/JMXManagement.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.22/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/JMXManagement.java?rev=1476298&r1=1476297&r2=1476298&view=diff
==============================================================================
--- qpid/branches/0.22/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/JMXManagement.java (original)
+++ qpid/branches/0.22/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/JMXManagement.java Fri Apr 26 17:09:56 2013
@@ -89,16 +89,13 @@ public class JMXManagement extends Abstr
         put(PluginFactory.PLUGIN_TYPE, String.class);
     }};
 
-    private final Broker _broker;
     private JMXManagedObjectRegistry _objectRegistry;
 
     private final Map<ConfiguredObject, AMQManagedObject> _children = new HashMap<ConfiguredObject, AMQManagedObject>();
 
     public JMXManagement(UUID id, Broker broker, Map<String, Object> attributes)
     {
-        super(id, DEFAULTS, MapValueConverter.convert(attributes, ATTRIBUTE_TYPES), broker.getTaskExecutor());
-        _broker = broker;
-        addParent(Broker.class, broker);
+        super(id, DEFAULTS, MapValueConverter.convert(attributes, ATTRIBUTE_TYPES), broker);
     }
 
     @Override
@@ -130,9 +127,10 @@ public class JMXManagement extends Abstr
 
     private void start() throws JMException, IOException
     {
+        Broker broker = getBroker();
         Port connectorPort = null;
         Port registryPort = null;
-        Collection<Port> ports = _broker.getPorts();
+        Collection<Port> ports = broker.getPorts();
         for (Port port : ports)
         {
             if (State.QUIESCED.equals(port.getActualState()))
@@ -158,13 +156,13 @@ public class JMXManagement extends Abstr
             throw new IllegalStateException("No JMX RMI port found supporting protocol " + Protocol.RMI);
         }
 
-        _objectRegistry = new JMXManagedObjectRegistry(_broker, connectorPort, registryPort, this);
+        _objectRegistry = new JMXManagedObjectRegistry(broker, connectorPort, registryPort, this);
 
-        _broker.addChangeListener(this);
+        broker.addChangeListener(this);
 
         synchronized (_children)
         {
-            for(VirtualHost virtualHost : _broker.getVirtualHosts())
+            for(VirtualHost virtualHost : broker.getVirtualHosts())
             {
                 if(!_children.containsKey(virtualHost))
                 {
@@ -181,7 +179,7 @@ public class JMXManagement extends Abstr
                     createAdditionalMBeansFromProviders(virtualHost, mbean);
                 }
             }
-            Collection<AuthenticationProvider> authenticationProviders = _broker.getAuthenticationProviders();
+            Collection<AuthenticationProvider> authenticationProviders = broker.getAuthenticationProviders();
             for (AuthenticationProvider authenticationProvider : authenticationProviders)
             {
                 if(authenticationProvider instanceof PasswordCredentialManagingAuthenticationProvider)
@@ -194,7 +192,7 @@ public class JMXManagement extends Abstr
             }
         }
         new Shutdown(_objectRegistry);
-        new ServerInformationMBean(_objectRegistry, _broker);
+        new ServerInformationMBean(_objectRegistry, broker);
         if (LoggingManagementFacade.getCurrentInstance() != null)
         {
             new LoggingManagementMBean(LoggingManagementFacade.getCurrentInstance(), _objectRegistry);
@@ -234,7 +232,7 @@ public class JMXManagement extends Abstr
             }
             _children.clear();
         }
-        _broker.removeChangeListener(this);
+        getBroker().removeChangeListener(this);
         _objectRegistry.close();
     }
 
@@ -352,12 +350,6 @@ public class JMXManagement extends Abstr
         }
     }
 
-    /** Added for testing purposes */
-    Broker getBroker()
-    {
-        return _broker;
-    }
-
     @Override
     public String getName()
     {

Modified: qpid/branches/0.22/qpid/java/broker/src/main/java/org/apache/qpid/server/model/adapter/AbstractPluginAdapter.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.22/qpid/java/broker/src/main/java/org/apache/qpid/server/model/adapter/AbstractPluginAdapter.java?rev=1476298&r1=1476297&r2=1476298&view=diff
==============================================================================
--- qpid/branches/0.22/qpid/java/broker/src/main/java/org/apache/qpid/server/model/adapter/AbstractPluginAdapter.java (original)
+++ qpid/branches/0.22/qpid/java/broker/src/main/java/org/apache/qpid/server/model/adapter/AbstractPluginAdapter.java Fri Apr 26 17:09:56 2013
@@ -26,19 +26,23 @@ import java.util.Collections;
 import java.util.Map;
 import java.util.UUID;
 
-import org.apache.qpid.server.configuration.updater.TaskExecutor;
+import org.apache.qpid.server.model.Broker;
 import org.apache.qpid.server.model.ConfiguredObject;
 import org.apache.qpid.server.model.LifetimePolicy;
 import org.apache.qpid.server.model.Plugin;
 import org.apache.qpid.server.model.State;
 import org.apache.qpid.server.model.Statistics;
+import org.apache.qpid.server.security.access.Operation;
 
 public abstract class AbstractPluginAdapter extends AbstractAdapter implements Plugin
 {
+    private Broker _broker;
 
-    protected AbstractPluginAdapter(UUID id, Map<String, Object> defaults, Map<String, Object> attributes, TaskExecutor taskExecutor)
+    protected AbstractPluginAdapter(UUID id, Map<String, Object> defaults, Map<String, Object> attributes, Broker broker)
     {
-        super(id, defaults, attributes, taskExecutor);
+        super(id, defaults, attributes, broker.getTaskExecutor());
+        _broker = broker;
+        addParent(Broker.class, broker);
     }
 
     @Override
@@ -104,13 +108,6 @@ public abstract class AbstractPluginAdap
     }
 
     @Override
-    public <C extends ConfiguredObject> C createChild(Class<C> childClass, Map<String, Object> attributes,
-            ConfiguredObject... otherParents)
-    {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
     public Collection<String> getAttributeNames()
     {
         return AVAILABLE_ATTRIBUTES;
@@ -149,4 +146,46 @@ public abstract class AbstractPluginAdap
         }
         return super.getAttribute(name);
     }
+
+    @Override
+    public <C extends ConfiguredObject> C createChild(Class<C> childClass, Map<String, Object> attributes,
+            ConfiguredObject... otherParents)
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    protected void authoriseSetDesiredState(State currentState, State desiredState) throws AccessControlException
+    {
+        if(desiredState == State.DELETED)
+        {
+            if (!_broker.getSecurityManager().authoriseConfiguringBroker(getName(), Plugin.class, Operation.DELETE))
+            {
+                throw new AccessControlException("Deletion of plugin is denied");
+            }
+        }
+    }
+
+    @Override
+    protected void authoriseSetAttribute(String name, Object expected, Object desired) throws AccessControlException
+    {
+        if (!_broker.getSecurityManager().authoriseConfiguringBroker(getName(), Plugin.class, Operation.UPDATE))
+        {
+            throw new AccessControlException("Setting of plugin attribute is denied");
+        }
+    }
+
+    @Override
+    protected void authoriseSetAttributes(Map<String, Object> attributes) throws AccessControlException
+    {
+        if (!_broker.getSecurityManager().authoriseConfiguringBroker(getName(), Plugin.class, Operation.UPDATE))
+        {
+            throw new AccessControlException("Setting of plugin attributes is denied");
+        }
+    }
+
+    protected Broker getBroker()
+    {
+        return _broker;
+    }
 }

Modified: qpid/branches/0.22/qpid/java/build.xml
URL: http://svn.apache.org/viewvc/qpid/branches/0.22/qpid/java/build.xml?rev=1476298&r1=1476297&r2=1476298&view=diff
==============================================================================
--- qpid/branches/0.22/qpid/java/build.xml (original)
+++ qpid/branches/0.22/qpid/java/build.xml Fri Apr 26 17:09:56 2013
@@ -37,7 +37,7 @@
   <property name="modules.plugin"     value="${broker-plugins} ${client-plugins}"/>
   <property name="modules.jca"        value="jca"/>
   <property name="modules"            value="${modules.core} ${modules.examples}
-   ${modules.jca} ${modules.tests} ${modules.plugin} ${modules.opt}"/>
+   ${modules.jca} ${modules.plugin} ${modules.tests} ${modules.opt}"/>
 
   <property name="qpid.jar"           location="${build.lib}/qpid-all.jar"/>
   <basename property="qpid.jar.name"  file="${qpid.jar}"/>

Modified: qpid/branches/0.22/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/AccessControlProviderRestTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.22/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/AccessControlProviderRestTest.java?rev=1476298&r1=1476297&r2=1476298&view=diff
==============================================================================
--- qpid/branches/0.22/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/AccessControlProviderRestTest.java (original)
+++ qpid/branches/0.22/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/AccessControlProviderRestTest.java Fri Apr 26 17:09:56 2013
@@ -27,6 +27,7 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.commons.configuration.ConfigurationException;
+import org.apache.qpid.server.management.plugin.HttpManagement;
 import org.apache.qpid.server.model.AccessControlProvider;
 import org.apache.qpid.server.security.access.FileAccessControlProviderConstants;
 import org.apache.qpid.test.utils.TestBrokerConfiguration;
@@ -56,7 +57,7 @@ public class AccessControlProviderRestTe
         getRestTestHelper().configureTemporaryPasswordFile(this, ALLOWED_USER, DENIED_USER, OTHER_USER);
 
         getBrokerConfiguration().setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT,
-                "httpBasicAuthenticationEnabled", true);
+                HttpManagement.HTTP_BASIC_AUTHENTICATION_ENABLED, true);
     }
 
     public void testCreateAccessControlProvider() throws Exception

Modified: qpid/branches/0.22/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/AnonymousAccessRestTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.22/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/AnonymousAccessRestTest.java?rev=1476298&r1=1476297&r2=1476298&view=diff
==============================================================================
--- qpid/branches/0.22/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/AnonymousAccessRestTest.java (original)
+++ qpid/branches/0.22/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/AnonymousAccessRestTest.java Fri Apr 26 17:09:56 2013
@@ -5,6 +5,7 @@ import java.util.HashMap;
 import java.util.Map;
 
 import org.apache.commons.configuration.ConfigurationException;
+import org.apache.qpid.server.management.plugin.HttpManagement;
 import org.apache.qpid.server.model.AuthenticationProvider;
 import org.apache.qpid.server.model.Broker;
 import org.apache.qpid.server.model.Port;
@@ -39,7 +40,7 @@ public class AnonymousAccessRestTest ext
         // set anonymous authentication provider on http port for the tests
         config.setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_HTTP_PORT, Port.AUTHENTICATION_PROVIDER,
                 TestBrokerConfiguration.ENTRY_NAME_ANONYMOUS_PROVIDER);
-        config.setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT, "httpBasicAuthenticationEnabled", false);
+        config.setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT, HttpManagement.HTTP_BASIC_AUTHENTICATION_ENABLED, false);
 
         // reset credentials
         getRestTestHelper().setUsernameAndPassword(null, null);

Modified: qpid/branches/0.22/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BasicAuthRestTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.22/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BasicAuthRestTest.java?rev=1476298&r1=1476297&r2=1476298&view=diff
==============================================================================
--- qpid/branches/0.22/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BasicAuthRestTest.java (original)
+++ qpid/branches/0.22/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BasicAuthRestTest.java Fri Apr 26 17:09:56 2013
@@ -30,6 +30,7 @@ import java.util.Collections;
 import javax.servlet.http.HttpServletResponse;
 
 import org.apache.commons.configuration.ConfigurationException;
+import org.apache.qpid.server.management.plugin.HttpManagement;
 import org.apache.qpid.server.model.Port;
 import org.apache.qpid.server.model.Protocol;
 import org.apache.qpid.test.utils.TestBrokerConfiguration;
@@ -86,7 +87,7 @@ public class BasicAuthRestTest extends Q
     public void testBasicAuthWhenDisabledWithHttp() throws Exception
     {
         configure(false);
-        getBrokerConfiguration().setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT, "httpBasicAuthenticationEnabled", false);
+        getBrokerConfiguration().setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT, HttpManagement.HTTP_BASIC_AUTHENTICATION_ENABLED, false);
         super.setUp();
 
         // Try the attempt with authentication, it should fail because
@@ -99,7 +100,7 @@ public class BasicAuthRestTest extends Q
     {
         configure(false);
 
-        getBrokerConfiguration().setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT, "httpBasicAuthenticationEnabled", true);
+        getBrokerConfiguration().setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT, HttpManagement.HTTP_BASIC_AUTHENTICATION_ENABLED, true);
         super.setUp();
 
         // Try the attempt with authentication, it should succeed because

Modified: qpid/branches/0.22/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/QpidRestTestCase.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.22/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/QpidRestTestCase.java?rev=1476298&r1=1476297&r2=1476298&view=diff
==============================================================================
--- qpid/branches/0.22/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/QpidRestTestCase.java (original)
+++ qpid/branches/0.22/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/QpidRestTestCase.java Fri Apr 26 17:09:56 2013
@@ -25,6 +25,7 @@ import java.util.HashMap;
 import java.util.Map;
 
 import org.apache.commons.configuration.ConfigurationException;
+import org.apache.qpid.server.management.plugin.HttpManagement;
 import org.apache.qpid.server.model.AuthenticationProvider;
 import org.apache.qpid.server.model.Port;
 import org.apache.qpid.server.security.auth.manager.AnonymousAuthenticationManagerFactory;
@@ -98,7 +99,7 @@ public class QpidRestTestCase extends Qp
         // set password authentication provider on http port for the tests
         config.setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_HTTP_PORT, Port.AUTHENTICATION_PROVIDER,
                 TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER);
-        config.setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT, "httpBasicAuthenticationEnabled", true);
+        config.setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT, HttpManagement.HTTP_BASIC_AUTHENTICATION_ENABLED, true);
     }
 
     public RestTestHelper getRestTestHelper()

Modified: qpid/branches/0.22/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/BrokerACLTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.22/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/BrokerACLTest.java?rev=1476298&r1=1476297&r2=1476298&view=diff
==============================================================================
--- qpid/branches/0.22/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/BrokerACLTest.java (original)
+++ qpid/branches/0.22/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/BrokerACLTest.java Fri Apr 26 17:09:56 2013
@@ -28,6 +28,7 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.commons.configuration.ConfigurationException;
+import org.apache.qpid.server.management.plugin.HttpManagement;
 import org.apache.qpid.server.model.AccessControlProvider;
 import org.apache.qpid.server.model.AuthenticationProvider;
 import org.apache.qpid.server.model.Broker;
@@ -74,7 +75,7 @@ public class BrokerACLTest extends QpidR
                 "ACL DENY-LOG ALL ALL";
 
         getBrokerConfiguration().setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT,
-                "httpBasicAuthenticationEnabled", true);
+                HttpManagement.HTTP_BASIC_AUTHENTICATION_ENABLED, true);
     }
 
     /* === AuthenticationProvider === */
@@ -877,6 +878,63 @@ public class BrokerACLTest extends QpidR
         assertEquals("Setting of access control provider attributes should be denied", 403, responseCode);
     }
 
+    /* === HTTP management === */
+
+    public void testSetHttpManagementAttributesAllowed() throws Exception
+    {
+        getRestTestHelper().setUsernameAndPassword(ALLOWED_USER, ALLOWED_USER);
+
+        Map<String, Object> attributes = new HashMap<String, Object>();
+        attributes.put(HttpManagement.NAME, TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT);
+        attributes.put(HttpManagement.HTTPS_BASIC_AUTHENTICATION_ENABLED, false);
+        attributes.put(HttpManagement.HTTPS_SASL_AUTHENTICATION_ENABLED, false);
+        attributes.put(HttpManagement.HTTP_SASL_AUTHENTICATION_ENABLED, false);
+        attributes.put(HttpManagement.TIME_OUT, 10000);
+
+        int responseCode = getRestTestHelper().submitRequest(
+                "/rest/plugin/" + TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT, "PUT", attributes);
+        assertEquals("Setting of http management should be allowed", 200, responseCode);
+
+        Map<String, Object> details = getRestTestHelper().getJsonAsSingletonList(
+                "/rest/plugin/" + TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT);
+
+        assertEquals("Unexpected session timeout", 10000, details.get(HttpManagement.TIME_OUT));
+        assertEquals("Unexpected http basic auth enabled", true, details.get(HttpManagement.HTTP_BASIC_AUTHENTICATION_ENABLED));
+        assertEquals("Unexpected https basic auth enabled", false, details.get(HttpManagement.HTTPS_BASIC_AUTHENTICATION_ENABLED));
+        assertEquals("Unexpected http sasl auth enabled", false, details.get(HttpManagement.HTTP_SASL_AUTHENTICATION_ENABLED));
+        assertEquals("Unexpected https sasl auth enabled", false, details.get(HttpManagement.HTTPS_SASL_AUTHENTICATION_ENABLED));
+    }
+
+    public void testSetHttpManagementAttributesDenied() throws Exception
+    {
+        getRestTestHelper().setUsernameAndPassword(DENIED_USER, DENIED_USER);
+
+        Map<String, Object> attributes = new HashMap<String, Object>();
+        attributes.put(HttpManagement.NAME, TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT);
+        attributes.put(HttpManagement.HTTPS_BASIC_AUTHENTICATION_ENABLED, false);
+        attributes.put(HttpManagement.HTTPS_SASL_AUTHENTICATION_ENABLED, false);
+        attributes.put(HttpManagement.HTTP_SASL_AUTHENTICATION_ENABLED, false);
+        attributes.put(HttpManagement.TIME_OUT, 10000);
+
+        int responseCode = getRestTestHelper().submitRequest(
+                "/rest/plugin/" + TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT, "PUT", attributes);
+        assertEquals("Setting of http management should be denied", 403, responseCode);
+
+        Map<String, Object> details = getRestTestHelper().getJsonAsSingletonList(
+                "/rest/plugin/" + TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT);
+
+        assertEquals("Unexpected session timeout", HttpManagement.DEFAULT_TIMEOUT_IN_SECONDS,
+                details.get(HttpManagement.TIME_OUT));
+        assertEquals("Unexpected http basic auth enabled", true,
+                details.get(HttpManagement.HTTP_BASIC_AUTHENTICATION_ENABLED));
+        assertEquals("Unexpected https basic auth enabled", HttpManagement.DEFAULT_HTTPS_BASIC_AUTHENTICATION_ENABLED,
+                details.get(HttpManagement.HTTPS_BASIC_AUTHENTICATION_ENABLED));
+        assertEquals("Unexpected http sasl auth enabled", HttpManagement.DEFAULT_HTTP_SASL_AUTHENTICATION_ENABLED,
+                details.get(HttpManagement.HTTP_SASL_AUTHENTICATION_ENABLED));
+        assertEquals("Unexpected https sasl auth enabled", HttpManagement.DEFAULT_HTTPS_SASL_AUTHENTICATION_ENABLED,
+                details.get(HttpManagement.HTTPS_SASL_AUTHENTICATION_ENABLED));
+    }
+
     /* === Utility Methods === */
 
     private int createPort(String portName) throws Exception

Modified: qpid/branches/0.22/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/GroupRestACLTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.22/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/GroupRestACLTest.java?rev=1476298&r1=1476297&r2=1476298&view=diff
==============================================================================
--- qpid/branches/0.22/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/GroupRestACLTest.java (original)
+++ qpid/branches/0.22/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/GroupRestACLTest.java Fri Apr 26 17:09:56 2013
@@ -29,6 +29,7 @@ import java.util.Properties;
 import javax.servlet.http.HttpServletResponse;
 
 import org.apache.commons.configuration.ConfigurationException;
+import org.apache.qpid.server.management.plugin.HttpManagement;
 import org.apache.qpid.server.security.acl.AbstractACLTestCase;
 import org.apache.qpid.systest.rest.QpidRestTestCase;
 import org.apache.qpid.test.utils.TestBrokerConfiguration;
@@ -60,7 +61,7 @@ public class GroupRestACLTest extends Qp
     protected void customizeConfiguration() throws ConfigurationException, IOException
     {
         super.customizeConfiguration();
-        getBrokerConfiguration().setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT, "httpBasicAuthenticationEnabled", true);
+        getBrokerConfiguration().setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT, HttpManagement.HTTP_BASIC_AUTHENTICATION_ENABLED, true);
     }
 
     @Override

Modified: qpid/branches/0.22/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/UserRestACLTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.22/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/UserRestACLTest.java?rev=1476298&r1=1476297&r2=1476298&view=diff
==============================================================================
--- qpid/branches/0.22/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/UserRestACLTest.java (original)
+++ qpid/branches/0.22/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/UserRestACLTest.java Fri Apr 26 17:09:56 2013
@@ -29,6 +29,7 @@ import java.util.Properties;
 import javax.servlet.http.HttpServletResponse;
 
 import org.apache.commons.configuration.ConfigurationException;
+import org.apache.qpid.server.management.plugin.HttpManagement;
 import org.apache.qpid.server.security.acl.AbstractACLTestCase;
 import org.apache.qpid.systest.rest.QpidRestTestCase;
 import org.apache.qpid.test.utils.TestBrokerConfiguration;
@@ -62,7 +63,7 @@ public class UserRestACLTest extends Qpi
     protected void customizeConfiguration() throws ConfigurationException, IOException
     {
         super.customizeConfiguration();
-        getBrokerConfiguration().setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT, "httpBasicAuthenticationEnabled", true);
+        getBrokerConfiguration().setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT, HttpManagement.HTTP_BASIC_AUTHENTICATION_ENABLED, true);
     }
 
     @Override



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org