Search in sources :

Example 21 with DefaultWhiteboard

use of org.apache.jackrabbit.oak.spi.whiteboard.DefaultWhiteboard in project jackrabbit-oak by apache.

the class RefreshOnGCTest method setup.

@Before
public void setup() throws Exception {
    File directory = createTempFile(getClass().getSimpleName(), "test", new File("target"));
    directory.delete();
    directory.mkdir();
    Whiteboard whiteboard = new DefaultWhiteboard();
    gcMonitor = new GCMonitorTracker();
    gcMonitor.start(whiteboard);
    Oak oak = new Oak(createSegmentTarStore(directory, gcMonitor));
    oak.with(whiteboard);
    repository = new Jcr(oak).createRepository();
}
Also used : GCMonitorTracker(org.apache.jackrabbit.oak.spi.gc.GCMonitorTracker) DefaultWhiteboard(org.apache.jackrabbit.oak.spi.whiteboard.DefaultWhiteboard) Oak(org.apache.jackrabbit.oak.Oak) File.createTempFile(java.io.File.createTempFile) File(java.io.File) DefaultWhiteboard(org.apache.jackrabbit.oak.spi.whiteboard.DefaultWhiteboard) Whiteboard(org.apache.jackrabbit.oak.spi.whiteboard.Whiteboard) Before(org.junit.Before)

Example 22 with DefaultWhiteboard

use of org.apache.jackrabbit.oak.spi.whiteboard.DefaultWhiteboard in project jackrabbit-oak by apache.

the class AbstractBinaryAccessIT method createRepository.

/**
 * Adjust JCR repository creation to register BlobAccessProvider (BlobStore) in Whiteboard
 * so it can be picked up by oak-jcr.
 */
@Override
protected Repository createRepository(NodeStore nodeStore) {
    Whiteboard wb = new DefaultWhiteboard();
    BlobStore blobStore = getNodeStoreComponent(BlobStore.class);
    if (blobStore != null && blobStore instanceof BlobAccessProvider) {
        wb.register(BlobAccessProvider.class, (BlobAccessProvider) blobStore, Collections.emptyMap());
    }
    return initJcr(new Jcr(nodeStore).with(wb)).createRepository();
}
Also used : BlobAccessProvider(org.apache.jackrabbit.oak.api.blob.BlobAccessProvider) DefaultWhiteboard(org.apache.jackrabbit.oak.spi.whiteboard.DefaultWhiteboard) Jcr(org.apache.jackrabbit.oak.jcr.Jcr) DefaultWhiteboard(org.apache.jackrabbit.oak.spi.whiteboard.DefaultWhiteboard) Whiteboard(org.apache.jackrabbit.oak.spi.whiteboard.Whiteboard) BlobStore(org.apache.jackrabbit.oak.spi.blob.BlobStore)

Example 23 with DefaultWhiteboard

use of org.apache.jackrabbit.oak.spi.whiteboard.DefaultWhiteboard in project jackrabbit-oak by apache.

the class BinaryAccessUnsupportedIT method createRepository.

@Override
protected Repository createRepository(NodeStore nodeStore) {
    Whiteboard wb = new DefaultWhiteboard();
    BlobStore blobStore = getNodeStoreComponent(BlobStore.class);
    if (blobStore != null && blobStore instanceof BlobAccessProvider) {
        wb.register(BlobAccessProvider.class, (BlobAccessProvider) blobStore, Collections.emptyMap());
    }
    return initJcr(new Jcr(nodeStore).with(wb)).createRepository();
}
Also used : BlobAccessProvider(org.apache.jackrabbit.oak.api.blob.BlobAccessProvider) DefaultWhiteboard(org.apache.jackrabbit.oak.spi.whiteboard.DefaultWhiteboard) Jcr(org.apache.jackrabbit.oak.jcr.Jcr) Whiteboard(org.apache.jackrabbit.oak.spi.whiteboard.Whiteboard) DefaultWhiteboard(org.apache.jackrabbit.oak.spi.whiteboard.DefaultWhiteboard) BlobStore(org.apache.jackrabbit.oak.spi.blob.BlobStore)

Example 24 with DefaultWhiteboard

use of org.apache.jackrabbit.oak.spi.whiteboard.DefaultWhiteboard in project jackrabbit-oak by apache.

the class AbstractDelegatorTest method mockSessionDelegate.

@NotNull
static SessionDelegate mockSessionDelegate(@NotNull Root root, @NotNull PermissionProvider pp) {
    ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor();
    Whiteboard wb = new DefaultWhiteboard();
    StatisticManager statisticManager = new StatisticManager(wb, executorService);
    return spy(new SessionDelegate(mockContentSession(root), mockSecurityProvider(root, pp), RefreshStrategy.Composite.create(), new ThreadLocal<>(), statisticManager, new Clock.Virtual()));
}
Also used : ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) DefaultWhiteboard(org.apache.jackrabbit.oak.spi.whiteboard.DefaultWhiteboard) StatisticManager(org.apache.jackrabbit.oak.stats.StatisticManager) Whiteboard(org.apache.jackrabbit.oak.spi.whiteboard.Whiteboard) DefaultWhiteboard(org.apache.jackrabbit.oak.spi.whiteboard.DefaultWhiteboard) NotNull(org.jetbrains.annotations.NotNull)

Example 25 with DefaultWhiteboard

use of org.apache.jackrabbit.oak.spi.whiteboard.DefaultWhiteboard in project jackrabbit-oak by apache.

the class ActiveDeletedBlobDisabledTest method test.

private void test(final boolean disabled) {
    String property = "oak.active.deletion.disabled";
    try {
        System.setProperty(property, "" + disabled);
        NodeStore store = null;
        IndexPathService indexPathService = null;
        AsyncIndexInfoService asyncIndexInfoService = null;
        Executor executor = new Executor() {

            @Override
            public void execute(Runnable command) {
                command.run();
            }
        };
        ActiveDeletedBlobCollectorMBeanImpl b = new ActiveDeletedBlobCollectorMBeanImpl(ActiveDeletedBlobCollectorFactory.NOOP, new DefaultWhiteboard(), store, indexPathService, asyncIndexInfoService, new MemoryBlobStore(), executor);
        b.isActiveDeletionUnsafe();
        b.isDisabled();
        CompositeData d = b.startActiveCollection();
        if (disabled) {
            // none
            assertEquals(1, d.get("code"));
            assertEquals("Active deletion is disabled", d.get("message"));
        } else {
            // failed
            assertEquals(5, d.get("code"));
            assertEquals("Active lucene index blobs collection couldn't be run as a safe timestamp for purging lucene index blobs couldn't be evaluated", d.get("message"));
        }
    } finally {
        System.clearProperty(property);
    }
}
Also used : IndexPathService(org.apache.jackrabbit.oak.plugins.index.IndexPathService) NodeStore(org.apache.jackrabbit.oak.spi.state.NodeStore) Executor(java.util.concurrent.Executor) AsyncIndexInfoService(org.apache.jackrabbit.oak.plugins.index.AsyncIndexInfoService) DefaultWhiteboard(org.apache.jackrabbit.oak.spi.whiteboard.DefaultWhiteboard) CompositeData(javax.management.openmbean.CompositeData) ActiveDeletedBlobCollectorMBeanImpl(org.apache.jackrabbit.oak.plugins.index.lucene.ActiveDeletedBlobCollectorMBeanImpl) MemoryBlobStore(org.apache.jackrabbit.oak.spi.blob.MemoryBlobStore)

Aggregations

DefaultWhiteboard (org.apache.jackrabbit.oak.spi.whiteboard.DefaultWhiteboard)26 Whiteboard (org.apache.jackrabbit.oak.spi.whiteboard.Whiteboard)21 Test (org.junit.Test)16 Before (org.junit.Before)5 OpenSecurityProvider (org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider)4 NodeBuilder (org.apache.jackrabbit.oak.spi.state.NodeBuilder)4 Map (java.util.Map)3 AtomicReference (java.util.concurrent.atomic.AtomicReference)3 Oak (org.apache.jackrabbit.oak.Oak)3 ContentRepository (org.apache.jackrabbit.oak.api.ContentRepository)3 Jcr (org.apache.jackrabbit.oak.jcr.Jcr)3 MemoryNodeStore (org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore)3 EditorHook (org.apache.jackrabbit.oak.spi.commit.EditorHook)3 NodeStore (org.apache.jackrabbit.oak.spi.state.NodeStore)3 Closeable (java.io.Closeable)2 Repository (javax.jcr.Repository)2 ContentSession (org.apache.jackrabbit.oak.api.ContentSession)2 PropertyState (org.apache.jackrabbit.oak.api.PropertyState)2 BlobAccessProvider (org.apache.jackrabbit.oak.api.blob.BlobAccessProvider)2 RepositoryImpl (org.apache.jackrabbit.oak.jcr.repository.RepositoryImpl)2