Search in sources :

Example 1 with NodeStoreFixture

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);
                }
            }
        }
    };
}
Also used : NodeStore(org.apache.jackrabbit.oak.spi.state.NodeStore) NodeStoreFixture(org.apache.jackrabbit.oak.fixture.NodeStoreFixture) Closeable(java.io.Closeable) IOException(java.io.IOException) MongoConnection(org.apache.jackrabbit.oak.plugins.document.util.MongoConnection) IOException(java.io.IOException) RepositoryException(javax.jcr.RepositoryException) DB(com.mongodb.DB)

Example 2 with NodeStoreFixture

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;
}
Also used : NodeStoreFixture(org.apache.jackrabbit.oak.fixture.NodeStoreFixture) ArrayList(java.util.ArrayList)

Example 3 with NodeStoreFixture

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);
}
Also used : NodeStore(org.apache.jackrabbit.oak.spi.state.NodeStore) NodeStoreFixture(org.apache.jackrabbit.oak.fixture.NodeStoreFixture) Map(java.util.Map)

Aggregations

NodeStoreFixture (org.apache.jackrabbit.oak.fixture.NodeStoreFixture)3 NodeStore (org.apache.jackrabbit.oak.spi.state.NodeStore)2 DB (com.mongodb.DB)1 Closeable (java.io.Closeable)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 RepositoryException (javax.jcr.RepositoryException)1 MongoConnection (org.apache.jackrabbit.oak.plugins.document.util.MongoConnection)1