use of org.apache.jackrabbit.oak.fixture.NodeStoreFixture in project jackrabbit-oak by apache.
the class RandomOpCompare method getMongo.
private static NodeStoreFixture getMongo() {
return new NodeStoreFixture() {
@Override
public NodeStore createNodeStore() {
MongoConnection connection;
try {
connection = new MongoConnection("mongodb://localhost:27017/oak");
} catch (Exception e) {
throw new RuntimeException(e);
}
DB mongoDB = connection.getDB();
return new DocumentMK.Builder().memoryCacheSize(0).setMongoDB(mongoDB, 16).setPersistentCache("target/persistentCache,time").getNodeStore();
}
@Override
public NodeStore createNodeStore(int clusterNodeId) {
return null;
}
@Override
public void dispose(NodeStore nodeStore) {
if (nodeStore instanceof Closeable) {
try {
((Closeable) nodeStore).close();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
};
}
use of org.apache.jackrabbit.oak.fixture.NodeStoreFixture in project jackrabbit-oak by apache.
the class NodeStoreFixtures method asJunitParameters.
public static Collection<Object[]> asJunitParameters(Set<FixturesHelper.Fixture> fixtures) {
List<NodeStoreFixture> configuredFixtures = new ArrayList<NodeStoreFixture>();
if (fixtures.contains(FixturesHelper.Fixture.DOCUMENT_NS)) {
configuredFixtures.add(DOCUMENT_NS);
}
if (fixtures.contains(FixturesHelper.Fixture.MEMORY_NS)) {
configuredFixtures.add(MEMORY_NS);
}
if (fixtures.contains(FixturesHelper.Fixture.DOCUMENT_RDB)) {
configuredFixtures.add(DOCUMENT_RDB);
}
if (fixtures.contains(FixturesHelper.Fixture.DOCUMENT_MEM)) {
configuredFixtures.add(DOCUMENT_MEM);
}
if (fixtures.contains(FixturesHelper.Fixture.SEGMENT_TAR)) {
configuredFixtures.add(SEGMENT_TAR);
}
if (fixtures.contains(FixturesHelper.Fixture.COMPOSITE_SEGMENT)) {
configuredFixtures.add(COMPOSITE_SEGMENT);
}
if (fixtures.contains(FixturesHelper.Fixture.COMPOSITE_MEM)) {
configuredFixtures.add(COMPOSITE_MEM);
}
Collection<Object[]> result = new ArrayList<Object[]>();
for (NodeStoreFixture f : configuredFixtures) {
if (f.isAvailable()) {
result.add(new Object[] { f });
}
}
return result;
}
use of org.apache.jackrabbit.oak.fixture.NodeStoreFixture in project jackrabbit-oak by apache.
the class ValidNamesTest method createRepository.
private Repository createRepository(NodeStoreFixture fixture) throws RepositoryException {
NodeStore ns = null;
for (Map.Entry<NodeStoreFixture, NodeStore> e : STORES.entrySet()) {
if (e.getKey().getClass().equals(fixture.getClass())) {
ns = e.getValue();
}
}
if (ns == null) {
ns = createNodeStore(fixture);
STORES.put(fixture, ns);
}
return createRepository(ns);
}
Aggregations