Search in sources :

Example 6 with ConfiguredObjectFactory

use of org.apache.qpid.server.model.ConfiguredObjectFactory in project qpid-broker-j by apache.

the class BDBHARemoteReplicationNodeTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    _facade = mock(ReplicatedEnvironmentFacade.class);
    _broker = BrokerTestHelper.createBrokerMock();
    _taskExecutor = new CurrentThreadTaskExecutor();
    _taskExecutor.start();
    when(_broker.getTaskExecutor()).thenReturn(_taskExecutor);
    when(_broker.getChildExecutor()).thenReturn(_taskExecutor);
    _virtualHostNode = BrokerTestHelper.mockWithSystemPrincipalAndAccessControl(BDBHAVirtualHostNode.class, mock(Principal.class), _mockAccessControl);
    _configStore = mock(DurableConfigurationStore.class);
    when(_virtualHostNode.getConfigurationStore()).thenReturn(_configStore);
    // Virtualhost needs the EventLogger from the SystemContext.
    when(_virtualHostNode.getParent()).thenReturn(_broker);
    doReturn(VirtualHostNode.class).when(_virtualHostNode).getCategoryClass();
    ConfiguredObjectFactory objectFactory = _broker.getObjectFactory();
    when(_virtualHostNode.getModel()).thenReturn(objectFactory.getModel());
    when(_virtualHostNode.getTaskExecutor()).thenReturn(_taskExecutor);
    when(_virtualHostNode.getChildExecutor()).thenReturn(_taskExecutor);
}
Also used : DurableConfigurationStore(org.apache.qpid.server.store.DurableConfigurationStore) ConfiguredObjectFactory(org.apache.qpid.server.model.ConfiguredObjectFactory) ReplicatedEnvironmentFacade(org.apache.qpid.server.store.berkeleydb.replication.ReplicatedEnvironmentFacade) CurrentThreadTaskExecutor(org.apache.qpid.server.configuration.updater.CurrentThreadTaskExecutor)

Example 7 with ConfiguredObjectFactory

use of org.apache.qpid.server.model.ConfiguredObjectFactory in project qpid-broker-j by apache.

the class VirtualHostCreationTest method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    EventLogger eventLogger = mock(EventLogger.class);
    TaskExecutor executor = CurrentThreadTaskExecutor.newStartedInstance();
    SystemConfig systemConfig = mock(SystemConfig.class);
    ConfiguredObjectFactory objectFactory = new ConfiguredObjectFactoryImpl(BrokerModel.getInstance());
    when(systemConfig.getObjectFactory()).thenReturn(objectFactory);
    when(systemConfig.getModel()).thenReturn(objectFactory.getModel());
    when(systemConfig.getEventLogger()).thenReturn(eventLogger);
    when(systemConfig.getTaskExecutor()).thenReturn(executor);
    when(systemConfig.getChildExecutor()).thenReturn(executor);
    Broker broker = mock(Broker.class);
    when(broker.getObjectFactory()).thenReturn(objectFactory);
    when(broker.getModel()).thenReturn(objectFactory.getModel());
    when(broker.getCategoryClass()).thenReturn(Broker.class);
    when(broker.getParent()).thenReturn(systemConfig);
    when(broker.getTaskExecutor()).thenReturn(executor);
    when(broker.getChildExecutor()).thenReturn(executor);
    _virtualHostNode = BrokerTestHelper.mockWithSystemPrincipal(VirtualHostNode.class, mock(Principal.class));
    when(_virtualHostNode.getParent()).thenReturn(broker);
    when(_virtualHostNode.getObjectFactory()).thenReturn(objectFactory);
    when(_virtualHostNode.getConfigurationStore()).thenReturn(mock(DurableConfigurationStore.class));
    when(_virtualHostNode.getModel()).thenReturn(objectFactory.getModel());
    when(_virtualHostNode.getCategoryClass()).thenReturn(VirtualHostNode.class);
    when(_virtualHostNode.getTaskExecutor()).thenReturn(executor);
    when(_virtualHostNode.getChildExecutor()).thenReturn(executor);
}
Also used : CurrentThreadTaskExecutor(org.apache.qpid.server.configuration.updater.CurrentThreadTaskExecutor) TaskExecutor(org.apache.qpid.server.configuration.updater.TaskExecutor) SystemConfig(org.apache.qpid.server.model.SystemConfig) Broker(org.apache.qpid.server.model.Broker) ConfiguredObjectFactory(org.apache.qpid.server.model.ConfiguredObjectFactory) DurableConfigurationStore(org.apache.qpid.server.store.DurableConfigurationStore) EventLogger(org.apache.qpid.server.logging.EventLogger) VirtualHostNode(org.apache.qpid.server.model.VirtualHostNode) ConfiguredObjectFactoryImpl(org.apache.qpid.server.model.ConfiguredObjectFactoryImpl)

Example 8 with ConfiguredObjectFactory

use of org.apache.qpid.server.model.ConfiguredObjectFactory in project qpid-broker-j by apache.

the class PortFactoryTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    SystemConfig systemConfig = mock(SystemConfig.class);
    _portNumber = findFreePort();
    TaskExecutor executor = CurrentThreadTaskExecutor.newStartedInstance();
    when(_authProvider.getName()).thenReturn(_authProviderName);
    when(_broker.getChildren(eq(AuthenticationProvider.class))).thenReturn(Collections.singleton(_authProvider));
    when(_broker.getCategoryClass()).thenReturn(Broker.class);
    when(_broker.getEventLogger()).thenReturn(new EventLogger());
    when(_broker.getParent()).thenReturn(systemConfig);
    when(_broker.getTypeClass()).thenReturn(Broker.class);
    ConfiguredObjectFactory objectFactory = new ConfiguredObjectFactoryImpl(BrokerModel.getInstance());
    when(_broker.getObjectFactory()).thenReturn(objectFactory);
    when(_broker.getModel()).thenReturn(objectFactory.getModel());
    when(_authProvider.getModel()).thenReturn(objectFactory.getModel());
    when(_authProvider.getObjectFactory()).thenReturn(objectFactory);
    when(_authProvider.getCategoryClass()).thenReturn(AuthenticationProvider.class);
    when(_authProvider.getMechanisms()).thenReturn(Arrays.asList("PLAIN"));
    when(_keyStore.getModel()).thenReturn(objectFactory.getModel());
    when(_keyStore.getObjectFactory()).thenReturn(objectFactory);
    when(_trustStore.getModel()).thenReturn(objectFactory.getModel());
    when(_trustStore.getObjectFactory()).thenReturn(objectFactory);
    for (ConfiguredObject obj : new ConfiguredObject[] { _authProvider, _broker, _keyStore, _trustStore }) {
        when(obj.getTaskExecutor()).thenReturn(executor);
        when(obj.getChildExecutor()).thenReturn(executor);
    }
    _factory = new ConfiguredObjectFactoryImpl(BrokerModel.getInstance());
    _attributes.put(Port.ID, _portId);
    _attributes.put(Port.NAME, getName());
    _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.BINDING_ADDRESS, "127.0.0.1");
}
Also used : SystemConfig(org.apache.qpid.server.model.SystemConfig) CurrentThreadTaskExecutor(org.apache.qpid.server.configuration.updater.CurrentThreadTaskExecutor) TaskExecutor(org.apache.qpid.server.configuration.updater.TaskExecutor) ConfiguredObjectFactory(org.apache.qpid.server.model.ConfiguredObjectFactory) EventLogger(org.apache.qpid.server.logging.EventLogger) AuthenticationProvider(org.apache.qpid.server.model.AuthenticationProvider) ConfiguredObject(org.apache.qpid.server.model.ConfiguredObject) ConfiguredObjectFactoryImpl(org.apache.qpid.server.model.ConfiguredObjectFactoryImpl)

Example 9 with ConfiguredObjectFactory

use of org.apache.qpid.server.model.ConfiguredObjectFactory in project qpid-broker-j by apache.

the class JsonFileConfigStoreTest method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    ConfiguredObjectFactory factory = new ConfiguredObjectFactoryImpl(BrokerModel.getInstance());
    _parent = mock(JsonVirtualHostNode.class);
    when(_parent.getName()).thenReturn(getName());
    when(_parent.getObjectFactory()).thenReturn(factory);
    when(_parent.getModel()).thenReturn(factory.getModel());
    _storeLocation = TestFileUtils.createTestDirectory("json", true);
    when(_parent.getStorePath()).thenReturn(_storeLocation.getAbsolutePath());
    _store = new JsonFileConfigStore(VirtualHost.class);
    _handler = mock(ConfiguredObjectRecordHandler.class);
}
Also used : ConfiguredObjectFactory(org.apache.qpid.server.model.ConfiguredObjectFactory) JsonVirtualHostNode(org.apache.qpid.server.virtualhostnode.JsonVirtualHostNode) VirtualHost(org.apache.qpid.server.model.VirtualHost) ConfiguredObjectFactoryImpl(org.apache.qpid.server.model.ConfiguredObjectFactoryImpl) ConfiguredObjectRecordHandler(org.apache.qpid.server.store.handler.ConfiguredObjectRecordHandler)

Aggregations

ConfiguredObjectFactory (org.apache.qpid.server.model.ConfiguredObjectFactory)9 ConfiguredObjectFactoryImpl (org.apache.qpid.server.model.ConfiguredObjectFactoryImpl)5 HashMap (java.util.HashMap)4 CurrentThreadTaskExecutor (org.apache.qpid.server.configuration.updater.CurrentThreadTaskExecutor)4 EventLogger (org.apache.qpid.server.logging.EventLogger)4 ConfiguredObject (org.apache.qpid.server.model.ConfiguredObject)4 TaskExecutor (org.apache.qpid.server.configuration.updater.TaskExecutor)3 Broker (org.apache.qpid.server.model.Broker)3 VirtualHostNode (org.apache.qpid.server.model.VirtualHostNode)3 DurableConfigurationStore (org.apache.qpid.server.store.DurableConfigurationStore)3 AuthenticationProvider (org.apache.qpid.server.model.AuthenticationProvider)2 SystemConfig (org.apache.qpid.server.model.SystemConfig)2 Principal (java.security.Principal)1 ArrayList (java.util.ArrayList)1 UUID (java.util.UUID)1 TaskExecutorImpl (org.apache.qpid.server.configuration.updater.TaskExecutorImpl)1 PasswordCredentialManagingAuthenticationProvider (org.apache.qpid.server.model.PasswordCredentialManagingAuthenticationProvider)1 VirtualHost (org.apache.qpid.server.model.VirtualHost)1 AccessControl (org.apache.qpid.server.security.AccessControl)1 ReplicatedEnvironmentFacade (org.apache.qpid.server.store.berkeleydb.replication.ReplicatedEnvironmentFacade)1