Search in sources :

Example 1 with BindingRecord

use of org.apache.qpid.server.store.berkeleydb.upgrade.UpgradeFrom4To5.BindingRecord in project qpid-broker-j by apache.

the class UpgradeFrom4to5Test method loadBindings.

private List<BindingRecord> loadBindings() {
    final BindingTuple bindingTuple = new BindingTuple();
    final List<BindingRecord> queueBindings = new ArrayList<BindingRecord>();
    CursorOperation databaseOperation = new CursorOperation() {

        @Override
        public void processEntry(Database sourceDatabase, Database targetDatabase, Transaction transaction, DatabaseEntry key, DatabaseEntry value) {
            BindingRecord bindingRecord = bindingTuple.entryToObject(key);
            AMQShortString queueName = bindingRecord.getQueueName();
            AMQShortString exchangeName = bindingRecord.getExchangeName();
            AMQShortString routingKey = bindingRecord.getRoutingKey();
            FieldTable arguments = bindingRecord.getArguments();
            queueBindings.add(new BindingRecord(exchangeName, queueName, routingKey, arguments));
        }
    };
    new DatabaseTemplate(_environment, BINDING_DB_NAME, null).run(databaseOperation);
    return queueBindings;
}
Also used : AMQShortString(org.apache.qpid.server.protocol.v0_8.AMQShortString) Transaction(com.sleepycat.je.Transaction) FieldTable(org.apache.qpid.server.protocol.v0_8.FieldTable) BindingTuple(org.apache.qpid.server.store.berkeleydb.upgrade.UpgradeFrom4To5.BindingTuple) ArrayList(java.util.ArrayList) Database(com.sleepycat.je.Database) DatabaseEntry(com.sleepycat.je.DatabaseEntry) BindingRecord(org.apache.qpid.server.store.berkeleydb.upgrade.UpgradeFrom4To5.BindingRecord)

Example 2 with BindingRecord

use of org.apache.qpid.server.store.berkeleydb.upgrade.UpgradeFrom4To5.BindingRecord in project qpid-broker-j by apache.

the class UpgradeFrom4to5Test method assertBindingRecord.

private void assertBindingRecord(List<BindingRecord> queueBindings, String queueName, String exchangeName, String routingKey, String selectorKey) {
    BindingRecord record = null;
    for (BindingRecord bindingRecord : queueBindings) {
        if (bindingRecord.getQueueName().toString().equals(queueName) && bindingRecord.getExchangeName().toString().equals(exchangeName)) {
            record = bindingRecord;
            break;
        }
    }
    assertNotNull("Binding is not found for queue " + queueName + " and exchange " + exchangeName, record);
    assertEquals("Unexpected routing key", routingKey, record.getRoutingKey().toString());
    if (selectorKey != null) {
        assertEquals("Unexpected selector key for " + queueName, selectorKey, record.getArguments().get(AMQPFilterTypes.JMS_SELECTOR.getValue()));
    }
}
Also used : BindingRecord(org.apache.qpid.server.store.berkeleydb.upgrade.UpgradeFrom4To5.BindingRecord)

Aggregations

BindingRecord (org.apache.qpid.server.store.berkeleydb.upgrade.UpgradeFrom4To5.BindingRecord)2 Database (com.sleepycat.je.Database)1 DatabaseEntry (com.sleepycat.je.DatabaseEntry)1 Transaction (com.sleepycat.je.Transaction)1 ArrayList (java.util.ArrayList)1 AMQShortString (org.apache.qpid.server.protocol.v0_8.AMQShortString)1 FieldTable (org.apache.qpid.server.protocol.v0_8.FieldTable)1 BindingTuple (org.apache.qpid.server.store.berkeleydb.upgrade.UpgradeFrom4To5.BindingTuple)1