Package org.apache.aries.transaction.test

Examples of org.apache.aries.transaction.test.TestBean.countRows()


  public void testMandatory() throws Exception {
      TestBean bean = context().getService(TestBean.class, "(tranAttribute=Mandatory)");
      UserTransaction tran = context().getService(UserTransaction.class);
     
      //Test with client transaction - the user transaction is used to insert a row
      int initialRows = bean.countRows();
     
      tran.begin();
      bean.insertRow("testWithClientTran", 1);
      tran.commit();
     
View Full Code Here


     
      tran.begin();
      bean.insertRow("testWithClientTran", 1);
      tran.commit();
     
      int finalRows = bean.countRows();
      assertTrue("Initial rows: " + initialRows + ", Final rows: " + finalRows, finalRows - initialRows == 1);
 
      //Test with client transaction and application exception - the user transaction is not rolled back
      initialRows = bean.countRows();
     
View Full Code Here

     
      int finalRows = bean.countRows();
      assertTrue("Initial rows: " + initialRows + ", Final rows: " + finalRows, finalRows - initialRows == 1);
 
      //Test with client transaction and application exception - the user transaction is not rolled back
      initialRows = bean.countRows();
     
      tran.begin();
      bean.insertRow("testWithClientTranAndWithAppException", 1);
     
      try {
View Full Code Here

          e.printStackTrace();
      }
     
      tran.commit();
     
      finalRows = bean.countRows();
      assertTrue("Initial rows: " + initialRows + ", Final rows: " + finalRows, finalRows - initialRows == 2);
     
      //Test with client transaction and runtime exception - the user transaction is rolled back
      initialRows = bean.countRows();
     
View Full Code Here

     
      finalRows = bean.countRows();
      assertTrue("Initial rows: " + initialRows + ", Final rows: " + finalRows, finalRows - initialRows == 2);
     
      //Test with client transaction and runtime exception - the user transaction is rolled back
      initialRows = bean.countRows();
     
      tran.begin();
      bean.insertRow("testWithClientTranAndWithRuntimeException", 1);
     
      try {
View Full Code Here

          fail("RollbackException not thrown");
      } catch (RollbackException e) {
          e.printStackTrace();
      }
     
      finalRows = bean.countRows();
      assertTrue("Initial rows: " + initialRows + ", Final rows: " + finalRows, finalRows - initialRows == 0);
     
      //Test without client transaction - an exception is thrown because a transaction is mandatory
      try {
          bean.insertRow("testWithoutClientTran", 1);
View Full Code Here

  public void testRequired() throws Exception {
      TestBean bean = context().getService(TestBean.class, "(tranAttribute=Required)");
      UserTransaction tran = context().getService(UserTransaction.class);
     
      //Test with client transaction - the user transaction is used to insert a row
      int initialRows = bean.countRows();
     
      tran.begin();
      bean.insertRow("testWithClientTran", 1);
      tran.commit();
     
View Full Code Here

     
      tran.begin();
      bean.insertRow("testWithClientTran", 1);
      tran.commit();
     
      int finalRows = bean.countRows();
      assertTrue("Initial rows: " + initialRows + ", Final rows: " + finalRows, finalRows - initialRows == 1);
     
      //Test with client transaction and application exception - the user transaction is not rolled back
      initialRows = bean.countRows();
     
View Full Code Here

     
      int finalRows = bean.countRows();
      assertTrue("Initial rows: " + initialRows + ", Final rows: " + finalRows, finalRows - initialRows == 1);
     
      //Test with client transaction and application exception - the user transaction is not rolled back
      initialRows = bean.countRows();
     
      tran.begin();
      bean.insertRow("testWithClientTranAndWithAppException", 1);
     
      try {
View Full Code Here

          e.printStackTrace();
      }
     
      tran.commit();
     
      finalRows = bean.countRows();
      assertTrue("Initial rows: " + initialRows + ", Final rows: " + finalRows, finalRows - initialRows == 2);
      
      //Test with client transaction and runtime exception - the user transaction is rolled back
      initialRows = bean.countRows();
     
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.