Search in sources :

Example 16 with SystemConfig

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;
}
Also used : SystemConfig(org.apache.qpid.server.model.SystemConfig) AbstractSystemConfig(org.apache.qpid.server.model.AbstractSystemConfig) DurableConfigurationStore(org.apache.qpid.server.store.DurableConfigurationStore) HashMap(java.util.HashMap) EventLogger(org.apache.qpid.server.logging.EventLogger) SystemConfigFactory(org.apache.qpid.server.plugin.SystemConfigFactory) ConfiguredObject(org.apache.qpid.server.model.ConfiguredObject) ConfiguredObjectRecord(org.apache.qpid.server.store.ConfiguredObjectRecord) PluggableFactoryLoader(org.apache.qpid.server.plugin.PluggableFactoryLoader)

Aggregations

SystemConfig (org.apache.qpid.server.model.SystemConfig)16 EventLogger (org.apache.qpid.server.logging.EventLogger)10 ConfiguredObject (org.apache.qpid.server.model.ConfiguredObject)8 HashMap (java.util.HashMap)7 Broker (org.apache.qpid.server.model.Broker)7 ConfiguredObjectFactoryImpl (org.apache.qpid.server.model.ConfiguredObjectFactoryImpl)7 CurrentThreadTaskExecutor (org.apache.qpid.server.configuration.updater.CurrentThreadTaskExecutor)4 AuthenticationProvider (org.apache.qpid.server.model.AuthenticationProvider)4 VirtualHostNode (org.apache.qpid.server.model.VirtualHostNode)4 BrokerModel (org.apache.qpid.server.model.BrokerModel)3 Model (org.apache.qpid.server.model.Model)3 ConfiguredObjectRecord (org.apache.qpid.server.store.ConfiguredObjectRecord)3 DurableConfigurationStore (org.apache.qpid.server.store.DurableConfigurationStore)3 Principal (java.security.Principal)2 Subject (javax.security.auth.Subject)2 IllegalConfigurationException (org.apache.qpid.server.configuration.IllegalConfigurationException)2 TaskExecutor (org.apache.qpid.server.configuration.updater.TaskExecutor)2 TaskExecutorImpl (org.apache.qpid.server.configuration.updater.TaskExecutorImpl)2 AbstractConfiguredObject (org.apache.qpid.server.model.AbstractConfiguredObject)2 ConfiguredObjectFactory (org.apache.qpid.server.model.ConfiguredObjectFactory)2