test_class.declarator: txn
test_class.original_string: TransactionLegacy txn;
test_class.type: TransactionLegacy
test_class.var_name: txn
test_class.declarator: conn
test_class.original_string: Connection conn;
test_class.type: Connection
test_class.var_name: conn
test_class.file: cosmic-core/framework/db/src/test/java/com/cloud/utils/db/TestTransaction.java
test_class.identifier: TestTransaction
test_case.body: @Test
      public void testRollbackWithException() throws Exception {
          try {
              Transaction.execute(new TransactionCallbackWithException<Object, FileNotFoundException>() {
                  @Override
                  public Object doInTransaction(final TransactionStatus status) throws FileNotFoundException {
                      assertEquals(TransactionLegacy.CLOUD_DB, TransactionLegacy.currentTxn().getDatabaseId().shortValue());
  
                      throw new FileNotFoundException("Panic!");
                  }
              });
              fail();
          } catch (final FileNotFoundException e) {
              assertEquals("Panic!", e.getMessage());
          }
  
          verify(conn).setAutoCommit(false);
          verify(conn, times(0)).commit();
          verify(conn, times(1)).rollback();
          verify(conn, times(1)).close();
      }
test_case.class_method_signature: TestTransaction.testRollbackWithException()
test_case.full_signature: @Test public void testRollbackWithException()
test_case.identifier: testRollbackWithException
test_case.invocations: execute assertEquals shortValue getDatabaseId currentTxn fail assertEquals getMessage setAutoCommit verify commit verify times rollback verify times close verify times
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testRollbackWithException()
focal_class.declarator: counter = new AtomicLong(0)
focal_class.modifier: private final static
focal_class.original_string: private final static AtomicLong counter = new AtomicLong(0);
focal_class.type: AtomicLong
focal_class.var_name: counter
focal_class.declarator: STATUS = new TransactionStatus() {
      }
focal_class.modifier: private final static
focal_class.original_string: private final static TransactionStatus STATUS = new TransactionStatus() {
      };
focal_class.type: TransactionStatus
focal_class.var_name: STATUS
focal_class.file: cosmic-core/framework/db/src/main/java/com/cloud/utils/db/Transaction.java
focal_class.identifier: Transaction
focal_class.class_method_signature: Transaction.execute(final TransactionCallback<T> callback)
focal_class.full_signature: public static T execute(final TransactionCallback<T> callback)
focal_class.identifier: execute
focal_class.modifiers: public static
focal_class.parameters: (final TransactionCallback<T> callback)
focal_class.return: T
focal_class.signature: T execute(final TransactionCallback<T> callback)
focal_class.class_method_signature: Transaction.execute(final TransactionCallbackWithException<T, E> callback)
focal_class.full_signature: public static T execute(final TransactionCallbackWithException<T, E> callback)
focal_class.identifier: execute
focal_class.modifiers: public static
focal_class.parameters: (final TransactionCallbackWithException<T, E> callback)
focal_class.return: T
focal_class.signature: T execute(final TransactionCallbackWithException<T, E> callback)
focal_class.class_method_signature: Transaction.execute(final short databaseId, final TransactionCallback<T> callback)
focal_class.full_signature: public static T execute(final short databaseId, final TransactionCallback<T> callback)
focal_class.identifier: execute
focal_class.modifiers: public static
focal_class.parameters: (final short databaseId, final TransactionCallback<T> callback)
focal_class.return: T
focal_class.signature: T execute(final short databaseId, final TransactionCallback<T> callback)
focal_class.class_method_signature: Transaction.execute(final short databaseId, final TransactionCallbackWithException<T, E> callback)
focal_class.full_signature: public static T execute(final short databaseId, final TransactionCallbackWithException<T, E> callback)
focal_class.identifier: execute
focal_class.modifiers: public static
focal_class.parameters: (final short databaseId, final TransactionCallbackWithException<T, E> callback)
focal_class.return: T
focal_class.signature: T execute(final short databaseId, final TransactionCallbackWithException<T, E> callback)
focal_method.body: public static <T> T execute(final TransactionCallback<T> callback) {
          return execute(new TransactionCallbackWithException<T, RuntimeException>() {
              @Override
              public T doInTransaction(final TransactionStatus status) throws RuntimeException {
                  return callback.doInTransaction(status);
              }
          });
      }
focal_method.class_method_signature: Transaction.execute(final TransactionCallback<T> callback)
focal_method.full_signature: public static T execute(final TransactionCallback<T> callback)
focal_method.identifier: execute
focal_method.invocations: execute doInTransaction
focal_method.modifiers: public static
focal_method.parameters: (final TransactionCallback<T> callback)
focal_method.return: T
focal_method.signature: T execute(final TransactionCallback<T> callback)