use of org.apache.jackrabbit.oak.spi.commit.EditorProvider in project jackrabbit-oak by apache.
the class PrivateStoreValidatorProviderTest method testValidatorServiceRegistered.
@Test
public void testValidatorServiceRegistered() {
// test service registration, there should be a service for the PrivateStoreValidatorProvider
MountInfoProvider mountInfoProvider = createMountInfoProvider("/content/readonly");
context.registerService(MountInfoProvider.class, mountInfoProvider);
registerValidatorProvider(privateStoreValidatorProvider, true);
EditorProvider validator = context.getService(EditorProvider.class);
assertNotNull("No PrivateStoreValidatorProvider available!", validator);
assertTrue(validator instanceof PrivateStoreValidatorProvider);
assertTrue(((PrivateStoreValidatorProvider) validator).isFailOnDetection());
MockOsgi.deactivate(privateStoreValidatorProvider, context.bundleContext());
assertNull(context.getService(EditorProvider.class));
}
use of org.apache.jackrabbit.oak.spi.commit.EditorProvider in project jackrabbit-oak by apache.
the class VersionHook method processCommit.
@Nonnull
@Override
public NodeState processCommit(NodeState before, NodeState after, CommitInfo info) throws CommitFailedException {
Set<String> existingVersionables = newHashSet();
List<EditorProvider> providers = newArrayList();
providers.add(new VersionEditorProvider());
providers.add(new VersionableCollector.Provider(existingVersionables));
providers.add(new OrphanedVersionCleaner.Provider(existingVersionables));
return compose(transform(providers, new Function<EditorProvider, CommitHook>() {
@Nullable
@Override
public CommitHook apply(@Nullable EditorProvider input) {
return new EditorHook(input);
}
})).processCommit(before, after, info);
}
use of org.apache.jackrabbit.oak.spi.commit.EditorProvider in project jackrabbit-oak by apache.
the class DocumentBundlingTest method recreatedBundledNode2.
@Test
public void recreatedBundledNode2() throws Exception {
NodeBuilder builder = store.getRoot().builder();
NodeBuilder fileNode = newNode("nt:file");
fileNode.child("jcr:content").setProperty("jcr:data", "foo");
builder.child("test").setChildNode("book.jpg", fileNode.getNodeState());
merge(builder);
builder = store.getRoot().builder();
builder.child("a");
//In this case we recreate the node in CommitHook
store.merge(builder, new EditorHook(new EditorProvider() {
@Override
public Editor getRootEditor(NodeState before, NodeState after, NodeBuilder builder, CommitInfo info) throws CommitFailedException {
return new BookRecreatingEditor(builder);
}
}), CommitInfo.EMPTY);
}
use of org.apache.jackrabbit.oak.spi.commit.EditorProvider in project jackrabbit-oak by apache.
the class PrivateStoreValidatorProviderTest method testValidatorServiceNotRegistered.
@Test
public void testValidatorServiceNotRegistered() {
// test service registration, for default mount there should be no service for the validator provider
MountInfoProvider mountInfoProvider = createMountInfoProvider();
context.registerService(MountInfoProvider.class, mountInfoProvider);
registerValidatorProvider(privateStoreValidatorProvider, true);
EditorProvider validator = context.getService(EditorProvider.class);
assertNull("No PrivateStoreValidatorProvider should be registered for default mounts!", validator);
}
Aggregations