Examples of TestEntityTransaction


Examples of org.apache.deltaspike.test.jpa.api.shared.TestEntityTransaction

        TestEntityManager defaultEntityManager = entityManagerProducer.getDefaultEntityManager();
        TestEntityManager firstEntityManager = entityManagerProducer.getFirstEntityManager();
        TestEntityManager secondEntityManager = entityManagerProducer.getSecondEntityManager();

        Assert.assertNotNull(defaultEntityManager);
        TestEntityTransaction defaultTransaction = (TestEntityTransaction) (defaultEntityManager).getTransaction();

        Assert.assertEquals(false, defaultEntityManager.isFlushed());
        Assert.assertEquals(false, defaultTransaction.isActive());
        Assert.assertEquals(false, defaultTransaction.isStarted());
        Assert.assertEquals(false, defaultTransaction.isCommitted());
        Assert.assertEquals(false, defaultTransaction.isRolledBack());

        Assert.assertNotNull(firstEntityManager);
        TestEntityTransaction firstTransaction = (TestEntityTransaction) (firstEntityManager).getTransaction();

        Assert.assertEquals(false, firstEntityManager.isFlushed());
        Assert.assertEquals(false, firstTransaction.isActive());
        Assert.assertEquals(false, firstTransaction.isStarted());
        Assert.assertEquals(false, firstTransaction.isCommitted());
        Assert.assertEquals(false, firstTransaction.isRolledBack());

        Assert.assertNotNull(secondEntityManager);
        TestEntityTransaction secondTransaction = (TestEntityTransaction) (secondEntityManager).getTransaction();

        Assert.assertEquals(false, secondEntityManager.isFlushed());
        Assert.assertEquals(false, secondTransaction.isActive());
        Assert.assertEquals(false, secondTransaction.isStarted());
        Assert.assertEquals(false, secondTransaction.isCommitted());
        Assert.assertEquals(false, secondTransaction.isRolledBack());

        multiTransactionBean.executeInTransactionRollback2();

        Assert.assertEquals(true, defaultEntityManager.isFlushed());
        Assert.assertEquals(false, defaultTransaction.isActive());
        Assert.assertEquals(true, defaultTransaction.isStarted());
        Assert.assertEquals(false, defaultTransaction.isCommitted());
        Assert.assertEquals(true, defaultTransaction.isRolledBack());

        Assert.assertEquals(true, firstEntityManager.isFlushed());
        Assert.assertEquals(false, firstTransaction.isActive());
        Assert.assertEquals(true, firstTransaction.isStarted());
        Assert.assertEquals(false, firstTransaction.isCommitted());
        Assert.assertEquals(true, firstTransaction.isRolledBack());

        Assert.assertEquals(true, secondEntityManager.isFlushed());
        Assert.assertEquals(false, secondTransaction.isActive());
        Assert.assertEquals(true, secondTransaction.isStarted());
        Assert.assertEquals(false, secondTransaction.isCommitted());
        Assert.assertEquals(true, secondTransaction.isRolledBack());
    }
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.