Search in sources :

Example 56 with ConfiguredObjectRecord

use of org.apache.qpid.server.store.ConfiguredObjectRecord in project qpid-broker-j by apache.

the class TestBrokerConfiguration method setObjectAttributes.

private boolean setObjectAttributes(ConfiguredObjectRecord entry, Map<String, Object> attributes) {
    Map<String, Object> newAttributes = new HashMap<String, Object>(entry.getAttributes());
    newAttributes.putAll(attributes);
    ConfiguredObjectRecord newEntry = new ConfiguredObjectRecordImpl(entry.getId(), entry.getType(), newAttributes, entry.getParents());
    _store.update(false, newEntry);
    return true;
}
Also used : ConfiguredObjectRecordImpl(org.apache.qpid.server.store.ConfiguredObjectRecordImpl) HashMap(java.util.HashMap) ConfiguredObject(org.apache.qpid.server.model.ConfiguredObject) ConfiguredObjectRecord(org.apache.qpid.server.store.ConfiguredObjectRecord)

Example 57 with ConfiguredObjectRecord

use of org.apache.qpid.server.store.ConfiguredObjectRecord 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)

Example 58 with ConfiguredObjectRecord

use of org.apache.qpid.server.store.ConfiguredObjectRecord in project qpid-broker-j by apache.

the class TestBrokerConfiguration method addObjectConfiguration.

private void addObjectConfiguration(UUID id, String type, Map<String, Object> attributes) {
    ConfiguredObjectRecord entry = new ConfiguredObjectRecordImpl(id, type, attributes, Collections.singletonMap(Broker.class.getSimpleName(), findObject(Broker.class, null).getId()));
    _store.update(true, entry);
}
Also used : ConfiguredObjectRecordImpl(org.apache.qpid.server.store.ConfiguredObjectRecordImpl) Broker(org.apache.qpid.server.model.Broker) ConfiguredObjectRecord(org.apache.qpid.server.store.ConfiguredObjectRecord)

Aggregations

ConfiguredObjectRecord (org.apache.qpid.server.store.ConfiguredObjectRecord)58 HashMap (java.util.HashMap)27 ConfiguredObject (org.apache.qpid.server.model.ConfiguredObject)25 UUID (java.util.UUID)24 ConfiguredObjectRecordImpl (org.apache.qpid.server.store.ConfiguredObjectRecordImpl)14 IllegalConfigurationException (org.apache.qpid.server.configuration.IllegalConfigurationException)13 ArrayList (java.util.ArrayList)12 ConfiguredObjectRecordHandler (org.apache.qpid.server.store.handler.ConfiguredObjectRecordHandler)8 LinkedHashMap (java.util.LinkedHashMap)6 IOException (java.io.IOException)5 Transaction (com.sleepycat.je.Transaction)4 Map (java.util.Map)4 DurableConfigurationStore (org.apache.qpid.server.store.DurableConfigurationStore)4 StoreException (org.apache.qpid.server.store.StoreException)4 Mockito.doAnswer (org.mockito.Mockito.doAnswer)4 InvocationOnMock (org.mockito.invocation.InvocationOnMock)4 Answer (org.mockito.stubbing.Answer)4 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)3 Connection (java.sql.Connection)3 SQLException (java.sql.SQLException)3