Search in sources :

Example 6 with Session

use of javax.jcr.Session in project jackrabbit-oak by apache.

the class AceCreationTest method runTest.

@Override
protected void runTest() throws Exception {
    Session session = createOrGetSystemSession();
    createAce(session, numberOfAce);
    save(session, transientWrites);
    logout(session, transientWrites);
}
Also used : Session(javax.jcr.Session)

Example 7 with Session

use of javax.jcr.Session in project jackrabbit-oak by apache.

the class AceCreationTest method afterTest.

@Override
protected void afterTest() throws Exception {
    Session session = createOrGetSystemSession();
    AccessControlManager acm = session.getAccessControlManager();
    for (AccessControlPolicy policy : acm.getPolicies(nodePath)) {
        acm.removePolicy(nodePath, policy);
    }
    save(session, transientWrites);
    super.afterTest();
}
Also used : AccessControlManager(javax.jcr.security.AccessControlManager) AccessControlPolicy(javax.jcr.security.AccessControlPolicy) Session(javax.jcr.Session)

Example 8 with Session

use of javax.jcr.Session in project jackrabbit-oak by apache.

the class AceCreationTest method beforeSuite.

@Override
protected void beforeSuite() throws Exception {
    super.beforeSuite();
    Session session = createOrGetSystemSession();
    nodePath = session.getRootNode().addNode("test" + new Random().nextInt()).getPath();
    save(session, transientWrites);
    logout(session, transientWrites);
}
Also used : Random(java.util.Random) Session(javax.jcr.Session)

Example 9 with Session

use of javax.jcr.Session in project jackrabbit-oak by apache.

the class AbstractExternalTest method beforeSuite.

@Override
protected void beforeSuite() throws Exception {
    Set<String> autoMembership = syncConfig.user().getAutoMembership();
    if (!autoMembership.isEmpty()) {
        Session s = systemLogin();
        UserManager userManager = ((JackrabbitSession) s).getUserManager();
        for (String groupId : autoMembership) {
            userManager.createGroup(groupId, new PrincipalImpl(groupId), PATH_PREFIX);
        }
        s.save();
    }
}
Also used : UserManager(org.apache.jackrabbit.api.security.user.UserManager) JackrabbitSession(org.apache.jackrabbit.api.JackrabbitSession) PrincipalImpl(org.apache.jackrabbit.oak.spi.security.principal.PrincipalImpl) Session(javax.jcr.Session) JackrabbitSession(org.apache.jackrabbit.api.JackrabbitSession)

Example 10 with Session

use of javax.jcr.Session in project jackrabbit-oak by apache.

the class ScalabilityNodeSuite method beforeSuite.

@Override
protected void beforeSuite() throws Exception {
    Session session = loginWriter();
    Node root = session.getRootNode();
    root.addNode(ROOT_NODE_NAME);
    session.save();
    if (CUSTOM_TYPE) {
        NodeTypeUtils.createNodeType(session, CUSTOM_DESC_NODE_TYPE, new String[] { DATE_PROP, SORT_PROP, FILTER_PROP, TITLE_PROP }, new int[] { PropertyType.DATE, PropertyType.BOOLEAN, PropertyType.STRING, PropertyType.STRING }, new String[0], new String[] { CUSTOM_DESC_NODE_TYPE }, null, false);
        NodeTypeUtils.createNodeType(session, CUSTOM_ROOT_NODE_TYPE, new String[] { DATE_PROP, SORT_PROP, FILTER_PROP, TITLE_PROP }, new int[] { PropertyType.DATE, PropertyType.BOOLEAN, PropertyType.STRING, PropertyType.STRING }, new String[0], new String[] { CUSTOM_DESC_NODE_TYPE }, null, false);
        nodeTypes.add(CUSTOM_ROOT_NODE_TYPE);
        nodeTypes.add(CUSTOM_DESC_NODE_TYPE);
    }
    if (INDEX) {
        createIndexes(session);
    }
}
Also used : Node(javax.jcr.Node) Session(javax.jcr.Session)

Aggregations

Session (javax.jcr.Session)1393 Node (javax.jcr.Node)761 Test (org.junit.Test)387 RepositoryException (javax.jcr.RepositoryException)304 JackrabbitSession (org.apache.jackrabbit.api.JackrabbitSession)162 Property (javax.jcr.Property)90 SimpleCredentials (javax.jcr.SimpleCredentials)88 Privilege (javax.jcr.security.Privilege)84 JackrabbitNode (org.apache.jackrabbit.api.JackrabbitNode)77 Value (javax.jcr.Value)71 Query (javax.jcr.query.Query)69 NodeIterator (javax.jcr.NodeIterator)68 NotExecutableException (org.apache.jackrabbit.test.NotExecutableException)65 QueryManager (javax.jcr.query.QueryManager)63 HashMap (java.util.HashMap)57 IOException (java.io.IOException)56 ArrayList (java.util.ArrayList)55 AccessControlManager (javax.jcr.security.AccessControlManager)55 AbstractRepositoryTest (org.apache.jackrabbit.oak.jcr.AbstractRepositoryTest)52 Authorizable (org.apache.jackrabbit.api.security.user.Authorizable)49