Package org.apache.jackrabbit.core

Examples of org.apache.jackrabbit.core.UserTransactionImpl$XidImpl


    public void testRestoreWithXA() throws Exception {
        Node n = testRootNode.addNode(nodeName1);
        n.addMixin(mixVersionable);
        testRootNode.save();
        UserTransactionImpl tx = new UserTransactionImpl(superuser);
        tx.begin();
        Version v10 = n.checkin();
        String versionName = v10.getName();
        n.restore(v10, true);
        assertEquals("Wrong version restored", versionName, n.getBaseVersion().getName());
        tx.commit();
    }
View Full Code Here


* JCR-1587.
*/
public class RemoveAndAddVersionLabelXATest extends AbstractJCRTest {

    public void testVersionLabel() throws Exception {
        UserTransaction tx = new UserTransactionImpl(superuser);
        tx.begin();
        Node n = testRootNode.addNode(nodeName1);
        n.addMixin(mixVersionable);
        testRootNode.save();
        String v1 = n.checkin().getName();
        n.checkout();
        String v2 = n.checkin().getName();
        n.getVersionHistory().addVersionLabel(v2, "label", false);
        tx.commit();

        tx = new UserTransactionImpl(superuser);
        tx.begin();
        n.restore(v1, false);
        n.getVersionHistory().removeVersion(v2);
        n.checkout();
        v2 = n.checkin().getName();
        n.getVersionHistory().addVersionLabel(v2, "label", false);
        tx.commit();
    }
View Full Code Here

    public void testCheckinRemoveVersionWithXA() throws Exception {
        Node n = testRootNode.addNode(nodeName1);
        n.addMixin(mixVersionable);
        testRootNode.save();
        UserTransactionImpl tx = new UserTransactionImpl(superuser);
        tx.begin();
        try {
            Version v10 = n.checkin();
            assertTrue("Version.getReferences() must return base version", v10.getReferences().hasNext());
            try {
                n.getVersionHistory().removeVersion(v10.getName());
                fail("VersionHistory.removeVersion() must throw ReferentialIntegrityException when" +
                        " version is still referenced.");
            } catch (ReferentialIntegrityException e) {
                // expected
            }
        } finally {
            tx.rollback();
        }
    }
View Full Code Here

        EventResult listener = new EventResult(log);
        addEventListener(listener, Event.NODE_ADDED);

        // use a transaction
        UserTransaction utx = new UserTransactionImpl(superuser);
        // start transaction
        utx.begin();
        Version v = n1.checkin();
        // commit transaction
        utx.commit();

        removeEventListener(listener);

        Event[] events = listener.getEvents(1000);
        Set paths = new HashSet();
View Full Code Here

        EventResult listener = new EventResult(log);
        addEventListener(listener, Event.NODE_REMOVED);

        // use a transaction
        UserTransaction utx = new UserTransactionImpl(superuser);
        // start transaction
        utx.begin();
        v.getContainingHistory().removeVersion(v.getName());
        // commit transaction
        utx.commit();

        removeEventListener(listener);

        Event[] events = listener.getEvents(1000);
        Set paths = new HashSet();
View Full Code Here

        super(s, "/");
        this.op = op;
    }

    public NodeIterator execute() throws Exception {
        UserTransactionImpl tx = new UserTransactionImpl(getSession());
        log.info("begin transaction");
        tx.begin();
        NodeIterator it = op.execute();
        log.info("commit transaction");
        tx.commit();
        return it;
    }
View Full Code Here

        EventResult listener = new EventResult(log);
        addEventListener(listener, Event.NODE_ADDED);

        // use a transaction
        UserTransaction utx = new UserTransactionImpl(superuser);
        // start transaction
        utx.begin();
        Version v = n1.checkin();
        // commit transaction
        utx.commit();

        removeEventListener(listener);

        Event[] events = listener.getEvents(1000);
        Set paths = new HashSet();
View Full Code Here

        EventResult listener = new EventResult(log);
        addEventListener(listener, Event.NODE_REMOVED);

        // use a transaction
        UserTransaction utx = new UserTransactionImpl(superuser);
        // start transaction
        utx.begin();
        v.getContainingHistory().removeVersion(v.getName());
        // commit transaction
        utx.commit();

        removeEventListener(listener);

        Event[] events = listener.getEvents(1000);
        Set paths = new HashSet();
View Full Code Here

        Privilege[] privileges = privilegesFromName(Privilege.JCR_ALL);
        givePrivileges(path, privileges, getRestrictions(superuser, path));

        // create new node and lock it
        Session s = getTestSession();
        UserTransaction utx = new UserTransactionImpl(s);
        utx.begin();

        // add node and save it
        Node n = s.getNode(childNPath);
        if (n.hasNode(nodeName1)) {
            Node c = n.getNode(nodeName1);
            c.remove();
            s.save();
        }

        // create node and save
        Node n2 = n.addNode(nodeName1);
        s.save(); // -> node is NEW -> no failure

        // create child node
        Node n3 = n2.addNode(nodeName2);
        s.save()// -> used to fail because n2 was saved (EXISTING) but not committed.

        n3.remove();
        n2.remove();

        // recreate n2 // -> another area where ItemManager#getItem is called in the ItemSaveOperation
        n2 = n.addNode(nodeName1);
        s.save();

        // set a property on a child node of an uncommited parent
        n2.setProperty(propertyName1, "testSetProperty");
        s.save()// -> used to fail because PropertyImpl#getParent called from PropertyImpl#checkSetValue
                   //    was checking read permission on the not yet commited parent

        // commit
        utx.commit();
    }
View Full Code Here

import org.apache.jackrabbit.test.AbstractJCRTest;

public class RemoveAndCheckinXATest extends AbstractJCRTest {

    public void testRemoveVersion() throws Exception {
        UserTransaction tx = new UserTransactionImpl(superuser);
        tx.begin();
        Node n = testRootNode.addNode(nodeName1);
        n.addMixin(mixVersionable);
        n.addMixin(mixReferenceable);
        testRootNode.save();
        String uuid = n.getUUID();
        // create two versions
        String v1 = n.checkin().getName();
        n.checkout();
        n.checkin();
        n.checkout();
        tx.commit();

        tx = new UserTransactionImpl(superuser);
        tx.begin();
        // remove on version
        n = superuser.getNodeByUUID(uuid);
        n.getVersionHistory().removeVersion(v1);
        n.save();
        tx.commit();

        // new session
        Session session = helper.getSuperuserSession();
        // for jackrabbit 2.x
        // Session session = getHelper().getSuperuserSession();
        tx = new UserTransactionImpl(session);
        tx.begin();
        n = session.getNodeByUUID(uuid);
        n.checkin();
        tx.commit();
    }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.core.UserTransactionImpl$XidImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.