use of org.apache.jackrabbit.oak.fixture.DocumentMongoFixture in project jackrabbit-oak by apache.
the class ReferenceBinaryIT method fixtures.
@Parameterized.Parameters(name = "{0}")
public static Collection<Object[]> fixtures() throws Exception {
File file = getTestDir("tar");
FileStore fileStore = FileStoreBuilder.fileStoreBuilder(file).withBlobStore(createBlobStore()).withMaxFileSize(256).withMemoryMapping(true).build();
SegmentNodeStore sns = SegmentNodeStoreBuilders.builder(fileStore).build();
List<Object[]> fixtures = Lists.newArrayList();
SegmentTarFixture segmentTarFixture = new SegmentTarFixture(sns);
if (segmentTarFixture.isAvailable()) {
fixtures.add(new Object[] { segmentTarFixture });
}
FileBlobStore fbs = new FileBlobStore(getTestDir("fbs1").getAbsolutePath());
fbs.setReferenceKeyPlainText("foobar");
FileStore fileStoreWithFBS = FileStoreBuilder.fileStoreBuilder(getTestDir("tar2")).withBlobStore(fbs).withMaxFileSize(256).withMemoryMapping(true).build();
SegmentNodeStore snsWithFBS = SegmentNodeStoreBuilders.builder(fileStoreWithFBS).build();
SegmentTarFixture segmentTarFixtureFBS = new SegmentTarFixture(snsWithFBS);
if (segmentTarFixtureFBS.isAvailable()) {
fixtures.add(new Object[] { segmentTarFixtureFBS });
}
DocumentMongoFixture documentFixture = new DocumentMongoFixture(MongoUtils.URL, createBlobStore());
if (documentFixture.isAvailable()) {
fixtures.add(new Object[] { documentFixture });
}
return fixtures;
}
use of org.apache.jackrabbit.oak.fixture.DocumentMongoFixture in project jackrabbit-oak by apache.
the class LargeOperationIT method fixtures.
@Parameterized.Parameters
public static Collection<Object[]> fixtures() throws Exception {
List<Object[]> fixtures = Lists.newArrayList();
SegmentTarFixture segmentFixture = new SegmentTarFixture();
if (segmentFixture.isAvailable()) {
fixtures.add(new Object[] { segmentFixture, SEGMENT_SCALES });
}
DocumentMongoFixture documentFixture = new DocumentMongoFixture();
if (documentFixture.isAvailable()) {
fixtures.add(new Object[] { documentFixture, MONGO_SCALES });
}
return fixtures;
}
use of org.apache.jackrabbit.oak.fixture.DocumentMongoFixture in project jackrabbit-oak by apache.
the class NonLocalObservationIT method getFixture.
@Override
protected NodeStoreFixture getFixture() {
/**
* Fixes the cluster use case plus allowing to control the cache sizes.
* In theory other users of DocumentMongoFixture might have similar
* test cases - but keeping it simple for now - thus going via subclass.
*/
return new DocumentMongoFixture() {
private String dbName = System.currentTimeMillis() + "-NonLocalObservationIT";
/**
* keep a reference to the node stores so that the db only gets closed after the last nodeStore was closed
*/
private Set<NodeStore> nodeStores = new HashSet<NodeStore>();
/**
* This is not implemented in the super class at all.
* <ul>
* <li>use a specific suffix to make sure we have our own, new db and clean it up after the test</li>
* <li>properly drop that db created above in dispose</li>
* <li>use only 32MB (vs default of 256MB) memory to ensure we're not going OOM just because of this (which happens with the default)</li>
* <li>disable the persistent cache for the same reason</li>
* </ul>
*/
@Override
public NodeStore createNodeStore(int clusterNodeId) {
try {
DocumentMK.Builder builder = new DocumentMK.Builder();
// keep this one low to avoid OOME
builder.memoryCacheSize(32 * 1024 * 1024);
// turn this one off to avoid OOME
builder.setPersistentCache(null);
builder.setMongoDB(createClient(), dbName);
DocumentNodeStore ns = builder.getNodeStore();
nodeStores.add(ns);
return ns;
} catch (Exception e) {
throw new AssumptionViolatedException("Mongo instance is not available", e);
}
}
@Override
public void dispose(NodeStore nodeStore) {
super.dispose(nodeStore);
nodeStores.remove(nodeStore);
if (nodeStores.size() == 0) {
try (MongoClient c = createClient()) {
c.dropDatabase(dbName);
} catch (Exception e) {
log.error("dispose: Can't close Mongo", e);
}
}
}
@Override
public String toString() {
return "NonLocalObservationIT's DocumentMongoFixture flavour";
}
};
}
Aggregations