use of org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider in project jackrabbit-oak by apache.
the class UniquePropertyTest method testUniqueness.
@Test
public void testUniqueness() throws Exception {
Root root = new Oak().with(new OpenSecurityProvider()).with(new PropertyIndexEditorProvider()).with(new InitialContent()).createRoot();
NodeUtil node = new NodeUtil(root.getTree("/"));
String uuid = UUID.randomUUID().toString();
node.setString(JcrConstants.JCR_UUID, uuid);
root.commit();
NodeUtil child = new NodeUtil(root.getTree("/")).addChild("another", "rep:User");
child.setString(JcrConstants.JCR_UUID, uuid);
try {
root.commit();
fail("Duplicate jcr:uuid should be detected.");
} catch (CommitFailedException e) {
// expected
}
}
use of org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider in project jackrabbit-oak by apache.
the class PrivilegeDefinitionWriterTest method testMissingPrivilegeRoot.
@Test
public void testMissingPrivilegeRoot() throws Exception {
ContentRepository repo = new Oak().with(new OpenSecurityProvider()).createContentRepository();
Root tmpRoot = repo.login(null, null).getLatestRoot();
try {
PrivilegeDefinitionWriter writer = new PrivilegeDefinitionWriter(tmpRoot);
writer.writeDefinition(new ImmutablePrivilegeDefinition("newName", true, null));
fail("missing privilege root");
} catch (RepositoryException e) {
// success
} finally {
tmpRoot.getContentSession().close();
}
}
use of org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider in project jackrabbit-oak by apache.
the class RepositoryManagerTest method registerRequiredServices.
private void registerRequiredServices() {
context.registerService(SecurityProvider.class, new OpenSecurityProvider());
context.registerService(NodeStore.class, new MemoryNodeStore());
context.registerService(IndexEditorProvider.class, new PropertyIndexEditorProvider(), ImmutableMap.<String, Object>of("type", "property"));
context.registerService(IndexEditorProvider.class, new ReferenceEditorProvider(), ImmutableMap.<String, Object>of("type", "reference"));
}
use of org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider in project jackrabbit-oak by apache.
the class DefaultConflictHandlerOursTest method setUp.
@Before
public void setUp() throws CommitFailedException {
ContentSession session = new Oak().with(new OpenSecurityProvider()).with(DefaultConflictHandler.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();
}
use of org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider in project jackrabbit-oak by apache.
the class OakTest method closeAsyncIndexers.
@Test
public void closeAsyncIndexers() throws Exception {
final AtomicReference<AsyncIndexUpdate> async = new AtomicReference<AsyncIndexUpdate>();
Whiteboard wb = new DefaultWhiteboard() {
@Override
public <T> Registration register(Class<T> type, T service, Map<?, ?> properties) {
if (service instanceof AsyncIndexUpdate) {
async.set((AsyncIndexUpdate) service);
}
return super.register(type, service, properties);
}
};
Oak oak = new Oak().with(new OpenSecurityProvider()).with(wb).withAsyncIndexing("foo-async", 5);
ContentRepository repo = oak.createContentRepository();
((Closeable) repo).close();
assertNotNull(async.get());
assertTrue(async.get().isClosed());
assertNull(WhiteboardUtils.getService(wb, AsyncIndexUpdate.class));
}
Aggregations