Examples of UserTransactionImpl


Examples of org.apache.geronimo.transaction.context.UserTransactionImpl

                mockConnection.close();
                return null;
            }
        };
        transactionContextManager.newUnspecifiedTransactionContext();
        userTransaction = new UserTransactionImpl();
        userTransaction.setUp(transactionContextManager, connectionTrackingCoordinator);
        userTransaction.setOnline(true);
        defaultComponentInterceptor.invoke(defaultComponentContext);
        MockXAResource mockXAResource = (MockXAResource) mockManagedConnection.getXAResource();
        assertEquals("XAResource should know 1 xid", 1, mockXAResource.getKnownXids().size());
View Full Code Here

Examples of org.apache.geronimo.transaction.context.UserTransactionImpl

                mockConnection.close();
                return null;
            }
        };
        transactionContextManager.newUnspecifiedTransactionContext();
        userTransaction = new UserTransactionImpl();
        userTransaction.setUp(transactionContextManager, connectionTrackingCoordinator);
        userTransaction.setOnline(true);
        defaultComponentInterceptor.invoke(defaultComponentContext);
        MockXAResource mockXAResource = (MockXAResource) mockManagedConnection.getXAResource();
        assertEquals("XAResource should know 1 xid", 1, mockXAResource.getKnownXids().size());
View Full Code Here

Examples of org.apache.geronimo.transaction.context.UserTransactionImpl

                mockConnection.close();
                return null;
            }
        };
        transactionContextManager.newUnspecifiedTransactionContext();
        userTransaction = new UserTransactionImpl();
        userTransaction.setUp(transactionContextManager, connectionTrackingCoordinator);
        userTransaction.setOnline(true);
        defaultComponentInterceptor.invoke(defaultComponentContext);
        MockXAResource mockXAResource = (MockXAResource) mockManagedConnection.getXAResource();
        assertEquals("XAResource should know 1 xid", 1, mockXAResource.getKnownXids().size());
View Full Code Here

Examples of org.apache.jackrabbit.core.UserTransactionImpl

        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

Examples of org.apache.jackrabbit.core.UserTransactionImpl

        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

Examples of org.apache.jackrabbit.core.UserTransactionImpl

                    n.addMixin(mixLockable);
                    session.save();
                    for (i = 0; i < NUM_OPERATIONS / CONCURRENCY; i++) {
                        Lock lock = n.lock(false, true);

                        final UserTransaction utx = new UserTransactionImpl(test.getSession());
                        utx.begin();
                        lock.refresh();
                        utx.commit();

                        n.unlock();
                    }
                } catch (Exception e) {
                    final String threadName = Thread.currentThread().getName();
View Full Code Here

Examples of org.apache.jackrabbit.core.UserTransactionImpl

            public void execute(Session session, Node test)
                    throws RepositoryException {
                // add versionable nodes
                for (int i = 0; i < NUM_OPERATIONS / CONCURRENCY; i++) {
                    try {
                        final UserTransaction utx = new UserTransactionImpl(test.getSession());
                        utx.begin();
                        Node n = test.addNode("test" + i);
                        n.addMixin(mixLockable);
                        session.save();
                        Lock l = n.lock(false, true);
                        n.unlock();
                        utx.commit();
                    } catch (Exception e) {
                        final String threadName = Thread.currentThread().getName();
                        final Throwable deepCause = getLevel2Cause(e);
                        if (deepCause != null && deepCause instanceof StaleItemStateException) {
                            // ignore
View Full Code Here

Examples of org.apache.jackrabbit.core.UserTransactionImpl

        n.addMixin(mixLockable);
        s.save();

        UserTransaction utx = null;
        if (xa) {
            utx = new UserTransactionImpl(s);
            utx.begin();
        }

        javax.jcr.lock.LockManager lm = s.getWorkspace().getLockManager();
View Full Code Here

Examples of org.apache.jackrabbit.core.UserTransactionImpl

        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

Examples of org.apache.jackrabbit.core.UserTransactionImpl

     * Tests error reported in JCR-2613
     *
     * @throws Exception if an error occurs
     */
    public void testRemoveVersionAndCheckinXA() 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 one version
        n = superuser.getNodeByUUID(uuid);
        n.getVersionHistory().removeVersion(v1);
        n.save();
        tx.commit();

        // new session
        Session session = getHelper().getSuperuserSession();
        tx = new UserTransactionImpl(session);
        tx.begin();
        n = session.getNodeByUUID(uuid);
        n.checkin();
        tx.commit();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.