use of org.apache.qpid.server.configuration.updater.TaskExecutorImpl in project qpid-broker-j by apache.
the class BrokerFileLoggerTest method setUp.
@Before
public void setUp() throws Exception {
_taskExecutor = new TaskExecutorImpl();
_taskExecutor.start();
Model model = BrokerModel.getInstance();
EventLogger eventLogger = mock(EventLogger.class);
SystemConfig<?> systemConfig = mock(SystemConfig.class);
when(systemConfig.getModel()).thenReturn(model);
when(systemConfig.getChildExecutor()).thenReturn(_taskExecutor);
when(systemConfig.getEventLogger()).thenReturn(eventLogger);
doReturn(SystemConfig.class).when(systemConfig).getCategoryClass();
_broker = mock(Broker.class);
when(_broker.getModel()).thenReturn(model);
when(_broker.getChildExecutor()).thenReturn(_taskExecutor);
when(_broker.getParent()).thenReturn(systemConfig);
doReturn(Broker.class).when(_broker).getCategoryClass();
_baseFolder = new File(TMP_FOLDER, "test-sub-folder");
_logFile = new File(_baseFolder, "tmp-broker-host.log." + System.currentTimeMillis());
if (_baseFolder.exists()) {
FileUtils.delete(_baseFolder, true);
}
}
use of org.apache.qpid.server.configuration.updater.TaskExecutorImpl in project qpid-broker-j by apache.
the class BrokerLoggerTest method setUp.
@Before
public void setUp() throws Exception {
_taskExecutor = new TaskExecutorImpl();
_taskExecutor.start();
_loggerAppender = new ListAppender<>();
_loggerAppender.setName(APPENDER_NAME);
Model model = BrokerModel.getInstance();
_broker = mock(Broker.class);
when(_broker.getCategoryClass()).thenReturn(Broker.class);
when(_broker.getTypeClass()).thenReturn(Broker.class);
when(_broker.getModel()).thenReturn(model);
when(_broker.getChildExecutor()).thenReturn(_taskExecutor);
doReturn(Broker.class).when(_broker).getCategoryClass();
Map<String, Object> attributes = new HashMap<>();
attributes.put("name", APPENDER_NAME);
_brokerLogger = new AbstractBrokerLogger(attributes, _broker) {
@Override
public Appender<ILoggingEvent> createAppenderInstance(Context context) {
return _loggerAppender;
}
};
_brokerLogger.open();
}
use of org.apache.qpid.server.configuration.updater.TaskExecutorImpl in project qpid-broker-j by apache.
the class RingOverflowPolicyTest method setUp.
@Before
public void setUp() throws Exception {
_taskExecutor = new TaskExecutorImpl();
_taskExecutor.start();
String name = getClass().getName();
final VirtualHostNode<?> virtualHostNode = BrokerTestHelper.createVirtualHostNodeMock(name, true, BrokerTestHelper.createAccessControlMock(), BrokerTestHelper.createBrokerMock());
when(virtualHostNode.getChildExecutor()).thenReturn(_taskExecutor);
when(virtualHostNode.getTaskExecutor()).thenReturn(_taskExecutor);
final Map<String, Object> virtualHostAttributes = new HashMap<>();
virtualHostAttributes.put(VirtualHost.TYPE, TestMemoryVirtualHost.VIRTUAL_HOST_TYPE);
virtualHostAttributes.put(VirtualHost.NAME, name);
virtualHostAttributes.put(QueueManagingVirtualHost.CONNECTION_THREAD_POOL_SIZE, 2);
virtualHostAttributes.put(QueueManagingVirtualHost.NUMBER_OF_SELECTORS, 1);
final ConfiguredObjectFactory objectFactory = virtualHostNode.getObjectFactory();
final QueueManagingVirtualHost<?> host = (QueueManagingVirtualHost<?>) objectFactory.create(VirtualHost.class, virtualHostAttributes, virtualHostNode);
final AbstractVirtualHost abstractVirtualHost = (AbstractVirtualHost) host;
abstractVirtualHost.start();
when(virtualHostNode.getVirtualHost()).thenReturn(abstractVirtualHost);
_virtualHost = host;
_messageId = new AtomicLong();
}
use of org.apache.qpid.server.configuration.updater.TaskExecutorImpl in project qpid-broker-j by apache.
the class AbstractVirtualHostTest method setUp.
@Before
public void setUp() throws Exception {
SystemConfig systemConfig = mock(SystemConfig.class);
when(systemConfig.getEventLogger()).thenReturn(mock(EventLogger.class));
when(systemConfig.createPreferenceStore()).thenReturn(mock(PreferenceStore.class));
AccessControl accessControlMock = BrokerTestHelper.createAccessControlMock();
Principal systemPrincipal = mock(Principal.class);
Broker<?> broker = BrokerTestHelper.mockWithSystemPrincipalAndAccessControl(Broker.class, systemPrincipal, accessControlMock);
when(broker.getParent()).thenReturn(systemConfig);
when(broker.getModel()).thenReturn(BrokerModel.getInstance());
_taskExecutor = new TaskExecutorImpl();
_taskExecutor.start();
when(broker.getTaskExecutor()).thenReturn(_taskExecutor);
when(broker.getChildExecutor()).thenReturn(_taskExecutor);
_node = BrokerTestHelper.mockWithSystemPrincipalAndAccessControl(VirtualHostNode.class, systemPrincipal, accessControlMock);
when(_node.getParent()).thenReturn(broker);
when(_node.getModel()).thenReturn(BrokerModel.getInstance());
when(_node.getTaskExecutor()).thenReturn(_taskExecutor);
when(_node.getChildExecutor()).thenReturn(_taskExecutor);
when(_node.getConfigurationStore()).thenReturn(mock(DurableConfigurationStore.class));
when(_node.getCategoryClass()).thenReturn(VirtualHostNode.class);
when(_node.createPreferenceStore()).thenReturn(mock(PreferenceStore.class));
when(_node.getEventLogger()).thenReturn(mock(EventLogger.class));
_failingStore = mock(MessageStore.class);
doThrow(new RuntimeException("Cannot open store")).when(_failingStore).openMessageStore(any(ConfiguredObject.class));
}
use of org.apache.qpid.server.configuration.updater.TaskExecutorImpl in project qpid-broker-j by apache.
the class DerbyVirtualHostNodeTest method setUp.
@Before
public void setUp() throws Exception {
assumeThat(getVirtualHostNodeStoreType(), is(equalTo(VirtualHostNodeStoreType.DERBY)));
_taskExecutor = new TaskExecutorImpl();
_taskExecutor.start();
_workDir = TestFileUtils.createTestDirectory("qpid.work_dir", true);
setTestSystemProperty("qpid.work_dir", _workDir.getAbsolutePath());
_broker = createBroker();
}
Aggregations