String contentKey = "content";
List<H2HTestData> content = new ArrayList<H2HTestData>();
int numberOfContent = 3;
for (int i = 0; i < numberOfContent; i++) {
H2HTestData data = new H2HTestData(NetworkTestUtil.randomString());
data.generateVersionKey();
if (i > 0) {
data.setBasedOnKey(content.get(i - 1).getVersionKey());
}
content.add(data);
p2.put(Number160.createHash(locationKey))
.setData(Number160.createHash(contentKey), new Data(data))
.setVersionKey(data.getVersionKey()).start().awaitUninterruptibly();
}
FutureDigest futureDigest = p1
.digest(Number160.createHash(locationKey))
.from(new Number640(Number160.createHash(locationKey), Number160.ZERO, Number160
.createHash(contentKey), Number160.ZERO))
.to(new Number640(Number160.createHash(locationKey), Number160.ZERO, Number160
.createHash(contentKey), Number160.MAX_VALUE)).start();
futureDigest.awaitUninterruptibly();
assertEquals(numberOfContent, futureDigest.getDigest().keyDigest().size());
for (H2HTestData data : content) {
assertTrue(futureDigest
.getDigest()
.keyDigest()
.containsKey(
new Number640(Number160.createHash(locationKey), Number160.ZERO, Number160
.createHash(contentKey), data.getVersionKey())));
}
p1.shutdown().awaitUninterruptibly();
p2.shutdown().awaitUninterruptibly();
}