Author: rgodfrey
Date: Tue May 12 23:57:06 2015
New Revision: 1679124

URL: http://svn.apache.org/r1679124
Log:
QPID-6540 : add ability to disable mechanisms of an authentication provider 
(patch from Lorenz Quack)

Added:
    
qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/port/PortWithAuthProvider.java
   (with props)
Modified:
    
qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/AuthenticationProvider.java
    
qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/port/AbstractPort.java
    
qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/port/AbstractPortWithAuthProvider.java
    
qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/port/ClientAuthCapablePort.java
    
qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/port/JmxPort.java
    
qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/security/SubjectCreator.java
    
qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/AbstractAuthenticationManager.java
    
qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManager.java
    
qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/model/adapter/PortFactoryTest.java
    
qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/model/port/AmqpPortImplTest.java
    
qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/security/SubjectCreatorTest.java
    
qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/virtualhostalias/VirtualHostAliasTest.java

Modified: 
qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/AuthenticationProvider.java
URL: 
http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/AuthenticationProvider.java?rev=1679124&r1=1679123&r2=1679124&view=diff
==============================================================================
--- 
qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/AuthenticationProvider.java
 (original)
+++ 
qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/AuthenticationProvider.java
 Tue May 12 23:57:06 2015
@@ -69,6 +69,11 @@ public interface AuthenticationProvider<
 
     @ManagedAttribute( defaultValue = "[ \"PLAIN\" ]")
     List<String> getSecureOnlyMechanisms();
+
+    @ManagedAttribute( defaultValue = "[]")
+    List<String> getDisabledMechanisms();
+
+
     /**
      * Creates a SASL server for the specified mechanism name for the given
      * fully qualified domain name.

Modified: 
qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/port/AbstractPort.java
URL: 
http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/port/AbstractPort.java?rev=1679124&r1=1679123&r2=1679124&view=diff
==============================================================================
--- 
qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/port/AbstractPort.java
 (original)
+++ 
qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/port/AbstractPort.java
 Tue May 12 23:57:06 2015
@@ -122,19 +122,34 @@ abstract public class AbstractPort<X ext
 
     protected final boolean isUsingTLSTransport(final Collection<Transport> 
transports)
     {
-        boolean usesTLS = false;
+        return hasTransportOfType(transports, true);
+    }
+
+    protected final boolean hasNonTLSTransport()
+    {
+        return hasNonTLSTransport(getTransports());
+    }
+    protected final boolean hasNonTLSTransport(final Collection<Transport> 
transports)
+    {
+        return hasTransportOfType(transports, false);
+    }
+
+    private boolean hasTransportOfType(Collection<Transport> transports, 
boolean secure)
+    {
+
+        boolean hasTransport = false;
         if(transports != null)
         {
             for (Transport transport : transports)
             {
-                if (transport.isSecure())
+                if (secure == transport.isSecure())
                 {
-                    usesTLS = true;
+                    hasTransport = true;
                     break;
                 }
             }
         }
-        return usesTLS;
+        return hasTransport;
     }
 
     @Override

Modified: 
qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/port/AbstractPortWithAuthProvider.java
URL: 
http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/port/AbstractPortWithAuthProvider.java?rev=1679124&r1=1679123&r2=1679124&view=diff
==============================================================================
--- 
qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/port/AbstractPortWithAuthProvider.java
 (original)
+++ 
qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/port/AbstractPortWithAuthProvider.java
 Tue May 12 23:57:06 2015
@@ -20,13 +20,20 @@
  */
 package org.apache.qpid.server.model.port;
 
+import java.util.ArrayList;
+import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
+import org.apache.qpid.server.configuration.IllegalConfigurationException;
 import org.apache.qpid.server.model.AuthenticationProvider;
 import org.apache.qpid.server.model.Broker;
+import org.apache.qpid.server.model.ConfiguredObject;
 import org.apache.qpid.server.model.ManagedAttributeField;
+import org.apache.qpid.server.model.Port;
+import org.apache.qpid.server.model.Transport;
 
-abstract public class AbstractPortWithAuthProvider<X extends 
AbstractPortWithAuthProvider<X>> extends AbstractPort<X>
+abstract public class AbstractPortWithAuthProvider<X extends 
AbstractPortWithAuthProvider<X>> extends AbstractPort<X> implements 
PortWithAuthProvider<X>
 {
     @ManagedAttributeField
     private AuthenticationProvider _authenticationProvider;
@@ -46,4 +53,57 @@ abstract public class AbstractPortWithAu
         }
         return _authenticationProvider;
     }
+
+    @Override
+    public void onValidate()
+    {
+        super.onValidate();
+
+        AuthenticationProvider<?> authenticationProvider = 
getAuthenticationProvider();
+        final Set<Transport> transports = getTransports();
+        validateAuthenticationMechanisms(authenticationProvider, transports);
+
+    }
+
+    private void validateAuthenticationMechanisms(final 
AuthenticationProvider<?> authenticationProvider,
+                                                  final Set<Transport> 
transports)
+    {
+        List<String> availableMechanisms = new 
ArrayList<>(authenticationProvider.getMechanisms());
+        if(authenticationProvider.getDisabledMechanisms() != null)
+        {
+            
availableMechanisms.removeAll(authenticationProvider.getDisabledMechanisms());
+        }
+        if (availableMechanisms.isEmpty())
+        {
+            throw new IllegalConfigurationException("The authentication 
provider '"
+                                                    + 
authenticationProvider.getName()
+                                                    + "' on port '"
+                                                    + getName()
+                                                    + "' has all 
authentication mechanisms disabled.");
+        }
+        if (hasNonTLSTransport(transports) && 
authenticationProvider.getSecureOnlyMechanisms() != null)
+        {
+            
availableMechanisms.removeAll(authenticationProvider.getSecureOnlyMechanisms());
+            if(availableMechanisms.isEmpty())
+            {
+                throw new IllegalConfigurationException("The port '"
+                                                        + getName()
+                                                        + "' allows for non 
TLS connections, but all authentication "
+                                                        + "mechanisms of the 
authentication provider '"
+                                                        + 
authenticationProvider.getName()
+                                                        + "' are disabled on 
non-secure connections.");
+            }
+        }
+    }
+
+    @Override
+    protected void validateChange(final ConfiguredObject<?> 
proxyForValidation, final Set<String> changedAttributes)
+    {
+        super.validateChange(proxyForValidation, changedAttributes);
+        if(changedAttributes.contains(Port.AUTHENTICATION_PROVIDER) || 
changedAttributes.contains(Port.TRANSPORTS))
+        {
+            PortWithAuthProvider<?> port = (PortWithAuthProvider<?>) 
proxyForValidation;
+            validateAuthenticationMechanisms(port.getAuthenticationProvider(), 
port.getTransports());
+        }
+    }
 }

Modified: 
qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/port/ClientAuthCapablePort.java
URL: 
http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/port/ClientAuthCapablePort.java?rev=1679124&r1=1679123&r2=1679124&view=diff
==============================================================================
--- 
qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/port/ClientAuthCapablePort.java
 (original)
+++ 
qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/port/ClientAuthCapablePort.java
 Tue May 12 23:57:06 2015
@@ -23,7 +23,7 @@ import org.apache.qpid.server.model.Port
 import org.apache.qpid.server.model.TrustStore;
 
 
-public interface ClientAuthCapablePort<X extends Port<X>> extends Port<X>
+public interface ClientAuthCapablePort<X extends PortWithAuthProvider<X>> 
extends PortWithAuthProvider<X>
 {
     boolean getNeedClientAuth();
 

Modified: 
qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/port/JmxPort.java
URL: 
http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/port/JmxPort.java?rev=1679124&r1=1679123&r2=1679124&view=diff
==============================================================================
--- 
qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/port/JmxPort.java
 (original)
+++ 
qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/port/JmxPort.java
 Tue May 12 23:57:06 2015
@@ -30,7 +30,7 @@ import org.apache.qpid.server.model.Prot
 import org.apache.qpid.server.model.Transport;
 
 @ManagedObject( category = false, type = "JMX")
-public interface JmxPort<X extends JmxPort<X>> extends Port<X>
+public interface JmxPort<X extends JmxPort<X>> extends PortWithAuthProvider<X>
 {
     @ManagedAttribute( mandatory = true )
     AuthenticationProvider getAuthenticationProvider();

Added: 
qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/port/PortWithAuthProvider.java
URL: 
http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/port/PortWithAuthProvider.java?rev=1679124&view=auto
==============================================================================
--- 
qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/port/PortWithAuthProvider.java
 (added)
+++ 
qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/port/PortWithAuthProvider.java
 Tue May 12 23:57:06 2015
@@ -0,0 +1,29 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.qpid.server.model.port;
+
+import org.apache.qpid.server.model.AuthenticationProvider;
+import org.apache.qpid.server.model.Port;
+
+public interface PortWithAuthProvider<X extends PortWithAuthProvider<X>> 
extends Port<X>
+{
+    AuthenticationProvider getAuthenticationProvider();
+}

Propchange: 
qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/port/PortWithAuthProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: 
qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/security/SubjectCreator.java
URL: 
http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/security/SubjectCreator.java?rev=1679124&r1=1679123&r2=1679124&view=diff
==============================================================================
--- 
qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/security/SubjectCreator.java
 (original)
+++ 
qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/security/SubjectCreator.java
 Tue May 12 23:57:06 2015
@@ -72,10 +72,17 @@ public class SubjectCreator
     public List<String> getMechanisms()
     {
         List<String> mechanisms = _authenticationProvider.getMechanisms();
+        Set<String> filter = _authenticationProvider.getDisabledMechanisms() 
!= null
+                ? new 
HashSet<>(_authenticationProvider.getDisabledMechanisms())
+                : new HashSet<String>() ;
         if(!_secure)
         {
+            filter.addAll(_authenticationProvider.getSecureOnlyMechanisms());
+        }
+        if (!filter.isEmpty())
+        {
             mechanisms = new ArrayList<>(mechanisms);
-            
mechanisms.removeAll(_authenticationProvider.getSecureOnlyMechanisms());
+            mechanisms.removeAll(filter);
         }
         return mechanisms;
     }

Modified: 
qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/AbstractAuthenticationManager.java
URL: 
http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/AbstractAuthenticationManager.java?rev=1679124&r1=1679123&r2=1679124&view=diff
==============================================================================
--- 
qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/AbstractAuthenticationManager.java
 (original)
+++ 
qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/AbstractAuthenticationManager.java
 Tue May 12 23:57:06 2015
@@ -61,6 +61,10 @@ public abstract class AbstractAuthentica
     @ManagedAttributeField
     private List<String> _secureOnlyMechanisms;
 
+    @ManagedAttributeField
+    private List<String> _disabledMechanisms;
+
+
     protected AbstractAuthenticationManager(final Map<String, Object> 
attributes, final Broker<?> broker)
     {
         super(parentsMap(broker), attributes);
@@ -257,4 +261,10 @@ public abstract class AbstractAuthentica
     {
         return _secureOnlyMechanisms;
     }
+
+    @Override
+    public final List<String> getDisabledMechanisms()
+    {
+        return _disabledMechanisms;
+    }
 }

Modified: 
qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManager.java
URL: 
http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManager.java?rev=1679124&r1=1679123&r2=1679124&view=diff
==============================================================================
--- 
qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManager.java
 (original)
+++ 
qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManager.java
 Tue May 12 23:57:06 2015
@@ -121,10 +121,15 @@ public abstract class PrincipalDatabaseA
     protected void onOpen()
     {
         super.onOpen();
-        _principalDatabase = createDatabase();
         initialise();
     }
 
+    @Override
+    protected void postResolve()
+    {
+        super.postResolve();
+        _principalDatabase = createDatabase();
+    }
 
     protected abstract PrincipalDatabase createDatabase();
 

Modified: 
qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/model/adapter/PortFactoryTest.java
URL: 
http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/model/adapter/PortFactoryTest.java?rev=1679124&r1=1679123&r2=1679124&view=diff
==============================================================================
--- 
qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/model/adapter/PortFactoryTest.java
 (original)
+++ 
qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/model/adapter/PortFactoryTest.java
 Tue May 12 23:57:06 2015
@@ -87,6 +87,7 @@ public class PortFactoryTest extends Qpi
         when(_authProvider.getModel()).thenReturn(objectFactory.getModel());
         when(_authProvider.getObjectFactory()).thenReturn(objectFactory);
         
when(_authProvider.getCategoryClass()).thenReturn(AuthenticationProvider.class);
+        when(_authProvider.getMechanisms()).thenReturn(Arrays.asList("PLAIN"));
 
 
         when(_keyStore.getModel()).thenReturn(objectFactory.getModel());
@@ -402,4 +403,19 @@ public class PortFactoryTest extends Qpi
             // pass
         }
     }
+
+    public void testCreatePortWithoutAuthenticationMechanism()
+    {
+        
when(_authProvider.getDisabledMechanisms()).thenReturn(Arrays.asList("PLAIN"));
+        try
+        {
+            createAmqpPortTestImpl(false, false, false, null, null);
+            fail("Port creation should fail due to no authentication mechanism 
being available.");
+        }
+        catch(IllegalConfigurationException e)
+        {
+            // pass
+        }
+        
when(_authProvider.getDisabledMechanisms()).thenReturn(Collections.emptyList());
+    }
 }

Modified: 
qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/model/port/AmqpPortImplTest.java
URL: 
http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/model/port/AmqpPortImplTest.java?rev=1679124&r1=1679123&r2=1679124&view=diff
==============================================================================
--- 
qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/model/port/AmqpPortImplTest.java
 (original)
+++ 
qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/model/port/AmqpPortImplTest.java
 Tue May 12 23:57:06 2015
@@ -29,6 +29,7 @@ import static org.mockito.Mockito.when;
 import java.io.IOException;
 import java.net.InetSocketAddress;
 import java.net.ServerSocket;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
@@ -73,6 +74,7 @@ public class AmqpPortImplTest extends Qp
         AuthenticationProvider<?> provider = 
mock(AuthenticationProvider.class);
         when(provider.getName()).thenReturn(AUTHENTICATION_PROVIDER_NAME);
         when(provider.getParent(Broker.class)).thenReturn(_broker);
+        when(provider.getMechanisms()).thenReturn(Arrays.asList("PLAIN"));
         
when(_broker.getChildren(AuthenticationProvider.class)).thenReturn(Collections.<AuthenticationProvider>singleton(provider));
         when(_broker.getChildByName(AuthenticationProvider.class, 
AUTHENTICATION_PROVIDER_NAME)).thenReturn(provider);
     }

Modified: 
qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/security/SubjectCreatorTest.java
URL: 
http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/security/SubjectCreatorTest.java?rev=1679124&r1=1679123&r2=1679124&view=diff
==============================================================================
--- 
qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/security/SubjectCreatorTest.java
 (original)
+++ 
qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/security/SubjectCreatorTest.java
 Tue May 12 23:57:06 2015
@@ -168,4 +168,39 @@ public class SubjectCreatorTest extends
         Set<Principal> expectedGroupPrincipals = new 
HashSet<Principal>(Arrays.asList(expectedGroups));
         assertEquals(expectedGroupPrincipals, actualGroupPrincipals);
     }
+
+    public void testDisabledMechanisms()
+    {
+        AuthenticationProvider<?> authenticationProvider = 
mock(AuthenticationProvider.class);
+        SubjectCreator subjectCreator = new 
SubjectCreator(authenticationProvider,
+                                                           new 
HashSet<GroupProvider<?>>(Arrays.asList(_groupManager1,
+                                                                               
                        _groupManager2)),
+                                                           false);
+        
when(authenticationProvider.getMechanisms()).thenReturn(Arrays.asList("PLAIN", 
"SCRAM-SHA-1"));
+        assertTrue("Should contain SCRAM-SHA-1 mechanism.", 
subjectCreator.getMechanisms().contains("SCRAM-SHA-1"));
+        assertTrue("Should contain PLAIN mechanism.", 
subjectCreator.getMechanisms().contains("PLAIN"));
+        
when(authenticationProvider.getDisabledMechanisms()).thenReturn(Arrays.asList("SCRAM-SHA-1"));
+        assertFalse("SCRAM-SHA-1 should have been filtered out.", 
subjectCreator.getMechanisms().contains("SCRAM-SHA-1"));
+        assertTrue("PLAIN should not have been filtered out.", 
subjectCreator.getMechanisms().contains("PLAIN"));
+    }
+
+    public void testSecureOnlyMechanisms()
+    {
+        AuthenticationProvider<?> authenticationProvider = 
mock(AuthenticationProvider.class);
+        SubjectCreator subjectCreator;
+        subjectCreator = new SubjectCreator(authenticationProvider,
+                                            new 
HashSet<GroupProvider<?>>(Arrays.asList(_groupManager1, _groupManager2)),
+                                            false);
+        
when(authenticationProvider.getMechanisms()).thenReturn(Arrays.asList("PLAIN", 
"SCRAM-SHA-1"));
+        assertTrue("Should contain SCRAM-SHA-1 mechanism", 
subjectCreator.getMechanisms().contains("SCRAM-SHA-1"));
+        assertTrue("Should contain PLAIN mechanism", 
subjectCreator.getMechanisms().contains("PLAIN"));
+        
when(authenticationProvider.getSecureOnlyMechanisms()).thenReturn(Arrays.asList("PLAIN"));
+        assertTrue("SCRAM-SHA-1 should not have been filtered out.", 
subjectCreator.getMechanisms().contains("SCRAM-SHA-1"));
+        assertFalse("PLAIN should have been filtered out on insecure 
connection.", subjectCreator.getMechanisms().contains("PLAIN"));
+
+        subjectCreator = new SubjectCreator(authenticationProvider,
+                                            new 
HashSet<GroupProvider<?>>(Arrays.asList(_groupManager1, _groupManager2)),
+                                            true);
+        assertTrue("SCRAM-SHA-1 should not have been filtered out.", 
subjectCreator.getMechanisms().contains("SCRAM-SHA-1"));
+        assertTrue("PLAIN should not have been filtered out on secure 
connection.", subjectCreator.getMechanisms().contains("PLAIN"));}
 }

Modified: 
qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/virtualhostalias/VirtualHostAliasTest.java
URL: 
http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/virtualhostalias/VirtualHostAliasTest.java?rev=1679124&r1=1679123&r2=1679124&view=diff
==============================================================================
--- 
qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/virtualhostalias/VirtualHostAliasTest.java
 (original)
+++ 
qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/virtualhostalias/VirtualHostAliasTest.java
 Tue May 12 23:57:06 2015
@@ -24,6 +24,7 @@ import static org.mockito.Matchers.eq;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
@@ -57,6 +58,7 @@ public class VirtualHostAliasTest extend
         AuthenticationProvider dummyAuthProvider = 
mock(AuthenticationProvider.class);
         when(dummyAuthProvider.getName()).thenReturn("dummy");
         when(dummyAuthProvider.getId()).thenReturn(UUID.randomUUID());
+        
when(dummyAuthProvider.getMechanisms()).thenReturn(Arrays.asList("PLAIN"));
         
when(_broker.getChildren(eq(AuthenticationProvider.class))).thenReturn(Collections.singleton(dummyAuthProvider));
         _vhosts = new HashMap<>();
         for(String name : new String[] { "red", "blue", "purple", "black" })



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to