Search in sources :

Example 6 with ReferenceEditorProvider

use of org.apache.jackrabbit.oak.plugins.index.reference.ReferenceEditorProvider in project jackrabbit-oak by apache.

the class OakTest method checkMissingStrategySetting.

@Test(expected = CommitFailedException.class)
public void checkMissingStrategySetting() throws Exception {
    Whiteboard wb = new DefaultWhiteboard();
    WhiteboardIndexEditorProvider wbProvider = new WhiteboardIndexEditorProvider();
    wbProvider.start(wb);
    Registration r1 = wb.register(IndexEditorProvider.class, new PropertyIndexEditorProvider(), null);
    Registration r2 = wb.register(IndexEditorProvider.class, new ReferenceEditorProvider(), null);
    Oak oak = new Oak().with(new OpenSecurityProvider()).with(new InitialContent()).with(wb).with(wbProvider).withFailOnMissingIndexProvider();
    ContentRepository repo = oak.createContentRepository();
    ContentSession cs = repo.login(null, null);
    Root root = cs.getLatestRoot();
    Tree t = root.getTree("/");
    t.setProperty("foo", "u1", Type.REFERENCE);
    r1.unregister();
    root.commit();
    cs.close();
    ((Closeable) repo).close();
}
Also used : Root(org.apache.jackrabbit.oak.api.Root) DefaultWhiteboard(org.apache.jackrabbit.oak.spi.whiteboard.DefaultWhiteboard) Closeable(java.io.Closeable) PropertyIndexEditorProvider(org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexEditorProvider) OpenSecurityProvider(org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider) WhiteboardIndexEditorProvider(org.apache.jackrabbit.oak.plugins.index.WhiteboardIndexEditorProvider) ReferenceEditorProvider(org.apache.jackrabbit.oak.plugins.index.reference.ReferenceEditorProvider) Registration(org.apache.jackrabbit.oak.spi.whiteboard.Registration) ContentRepository(org.apache.jackrabbit.oak.api.ContentRepository) ContentSession(org.apache.jackrabbit.oak.api.ContentSession) Tree(org.apache.jackrabbit.oak.api.Tree) Whiteboard(org.apache.jackrabbit.oak.spi.whiteboard.Whiteboard) DefaultWhiteboard(org.apache.jackrabbit.oak.spi.whiteboard.DefaultWhiteboard) Test(org.junit.Test)

Aggregations

PropertyIndexEditorProvider (org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexEditorProvider)6 ReferenceEditorProvider (org.apache.jackrabbit.oak.plugins.index.reference.ReferenceEditorProvider)6 Before (org.junit.Before)3 PropertyIndexProvider (org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexProvider)2 ReferenceIndexProvider (org.apache.jackrabbit.oak.plugins.index.reference.ReferenceIndexProvider)2 TypeEditorProvider (org.apache.jackrabbit.oak.plugins.nodetype.TypeEditorProvider)2 EditorHook (org.apache.jackrabbit.oak.spi.commit.EditorHook)2 OpenSecurityProvider (org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider)2 Test (org.junit.Test)2 Closeable (java.io.Closeable)1 InitialContent (org.apache.jackrabbit.oak.InitialContent)1 Oak (org.apache.jackrabbit.oak.Oak)1 ContentRepository (org.apache.jackrabbit.oak.api.ContentRepository)1 ContentSession (org.apache.jackrabbit.oak.api.ContentSession)1 Root (org.apache.jackrabbit.oak.api.Root)1 Tree (org.apache.jackrabbit.oak.api.Tree)1 LogCustomizer (org.apache.jackrabbit.oak.commons.junit.LogCustomizer)1 ConflictValidatorProvider (org.apache.jackrabbit.oak.plugins.commit.ConflictValidatorProvider)1 DocumentMK (org.apache.jackrabbit.oak.plugins.document.DocumentMK)1 MemoryDocumentStore (org.apache.jackrabbit.oak.plugins.document.memory.MemoryDocumentStore)1