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());
}
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);
}
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);
}
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);
}
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);
}
Aggregations