use of org.apache.qpid.server.configuration.updater.CurrentThreadTaskExecutor in project qpid-broker-j by apache.
the class BrokerMemoryLoggerTest method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
_taskExecutor = new CurrentThreadTaskExecutor();
_taskExecutor.start();
_systemConfig = new JsonSystemConfigImpl(_taskExecutor, mock(EventLogger.class), null, new HashMap<String, Object>()) {
{
updateModel(BrokerModel.getInstance());
}
};
when(_brokerEntry.getId()).thenReturn(_brokerId);
when(_brokerEntry.getType()).thenReturn(Broker.class.getSimpleName());
Map<String, Object> attributesMap = new HashMap<>();
attributesMap.put(Broker.MODEL_VERSION, BrokerModel.MODEL_VERSION);
attributesMap.put(Broker.NAME, getName());
when(_brokerEntry.getAttributes()).thenReturn(attributesMap);
when(_brokerEntry.getParents()).thenReturn(Collections.singletonMap(SystemConfig.class.getSimpleName(), _systemConfig.getId()));
GenericRecoverer recoverer = new GenericRecoverer(_systemConfig);
recoverer.recover(Arrays.asList(_brokerEntry), false);
}
use of org.apache.qpid.server.configuration.updater.CurrentThreadTaskExecutor in project qpid-broker-j by apache.
the class Session_1_0Test method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
Map<String, Object> virtualHostAttributes = new HashMap<>();
virtualHostAttributes.put(QueueManagingVirtualHost.NAME, "testVH");
virtualHostAttributes.put(QueueManagingVirtualHost.TYPE, TestMemoryVirtualHost.VIRTUAL_HOST_TYPE);
_virtualHost = BrokerTestHelper.createVirtualHost(virtualHostAttributes);
_taskExecutor = new CurrentThreadTaskExecutor();
_taskExecutor.start();
_connection = createAmqpConnection_1_0("testContainerId");
this._session = createSession_1_0(_connection, 0);
}
use of org.apache.qpid.server.configuration.updater.CurrentThreadTaskExecutor in project qpid-broker-j by apache.
the class VirtualHostTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
_broker = BrokerTestHelper.createBrokerMock();
_taskExecutor = new CurrentThreadTaskExecutor();
_taskExecutor.start();
when(_broker.getTaskExecutor()).thenReturn(_taskExecutor);
when(_broker.getChildExecutor()).thenReturn(_taskExecutor);
Principal systemPrincipal = ((SystemPrincipalSource) _broker).getSystemPrincipal();
_virtualHostNode = BrokerTestHelper.mockWithSystemPrincipalAndAccessControl(VirtualHostNode.class, systemPrincipal, _mockAccessControl);
when(_virtualHostNode.getParent()).thenReturn(_broker);
when(_virtualHostNode.getCategoryClass()).thenReturn(VirtualHostNode.class);
when(_virtualHostNode.isDurable()).thenReturn(true);
_configStore = mock(DurableConfigurationStore.class);
_storeConfigurationChangeListener = new StoreConfigurationChangeListener(_configStore);
when(_virtualHostNode.getConfigurationStore()).thenReturn(_configStore);
// Virtualhost needs the EventLogger from the SystemContext.
when(_virtualHostNode.getParent()).thenReturn(_broker);
ConfiguredObjectFactory objectFactory = _broker.getObjectFactory();
when(_virtualHostNode.getModel()).thenReturn(objectFactory.getModel());
when(_virtualHostNode.getTaskExecutor()).thenReturn(_taskExecutor);
when(_virtualHostNode.getChildExecutor()).thenReturn(_taskExecutor);
_preferenceStore = mock(PreferenceStore.class);
when(_virtualHostNode.createPreferenceStore()).thenReturn(_preferenceStore);
}
use of org.apache.qpid.server.configuration.updater.CurrentThreadTaskExecutor in project qpid-broker-j by apache.
the class UserPreferencesTest 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());
_groupPrincipal = new GroupPrincipal(MYGROUP, (GroupProvider) null);
_owner = new AuthenticatedPrincipal(new UsernamePrincipal(MYUSER, null));
_subject = new Subject(true, Sets.newHashSet(_owner, _groupPrincipal), Collections.emptySet(), Collections.emptySet());
_testId = UUID.randomUUID();
}
use of org.apache.qpid.server.configuration.updater.CurrentThreadTaskExecutor in project qpid-broker-j by apache.
the class VirtualHostQueueCreationTest method setUp.
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public void setUp() throws Exception {
super.setUp();
EventLogger eventLogger = mock(EventLogger.class);
ConfiguredObjectFactory objectFactory = new ConfiguredObjectFactoryImpl(BrokerModel.getInstance());
_taskExecutor = new CurrentThreadTaskExecutor();
_taskExecutor.start();
SystemConfig<?> context = mock(SystemConfig.class);
when(context.getEventLogger()).thenReturn(eventLogger);
when(context.createPreferenceStore()).thenReturn(mock(PreferenceStore.class));
Principal systemPrincipal = mock(Principal.class);
AccessControl accessControl = BrokerTestHelper.createAccessControlMock();
Broker broker = BrokerTestHelper.mockWithSystemPrincipalAndAccessControl(Broker.class, systemPrincipal, accessControl);
when(broker.getObjectFactory()).thenReturn(objectFactory);
when(broker.getCategoryClass()).thenReturn(Broker.class);
when(broker.getParent()).thenReturn(context);
when(broker.getModel()).thenReturn(objectFactory.getModel());
when(broker.getTaskExecutor()).thenReturn(_taskExecutor);
when(broker.getChildExecutor()).thenReturn(_taskExecutor);
_virtualHostNode = BrokerTestHelper.mockWithSystemPrincipalAndAccessControl(VirtualHostNode.class, systemPrincipal, accessControl);
when(_virtualHostNode.getParent()).thenReturn(broker);
when(_virtualHostNode.getConfigurationStore()).thenReturn(mock(DurableConfigurationStore.class));
when(_virtualHostNode.getObjectFactory()).thenReturn(objectFactory);
when(_virtualHostNode.getModel()).thenReturn(objectFactory.getModel());
when(_virtualHostNode.getTaskExecutor()).thenReturn(_taskExecutor);
when(_virtualHostNode.getChildExecutor()).thenReturn(_taskExecutor);
when(_virtualHostNode.getCategoryClass()).thenReturn(VirtualHostNode.class);
when(_virtualHostNode.createPreferenceStore()).thenReturn(mock(PreferenceStore.class));
_virtualHost = createHost();
}
Aggregations