use of org.apache.qpid.server.model.JsonSystemConfigImpl 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);
}
use of org.apache.qpid.server.model.JsonSystemConfigImpl in project qpid-broker-j by apache.
the class ManagementModeStoreHandlerTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
_rootId = UUID.randomUUID();
_portEntryId = UUID.randomUUID();
_store = mock(DurableConfigurationStore.class);
_taskExecutor = new CurrentThreadTaskExecutor();
_taskExecutor.start();
_systemConfig = new JsonSystemConfigImpl(_taskExecutor, mock(EventLogger.class), null, new HashMap<String, Object>());
ConfiguredObjectRecord systemContextRecord = _systemConfig.asObjectRecord();
_root = new ConfiguredObjectRecordImpl(_rootId, Broker.class.getSimpleName(), Collections.singletonMap(Broker.NAME, (Object) "broker"), Collections.singletonMap(SystemConfig.class.getSimpleName(), systemContextRecord.getId()));
_portEntry = mock(ConfiguredObjectRecord.class);
when(_portEntry.getId()).thenReturn(_portEntryId);
when(_portEntry.getParents()).thenReturn(Collections.singletonMap(Broker.class.getSimpleName(), _root.getId()));
when(_portEntry.getType()).thenReturn(Port.class.getSimpleName());
final ArgumentCaptor<ConfiguredObjectRecordHandler> recovererArgumentCaptor = ArgumentCaptor.forClass(ConfiguredObjectRecordHandler.class);
doAnswer(new Answer() {
@Override
public Object answer(final InvocationOnMock invocation) throws Throwable {
ConfiguredObjectRecordHandler recoverer = recovererArgumentCaptor.getValue();
recoverer.handle(_root);
recoverer.handle(_portEntry);
return false;
}
}).when(_store).openConfigurationStore(recovererArgumentCaptor.capture());
_systemConfigAttributes = new HashMap<>();
_handler = new ManagementModeStoreHandler(_store, _systemConfig);
;
_handler.init(_systemConfig);
}
use of org.apache.qpid.server.model.JsonSystemConfigImpl 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);
}
use of org.apache.qpid.server.model.JsonSystemConfigImpl 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>());
}
Aggregations