Search in sources :

Example 11 with ConfiguredObjectRecordImpl

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

the class ConfiguredObjectBindingTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    _configuredObjectBinding = ConfiguredObjectBinding.getInstance();
    _object = new ConfiguredObjectRecordImpl(UUIDGenerator.generateRandomUUID(), DUMMY_TYPE_STRING, DUMMY_ATTRIBUTES_MAP);
}
Also used : ConfiguredObjectRecordImpl(org.apache.qpid.server.store.ConfiguredObjectRecordImpl)

Example 12 with ConfiguredObjectRecordImpl

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

the class AbstractVirtualHostNode method enrichWithAuditInformation.

private void enrichWithAuditInformation(final Collection<ConfiguredObjectRecord> records) {
    List<ConfiguredObjectRecord> replacements = new ArrayList<>(records.size());
    for (ConfiguredObjectRecord record : records) {
        replacements.add(new ConfiguredObjectRecordImpl(record.getId(), record.getType(), enrichAttributesWithAuditInformation(record.getAttributes()), record.getParents()));
    }
    records.clear();
    records.addAll(replacements);
}
Also used : ConfiguredObjectRecordImpl(org.apache.qpid.server.store.ConfiguredObjectRecordImpl) ArrayList(java.util.ArrayList) ConfiguredObjectRecord(org.apache.qpid.server.store.ConfiguredObjectRecord)

Example 13 with ConfiguredObjectRecordImpl

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

the class ManagementModeStoreHandlerTest method testSavePort.

public void testSavePort() {
    _systemConfigAttributes.put(SystemConfig.MANAGEMENT_MODE_HTTP_PORT_OVERRIDE, 1000);
    _handler = createManagementModeStoreHandler();
    _handler.init(_systemConfig);
    Collection<ConfiguredObjectRecord> records = openAndGetRecords();
    Map<String, Object> attributes = new HashMap<String, Object>();
    attributes.put(Port.NAME, "TEST");
    ConfiguredObjectRecord configurationEntry = new ConfiguredObjectRecordImpl(_portEntryId, Port.class.getSimpleName(), attributes, Collections.singletonMap(Broker.class.getSimpleName(), getRootEntry(records).getId()));
    _handler.create(configurationEntry);
    verify(_store).create(any(ConfiguredObjectRecord.class));
}
Also used : ConfiguredObjectRecordImpl(org.apache.qpid.server.store.ConfiguredObjectRecordImpl) HashMap(java.util.HashMap) Port(org.apache.qpid.server.model.Port) ConfiguredObject(org.apache.qpid.server.model.ConfiguredObject) ConfiguredObjectRecord(org.apache.qpid.server.store.ConfiguredObjectRecord)

Example 14 with ConfiguredObjectRecordImpl

use of org.apache.qpid.server.store.ConfiguredObjectRecordImpl 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);
}
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) CurrentThreadTaskExecutor(org.apache.qpid.server.configuration.updater.CurrentThreadTaskExecutor) Port(org.apache.qpid.server.model.Port) Answer(org.mockito.stubbing.Answer) Mockito.doAnswer(org.mockito.Mockito.doAnswer) ConfiguredObjectRecordImpl(org.apache.qpid.server.store.ConfiguredObjectRecordImpl) InvocationOnMock(org.mockito.invocation.InvocationOnMock) ConfiguredObject(org.apache.qpid.server.model.ConfiguredObject) ConfiguredObjectRecord(org.apache.qpid.server.store.ConfiguredObjectRecord) JsonSystemConfigImpl(org.apache.qpid.server.model.JsonSystemConfigImpl) ConfiguredObjectRecordHandler(org.apache.qpid.server.store.handler.ConfiguredObjectRecordHandler)

Example 15 with ConfiguredObjectRecordImpl

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

Aggregations

ConfiguredObjectRecordImpl (org.apache.qpid.server.store.ConfiguredObjectRecordImpl)16 ConfiguredObjectRecord (org.apache.qpid.server.store.ConfiguredObjectRecord)14 HashMap (java.util.HashMap)11 ConfiguredObject (org.apache.qpid.server.model.ConfiguredObject)11 UUID (java.util.UUID)4 Broker (org.apache.qpid.server.model.Broker)3 Port (org.apache.qpid.server.model.Port)3 LinkedHashMap (java.util.LinkedHashMap)2 IllegalConfigurationException (org.apache.qpid.server.configuration.IllegalConfigurationException)2 VirtualHost (org.apache.qpid.server.model.VirtualHost)2 ConfiguredObjectRecordHandler (org.apache.qpid.server.store.handler.ConfiguredObjectRecordHandler)2 Mockito.doAnswer (org.mockito.Mockito.doAnswer)2 InvocationOnMock (org.mockito.invocation.InvocationOnMock)2 Answer (org.mockito.stubbing.Answer)2 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 Set (java.util.Set)1 CurrentThreadTaskExecutor (org.apache.qpid.server.configuration.updater.CurrentThreadTaskExecutor)1 AbstractConfiguredObject (org.apache.qpid.server.model.AbstractConfiguredObject)1 AbstractSystemConfig (org.apache.qpid.server.model.AbstractSystemConfig)1