use of org.apache.qpid.server.model.SystemConfig in project qpid-broker-j by apache.
the class TestBrokerConfiguration method save.
public boolean save(File configFile) {
Map<String, Object> attributes = new HashMap<>();
attributes.put("storePath", configFile.getAbsolutePath());
SystemConfigFactory configFactory = (new PluggableFactoryLoader<>(SystemConfigFactory.class)).get(_storeType);
attributes.put(SystemConfig.STARTUP_LOGGED_TO_SYSTEM_OUT, false);
attributes.put(ConfiguredObject.DESIRED_STATE, State.QUIESCED);
final SystemConfig parentObject = configFactory.newInstance(_taskExecutor, mock(EventLogger.class), null, attributes);
parentObject.open();
DurableConfigurationStore configurationStore = parentObject.getConfigurationStore();
configurationStore.closeConfigurationStore();
final List<ConfiguredObjectRecord> records = getConfiguredObjectRecords();
configurationStore.init(parentObject);
clearStore(configurationStore);
configurationStore.update(true, records.toArray(new ConfiguredObjectRecord[records.size()]));
configurationStore.closeConfigurationStore();
parentObject.close();
return true;
}
Aggregations