@Override
public Repository[] setUpCluster(int n) throws Exception {
Repository[] cluster = new Repository[n];
kernels = new MongoMK[cluster.length];
for (int i = 0; i < cluster.length; i++) {
MongoConnection mongo =
new MongoConnection(host, port, unique);
kernels[i] = new MongoMK.Builder().
setMongoDB(mongo.getDB()).
setClusterId(i).open();
Oak oak = new Oak(new KernelNodeStore(kernels[i], cacheSize));
cluster[i] = new Jcr(oak).createRepository();
}
return cluster;
}
@Override
public void tearDownCluster() {
for (MongoMK kernel : kernels) {
kernel.dispose();
}
try {
MongoConnection mongo =
new MongoConnection(host, port, unique);
mongo.getDB().dropDatabase();
mongo.close();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
};