JavaSpaceAdmin admin = (JavaSpaceAdmin) ((Administrable)
services[0]).getAdmin();
admin = (JavaSpaceAdmin) getConfig().prepare("test.outriggerAdminPreparer",
admin);
final AdminIterator i = admin.contents(null, null, 10);
Entry weGot = i.next();
while (weGot != null) {
boolean accounted = false;
final Template weGotTemplate = new Template(weGot);
logger.log(Level.INFO, "Got " + weGot + " from the interator");
for (Iterator k = allEntries.iterator(); k.hasNext();) {
final Entry weWrote = (Entry) k.next();
final Template weWroteTemplate = new Template(weWrote);
if (weWroteTemplate.matchFieldAreEqual(weGotTemplate)) {
k.remove();
if (deleteAsWeGo) {
i.delete();
}
accounted = true;
break;
}
}
/*
* At this point we have found it in the list of
* entries we wrote or its not their
*/
if (!accounted) {
throw new TestException(
"Extra entries in space!");
}
weGot = i.next();
}
i.close();
if (!allEntries.isEmpty()) {
throw new TestException(
"Did not get back all the entries we wrote");
}
// Check to see if the entries are still their (or not there...)
if (deleteAsWeGo) {
// do a null take and complane if we get something back...
if (spaceTake(null, null, 20000) != null) {
throw new TestException(
"Deleting all the entries with the interator did"
+ " not work");
}
} else {
for (Iterator j = copyOfAllEntries.iterator(); j.hasNext();) {
final Entry toPull = (Entry) j.next();
if (spaceTake(toPull, null, 20000) == null) {
throw new TestException(
"Could not find one of the entries we wrote "
+ "after using iterator");