Search in sources :

Example 16 with CurrentThreadTaskExecutor

use of org.apache.qpid.server.configuration.updater.CurrentThreadTaskExecutor in project qpid-broker-j by apache.

the class TestAbstractCarImpl method newTaskExecutor.

private static CurrentThreadTaskExecutor newTaskExecutor() {
    CurrentThreadTaskExecutor currentThreadTaskExecutor = new CurrentThreadTaskExecutor();
    currentThreadTaskExecutor.start();
    return currentThreadTaskExecutor;
}
Also used : CurrentThreadTaskExecutor(org.apache.qpid.server.configuration.updater.CurrentThreadTaskExecutor)

Example 17 with CurrentThreadTaskExecutor

use of org.apache.qpid.server.configuration.updater.CurrentThreadTaskExecutor in project qpid-broker-j by apache.

the class BrokerRecovererTest method setUp.

@Override
protected 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<String, Object>();
    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()));
    // Add a base AuthenticationProvider for all tests
    _authenticationProvider1 = mock(AuthenticationProvider.class);
    when(_authenticationProvider1.getName()).thenReturn("authenticationProvider1");
    when(_authenticationProvider1.getId()).thenReturn(_authenticationProvider1Id);
}
Also used : Broker(org.apache.qpid.server.model.Broker) HashMap(java.util.HashMap) CurrentThreadTaskExecutor(org.apache.qpid.server.configuration.updater.CurrentThreadTaskExecutor) AuthenticationProvider(org.apache.qpid.server.model.AuthenticationProvider) ConfiguredObject(org.apache.qpid.server.model.ConfiguredObject) JsonSystemConfigImpl(org.apache.qpid.server.model.JsonSystemConfigImpl)

Example 18 with CurrentThreadTaskExecutor

use of org.apache.qpid.server.configuration.updater.CurrentThreadTaskExecutor in project qpid-broker-j by apache.

the class BrokerStoreUpgraderAndRecovererTest method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    _virtaulHosts = new ArrayList<>();
    _hostId = UUID.randomUUID();
    _brokerId = UUID.randomUUID();
    Map<String, Object> brokerAttributes = new HashMap<>();
    brokerAttributes.put("createdTime", BROKER_CREATE_TIME);
    brokerAttributes.put("defaultVirtualHost", VIRTUALHOST_NAME);
    brokerAttributes.put("modelVersion", "1.3");
    brokerAttributes.put("name", BROKER_NAME);
    brokerAttributes.put("virtualhosts", _virtaulHosts);
    _brokerRecord = mock(ConfiguredObjectRecord.class);
    when(_brokerRecord.getId()).thenReturn(_brokerId);
    when(_brokerRecord.getType()).thenReturn("Broker");
    when(_brokerRecord.getAttributes()).thenReturn(brokerAttributes);
    _taskExecutor = new CurrentThreadTaskExecutor();
    _taskExecutor.start();
    _systemConfig = new JsonSystemConfigImpl(_taskExecutor, mock(EventLogger.class), null, new HashMap<String, Object>());
}
Also used : HashMap(java.util.HashMap) CurrentThreadTaskExecutor(org.apache.qpid.server.configuration.updater.CurrentThreadTaskExecutor) ConfiguredObject(org.apache.qpid.server.model.ConfiguredObject) JsonSystemConfigImpl(org.apache.qpid.server.model.JsonSystemConfigImpl)

Example 19 with CurrentThreadTaskExecutor

use of org.apache.qpid.server.configuration.updater.CurrentThreadTaskExecutor in project qpid-broker-j by apache.

the class PreferencesRecovererTest method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    _store = mock(PreferenceStore.class);
    _testObject = _model.getObjectFactory().create(TestCar.class, Collections.<String, Object>singletonMap(ConfiguredObject.NAME, getTestName()), null);
    _testChildObject = _testObject.createChild(TestEngine.class, Collections.<String, Object>singletonMap(ConfiguredObject.NAME, getTestName()));
    _testSubject = TestPrincipalUtils.createTestSubject(TEST_USERNAME);
    _preferenceTaskExecutor = new CurrentThreadTaskExecutor();
    _preferenceTaskExecutor.start();
    _recoverer = new PreferencesRecoverer(_preferenceTaskExecutor);
}
Also used : CurrentThreadTaskExecutor(org.apache.qpid.server.configuration.updater.CurrentThreadTaskExecutor) ConfiguredObject(org.apache.qpid.server.model.ConfiguredObject) TestEngine(org.apache.qpid.server.model.testmodels.hierarchy.TestEngine) TestCar(org.apache.qpid.server.model.testmodels.hierarchy.TestCar)

Example 20 with CurrentThreadTaskExecutor

use of org.apache.qpid.server.configuration.updater.CurrentThreadTaskExecutor in project qpid-broker-j by apache.

the class RedirectingVirtualHostNodeTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    _broker = BrokerTestHelper.createBrokerMock();
    SystemConfig<?> systemConfig = (SystemConfig<?>) _broker.getParent();
    when(systemConfig.getObjectFactory()).thenReturn(new ConfiguredObjectFactoryImpl(mock(Model.class)));
    _taskExecutor = new CurrentThreadTaskExecutor();
    _taskExecutor.start();
    when(_broker.getTaskExecutor()).thenReturn(_taskExecutor);
    when(_broker.getChildExecutor()).thenReturn(_taskExecutor);
    AuthenticationProvider dummyAuthProvider = mock(AuthenticationProvider.class);
    when(dummyAuthProvider.getName()).thenReturn("dummy");
    when(dummyAuthProvider.getId()).thenReturn(UUID.randomUUID());
    when(dummyAuthProvider.getMechanisms()).thenReturn(Arrays.asList("PLAIN"));
    when(_broker.getChildren(eq(AuthenticationProvider.class))).thenReturn(Collections.singleton(dummyAuthProvider));
    final Map<String, Object> attributes = new HashMap<>();
    attributes.put(Port.NAME, getTestName());
    attributes.put(Port.PORT, 0);
    attributes.put(Port.AUTHENTICATION_PROVIDER, "dummy");
    attributes.put(Port.TYPE, "AMQP");
    _port = (AmqpPort) _broker.getObjectFactory().create(Port.class, attributes, _broker);
}
Also used : SystemConfig(org.apache.qpid.server.model.SystemConfig) HashMap(java.util.HashMap) CurrentThreadTaskExecutor(org.apache.qpid.server.configuration.updater.CurrentThreadTaskExecutor) AuthenticationProvider(org.apache.qpid.server.model.AuthenticationProvider) 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