qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgodf...@apache.org
Subject svn commit: r1632579 [2/3] - in /qpid/branches/QPID-6125-ProtocolRefactoring/java: ./ amqp-1-0-client-websocket/src/main/java/org/apache/qpid/amqp_1_0/client/websocket/ amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/client/ amqp-1-0-common/src/...
Date Fri, 17 Oct 2014 13:58:07 GMT
Modified: qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/main/java/org/apache/qpid/server/store/BrokerStoreUpgraderAndRecoverer.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/main/java/org/apache/qpid/server/store/BrokerStoreUpgraderAndRecoverer.java?rev=1632579&r1=1632578&r2=1632579&view=diff
==============================================================================
--- qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/main/java/org/apache/qpid/server/store/BrokerStoreUpgraderAndRecoverer.java (original)
+++ qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/main/java/org/apache/qpid/server/store/BrokerStoreUpgraderAndRecoverer.java Fri Oct 17 13:58:04 2014
@@ -19,6 +19,7 @@
  *
  */
 package org.apache.qpid.server.store;
+
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
@@ -26,12 +27,15 @@ import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.UUID;
 
 import org.apache.qpid.server.configuration.IllegalConfigurationException;
 import org.apache.qpid.server.configuration.store.StoreConfigurationChangeListener;
 import org.apache.qpid.server.model.Broker;
 import org.apache.qpid.server.model.ConfiguredObject;
+import org.apache.qpid.server.model.Port;
 import org.apache.qpid.server.model.SystemConfig;
+import org.apache.qpid.server.model.VirtualHostAlias;
 import org.apache.qpid.server.util.Action;
 
 public class BrokerStoreUpgraderAndRecoverer
@@ -49,6 +53,7 @@ public class BrokerStoreUpgraderAndRecov
         register(new Upgrader_1_1_to_1_2());
         register(new Upgrader_1_2_to_1_3());
         register(new Upgrader_1_3_to_2_0());
+        register(new Upgrader_2_0_to_2_1());
     }
 
     private void register(StoreUpgraderPhase upgrader)
@@ -207,6 +212,71 @@ public class BrokerStoreUpgraderAndRecov
         }
 
     }
+    private class Upgrader_2_0_to_2_1 extends StoreUpgraderPhase
+    {
+        public Upgrader_2_0_to_2_1()
+        {
+            super("modelVersion", "2.0", "2.1");
+        }
+
+        @Override
+        public void configuredObject(ConfiguredObjectRecord record)
+        {
+            if(record.getType().equals("Port") && isAmqpPort(record.getAttributes()))
+            {
+                createAliasRecord(record, "nameAlias", "nameAlias");
+                createAliasRecord(record, "defaultAlias", "defaultAlias");
+                createAliasRecord(record, "hostnameAlias", "hostnameAlias");
+
+            }
+            else if(record.getType().equals("User") && "scram".equals(record.getAttributes().get("type")) )
+            {
+                Map<String, Object> updatedAttributes = new HashMap<String, Object>(record.getAttributes());
+                updatedAttributes.put("type", "managed");
+                record = new ConfiguredObjectRecordImpl(record.getId(), record.getType(), updatedAttributes, record.getParents());
+                getUpdateMap().put(record.getId(), record);
+            }
+            else if (record.getType().equals("Broker"))
+            {
+                record = upgradeRootRecord(record);
+            }
+
+            getNextUpgrader().configuredObject(record);
+        }
+
+        private boolean isAmqpPort(final Map<String, Object> attributes)
+        {
+            Object type = attributes.get(ConfiguredObject.TYPE);
+            Object protocols = attributes.get(Port.PROTOCOLS);
+            String protocolString = protocols == null ? null : protocols.toString();
+            return "AMQP".equals(type)
+                   || protocolString == null
+                   || !protocolString.matches(".*\\w.*")
+                   || protocolString.contains("AMQP");
+
+        }
+
+        private void createAliasRecord(ConfiguredObjectRecord parent, String name, String type)
+        {
+            Map<String,Object> attributes = new HashMap<>();
+            attributes.put(VirtualHostAlias.NAME, name);
+            attributes.put(VirtualHostAlias.TYPE, type);
+
+            final ConfiguredObjectRecord record = new ConfiguredObjectRecordImpl(UUID.randomUUID(),
+                                                                                 "VirtualHostAlias",
+                                                                                 attributes,
+                                                                                 Collections.singletonMap("Port", parent.getId()));
+            getUpdateMap().put(record.getId(), record);
+            getNextUpgrader().configuredObject(record);
+        }
+
+        @Override
+        public void complete()
+        {
+            getNextUpgrader().complete();
+        }
+
+    }
 
     private static class VirtualHostEntryUpgrader
     {

Modified: qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/main/java/org/apache/qpid/server/store/ConfiguredObjectRecordConverter.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/main/java/org/apache/qpid/server/store/ConfiguredObjectRecordConverter.java?rev=1632579&r1=1632578&r2=1632579&view=diff
==============================================================================
--- qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/main/java/org/apache/qpid/server/store/ConfiguredObjectRecordConverter.java (original)
+++ qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/main/java/org/apache/qpid/server/store/ConfiguredObjectRecordConverter.java Fri Oct 17 13:58:04 2014
@@ -98,7 +98,8 @@ public class ConfiguredObjectRecordConve
         for(Class<? extends ConfiguredObject> childClass : childClasses)
         {
             final String childType = childClass.getSimpleName();
-            String attrName = childType.toLowerCase() + "s";
+            String singularName = childType.toLowerCase();
+            String attrName = singularName + (singularName.endsWith("s") ? "es" : "s");
             Object children = data.remove(attrName);
             if(children != null)
             {

Modified: qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/main/java/org/apache/qpid/server/store/ConfiguredObjectRecordImpl.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/main/java/org/apache/qpid/server/store/ConfiguredObjectRecordImpl.java?rev=1632579&r1=1632578&r2=1632579&view=diff
==============================================================================
--- qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/main/java/org/apache/qpid/server/store/ConfiguredObjectRecordImpl.java (original)
+++ qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/main/java/org/apache/qpid/server/store/ConfiguredObjectRecordImpl.java Fri Oct 17 13:58:04 2014
@@ -79,7 +79,7 @@ public class ConfiguredObjectRecordImpl 
     @Override
     public String toString()
     {
-        return "ConfiguredObjectRecord [id=" + _id + ", type=" + _type + ", attributes=" + _attributes + "]";
+        return "ConfiguredObjectRecord [id=" + _id + ", type=" + _type + ", attributes=" + _attributes + ", parents=" + _parents + "]";
     }
 
     @Override

Modified: qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/main/java/org/apache/qpid/server/store/JsonFileConfigStore.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/main/java/org/apache/qpid/server/store/JsonFileConfigStore.java?rev=1632579&r1=1632578&r2=1632579&view=diff
==============================================================================
--- qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/main/java/org/apache/qpid/server/store/JsonFileConfigStore.java (original)
+++ qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/main/java/org/apache/qpid/server/store/JsonFileConfigStore.java Fri Oct 17 13:58:04 2014
@@ -445,7 +445,8 @@ public class JsonFileConfigStore impleme
             // only add if this is the "first" parent
             if(_parent.getModel().getParentTypes(childClass).iterator().next() == type)
             {
-                String attrName = childClass.getSimpleName().toLowerCase() + "s";
+                String singularName = childClass.getSimpleName().toLowerCase();
+                String attrName = singularName + (singularName.endsWith("s") ? "es" : "s");
                 List<UUID> childIds = _idsByType.get(childClass.getSimpleName());
                 if(childIds != null)
                 {

Modified: qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/main/java/org/apache/qpid/server/store/VirtualHostStoreUpgraderAndRecoverer.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/main/java/org/apache/qpid/server/store/VirtualHostStoreUpgraderAndRecoverer.java?rev=1632579&r1=1632578&r2=1632579&view=diff
==============================================================================
--- qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/main/java/org/apache/qpid/server/store/VirtualHostStoreUpgraderAndRecoverer.java (original)
+++ qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/main/java/org/apache/qpid/server/store/VirtualHostStoreUpgraderAndRecoverer.java Fri Oct 17 13:58:04 2014
@@ -61,6 +61,7 @@ public class VirtualHostStoreUpgraderAnd
         register(new Upgrader_0_2_to_0_3());
         register(new Upgrader_0_3_to_0_4());
         register(new Upgrader_0_4_to_2_0());
+        register(new Upgrader_2_0_to_2_1());
 
         Map<String, UUID> defaultExchangeIds = new HashMap<String, UUID>();
         for (String exchangeName : DEFAULT_EXCHANGES.keySet())
@@ -400,6 +401,32 @@ public class VirtualHostStoreUpgraderAnd
 
     }
 
+    private class Upgrader_2_0_to_2_1 extends StoreUpgraderPhase
+    {
+        public Upgrader_2_0_to_2_1()
+        {
+            super("modelVersion", "2.0", "2.1");
+        }
+
+        @Override
+        public void configuredObject(ConfiguredObjectRecord record)
+        {
+
+            if("VirtualHost".equals(record.getType()))
+            {
+                record = upgradeRootRecord(record);
+            }
+            getNextUpgrader().configuredObject(record);
+        }
+
+        @Override
+        public void complete()
+        {
+            getNextUpgrader().complete();
+        }
+
+    }
+
     public void perform(DurableConfigurationStore durableConfigurationStore)
     {
         String virtualHostCategory = VirtualHost.class.getSimpleName();

Modified: qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/main/java/org/apache/qpid/server/transport/TCPandSSLTransport.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/main/java/org/apache/qpid/server/transport/TCPandSSLTransport.java?rev=1632579&r1=1632578&r2=1632579&view=diff
==============================================================================
--- qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/main/java/org/apache/qpid/server/transport/TCPandSSLTransport.java (original)
+++ qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/main/java/org/apache/qpid/server/transport/TCPandSSLTransport.java Fri Oct 17 13:58:04 2014
@@ -42,13 +42,13 @@ class TCPandSSLTransport implements Acce
     private Set<Transport> _transports;
     private SSLContext _sslContext;
     private InetSocketAddress _bindingSocketAddress;
-    private Port<?> _port;
+    private AmqpPort<?> _port;
     private Set<Protocol> _supported;
     private Protocol _defaultSupportedProtocolReply;
 
     TCPandSSLTransport(final Set<Transport> transports,
                        final SSLContext sslContext,
-                       final Port<?> port,
+                       final AmqpPort<?> port,
                        final Set<Protocol> supported,
                        final Protocol defaultSupportedProtocolReply)
     {
@@ -62,12 +62,12 @@ class TCPandSSLTransport implements Acce
     @Override
     public void start()
     {
-        String bindingAddress = (String) _port.getAttribute(Port.BINDING_ADDRESS);
+        String bindingAddress = ((AmqpPort<?>)_port).getBindingAddress();
         if (WILDCARD_ADDRESS.equals(bindingAddress))
         {
             bindingAddress = null;
         }
-        Integer port = (Integer) _port.getAttribute(Port.PORT);
+        int port = _port.getPort();
         if ( bindingAddress == null )
         {
             _bindingSocketAddress = new InetSocketAddress(port);
@@ -91,6 +91,11 @@ class TCPandSSLTransport implements Acce
         _networkTransport.accept(settings, protocolEngineFactory, _transports.contains(Transport.TCP) ? null : _sslContext);
     }
 
+    public int getAcceptingPort()
+    {
+        return _networkTransport.getAcceptingPort();
+    }
+
     @Override
     public void close()
     {
@@ -106,31 +111,31 @@ class TCPandSSLTransport implements Acce
         @Override
         public boolean wantClientAuth()
         {
-            return (Boolean)_port.getAttribute(Port.WANT_CLIENT_AUTH);
+            return _port.getWantClientAuth();
         }
 
         @Override
         public boolean needClientAuth()
         {
-            return (Boolean)_port.getAttribute(Port.NEED_CLIENT_AUTH);
+            return _port.getNeedClientAuth();
         }
 
         @Override
         public Boolean getTcpNoDelay()
         {
-            return (Boolean)_port.getAttribute(Port.TCP_NO_DELAY);
+            return _port.isTcpNoDelay();
         }
 
         @Override
         public Integer getSendBufferSize()
         {
-            return (Integer)_port.getAttribute(AmqpPort.SEND_BUFFER_SIZE);
+            return _port.getSendBufferSize();
         }
 
         @Override
         public Integer getReceiveBufferSize()
         {
-            return (Integer)_port.getAttribute(AmqpPort.RECEIVE_BUFFER_SIZE);
+            return _port.getReceiveBufferSize();
         }
 
         @Override

Modified: qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/main/java/org/apache/qpid/server/transport/TCPandSSLTransportProvider.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/main/java/org/apache/qpid/server/transport/TCPandSSLTransportProvider.java?rev=1632579&r1=1632578&r2=1632579&view=diff
==============================================================================
--- qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/main/java/org/apache/qpid/server/transport/TCPandSSLTransportProvider.java (original)
+++ qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/main/java/org/apache/qpid/server/transport/TCPandSSLTransportProvider.java Fri Oct 17 13:58:04 2014
@@ -24,16 +24,16 @@ import java.util.Set;
 
 import javax.net.ssl.SSLContext;
 
-import org.apache.qpid.server.model.Port;
 import org.apache.qpid.server.model.Protocol;
 import org.apache.qpid.server.model.Transport;
+import org.apache.qpid.server.model.port.AmqpPort;
 
 class TCPandSSLTransportProvider implements TransportProvider
 {
     @Override
     public AcceptingTransport createTransport(final Set<Transport> transports,
                                               final SSLContext sslContext,
-                                              final Port port,
+                                              final AmqpPort<?> port,
                                               final Set<Protocol> supported,
                                               final Protocol defaultSupportedProtocolReply)
     {

Modified: qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/main/java/org/apache/qpid/server/transport/TransportProvider.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/main/java/org/apache/qpid/server/transport/TransportProvider.java?rev=1632579&r1=1632578&r2=1632579&view=diff
==============================================================================
--- qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/main/java/org/apache/qpid/server/transport/TransportProvider.java (original)
+++ qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/main/java/org/apache/qpid/server/transport/TransportProvider.java Fri Oct 17 13:58:04 2014
@@ -24,15 +24,15 @@ import java.util.Set;
 
 import javax.net.ssl.SSLContext;
 
-import org.apache.qpid.server.model.Port;
 import org.apache.qpid.server.model.Protocol;
 import org.apache.qpid.server.model.Transport;
+import org.apache.qpid.server.model.port.AmqpPort;
 
 public interface TransportProvider
 {
     AcceptingTransport createTransport(Set<Transport> transports,
                                        SSLContext sslContext,
-                                       Port port,
+                                       AmqpPort<?> port,
                                        Set<Protocol> supported,
                                        Protocol defaultSupportedProtocolReply);
 }

Modified: qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java?rev=1632579&r1=1632578&r2=1632579&view=diff
==============================================================================
--- qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java (original)
+++ qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java Fri Oct 17 13:58:04 2014
@@ -60,7 +60,6 @@ import org.apache.qpid.server.message.Me
 import org.apache.qpid.server.message.ServerMessage;
 import org.apache.qpid.server.model.*;
 import org.apache.qpid.server.model.adapter.ConnectionAdapter;
-import org.apache.qpid.server.model.adapter.VirtualHostAliasAdapter;
 import org.apache.qpid.server.plugin.QpidServiceLoader;
 import org.apache.qpid.server.plugin.SystemNodeCreator;
 import org.apache.qpid.server.protocol.AMQConnectionModel;
@@ -284,18 +283,6 @@ public abstract class AbstractVirtualHos
         _messageStore.addEventListener(this, Event.PERSISTENT_MESSAGE_SIZE_OVERFULL);
         _messageStore.addEventListener(this, Event.PERSISTENT_MESSAGE_SIZE_UNDERFULL);
 
-
-        synchronized(_aliases)
-        {
-            for(Port port :_broker.getPorts())
-            {
-                if (Protocol.hasAmqpProtocol(port.getProtocols()))
-                {
-                    _aliases.add(new VirtualHostAliasAdapter(this, port));
-                }
-            }
-        }
-
         addChangeListener(new StoreUpdatingChangeListener());
     }
 

Modified: qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/AbstractVirtualHostNode.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/AbstractVirtualHostNode.java?rev=1632579&r1=1632578&r2=1632579&view=diff
==============================================================================
--- qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/AbstractVirtualHostNode.java (original)
+++ qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/AbstractVirtualHostNode.java Fri Oct 17 13:58:04 2014
@@ -107,6 +107,11 @@ public abstract class AbstractVirtualHos
         return LifetimePolicy.PERMANENT;
     }
 
+    @Override
+    protected void onCreate()
+    {
+        super.onCreate();
+    }
 
     @StateTransition( currentState = {State.UNINITIALIZED, State.STOPPED, State.ERRORED }, desiredState = State.ACTIVE )
     protected void doActivate()

Modified: qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/main/resources/initial-config.json
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/main/resources/initial-config.json?rev=1632579&r1=1632578&r2=1632579&view=diff
==============================================================================
--- qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/main/resources/initial-config.json (original)
+++ qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/main/resources/initial-config.json Fri Oct 17 13:58:04 2014
@@ -20,7 +20,7 @@
  */
 {
   "name": "${broker.name}",
-  "modelVersion": "2.0",
+  "modelVersion": "2.1",
   "defaultVirtualHost" : "default",
   "authenticationproviders" : [ {
     "name" : "passwordFile",
@@ -35,7 +35,18 @@
   "ports" : [  {
     "name" : "AMQP",
     "port" : "${qpid.amqp_port}",
-    "authenticationProvider" : "passwordFile"
+    "authenticationProvider" : "passwordFile",
+    "secureOnlyMechanisms" : [ ],
+    "virtualhostaliases" : [ {
+       "name" : "nameAlias",
+       "type" : "nameAlias"
+    }, {
+        "name" : "defaultAlias",
+        "type" : "defaultAlias"
+    }, {
+        "name" : "hostnameAlias",
+        "type" : "hostnameAlias"
+    } ]
   }, {
     "name" : "HTTP",
     "port" : "${qpid.http_port}",

Modified: qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/configuration/store/StoreConfigurationChangeListenerTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/configuration/store/StoreConfigurationChangeListenerTest.java?rev=1632579&r1=1632578&r2=1632579&view=diff
==============================================================================
--- qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/configuration/store/StoreConfigurationChangeListenerTest.java (original)
+++ qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/configuration/store/StoreConfigurationChangeListenerTest.java Fri Oct 17 13:58:04 2014
@@ -27,10 +27,12 @@ import static org.mockito.Mockito.verify
 import static org.mockito.Mockito.verifyNoMoreInteractions;
 import static org.mockito.Mockito.when;
 
+import java.util.Collections;
 import java.util.UUID;
 
 import org.apache.qpid.server.model.Broker;
 import org.apache.qpid.server.model.ConfiguredObject;
+import org.apache.qpid.server.model.Model;
 import org.apache.qpid.server.model.State;
 import org.apache.qpid.server.model.VirtualHost;
 import org.apache.qpid.server.model.VirtualHostNode;
@@ -69,6 +71,9 @@ public class StoreConfigurationChangeLis
         when(broker.getCategoryClass()).thenReturn(Broker.class);
         VirtualHost child = mock(VirtualHost.class);
         when(child.getCategoryClass()).thenReturn(VirtualHost.class);
+        Model model = mock(Model.class);
+        when(model.getChildTypes(any(Class.class))).thenReturn(Collections.<Class<? extends ConfiguredObject>>emptyList());
+        when(child.getModel()).thenReturn(model);
         _listener.childAdded(broker, child);
         verify(_store).update(eq(true), any(ConfiguredObjectRecord.class));
     }

Modified: qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/model/AbstractConfiguredObjectTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/model/AbstractConfiguredObjectTest.java?rev=1632579&r1=1632578&r2=1632579&view=diff
==============================================================================
--- qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/model/AbstractConfiguredObjectTest.java (original)
+++ qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/model/AbstractConfiguredObjectTest.java Fri Oct 17 13:58:04 2014
@@ -24,16 +24,15 @@ import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 
-import junit.framework.TestCase;
-
 import org.apache.qpid.server.configuration.IllegalConfigurationException;
 import org.apache.qpid.server.model.testmodel.TestChildCategory;
 import org.apache.qpid.server.model.testmodel.TestConfiguredObject;
 import org.apache.qpid.server.model.testmodel.TestModel;
 import org.apache.qpid.server.model.testmodel.TestRootCategory;
 import org.apache.qpid.server.store.ConfiguredObjectRecord;
+import org.apache.qpid.test.utils.QpidTestCase;
 
-public class AbstractConfiguredObjectTest extends TestCase
+public class AbstractConfiguredObjectTest extends QpidTestCase
 {
     private final Model _model = TestModel.getInstance();
 
@@ -169,6 +168,27 @@ public class AbstractConfiguredObjectTes
         System.clearProperty(sysPropertyName);
     }
 
+
+    public void testDefaultContextIsInContextKeys()
+    {
+        final String objectName = "myName";
+
+        Map<String, Object> attributes = new HashMap<>();
+        attributes.put(ConfiguredObject.NAME, objectName);
+
+
+        TestRootCategory object = _model.getObjectFactory().create(TestRootCategory.class,
+                                                                    attributes);
+
+
+        assertTrue("context default not in contextKeys", object.getContextKeys(true).contains(TestRootCategory.TEST_CONTEXT_DEFAULT));
+        assertEquals(object.getContextValue(String.class, TestRootCategory.TEST_CONTEXT_DEFAULT), "default");
+
+        setTestSystemProperty(TestRootCategory.TEST_CONTEXT_DEFAULT, "notdefault");
+        assertTrue("context default not in contextKeys", object.getContextKeys(true).contains(TestRootCategory.TEST_CONTEXT_DEFAULT));
+        assertEquals(object.getContextValue(String.class, TestRootCategory.TEST_CONTEXT_DEFAULT), "notdefault");
+    }
+
     public void testStringAttributeValueFromContextVariableProvidedObjectsContext()
     {
         String contextToken = "${myReplacement}";

Modified: qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestChildCategory.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestChildCategory.java?rev=1632579&r1=1632578&r2=1632579&view=diff
==============================================================================
--- qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestChildCategory.java (original)
+++ qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestChildCategory.java Fri Oct 17 13:58:04 2014
@@ -24,12 +24,12 @@ import java.util.Set;
 
 import org.apache.qpid.server.model.ConfiguredObject;
 import org.apache.qpid.server.model.ManagedAttribute;
+import org.apache.qpid.server.model.ManagedContextDefault;
 import org.apache.qpid.server.model.ManagedObject;
 
 @ManagedObject
 public interface TestChildCategory<X extends TestChildCategory<X>> extends ConfiguredObject<X>
 {
-
     String NON_INTERPOLATED_VALID_VALUE = "${file.separator}";
 
     @ManagedAttribute(validValues = { NON_INTERPOLATED_VALID_VALUE }, defaultValue = "")

Modified: qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestRootCategory.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestRootCategory.java?rev=1632579&r1=1632578&r2=1632579&view=diff
==============================================================================
--- qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestRootCategory.java (original)
+++ qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestRootCategory.java Fri Oct 17 13:58:04 2014
@@ -24,6 +24,7 @@ import java.util.Map;
 
 import org.apache.qpid.server.model.ConfiguredObject;
 import org.apache.qpid.server.model.ManagedAttribute;
+import org.apache.qpid.server.model.ManagedContextDefault;
 import org.apache.qpid.server.model.ManagedObject;
 
 @ManagedObject( defaultType = "test" )
@@ -35,6 +36,13 @@ public interface TestRootCategory<X exte
     String STRING_VALUE = "stringValue";
     String MAP_VALUE = "mapValue";
 
+
+    String TEST_CONTEXT_DEFAULT = "TEST_CONTEXT_DEFAULT";
+
+    @ManagedContextDefault(name = TEST_CONTEXT_DEFAULT)
+    String testGlobalDefault = "default";
+
+
     @ManagedAttribute
     String getAutomatedPersistedValue();
 

Modified: qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/security/SubjectCreatorTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/security/SubjectCreatorTest.java?rev=1632579&r1=1632578&r2=1632579&view=diff
==============================================================================
--- qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/security/SubjectCreatorTest.java (original)
+++ qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/security/SubjectCreatorTest.java Fri Oct 17 13:58:04 2014
@@ -44,10 +44,10 @@ public class SubjectCreatorTest extends 
     private static final String USERNAME = "username";
     private static final String PASSWORD = "password";
 
-    private AuthenticationProvider _authenticationProvider = mock(AuthenticationProvider.class);
+    private AuthenticationProvider<?> _authenticationProvider = mock(AuthenticationProvider.class);
 
-    private GroupProvider _groupManager1 = mock(GroupProvider.class);
-    private GroupProvider _groupManager2 = mock(GroupProvider.class);
+    private GroupProvider<?> _groupManager1 = mock(GroupProvider.class);
+    private GroupProvider<?> _groupManager2 = mock(GroupProvider.class);
 
     private Principal _userPrincipal = mock(Principal.class);
     private Principal _group1 = mock(Principal.class);
@@ -64,7 +64,7 @@ public class SubjectCreatorTest extends 
         when(_groupManager1.getGroupPrincipalsForUser(USERNAME)).thenReturn(Collections.singleton(_group1));
         when(_groupManager2.getGroupPrincipalsForUser(USERNAME)).thenReturn(Collections.singleton(_group2));
 
-        _subjectCreator = new SubjectCreator(_authenticationProvider, new HashSet<GroupProvider>(Arrays.asList(_groupManager1, _groupManager2)),
+        _subjectCreator = new SubjectCreator(_authenticationProvider, new HashSet<GroupProvider<?>>(Arrays.asList(_groupManager1, _groupManager2)),
                                              false);
         _authenticationResult = new AuthenticationResult(_userPrincipal);
         when(_authenticationProvider.authenticate(USERNAME, PASSWORD)).thenReturn(_authenticationResult);

Modified: qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/ScramSHA1AuthenticationManagerTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/ScramSHA1AuthenticationManagerTest.java?rev=1632579&r1=1632578&r2=1632579&view=diff
==============================================================================
--- qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/ScramSHA1AuthenticationManagerTest.java (original)
+++ qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/ScramSHA1AuthenticationManagerTest.java Fri Oct 17 13:58:04 2014
@@ -20,213 +20,43 @@
  */
 package org.apache.qpid.server.security.auth.manager;
 
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
 import java.util.Collections;
-import java.util.HashMap;
 import java.util.Map;
-import java.util.UUID;
-
-import javax.security.auth.login.AccountNotFoundException;
-import javax.security.sasl.SaslException;
-import javax.security.sasl.SaslServer;
-
-import org.apache.qpid.server.configuration.updater.CurrentThreadTaskExecutor;
-import org.apache.qpid.server.configuration.updater.TaskExecutor;
-import org.apache.qpid.server.model.AuthenticationProvider;
-import org.apache.qpid.server.model.Broker;
-import org.apache.qpid.server.model.User;
-import org.apache.qpid.server.security.SecurityManager;
-import org.apache.qpid.server.security.SubjectCreator;
-import org.apache.qpid.server.security.auth.AuthenticationResult;
-import org.apache.qpid.server.util.BrokerTestHelper;
-import org.apache.qpid.test.utils.QpidTestCase;
 
-public class ScramSHA1AuthenticationManagerTest extends QpidTestCase
+public class ScramSHA1AuthenticationManagerTest extends ManagedAuthenticationManagerTestBase
 {
-    private ScramSHA1AuthenticationManager _authManager;
-    private Broker _broker;
-    private SecurityManager _securityManager;
-    private TaskExecutor _executor;
-
     @Override
     public void setUp() throws Exception
     {
         super.setUp();
-        _executor = new CurrentThreadTaskExecutor();
-        _executor.start();
-        _broker = BrokerTestHelper.createBrokerMock();
-        _securityManager = mock(SecurityManager.class);
-        when(_broker.getTaskExecutor()).thenReturn(_executor);
-        when(_broker.getSecurityManager()).thenReturn(_securityManager);
-        final Map<String, Object> attributesMap = new HashMap<String, Object>();
-        attributesMap.put(AuthenticationProvider.NAME, getTestName());
-        attributesMap.put(AuthenticationProvider.ID, UUID.randomUUID());
-        _authManager = new ScramSHA1AuthenticationManager(attributesMap, _broker);
-        _authManager.open();
     }
 
     @Override
-    public void tearDown() throws Exception
+    protected ConfigModelPasswordManagingAuthenticationProvider<?> createAuthManager(final Map<String, Object> attributesMap)
     {
-        _executor.stop();
-        super.tearDown();
-    }
-
-    public void testMechanisms()
-    {
-        SubjectCreator insecureCreator = _authManager.getSubjectCreator(false);
-        assertFalse("PLAIN authentication should not be available on an insecure connection", insecureCreator.getMechanisms().contains("PLAIN"));
-        SubjectCreator secureCreator = _authManager.getSubjectCreator(true);
-        assertTrue("PLAIN authentication should be available on a secure connection", secureCreator.getMechanisms().contains("PLAIN"));
-
-        try
-        {
-            SaslServer saslServer = secureCreator.createSaslServer("PLAIN", "127.0.0.1", null);
-            assertNotNull(saslServer);
-        }
-        catch (SaslException e)
-        {
-            fail("Unable to create a SaslServer for PLAIN authentication on a secure connection" + e.getMessage());
-        }
-
-        try
-        {
-            SaslServer saslServer = insecureCreator.createSaslServer("PLAIN", "127.0.0.1", null);
-            fail("Erroneously created a SaslServer for PLAIN authentication on an insecure connection");
-        }
-        catch (SaslException e)
-        {
-            // Pass
-        }
-
+        return new ScramSHA1AuthenticationManager(attributesMap, getBroker());
     }
 
-    public void testAddChildAndThenDelete()
+    @Override
+    protected boolean isPlain()
     {
-        // No children should be present before the test starts
-        assertEquals("No users should be present before the test starts", 0, _authManager.getChildren(User.class).size());
-        assertEquals("No users should be present before the test starts", 0, _authManager.getUsers().size());
-
-        final Map<String, Object> childAttrs = new HashMap<String, Object>();
-
-        childAttrs.put(User.NAME, getTestName());
-        childAttrs.put(User.PASSWORD, "password");
-        User user = _authManager.addChild(User.class, childAttrs);
-        assertNotNull("User should be created but addChild returned null", user);
-        assertEquals(getTestName(), user.getName());
-        // password shouldn't actually be the given string, but instead salt and the hashed value
-        assertFalse("Password shouldn't actually be the given string, but instead salt and the hashed value", "password".equals(user.getPassword()));
-
-        AuthenticationResult authResult =
-                _authManager.authenticate(getTestName(), "password");
-
-        assertEquals("User should authenticate with given password", AuthenticationResult.AuthenticationStatus.SUCCESS, authResult.getStatus());
-
-        assertEquals("Manager should have exactly one user child",1, _authManager.getChildren(User.class).size());
-        assertEquals("Manager should have exactly one user child",1, _authManager.getUsers().size());
-
-
-        user.delete();
-
-        assertEquals("No users should be present after child deletion", 0, _authManager.getChildren(User.class).size());
-
-
-        authResult = _authManager.authenticate(getTestName(), "password");
-        assertEquals("User should no longer authenticate with given password", AuthenticationResult.AuthenticationStatus.ERROR, authResult.getStatus());
-
+        return false;
     }
 
-    public void testCreateUser()
+    @Override
+    public void tearDown() throws Exception
     {
-        assertEquals("No users should be present before the test starts", 0, _authManager.getChildren(User.class).size());
-        assertTrue(_authManager.createUser(getTestName(), "password", Collections.<String, String>emptyMap()));
-        assertEquals("Manager should have exactly one user child",1, _authManager.getChildren(User.class).size());
-        User user = _authManager.getChildren(User.class).iterator().next();
-        assertEquals(getTestName(), user.getName());
-        // password shouldn't actually be the given string, but instead salt and the hashed value
-        assertFalse("Password shouldn't actually be the given string, but instead salt and the hashed value", "password".equals(user.getPassword()));
-        final Map<String, Object> childAttrs = new HashMap<String, Object>();
-
-        childAttrs.put(User.NAME, getTestName());
-        childAttrs.put(User.PASSWORD, "password");
-        try
-        {
-            user = _authManager.addChild(User.class, childAttrs);
-            fail("Should not be able to create a second user with the same name");
-        }
-        catch(IllegalArgumentException e)
-        {
-            // pass
-        }
-        try
-        {
-            _authManager.deleteUser(getTestName());
-        }
-        catch (AccountNotFoundException e)
-        {
-            fail("AccountNotFoundException thrown when none was expected: " + e.getMessage());
-        }
-        try
-        {
-            _authManager.deleteUser(getTestName());
-            fail("AccountNotFoundException not thrown when was expected");
-        }
-        catch (AccountNotFoundException e)
-        {
-            // pass
-        }
+        super.tearDown();
     }
 
-    public void testUpdateUser()
-    {
-        assertTrue(_authManager.createUser(getTestName(), "password", Collections.<String, String>emptyMap()));
-        assertTrue(_authManager.createUser(getTestName()+"_2", "password", Collections.<String, String>emptyMap()));
-        assertEquals("Manager should have exactly two user children",2, _authManager.getChildren(User.class).size());
-
-        AuthenticationResult authResult = _authManager.authenticate(getTestName(), "password");
-
-        assertEquals("User should authenticate with given password", AuthenticationResult.AuthenticationStatus.SUCCESS, authResult.getStatus());
-        authResult = _authManager.authenticate(getTestName()+"_2", "password");
-        assertEquals("User should authenticate with given password", AuthenticationResult.AuthenticationStatus.SUCCESS, authResult.getStatus());
-
-        for(User user : _authManager.getChildren(User.class))
-        {
-            if(user.getName().equals(getTestName()))
-            {
-                user.setAttributes(Collections.singletonMap(User.PASSWORD, "newpassword"));
-            }
-        }
-
-        authResult = _authManager.authenticate(getTestName(), "newpassword");
-        assertEquals("User should authenticate with updated password", AuthenticationResult.AuthenticationStatus.SUCCESS, authResult.getStatus());
-        authResult = _authManager.authenticate(getTestName()+"_2", "password");
-        assertEquals("User should authenticate with original password", AuthenticationResult.AuthenticationStatus.SUCCESS, authResult.getStatus());
-
-        authResult = _authManager.authenticate(getTestName(), "password");
-        assertEquals("User not authenticate with original password", AuthenticationResult.AuthenticationStatus.ERROR, authResult.getStatus());
-
-        for(User user : _authManager.getChildren(User.class))
-        {
-            if(user.getName().equals(getTestName()))
-            {
-                user.setPassword("newerpassword");
-            }
-        }
-
-        authResult = _authManager.authenticate(getTestName(), "newerpassword");
-        assertEquals("User should authenticate with updated password", AuthenticationResult.AuthenticationStatus.SUCCESS, authResult.getStatus());
-
-
-
-    }
 
     public void testNonASCIIUser()
     {
         try
         {
-            _authManager.createUser(getTestName()+Character.toString((char)0xa3), "password", Collections.<String, String>emptyMap());
+            getAuthManager().createUser(getTestName() + Character.toString((char) 0xa3),
+                                        "password",
+                                        Collections.<String, String>emptyMap());
             fail("Expected exception when attempting to create a user with a non ascii name");
         }
         catch(IllegalArgumentException e)

Modified: qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/security/auth/sasl/CRAMMD5HexInitialiserTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/security/auth/sasl/CRAMMD5HexInitialiserTest.java?rev=1632579&r1=1632578&r2=1632579&view=diff
==============================================================================
--- qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/security/auth/sasl/CRAMMD5HexInitialiserTest.java (original)
+++ qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/security/auth/sasl/CRAMMD5HexInitialiserTest.java Fri Oct 17 13:58:04 2014
@@ -28,6 +28,7 @@ import java.security.NoSuchAlgorithmExce
 import javax.security.auth.callback.Callback;
 import javax.security.auth.callback.NameCallback;
 import javax.security.auth.callback.PasswordCallback;
+import javax.xml.bind.DatatypeConverter;
 
 import junit.framework.TestCase;
 
@@ -35,7 +36,6 @@ import org.apache.qpid.server.security.a
 import org.apache.qpid.server.security.auth.database.PrincipalDatabase;
 import org.apache.qpid.server.security.auth.sasl.crammd5.CRAMMD5HexInitialiser;
 import org.apache.qpid.test.utils.TestFileUtils;
-import org.apache.qpid.tools.security.Passwd;
 
 /**
  * These tests ensure that the Hex wrapping that the initialiser performs does actually operate when the handle method is called.
@@ -73,7 +73,13 @@ public class CRAMMD5HexInitialiserTest e
     public void setUp() throws Exception
     {
         super.setUp();
-        _file = TestFileUtils.createTempFile(this, "password-file", new Passwd().getOutput(TEST_USER , TEST_PASSWORD));
+
+        MessageDigest md = MessageDigest.getInstance("MD5");
+
+        md.update(TEST_PASSWORD.getBytes("utf-8"));
+
+        _file = TestFileUtils.createTempFile(this, "password-file",
+                                             TEST_USER + ":" + DatatypeConverter.printBase64Binary(md.digest()));
     }
 
     public void tearDown() throws Exception

Modified: qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/store/BrokerRecovererTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/store/BrokerRecovererTest.java?rev=1632579&r1=1632578&r2=1632579&view=diff
==============================================================================
--- qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/store/BrokerRecovererTest.java (original)
+++ qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/store/BrokerRecovererTest.java Fri Oct 17 13:58:04 2014
@@ -34,7 +34,6 @@ import java.util.UUID;
 import junit.framework.TestCase;
 
 import org.apache.qpid.server.BrokerOptions;
-import org.apache.qpid.server.configuration.IllegalConfigurationException;
 import org.apache.qpid.server.configuration.updater.CurrentThreadTaskExecutor;
 import org.apache.qpid.server.configuration.updater.TaskExecutor;
 import org.apache.qpid.server.logging.EventLogger;
@@ -261,7 +260,7 @@ public class BrokerRecovererTest extends
             resolveObjects(_brokerEntry);
             Broker<?> broker = _systemConfig.getBroker();
             broker.open();
-            verify(_brokerShutdownProvider).shutdown();
+            verify(_brokerShutdownProvider).shutdown(1);
         }
     }
 
@@ -280,7 +279,7 @@ public class BrokerRecovererTest extends
 
         Broker<?> broker = (Broker<?>) recover.resolve();
         broker.open();
-        verify(_brokerShutdownProvider).shutdown();
+        verify(_brokerShutdownProvider).shutdown(1);
     }
 
     public void testIncorrectModelVersion() throws Exception
@@ -298,7 +297,7 @@ public class BrokerRecovererTest extends
                     _systemConfig.getObjectFactory().recover(_brokerEntry, _systemConfig);
             Broker<?> broker = (Broker<?>) recover.resolve();
             broker.open();
-            verify(_brokerShutdownProvider).shutdown();
+            verify(_brokerShutdownProvider).shutdown(1);
             reset(_brokerShutdownProvider);
         }
     }

Modified: qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/util/BrokerTestHelper.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/util/BrokerTestHelper.java?rev=1632579&r1=1632578&r2=1632579&view=diff
==============================================================================
--- qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/util/BrokerTestHelper.java (original)
+++ qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/util/BrokerTestHelper.java Fri Oct 17 13:58:04 2014
@@ -28,6 +28,8 @@ import static org.mockito.Mockito.when;
 
 import java.net.SocketAddress;
 import java.security.PrivilegedAction;
+import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
@@ -110,17 +112,28 @@ public class BrokerTestHelper
     }
 
     public static VirtualHostImpl<?,?,?> createVirtualHost(Map<String, Object> attributes)
-            throws Exception
     {
 
         Broker<?> broker = createBrokerMock();
+        return createVirtualHost(attributes, broker);
+    }
+
+    public static VirtualHostImpl<?, ?, ?> createVirtualHost(final Map<String, Object> attributes,
+                                                                final Broker<?> broker)
+    {
         ConfiguredObjectFactory objectFactory = broker.getObjectFactory();
 
         VirtualHostNode virtualHostNode = mock(VirtualHostNode.class);
+        when(virtualHostNode.getName()).thenReturn((String) attributes.get(VirtualHostNode.NAME));
         when(virtualHostNode.getTaskExecutor()).thenReturn(TASK_EXECUTOR);
 
         when(virtualHostNode.getParent(eq(Broker.class))).thenReturn(broker);
 
+        Collection<VirtualHostNode<?>> nodes = broker.getVirtualHostNodes();
+        nodes = new ArrayList<>(nodes != null ?  nodes : Collections.<VirtualHostNode<?>>emptyList());
+        nodes.add(virtualHostNode);
+        when(broker.getVirtualHostNodes()).thenReturn(nodes);
+
         DurableConfigurationStore dcs = mock(DurableConfigurationStore.class);
         when(virtualHostNode.getConfigurationStore()).thenReturn(dcs);
         when(virtualHostNode.getParent(eq(VirtualHostNode.class))).thenReturn(virtualHostNode);
@@ -128,19 +141,26 @@ public class BrokerTestHelper
         when(virtualHostNode.getObjectFactory()).thenReturn(objectFactory);
         when(virtualHostNode.getCategoryClass()).thenReturn(VirtualHostNode.class);
         when(virtualHostNode.getTaskExecutor()).thenReturn(TASK_EXECUTOR);
-        AbstractVirtualHost host = (AbstractVirtualHost) objectFactory.create(VirtualHost.class, attributes, virtualHostNode );
+        AbstractVirtualHost
+                host = (AbstractVirtualHost) objectFactory.create(VirtualHost.class, attributes, virtualHostNode );
         host.start();
-
+        when(virtualHostNode.getVirtualHost()).thenReturn(host);
         return host;
     }
 
+
     public static VirtualHostImpl<?,?,?> createVirtualHost(String name) throws Exception
     {
+        return createVirtualHost(name, createBrokerMock());
+    }
+
+    public static VirtualHostImpl<?,?,?> createVirtualHost(String name, Broker<?> broker) throws Exception
+    {
         Map<String,Object> attributes = new HashMap<String, Object>();
         attributes.put(org.apache.qpid.server.model.VirtualHost.TYPE, TestMemoryVirtualHost.VIRTUAL_HOST_TYPE);
         attributes.put(org.apache.qpid.server.model.VirtualHost.NAME, name);
 
-        return createVirtualHost(attributes);
+        return createVirtualHost(attributes, broker);
     }
 
     public static AMQSessionModel<?,?> createSession(int channelId, AMQConnectionModel<?,?> connection)

Modified: qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Connection_1_0.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Connection_1_0.java?rev=1632579&r1=1632578&r2=1632579&view=diff
==============================================================================
--- qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Connection_1_0.java (original)
+++ qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Connection_1_0.java Fri Oct 17 13:58:04 2014
@@ -130,21 +130,12 @@ public class Connection_1_0 implements C
     public void openReceived()
     {
         String host = _conn.getLocalHostname();
-        if(host == null || host.trim().equals(""))
-        {
-            host = _broker.getDefaultVirtualHost();
-        }
-
         _vhost = ((AmqpPort)_port).getVirtualHost(host);
-        if(_vhost == null && _port.isLocalMachine(host))
-        {
-            _vhost = ((AmqpPort)_port).getVirtualHost(_broker.getDefaultVirtualHost());
-        }
         if(_vhost == null)
         {
             final Error err = new Error();
             err.setCondition(AmqpError.NOT_FOUND);
-            err.setDescription("Unknown hostname " + _conn.getLocalHostname());
+            err.setDescription("Unknown hostname in connection open: '" + host + "'");
             _conn.close(err);
             _closedOnOpen = true;
         }

Modified: qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyUtils.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyUtils.java?rev=1632579&r1=1632578&r2=1632579&view=diff
==============================================================================
--- qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyUtils.java (original)
+++ qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyUtils.java Fri Oct 17 13:58:04 2014
@@ -32,7 +32,6 @@ import java.sql.ResultSet;
 import java.sql.SQLException;
 
 import org.apache.qpid.server.store.StoreException;
-import org.apache.qpid.util.FileUtils;
 
 public class DerbyUtils
 {

Modified: qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java?rev=1632579&r1=1632578&r2=1632579&view=diff
==============================================================================
--- qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java (original)
+++ qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java Fri Oct 17 13:58:04 2014
@@ -74,6 +74,7 @@ import org.apache.qpid.server.model.port
 import org.apache.qpid.server.model.port.PortManager;
 import org.apache.qpid.server.util.ServerScopedRuntimeException;
 import org.apache.qpid.transport.network.security.ssl.QpidMultipleTrustManager;
+import org.apache.qpid.transport.network.security.ssl.SSLUtil;
 
 @ManagedObject( category = false, type = "MANAGEMENT-HTTP" )
 public class HttpManagement extends AbstractPluginAdapter<HttpManagement> implements HttpManagementConfiguration<HttpManagement>, PortManager
@@ -317,7 +318,7 @@ public class HttpManagement extends Abst
             throw new IllegalConfigurationException("Key store is not configured. Cannot start management on HTTPS port without keystore");
         }
         SslContextFactory factory = new SslContextFactory();
-
+        factory.addExcludeProtocols(SSLUtil.SSLV3_PROTOCOL);
         boolean needClientCert = port.getNeedClientAuth() || port.getWantClientAuth();
 
         if (needClientCert && trustStores.isEmpty())

Modified: qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/ConfiguredObjectToMapConverter.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/ConfiguredObjectToMapConverter.java?rev=1632579&r1=1632578&r2=1632579&view=diff
==============================================================================
--- qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/ConfiguredObjectToMapConverter.java (original)
+++ qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/ConfiguredObjectToMapConverter.java Fri Oct 17 13:58:04 2014
@@ -268,7 +268,8 @@ public class ConfiguredObjectToMapConver
 
                     if (!childObjects.isEmpty())
                     {
-                        object.put(childClass.getSimpleName().toLowerCase() + "s", childObjects);
+                        String childTypeSingular = childClass.getSimpleName().toLowerCase();
+                        object.put(childTypeSingular + (childTypeSingular.endsWith("s") ? "es" : "s"), childObjects);
                     }
                 }
             }

Modified: qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/util.js
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/util.js?rev=1632579&r1=1632578&r2=1632579&view=diff
==============================================================================
--- qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/util.js (original)
+++ qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/util.js Fri Oct 17 13:58:04 2014
@@ -152,7 +152,8 @@ define(["dojo/_base/xhr",
 
            util.isProviderManagingUsers = function(type)
            {
-               return (type === "PlainPasswordFile" || type === "Base64MD5PasswordFile" || type === "SCRAM-SHA-1" || type === "SCRAM-SHA-256");
+               return (type === "PlainPasswordFile" || type === "Base64MD5PasswordFile" || type === "SCRAM-SHA-1"
+                        || type === "SCRAM-SHA-256" || type === "Plain" || type === "MD5" );
            };
 
            util.showSetAttributesDialog = function(attributeWidgetFactories, data, putURL, dialogTitle, category, type, appendNameToUrl)

Modified: qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/AuthenticationProvider.js
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/AuthenticationProvider.js?rev=1632579&r1=1632578&r2=1632579&view=diff
==============================================================================
--- qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/AuthenticationProvider.js (original)
+++ qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/AuthenticationProvider.js Fri Oct 17 13:58:04 2014
@@ -139,6 +139,7 @@ define(["dojo/_base/xhr",
                this.editPreferencesProviderButton = query(".editPreferencesProviderButton", node)[0];
                this.deletePreferencesProviderButton = query(".deletePreferencesProviderButton", node)[0];
                this.preferencesProviderAttributes = dom.byId("preferencesProviderAttributes")
+               this.preferencesNode = query(".preferencesProviderDetails", node)[0];
 
                this.query = "api/latest/authenticationprovider/" + encodeURIComponent(authProviderObj.name);
 
@@ -171,7 +172,7 @@ define(["dojo/_base/xhr",
                              else
                              {
                                var preferencesProviderData = that.authProviderData.preferencesproviders? that.authProviderData.preferencesproviders[0]: null;
-                               that.preferencesNode = query(".preferencesProviderDetails", node)[0];
+
                                that.updatePreferencesProvider(preferencesProviderData);
                              }
                          });

Modified: qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/QpidSslRMIServerSocketFactory.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/QpidSslRMIServerSocketFactory.java?rev=1632579&r1=1632578&r2=1632579&view=diff
==============================================================================
--- qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/QpidSslRMIServerSocketFactory.java (original)
+++ qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/QpidSslRMIServerSocketFactory.java Fri Oct 17 13:58:04 2014
@@ -30,6 +30,8 @@ import javax.net.ssl.SSLSocket;
 import javax.net.ssl.SSLSocketFactory;
 import javax.rmi.ssl.SslRMIServerSocketFactory;
 
+import org.apache.qpid.transport.network.security.ssl.SSLUtil;
+
 public class QpidSslRMIServerSocketFactory extends SslRMIServerSocketFactory
 {
     private final SSLContext _sslContext;
@@ -74,7 +76,7 @@ public class QpidSslRMIServerSocketFacto
                                                          socket.getPort(),
                                                          true);
                 sslSocket.setUseClientMode(false);
-
+                SSLUtil.removeSSLv3Support(sslSocket);
                 return sslSocket;
             }
         };

Modified: qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-plugins/websocket/src/main/java/org/apache/qpid/server/transport/websocket/WebSocketProvider.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-plugins/websocket/src/main/java/org/apache/qpid/server/transport/websocket/WebSocketProvider.java?rev=1632579&r1=1632578&r2=1632579&view=diff
==============================================================================
--- qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-plugins/websocket/src/main/java/org/apache/qpid/server/transport/websocket/WebSocketProvider.java (original)
+++ qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-plugins/websocket/src/main/java/org/apache/qpid/server/transport/websocket/WebSocketProvider.java Fri Oct 17 13:58:04 2014
@@ -32,8 +32,6 @@ import java.util.Set;
 import javax.net.ssl.SSLContext;
 import javax.servlet.http.HttpServletRequest;
 
-import org.apache.qpid.server.model.port.AmqpPort;
-import org.apache.qpid.server.model.port.HttpPort;
 import org.eclipse.jetty.server.Connector;
 import org.eclipse.jetty.server.Server;
 import org.eclipse.jetty.server.nio.SelectChannelConnector;
@@ -48,11 +46,14 @@ import org.apache.qpid.server.model.Brok
 import org.apache.qpid.server.model.Port;
 import org.apache.qpid.server.model.Protocol;
 import org.apache.qpid.server.model.Transport;
+import org.apache.qpid.server.model.port.AmqpPort;
+import org.apache.qpid.server.model.port.HttpPort;
 import org.apache.qpid.server.protocol.MultiVersionProtocolEngineFactory;
 import org.apache.qpid.server.transport.AcceptingTransport;
 import org.apache.qpid.server.util.ServerScopedRuntimeException;
 import org.apache.qpid.transport.Sender;
 import org.apache.qpid.transport.network.NetworkConnection;
+import org.apache.qpid.transport.network.security.ssl.SSLUtil;
 
 class WebSocketProvider implements AcceptingTransport
 {
@@ -103,6 +104,7 @@ class WebSocketProvider implements Accep
         {
             SslContextFactory factory = new SslContextFactory();
             factory.setSslContext(_sslContext);
+            factory.addExcludeProtocols(SSLUtil.SSLV3_PROTOCOL);
             factory.setNeedClientAuth(true);
             connector = new SslSelectChannelConnector(factory);
         }

Modified: qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-plugins/websocket/src/main/java/org/apache/qpid/server/transport/websocket/WebSocketTransportProvider.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-plugins/websocket/src/main/java/org/apache/qpid/server/transport/websocket/WebSocketTransportProvider.java?rev=1632579&r1=1632578&r2=1632579&view=diff
==============================================================================
--- qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-plugins/websocket/src/main/java/org/apache/qpid/server/transport/websocket/WebSocketTransportProvider.java (original)
+++ qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-plugins/websocket/src/main/java/org/apache/qpid/server/transport/websocket/WebSocketTransportProvider.java Fri Oct 17 13:58:04 2014
@@ -24,9 +24,9 @@ import java.util.Set;
 
 import javax.net.ssl.SSLContext;
 
-import org.apache.qpid.server.model.Port;
 import org.apache.qpid.server.model.Protocol;
 import org.apache.qpid.server.model.Transport;
+import org.apache.qpid.server.model.port.AmqpPort;
 import org.apache.qpid.server.transport.AcceptingTransport;
 import org.apache.qpid.server.transport.TransportProvider;
 
@@ -39,7 +39,7 @@ class WebSocketTransportProvider impleme
     @Override
     public AcceptingTransport createTransport(final Set<Transport> transports,
                                               final SSLContext sslContext,
-                                              final Port port,
+                                              final AmqpPort<?> port,
                                               final Set<Protocol> supported,
                                               final Protocol defaultSupportedProtocolReply)
     {

Modified: qpid/branches/QPID-6125-ProtocolRefactoring/java/broker/src/main/java/org/apache/qpid/server/Main.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-6125-ProtocolRefactoring/java/broker/src/main/java/org/apache/qpid/server/Main.java?rev=1632579&r1=1632578&r2=1632579&view=diff
==============================================================================
--- qpid/branches/QPID-6125-ProtocolRefactoring/java/broker/src/main/java/org/apache/qpid/server/Main.java (original)
+++ qpid/branches/QPID-6125-ProtocolRefactoring/java/broker/src/main/java/org/apache/qpid/server/Main.java Fri Oct 17 13:58:04 2014
@@ -454,7 +454,7 @@ public class Main
 
     protected void startBroker(final BrokerOptions options) throws Exception
     {
-        Broker broker = new Broker();
+        Broker broker = new Broker(true);
         broker.startup(options);
     }
 

Modified: qpid/branches/QPID-6125-ProtocolRefactoring/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-6125-ProtocolRefactoring/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java?rev=1632579&r1=1632578&r2=1632579&view=diff
==============================================================================
--- qpid/branches/QPID-6125-ProtocolRefactoring/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java (original)
+++ qpid/branches/QPID-6125-ProtocolRefactoring/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java Fri Oct 17 13:58:04 2014
@@ -81,7 +81,8 @@ public class AMQConnection extends Close
     private static final Logger _logger = LoggerFactory.getLogger(AMQConnection.class);
     private static final AtomicLong CONN_NUMBER_GENERATOR = new AtomicLong();
 
-    private static final long DEFAULT_CLOSE_TIMEOUT = 2000l;
+    private static final long DEFAULT_CLOSE_TIMEOUT = Long.getLong(ClientProperties.QPID_CLOSE_TIMEOUT,
+                                                                   ClientProperties.DEFAULT_CLOSE_TIMEOUT);
 
     private final long _connectionNumber;
 
@@ -880,44 +881,19 @@ public class AMQConnection extends Close
                 {
                     try
                     {
-                        long startCloseTime = System.currentTimeMillis();
-
-	                    closeAllSessions(null, timeout, startCloseTime);
-
-                        //This MUST occur after we have successfully closed all Channels/Sessions
-                        _taskPool.shutdown();
-
-                        if (!_taskPool.isTerminated())
+                        try
                         {
-                            try
-                            {
-                                // adjust timeout
-                                long taskPoolTimeout = adjustTimeout(timeout, startCloseTime);
-
-                                _taskPool.awaitTermination(taskPoolTimeout, TimeUnit.MILLISECONDS);
-                            }
-                            catch (InterruptedException e)
-                            {
-                                _logger.info("Interrupted while shutting down connection thread pool.");
-                            }
+                            closeAllSessions(null, timeout);
                         }
-
-                        // adjust timeout
-                        timeout = adjustTimeout(timeout, startCloseTime);
-                        //If the taskpool hasn't shutdown by now then give it shutdownNow.
-                        // This will interupt any running tasks.
-                        if (!_taskPool.isTerminated())
+                        finally
                         {
-                            List<Runnable> tasks = _taskPool.shutdownNow();
-                            for (Runnable r : tasks)
-                            {
-                                _logger.warn("Connection close forced taskpool to prevent execution:" + r);
-                            }
+                            //This MUST occur after we have successfully closed all Channels/Sessions
+                            shutdownTaskPool(timeout);
                         }
                     }
                     catch (JMSException e)
                     {
-                        _logger.error("error:", e);
+                        _logger.error("Error closing connection", e);
                         JMSException jmse = new JMSException("Error closing connection: " + e);
                         jmse.setLinkedException(e);
                         jmse.initCause(e);
@@ -939,16 +915,32 @@ public class AMQConnection extends Close
         }
     }
 
-    private long adjustTimeout(long timeout, long startTime)
+    private void shutdownTaskPool(final long timeout)
     {
-        long now = System.currentTimeMillis();
-        timeout -= now - startTime;
-        if (timeout < 0)
+        _taskPool.shutdown();
+
+        if (!_taskPool.isTerminated())
         {
-            timeout = 0;
+            try
+            {
+                _taskPool.awaitTermination(timeout, TimeUnit.MILLISECONDS);
+            }
+            catch (InterruptedException e)
+            {
+                _logger.info("Interrupted while shutting down connection thread pool.");
+            }
         }
 
-        return timeout;
+        //If the taskpool hasn't shutdown by now then give it shutdownNow.
+        // This will interrupt any running tasks.
+        if (!_taskPool.isTerminated())
+        {
+            List<Runnable> tasks = _taskPool.shutdownNow();
+            for (Runnable r : tasks)
+            {
+                _logger.warn("Connection close forced taskpool to prevent execution:" + r);
+            }
+        }
     }
 
     /**
@@ -976,7 +968,7 @@ public class AMQConnection extends Close
      * @param cause if not null, the error that is causing this shutdown <p/> The caller must hold the failover mutex
      *              before calling this method.
      */
-    private void closeAllSessions(Throwable cause, long timeout, long starttime) throws JMSException
+    private void closeAllSessions(Throwable cause, long timeout) throws JMSException
     {
         final LinkedList sessionCopy = new LinkedList(_sessions.values());
         final Iterator it = sessionCopy.iterator();
@@ -992,11 +984,6 @@ public class AMQConnection extends Close
             {
                 try
                 {
-                    if (starttime != -1)
-                    {
-                        timeout = adjustTimeout(timeout, starttime);
-                    }
-
                     session.close(timeout);
                 }
                 catch (JMSException e)
@@ -1042,7 +1029,6 @@ public class AMQConnection extends Close
     public ConnectionConsumer createDurableConnectionConsumer(Topic topic, String subscriptionName, String messageSelector,
                                                               ServerSessionPool sessionPool, int maxMessages) throws JMSException
     {
-        // TODO Auto-generated method stub
         checkNotClosed();
 
         throw new JmsNotImplementedException();
@@ -1322,7 +1308,7 @@ public class AMQConnection extends Close
                 {
                     try
                     {
-                        closeAllSessions(cause, -1, -1); // FIXME: when doing this end up with RejectedExecutionException from executor.
+                        closeAllSessions(cause, -1); // FIXME: when doing this end up with RejectedExecutionException from executor.
                     }
                     catch (JMSException e)
                     {
@@ -1444,7 +1430,7 @@ public class AMQConnection extends Close
 
     public AMQShortString getTemporaryQueueExchangeName()
     {
-        return _temporaryQueueExchangeName; // To change body of created methods use File | Settings | File Templates.
+        return _temporaryQueueExchangeName;
     }
 
     public void setTemporaryTopicExchangeName(AMQShortString temporaryTopicExchangeName)

Modified: qpid/branches/QPID-6125-ProtocolRefactoring/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_8.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-6125-ProtocolRefactoring/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_8.java?rev=1632579&r1=1632578&r2=1632579&view=diff
==============================================================================
--- qpid/branches/QPID-6125-ProtocolRefactoring/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_8.java (original)
+++ qpid/branches/QPID-6125-ProtocolRefactoring/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_8.java Fri Oct 17 13:58:04 2014
@@ -32,6 +32,7 @@ import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.UUID;
+import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicInteger;
 
 import javax.jms.Destination;
@@ -96,6 +97,7 @@ public class AMQSession_0_8 extends AMQS
 
     /** Flow control */
     private FlowControlIndicator _flowControl = new FlowControlIndicator();
+    private final AtomicBoolean _creditChanged = new AtomicBoolean();
 
     /**
      * Creates a new session on a connection.
@@ -847,6 +849,7 @@ public class AMQSession_0_8 extends AMQS
 
                             getProtocolHandler().syncWrite(basicQosBody.generateFrame(getChannelId()),
                                                            BasicQosOkBody.class);
+                            _creditChanged.set(true);
                             return true;
                         }
                         else
@@ -863,7 +866,7 @@ public class AMQSession_0_8 extends AMQS
         int acknowledgeMode = getAcknowledgeMode();
         boolean manageCredit = acknowledgeMode == javax.jms.Session.CLIENT_ACKNOWLEDGE || acknowledgeMode == javax.jms.Session.SESSION_TRANSACTED;
 
-        if(manageCredit)
+        if(manageCredit && _creditChanged.compareAndSet(true,false))
         {
             new FailoverNoopSupport<>(
                     new FailoverProtectedOperation<Void, AMQException>()

Modified: qpid/branches/QPID-6125-ProtocolRefactoring/java/common/src/main/java/org/apache/qpid/configuration/ClientProperties.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-6125-ProtocolRefactoring/java/common/src/main/java/org/apache/qpid/configuration/ClientProperties.java?rev=1632579&r1=1632578&r2=1632579&view=diff
==============================================================================
--- qpid/branches/QPID-6125-ProtocolRefactoring/java/common/src/main/java/org/apache/qpid/configuration/ClientProperties.java (original)
+++ qpid/branches/QPID-6125-ProtocolRefactoring/java/common/src/main/java/org/apache/qpid/configuration/ClientProperties.java Fri Oct 17 13:58:04 2014
@@ -134,6 +134,18 @@ public class ClientProperties
     public static final int DEFAULT_SYNC_OPERATION_TIMEOUT = 60000;
 
     /**
+     * System properties to change the default timeout used whilst closing connections
+     * and underlying sessions.
+     */
+    public static final String QPID_CLOSE_TIMEOUT = "qpid.close_timeout";
+
+    /**
+     * A default timeout value for close operations
+     */
+    public static final int DEFAULT_CLOSE_TIMEOUT = 2000;
+
+
+    /**
      * System properties to change the default value used for TCP_NODELAY
      */
     public static final String QPID_TCP_NODELAY_PROP_NAME = "qpid.tcp_nodelay";

Modified: qpid/branches/QPID-6125-ProtocolRefactoring/java/common/src/main/java/org/apache/qpid/transport/network/IncomingNetworkTransport.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-6125-ProtocolRefactoring/java/common/src/main/java/org/apache/qpid/transport/network/IncomingNetworkTransport.java?rev=1632579&r1=1632578&r2=1632579&view=diff
==============================================================================
--- qpid/branches/QPID-6125-ProtocolRefactoring/java/common/src/main/java/org/apache/qpid/transport/network/IncomingNetworkTransport.java (original)
+++ qpid/branches/QPID-6125-ProtocolRefactoring/java/common/src/main/java/org/apache/qpid/transport/network/IncomingNetworkTransport.java Fri Oct 17 13:58:04 2014
@@ -20,14 +20,16 @@
  */
 package org.apache.qpid.transport.network;
 
+import javax.net.ssl.SSLContext;
+
 import org.apache.qpid.protocol.ProtocolEngineFactory;
 import org.apache.qpid.transport.NetworkTransportConfiguration;
 
-import javax.net.ssl.SSLContext;
-
 public interface IncomingNetworkTransport extends NetworkTransport
 {
     public void accept(NetworkTransportConfiguration config,
                        ProtocolEngineFactory factory,
                        SSLContext sslContext);
-}
\ No newline at end of file
+
+    public int getAcceptingPort();
+}

Modified: qpid/branches/QPID-6125-ProtocolRefactoring/java/common/src/main/java/org/apache/qpid/transport/network/io/IoNetworkTransport.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-6125-ProtocolRefactoring/java/common/src/main/java/org/apache/qpid/transport/network/io/IoNetworkTransport.java?rev=1632579&r1=1632578&r2=1632579&view=diff
==============================================================================
--- qpid/branches/QPID-6125-ProtocolRefactoring/java/common/src/main/java/org/apache/qpid/transport/network/io/IoNetworkTransport.java (original)
+++ qpid/branches/QPID-6125-ProtocolRefactoring/java/common/src/main/java/org/apache/qpid/transport/network/io/IoNetworkTransport.java Fri Oct 17 13:58:04 2014
@@ -27,12 +27,12 @@ import java.net.ServerSocket;
 import java.net.Socket;
 import java.net.SocketException;
 import java.nio.ByteBuffer;
-import java.security.Principal;
+
 import javax.net.ssl.SSLContext;
-import javax.net.ssl.SSLPeerUnverifiedException;
 import javax.net.ssl.SSLServerSocket;
 import javax.net.ssl.SSLServerSocketFactory;
-import javax.net.ssl.SSLSocket;
+
+import org.slf4j.LoggerFactory;
 
 import org.apache.qpid.configuration.CommonProperties;
 import org.apache.qpid.protocol.ProtocolEngine;
@@ -41,9 +41,11 @@ import org.apache.qpid.transport.Connect
 import org.apache.qpid.transport.NetworkTransportConfiguration;
 import org.apache.qpid.transport.Receiver;
 import org.apache.qpid.transport.TransportException;
-import org.apache.qpid.transport.network.*;
-
-import org.slf4j.LoggerFactory;
+import org.apache.qpid.transport.network.IncomingNetworkTransport;
+import org.apache.qpid.transport.network.NetworkConnection;
+import org.apache.qpid.transport.network.OutgoingNetworkTransport;
+import org.apache.qpid.transport.network.TransportActivity;
+import org.apache.qpid.transport.network.security.ssl.SSLUtil;
 
 public class IoNetworkTransport implements OutgoingNetworkTransport, IncomingNetworkTransport
 {
@@ -150,6 +152,11 @@ public class IoNetworkTransport implemen
         }
     }
 
+    public int getAcceptingPort()
+    {
+        return _acceptor == null ? -1 : _acceptor.getPort();
+    }
+
     private class AcceptingThread extends Thread
     {
         private volatile boolean _closed = false;
@@ -179,14 +186,19 @@ public class IoNetworkTransport implemen
                 SSLServerSocketFactory socketFactory = _sslContext.getServerSocketFactory();
                 _serverSocket = socketFactory.createServerSocket();
 
+                SSLServerSocket sslServerSocket = (SSLServerSocket) _serverSocket;
+
+                SSLUtil.removeSSLv3Support(sslServerSocket);
+
                 if(config.needClientAuth())
                 {
-                    ((SSLServerSocket)_serverSocket).setNeedClientAuth(true);
+                    sslServerSocket.setNeedClientAuth(true);
                 }
                 else if(config.wantClientAuth())
                 {
-                    ((SSLServerSocket)_serverSocket).setWantClientAuth(true);
+                    sslServerSocket.setWantClientAuth(true);
                 }
+
             }
 
             _serverSocket.setReuseAddress(true);
@@ -215,6 +227,11 @@ public class IoNetworkTransport implemen
             }
         }
 
+        private int getPort()
+        {
+            return _serverSocket.getLocalPort();
+        }
+
         @Override
         public void run()
         {

Modified: qpid/branches/QPID-6125-ProtocolRefactoring/java/common/src/main/java/org/apache/qpid/transport/network/security/SecurityLayerFactory.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-6125-ProtocolRefactoring/java/common/src/main/java/org/apache/qpid/transport/network/security/SecurityLayerFactory.java?rev=1632579&r1=1632578&r2=1632579&view=diff
==============================================================================
--- qpid/branches/QPID-6125-ProtocolRefactoring/java/common/src/main/java/org/apache/qpid/transport/network/security/SecurityLayerFactory.java (original)
+++ qpid/branches/QPID-6125-ProtocolRefactoring/java/common/src/main/java/org/apache/qpid/transport/network/security/SecurityLayerFactory.java Fri Oct 17 13:58:04 2014
@@ -20,6 +20,11 @@
  */
 package org.apache.qpid.transport.network.security;
 
+import java.nio.ByteBuffer;
+
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLEngine;
+
 import org.apache.qpid.ssl.SSLContextFactory;
 import org.apache.qpid.transport.ConnectionSettings;
 import org.apache.qpid.transport.Receiver;
@@ -31,10 +36,6 @@ import org.apache.qpid.transport.network
 import org.apache.qpid.transport.network.security.ssl.SSLSender;
 import org.apache.qpid.transport.network.security.ssl.SSLUtil;
 
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.SSLEngine;
-import java.nio.ByteBuffer;
-
 public class SecurityLayerFactory
 {
     private SecurityLayerFactory()
@@ -100,6 +101,7 @@ public class SecurityLayerFactory
             {
                 _engine = sslCtx.createSSLEngine();
                 _engine.setUseClientMode(true);
+                SSLUtil.removeSSLv3Support(_engine);
             }
             catch(Exception e)
             {

Modified: qpid/branches/QPID-6125-ProtocolRefactoring/java/common/src/main/java/org/apache/qpid/transport/network/security/ssl/SSLUtil.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-6125-ProtocolRefactoring/java/common/src/main/java/org/apache/qpid/transport/network/security/ssl/SSLUtil.java?rev=1632579&r1=1632578&r2=1632579&view=diff
==============================================================================
--- qpid/branches/QPID-6125-ProtocolRefactoring/java/common/src/main/java/org/apache/qpid/transport/network/security/ssl/SSLUtil.java (original)
+++ qpid/branches/QPID-6125-ProtocolRefactoring/java/common/src/main/java/org/apache/qpid/transport/network/security/ssl/SSLUtil.java Fri Oct 17 13:58:04 2014
@@ -30,6 +30,8 @@ import java.security.Principal;
 import java.security.cert.Certificate;
 import java.security.cert.CertificateParsingException;
 import java.security.cert.X509Certificate;
+import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 import java.util.SortedSet;
 import java.util.TreeSet;
@@ -39,6 +41,8 @@ import javax.naming.ldap.LdapName;
 import javax.naming.ldap.Rdn;
 import javax.net.ssl.SSLEngine;
 import javax.net.ssl.SSLPeerUnverifiedException;
+import javax.net.ssl.SSLServerSocket;
+import javax.net.ssl.SSLSocket;
 
 import org.apache.qpid.transport.TransportException;
 import org.apache.qpid.transport.util.Logger;
@@ -47,6 +51,7 @@ public class SSLUtil
 {
     private static final Logger log = Logger.get(SSLUtil.class);
     private static final Integer DNS_NAME_TYPE = 2;
+    public static final String SSLV3_PROTOCOL = "SSLv3";
 
     private SSLUtil()
     {
@@ -242,4 +247,38 @@ public class SSLUtil
         }
         return ks;
     }
+
+    public static void removeSSLv3Support(final SSLEngine engine)
+    {
+        List<String> enabledProtocols = Arrays.asList(engine.getEnabledProtocols());
+        if(enabledProtocols.contains(SSLV3_PROTOCOL))
+        {
+            List<String> allowedProtocols = new ArrayList<>(enabledProtocols);
+            allowedProtocols.remove(SSLV3_PROTOCOL);
+            engine.setEnabledProtocols(allowedProtocols.toArray(new String[allowedProtocols.size()]));
+        }
+    }
+
+    public static void removeSSLv3Support(final SSLSocket socket)
+    {
+        List<String> enabledProtocols = Arrays.asList(socket.getEnabledProtocols());
+        if(enabledProtocols.contains(SSLV3_PROTOCOL))
+        {
+            List<String> allowedProtocols = new ArrayList<>(enabledProtocols);
+            allowedProtocols.remove(SSLV3_PROTOCOL);
+            socket.setEnabledProtocols(allowedProtocols.toArray(new String[allowedProtocols.size()]));
+        }
+    }
+
+
+    public static void removeSSLv3Support(final SSLServerSocket socket)
+    {
+        List<String> enabledProtocols = Arrays.asList(socket.getEnabledProtocols());
+        if(enabledProtocols.contains(SSLV3_PROTOCOL))
+        {
+            List<String> allowedProtocols = new ArrayList<>(enabledProtocols);
+            allowedProtocols.remove(SSLV3_PROTOCOL);
+            socket.setEnabledProtocols(allowedProtocols.toArray(new String[allowedProtocols.size()]));
+        }
+    }
 }

Modified: qpid/branches/QPID-6125-ProtocolRefactoring/java/common/src/test/java/org/apache/qpid/transport/network/TransportTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-6125-ProtocolRefactoring/java/common/src/test/java/org/apache/qpid/transport/network/TransportTest.java?rev=1632579&r1=1632578&r2=1632579&view=diff
==============================================================================
--- qpid/branches/QPID-6125-ProtocolRefactoring/java/common/src/test/java/org/apache/qpid/transport/network/TransportTest.java (original)
+++ qpid/branches/QPID-6125-ProtocolRefactoring/java/common/src/test/java/org/apache/qpid/transport/network/TransportTest.java Fri Oct 17 13:58:04 2014
@@ -21,6 +21,10 @@
 package org.apache.qpid.transport.network;
 
 
+import java.nio.ByteBuffer;
+
+import javax.net.ssl.SSLContext;
+
 import org.apache.qpid.framing.ProtocolVersion;
 import org.apache.qpid.protocol.ProtocolEngineFactory;
 import org.apache.qpid.test.utils.QpidTestCase;
@@ -30,9 +34,6 @@ import org.apache.qpid.transport.Receive
 import org.apache.qpid.transport.TransportException;
 import org.apache.qpid.transport.network.io.IoNetworkTransport;
 
-import javax.net.ssl.SSLContext;
-import java.nio.ByteBuffer;
-
 public class TransportTest extends QpidTestCase
 {
 
@@ -153,5 +154,11 @@ public class TransportTest extends QpidT
         {
             throw new UnsupportedOperationException();
         }
+
+        @Override
+        public int getAcceptingPort()
+        {
+            return -1;
+        }
     }
 }

Modified: qpid/branches/QPID-6125-ProtocolRefactoring/java/perftests/etc/chartdefs/1001-MessageSize-Transient-ByteSec.chartdef
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-6125-ProtocolRefactoring/java/perftests/etc/chartdefs/1001-MessageSize-Transient-ByteSec.chartdef?rev=1632579&r1=1632578&r2=1632579&view=diff
==============================================================================
--- qpid/branches/QPID-6125-ProtocolRefactoring/java/perftests/etc/chartdefs/1001-MessageSize-Transient-ByteSec.chartdef (original)
+++ qpid/branches/QPID-6125-ProtocolRefactoring/java/perftests/etc/chartdefs/1001-MessageSize-Transient-ByteSec.chartdef Fri Oct 17 13:58:04 2014
@@ -20,7 +20,7 @@
 chartType=XYLINE
 chartTitle=Impact of Message Size Bytes/S
 chartSubtitle=Transient messages
-chartDescription=1P 1C, transient, auto-ack, with message payload between 256-262144 bytes ${baselineName}, single queue.
+chartDescription=1P 1C, single queue, transient, auto-ack, with message payload between 256-262144 bytes ${baselineName}.
 
 xAxisTitle=Message Size (B)
 yAxisTitle=Throughput (KB/s)



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


Mime
View raw message