use of org.apache.qpid.server.store.berkeleydb.upgrade.UpgradeFrom4To5.QueueEntryKey in project qpid-broker-j by apache.
the class UpgradeFrom4to5Test method assertDeliveriesForQueue.
private Set<Long> assertDeliveriesForQueue(final String queueName, final int expectedQueueSize) {
final QueueEntryKeyBinding queueEntryKeyBinding = new QueueEntryKeyBinding();
final AtomicInteger deliveryCounter = new AtomicInteger();
final Set<Long> messagesForQueue = new HashSet<Long>();
CursorOperation deliveryDatabaseOperation = new CursorOperation() {
@Override
public void processEntry(Database sourceDatabase, Database targetDatabase, Transaction transaction, DatabaseEntry key, DatabaseEntry value) {
QueueEntryKey entryKey = queueEntryKeyBinding.entryToObject(key);
String thisQueueName = entryKey.getQueueName().toString();
if (thisQueueName.equals(queueName)) {
deliveryCounter.incrementAndGet();
messagesForQueue.add(entryKey.getMessageId());
}
}
};
new DatabaseTemplate(_environment, DELIVERY_DB_NAME, null).run(deliveryDatabaseOperation);
assertEquals("Unxpected number of entries in delivery db for queue " + queueName, expectedQueueSize, deliveryCounter.get());
return messagesForQueue;
}
Aggregations