Search in sources :

Example 1 with ConfiguredObjectFactoryImpl

use of org.apache.qpid.server.model.ConfiguredObjectFactoryImpl in project qpid-broker-j by apache.

the class VirtualHostQueueCreationTest method setUp.

@SuppressWarnings({ "rawtypes", "unchecked" })
@Before
public void setUp() throws Exception {
    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) Before(org.junit.Before)

Example 2 with ConfiguredObjectFactoryImpl

use of org.apache.qpid.server.model.ConfiguredObjectFactoryImpl in project qpid-broker-j by apache.

the class AbstractStandardVirtualHostNodeTest method setUp.

@Before
public void setUp() throws Exception {
    _taskExecutor = new CurrentThreadTaskExecutor();
    _broker = BrokerTestHelper.createBrokerMock();
    SystemConfig<?> systemConfig = (SystemConfig<?>) _broker.getParent();
    when(systemConfig.getObjectFactory()).thenReturn(new ConfiguredObjectFactoryImpl(mock(Model.class)));
    _taskExecutor.start();
    when(_broker.getTaskExecutor()).thenReturn(_taskExecutor);
    when(_broker.getChildExecutor()).thenReturn(_taskExecutor);
}
Also used : SystemConfig(org.apache.qpid.server.model.SystemConfig) CurrentThreadTaskExecutor(org.apache.qpid.server.configuration.updater.CurrentThreadTaskExecutor) ConfiguredObjectFactoryImpl(org.apache.qpid.server.model.ConfiguredObjectFactoryImpl) Before(org.junit.Before)

Example 3 with ConfiguredObjectFactoryImpl

use of org.apache.qpid.server.model.ConfiguredObjectFactoryImpl in project qpid-broker-j by apache.

the class DerbyVirtualHostNodeTest method createBroker.

private BrokerImpl createBroker() {
    Map<String, Object> brokerAttributes = Collections.<String, Object>singletonMap(Broker.NAME, "Broker");
    SystemConfig parent = BrokerTestHelper.mockWithSystemPrincipal(SystemConfig.class, mock(Principal.class));
    when(parent.getEventLogger()).thenReturn(new EventLogger());
    when(parent.getCategoryClass()).thenReturn(SystemConfig.class);
    when(parent.getTaskExecutor()).thenReturn(_taskExecutor);
    when(parent.getChildExecutor()).thenReturn(_taskExecutor);
    when(parent.getModel()).thenReturn(BrokerModel.getInstance());
    when(parent.getObjectFactory()).thenReturn(new ConfiguredObjectFactoryImpl(BrokerModel.getInstance()));
    BrokerImpl broker = new BrokerImpl(brokerAttributes, parent);
    broker.start();
    return broker;
}
Also used : BrokerImpl(org.apache.qpid.server.model.BrokerImpl) SystemConfig(org.apache.qpid.server.model.SystemConfig) EventLogger(org.apache.qpid.server.logging.EventLogger) Principal(java.security.Principal) ConfiguredObjectFactoryImpl(org.apache.qpid.server.model.ConfiguredObjectFactoryImpl)

Example 4 with ConfiguredObjectFactoryImpl

use of org.apache.qpid.server.model.ConfiguredObjectFactoryImpl in project qpid-broker-j by apache.

the class AbstractDurableConfigurationStoreTestCase method setUp.

@Before
public void setUp() throws Exception {
    _queueId = UUIDGenerator.generateRandomUUID();
    _exchangeId = UUIDGenerator.generateRandomUUID();
    _factory = new ConfiguredObjectFactoryImpl(BrokerModel.getInstance());
    _storeName = getTestName();
    _storePath = TMP_FOLDER + File.separator + _storeName;
    FileUtils.delete(new File(_storePath), true);
    _handler = mock(ConfiguredObjectRecordHandler.class);
    _bindingArgs = new HashMap<>();
    String argKey = AMQPFilterTypes.JMS_SELECTOR.toString();
    String argValue = "some selector expression";
    _bindingArgs.put(argKey, argValue);
    _parent = createVirtualHostNode(_storePath, _factory);
    _configStore = createConfigStore();
    _configStore.init(_parent);
    _configStore.openConfigurationStore(new ConfiguredObjectRecordHandler() {

        @Override
        public void handle(final ConfiguredObjectRecord record) {
        }
    });
    _rootRecord = new ConfiguredObjectRecordImpl(UUID.randomUUID(), VirtualHost.class.getSimpleName(), Collections.<String, Object>singletonMap(ConfiguredObject.NAME, "vhost"));
    _configStore.create(_rootRecord);
}
Also used : ConfiguredObject(org.apache.qpid.server.model.ConfiguredObject) File(java.io.File) ConfiguredObjectFactoryImpl(org.apache.qpid.server.model.ConfiguredObjectFactoryImpl) ConfiguredObjectRecordHandler(org.apache.qpid.server.store.handler.ConfiguredObjectRecordHandler) Before(org.junit.Before)

Example 5 with ConfiguredObjectFactoryImpl

use of org.apache.qpid.server.model.ConfiguredObjectFactoryImpl in project qpid-broker-j by apache.

the class JsonFileConfigStoreTest method setUp.

@Before
public void setUp() throws Exception {
    ConfiguredObjectFactory factory = new ConfiguredObjectFactoryImpl(BrokerModel.getInstance());
    _parent = mock(JsonVirtualHostNode.class);
    when(_parent.getName()).thenReturn(getTestName());
    when(_parent.getObjectFactory()).thenReturn(factory);
    when(_parent.getModel()).thenReturn(factory.getModel());
    _storeLocation = TestFileUtils.createTestDirectory("json", true);
    when(_parent.getStorePath()).thenReturn(_storeLocation.getAbsolutePath());
    _store = new JsonFileConfigStore(VirtualHost.class);
    _handler = mock(ConfiguredObjectRecordHandler.class);
}
Also used : ConfiguredObjectFactory(org.apache.qpid.server.model.ConfiguredObjectFactory) JsonVirtualHostNode(org.apache.qpid.server.virtualhostnode.JsonVirtualHostNode) VirtualHost(org.apache.qpid.server.model.VirtualHost) ConfiguredObjectFactoryImpl(org.apache.qpid.server.model.ConfiguredObjectFactoryImpl) ConfiguredObjectRecordHandler(org.apache.qpid.server.store.handler.ConfiguredObjectRecordHandler) Before(org.junit.Before)

Aggregations

ConfiguredObjectFactoryImpl (org.apache.qpid.server.model.ConfiguredObjectFactoryImpl)11 Before (org.junit.Before)9 CurrentThreadTaskExecutor (org.apache.qpid.server.configuration.updater.CurrentThreadTaskExecutor)6 EventLogger (org.apache.qpid.server.logging.EventLogger)6 SystemConfig (org.apache.qpid.server.model.SystemConfig)6 Broker (org.apache.qpid.server.model.Broker)5 ConfiguredObjectFactory (org.apache.qpid.server.model.ConfiguredObjectFactory)5 TaskExecutor (org.apache.qpid.server.configuration.updater.TaskExecutor)4 ConfiguredObject (org.apache.qpid.server.model.ConfiguredObject)4 HashMap (java.util.HashMap)3 Principal (java.security.Principal)2 AuthenticationProvider (org.apache.qpid.server.model.AuthenticationProvider)2 VirtualHostNode (org.apache.qpid.server.model.VirtualHostNode)2 DurableConfigurationStore (org.apache.qpid.server.store.DurableConfigurationStore)2 ConfiguredObjectRecordHandler (org.apache.qpid.server.store.handler.ConfiguredObjectRecordHandler)2 File (java.io.File)1 IllegalConfigurationException (org.apache.qpid.server.configuration.IllegalConfigurationException)1 TaskExecutorImpl (org.apache.qpid.server.configuration.updater.TaskExecutorImpl)1 BrokerImpl (org.apache.qpid.server.model.BrokerImpl)1 VirtualHost (org.apache.qpid.server.model.VirtualHost)1