use of org.apache.qpid.server.store.berkeleydb.upgrade.UpgradeFrom4To5.MessageContentKeyBinding in project qpid-broker-j by apache.
the class UpgradeFrom4to5Test method assertContentForQueue.
private void assertContentForQueue(String queueName, int expectedQueueSize, final Set<Long> messageIdsForQueue) {
final AtomicInteger contentCounter = new AtomicInteger();
final MessageContentKeyBinding keyBinding = new MessageContentKeyBinding();
CursorOperation cursorOperation = new CursorOperation() {
private long _prevMsgId = -1;
@Override
public void processEntry(Database sourceDatabase, Database targetDatabase, Transaction transaction, DatabaseEntry key, DatabaseEntry value) {
MessageContentKey contentKey = keyBinding.entryToObject(key);
long msgId = contentKey.getMessageId();
if (_prevMsgId != msgId && messageIdsForQueue.contains(msgId)) {
contentCounter.incrementAndGet();
}
_prevMsgId = msgId;
}
};
new DatabaseTemplate(_environment, MESSAGE_CONTENT_DB_NAME, null).run(cursorOperation);
assertEquals("Unxpected number of entries in content db for queue " + queueName, expectedQueueSize, contentCounter.get());
}
Aggregations