use of org.apache.qpid.server.store.berkeleydb.upgrade.UpgradeFrom4To5.QueueRecord in project qpid-broker-j by apache.
the class UpgradeFrom4to5Test method assertQueues.
private void assertQueues(Set<String> expectedQueueNames) {
List<AMQShortString> durableSubNames = Collections.emptyList();
final UpgradeFrom4To5.QueueRecordBinding binding = new UpgradeFrom4To5.QueueRecordBinding(durableSubNames);
final Set<String> actualQueueNames = new HashSet<String>();
CursorOperation queueNameCollector = new CursorOperation() {
@Override
public void processEntry(Database sourceDatabase, Database targetDatabase, Transaction transaction, DatabaseEntry key, DatabaseEntry value) {
QueueRecord record = binding.entryToObject(value);
String queueName = record.getNameShortString().toString();
actualQueueNames.add(queueName);
}
};
new DatabaseTemplate(_environment, "queueDb_v5", null).run(queueNameCollector);
assertEquals("Unexpected queue names", expectedQueueNames, actualQueueNames);
}
use of org.apache.qpid.server.store.berkeleydb.upgrade.UpgradeFrom4To5.QueueRecord in project qpid-broker-j by apache.
the class UpgradeFrom4to5Test method assertQueueHasOwner.
private void assertQueueHasOwner(String queueName, final String expectedOwner) {
List<AMQShortString> durableSubNames = Collections.emptyList();
final UpgradeFrom4To5.QueueRecordBinding binding = new UpgradeFrom4To5.QueueRecordBinding(durableSubNames);
final AtomicReference<String> actualOwner = new AtomicReference<String>();
final AtomicBoolean foundQueue = new AtomicBoolean(false);
CursorOperation queueNameCollector = new CursorOperation() {
@Override
public void processEntry(Database sourceDatabase, Database targetDatabase, Transaction transaction, DatabaseEntry key, DatabaseEntry value) {
QueueRecord record = binding.entryToObject(value);
String queueName = record.getNameShortString().toString();
if (queueName.equals(queueName)) {
foundQueue.set(true);
actualOwner.set(AMQShortString.toString(record.getOwner()));
}
}
};
new DatabaseTemplate(_environment, "queueDb_v5", null).run(queueNameCollector);
assertTrue("Could not find queue in database", foundQueue.get());
assertEquals("Queue has unexpected owner", expectedOwner, actualOwner.get());
}
Aggregations