use of org.apache.qpid.server.model.ConfiguredObjectFactory in project qpid-broker-j by apache.
the class BDBHARemoteReplicationNodeTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
_facade = mock(ReplicatedEnvironmentFacade.class);
_broker = BrokerTestHelper.createBrokerMock();
_taskExecutor = new CurrentThreadTaskExecutor();
_taskExecutor.start();
when(_broker.getTaskExecutor()).thenReturn(_taskExecutor);
when(_broker.getChildExecutor()).thenReturn(_taskExecutor);
_virtualHostNode = BrokerTestHelper.mockWithSystemPrincipalAndAccessControl(BDBHAVirtualHostNode.class, mock(Principal.class), _mockAccessControl);
_configStore = mock(DurableConfigurationStore.class);
when(_virtualHostNode.getConfigurationStore()).thenReturn(_configStore);
// Virtualhost needs the EventLogger from the SystemContext.
when(_virtualHostNode.getParent()).thenReturn(_broker);
doReturn(VirtualHostNode.class).when(_virtualHostNode).getCategoryClass();
ConfiguredObjectFactory objectFactory = _broker.getObjectFactory();
when(_virtualHostNode.getModel()).thenReturn(objectFactory.getModel());
when(_virtualHostNode.getTaskExecutor()).thenReturn(_taskExecutor);
when(_virtualHostNode.getChildExecutor()).thenReturn(_taskExecutor);
}
use of org.apache.qpid.server.model.ConfiguredObjectFactory in project qpid-broker-j by apache.
the class VirtualHostCreationTest method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
EventLogger eventLogger = mock(EventLogger.class);
TaskExecutor executor = CurrentThreadTaskExecutor.newStartedInstance();
SystemConfig systemConfig = mock(SystemConfig.class);
ConfiguredObjectFactory objectFactory = new ConfiguredObjectFactoryImpl(BrokerModel.getInstance());
when(systemConfig.getObjectFactory()).thenReturn(objectFactory);
when(systemConfig.getModel()).thenReturn(objectFactory.getModel());
when(systemConfig.getEventLogger()).thenReturn(eventLogger);
when(systemConfig.getTaskExecutor()).thenReturn(executor);
when(systemConfig.getChildExecutor()).thenReturn(executor);
Broker broker = mock(Broker.class);
when(broker.getObjectFactory()).thenReturn(objectFactory);
when(broker.getModel()).thenReturn(objectFactory.getModel());
when(broker.getCategoryClass()).thenReturn(Broker.class);
when(broker.getParent()).thenReturn(systemConfig);
when(broker.getTaskExecutor()).thenReturn(executor);
when(broker.getChildExecutor()).thenReturn(executor);
_virtualHostNode = BrokerTestHelper.mockWithSystemPrincipal(VirtualHostNode.class, mock(Principal.class));
when(_virtualHostNode.getParent()).thenReturn(broker);
when(_virtualHostNode.getObjectFactory()).thenReturn(objectFactory);
when(_virtualHostNode.getConfigurationStore()).thenReturn(mock(DurableConfigurationStore.class));
when(_virtualHostNode.getModel()).thenReturn(objectFactory.getModel());
when(_virtualHostNode.getCategoryClass()).thenReturn(VirtualHostNode.class);
when(_virtualHostNode.getTaskExecutor()).thenReturn(executor);
when(_virtualHostNode.getChildExecutor()).thenReturn(executor);
}
use of org.apache.qpid.server.model.ConfiguredObjectFactory in project qpid-broker-j by apache.
the class PortFactoryTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
SystemConfig systemConfig = mock(SystemConfig.class);
_portNumber = findFreePort();
TaskExecutor executor = CurrentThreadTaskExecutor.newStartedInstance();
when(_authProvider.getName()).thenReturn(_authProviderName);
when(_broker.getChildren(eq(AuthenticationProvider.class))).thenReturn(Collections.singleton(_authProvider));
when(_broker.getCategoryClass()).thenReturn(Broker.class);
when(_broker.getEventLogger()).thenReturn(new EventLogger());
when(_broker.getParent()).thenReturn(systemConfig);
when(_broker.getTypeClass()).thenReturn(Broker.class);
ConfiguredObjectFactory objectFactory = new ConfiguredObjectFactoryImpl(BrokerModel.getInstance());
when(_broker.getObjectFactory()).thenReturn(objectFactory);
when(_broker.getModel()).thenReturn(objectFactory.getModel());
when(_authProvider.getModel()).thenReturn(objectFactory.getModel());
when(_authProvider.getObjectFactory()).thenReturn(objectFactory);
when(_authProvider.getCategoryClass()).thenReturn(AuthenticationProvider.class);
when(_authProvider.getMechanisms()).thenReturn(Arrays.asList("PLAIN"));
when(_keyStore.getModel()).thenReturn(objectFactory.getModel());
when(_keyStore.getObjectFactory()).thenReturn(objectFactory);
when(_trustStore.getModel()).thenReturn(objectFactory.getModel());
when(_trustStore.getObjectFactory()).thenReturn(objectFactory);
for (ConfiguredObject obj : new ConfiguredObject[] { _authProvider, _broker, _keyStore, _trustStore }) {
when(obj.getTaskExecutor()).thenReturn(executor);
when(obj.getChildExecutor()).thenReturn(executor);
}
_factory = new ConfiguredObjectFactoryImpl(BrokerModel.getInstance());
_attributes.put(Port.ID, _portId);
_attributes.put(Port.NAME, getName());
_attributes.put(Port.PORT, _portNumber);
_attributes.put(Port.TRANSPORTS, _tcpStringSet);
_attributes.put(Port.AUTHENTICATION_PROVIDER, _authProviderName);
_attributes.put(Port.TCP_NO_DELAY, "true");
_attributes.put(Port.BINDING_ADDRESS, "127.0.0.1");
}
use of org.apache.qpid.server.model.ConfiguredObjectFactory in project qpid-broker-j by apache.
the class JsonFileConfigStoreTest method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
ConfiguredObjectFactory factory = new ConfiguredObjectFactoryImpl(BrokerModel.getInstance());
_parent = mock(JsonVirtualHostNode.class);
when(_parent.getName()).thenReturn(getName());
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);
}
Aggregations