Search in sources :

Example 11 with CurrentThreadTaskExecutor

use of org.apache.qpid.server.configuration.updater.CurrentThreadTaskExecutor in project qpid-broker-j by apache.

the class ServerSessionTest method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    BrokerTestHelper.setUp();
    _taskExecutor = new CurrentThreadTaskExecutor();
    _taskExecutor.start();
    _virtualHost = BrokerTestHelper.createVirtualHost(getName());
}
Also used : CurrentThreadTaskExecutor(org.apache.qpid.server.configuration.updater.CurrentThreadTaskExecutor)

Example 12 with CurrentThreadTaskExecutor

use of org.apache.qpid.server.configuration.updater.CurrentThreadTaskExecutor in project qpid-broker-j by apache.

the class RestUserPreferenceHandlerTest method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    _configuredObject = mock(ConfiguredObject.class);
    _preferenceStore = mock(PreferenceStore.class);
    _preferenceTaskExecutor = new CurrentThreadTaskExecutor();
    _preferenceTaskExecutor.start();
    _userPreferences = new UserPreferencesImpl(_preferenceTaskExecutor, _configuredObject, _preferenceStore, Collections.<Preference>emptyList());
    _subject = TestPrincipalUtils.createTestSubject(MYUSER, MYGROUP);
    _groupPrincipal = _subject.getPrincipals(GroupPrincipal.class).iterator().next();
    _userPrincipal = _subject.getPrincipals(AuthenticatedPrincipal.class).iterator().next();
    when(_configuredObject.getUserPreferences()).thenReturn(_userPreferences);
}
Also used : UserPreferencesImpl(org.apache.qpid.server.model.preferences.UserPreferencesImpl) Preference(org.apache.qpid.server.model.preferences.Preference) GroupPrincipal(org.apache.qpid.server.security.group.GroupPrincipal) CurrentThreadTaskExecutor(org.apache.qpid.server.configuration.updater.CurrentThreadTaskExecutor) ConfiguredObject(org.apache.qpid.server.model.ConfiguredObject) PreferenceStore(org.apache.qpid.server.store.preferences.PreferenceStore) AuthenticatedPrincipal(org.apache.qpid.server.security.auth.AuthenticatedPrincipal)

Example 13 with CurrentThreadTaskExecutor

use of org.apache.qpid.server.configuration.updater.CurrentThreadTaskExecutor 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 14 with CurrentThreadTaskExecutor

use of org.apache.qpid.server.configuration.updater.CurrentThreadTaskExecutor in project qpid-broker-j by apache.

the class ManagementModeStoreHandlerTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    _rootId = UUID.randomUUID();
    _portEntryId = UUID.randomUUID();
    _store = mock(DurableConfigurationStore.class);
    _taskExecutor = new CurrentThreadTaskExecutor();
    _taskExecutor.start();
    _systemConfig = new JsonSystemConfigImpl(_taskExecutor, mock(EventLogger.class), null, new HashMap<String, Object>());
    ConfiguredObjectRecord systemContextRecord = _systemConfig.asObjectRecord();
    _root = new ConfiguredObjectRecordImpl(_rootId, Broker.class.getSimpleName(), Collections.singletonMap(Broker.NAME, (Object) "broker"), Collections.singletonMap(SystemConfig.class.getSimpleName(), systemContextRecord.getId()));
    _portEntry = mock(ConfiguredObjectRecord.class);
    when(_portEntry.getId()).thenReturn(_portEntryId);
    when(_portEntry.getParents()).thenReturn(Collections.singletonMap(Broker.class.getSimpleName(), _root.getId()));
    when(_portEntry.getType()).thenReturn(Port.class.getSimpleName());
    final ArgumentCaptor<ConfiguredObjectRecordHandler> recovererArgumentCaptor = ArgumentCaptor.forClass(ConfiguredObjectRecordHandler.class);
    doAnswer(new Answer() {

        @Override
        public Object answer(final InvocationOnMock invocation) throws Throwable {
            ConfiguredObjectRecordHandler recoverer = recovererArgumentCaptor.getValue();
            recoverer.handle(_root);
            recoverer.handle(_portEntry);
            return false;
        }
    }).when(_store).openConfigurationStore(recovererArgumentCaptor.capture());
    _systemConfigAttributes = new HashMap<>();
    _handler = new ManagementModeStoreHandler(_store, _systemConfig);
    ;
    _handler.init(_systemConfig);
}
Also used : SystemConfig(org.apache.qpid.server.model.SystemConfig) AbstractSystemConfig(org.apache.qpid.server.model.AbstractSystemConfig) DurableConfigurationStore(org.apache.qpid.server.store.DurableConfigurationStore) HashMap(java.util.HashMap) CurrentThreadTaskExecutor(org.apache.qpid.server.configuration.updater.CurrentThreadTaskExecutor) Port(org.apache.qpid.server.model.Port) Answer(org.mockito.stubbing.Answer) Mockito.doAnswer(org.mockito.Mockito.doAnswer) ConfiguredObjectRecordImpl(org.apache.qpid.server.store.ConfiguredObjectRecordImpl) InvocationOnMock(org.mockito.invocation.InvocationOnMock) ConfiguredObject(org.apache.qpid.server.model.ConfiguredObject) ConfiguredObjectRecord(org.apache.qpid.server.store.ConfiguredObjectRecord) JsonSystemConfigImpl(org.apache.qpid.server.model.JsonSystemConfigImpl) ConfiguredObjectRecordHandler(org.apache.qpid.server.store.handler.ConfiguredObjectRecordHandler)

Example 15 with CurrentThreadTaskExecutor

use of org.apache.qpid.server.configuration.updater.CurrentThreadTaskExecutor in project qpid-broker-j by apache.

the class HeadersBindingTest method setUp.

@Override
protected void setUp() {
    _count++;
    _queue = mock(Queue.class);
    TaskExecutor executor = new CurrentThreadTaskExecutor();
    executor.start();
    QueueManagingVirtualHost vhost = mock(QueueManagingVirtualHost.class);
    when(_queue.getVirtualHost()).thenReturn(vhost);
    when(_queue.getModel()).thenReturn(BrokerModel.getInstance());
    when(_queue.getTaskExecutor()).thenReturn(executor);
    when(_queue.getChildExecutor()).thenReturn(executor);
    final EventLogger eventLogger = new EventLogger();
    when(vhost.getEventLogger()).thenReturn(eventLogger);
    when(vhost.getTaskExecutor()).thenReturn(executor);
    when(vhost.getChildExecutor()).thenReturn(executor);
    _exchange = mock(Exchange.class);
    when(_exchange.getType()).thenReturn(ExchangeDefaults.HEADERS_EXCHANGE_CLASS);
    when(_exchange.getEventLogger()).thenReturn(eventLogger);
    when(_exchange.getModel()).thenReturn(BrokerModel.getInstance());
    when(_exchange.getTaskExecutor()).thenReturn(executor);
    when(_exchange.getChildExecutor()).thenReturn(executor);
}
Also used : Exchange(org.apache.qpid.server.model.Exchange) CurrentThreadTaskExecutor(org.apache.qpid.server.configuration.updater.CurrentThreadTaskExecutor) TaskExecutor(org.apache.qpid.server.configuration.updater.TaskExecutor) QueueManagingVirtualHost(org.apache.qpid.server.virtualhost.QueueManagingVirtualHost) EventLogger(org.apache.qpid.server.logging.EventLogger) CurrentThreadTaskExecutor(org.apache.qpid.server.configuration.updater.CurrentThreadTaskExecutor) Queue(org.apache.qpid.server.model.Queue)

Aggregations

CurrentThreadTaskExecutor (org.apache.qpid.server.configuration.updater.CurrentThreadTaskExecutor)23 ConfiguredObject (org.apache.qpid.server.model.ConfiguredObject)8 HashMap (java.util.HashMap)7 PreferenceStore (org.apache.qpid.server.store.preferences.PreferenceStore)5 EventLogger (org.apache.qpid.server.logging.EventLogger)4 Broker (org.apache.qpid.server.model.Broker)4 ConfiguredObjectFactoryImpl (org.apache.qpid.server.model.ConfiguredObjectFactoryImpl)4 JsonSystemConfigImpl (org.apache.qpid.server.model.JsonSystemConfigImpl)4 DurableConfigurationStore (org.apache.qpid.server.store.DurableConfigurationStore)4 Principal (java.security.Principal)3 TaskExecutor (org.apache.qpid.server.configuration.updater.TaskExecutor)3 SystemConfig (org.apache.qpid.server.model.SystemConfig)3 AuthenticationProvider (org.apache.qpid.server.model.AuthenticationProvider)2 ConfiguredObjectFactory (org.apache.qpid.server.model.ConfiguredObjectFactory)2 Preference (org.apache.qpid.server.model.preferences.Preference)2 UserPreferencesImpl (org.apache.qpid.server.model.preferences.UserPreferencesImpl)2 AuthenticatedPrincipal (org.apache.qpid.server.security.auth.AuthenticatedPrincipal)2 GroupPrincipal (org.apache.qpid.server.security.group.GroupPrincipal)2 Subject (javax.security.auth.Subject)1 IllegalConfigurationException (org.apache.qpid.server.configuration.IllegalConfigurationException)1