use of javax.jcr.Session in project jackrabbit-oak by apache.
the class WikipediaImport method run.
private void run(Repository repository) throws Exception {
Session session = repository.login(new SimpleCredentials("admin", "admin".toCharArray()));
try {
int before = importWikipedia(session);
int after = new Traversal().traverse(session);
checkState(before == after, "Import vs. traverse mismatch");
} finally {
session.logout();
}
}
use of javax.jcr.Session in project jackrabbit-oak by apache.
the class RemoveMembersTest method beforeSuite.
@Override
public void beforeSuite() throws Exception {
super.beforeSuite();
Session s = loginAdministrative();
try {
UserManager userManager = ((JackrabbitSession) s).getUserManager();
createUsers(userManager);
for (int i = 0; i <= GROUP_CNT; i++) {
Group g = userManager.createGroup(new PrincipalImpl(GROUP + i), REL_TEST_PATH);
groupPaths.add(g.getPath());
List<String> ids = new ArrayList<String>();
for (int j = 0; j <= numberOfMembers; j++) {
ids.add(USER + j);
}
g.addMembers(ids.toArray(new String[ids.size()]));
s.save();
}
} finally {
s.logout();
}
System.out.println("setup done");
}
use of javax.jcr.Session in project jackrabbit-oak by apache.
the class SequentialCreateNodesTest method beforeTest.
@Override
public void beforeTest() throws Exception {
Session session = loginWriter();
Node root = session.getRootNode().addNode(ROOT_NODE_NAME, "nt:unstructured");
for (int i = 0; i < NODE_COUNT; i++) {
Node node = root.addNode("node" + i, "nt:unstructured");
session.save();
}
}
use of javax.jcr.Session in project jackrabbit-oak by apache.
the class SetPropertyTest method beforeTest.
@Override
public void beforeTest() throws RepositoryException {
Map<Thread, Node> nodes = getOrCreateNodesMap();
Thread t = Thread.currentThread();
Node node = nodes.get(t);
if (node == null) {
Session s = getRepository().login(getCredentials());
node = s.getRootNode().getNode(testNodeName).addNode(UUID.randomUUID().toString());
node.setProperty("count", -1);
s.save();
nodes.put(t, node);
map.put(getCurrentFixture().toString(), nodes);
}
}
use of javax.jcr.Session in project jackrabbit-oak by apache.
the class ScalabilityNodeRelationshipSuite method beforeSuite.
@Override
protected void beforeSuite() throws Exception {
Session session = loginWriter();
Node root = session.getRootNode();
root.addNode(ROOT_NODE_NAME);
session.save();
users = Lists.newArrayList();
groups = Lists.newArrayList();
if (CUSTOM_TYPE) {
NodeTypeUtils.createNodeType(session, CUSTOM_ACT_NODE_TYPE, new String[] { TITLE_PROP, CREATED, ACTION, SOURCE_ID }, new int[] { PropertyType.STRING, PropertyType.DATE, PropertyType.STRING, PropertyType.STRING }, new String[0], new String[] { NodeTypeConstants.NT_OAK_UNSTRUCTURED }, null, false);
NodeTypeUtils.createNodeType(session, CUSTOM_REL_NODE_TYPE, new String[] { CREATED, SOURCE_ID, TARGET_ID }, new int[] { PropertyType.DATE, PropertyType.STRING, PropertyType.STRING }, new String[0], null, null, false);
nodeTypes.add(CUSTOM_ACT_NODE_TYPE);
nodeTypes.add(CUSTOM_REL_NODE_TYPE);
}
if (INDEX) {
createIndexes(session);
}
}
Aggregations