public class MockUserTransaction extends Object implements UserTransaction
UserTransaction.| Constructor and Description |
|---|
MockUserTransaction() |
| Modifier and Type | Method and Description |
|---|---|
void |
begin()
Starts the transaction.
|
void |
commit()
Commits the transaction.
|
int |
getNumberBeginCalls()
Returns the number of overall
begin() calls. |
int |
getNumberCommitCalls()
Returns the number of overall
commit() calls. |
int |
getNumberRollbackCalls()
Returns the number of overall
rollback() calls. |
int |
getNumberRollbackOnlyCalls()
Returns the number of overall
setRollbackOnly() calls. |
int |
getStatus()
Returns the status of this transaction.
|
int |
getTransactionTimeout()
Returns the transaction timeout.
|
void |
reset()
Resets the state, i.e.
|
void |
rollback()
Rolls back the transaction.
|
void |
setRollbackOnly()
Sets the rollback only flag.
|
void |
setTransactionTimeout(int timeout)
Sets the transaction timeout.
|
boolean |
wasBeginCalled()
Returns if
begin() was called. |
boolean |
wasCommitCalled()
Returns if
commit() was called. |
boolean |
wasRollbackCalled()
Returns if
rollback() was called. |
boolean |
wasRollbackOnlyCalled()
Returns if
setRollbackOnly() was called. |
public void reset()
Status.STATUS_NO_TRANSACTION
and the number of calls to 0.public boolean wasBeginCalled()
begin() was called.begin() calledpublic boolean wasCommitCalled()
commit() was called.commit() calledpublic boolean wasRollbackCalled()
rollback() was called.rollback() calledpublic boolean wasRollbackOnlyCalled()
setRollbackOnly() was called.setRollbackOnly() calledpublic int getTransactionTimeout()
public int getNumberBeginCalls()
begin() calls.begin() callspublic int getNumberCommitCalls()
commit() calls.commit() callspublic int getNumberRollbackCalls()
rollback() calls.rollback() callspublic int getNumberRollbackOnlyCalls()
setRollbackOnly() calls.setRollbackOnly() callspublic int getStatus()
throws SystemException
getStatus in interface UserTransactionSystemExceptionpublic void begin()
throws NotSupportedException,
SystemException
Status.STATUS_ACTIVE and the
flags regarding wasXYZCalled
are reset to false. This method
does not reset the number of overall calls.begin in interface UserTransactionNotSupportedExceptionSystemExceptionpublic void commit()
throws RollbackException,
HeuristicMixedException,
HeuristicRollbackException,
SecurityException,
IllegalStateException,
SystemException
commit in interface UserTransactionRollbackExceptionHeuristicMixedExceptionHeuristicRollbackExceptionSecurityExceptionIllegalStateExceptionSystemExceptionpublic void rollback()
throws IllegalStateException,
SecurityException,
SystemException
rollback in interface UserTransactionIllegalStateExceptionSecurityExceptionSystemExceptionpublic void setRollbackOnly()
throws IllegalStateException,
SystemException
setRollbackOnly in interface UserTransactionIllegalStateExceptionSystemExceptionpublic void setTransactionTimeout(int timeout)
throws SystemException
setTransactionTimeout in interface UserTransactiontimeout - the transaction timeoutSystemExceptionCopyright © 2003–2018. All rights reserved.