use of org.apache.jackrabbit.oak.InitialContent in project jackrabbit-oak by apache.
the class InitializerTest method testInitializerMongo.
@Test
public void testInitializerMongo() throws CommitFailedException {
NodeBuilder builder = mk.getNodeStore().getRoot().builder();
new InitialContent().initialize(builder);
SecurityProvider provider = SecurityProviderBuilder.newBuilder().with(ConfigurationParameters.of(ImmutableMap.of(UserConfiguration.NAME, ConfigurationParameters.of(ImmutableMap.of("anonymousId", "anonymous", "adminId", "admin", "usersPath", "/home/users", "groupsPath", "/home/groups", "defaultDepth", "1"))))).build();
provider.getConfiguration(UserConfiguration.class).getWorkspaceInitializer().initialize(builder, "default");
builder.getNodeState();
}
use of org.apache.jackrabbit.oak.InitialContent in project jackrabbit-oak by apache.
the class MountsNodeCounterTest method createRepository.
protected ContentRepository createRepository() {
Mounts.Builder builder = Mounts.newBuilder();
builder.mount("libs", false, Arrays.asList("/var/fragments"), Arrays.asList("/apps", "/libs", "/nested/mount"));
mip = builder.build();
nodeStore = new MemoryNodeStore();
Oak oak = new Oak(nodeStore).with(new InitialContent()).with(new OpenSecurityProvider()).with(new PropertyIndexEditorProvider().with(mip)).with(new NodeCounterEditorProvider().with(mip)).withAsyncIndexing("async", TimeUnit.DAYS.toSeconds(1));
wb = oak.getWhiteboard();
return oak.createContentRepository();
}
use of org.apache.jackrabbit.oak.InitialContent in project jackrabbit-oak by apache.
the class ChangeCollectorProviderTest method setup.
@Before
public void setup() throws PrivilegedActionException, CommitFailedException {
collectorProvider = new ChangeCollectorProvider();
recorder = new Recorder();
Oak oak = new Oak().with(new InitialContent()).with(collectorProvider).with(recorder).with(getSecurityProvider());
contentRepository = oak.createContentRepository();
session = Subject.doAs(SystemSubject.INSTANCE, new PrivilegedExceptionAction<ContentSession>() {
@Override
public ContentSession run() throws LoginException, NoSuchWorkspaceException {
return contentRepository.login(null, null);
}
});
Root root = session.getLatestRoot();
Tree rootTree = root.getTree("/").addChild("test");
rootTree.setProperty(JcrConstants.JCR_PRIMARYTYPE, "test:parentType", Type.NAME);
Tree child1 = rootTree.addChild("child1");
child1.setProperty("child1Prop", 1);
child1.setProperty(JcrConstants.JCR_PRIMARYTYPE, "test:childType", Type.NAME);
Tree grandChild1 = child1.addChild("grandChild1");
grandChild1.setProperty("grandChild1Prop", 1);
grandChild1.setProperty(JcrConstants.JCR_PRIMARYTYPE, "test:grandChildType", Type.NAME);
Tree greatGrandChild1 = grandChild1.addChild("greatGrandChild1");
greatGrandChild1.setProperty("greatGrandChild1Prop", 1);
greatGrandChild1.setProperty(JcrConstants.JCR_PRIMARYTYPE, "test:greatGrandChildType", Type.NAME);
Tree child2 = rootTree.addChild("child2");
child2.setProperty("child2Prop", 1);
child2.setProperty(JcrConstants.JCR_PRIMARYTYPE, "test:childType", Type.NAME);
Tree grandChild2 = child2.addChild("grandChild2");
grandChild2.setProperty("grandChild2Prop", 1);
grandChild2.setProperty(JcrConstants.JCR_PRIMARYTYPE, "test:grandChildType", Type.NAME);
recorder.changes.clear();
root.commit();
ChangeSet changeSet = getSingleChangeSet();
assertMatches("parentPaths", changeSet.getParentPaths(), "/test/child2", "/test/child1", "/test/child1/grandChild1/greatGrandChild1", "/", "/test", "/test/child1/grandChild1", "/test/child2/grandChild2");
assertMatches("parentNodeNames", changeSet.getParentNodeNames(), "child2", "child1", "greatGrandChild1", "test", "grandChild1", "grandChild2");
assertMatches("parentNodeTypes", changeSet.getParentNodeTypes(), "test:parentType", "test:childType", "test:grandChildType", "test:greatGrandChildType");
assertMatches("allNodeTypes", changeSet.getAllNodeTypes(), "test:parentType", "test:childType", "test:grandChildType", "test:greatGrandChildType");
assertMatches("propertyNames", changeSet.getPropertyNames(), JcrConstants.JCR_PRIMARYTYPE, "child1Prop", "child2Prop", "grandChild1Prop", "grandChild2Prop", "greatGrandChild1Prop");
// clear the recorder so that we start off empty
recorder.changes.clear();
}
Aggregations