use of org.apache.qpid.server.configuration.updater.TaskExecutor 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);
}
use of org.apache.qpid.server.configuration.updater.TaskExecutor 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");
}
use of org.apache.qpid.server.configuration.updater.TaskExecutor in project qpid-broker-j by apache.
the class AbstractDurableConfigurationStoreTestCase method createTestQueue.
private Queue<?> createTestQueue(String queueName, String queueOwner, boolean exclusive, final Map<String, Object> arguments) throws StoreException {
Queue queue = BrokerTestHelper.mockWithSystemPrincipal(Queue.class, mock(Principal.class));
when(queue.getName()).thenReturn(queueName);
when(queue.isExclusive()).thenReturn(exclusive);
when(queue.getId()).thenReturn(_queueId);
when(queue.getType()).thenReturn(STANDARD);
when(queue.getCategoryClass()).thenReturn(Queue.class);
when(queue.isDurable()).thenReturn(true);
TaskExecutor taskExecutor = CurrentThreadTaskExecutor.newStartedInstance();
when(queue.getTaskExecutor()).thenReturn(taskExecutor);
when(queue.getChildExecutor()).thenReturn(taskExecutor);
final QueueManagingVirtualHost vh = mock(QueueManagingVirtualHost.class);
when(queue.getVirtualHost()).thenReturn(vh);
final Map<String, Object> attributes = arguments == null ? new LinkedHashMap<>() : new LinkedHashMap<>(arguments);
attributes.put(Queue.NAME, queueName);
attributes.put(Queue.TYPE, STANDARD);
if (exclusive) {
when(queue.getOwner()).thenReturn(queueOwner);
attributes.put(Queue.OWNER, queueOwner);
attributes.put(Queue.EXCLUSIVE, ExclusivityPolicy.CONTAINER);
}
when(queue.getAvailableAttributes()).thenReturn(attributes.keySet());
final ArgumentCaptor<String> requestedAttribute = ArgumentCaptor.forClass(String.class);
when(queue.getAttribute(requestedAttribute.capture())).then(new Answer() {
@Override
public Object answer(final InvocationOnMock invocation) throws Throwable {
String attrName = requestedAttribute.getValue();
return attributes.get(attrName);
}
});
when(queue.getActualAttributes()).thenReturn(attributes);
when(queue.getObjectFactory()).thenReturn(_factory);
when(queue.getModel()).thenReturn(_factory.getModel());
ConfiguredObjectRecord objectRecord = mock(ConfiguredObjectRecord.class);
when(objectRecord.getId()).thenReturn(_queueId);
when(objectRecord.getType()).thenReturn(Queue.class.getSimpleName());
when(objectRecord.getAttributes()).thenReturn(attributes);
when(objectRecord.getParents()).thenReturn(Collections.singletonMap(_rootRecord.getType(), _rootRecord.getId()));
when(queue.asObjectRecord()).thenReturn(objectRecord);
return queue;
}
use of org.apache.qpid.server.configuration.updater.TaskExecutor in project qpid-broker-j by apache.
the class AclFileAccessControlProviderFactoryTest method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
_broker = mock(Broker.class);
_objectFactory = new ConfiguredObjectFactoryImpl(BrokerModel.getInstance());
when(_broker.getObjectFactory()).thenReturn(_objectFactory);
when(_broker.getModel()).thenReturn(_objectFactory.getModel());
when(_broker.getCategoryClass()).thenReturn(Broker.class);
TaskExecutor taskExecutor = new CurrentThreadTaskExecutor();
taskExecutor.start();
when(_broker.getTaskExecutor()).thenReturn(taskExecutor);
when(_broker.getChildExecutor()).thenReturn(taskExecutor);
when(_broker.getEventLogger()).thenReturn(new EventLogger());
}
Aggregations