Search in sources :

Example 1 with CurrentThreadTaskExecutor

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);
}
Also used : Broker(org.apache.qpid.server.model.Broker) HashMap(java.util.HashMap) CurrentThreadTaskExecutor(org.apache.qpid.server.configuration.updater.CurrentThreadTaskExecutor) ConfiguredObject(org.apache.qpid.server.model.ConfiguredObject) GenericRecoverer(org.apache.qpid.server.store.GenericRecoverer) JsonSystemConfigImpl(org.apache.qpid.server.model.JsonSystemConfigImpl)

Example 2 with CurrentThreadTaskExecutor

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);
}
Also used : HashMap(java.util.HashMap) CurrentThreadTaskExecutor(org.apache.qpid.server.configuration.updater.CurrentThreadTaskExecutor)

Example 3 with CurrentThreadTaskExecutor

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);
}
Also used : DurableConfigurationStore(org.apache.qpid.server.store.DurableConfigurationStore) CurrentThreadTaskExecutor(org.apache.qpid.server.configuration.updater.CurrentThreadTaskExecutor) Principal(java.security.Principal) PreferenceStore(org.apache.qpid.server.store.preferences.PreferenceStore) StoreConfigurationChangeListener(org.apache.qpid.server.configuration.store.StoreConfigurationChangeListener)

Example 4 with CurrentThreadTaskExecutor

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();
}
Also used : UsernamePrincipal(org.apache.qpid.server.security.auth.UsernamePrincipal) GroupPrincipal(org.apache.qpid.server.security.group.GroupPrincipal) CurrentThreadTaskExecutor(org.apache.qpid.server.configuration.updater.CurrentThreadTaskExecutor) ConfiguredObject(org.apache.qpid.server.model.ConfiguredObject) GroupProvider(org.apache.qpid.server.model.GroupProvider) PreferenceStore(org.apache.qpid.server.store.preferences.PreferenceStore) Subject(javax.security.auth.Subject) AuthenticatedPrincipal(org.apache.qpid.server.security.auth.AuthenticatedPrincipal)

Example 5 with CurrentThreadTaskExecutor

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();
}
Also used : Broker(org.apache.qpid.server.model.Broker) ConfiguredObjectFactory(org.apache.qpid.server.model.ConfiguredObjectFactory) DurableConfigurationStore(org.apache.qpid.server.store.DurableConfigurationStore) EventLogger(org.apache.qpid.server.logging.EventLogger) CurrentThreadTaskExecutor(org.apache.qpid.server.configuration.updater.CurrentThreadTaskExecutor) PreferenceStore(org.apache.qpid.server.store.preferences.PreferenceStore) Principal(java.security.Principal) AccessControl(org.apache.qpid.server.security.AccessControl) VirtualHostNode(org.apache.qpid.server.model.VirtualHostNode) ConfiguredObjectFactoryImpl(org.apache.qpid.server.model.ConfiguredObjectFactoryImpl)

Aggregations

CurrentThreadTaskExecutor (org.apache.qpid.server.configuration.updater.CurrentThreadTaskExecutor)23 ConfiguredObject (org.apache.qpid.server.model.ConfiguredObject)8 HashMap (java.util.HashMap)7 PreferenceStore (org.apache.qpid.server.store.preferences.PreferenceStore)5 EventLogger (org.apache.qpid.server.logging.EventLogger)4 Broker (org.apache.qpid.server.model.Broker)4 ConfiguredObjectFactoryImpl (org.apache.qpid.server.model.ConfiguredObjectFactoryImpl)4 JsonSystemConfigImpl (org.apache.qpid.server.model.JsonSystemConfigImpl)4 DurableConfigurationStore (org.apache.qpid.server.store.DurableConfigurationStore)4 Principal (java.security.Principal)3 TaskExecutor (org.apache.qpid.server.configuration.updater.TaskExecutor)3 SystemConfig (org.apache.qpid.server.model.SystemConfig)3 AuthenticationProvider (org.apache.qpid.server.model.AuthenticationProvider)2 ConfiguredObjectFactory (org.apache.qpid.server.model.ConfiguredObjectFactory)2 Preference (org.apache.qpid.server.model.preferences.Preference)2 UserPreferencesImpl (org.apache.qpid.server.model.preferences.UserPreferencesImpl)2 AuthenticatedPrincipal (org.apache.qpid.server.security.auth.AuthenticatedPrincipal)2 GroupPrincipal (org.apache.qpid.server.security.group.GroupPrincipal)2 Subject (javax.security.auth.Subject)1 IllegalConfigurationException (org.apache.qpid.server.configuration.IllegalConfigurationException)1