Search in sources :

Example 46 with OpenSecurityProvider

use of org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider in project jackrabbit-oak by apache.

the class SecurityProviderCallbackTest method testCallback.

@Test
public void testCallback() {
    SecurityProviderCallback cb = new SecurityProviderCallback();
    SecurityProvider sp = new OpenSecurityProvider();
    cb.setSecurityProvider(sp);
    assertSame(sp, cb.getSecurityProvider());
}
Also used : OpenSecurityProvider(org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider) SecurityProvider(org.apache.jackrabbit.oak.spi.security.SecurityProvider) OpenSecurityProvider(org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider) Test(org.junit.Test)

Example 47 with OpenSecurityProvider

use of org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider in project jackrabbit-oak by apache.

the class AbstractLoginModuleTest method testGetSecurityProvider.

@Test
public void testGetSecurityProvider() {
    AbstractLoginModule loginModule = initLoginModule(TestCredentials.class, new TestCallbackHandler(null, new OpenSecurityProvider(), null));
    SecurityProvider securityProvider = loginModule.getSecurityProvider();
    assertNotNull(securityProvider);
    // securityProvider is stored as field -> second access returns the same object
    assertSame(securityProvider, loginModule.getSecurityProvider());
}
Also used : SecurityProvider(org.apache.jackrabbit.oak.spi.security.SecurityProvider) OpenSecurityProvider(org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider) OpenSecurityProvider(org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider) Test(org.junit.Test)

Example 48 with OpenSecurityProvider

use of org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider in project jackrabbit-oak by apache.

the class MountsNodeCounterTest method createRepository.

protected ContentRepository createRepository() {
    Mounts.Builder builder = Mounts.newBuilder();
    builder.mount("libs", false, Arrays.asList("/var/fragments"), Arrays.asList("/apps", "/libs", "/nested/mount"));
    mip = builder.build();
    nodeStore = new MemoryNodeStore();
    Oak oak = new Oak(nodeStore).with(new InitialContent()).with(new OpenSecurityProvider()).with(new PropertyIndexEditorProvider().with(mip)).with(new NodeCounterEditorProvider().with(mip)).withAsyncIndexing("async", TimeUnit.DAYS.toSeconds(1));
    wb = oak.getWhiteboard();
    return oak.createContentRepository();
}
Also used : InitialContent(org.apache.jackrabbit.oak.InitialContent) Mounts(org.apache.jackrabbit.oak.spi.mount.Mounts) MemoryNodeStore(org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore) Oak(org.apache.jackrabbit.oak.Oak) OpenSecurityProvider(org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider) PropertyIndexEditorProvider(org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexEditorProvider)

Example 49 with OpenSecurityProvider

use of org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider in project jackrabbit-oak by apache.

the class DefaultThreeWayConflictHandlerOursTest method setUp.

@Before
public void setUp() throws CommitFailedException {
    ContentSession session = new Oak().with(new OpenSecurityProvider()).with(DefaultThreeWayConflictHandler.OURS).createContentSession();
    // Add test content
    Root root = session.getLatestRoot();
    Tree tree = root.getTree("/");
    tree.setProperty("a", 1);
    tree.setProperty("b", 2);
    tree.setProperty("c", 3);
    tree.addChild("x");
    tree.addChild("y");
    tree.addChild("z");
    root.commit();
    ourRoot = session.getLatestRoot();
    theirRoot = session.getLatestRoot();
}
Also used : Root(org.apache.jackrabbit.oak.api.Root) Oak(org.apache.jackrabbit.oak.Oak) ContentSession(org.apache.jackrabbit.oak.api.ContentSession) Tree(org.apache.jackrabbit.oak.api.Tree) OpenSecurityProvider(org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider) Before(org.junit.Before)

Example 50 with OpenSecurityProvider

use of org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider in project jackrabbit-oak by apache.

the class OakTest method checkExecutorShutdown.

@Test
public void checkExecutorShutdown() throws Exception {
    Runnable runnable = new Runnable() {

        @Override
        public void run() {
        }
    };
    Oak oak = new Oak().with(new OpenSecurityProvider());
    ContentRepository repo = oak.createContentRepository();
    WhiteboardUtils.scheduleWithFixedDelay(oak.getWhiteboard(), runnable, 1);
    ((Closeable) repo).close();
    try {
        WhiteboardUtils.scheduleWithFixedDelay(oak.getWhiteboard(), runnable, 1);
        fail("Executor should have rejected the task");
    } catch (RejectedExecutionException ignore) {
    }
    // Externally passed executor should not be shutdown upon repository close
    ScheduledExecutorService externalExecutor = Executors.newSingleThreadScheduledExecutor();
    Oak oak2 = new Oak().with(new OpenSecurityProvider()).with(externalExecutor);
    ContentRepository repo2 = oak2.createContentRepository();
    WhiteboardUtils.scheduleWithFixedDelay(oak2.getWhiteboard(), runnable, 1);
    ((Closeable) repo2).close();
    WhiteboardUtils.scheduleWithFixedDelay(oak2.getWhiteboard(), runnable, 1);
    externalExecutor.shutdown();
}
Also used : ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) Closeable(java.io.Closeable) ContentRepository(org.apache.jackrabbit.oak.api.ContentRepository) OpenSecurityProvider(org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider) RejectedExecutionException(java.util.concurrent.RejectedExecutionException) Test(org.junit.Test)

Aggregations

OpenSecurityProvider (org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider)51 Oak (org.apache.jackrabbit.oak.Oak)38 InitialContent (org.apache.jackrabbit.oak.InitialContent)25 Test (org.junit.Test)19 Root (org.apache.jackrabbit.oak.api.Root)16 Tree (org.apache.jackrabbit.oak.api.Tree)14 PropertyIndexEditorProvider (org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexEditorProvider)14 ContentRepository (org.apache.jackrabbit.oak.api.ContentRepository)12 MemoryNodeStore (org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore)11 Before (org.junit.Before)11 IOException (java.io.IOException)8 NodeTypeIndexProvider (org.apache.jackrabbit.oak.plugins.index.nodetype.NodeTypeIndexProvider)8 QueryIndexProvider (org.apache.jackrabbit.oak.spi.query.QueryIndexProvider)8 ContentSession (org.apache.jackrabbit.oak.api.ContentSession)7 Nonnull (javax.annotation.Nonnull)6 Closeable (java.io.Closeable)5 LuceneIndexEditorProvider (org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexEditorProvider)5 LuceneIndexProvider (org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexProvider)5 Observer (org.apache.jackrabbit.oak.spi.commit.Observer)5 CommitFailedException (org.apache.jackrabbit.oak.api.CommitFailedException)4