qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgodf...@apache.org
Subject svn commit: r1471141 [8/11] - in /qpid/branches/QPID-4659/qpid/java: ./ amqp-1-0-client-jms/ amqp-1-0-client/ amqp-1-0-common/ amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/transport/ broker-plugins/access-control/src/main/java/org/apache/qpid...
Date Tue, 23 Apr 2013 20:54:24 GMT
Modified: qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/BrokerConfigurationStoreCreatorTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/BrokerConfigurationStoreCreatorTest.java?rev=1471141&r1=1471140&r2=1471141&view=diff
==============================================================================
--- qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/BrokerConfigurationStoreCreatorTest.java (original)
+++ qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/BrokerConfigurationStoreCreatorTest.java Tue Apr 23 20:54:19 2013
@@ -73,7 +73,7 @@ public class BrokerConfigurationStoreCre
 
     public void testCreateJsonStore()
     {
-        ConfigurationEntryStore store = _storeCreator.createStore(_userStoreLocation.getAbsolutePath(), "json", BrokerOptions.DEFAULT_INITIAL_CONFIG_LOCATION);
+        ConfigurationEntryStore store = _storeCreator.createStore(_userStoreLocation.getAbsolutePath(), "json", BrokerOptions.DEFAULT_INITIAL_CONFIG_LOCATION, false);
         assertNotNull("Store was not created", store);
         assertTrue("File should exists", _userStoreLocation.exists());
         assertTrue("File size should be greater than 0", _userStoreLocation.length() > 0);
@@ -84,41 +84,73 @@ public class BrokerConfigurationStoreCre
 
     public void testCreateJsonStoreFromInitialStore() throws Exception
     {
+        createJsonStoreFromInitialStoreTestImpl(false);
+    }
+
+    public void testOverwriteExistingJsonStoreWithInitialConfig() throws Exception
+    {
+        createJsonStoreFromInitialStoreTestImpl(true);
+    }
+
+    public void createJsonStoreFromInitialStoreTestImpl(boolean overwrite) throws Exception
+    {
         ObjectMapper objectMapper = new ObjectMapper();
         objectMapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true);
 
+        String defaultBrokerName = "Broker";
+        String testBrokerName = getTestName();
+
         Map<String, Object> brokerObjectMap = new HashMap<String, Object>();
-        UUID brokerId = UUID.randomUUID();
-        brokerObjectMap.put(Broker.ID, brokerId);
-        brokerObjectMap.put("name", "Test");
+        UUID testBrokerId = UUID.randomUUID();
+        brokerObjectMap.put(Broker.ID, testBrokerId);
+        brokerObjectMap.put("name", testBrokerName);
 
         StringWriter sw = new StringWriter();
         objectMapper.writeValue(sw, brokerObjectMap);
 
         String brokerJson = sw.toString();
 
-        File _storeFile = TestFileUtils.createTempFile(this, ".json", brokerJson);
+        File _initialStoreFile = TestFileUtils.createTempFile(this, ".json", brokerJson);
 
-        ConfigurationEntryStore store = _storeCreator.createStore(_userStoreLocation.getAbsolutePath(), "json", _storeFile.getAbsolutePath());
+        ConfigurationEntryStore store = _storeCreator.createStore(_userStoreLocation.getAbsolutePath(), "json", _initialStoreFile.getAbsolutePath(), false);
         assertNotNull("Store was not created", store);
         assertTrue("File should exists", _userStoreLocation.exists());
         assertTrue("File size should be greater than 0", _userStoreLocation.length() > 0);
         JsonConfigurationEntryStore jsonStore = new JsonConfigurationEntryStore(_userStoreLocation.getAbsolutePath(), null);
         ConfigurationEntry entry = jsonStore.getRootEntry();
-        assertEquals("Unexpected root id", brokerId, entry.getId());
+        assertEquals("Unexpected root id", testBrokerId, entry.getId());
         Map<String, Object> attributes = entry.getAttributes();
         assertNotNull("Unexpected attributes: " + attributes, attributes);
         assertEquals("Unexpected attributes size: " + attributes.size(), 1, attributes.size());
-        assertEquals("Unexpected attribute name: " + attributes.get("name"), "Test", attributes.get("name"));
+        assertEquals("Unexpected attribute name: " + attributes.get("name"), testBrokerName, attributes.get(Broker.NAME));
         Set<UUID> childrenIds = entry.getChildrenIds();
         assertTrue("Unexpected children: " + childrenIds, childrenIds.isEmpty());
+
+        if(overwrite)
+        {
+            ConfigurationEntryStore overwrittenStore = _storeCreator.createStore(_userStoreLocation.getAbsolutePath(), "json", BrokerOptions.DEFAULT_INITIAL_CONFIG_LOCATION, true);
+            assertNotNull("Store was not created", overwrittenStore);
+            assertTrue("File should exists", _userStoreLocation.exists());
+            assertTrue("File size should be greater than 0", _userStoreLocation.length() > 0);
+
+            //check the contents reflect the test store content having been overwritten with the default store
+            JsonConfigurationEntryStore reopenedOverwrittenStore = new JsonConfigurationEntryStore(_userStoreLocation.getAbsolutePath(), null, false);
+            entry = reopenedOverwrittenStore.getRootEntry();
+            assertFalse("Root id did not change, store content was not overwritten", testBrokerId.equals(entry.getId()));
+            attributes = entry.getAttributes();
+            assertNotNull("No attributes found", attributes);
+            assertFalse("Test name should not equal default broker name", testBrokerName.equals(defaultBrokerName));
+            assertEquals("Unexpected broker name value" , defaultBrokerName, attributes.get(Broker.NAME));
+            childrenIds = entry.getChildrenIds();
+            assertFalse("Expected children were not found" + childrenIds, childrenIds.isEmpty());
+        }
     }
 
     public void testCreateStoreWithUnknownType()
     {
         try
         {
-            _storeCreator.createStore(_userStoreLocation.getAbsolutePath(), "derby", null);
+            _storeCreator.createStore(_userStoreLocation.getAbsolutePath(), "derby", null, false);
             fail("Store is not yet supported");
         }
         catch(IllegalConfigurationException e)

Modified: qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/startup/BrokerRecovererTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/startup/BrokerRecovererTest.java?rev=1471141&r1=1471140&r2=1471141&view=diff
==============================================================================
--- qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/startup/BrokerRecovererTest.java (original)
+++ qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/startup/BrokerRecovererTest.java Tue Apr 23 20:54:19 2013
@@ -20,10 +20,8 @@
  */
 package org.apache.qpid.server.configuration.startup;
 
-import static org.mockito.Mockito.any;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
-import static org.mockito.Mockito.verify;
 
 import java.util.Arrays;
 import java.util.Collection;
@@ -35,9 +33,9 @@ import java.util.UUID;
 
 import junit.framework.TestCase;
 
+import org.apache.qpid.server.BrokerOptions;
 import org.apache.qpid.server.configuration.ConfigurationEntry;
 import org.apache.qpid.server.configuration.ConfiguredObjectRecoverer;
-import org.apache.qpid.server.configuration.IllegalConfigurationException;
 import org.apache.qpid.server.configuration.RecovererProvider;
 import org.apache.qpid.server.logging.LogRecorder;
 import org.apache.qpid.server.logging.RootMessageLogger;
@@ -50,7 +48,9 @@ import org.apache.qpid.server.model.Plug
 import org.apache.qpid.server.model.Port;
 import org.apache.qpid.server.model.TrustStore;
 import org.apache.qpid.server.model.VirtualHost;
+import org.apache.qpid.server.model.adapter.AccessControlProviderFactory;
 import org.apache.qpid.server.model.adapter.AuthenticationProviderFactory;
+import org.apache.qpid.server.model.adapter.GroupProviderFactory;
 import org.apache.qpid.server.model.adapter.PortFactory;
 import org.apache.qpid.server.configuration.updater.TaskExecutor;
 import org.apache.qpid.server.stats.StatisticsGatherer;
@@ -72,8 +72,8 @@ public class BrokerRecovererTest extends
     {
         super.setUp();
 
-        _brokerRecoverer = new BrokerRecoverer(mock(AuthenticationProviderFactory.class), mock(PortFactory.class), mock(StatisticsGatherer.class),
-                mock(VirtualHostRegistry.class), mock(LogRecorder.class), mock(RootMessageLogger.class), mock(TaskExecutor.class));
+        _brokerRecoverer = new BrokerRecoverer(mock(AuthenticationProviderFactory.class), mock(GroupProviderFactory.class), mock(AccessControlProviderFactory.class), mock(PortFactory.class),
+                mock(StatisticsGatherer.class), mock(VirtualHostRegistry.class), mock(LogRecorder.class), mock(RootMessageLogger.class), mock(TaskExecutor.class), mock(BrokerOptions.class));
         when(_brokerEntry.getId()).thenReturn(_brokerId);
         when(_brokerEntry.getChildren()).thenReturn(_brokerEntryChildren);
 
@@ -89,7 +89,6 @@ public class BrokerRecovererTest extends
     {
         Map<String, Object> attributes = new HashMap<String, Object>();
         attributes.put(Broker.DEFAULT_VIRTUAL_HOST, "test");
-        attributes.put(Broker.DEFAULT_AUTHENTICATION_PROVIDER, "authenticationProvider1");
         attributes.put(Broker.QUEUE_ALERT_THRESHOLD_MESSAGE_AGE, 9l);
         attributes.put(Broker.QUEUE_ALERT_THRESHOLD_QUEUE_DEPTH_MESSAGES, 8l);
         attributes.put(Broker.QUEUE_ALERT_THRESHOLD_QUEUE_DEPTH_BYTES, 7l);
@@ -100,7 +99,6 @@ public class BrokerRecovererTest extends
         attributes.put(Broker.QUEUE_MAXIMUM_DELIVERY_ATTEMPTS, 2);
         attributes.put(Broker.QUEUE_DEAD_LETTER_QUEUE_ENABLED, true);
         attributes.put(Broker.VIRTUALHOST_HOUSEKEEPING_CHECK_PERIOD, 1l);
-        attributes.put(Broker.ACL_FILE, "/path/to/acl");
         attributes.put(Broker.CONNECTION_SESSION_COUNT_LIMIT, 1000);
         attributes.put(Broker.CONNECTION_HEART_BEAT_DELAY, 2000);
         attributes.put(Broker.STATISTICS_REPORTING_PERIOD, 4000);
@@ -172,24 +170,6 @@ public class BrokerRecovererTest extends
         assertEquals(Collections.singletonList(port), broker.getPorts());
     }
 
-    public void testCreateBrokerWithoutAuthenticationProviderThrowsException()
-    {
-        assertNotNull("expected to remove the base entry", _brokerEntryChildren.remove(AuthenticationProvider.class.getSimpleName()));
-        assertTrue("should be empty", _brokerEntryChildren.isEmpty());
-
-        RecovererProvider recovererProvider = createRecoveryProvider(new ConfigurationEntry[0], new ConfiguredObject[0]);
-
-        try
-        {
-            _brokerRecoverer.create(recovererProvider, _brokerEntry);
-            fail("should have thrown an exception due to missing authentication provider configuration");
-        }
-        catch(IllegalConfigurationException e)
-        {
-            //expected
-        }
-    }
-
     public void testCreateBrokerWithOneAuthenticationProvider()
     {
         RecovererProvider recovererProvider = createRecoveryProvider(new ConfigurationEntry[]{_authenticationProviderEntry1},
@@ -202,29 +182,6 @@ public class BrokerRecovererTest extends
         assertEquals(Collections.singletonList(_authenticationProvider1), broker.getAuthenticationProviders());
     }
 
-    public void testCreateBrokerWithMultipleAuthenticationProvidersAndNoDefaultThrowsException()
-    {
-        AuthenticationProvider authenticationProvider2 = mock(AuthenticationProvider.class);
-        when(authenticationProvider2.getName()).thenReturn("authenticationProvider2");
-        ConfigurationEntry authenticationProviderEntry2 = mock(ConfigurationEntry.class);
-        _brokerEntryChildren.put(AuthenticationProvider.class.getSimpleName(), Arrays.asList(_authenticationProviderEntry1, authenticationProviderEntry2));
-
-        Map<String,Object> emptyBrokerAttributes = new HashMap<String,Object>();
-        when(_brokerEntry.getAttributes()).thenReturn(emptyBrokerAttributes);
-
-        RecovererProvider recovererProvider = createRecoveryProvider(new ConfigurationEntry[]{authenticationProviderEntry2, _authenticationProviderEntry1},
-                                                                     new ConfiguredObject[]{authenticationProvider2, _authenticationProvider1});
-        try
-        {
-            _brokerRecoverer.create(recovererProvider, _brokerEntry);
-            fail("should have thrown an exception due to missing authentication provider default");
-        }
-        catch(IllegalConfigurationException e)
-        {
-            //expected
-        }
-    }
-
     public void testCreateBrokerWithMultipleAuthenticationProvidersAndPorts()
     {
         //Create a second authentication provider
@@ -233,13 +190,10 @@ public class BrokerRecovererTest extends
         ConfigurationEntry authenticationProviderEntry2 = mock(ConfigurationEntry.class);
         _brokerEntryChildren.put(AuthenticationProvider.class.getSimpleName(), Arrays.asList(_authenticationProviderEntry1, authenticationProviderEntry2));
 
-        //Set the default authentication provider
         Map<String,Object> brokerAtttributes = new HashMap<String,Object>();
         when(_brokerEntry.getAttributes()).thenReturn(brokerAtttributes);
-        brokerAtttributes.put(Broker.DEFAULT_AUTHENTICATION_PROVIDER, "authenticationProvider2");
 
-        //Add a couple ports, one with a defined authentication provider and
-        //one without (which should then use the default)
+        //Add a couple ports
         ConfigurationEntry portEntry1 = mock(ConfigurationEntry.class);
         Port port1 = mock(Port.class);
         when(port1.getName()).thenReturn("port1");
@@ -249,6 +203,7 @@ public class BrokerRecovererTest extends
         Port port2 = mock(Port.class);
         when(port2.getName()).thenReturn("port2");
         when(port2.getPort()).thenReturn(5672);
+        when(port2.getAttribute(Port.AUTHENTICATION_PROVIDER)).thenReturn("authenticationProvider2");
         _brokerEntryChildren.put(Port.class.getSimpleName(), Arrays.asList(portEntry1, portEntry2));
 
         RecovererProvider recovererProvider = createRecoveryProvider(
@@ -258,47 +213,12 @@ public class BrokerRecovererTest extends
         Broker broker = _brokerRecoverer.create(recovererProvider, _brokerEntry);
 
         assertNotNull(broker);
-        assertEquals("Unexpected number of authentication providers", 2,broker.getAuthenticationProviders().size());
+        assertEquals("Unexpected number of authentication providers", 2, broker.getAuthenticationProviders().size());
 
         Collection<Port> ports = broker.getPorts();
         assertEquals("Unexpected number of ports", 2, ports.size());
         assertTrue(ports.contains(port1));
         assertTrue(ports.contains(port2));
-
-        verify(port1).setAuthenticationProvider(any(AuthenticationProvider.class));
-        verify(port1).setAuthenticationProvider(_authenticationProvider1);
-
-        verify(port2).setAuthenticationProvider(any(AuthenticationProvider.class));
-        verify(port2).setAuthenticationProvider(authenticationProvider2);
-    }
-
-    public void testCreateBrokerAssignsGroupAccessorToAuthenticationProviders()
-    {
-        //Create a second authentication provider
-        AuthenticationProvider authenticationProvider2 = mock(AuthenticationProvider.class);
-        when(authenticationProvider2.getName()).thenReturn("authenticationProvider2");
-        ConfigurationEntry authenticationProviderEntry2 = mock(ConfigurationEntry.class);
-        _brokerEntryChildren.put(AuthenticationProvider.class.getSimpleName(), Arrays.asList(_authenticationProviderEntry1, authenticationProviderEntry2));
-
-        //Set the default authentication provider
-        Map<String,Object> brokerAtttributes = new HashMap<String,Object>();
-        when(_brokerEntry.getAttributes()).thenReturn(brokerAtttributes);
-        brokerAtttributes.put(Broker.DEFAULT_AUTHENTICATION_PROVIDER, "authenticationProvider2");
-
-        //Create a group provider
-        ConfigurationEntry groupProviderEntry = mock(ConfigurationEntry.class);
-        GroupProvider groupProvider = mock(GroupProvider.class);
-        _brokerEntryChildren.put(GroupProvider.class.getSimpleName(), Arrays.asList(groupProviderEntry));
-
-        RecovererProvider recovererProvider = createRecoveryProvider(
-                new ConfigurationEntry[]{groupProviderEntry, authenticationProviderEntry2, _authenticationProviderEntry1},
-                new ConfiguredObject[]{groupProvider, authenticationProvider2, _authenticationProvider1});
-
-        Broker broker = _brokerRecoverer.create(recovererProvider, _brokerEntry);
-
-        assertNotNull(broker);
-        assertEquals("Unexpected number of authentication providers", 2, broker.getAuthenticationProviders().size());
-
     }
 
     public void testCreateBrokerWithGroupProvider()

Modified: qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/startup/DefaultRecovererProviderTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/startup/DefaultRecovererProviderTest.java?rev=1471141&r1=1471140&r2=1471141&view=diff
==============================================================================
--- qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/startup/DefaultRecovererProviderTest.java (original)
+++ qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/startup/DefaultRecovererProviderTest.java Tue Apr 23 20:54:19 2013
@@ -23,14 +23,17 @@ package org.apache.qpid.server.configura
 import static org.mockito.Mockito.mock;
 import junit.framework.TestCase;
 
+import org.apache.qpid.server.BrokerOptions;
 import org.apache.qpid.server.configuration.ConfiguredObjectRecoverer;
 import org.apache.qpid.server.logging.LogRecorder;
 import org.apache.qpid.server.logging.RootMessageLogger;
 import org.apache.qpid.server.model.AuthenticationProvider;
 import org.apache.qpid.server.model.Broker;
 import org.apache.qpid.server.model.GroupProvider;
+import org.apache.qpid.server.model.KeyStore;
 import org.apache.qpid.server.model.Plugin;
 import org.apache.qpid.server.model.Port;
+import org.apache.qpid.server.model.TrustStore;
 import org.apache.qpid.server.model.VirtualHost;
 import org.apache.qpid.server.configuration.updater.TaskExecutor;
 import org.apache.qpid.server.stats.StatisticsGatherer;
@@ -42,7 +45,8 @@ public class DefaultRecovererProviderTes
     {
         String[] supportedTypes = {Broker.class.getSimpleName(),
                 VirtualHost.class.getSimpleName(), AuthenticationProvider.class.getSimpleName(),
-                GroupProvider.class.getSimpleName(), Plugin.class.getSimpleName(), Port.class.getSimpleName()};
+                GroupProvider.class.getSimpleName(), Plugin.class.getSimpleName(), Port.class.getSimpleName(),
+                KeyStore.class.getSimpleName(), TrustStore.class.getSimpleName()};
 
         // mocking the required object
         StatisticsGatherer statisticsGatherer = mock(StatisticsGatherer.class);
@@ -51,7 +55,7 @@ public class DefaultRecovererProviderTes
         RootMessageLogger rootMessageLogger = mock(RootMessageLogger.class);
         TaskExecutor taskExecutor = mock(TaskExecutor.class);
 
-        DefaultRecovererProvider provider = new DefaultRecovererProvider(statisticsGatherer, virtualHostRegistry, logRecorder, rootMessageLogger, taskExecutor);
+        DefaultRecovererProvider provider = new DefaultRecovererProvider(statisticsGatherer, virtualHostRegistry, logRecorder, rootMessageLogger, taskExecutor, mock(BrokerOptions.class));
         for (String configuredObjectType : supportedTypes)
         {
             ConfiguredObjectRecoverer<?> recovever = provider.getRecoverer(configuredObjectType);

Modified: qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/startup/GroupProviderRecovererTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/startup/GroupProviderRecovererTest.java?rev=1471141&r1=1471140&r2=1471141&view=diff
==============================================================================
--- qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/startup/GroupProviderRecovererTest.java (original)
+++ qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/startup/GroupProviderRecovererTest.java Tue Apr 23 20:54:19 2013
@@ -30,6 +30,7 @@ import org.apache.qpid.server.configurat
 import org.apache.qpid.server.configuration.IllegalConfigurationException;
 import org.apache.qpid.server.model.Broker;
 import org.apache.qpid.server.model.GroupProvider;
+import org.apache.qpid.server.model.adapter.GroupProviderFactory;
 import org.apache.qpid.server.plugin.GroupManagerFactory;
 import org.apache.qpid.server.plugin.QpidServiceLoader;
 import org.apache.qpid.server.security.group.GroupManager;
@@ -46,6 +47,7 @@ public class GroupProviderRecovererTest 
     private QpidServiceLoader<GroupManagerFactory> _groupManagerServiceLoader;
     private Broker _broker;
     private ConfigurationEntry _configurationEntry;
+    private GroupProviderFactory _groupProviderFactory;
 
     @SuppressWarnings("unchecked")
     protected void setUp() throws Exception
@@ -58,6 +60,7 @@ public class GroupProviderRecovererTest 
 
         _groupManagerServiceLoader = mock(QpidServiceLoader.class);
         when(_groupManagerServiceLoader.instancesOf(GroupManagerFactory.class)).thenReturn(Collections.singletonList(_factory ));
+        _groupProviderFactory = new GroupProviderFactory(_groupManagerServiceLoader);
 
         _broker = mock(Broker.class);
 
@@ -70,8 +73,9 @@ public class GroupProviderRecovererTest 
     {
         GroupManager groupManager = mock(GroupManager.class);
         String name = groupManager.getClass().getSimpleName();
+        _attributes.put(GroupProvider.NAME, name);
         when(_factory.createInstance(_attributes)).thenReturn(groupManager);
-        GroupProviderRecoverer groupProviderRecoverer = new GroupProviderRecoverer(_groupManagerServiceLoader);
+        GroupProviderRecoverer groupProviderRecoverer = new GroupProviderRecoverer(_groupProviderFactory);
         GroupProvider groupProvider = groupProviderRecoverer.create(null, _configurationEntry, _broker);
         assertNotNull("Null group provider", groupProvider);
         assertEquals("Unexpected name", name, groupProvider.getName());
@@ -82,7 +86,7 @@ public class GroupProviderRecovererTest 
     {
         when(_factory.createInstance(_attributes)).thenReturn(null);
 
-        GroupProviderRecoverer groupProviderRecoverer = new GroupProviderRecoverer(_groupManagerServiceLoader);
+        GroupProviderRecoverer groupProviderRecoverer = new GroupProviderRecoverer(_groupProviderFactory);
         try
         {
             groupProviderRecoverer.create(null, _configurationEntry, _broker);

Modified: qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/startup/KeyStoreRecovererTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/startup/KeyStoreRecovererTest.java?rev=1471141&r1=1471140&r2=1471141&view=diff
==============================================================================
--- qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/startup/KeyStoreRecovererTest.java (original)
+++ qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/startup/KeyStoreRecovererTest.java Tue Apr 23 20:54:19 2013
@@ -27,12 +27,15 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.UUID;
 
+import javax.net.ssl.KeyManagerFactory;
+
+import junit.framework.TestCase;
+
 import org.apache.qpid.server.configuration.ConfigurationEntry;
 import org.apache.qpid.server.model.Broker;
 import org.apache.qpid.server.model.KeyStore;
-import org.apache.qpid.server.model.TrustStore;
-
-import junit.framework.TestCase;
+import org.apache.qpid.server.model.adapter.AbstractKeyStoreAdapter;
+import org.apache.qpid.test.utils.TestSSLConstants;
 
 public class KeyStoreRecovererTest extends TestCase
 {
@@ -40,6 +43,7 @@ public class KeyStoreRecovererTest exten
     public void testCreateWithAllAttributesProvided()
     {
         Map<String, Object> attributes = getKeyStoreAttributes();
+        Map<String, Object> attributesCopy = new HashMap<String, Object>(attributes);
 
         UUID id = UUID.randomUUID();
         Broker broker = mock(Broker.class);
@@ -49,36 +53,27 @@ public class KeyStoreRecovererTest exten
 
         KeyStoreRecoverer recovever = new KeyStoreRecoverer();
 
-        KeyStore KeyStore = recovever.create(null, entry, broker);
-        assertNotNull("Key store configured object is not created", KeyStore);
-        assertEquals(id, KeyStore.getId());
-        assertEquals("my-secret-password", KeyStore.getPassword());
-
-        assertNull("Password was unexpectedly returned from configured object", KeyStore.getAttribute(TrustStore.PASSWORD));
-
-        // password attribute should not be exposed by a key store configured object
-        // so, we should set password value to null in the map being used to create the key store configured object
-        attributes.put(KeyStore.PASSWORD, null);
-        for (Map.Entry<String, Object> attribute : attributes.entrySet())
+        KeyStore keyStore = recovever.create(null, entry, broker);
+        assertNotNull("Key store configured object is not created", keyStore);
+        assertEquals(id, keyStore.getId());
+
+        //verify we can retrieve the actual password using the method
+        assertEquals(TestSSLConstants.BROKER_TRUSTSTORE_PASSWORD, keyStore.getPassword());
+        assertNotNull(keyStore.getPassword());
+
+        //verify that we havent configured the key store with the actual dummy password value
+        assertFalse(AbstractKeyStoreAdapter.DUMMY_PASSWORD_MASK.equals(keyStore.getPassword()));
+
+        // Verify the remaining attributes, including that the password value returned
+        // via getAttribute is actually the dummy value and not the real password
+        attributesCopy.put(KeyStore.PASSWORD, AbstractKeyStoreAdapter.DUMMY_PASSWORD_MASK);
+        for (Map.Entry<String, Object> attribute : attributesCopy.entrySet())
         {
-            Object attributeValue = KeyStore.getAttribute(attribute.getKey());
+            Object attributeValue = keyStore.getAttribute(attribute.getKey());
             assertEquals("Unexpected value of attribute '" + attribute.getKey() + "'", attribute.getValue(), attributeValue);
         }
     }
 
-    private Map<String, Object> getKeyStoreAttributes()
-    {
-        Map<String, Object> attributes = new HashMap<String, Object>();
-        attributes.put(KeyStore.NAME, getName());
-        attributes.put(KeyStore.PATH, "/path/to/KeyStore");
-        attributes.put(KeyStore.PASSWORD, "my-secret-password");
-        attributes.put(KeyStore.TYPE, "NON-JKS");
-        attributes.put(KeyStore.KEY_MANAGER_FACTORY_ALGORITHM, "NON-STANDARD");
-        attributes.put(KeyStore.CERTIFICATE_ALIAS, "my-cert-alias");
-        attributes.put(KeyStore.DESCRIPTION, "description");
-        return attributes;
-    }
-
     public void testCreateWithMissedRequiredAttributes()
     {
         Map<String, Object> attributes = getKeyStoreAttributes();
@@ -108,4 +103,16 @@ public class KeyStoreRecovererTest exten
         }
     }
 
+    private Map<String, Object> getKeyStoreAttributes()
+    {
+        Map<String, Object> attributes = new HashMap<String, Object>();
+        attributes.put(KeyStore.NAME, getName());
+        attributes.put(KeyStore.PATH, TestSSLConstants.BROKER_KEYSTORE);
+        attributes.put(KeyStore.PASSWORD, TestSSLConstants.BROKER_KEYSTORE_PASSWORD);
+        attributes.put(KeyStore.TYPE, "jks");
+        attributes.put(KeyStore.KEY_MANAGER_FACTORY_ALGORITHM, KeyManagerFactory.getDefaultAlgorithm());
+        attributes.put(KeyStore.CERTIFICATE_ALIAS, "java-broker");
+        return attributes;
+    }
+
 }

Modified: qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/startup/TrustStoreRecovererTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/startup/TrustStoreRecovererTest.java?rev=1471141&r1=1471140&r2=1471141&view=diff
==============================================================================
--- qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/startup/TrustStoreRecovererTest.java (original)
+++ qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/startup/TrustStoreRecovererTest.java Tue Apr 23 20:54:19 2013
@@ -27,16 +27,21 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.UUID;
 
+import javax.net.ssl.TrustManagerFactory;
+
 import org.apache.qpid.server.configuration.ConfigurationEntry;
 import org.apache.qpid.server.model.Broker;
 import org.apache.qpid.server.model.TrustStore;
+import org.apache.qpid.server.model.adapter.AbstractKeyStoreAdapter;
 import org.apache.qpid.test.utils.QpidTestCase;
+import org.apache.qpid.test.utils.TestSSLConstants;
 
 public class TrustStoreRecovererTest extends QpidTestCase
 {
     public void testCreateWithAllAttributesProvided()
     {
         Map<String, Object> attributes = getTrustStoreAttributes();
+        Map<String, Object> attributesCopy = new HashMap<String, Object>(attributes);
 
         UUID id = UUID.randomUUID();
         Broker broker = mock(Broker.class);
@@ -44,38 +49,29 @@ public class TrustStoreRecovererTest ext
         when(entry.getAttributes()).thenReturn(attributes);
         when(entry.getId()).thenReturn(id);
 
-        TrustStoreRecoverer recovever = new TrustStoreRecoverer();
+        TrustStoreRecoverer recoverer = new TrustStoreRecoverer();
 
-        TrustStore trustStore = recovever.create(null, entry, broker);
+        TrustStore trustStore = recoverer.create(null, entry, broker);
         assertNotNull("Trust store configured object is not created", trustStore);
         assertEquals(id, trustStore.getId());
-        assertEquals("my-secret-password", trustStore.getPassword());
-
-        assertNull("Password was unexpectedly returned from configured object", trustStore.getAttribute(TrustStore.PASSWORD));
 
-        // password attribute should not be exposed by a trust store configured object
-        // so, we should set password value to null in the map being used to create the trust store configured object
-        attributes.put(TrustStore.PASSWORD, null);
-        for (Map.Entry<String, Object> attribute : attributes.entrySet())
+        //verify we can retrieve the actual password using the method
+        assertEquals(TestSSLConstants.BROKER_TRUSTSTORE_PASSWORD, trustStore.getPassword());
+        assertNotNull(trustStore.getPassword());
+
+        //verify that we havent configured the trust store with the actual dummy password value
+        assertFalse(AbstractKeyStoreAdapter.DUMMY_PASSWORD_MASK.equals(trustStore.getPassword()));
+
+        // Verify the remaining attributes, including that the password value returned
+        // via getAttribute is actually the dummy value and not the real password
+        attributesCopy.put(TrustStore.PASSWORD, AbstractKeyStoreAdapter.DUMMY_PASSWORD_MASK);
+        for (Map.Entry<String, Object> attribute : attributesCopy.entrySet())
         {
             Object attributeValue = trustStore.getAttribute(attribute.getKey());
             assertEquals("Unexpected value of attribute '" + attribute.getKey() + "'", attribute.getValue(), attributeValue);
         }
     }
 
-    private Map<String, Object> getTrustStoreAttributes()
-    {
-        Map<String, Object> attributes = new HashMap<String, Object>();
-        attributes.put(TrustStore.NAME, getName());
-        attributes.put(TrustStore.PATH, "/path/to/truststore");
-        attributes.put(TrustStore.PASSWORD, "my-secret-password");
-        attributes.put(TrustStore.TYPE, "NON-JKS");
-        attributes.put(TrustStore.KEY_MANAGER_FACTORY_ALGORITHM, "NON-STANDARD");
-        attributes.put(TrustStore.PEERS_ONLY, Boolean.TRUE);
-        attributes.put(TrustStore.DESCRIPTION, "Description");
-        return attributes;
-    }
-
     public void testCreateWithMissedRequiredAttributes()
     {
         Map<String, Object> attributes = getTrustStoreAttributes();
@@ -106,4 +102,16 @@ public class TrustStoreRecovererTest ext
         }
     }
 
+    private Map<String, Object> getTrustStoreAttributes()
+    {
+        Map<String, Object> attributes = new HashMap<String, Object>();
+        attributes.put(TrustStore.NAME, getName());
+        attributes.put(TrustStore.PATH, TestSSLConstants.BROKER_TRUSTSTORE);
+        attributes.put(TrustStore.PASSWORD, TestSSLConstants.BROKER_TRUSTSTORE_PASSWORD);
+        attributes.put(TrustStore.TYPE, "jks");
+        attributes.put(TrustStore.TRUST_MANAGER_FACTORY_ALGORITHM, TrustManagerFactory.getDefaultAlgorithm());
+        attributes.put(TrustStore.PEERS_ONLY, Boolean.TRUE);
+        return attributes;
+    }
+
 }

Modified: qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/store/ConfigurationEntryStoreTestCase.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/store/ConfigurationEntryStoreTestCase.java?rev=1471141&r1=1471140&r2=1471141&view=diff
==============================================================================
--- qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/store/ConfigurationEntryStoreTestCase.java (original)
+++ qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/store/ConfigurationEntryStoreTestCase.java Tue Apr 23 20:54:19 2013
@@ -60,7 +60,6 @@ public abstract class ConfigurationEntry
         _brokerId = UUID.randomUUID();
         _brokerAttributes = new HashMap<String, Object>();
         _brokerAttributes.put(Broker.DEFAULT_VIRTUAL_HOST, "test");
-        _brokerAttributes.put(Broker.DEFAULT_AUTHENTICATION_PROVIDER, "authenticationProvider1");
         _brokerAttributes.put(Broker.QUEUE_ALERT_THRESHOLD_MESSAGE_AGE, 9);
         _brokerAttributes.put(Broker.QUEUE_ALERT_THRESHOLD_QUEUE_DEPTH_MESSAGES, 8);
         _brokerAttributes.put(Broker.QUEUE_ALERT_THRESHOLD_QUEUE_DEPTH_BYTES, 7);
@@ -71,7 +70,6 @@ public abstract class ConfigurationEntry
         _brokerAttributes.put(Broker.QUEUE_MAXIMUM_DELIVERY_ATTEMPTS, 2);
         _brokerAttributes.put(Broker.QUEUE_DEAD_LETTER_QUEUE_ENABLED, true);
         _brokerAttributes.put(Broker.VIRTUALHOST_HOUSEKEEPING_CHECK_PERIOD, 1);
-        _brokerAttributes.put(Broker.ACL_FILE, "/path/to/acl");
         _brokerAttributes.put(Broker.CONNECTION_SESSION_COUNT_LIMIT, 1000);
         _brokerAttributes.put(Broker.CONNECTION_HEART_BEAT_DELAY, 2000);
         _brokerAttributes.put(Broker.STATISTICS_REPORTING_PERIOD, 4000);
@@ -171,7 +169,6 @@ public abstract class ConfigurationEntry
         ConfigurationEntry brokerConfigEntry = _store.getRootEntry();
         Map<String, Object> attributes = new HashMap<String, Object>();
         attributes.put(Broker.DEFAULT_VIRTUAL_HOST, "test");
-        attributes.put(Broker.DEFAULT_AUTHENTICATION_PROVIDER, "authenticationProvider1");
         attributes.put(Broker.QUEUE_ALERT_THRESHOLD_MESSAGE_AGE, 19);
         attributes.put(Broker.QUEUE_ALERT_THRESHOLD_QUEUE_DEPTH_MESSAGES, 18);
         attributes.put(Broker.QUEUE_ALERT_THRESHOLD_QUEUE_DEPTH_BYTES, 17);
@@ -182,7 +179,6 @@ public abstract class ConfigurationEntry
         attributes.put(Broker.QUEUE_MAXIMUM_DELIVERY_ATTEMPTS, 12);
         attributes.put(Broker.QUEUE_DEAD_LETTER_QUEUE_ENABLED, false);
         attributes.put(Broker.VIRTUALHOST_HOUSEKEEPING_CHECK_PERIOD, 11);
-        attributes.put(Broker.ACL_FILE, "/path/to/acl1");
         attributes.put(Broker.CONNECTION_SESSION_COUNT_LIMIT, 11000);
         attributes.put(Broker.CONNECTION_HEART_BEAT_DELAY, 12000);
         attributes.put(Broker.STATISTICS_REPORTING_PERIOD, 14000);
@@ -284,7 +280,7 @@ public abstract class ConfigurationEntry
         attributes.put(TrustStore.PATH, "/path/to/truststore");
         attributes.put(TrustStore.PASSWORD, "my-secret-password");
         attributes.put(TrustStore.TYPE, "NON-JKS");
-        attributes.put(TrustStore.KEY_MANAGER_FACTORY_ALGORITHM, "NON-STANDARD");
+        attributes.put(TrustStore.TRUST_MANAGER_FACTORY_ALGORITHM, "NON-STANDARD");
         attributes.put(TrustStore.DESCRIPTION, "Description");
 
         ConfigurationEntry trustStoreEntry = new ConfigurationEntry(trustStoreId, TrustStore.class.getSimpleName(), attributes,

Modified: qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/store/JsonConfigurationEntryStoreTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/store/JsonConfigurationEntryStoreTest.java?rev=1471141&r1=1471140&r2=1471141&view=diff
==============================================================================
--- qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/store/JsonConfigurationEntryStoreTest.java (original)
+++ qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/store/JsonConfigurationEntryStoreTest.java Tue Apr 23 20:54:19 2013
@@ -72,20 +72,20 @@ public class JsonConfigurationEntryStore
 
     public void testAttributeIsResolvedFromSystemProperties()
     {
-        String aclLocation = "path/to/acl/" + getTestName();
-        setTestSystemProperty("my.test.property", aclLocation);
+        String defaultVhost = getTestName();
+        setTestSystemProperty("my.test.property", defaultVhost);
 
         ConfigurationEntryStore store = getStore();
         ConfigurationEntry brokerConfigEntry = store.getRootEntry();
         Map<String, Object> attributes = new HashMap<String, Object>(brokerConfigEntry.getAttributes());
-        attributes.put(Broker.ACL_FILE, "${my.test.property}");
+        attributes.put(Broker.DEFAULT_VIRTUAL_HOST, "${my.test.property}");
         ConfigurationEntry updatedBrokerEntry = new ConfigurationEntry(brokerConfigEntry.getId(), Broker.class.getSimpleName(),
                 attributes, brokerConfigEntry.getChildrenIds(), store);
         store.save(updatedBrokerEntry);
 
         JsonConfigurationEntryStore store2 = new JsonConfigurationEntryStore(_storeFile.getAbsolutePath(), null);
 
-        assertEquals("Unresolved ACL value", aclLocation, store2.getRootEntry().getAttributes().get(Broker.ACL_FILE));
+        assertEquals("Unresolved default virtualhost  value", defaultVhost, store2.getRootEntry().getAttributes().get(Broker.DEFAULT_VIRTUAL_HOST));
     }
 
     public void testCreateEmptyStore()

Modified: qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/store/ManagementModeStoreHandlerTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/store/ManagementModeStoreHandlerTest.java?rev=1471141&r1=1471140&r2=1471141&view=diff
==============================================================================
--- qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/store/ManagementModeStoreHandlerTest.java (original)
+++ qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/store/ManagementModeStoreHandlerTest.java Tue Apr 23 20:54:19 2013
@@ -176,7 +176,17 @@ public class ManagementModeStoreHandlerT
         assertEquals("Unexpected state", State.QUIESCED, portEntry.getAttributes().get(Port.STATE));
     }
 
-    public void testVirtualHostEntryIsQuiesced()
+    public void testVirtualHostEntryIsNotQuiescedByDefault()
+    {
+        virtualHostEntryQuiescedStatusTestImpl(false);
+    }
+
+    public void testVirtualHostEntryIsQuiescedWhenRequested()
+    {
+        virtualHostEntryQuiescedStatusTestImpl(true);
+    }
+
+    private void virtualHostEntryQuiescedStatusTestImpl(boolean mmQuiesceVhosts)
     {
         UUID virtualHostId = UUID.randomUUID();
         ConfigurationEntry virtualHost = mock(ConfigurationEntry.class);
@@ -188,11 +198,17 @@ public class ManagementModeStoreHandlerT
         when(_store.getEntry(virtualHostId)).thenReturn(virtualHost);
         when(_root.getChildrenIds()).thenReturn(new HashSet<UUID>(Arrays.asList(_portEntryId, virtualHostId)));
 
+        State expectedState = mmQuiesceVhosts ? State.QUIESCED : null;
+        if(mmQuiesceVhosts)
+        {
+            _options.setManagementModeQuiesceVirtualHosts(mmQuiesceVhosts);
+        }
+
         _handler = new ManagementModeStoreHandler(_store, _options);
 
         ConfigurationEntry hostEntry = _handler.getEntry(virtualHostId);
         Map<String, Object> hostAttributes = hostEntry.getAttributes();
-        assertEquals("Unexpected state", State.QUIESCED, hostAttributes.get(VirtualHost.STATE));
+        assertEquals("Unexpected state", expectedState, hostAttributes.get(VirtualHost.STATE));
         hostAttributes.remove(VirtualHost.STATE);
         assertEquals("Unexpected attributes", attributes, hostAttributes);
     }

Modified: qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/model/BrokerShutdownTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/model/BrokerShutdownTest.java?rev=1471141&r1=1471140&r2=1471141&view=diff
==============================================================================
--- qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/model/BrokerShutdownTest.java (original)
+++ qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/model/BrokerShutdownTest.java Tue Apr 23 20:54:19 2013
@@ -23,6 +23,7 @@ package org.apache.qpid.server.model;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
+import org.apache.qpid.server.BrokerOptions;
 import org.apache.qpid.server.configuration.ConfigurationEntry;
 import org.apache.qpid.server.configuration.ConfigurationEntryStore;
 import org.apache.qpid.server.configuration.ConfiguredObjectRecoverer;
@@ -121,7 +122,7 @@ public class BrokerShutdownTest extends 
         RootMessageLogger rootMessageLogger = mock(RootMessageLogger.class);
 
         // recover the broker from the store
-        RecovererProvider provider = new DefaultRecovererProvider(statisticsGatherer, virtualHostRegistry, logRecorder, rootMessageLogger, _taskExecutor);
+        RecovererProvider provider = new DefaultRecovererProvider(statisticsGatherer, virtualHostRegistry, logRecorder, rootMessageLogger, _taskExecutor, mock(BrokerOptions.class));
         ConfiguredObjectRecoverer<? extends ConfiguredObject> brokerRecoverer = provider.getRecoverer(Broker.class.getSimpleName());
 
         Broker broker = (Broker) brokerRecoverer.create(provider, store.getRootEntry());

Modified: qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/model/adapter/PortFactoryTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/model/adapter/PortFactoryTest.java?rev=1471141&r1=1471140&r2=1471141&view=diff
==============================================================================
--- qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/model/adapter/PortFactoryTest.java (original)
+++ qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/model/adapter/PortFactoryTest.java Tue Apr 23 20:54:19 2013
@@ -22,8 +22,8 @@ package org.apache.qpid.server.model.ada
 
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
+import static org.mockito.Mockito.any;
 
-import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
@@ -36,6 +36,7 @@ import java.util.UUID;
 
 import org.apache.qpid.server.configuration.BrokerProperties;
 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.KeyStore;
 import org.apache.qpid.server.model.Port;
@@ -47,8 +48,6 @@ import org.apache.qpid.test.utils.QpidTe
 public class PortFactoryTest extends QpidTestCase
 {
     private UUID _portId = UUID.randomUUID();
-    private UUID _keyStoreId = UUID.randomUUID();
-    private UUID _trustStoreId = UUID.randomUUID();
     private int _portNumber = 123;
     private Set<String> _tcpStringSet = Collections.singleton(Transport.TCP.name());
     private Set<Transport> _tcpTransportSet = Collections.singleton(Transport.TCP);
@@ -60,19 +59,22 @@ public class PortFactoryTest extends Qpi
     private Broker _broker = mock(Broker.class);
     private KeyStore _keyStore = mock(KeyStore.class);
     private TrustStore _trustStore = mock(TrustStore.class);
-
+    private String _authProviderName = "authProvider";
+    private AuthenticationProvider _authProvider = mock(AuthenticationProvider.class);
     private PortFactory _portFactory;
 
     @Override
     protected void setUp() throws Exception
     {
+        when(_broker.findAuthenticationProviderByName(_authProviderName)).thenReturn(_authProvider);
+
         setTestSystemProperty(BrokerProperties.PROPERTY_BROKER_DEFAULT_AMQP_PROTOCOL_EXCLUDES, null);
         setTestSystemProperty(BrokerProperties.PROPERTY_BROKER_DEFAULT_AMQP_PROTOCOL_INCLUDES, null);
         _portFactory = new PortFactory();
 
         _attributes.put(Port.PORT, _portNumber);
         _attributes.put(Port.TRANSPORTS, _tcpStringSet);
-
+        _attributes.put(Port.AUTHENTICATION_PROVIDER, _authProviderName);
         _attributes.put(Port.TCP_NO_DELAY, "true");
         _attributes.put(Port.RECEIVE_BUFFER_SIZE, "1");
         _attributes.put(Port.SEND_BUFFER_SIZE, "2");
@@ -113,6 +115,7 @@ public class PortFactoryTest extends Qpi
     {
         Map<String, Object> attributes = new HashMap<String, Object>();
         attributes.put(Port.PORT, 1);
+        attributes.put(Port.AUTHENTICATION_PROVIDER, _authProviderName);
         Port port = _portFactory.createPort(_portId, _broker, attributes);
 
         assertNotNull(port);
@@ -134,15 +137,14 @@ public class PortFactoryTest extends Qpi
 
     public void testCreateAmqpPort()
     {
-        createAmqpPortTestImpl(false,false,false);
+        createAmqpPortTestImpl(false, false, false, null, null);
     }
 
     public void testCreateAmqpPortUsingSslFailsWithoutKeyStore()
     {
-        when(_broker.getKeyStores()).thenReturn(new ArrayList<KeyStore>());
         try
         {
-            createAmqpPortTestImpl(true,false,false);
+            createAmqpPortTestImpl(true, false, false, null, null);
             fail("expected exception due to lack of SSL keystore");
         }
         catch(IllegalConfigurationException e)
@@ -153,18 +155,22 @@ public class PortFactoryTest extends Qpi
 
     public void testCreateAmqpPortUsingSslSucceedsWithKeyStore()
     {
-        when(_broker.getKeyStores()).thenReturn(Collections.singleton(_keyStore));
+        String keyStoreName = "myKeyStore";
+        when(_broker.findKeyStoreByName(keyStoreName)).thenReturn(_keyStore);
 
-        createAmqpPortTestImpl(true,false,false);
+        createAmqpPortTestImpl(true, false, false, keyStoreName, null);
     }
 
     public void testCreateAmqpPortNeedingClientAuthFailsWithoutTrustStore()
     {
-        when(_broker.getKeyStores()).thenReturn(Collections.singleton(_keyStore));
-        when(_broker.getTrustStores()).thenReturn(new ArrayList<TrustStore>());
+        String keyStoreName = "myKeyStore";
+        when(_broker.findKeyStoreByName(keyStoreName)).thenReturn(_keyStore);
+
+        when(_broker.findTrustStoreByName(any(String.class))).thenReturn(null);
+
         try
         {
-            createAmqpPortTestImpl(true,true,false);
+            createAmqpPortTestImpl(true, true, false, keyStoreName, null);
             fail("expected exception due to lack of SSL truststore");
         }
         catch(IllegalConfigurationException e)
@@ -175,19 +181,23 @@ public class PortFactoryTest extends Qpi
 
     public void testCreateAmqpPortNeedingClientAuthSucceedsWithTrustStore()
     {
-        when(_broker.getKeyStores()).thenReturn(Collections.singleton(_keyStore));
-        when(_broker.getTrustStores()).thenReturn(Collections.singleton(_trustStore));
+        String keyStoreName = "myKeyStore";
+        when(_broker.findKeyStoreByName(keyStoreName)).thenReturn(_keyStore);
+
+        String trustStoreName = "myTrustStore";
+        when(_broker.findTrustStoreByName(trustStoreName)).thenReturn(_trustStore);
 
-        createAmqpPortTestImpl(true,true,false);
+        createAmqpPortTestImpl(true, true, false, keyStoreName, new String[]{trustStoreName});
     }
 
     public void testCreateAmqpPortWantingClientAuthFailsWithoutTrustStore()
     {
-        when(_broker.getKeyStores()).thenReturn(Collections.singleton(_keyStore));
-        when(_broker.getTrustStores()).thenReturn(new ArrayList<TrustStore>());
+        String keyStoreName = "myKeyStore";
+        when(_broker.findKeyStoreByName(keyStoreName)).thenReturn(_keyStore);
+
         try
         {
-            createAmqpPortTestImpl(true,false,true);
+            createAmqpPortTestImpl(true, false, true, keyStoreName, null);
             fail("expected exception due to lack of SSL truststore");
         }
         catch(IllegalConfigurationException e)
@@ -198,13 +208,17 @@ public class PortFactoryTest extends Qpi
 
     public void testCreateAmqpPortWantingClientAuthSucceedsWithTrustStore()
     {
-        when(_broker.getKeyStores()).thenReturn(Collections.singleton(_keyStore));
-        when(_broker.getTrustStores()).thenReturn(Collections.singleton(_trustStore));
+        String keyStoreName = "myKeyStore";
+        when(_broker.findKeyStoreByName(keyStoreName)).thenReturn(_keyStore);
+
+        String trustStoreName = "myTrustStore";
+        when(_broker.findTrustStoreByName(trustStoreName)).thenReturn(_trustStore);
 
-        createAmqpPortTestImpl(true,false,true);
+        createAmqpPortTestImpl(true, false, true, keyStoreName, new String[]{trustStoreName});
     }
 
-    public void createAmqpPortTestImpl(boolean useSslTransport, boolean needClientAuth, boolean wantClientAuth)
+    public void createAmqpPortTestImpl(boolean useSslTransport, boolean needClientAuth, boolean wantClientAuth,
+                                       String keystoreName, String[] trustStoreNames)
     {
         Set<Protocol> amqp010ProtocolSet = Collections.singleton(Protocol.AMQP_0_10);
         Set<String> amqp010StringSet = Collections.singleton(Protocol.AMQP_0_10.name());
@@ -225,6 +239,16 @@ public class PortFactoryTest extends Qpi
             _attributes.put(Port.WANT_CLIENT_AUTH, "true");
         }
 
+        if(keystoreName != null)
+        {
+            _attributes.put(Port.KEY_STORE, keystoreName);
+        }
+
+        if(trustStoreNames != null)
+        {
+            _attributes.put(Port.TRUST_STORES, Arrays.asList(trustStoreNames));
+        }
+
         Port port = _portFactory.createPort(_portId, _broker, _attributes);
 
         assertNotNull(port);
@@ -254,6 +278,7 @@ public class PortFactoryTest extends Qpi
         Set<String> nonAmqpStringSet = Collections.singleton(Protocol.JMX_RMI.name());
         _attributes = new HashMap<String, Object>();
         _attributes.put(Port.PROTOCOLS, nonAmqpStringSet);
+        _attributes.put(Port.AUTHENTICATION_PROVIDER, _authProviderName);
         _attributes.put(Port.PORT, _portNumber);
         _attributes.put(Port.TRANSPORTS, _tcpStringSet);
 
@@ -279,6 +304,7 @@ public class PortFactoryTest extends Qpi
         Set<String> nonAmqpStringSet = Collections.singleton(Protocol.JMX_RMI.name());
         _attributes = new HashMap<String, Object>();
         _attributes.put(Port.PROTOCOLS, nonAmqpStringSet);
+        _attributes.put(Port.AUTHENTICATION_PROVIDER, _authProviderName);
         _attributes.put(Port.PORT, _portNumber);
 
         Port port = _portFactory.createPort(_portId, _broker, _attributes);
@@ -335,4 +361,29 @@ public class PortFactoryTest extends Qpi
             // pass
         }
     }
+
+    public void testCreateRMIPortRequestingSslFails()
+    {
+        String keyStoreName = "myKeyStore";
+
+        Map<String, Object> attributes = new HashMap<String, Object>();
+        attributes.put(Port.PORT, 1);
+        attributes.put(Port.NAME, getTestName());
+        attributes.put(Port.TRANSPORTS, Collections.singleton(Transport.SSL));
+        attributes.put(Port.PROTOCOLS, Collections.singleton(Protocol.RMI));
+        _attributes.put(Port.KEY_STORE, keyStoreName);
+
+        when(_broker.findKeyStoreByName(keyStoreName)).thenReturn(_keyStore);
+
+        try
+        {
+            _portFactory.createPort(_portId, _broker, attributes);
+            fail("RMI port creation should fail due to requesting SSL");
+        }
+        catch(IllegalConfigurationException e)
+        {
+            e.printStackTrace();
+            // pass
+        }
+    }
 }

Modified: qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/security/auth/sasl/CRAMMD5HexInitialiserTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/security/auth/sasl/CRAMMD5HexInitialiserTest.java?rev=1471141&r1=1471140&r2=1471141&view=diff
==============================================================================
--- qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/security/auth/sasl/CRAMMD5HexInitialiserTest.java (original)
+++ qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/security/auth/sasl/CRAMMD5HexInitialiserTest.java Tue Apr 23 20:54:19 2013
@@ -20,88 +20,94 @@
  */
 package org.apache.qpid.server.security.auth.sasl;
 
-import junit.framework.TestCase;
-
-import org.apache.qpid.server.security.auth.database.PropertiesPrincipalDatabase;
-import org.apache.qpid.server.security.auth.sasl.crammd5.CRAMMD5HexInitialiser;
+import java.io.File;
+import java.io.UnsupportedEncodingException;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
 
 import javax.security.auth.callback.Callback;
 import javax.security.auth.callback.NameCallback;
 import javax.security.auth.callback.PasswordCallback;
-import javax.security.auth.callback.UnsupportedCallbackException;
-import java.io.IOException;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import java.util.Properties;
+
+import junit.framework.TestCase;
+
+import org.apache.qpid.server.security.auth.database.Base64MD5PasswordFilePrincipalDatabase;
+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.
  */
 public class CRAMMD5HexInitialiserTest extends TestCase
 {
-    public void testHex()
-    {
-        //Create User details for testing
-        String user = "testUser";
-        String password = "testPassword";
+    private static final String TEST_PASSWORD = "testPassword";
+    private static final String TEST_USER = "testUser";
+    private File _file;
 
-        perform(user, password);
-    }
-
-    public void testHashedHex()
+    public void testHashedHex() throws Exception
     {
-        //Create User details for testing
-        String user = "testUser";
-        String password = "testPassword";
-
-        //Create a hashed password that we then attempt to put through the call back mechanism.
-        try
-        {
-            password = new String(MessageDigest.getInstance("MD5").digest(password.getBytes()));
-        }
-        catch (NoSuchAlgorithmException e)
-        {
-            fail(e.getMessage());
-        }
-
-        perform(user, password);
+        perform(TEST_USER, getHash(TEST_PASSWORD));
     }
 
-    public void perform(String user, String password)
+    public void perform(String user, char[] password) throws Exception
     {
         CRAMMD5HexInitialiser initialiser = new CRAMMD5HexInitialiser();
 
-        //Use properties to create a PrincipalDatabase
-        Properties users = new Properties();
-        users.put(user, password);
-
-        PropertiesPrincipalDatabase db = new PropertiesPrincipalDatabase(users);
-
+        PrincipalDatabase db = new Base64MD5PasswordFilePrincipalDatabase();
+        db.open(_file);
         initialiser.initialise(db);
 
-        //setup the callbacks
         PasswordCallback passwordCallback = new PasswordCallback("password:", false);
         NameCallback usernameCallback = new NameCallback("user:", user);
 
         Callback[] callbacks = new Callback[]{usernameCallback, passwordCallback};
 
-        //Check the
-        try
+        assertNull("The password was not null before the handle call.", passwordCallback.getPassword());
+        initialiser.getCallbackHandler().handle(callbacks);
+
+        assertArrayEquals(toHex(password), passwordCallback.getPassword());
+    }
+
+    public void setUp() throws Exception
+    {
+        super.setUp();
+        _file = TestFileUtils.createTempFile(this, "password-file", new Passwd().getOutput(TEST_USER , TEST_PASSWORD));
+    }
+
+    public void tearDown() throws Exception
+    {
+        if (_file != null)
         {
-            assertNull("The password was not null before the handle call.", passwordCallback.getPassword());
-            initialiser.getCallbackHandler().handle(callbacks);
+            _file.delete();
         }
-        catch (IOException e)
+        super.tearDown();
+    }
+
+    private char[] getHash(String text) throws NoSuchAlgorithmException, UnsupportedEncodingException
+    {
+
+        byte[] data = text.getBytes("utf-8");
+
+        MessageDigest md = MessageDigest.getInstance("MD5");
+
+        for (byte b : data)
         {
-            fail(e.getMessage());
+            md.update(b);
         }
-        catch (UnsupportedCallbackException e)
+
+        byte[] digest = md.digest();
+
+        char[] hash = new char[digest.length];
+
+        int index = 0;
+        for (byte b : digest)
         {
-            fail(e.getMessage());
+            hash[index++] = (char) b;
         }
 
-        //Hex the password we initialised with and compare it with the passwordCallback
-        assertArrayEquals(toHex(password.toCharArray()), passwordCallback.getPassword());
+        return hash;
     }
 
     private void assertArrayEquals(char[] expected, char[] actual)
@@ -135,4 +141,5 @@ public class CRAMMD5HexInitialiserTest e
 
         return hex;
     }
+
 }

Modified: qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/security/group/FileGroupManagerFactoryTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/security/group/FileGroupManagerFactoryTest.java?rev=1471141&r1=1471140&r2=1471141&view=diff
==============================================================================
--- qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/security/group/FileGroupManagerFactoryTest.java (original)
+++ qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/security/group/FileGroupManagerFactoryTest.java Tue Apr 23 20:54:19 2013
@@ -35,8 +35,8 @@ public class FileGroupManagerFactoryTest
 
     public void testInstanceCreated() throws Exception
     {
-        _configuration.put(GroupProvider.TYPE, FileGroupManagerFactory.FILE_GROUP_MANAGER_TYPE);
-        _configuration.put(FileGroupManagerFactory.FILE, _emptyButValidGroupFile);
+        _configuration.put(GroupProvider.TYPE, FileGroupManagerFactory.GROUP_FILE_PROVIDER_TYPE);
+        _configuration.put(FileGroupManagerFactory.PATH, _emptyButValidGroupFile);
 
         GroupManager manager = _factory.createInstance(_configuration);
         assertNotNull(manager);
@@ -60,8 +60,8 @@ public class FileGroupManagerFactoryTest
 
     public void testRejectsConfigThatIsMissingAttributeValue() throws Exception
     {
-        _configuration.put(GroupProvider.TYPE, FileGroupManagerFactory.FILE_GROUP_MANAGER_TYPE);
-        _configuration.put(FileGroupManagerFactory.FILE, null);
+        _configuration.put(GroupProvider.TYPE, FileGroupManagerFactory.GROUP_FILE_PROVIDER_TYPE);
+        _configuration.put(FileGroupManagerFactory.PATH, null);
 
         try
         {

Modified: qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/security/group/FileGroupManagerTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/security/group/FileGroupManagerTest.java?rev=1471141&r1=1471140&r2=1471141&view=diff
==============================================================================
--- qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/security/group/FileGroupManagerTest.java (original)
+++ qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/security/group/FileGroupManagerTest.java Tue Apr 23 20:54:19 2013
@@ -20,13 +20,11 @@
 package org.apache.qpid.server.security.group;
 
 import java.io.File;
-import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.security.Principal;
 import java.util.Properties;
 import java.util.Set;
 
-import org.apache.qpid.server.configuration.IllegalConfigurationException;
 import org.apache.qpid.server.security.auth.UsernamePrincipal;
 import org.apache.qpid.test.utils.QpidTestCase;
 
@@ -62,17 +60,26 @@ public class FileGroupManagerTest extend
 
     public void testNonExistentGroupFile() throws Exception
     {
-        final String filePath = "/does.not.exist/";
-
+        final String filePath = TMP_FOLDER + File.separator + "non.existing";
+        File file = new File(filePath);
+        if (file.exists())
+        {
+            file.delete();
+        }
+        assertFalse("File should not exist", file.exists());
         try
         {
             _manager = new FileGroupManager(filePath);
-            fail("expected exception was not thrown");
+            assertFalse("File should be created", file.exists());
+            _manager.onCreate();
+            assertTrue("File should be created", file.exists());
+            _manager.open();
+            Set<Principal> groups = _manager.getGroupPrincipals();
+            assertTrue("No group should exist", groups.isEmpty());
         }
-        catch(IllegalConfigurationException ce)
+        finally
         {
-            assertNotNull(ce.getCause());
-            assertTrue(ce.getCause() instanceof FileNotFoundException);
+            file.delete();
         }
     }
 
@@ -80,7 +87,7 @@ public class FileGroupManagerTest extend
     {
         final String groupFileName = writeGroupFile();
         _manager = new FileGroupManager(groupFileName);
-
+        _manager.open();
         Set<Principal> principals = _manager.getGroupPrincipalsForUser("user1");
         assertEquals(1, principals.size());
         assertTrue(principals.contains(new GroupPrincipal("myGroup")));
@@ -90,7 +97,7 @@ public class FileGroupManagerTest extend
     {
         final String groupFileName = writeGroupFile();
         _manager = new FileGroupManager(groupFileName);
-
+        _manager.open();
         Set<Principal> principals = _manager.getUserPrincipalsForGroup("myGroup");
         assertEquals(1, principals.size());
         assertTrue(principals.contains(new UsernamePrincipal("user1")));
@@ -100,7 +107,7 @@ public class FileGroupManagerTest extend
     {
         final String groupFileName = writeGroupFile(MY_GROUP, MYGROUP_USERS, MY_GROUP2, MYGROUP_USERS);
         _manager = new FileGroupManager(groupFileName);
-
+        _manager.open();
         Set<Principal> principals = _manager.getGroupPrincipals();
         assertEquals(2, principals.size());
         assertTrue(principals.contains(new GroupPrincipal("myGroup")));
@@ -111,7 +118,7 @@ public class FileGroupManagerTest extend
     {
         final String groupFileName = writeGroupFile();
         _manager = new FileGroupManager(groupFileName);
-
+        _manager.open();
         Set<Principal> principals = _manager.getGroupPrincipals();
         assertEquals(1, principals.size());
 
@@ -126,7 +133,7 @@ public class FileGroupManagerTest extend
     {
         final String groupFileName = writeGroupFile(MY_GROUP, MYGROUP_USERS);
         _manager = new FileGroupManager(groupFileName);
-
+        _manager.open();
         Set<Principal> principals = _manager.getGroupPrincipals();
         assertEquals(1, principals.size());
 
@@ -140,7 +147,7 @@ public class FileGroupManagerTest extend
     {
         final String groupFileName = writeGroupFile(MY_GROUP, MYGROUP_USERS);
         _manager = new FileGroupManager(groupFileName);
-
+        _manager.open();
         Set<Principal> principals = _manager.getUserPrincipalsForGroup("myGroup");
         assertEquals(1, principals.size());
         assertFalse(principals.contains(new UsernamePrincipal("user2")));
@@ -156,7 +163,7 @@ public class FileGroupManagerTest extend
     {
         final String groupFileName = writeGroupFile(MY_GROUP, MYGROUP_USERS);
         _manager = new FileGroupManager(groupFileName);
-
+        _manager.open();
         Set<Principal> principals = _manager.getUserPrincipalsForGroup("myGroup");
         assertEquals(1, principals.size());
         assertTrue(principals.contains(new UsernamePrincipal("user1")));

Modified: qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/util/BrokerTestHelper.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/util/BrokerTestHelper.java?rev=1471141&r1=1471140&r2=1471141&view=diff
==============================================================================
--- qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/util/BrokerTestHelper.java (original)
+++ qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/util/BrokerTestHelper.java Tue Apr 23 20:54:19 2013
@@ -77,7 +77,7 @@ public class BrokerTestHelper
         RootMessageLogger rootMessageLogger = CurrentActor.get().getRootMessageLogger();
         when(broker.getRootMessageLogger()).thenReturn(rootMessageLogger);
         when(broker.getVirtualHostRegistry()).thenReturn(new VirtualHostRegistry());
-        when(broker.getSecurityManager()).thenReturn(new SecurityManager(null));
+        when(broker.getSecurityManager()).thenReturn(new SecurityManager(mock(Broker.class), false));
         GenericActor.setDefaultMessageLogger(rootMessageLogger);
         return broker;
     }
@@ -96,14 +96,14 @@ public class BrokerTestHelper
             throws Exception
     {
         StatisticsGatherer statisticsGatherer = mock(StatisticsGatherer.class);
-        VirtualHost host = new VirtualHostImpl(virtualHostRegistry, statisticsGatherer, new SecurityManager(null), virtualHostConfiguration);
+        VirtualHost host = new VirtualHostImpl(virtualHostRegistry, statisticsGatherer, new SecurityManager(mock(Broker.class), false), virtualHostConfiguration);
         virtualHostRegistry.registerVirtualHost(host);
         return host;
     }
 
     public static VirtualHost createVirtualHost(VirtualHostConfiguration virtualHostConfiguration) throws Exception
     {
-        return new VirtualHostImpl(null, mock(StatisticsGatherer.class), new SecurityManager(null), virtualHostConfiguration);
+        return new VirtualHostImpl(null, mock(StatisticsGatherer.class), new SecurityManager(mock(Broker.class), false), virtualHostConfiguration);
     }
 
     public static VirtualHost createVirtualHost(String name, VirtualHostRegistry virtualHostRegistry) throws Exception
@@ -156,7 +156,7 @@ public class BrokerTestHelper
 
     public static Exchange createExchange(String hostName) throws Exception
     {
-        SecurityManager securityManager = new SecurityManager(null);
+        SecurityManager securityManager = new SecurityManager(mock(Broker.class), false);
         VirtualHost virtualHost = mock(VirtualHost.class);
         when(virtualHost.getName()).thenReturn(hostName);
         when(virtualHost.getSecurityManager()).thenReturn(securityManager);

Modified: qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/virtualhost/VirtualHostImplTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/virtualhost/VirtualHostImplTest.java?rev=1471141&r1=1471140&r2=1471141&view=diff
==============================================================================
--- qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/virtualhost/VirtualHostImplTest.java (original)
+++ qpid/branches/QPID-4659/qpid/java/broker/src/test/java/org/apache/qpid/server/virtualhost/VirtualHostImplTest.java Tue Apr 23 20:54:19 2013
@@ -211,7 +211,7 @@ public class VirtualHostImplTest extends
         _virtualHostRegistry = broker.getVirtualHostRegistry();
 
         VirtualHostConfiguration configuration = new  VirtualHostConfiguration(vhostName, config, broker);
-        VirtualHost host = new VirtualHostImpl(_virtualHostRegistry, mock(StatisticsGatherer.class), new SecurityManager(null), configuration);
+        VirtualHost host = new VirtualHostImpl(_virtualHostRegistry, mock(StatisticsGatherer.class), new SecurityManager(mock(Broker.class), false), configuration);
         _virtualHostRegistry.registerVirtualHost(host);
 
         return host;
@@ -295,7 +295,7 @@ public class VirtualHostImplTest extends
         Configuration config = new PropertiesConfiguration();
         config.setProperty("store.type", MemoryMessageStore.TYPE);
         VirtualHostConfiguration configuration = new  VirtualHostConfiguration(virtualHostName, config, broker);
-        VirtualHost host = new VirtualHostImpl(_virtualHostRegistry, mock(StatisticsGatherer.class), new SecurityManager(null), configuration);
+        VirtualHost host = new VirtualHostImpl(_virtualHostRegistry, mock(StatisticsGatherer.class), new SecurityManager(mock(Broker.class), false), configuration);
         _virtualHostRegistry.registerVirtualHost(host);
         return host;
     }

Modified: qpid/branches/QPID-4659/qpid/java/build.deps
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-4659/qpid/java/build.deps?rev=1471141&r1=1471140&r2=1471141&view=diff
==============================================================================
--- qpid/branches/QPID-4659/qpid/java/build.deps (original)
+++ qpid/branches/QPID-4659/qpid/java/build.deps Tue Apr 23 20:54:19 2013
@@ -47,17 +47,17 @@ slf4j-log4j=lib/required/slf4j-log4j12-1
 
 xalan=lib/required/xalan-2.7.0.jar
 
-jetty=lib/required/jetty-server-7.6.3.v20120416.jar
-jetty-continuation=lib/required/jetty-continuation-7.6.3.v20120416.jar
-jetty-security=lib/required/jetty-security-7.6.3.v20120416.jar
-jetty-util=lib/required/jetty-util-7.6.3.v20120416.jar
-jetty-io=lib/required/jetty-io-7.6.3.v20120416.jar
-jetty-http=lib/required/jetty-http-7.6.3.v20120416.jar
-jetty-servlet=lib/required/jetty-servlet-7.6.3.v20120416.jar
-jetty-websocket=lib/required/jetty-websocket-7.6.3.v20120416.jar
+jetty=lib/required/jetty-server-7.6.10.v20130312.jar
+jetty-continuation=lib/required/jetty-continuation-7.6.10.v20130312.jar
+jetty-security=lib/required/jetty-security-7.6.10.v20130312.jar
+jetty-util=lib/required/jetty-util-7.6.10.v20130312.jar
+jetty-io=lib/required/jetty-io-7.6.10.v20130312.jar
+jetty-http=lib/required/jetty-http-7.6.10.v20130312.jar
+jetty-servlet=lib/required/jetty-servlet-7.6.10.v20130312.jar
+jetty-websocket=lib/required/jetty-websocket-7.6.10.v20130312.jar
 servlet-api=${geronimo-servlet}
 
-dojo=lib/required/dojo-war-1.7.2.war
+dojo=lib/required/dojo-war-1.8.3.war
 
 jackson-core=lib/required/jackson-core-asl-1.9.0.jar
 jackson-mapper=lib/required/jackson-mapper-asl-1.9.0.jar

Modified: qpid/branches/QPID-4659/qpid/java/client/example/src/main/java/org/apache/qpid/example/hello.properties
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-4659/qpid/java/client/example/src/main/java/org/apache/qpid/example/hello.properties?rev=1471141&r1=1471140&r2=1471141&view=diff
==============================================================================
--- qpid/branches/QPID-4659/qpid/java/client/example/src/main/java/org/apache/qpid/example/hello.properties (original)
+++ qpid/branches/QPID-4659/qpid/java/client/example/src/main/java/org/apache/qpid/example/hello.properties Tue Apr 23 20:54:19 2013
@@ -20,7 +20,7 @@ java.naming.factory.initial = org.apache
 
 # register some connection factories
 # connectionfactory.[jndiname] = [ConnectionURL]
-connectionfactory.qpidConnectionfactory = amqp://guest:guest@clientid/test?brokerlist='tcp://localhost:5672'
+connectionfactory.qpidConnectionfactory = amqp://guest:guest@clientid/?brokerlist='tcp://localhost:5672'
 
 # Register an AMQP destination in JNDI
 # destination.[jniName] = [Address Format]

Modified: qpid/branches/QPID-4659/qpid/java/common/src/main/java/org/apache/qpid/ssl/SSLContextFactory.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-4659/qpid/java/common/src/main/java/org/apache/qpid/ssl/SSLContextFactory.java?rev=1471141&r1=1471140&r2=1471141&view=diff
==============================================================================
--- qpid/branches/QPID-4659/qpid/java/common/src/main/java/org/apache/qpid/ssl/SSLContextFactory.java (original)
+++ qpid/branches/QPID-4659/qpid/java/common/src/main/java/org/apache/qpid/ssl/SSLContextFactory.java Tue Apr 23 20:54:19 2013
@@ -31,7 +31,6 @@ import javax.net.ssl.SSLContext;
 import javax.net.ssl.TrustManager;
 import javax.net.ssl.TrustManagerFactory;
 import javax.net.ssl.X509TrustManager;
-import java.security.cert.X509Certificate;
 
 import java.io.IOException;
 import java.security.GeneralSecurityException;
@@ -39,7 +38,6 @@ import java.security.KeyStore;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.List;
 
 /**
  * Factory used to create SSLContexts. SSL needs to be configured

Modified: qpid/branches/QPID-4659/qpid/java/ivy.retrieve.xml
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-4659/qpid/java/ivy.retrieve.xml?rev=1471141&r1=1471140&r2=1471141&view=diff
==============================================================================
--- qpid/branches/QPID-4659/qpid/java/ivy.retrieve.xml (original)
+++ qpid/branches/QPID-4659/qpid/java/ivy.retrieve.xml Tue Apr 23 20:54:19 2013
@@ -59,15 +59,15 @@
     <dependency org="org.mockito" name="mockito-all" rev="1.9.0" transitive="false"/>
     <dependency org="org.slf4j" name="slf4j-api" rev="1.6.4" transitive="false"/>
     <dependency org="org.slf4j" name="slf4j-log4j12" rev="1.6.4" transitive="false"/>
-    <dependency org="org.eclipse.jetty" name="jetty-server" rev="7.6.3.v20120416" transitive="false"/>
-    <dependency org="org.eclipse.jetty" name="jetty-websocket" rev="7.6.3.v20120416" transitive="false"/>
-    <dependency org="org.eclipse.jetty" name="jetty-continuation" rev="7.6.3.v20120416" transitive="false"/>
-    <dependency org="org.eclipse.jetty" name="jetty-io" rev="7.6.3.v20120416" transitive="false"/>
-    <dependency org="org.eclipse.jetty" name="jetty-http" rev="7.6.3.v20120416" transitive="false"/>
-    <dependency org="org.eclipse.jetty" name="jetty-security" rev="7.6.3.v20120416" transitive="false"/>
-    <dependency org="org.eclipse.jetty" name="jetty-servlet" rev="7.6.3.v20120416" transitive="false"/>
-    <dependency org="org.eclipse.jetty" name="jetty-util" rev="7.6.3.v20120416" transitive="false"/>
-    <dependency org="org.dojotoolkit" name="dojo-war" rev="1.7.2" transitive="false"/>
+    <dependency org="org.eclipse.jetty" name="jetty-server" rev="7.6.10.v20130312" transitive="false"/>
+    <dependency org="org.eclipse.jetty" name="jetty-websocket" rev="7.6.10.v20130312" transitive="false"/>
+    <dependency org="org.eclipse.jetty" name="jetty-continuation" rev="7.6.10.v20130312" transitive="false"/>
+    <dependency org="org.eclipse.jetty" name="jetty-io" rev="7.6.10.v20130312" transitive="false"/>
+    <dependency org="org.eclipse.jetty" name="jetty-http" rev="7.6.10.v20130312" transitive="false"/>
+    <dependency org="org.eclipse.jetty" name="jetty-security" rev="7.6.10.v20130312" transitive="false"/>
+    <dependency org="org.eclipse.jetty" name="jetty-servlet" rev="7.6.10.v20130312" transitive="false"/>
+    <dependency org="org.eclipse.jetty" name="jetty-util" rev="7.6.10.v20130312" transitive="false"/>
+    <dependency org="org.dojotoolkit" name="dojo-war" rev="1.8.3" transitive="false"/>
     <dependency org="xalan" name="xalan" rev="2.7.0" transitive="false"/>
     <dependency org="velocity" name="velocity" rev="1.4" transitive="false"/>
     <dependency org="velocity" name="velocity-dep" rev="1.4" transitive="false"/>

Propchange: qpid/branches/QPID-4659/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/LoggingManagement.java
------------------------------------------------------------------------------
  Merged /qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/LoggingManagement.java:r1463061,1465459,1465590,1466482,1467334,1467922,1467930,1467932,1467938,1467940,1467992,1468815-1468816,1468830,1468875,1468953,1469256,1469914,1469916-1469917,1469937,1470439,1470454,1470457,1470463,1470474,1470897,1470899,1471004

Propchange: qpid/branches/QPID-4659/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ManagedBroker.java
------------------------------------------------------------------------------
  Merged /qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ManagedBroker.java:r1463061,1465459,1465590,1466482,1467334,1467922,1467930,1467932,1467938,1467940,1467992,1468815-1468816,1468830,1468875,1468953,1469256,1469914,1469916-1469917,1469937,1470439,1470454,1470457,1470463,1470474,1470897,1470899,1471004

Propchange: qpid/branches/QPID-4659/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ManagedConnection.java
------------------------------------------------------------------------------
  Merged /qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ManagedConnection.java:r1463061,1465459,1465590,1466482,1467334,1467922,1467930,1467932,1467938,1467940,1467992,1468815-1468816,1468830,1468875,1468953,1469256,1469914,1469916-1469917,1469937,1470439,1470454,1470457,1470463,1470474,1470897,1470899,1471004

Propchange: qpid/branches/QPID-4659/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ManagedExchange.java
------------------------------------------------------------------------------
  Merged /qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ManagedExchange.java:r1463061,1465459,1465590,1466482,1467334,1467922,1467930,1467932,1467938,1467940,1467992,1468815-1468816,1468830,1468875,1468953,1469256,1469914,1469916-1469917,1469937,1470439,1470454,1470457,1470463,1470474,1470897,1470899,1471004

Propchange: qpid/branches/QPID-4659/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ManagedQueue.java
------------------------------------------------------------------------------
  Merged /qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ManagedQueue.java:r1463061,1465459,1465590,1466482,1467334,1467922,1467930,1467932,1467938,1467940,1467992,1468815-1468816,1468830,1468875,1468953,1469256,1469914,1469916-1469917,1469937,1470439,1470454,1470457,1470463,1470474,1470897,1470899,1471004

Propchange: qpid/branches/QPID-4659/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/UserManagement.java
------------------------------------------------------------------------------
  Merged /qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/UserManagement.java:r1463061,1465459,1465590,1466482,1467334,1467922,1467930,1467932,1467938,1467940,1467992,1468815-1468816,1468830,1468875,1468953,1469256,1469914,1469916-1469917,1469937,1470439,1470454,1470457,1470463,1470474,1470897,1470899,1471004

Propchange: qpid/branches/QPID-4659/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/annotations/MBeanAttribute.java
------------------------------------------------------------------------------
  Merged /qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/annotations/MBeanAttribute.java:r1463061,1465459,1465590,1466482,1467334,1467922,1467930,1467932,1467938,1467940,1467992,1468815-1468816,1468830,1468875,1468953,1469256,1469914,1469916-1469917,1469937,1470439,1470454,1470457,1470463,1470474,1470897,1470899,1471004

Propchange: qpid/branches/QPID-4659/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/annotations/MBeanConstructor.java
------------------------------------------------------------------------------
  Merged /qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/annotations/MBeanConstructor.java:r1463061,1465459,1465590,1466482,1467334,1467922,1467930,1467932,1467938,1467940,1467992,1468815-1468816,1468830,1468875,1468953,1469256,1469914,1469916-1469917,1469937,1470439,1470454,1470457,1470463,1470474,1470897,1470899,1471004

Propchange: qpid/branches/QPID-4659/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/annotations/MBeanDescription.java
------------------------------------------------------------------------------
  Merged /qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/annotations/MBeanDescription.java:r1463061,1465459,1465590,1466482,1467334,1467922,1467930,1467932,1467938,1467940,1467992,1468815-1468816,1468830,1468875,1468953,1469256,1469914,1469916-1469917,1469937,1470439,1470454,1470457,1470463,1470474,1470897,1470899,1471004

Propchange: qpid/branches/QPID-4659/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/annotations/MBeanOperation.java
------------------------------------------------------------------------------
  Merged /qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/annotations/MBeanOperation.java:r1463061,1465459,1465590,1466482,1467334,1467922,1467930,1467932,1467938,1467940,1467992,1468815-1468816,1468830,1468875,1468953,1469256,1469914,1469916-1469917,1469937,1470439,1470454,1470457,1470463,1470474,1470897,1470899,1471004

Propchange: qpid/branches/QPID-4659/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/annotations/MBeanOperationParameter.java
------------------------------------------------------------------------------
  Merged /qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/annotations/MBeanOperationParameter.java:r1463061,1465459,1465590,1466482,1467334,1467922,1467930,1467932,1467938,1467940,1467992,1468815-1468816,1468830,1468875,1468953,1469256,1469914,1469916-1469917,1469937,1470439,1470454,1470457,1470463,1470474,1470897,1470899,1471004

Modified: qpid/branches/QPID-4659/qpid/java/systests/etc/config-systests.json
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-4659/qpid/java/systests/etc/config-systests.json?rev=1471141&r1=1471140&r2=1471141&view=diff
==============================================================================
--- qpid/branches/QPID-4659/qpid/java/systests/etc/config-systests.json (original)
+++ qpid/branches/QPID-4659/qpid/java/systests/etc/config-systests.json Tue Apr 23 20:54:19 2013
@@ -19,23 +19,30 @@
  *
  */
 {
-  "name": "QpidBroker",
-  "defaultAuthenticationProvider" : "plain",
+  "name": "Broker",
   "defaultVirtualHost" : "test",
-  "keyStorePath": "${QPID_HOME}/../test-profiles/test_resources/ssl/java_broker_keystore.jks",
-  "keyStorePassword": "password",
-  "trustStorePath": "${QPID_HOME}/../test-profiles/test_resources/ssl/java_broker_truststore.jks",
-  "trustStorePassword": "password",
   "authenticationproviders" : [ {
     "name" : "plain",
     "type" : "PlainPasswordFile",
     "path" : "${QPID_HOME}/etc/passwd"
   } ],
+  "keystores" : [ {
+    "name" : "systestsKeyStore",
+    "path" : "${QPID_HOME}/../test-profiles/test_resources/ssl/java_broker_keystore.jks",
+    "password" : "password"
+  } ],
+  "truststores" : [ {
+    "name" : "systestsTrustStore",
+    "path" : "${QPID_HOME}/../test-profiles/test_resources/ssl/java_broker_truststore.jks",
+    "password" : "password"
+  } ],
   "ports" : [  {
     "name" : "amqp",
+    "authenticationProvider" : "plain",
     "port" : "${test.port}"
   }, {
     "name" : "http",
+    "authenticationProvider" : "plain",
     "port" : "${test.hport}",
     "protocols" : [ "HTTP" ]
   }, {
@@ -44,6 +51,7 @@
     "protocols" : [ "RMI" ]
   }, {
     "name" : "jmx",
+    "authenticationProvider" : "plain",
     "port" : "${test.cport}",
     "protocols" : [ "JMX_RMI" ]
   }],
@@ -61,4 +69,4 @@
     "name" : "jmxManagement"
   } ]
   */
-}
\ No newline at end of file
+}

Modified: qpid/branches/QPID-4659/qpid/java/systests/src/main/java/org/apache/qpid/client/ssl/SSLTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-4659/qpid/java/systests/src/main/java/org/apache/qpid/client/ssl/SSLTest.java?rev=1471141&r1=1471140&r2=1471141&view=diff
==============================================================================
--- qpid/branches/QPID-4659/qpid/java/systests/src/main/java/org/apache/qpid/client/ssl/SSLTest.java (original)
+++ qpid/branches/QPID-4659/qpid/java/systests/src/main/java/org/apache/qpid/client/ssl/SSLTest.java Tue Apr 23 20:54:19 2013
@@ -362,9 +362,12 @@ public class SSLTest extends QpidBrokerT
             Map<String, Object> sslPortAttributes = new HashMap<String, Object>();
             sslPortAttributes.put(Port.TRANSPORTS, Collections.singleton(Transport.SSL));
             sslPortAttributes.put(Port.PORT, DEFAULT_SSL_PORT);
+            sslPortAttributes.put(Port.AUTHENTICATION_PROVIDER, TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER);
             sslPortAttributes.put(Port.NEED_CLIENT_AUTH, needClientAuth);
             sslPortAttributes.put(Port.WANT_CLIENT_AUTH, wantClientAuth);
             sslPortAttributes.put(Port.NAME, TestBrokerConfiguration.ENTRY_NAME_SSL_PORT);
+            sslPortAttributes.put(Port.KEY_STORE, TestBrokerConfiguration.ENTRY_NAME_SSL_KEYSTORE);
+            sslPortAttributes.put(Port.TRUST_STORES, Collections.singleton(TestBrokerConfiguration.ENTRY_NAME_SSL_TRUSTSTORE));
             getBrokerConfiguration().addPortConfiguration(sslPortAttributes);
         }
     }

Propchange: qpid/branches/QPID-4659/qpid/java/systests/src/main/java/org/apache/qpid/server/SupportedProtocolVersionsTest.java
------------------------------------------------------------------------------
  Merged /qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/SupportedProtocolVersionsTest.java:r1463061,1465459,1465590,1466482,1467334,1467922,1467930,1467932,1467938,1467940,1467992,1468815-1468816,1468830,1468875,1468953,1469256,1469914,1469916-1469917,1469937,1470439,1470454,1470457,1470463,1470474,1470897,1470899,1471004



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


Mime
View raw message