Search in sources :

Example 1 with TaskExecutorImpl

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);
    }
}
Also used : TaskExecutorImpl(org.apache.qpid.server.configuration.updater.TaskExecutorImpl) Broker(org.apache.qpid.server.model.Broker) EventLogger(org.apache.qpid.server.logging.EventLogger) BrokerModel(org.apache.qpid.server.model.BrokerModel) Model(org.apache.qpid.server.model.Model) File(java.io.File) Before(org.junit.Before)

Example 2 with TaskExecutorImpl

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();
}
Also used : Context(ch.qos.logback.core.Context) Appender(ch.qos.logback.core.Appender) ListAppender(ch.qos.logback.core.read.ListAppender) TaskExecutorImpl(org.apache.qpid.server.configuration.updater.TaskExecutorImpl) Broker(org.apache.qpid.server.model.Broker) HashMap(java.util.HashMap) BrokerModel(org.apache.qpid.server.model.BrokerModel) Model(org.apache.qpid.server.model.Model) ConfiguredObject(org.apache.qpid.server.model.ConfiguredObject) Before(org.junit.Before)

Example 3 with TaskExecutorImpl

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();
}
Also used : TaskExecutorImpl(org.apache.qpid.server.configuration.updater.TaskExecutorImpl) AtomicLong(java.util.concurrent.atomic.AtomicLong) ConfiguredObjectFactory(org.apache.qpid.server.model.ConfiguredObjectFactory) QueueManagingVirtualHost(org.apache.qpid.server.virtualhost.QueueManagingVirtualHost) HashMap(java.util.HashMap) AbstractVirtualHost(org.apache.qpid.server.virtualhost.AbstractVirtualHost) AbstractVirtualHost(org.apache.qpid.server.virtualhost.AbstractVirtualHost) TestMemoryVirtualHost(org.apache.qpid.server.virtualhost.TestMemoryVirtualHost) VirtualHost(org.apache.qpid.server.model.VirtualHost) QueueManagingVirtualHost(org.apache.qpid.server.virtualhost.QueueManagingVirtualHost) Before(org.junit.Before)

Example 4 with TaskExecutorImpl

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));
}
Also used : MessageStore(org.apache.qpid.server.store.MessageStore) SystemConfig(org.apache.qpid.server.model.SystemConfig) TaskExecutorImpl(org.apache.qpid.server.configuration.updater.TaskExecutorImpl) DurableConfigurationStore(org.apache.qpid.server.store.DurableConfigurationStore) EventLogger(org.apache.qpid.server.logging.EventLogger) ConfiguredObject(org.apache.qpid.server.model.ConfiguredObject) PreferenceStore(org.apache.qpid.server.store.preferences.PreferenceStore) AccessControl(org.apache.qpid.server.security.AccessControl) Principal(java.security.Principal) VirtualHostNode(org.apache.qpid.server.model.VirtualHostNode) Before(org.junit.Before)

Example 5 with TaskExecutorImpl

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();
}
Also used : TaskExecutorImpl(org.apache.qpid.server.configuration.updater.TaskExecutorImpl) Before(org.junit.Before)

Aggregations

TaskExecutorImpl (org.apache.qpid.server.configuration.updater.TaskExecutorImpl)15 Before (org.junit.Before)12 EventLogger (org.apache.qpid.server.logging.EventLogger)7 Broker (org.apache.qpid.server.model.Broker)7 BrokerModel (org.apache.qpid.server.model.BrokerModel)6 Model (org.apache.qpid.server.model.Model)6 ConfiguredObject (org.apache.qpid.server.model.ConfiguredObject)5 HashMap (java.util.HashMap)4 Principal (java.security.Principal)3 TaskExecutor (org.apache.qpid.server.configuration.updater.TaskExecutor)3 SystemConfig (org.apache.qpid.server.model.SystemConfig)3 VirtualHostNode (org.apache.qpid.server.model.VirtualHostNode)3 AmqpPort (org.apache.qpid.server.model.port.AmqpPort)3 PreferenceStore (org.apache.qpid.server.store.preferences.PreferenceStore)3 File (java.io.File)2 InetSocketAddress (java.net.InetSocketAddress)2 Subject (javax.security.auth.Subject)2 AuthenticationProvider (org.apache.qpid.server.model.AuthenticationProvider)2 ConfiguredObjectFactory (org.apache.qpid.server.model.ConfiguredObjectFactory)2 VirtualHost (org.apache.qpid.server.model.VirtualHost)2