Search in sources :

Example 46 with ConfiguredObjectRecord

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

the class ManagementModeStoreHandlerTest method testGetEntryByPortId.

public void testGetEntryByPortId() {
    Collection<ConfiguredObjectRecord> records = openAndGetRecords();
    ConfiguredObjectRecord portEntry = getEntry(records, _portEntryId);
    assertEquals("Unexpected entry id", _portEntryId, portEntry.getId());
    assertTrue("Unexpected children", getChildrenIds(records, portEntry).isEmpty());
    assertEquals("Unexpected state", State.QUIESCED, portEntry.getAttributes().get(Port.STATE));
}
Also used : ConfiguredObjectRecord(org.apache.qpid.server.store.ConfiguredObjectRecord)

Example 47 with ConfiguredObjectRecord

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

the class ManagementModeStoreHandlerTest method testRemoveCLIPort.

public void testRemoveCLIPort() {
    _systemConfigAttributes.put(SystemConfig.MANAGEMENT_MODE_HTTP_PORT_OVERRIDE, 1000);
    _handler = createManagementModeStoreHandler();
    _handler.init(_systemConfig);
    Collection<ConfiguredObjectRecord> records = openAndGetRecords();
    UUID portId = getOptionsPortId(records);
    ConfiguredObjectRecord record = mock(ConfiguredObjectRecord.class);
    when(record.getId()).thenReturn(portId);
    try {
        _handler.remove(record);
        fail("Exception should be thrown on trying to remove CLI port");
    } catch (IllegalConfigurationException e) {
    // pass
    }
}
Also used : IllegalConfigurationException(org.apache.qpid.server.configuration.IllegalConfigurationException) ConfiguredObjectRecord(org.apache.qpid.server.store.ConfiguredObjectRecord) UUID(java.util.UUID)

Example 48 with ConfiguredObjectRecord

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

the class ManagementModeStoreHandlerTest method testGetRootEntryWithHttpPortOverriden.

public void testGetRootEntryWithHttpPortOverriden() {
    _systemConfigAttributes.put(SystemConfig.MANAGEMENT_MODE_HTTP_PORT_OVERRIDE, 9090);
    _handler = createManagementModeStoreHandler();
    _handler.init(_systemConfig);
    Collection<ConfiguredObjectRecord> records = openAndGetRecords();
    ConfiguredObjectRecord root = getRootEntry(records);
    assertEquals("Unexpected root id", _rootId, root.getId());
    Collection<UUID> childrenIds = getChildrenIds(records, root);
    assertEquals("Unexpected children size", 2, childrenIds.size());
    assertTrue("Store port entry id is not found", childrenIds.contains(_portEntryId));
}
Also used : ConfiguredObjectRecord(org.apache.qpid.server.store.ConfiguredObjectRecord) UUID(java.util.UUID)

Example 49 with ConfiguredObjectRecord

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

the class ManagementModeStoreHandlerTest method testGetRootEntryWithManagementPortsOverriden.

public void testGetRootEntryWithManagementPortsOverriden() {
    _systemConfigAttributes.put(SystemConfig.MANAGEMENT_MODE_HTTP_PORT_OVERRIDE, 1000);
    _handler = createManagementModeStoreHandler();
    _handler.init(_systemConfig);
    Collection<ConfiguredObjectRecord> records = openAndGetRecords();
    ConfiguredObjectRecord root = getRootEntry(records);
    assertEquals("Unexpected root id", _rootId, root.getId());
    Collection<UUID> childrenIds = getChildrenIds(records, root);
    assertEquals("Unexpected children size", 2, childrenIds.size());
    assertTrue("Store port entry id is not found", childrenIds.contains(_portEntryId));
}
Also used : ConfiguredObjectRecord(org.apache.qpid.server.store.ConfiguredObjectRecord) UUID(java.util.UUID)

Example 50 with ConfiguredObjectRecord

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

the class ManagementModeStoreHandlerTest method testGetRootEntryWithEmptyOptions.

public void testGetRootEntryWithEmptyOptions() {
    Collection<ConfiguredObjectRecord> records = openAndGetRecords();
    ConfiguredObjectRecord root = getRootEntry(records);
    assertEquals("Unexpected root id", _rootId, root.getId());
    assertEquals("Unexpected children", Collections.singleton(_portEntryId), getChildrenIds(records, root));
}
Also used : 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