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);
}
}
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()));
}
Aggregations