Modified: qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManagerTest.java URL: http://svn.apache.org/viewvc/qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManagerTest.java?rev=1630749&r1=1630748&r2=1630749&view=diff ============================================================================== --- qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManagerTest.java (original) +++ qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManagerTest.java Fri Oct 10 09:59:55 2014 @@ -90,31 +90,28 @@ public class PrincipalDatabaseAuthentica private void setupMocks() throws Exception { - _principalDatabase = mock(PrincipalDatabase.class); - - when(_principalDatabase.getMechanisms()).thenReturn(Collections.singletonList(MOCK_MECH_NAME)); - when(_principalDatabase.createSaslServer(MOCK_MECH_NAME, LOCALHOST, null)).thenReturn(new MySaslServer(false, true)); + setUpPrincipalDatabase(); setupManager(false); _manager.initialise(); } + private void setUpPrincipalDatabase() throws SaslException + { + _principalDatabase = mock(PrincipalDatabase.class); + + when(_principalDatabase.getMechanisms()).thenReturn(Collections.singletonList(MOCK_MECH_NAME)); + when(_principalDatabase.createSaslServer(MOCK_MECH_NAME, LOCALHOST, null)).thenReturn(new MySaslServer(false, true)); + } + private void setupManager(final boolean recovering) { Map<String,Object> attrs = new HashMap<String, Object>(); attrs.put(ConfiguredObject.ID, UUID.randomUUID()); attrs.put(ConfiguredObject.NAME, getTestName()); attrs.put("path", _passwordFileLocation); - _manager = new PrincipalDatabaseAuthenticationManager(attrs, BrokerTestHelper.createBrokerMock()) - { - @Override - protected PrincipalDatabase createDatabase() - { - return _principalDatabase; - } - - }; + _manager = getPrincipalDatabaseAuthenticationManager(attrs); if(recovering) { _manager.open(); @@ -273,6 +270,41 @@ public class PrincipalDatabaseAuthentica assertFalse("Password file was not deleted", new File(_passwordFileLocation).exists()); } + public void testCreateForInvalidPath() throws Exception + { + setUpPrincipalDatabase(); + + Map<String,Object> attrs = new HashMap<>(); + attrs.put(ConfiguredObject.ID, UUID.randomUUID()); + attrs.put(ConfiguredObject.NAME, getTestName()); + String path = TMP_FOLDER + File.separator + getTestName() + System.nanoTime() + File.separator + "users"; + attrs.put("path", path); + + _manager = getPrincipalDatabaseAuthenticationManager(attrs); + try + { + _manager.create(); + fail("Creation with invalid path should have failed"); + } + catch(IllegalConfigurationException e) + { + assertEquals("Unexpected exception message:" + e.getMessage(), String.format("Cannot create password file at '%s'", path), e.getMessage()); + } + } + + PrincipalDatabaseAuthenticationManager getPrincipalDatabaseAuthenticationManager(final Map<String, Object> attrs) + { + return new PrincipalDatabaseAuthenticationManager(attrs, BrokerTestHelper.createBrokerMock()) + { + @Override + protected PrincipalDatabase createDatabase() + { + return _principalDatabase; + } + + }; + } + private void deletePasswordFileIfExists() { File passwordFile = new File(_passwordFileLocation);
Modified: qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/SimpleLDAPAuthenticationManagerFactoryTest.java URL: http://svn.apache.org/viewvc/qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/SimpleLDAPAuthenticationManagerFactoryTest.java?rev=1630749&r1=1630748&r2=1630749&view=diff ============================================================================== --- qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/SimpleLDAPAuthenticationManagerFactoryTest.java (original) +++ qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/SimpleLDAPAuthenticationManagerFactoryTest.java Fri Oct 10 09:59:55 2014 @@ -57,40 +57,15 @@ public class SimpleLDAPAuthenticationMan _configuration.put(AuthenticationProvider.NAME, getName()); } - public void testLdapInstanceCreated() throws Exception + public void testLdapCreated() throws Exception { _configuration.put(AuthenticationProvider.TYPE, SimpleLDAPAuthenticationManager.PROVIDER_TYPE); - _configuration.put("providerUrl", "ldap://example.com:389/"); - _configuration.put("searchContext", "dc=example"); - - AuthenticationProvider manager = _factory.create(AuthenticationProvider.class, _configuration, _broker); - assertNotNull(manager); - - } - - public void testLdapsInstanceCreated() throws Exception - { - _configuration.put(AuthenticationProvider.TYPE, SimpleLDAPAuthenticationManager.PROVIDER_TYPE); - _configuration.put("providerUrl", "ldaps://example.com:636/"); - _configuration.put("searchContext", "dc=example"); - - AuthenticationProvider manager = _factory.create(AuthenticationProvider.class, _configuration, _broker); - assertNotNull(manager); - - } - - public void testLdapsWithTrustStoreInstanceCreated() throws Exception - { - when(_broker.getChildren(eq(TrustStore.class))).thenReturn(Collections.singletonList(_trustStore)); - - - _configuration.put(AuthenticationProvider.TYPE, SimpleLDAPAuthenticationManager.PROVIDER_TYPE); _configuration.put("providerUrl", "ldaps://example.com:636/"); _configuration.put("searchContext", "dc=example"); - _configuration.put("trustStore", "mytruststore"); + _configuration.put("searchFilter", "(uid={0})"); + _configuration.put("ldapContextFactory", TestLdapDirectoryContext.class.getName()); - AuthenticationProvider manager = _factory.create(AuthenticationProvider.class, _configuration, _broker); - assertNotNull(manager); + _factory.create(AuthenticationProvider.class, _configuration, _broker); } public void testLdapsWhenTrustStoreNotFound() throws Exception @@ -100,6 +75,7 @@ public class SimpleLDAPAuthenticationMan _configuration.put(AuthenticationProvider.TYPE, SimpleLDAPAuthenticationManager.PROVIDER_TYPE); _configuration.put("providerUrl", "ldaps://example.com:636/"); _configuration.put("searchContext", "dc=example"); + _configuration.put("searchFilter", "(uid={0})"); _configuration.put("trustStore", "notfound"); try @@ -110,7 +86,7 @@ public class SimpleLDAPAuthenticationMan catch(IllegalArgumentException e) { // PASS - assertTrue("Message does not include underlying issue", e.getMessage().contains("name 'notfound'")); + assertTrue("Message does not include underlying issue ", e.getMessage().contains("name 'notfound'")); assertTrue("Message does not include the attribute name", e.getMessage().contains("trustStore")); assertTrue("Message does not include the expected type", e.getMessage().contains("TrustStore")); } Modified: qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/store/BrokerRecovererTest.java URL: http://svn.apache.org/viewvc/qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/store/BrokerRecovererTest.java?rev=1630749&r1=1630748&r2=1630749&view=diff ============================================================================== --- qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/store/BrokerRecovererTest.java (original) +++ qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/store/BrokerRecovererTest.java Fri Oct 10 09:59:55 2014 @@ -21,7 +21,9 @@ package org.apache.qpid.server.store; import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.reset; import static org.mockito.Mockito.when; +import static org.mockito.Mockito.verify; import java.util.Arrays; import java.util.Collections; @@ -40,6 +42,7 @@ import org.apache.qpid.server.logging.Lo import org.apache.qpid.server.model.AuthenticationProvider; import org.apache.qpid.server.model.Broker; import org.apache.qpid.server.model.BrokerModel; +import org.apache.qpid.server.model.BrokerShutdownProvider; import org.apache.qpid.server.model.ConfiguredObject; import org.apache.qpid.server.model.GroupProvider; import org.apache.qpid.server.model.JsonSystemConfigImpl; @@ -55,6 +58,7 @@ public class BrokerRecovererTest extends private UUID _authenticationProvider1Id = UUID.randomUUID(); private SystemConfig<?> _systemConfig; private TaskExecutor _taskExecutor; + private BrokerShutdownProvider _brokerShutdownProvider; @Override protected void setUp() throws Exception @@ -63,8 +67,11 @@ public class BrokerRecovererTest extends _taskExecutor = new CurrentThreadTaskExecutor(); _taskExecutor.start(); + _brokerShutdownProvider = mock(BrokerShutdownProvider.class); _systemConfig = new JsonSystemConfigImpl(_taskExecutor, - mock(EventLogger.class), mock(LogRecorder.class), new BrokerOptions()); + mock(EventLogger.class), mock(LogRecorder.class), + new BrokerOptions(), + _brokerShutdownProvider); when(_brokerEntry.getId()).thenReturn(_brokerId); when(_brokerEntry.getType()).thenReturn(Broker.class.getSimpleName()); @@ -251,18 +258,10 @@ public class BrokerRecovererTest extends brokerAttributes.put(Broker.NAME, getName()); when(_brokerEntry.getAttributes()).thenReturn(brokerAttributes); - try - { - resolveObjects(_brokerEntry); - Broker<?> broker = _systemConfig.getBroker(); - broker.open(); - fail("The broker creation should fail due to unsupported model version"); - } - catch (IllegalConfigurationException e) - { - assertEquals("The model version '" + incompatibleVersion - + "' in configuration is incompatible with the broker model version '" + BrokerModel.MODEL_VERSION + "'", e.getMessage()); - } + resolveObjects(_brokerEntry); + Broker<?> broker = _systemConfig.getBroker(); + broker.open(); + verify(_brokerShutdownProvider).shutdown(); } } @@ -276,20 +275,12 @@ public class BrokerRecovererTest extends when(_brokerEntry.getAttributes()).thenReturn(brokerAttributes); - try - { - UnresolvedConfiguredObject<? extends ConfiguredObject> recover = - _systemConfig.getObjectFactory().recover(_brokerEntry, _systemConfig); + UnresolvedConfiguredObject<? extends ConfiguredObject> recover = + _systemConfig.getObjectFactory().recover(_brokerEntry, _systemConfig); - Broker<?> broker = (Broker<?>) recover.resolve(); - broker.open(); - fail("The broker creation should fail due to unsupported model version"); - } - catch (IllegalConfigurationException e) - { - assertEquals("The model version '" + incompatibleVersion - + "' in configuration is incompatible with the broker model version '" + BrokerModel.MODEL_VERSION + "'", e.getMessage()); - } + Broker<?> broker = (Broker<?>) recover.resolve(); + broker.open(); + verify(_brokerShutdownProvider).shutdown(); } public void testIncorrectModelVersion() throws Exception @@ -303,18 +294,12 @@ public class BrokerRecovererTest extends brokerAttributes.put(Broker.MODEL_VERSION, modelVersion); when(_brokerEntry.getAttributes()).thenReturn(brokerAttributes); - try - { - UnresolvedConfiguredObject<? extends ConfiguredObject> recover = - _systemConfig.getObjectFactory().recover(_brokerEntry, _systemConfig); - Broker<?> broker = (Broker<?>) recover.resolve(); - broker.open(); - fail("The broker creation should fail due to unsupported model version"); - } - catch (IllegalConfigurationException e) - { - // pass - } + UnresolvedConfiguredObject<? extends ConfiguredObject> recover = + _systemConfig.getObjectFactory().recover(_brokerEntry, _systemConfig); + Broker<?> broker = (Broker<?>) recover.resolve(); + broker.open(); + verify(_brokerShutdownProvider).shutdown(); + reset(_brokerShutdownProvider); } } Modified: qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/store/BrokerStoreUpgraderAndRecovererTest.java URL: http://svn.apache.org/viewvc/qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/store/BrokerStoreUpgraderAndRecovererTest.java?rev=1630749&r1=1630748&r2=1630749&view=diff ============================================================================== --- qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/store/BrokerStoreUpgraderAndRecovererTest.java (original) +++ qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/store/BrokerStoreUpgraderAndRecovererTest.java Fri Oct 10 09:59:55 2014 @@ -32,6 +32,7 @@ import org.apache.qpid.server.BrokerOpti import org.apache.qpid.server.configuration.updater.CurrentThreadTaskExecutor; import org.apache.qpid.server.logging.EventLogger; import org.apache.qpid.server.logging.LogRecorder; +import org.apache.qpid.server.model.BrokerShutdownProvider; import org.apache.qpid.server.model.ConfiguredObject; import org.apache.qpid.server.model.JsonSystemConfigImpl; import org.apache.qpid.server.model.SystemConfig; @@ -60,7 +61,8 @@ public class BrokerStoreUpgraderAndRecov _systemConfig = new JsonSystemConfigImpl(_taskExecutor, mock(EventLogger.class), mock(LogRecorder.class), - new BrokerOptions()); + new BrokerOptions(), + mock(BrokerShutdownProvider.class)); } public void testUpgradeVirtualHostWithJDBCStoreAndBoneCPPool() Modified: qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/virtualhostnode/AbstractStandardVirtualHostNodeTest.java URL: http://svn.apache.org/viewvc/qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/virtualhostnode/AbstractStandardVirtualHostNodeTest.java?rev=1630749&r1=1630748&r2=1630749&view=diff ============================================================================== --- qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/virtualhostnode/AbstractStandardVirtualHostNodeTest.java (original) +++ qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/virtualhostnode/AbstractStandardVirtualHostNodeTest.java Fri Oct 10 09:59:55 2014 @@ -20,22 +20,30 @@ */ package org.apache.qpid.server.virtualhostnode; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import java.security.AccessControlException; +import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.Map; import java.util.UUID; +import java.util.concurrent.atomic.AtomicBoolean; +import org.apache.qpid.server.configuration.IllegalConfigurationException; import org.apache.qpid.server.configuration.updater.CurrentThreadTaskExecutor; import org.apache.qpid.server.configuration.updater.TaskExecutor; import org.apache.qpid.server.model.Broker; import org.apache.qpid.server.model.BrokerModel; +import org.apache.qpid.server.model.ConfiguredObject; import org.apache.qpid.server.model.ConfiguredObjectFactoryImpl; import org.apache.qpid.server.model.Model; +import org.apache.qpid.server.model.RemoteReplicationNode; import org.apache.qpid.server.model.State; import org.apache.qpid.server.model.SystemConfig; import org.apache.qpid.server.model.VirtualHost; @@ -348,6 +356,132 @@ public class AbstractStandardVirtualHost assertEquals("Virtual host node state changed unexpectedly", State.ACTIVE, node.getState()); } + public void testValidateOnCreateFails() throws Exception + { + String nodeName = getTestName(); + Map<String, Object> attributes = Collections.<String, Object>singletonMap(TestVirtualHostNode.NAME, nodeName); + + final DurableConfigurationStore store = mock(DurableConfigurationStore.class); + doThrow(new RuntimeException("Cannot open store")).when(store).openConfigurationStore(any(ConfiguredObject.class), any(boolean.class)); + AbstractStandardVirtualHostNode node = createAbstractStandardVirtualHostNode(attributes, store); + + try + { + node.validateOnCreate(); + fail("Cannot create node"); + } + catch (IllegalConfigurationException e) + { + assertTrue("Unexpected exception " + e.getMessage(), e.getMessage().startsWith("Cannot open node configuration store")); + } + } + + public void testValidateOnCreateSucceeds() throws Exception + { + String nodeName = getTestName(); + Map<String, Object> attributes = Collections.<String, Object>singletonMap(TestVirtualHostNode.NAME, nodeName); + + final DurableConfigurationStore store = mock(DurableConfigurationStore.class); + AbstractStandardVirtualHostNode node = createAbstractStandardVirtualHostNode(attributes, store); + + node.validateOnCreate(); + verify(store).openConfigurationStore(node, false); + verify(store).closeConfigurationStore(); + } + + public void testOpenFails() throws Exception + { + String nodeName = getTestName(); + Map<String, Object> attributes = Collections.<String, Object>singletonMap(TestVirtualHostNode.NAME, nodeName); + + DurableConfigurationStore store = mock(DurableConfigurationStore.class); + AbstractVirtualHostNode node = new TestAbstractVirtualHostNode( _broker, attributes, store); + node.open(); + assertEquals("Unexpected node state", State.ERRORED, node.getState()); + } + + public void testOpenSucceeds() throws Exception + { + String nodeName = getTestName(); + Map<String, Object> attributes = Collections.<String, Object>singletonMap(TestVirtualHostNode.NAME, nodeName); + + final AtomicBoolean onFailureFlag = new AtomicBoolean(); + DurableConfigurationStore store = mock(DurableConfigurationStore.class); + AbstractVirtualHostNode node = new TestAbstractVirtualHostNode( _broker, attributes, store) + { + @Override + public void onValidate() + { + // no op + } + + @Override + protected void onExceptionInOpen(RuntimeException e) + { + try + { + super.onExceptionInOpen(e); + } + finally + { + onFailureFlag.set(true); + } + } + }; + + node.open(); + assertEquals("Unexpected node state", State.ACTIVE, node.getState()); + assertFalse("onExceptionInOpen was called", onFailureFlag.get()); + } + + + public void testDeleteInErrorStateAfterOpen() + { + String nodeName = getTestName(); + Map<String, Object> attributes = Collections.<String, Object>singletonMap(TestVirtualHostNode.NAME, nodeName); + + final DurableConfigurationStore store = mock(DurableConfigurationStore.class); + doThrow(new RuntimeException("Cannot open store")).when(store).openConfigurationStore(any(ConfiguredObject.class), any(boolean.class)); + AbstractStandardVirtualHostNode node = createAbstractStandardVirtualHostNode(attributes, store); + node.open(); + assertEquals("Unexpected node state", State.ERRORED, node.getState()); + + node.delete(); + assertEquals("Unexpected state", State.DELETED, node.getState()); + } + + public void testActivateInErrorStateAfterOpen() throws Exception + { + String nodeName = getTestName(); + Map<String, Object> attributes = Collections.<String, Object>singletonMap(TestVirtualHostNode.NAME, nodeName); + + DurableConfigurationStore store = mock(DurableConfigurationStore.class); + doThrow(new RuntimeException("Cannot open store")).when(store).openConfigurationStore(any(ConfiguredObject.class), any(boolean.class)); + AbstractVirtualHostNode node = createAbstractStandardVirtualHostNode(attributes, store); + node.open(); + assertEquals("Unexpected node state", State.ERRORED, node.getState()); + doNothing().when(store).openConfigurationStore(any(ConfiguredObject.class), any(boolean.class)); + + node.setAttributes(Collections.<String, Object>singletonMap(VirtualHostNode.DESIRED_STATE, State.ACTIVE)); + assertEquals("Unexpected state", State.ACTIVE, node.getState()); + } + + public void testStartInErrorStateAfterOpen() throws Exception + { + String nodeName = getTestName(); + Map<String, Object> attributes = Collections.<String, Object>singletonMap(TestVirtualHostNode.NAME, nodeName); + + DurableConfigurationStore store = mock(DurableConfigurationStore.class); + doThrow(new RuntimeException("Cannot open store")).when(store).openConfigurationStore(any(ConfiguredObject.class), any(boolean.class)); + AbstractVirtualHostNode node = createAbstractStandardVirtualHostNode(attributes, store); + node.open(); + assertEquals("Unexpected node state", State.ERRORED, node.getState()); + doNothing().when(store).openConfigurationStore(any(ConfiguredObject.class), any(boolean.class)); + + node.start(); + assertEquals("Unexpected state", State.ACTIVE, node.getState()); + } + private ConfiguredObjectRecord createVirtualHostConfiguredObjectRecord(UUID virtualHostId) { Map<String, Object> virtualHostAttributes = new HashMap<>(); @@ -384,4 +518,62 @@ public class AbstractStandardVirtualHost return configStoreThatProduces(null); } + + private AbstractStandardVirtualHostNode createAbstractStandardVirtualHostNode(final Map<String, Object> attributes, final DurableConfigurationStore store) + { + return new AbstractStandardVirtualHostNode(attributes, _broker){ + + @Override + protected void writeLocationEventLog() + { + + } + + @Override + protected DurableConfigurationStore createConfigurationStore() + { + return store; + } + }; + } + + private class TestAbstractVirtualHostNode extends AbstractVirtualHostNode + { + private DurableConfigurationStore _store; + + public TestAbstractVirtualHostNode(Broker parent, Map attributes, DurableConfigurationStore store) + { + super(parent, attributes); + _store = store; + } + + @Override + public void onValidate() + { + throw new RuntimeException("Cannot validate"); + } + + @Override + protected DurableConfigurationStore createConfigurationStore() + { + return _store; + } + + @Override + protected void activate() + { + } + + @Override + protected ConfiguredObjectRecord enrichInitialVirtualHostRootRecord(ConfiguredObjectRecord vhostRecord) + { + return null; + } + + @Override + public Collection<? extends RemoteReplicationNode> getRemoteReplicationNodes() + { + return null; + } + } } Modified: qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/virtualhostnode/TestVirtualHostNode.java URL: http://svn.apache.org/viewvc/qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/virtualhostnode/TestVirtualHostNode.java?rev=1630749&r1=1630748&r2=1630749&view=diff ============================================================================== --- qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/virtualhostnode/TestVirtualHostNode.java (original) +++ qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/test/java/org/apache/qpid/server/virtualhostnode/TestVirtualHostNode.java Fri Oct 10 09:59:55 2014 @@ -53,6 +53,12 @@ public class TestVirtualHostNode extends } @Override + public DurableConfigurationStore getConfigurationStore() + { + return _store; + } + + @Override protected void writeLocationEventLog() { } Modified: qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-plugins/access-control/src/main/java/org/apache/qpid/server/security/access/plugins/ACLFileAccessControlProviderImpl.java URL: http://svn.apache.org/viewvc/qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-plugins/access-control/src/main/java/org/apache/qpid/server/security/access/plugins/ACLFileAccessControlProviderImpl.java?rev=1630749&r1=1630748&r2=1630749&view=diff ============================================================================== --- qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-plugins/access-control/src/main/java/org/apache/qpid/server/security/access/plugins/ACLFileAccessControlProviderImpl.java (original) +++ qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-plugins/access-control/src/main/java/org/apache/qpid/server/security/access/plugins/ACLFileAccessControlProviderImpl.java Fri Oct 10 09:59:55 2014 @@ -25,10 +25,10 @@ import java.util.Collection; import java.util.Collections; import java.util.Map; import java.util.Set; -import java.util.concurrent.atomic.AtomicReference; import org.apache.log4j.Logger; +import org.apache.qpid.server.configuration.IllegalConfigurationException; import org.apache.qpid.server.model.AbstractConfiguredObject; import org.apache.qpid.server.model.AccessControlProvider; import org.apache.qpid.server.model.Broker; @@ -83,6 +83,29 @@ public class ACLFileAccessControlProvide } @Override + protected void validateOnCreate() + { + DefaultAccessControl accessControl = null; + try + { + accessControl = new DefaultAccessControl(getPath(), _broker); + accessControl.validate(); + accessControl.open(); + } + catch(RuntimeException e) + { + throw new IllegalConfigurationException(e.getMessage(), e); + } + finally + { + if (accessControl != null) + { + accessControl.close(); + } + } + } + + @Override protected void onOpen() { super.onOpen(); @@ -105,6 +128,7 @@ public class ACLFileAccessControlProvide @StateTransition(currentState = {State.UNINITIALIZED, State.QUIESCED, State.ERRORED}, desiredState = State.ACTIVE) private void activate() { + if(_broker.isManagementMode()) { @@ -136,7 +160,10 @@ public class ACLFileAccessControlProvide protected void onClose() { super.onClose(); - _accessControl.close(); + if (_accessControl != null) + { + _accessControl.close(); + } } @StateTransition(currentState = State.UNINITIALIZED, desiredState = State.QUIESCED) Modified: qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQChannel.java URL: http://svn.apache.org/viewvc/qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQChannel.java?rev=1630749&r1=1630748&r2=1630749&view=diff ============================================================================== --- qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQChannel.java (original) +++ qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQChannel.java Fri Oct 10 09:59:55 2014 @@ -1322,6 +1322,12 @@ public class AMQChannel<T extends AMQPro return _subject; } + public ChannelMethodProcessor getMethodProcessor() + { + // TODO + return null; + } + private class ImmediateAction implements Action<MessageInstance> { Added: qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/ChannelMethodProcessor.java URL: http://svn.apache.org/viewvc/qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/ChannelMethodProcessor.java?rev=1630749&view=auto ============================================================================== --- qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/ChannelMethodProcessor.java (added) +++ qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/ChannelMethodProcessor.java Fri Oct 10 09:59:55 2014 @@ -0,0 +1,25 @@ +/* + * + * 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.protocol.v0_8; + +public interface ChannelMethodProcessor +{ +} --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org