Search in sources :

Example 16 with ContentRepository

use of org.apache.jackrabbit.oak.api.ContentRepository in project jackrabbit-oak by apache.

the class AtomicCounterIT method setup.

@Before
public void setup() throws Exception {
    DocumentNodeStore ns = builderProvider.newBuilder().getNodeStore();
    NodeBuilder builder = ns.getRoot().builder();
    NodeBuilder index = builder.child(INDEX_DEFINITIONS_NAME);
    NodeBuilder lucene = newLuceneIndexDefinition(index, "lucene", ImmutableSet.of("String"), null, "async");
    lucene.setProperty("async", of("async", "nrt"), STRINGS);
    IndexDefinition.updateDefinition(index.child("lucene"));
    ns.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
    LuceneIndexEditorProvider editorProvider = new LuceneIndexEditorProvider();
    editorProvider.setIndexingQueue(mock(DocumentQueue.class));
    LuceneIndexProvider provider = new LuceneIndexProvider();
    ContentRepository repository = new Oak(ns).with(// Clusterable
    ns).with(new OpenSecurityProvider()).with((QueryIndexProvider) provider).with((Observer) provider).with(editorProvider).with(executorService).withAtomicCounter().withAsyncIndexing("async", 1).withFailOnMissingIndexProvider().createContentRepository();
    session = repository.login(new SimpleCredentials("admin", "admin".toCharArray()), null);
    while (isReindexing(session)) {
        Thread.sleep(100);
    }
}
Also used : SimpleCredentials(javax.jcr.SimpleCredentials) LuceneIndexEditorProvider(org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexEditorProvider) ContentRepository(org.apache.jackrabbit.oak.api.ContentRepository) Oak(org.apache.jackrabbit.oak.Oak) DocumentNodeStore(org.apache.jackrabbit.oak.plugins.document.DocumentNodeStore) DocumentQueue(org.apache.jackrabbit.oak.plugins.index.lucene.hybrid.DocumentQueue) OpenSecurityProvider(org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider) LuceneIndexProvider(org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexProvider) NodeBuilder(org.apache.jackrabbit.oak.spi.state.NodeBuilder) QueryIndexProvider(org.apache.jackrabbit.oak.spi.query.QueryIndexProvider) Before(org.junit.Before)

Example 17 with ContentRepository

use of org.apache.jackrabbit.oak.api.ContentRepository in project jackrabbit-oak by apache.

the class ContentRemoteRepositoryTest method testUnsuccessfulLoginWithBasicCredentials.

@Test(expected = RemoteLoginException.class)
public void testUnsuccessfulLoginWithBasicCredentials() throws Exception {
    ContentRepository repository = mock(ContentRepository.class);
    when(repository.login(any(Credentials.class), anyString())).thenThrow(LoginException.class);
    ContentRemoteRepository remoteRepository = createRepository(repository);
    remoteRepository.login(remoteRepository.createBasicCredentials("admin", "admin".toCharArray()));
}
Also used : ContentRepository(org.apache.jackrabbit.oak.api.ContentRepository) RemoteCredentials(org.apache.jackrabbit.oak.remote.RemoteCredentials) Credentials(javax.jcr.Credentials) Test(org.junit.Test)

Aggregations

ContentRepository (org.apache.jackrabbit.oak.api.ContentRepository)17 Test (org.junit.Test)13 OpenSecurityProvider (org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider)11 Oak (org.apache.jackrabbit.oak.Oak)8 Closeable (java.io.Closeable)5 AbstractSecurityTest (org.apache.jackrabbit.oak.AbstractSecurityTest)5 ContentSession (org.apache.jackrabbit.oak.api.ContentSession)5 Root (org.apache.jackrabbit.oak.api.Root)5 InitialContent (org.apache.jackrabbit.oak.InitialContent)4 PropertyIndexEditorProvider (org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexEditorProvider)3 TypeEditorProvider (org.apache.jackrabbit.oak.plugins.nodetype.TypeEditorProvider)3 DefaultWhiteboard (org.apache.jackrabbit.oak.spi.whiteboard.DefaultWhiteboard)3 HashMap (java.util.HashMap)2 Credentials (javax.jcr.Credentials)2 SimpleCredentials (javax.jcr.SimpleCredentials)2 LoginException (javax.security.auth.login.LoginException)2 Authorizable (org.apache.jackrabbit.api.security.user.Authorizable)2 UserManager (org.apache.jackrabbit.api.security.user.UserManager)2 Tree (org.apache.jackrabbit.oak.api.Tree)2 PropertyIndexProvider (org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexProvider)2