Package javax.transaction

Examples of javax.transaction.UserTransaction.rollback()


            assertTrue("Node locked in session 1", n.isLocked());
            assertFalse("Node not locked in session 2", nOther.isLocked());
            assertFalse("Node not locked in session 2", nOther.hasProperty(jcrLockOwner));

            // rollback in first session
            utx.rollback();

            // verify node is not locked in either session
            assertFalse("Node not locked in session 1", n.isLocked());
            assertFalse("Node not locked in session 2", nOther.isLocked());
            assertFalse("Node not locked in session 2", nOther.hasProperty(jcrlockIsDeep));
View Full Code Here


        // verify lock is live
        assertTrue("Lock live", lock.isLive());

        // rollback
        utx.rollback();

        // verify lock is not live anymore
        assertFalse("Lock not live", lock.isLive());
    }
View Full Code Here

        // verify lock is no longer live
        assertFalse("Lock not live", lock.isLive());

        // rollback
        utx.rollback();

        // verify lock is live again
        assertTrue("Lock live", lock.isLive());
    }
View Full Code Here

        Property lockIsDeep = n.getProperty(jcrlockIsDeep);
        assertFalse(lockIsDeep.isNew());
        assertFalse(lockIsDeep.isModified());

        // rollback
        utx.rollback();

        // verify that the lock properties have been removed again.
        assertFalse(n.hasProperty(jcrLockOwner));
        try {
            lockOwner.getPath();
View Full Code Here

            // verify that the lock properties have been removed.
            assertFalse(n.hasProperty(jcrLockOwner));
            assertFalse(n.hasProperty(jcrlockIsDeep));

            // rollback
            utx.rollback();

            // verify lock is live again -> properties must be present
            assertTrue(n.hasProperty(jcrLockOwner));
            assertTrue(n.hasProperty(jcrlockIsDeep));
        } finally {
View Full Code Here

        finally
        {
           if (doCommit)
               utx.commit();
           else
               utx.rollback();
        }
       
    }
   
    private Integer getFoo (DataSource ds)
View Full Code Here

        // insert and rollback
        ut = (UserTransaction) new InitialContext().lookup( "java:comp/UserTransaction" );
        ut.begin();
        ksession.insert( 3 );
        ut.rollback();

        // check we rolled back the state changes from the 3rd insert
        ut = (UserTransaction) new InitialContext().lookup( "java:comp/UserTransaction" );
        ut.begin();
        ksession.fireAllRules();
View Full Code Here

        // rollback again, this is testing that we can do consecutive rollbacks and commits without issue
        ut = (UserTransaction) new InitialContext().lookup( "java:comp/UserTransaction" );
        ut.begin();
        ksession.insert( 5 );
        ksession.insert( 6 );
        ut.rollback();

        ksession.fireAllRules();

        assertEquals( 4,
                      list.size() );
View Full Code Here

            if( e instanceof BitronixRollbackException || e.getCause() instanceof TransientObjectException ) {
                rollBackExceptionthrown = true;
               
                // Depends on JTA version (and thus BTM version)
                if( tx.getStatus() == 1 ) {
                    tx.rollback();
                }
            }
        }          
        assertTrue( "A rollback exception should have been thrown because of foreign key violations.", rollBackExceptionthrown );
      
View Full Code Here

        } catch (Exception e) {
            if (tx != null) {
                try {
                    // rollback the operations
                    tx.rollback();
                    // System.out.println("catch: roll back success.");
                    output += "catch: roll back success.";
                } catch (Exception e1) {
                    // System.out.println("catch: roll back fail.");
                    output += "catch: roll back fail.";
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.