Search in sources :

Example 1 with OakRepositoryFixture

use of org.apache.jackrabbit.oak.fixture.OakRepositoryFixture in project jackrabbit-oak by apache.

the class PersistentCacheTest method createRepository.

@Override
protected Repository[] createRepository(RepositoryFixture fixture) throws Exception {
    System.setProperty("PersistentCacheStats.rejectedPut", "true");
    if (fixture instanceof OakRepositoryFixture) {
        OakFixture oakFixture = ((OakRepositoryFixture) fixture).getOakFixture();
        if (oakFixture instanceof OakFixture.MongoFixture) {
            OakFixture.MongoFixture mongoFixture = (OakFixture.MongoFixture) oakFixture;
            DocumentMK.Builder builder = mongoFixture.getBuilder(1);
            builder.setStatisticsProvider(statsProvider);
            builder.setPersistentCache("target/persistentCache,time," + CACHE_OPTIONS);
            dns = builder.getNodeStore();
            nodesCache = DocumentNodeStoreHelper.getNodesCache(dns);
            Oak[] cluster = mongoFixture.setUpCluster(new DocumentMK.Builder[] { builder }, statsProvider);
            return new Repository[] { new Jcr(cluster[0]).createRepository() };
        }
    }
    throw new IllegalArgumentException("Fixture " + fixture + " not supported for this benchmark.");
}
Also used : OakRepositoryFixture(org.apache.jackrabbit.oak.fixture.OakRepositoryFixture) Repository(javax.jcr.Repository) DocumentMK(org.apache.jackrabbit.oak.plugins.document.DocumentMK) OakFixture(org.apache.jackrabbit.oak.fixture.OakFixture) Oak(org.apache.jackrabbit.oak.Oak) Jcr(org.apache.jackrabbit.oak.jcr.Jcr)

Example 2 with OakRepositoryFixture

use of org.apache.jackrabbit.oak.fixture.OakRepositoryFixture in project jackrabbit-oak by apache.

the class ObservationTest method run.

@Override
public void run(Iterable<RepositoryFixture> fixtures) {
    for (RepositoryFixture fixture : fixtures) {
        if (fixture.isAvailable(1)) {
            System.out.format("%s: Observation throughput benchmark%n", fixture);
            try {
                final AtomicReference<Whiteboard> whiteboardRef = new AtomicReference<Whiteboard>();
                Repository[] cluster;
                if (fixture instanceof OakRepositoryFixture) {
                    cluster = ((OakRepositoryFixture) fixture).setUpCluster(1, new JcrCreator() {

                        @Override
                        public Jcr customize(Oak oak) {
                            whiteboardRef.set(oak.getWhiteboard());
                            return new Jcr(oak);
                        }
                    });
                } else {
                    cluster = fixture.setUpCluster(1);
                }
                try {
                    run(cluster[0], whiteboardRef.get());
                } finally {
                    fixture.tearDownCluster();
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}
Also used : Repository(javax.jcr.Repository) OakRepositoryFixture(org.apache.jackrabbit.oak.fixture.OakRepositoryFixture) OakRepositoryFixture(org.apache.jackrabbit.oak.fixture.OakRepositoryFixture) RepositoryFixture(org.apache.jackrabbit.oak.fixture.RepositoryFixture) Oak(org.apache.jackrabbit.oak.Oak) Jcr(org.apache.jackrabbit.oak.jcr.Jcr) AtomicReference(java.util.concurrent.atomic.AtomicReference) JcrCreator(org.apache.jackrabbit.oak.fixture.JcrCreator) Whiteboard(org.apache.jackrabbit.oak.spi.whiteboard.Whiteboard) RepositoryException(javax.jcr.RepositoryException) ExecutionException(java.util.concurrent.ExecutionException)

Example 3 with OakRepositoryFixture

use of org.apache.jackrabbit.oak.fixture.OakRepositoryFixture in project jackrabbit-oak by apache.

the class RevisionGCTest method run.

@Override
public void run(Iterable<RepositoryFixture> fixtures) {
    for (RepositoryFixture fixture : fixtures) {
        if (fixture.isAvailable(1)) {
            System.out.format("%s: RevisionGC benchmark%n", fixture);
            try {
                final AtomicReference<Oak> whiteboardRef = new AtomicReference<Oak>();
                Repository[] cluster;
                if (fixture instanceof OakRepositoryFixture) {
                    cluster = ((OakRepositoryFixture) fixture).setUpCluster(1, new JcrCreator() {

                        @Override
                        public Jcr customize(Oak oak) {
                            whiteboardRef.set(oak);
                            return new Jcr(oak);
                        }
                    });
                } else {
                    System.err.format("%s: RevisionGC benchmark only runs on Oak%n", fixture);
                    return;
                }
                try {
                    run(cluster[0], getNodeStore(whiteboardRef.get()));
                } finally {
                    fixture.tearDownCluster();
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}
Also used : Repository(javax.jcr.Repository) OakRepositoryFixture(org.apache.jackrabbit.oak.fixture.OakRepositoryFixture) OakRepositoryFixture(org.apache.jackrabbit.oak.fixture.OakRepositoryFixture) RepositoryFixture(org.apache.jackrabbit.oak.fixture.RepositoryFixture) Oak(org.apache.jackrabbit.oak.Oak) Jcr(org.apache.jackrabbit.oak.jcr.Jcr) AtomicReference(java.util.concurrent.atomic.AtomicReference) JcrCreator(org.apache.jackrabbit.oak.fixture.JcrCreator) RepositoryException(javax.jcr.RepositoryException)

Aggregations

Repository (javax.jcr.Repository)3 Oak (org.apache.jackrabbit.oak.Oak)3 OakRepositoryFixture (org.apache.jackrabbit.oak.fixture.OakRepositoryFixture)3 Jcr (org.apache.jackrabbit.oak.jcr.Jcr)3 AtomicReference (java.util.concurrent.atomic.AtomicReference)2 RepositoryException (javax.jcr.RepositoryException)2 JcrCreator (org.apache.jackrabbit.oak.fixture.JcrCreator)2 RepositoryFixture (org.apache.jackrabbit.oak.fixture.RepositoryFixture)2 ExecutionException (java.util.concurrent.ExecutionException)1 OakFixture (org.apache.jackrabbit.oak.fixture.OakFixture)1 DocumentMK (org.apache.jackrabbit.oak.plugins.document.DocumentMK)1 Whiteboard (org.apache.jackrabbit.oak.spi.whiteboard.Whiteboard)1