|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.mockrunner.mock.ejb.MockUserTransaction
public class MockUserTransaction
Mock implementation of UserTransaction
.
Constructor Summary | |
---|---|
MockUserTransaction()
|
Method Summary | |
---|---|
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. sets the status to Status.STATUS_NO_TRANSACTION
and the number of calls to 0. |
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MockUserTransaction()
Method Detail |
---|
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 javax.transaction.SystemException
getStatus
in interface javax.transaction.UserTransaction
javax.transaction.SystemException
public void begin() throws javax.transaction.NotSupportedException, javax.transaction.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 javax.transaction.UserTransaction
javax.transaction.NotSupportedException
javax.transaction.SystemException
public void commit() throws javax.transaction.RollbackException, javax.transaction.HeuristicMixedException, javax.transaction.HeuristicRollbackException, java.lang.SecurityException, java.lang.IllegalStateException, javax.transaction.SystemException
commit
in interface javax.transaction.UserTransaction
javax.transaction.RollbackException
javax.transaction.HeuristicMixedException
javax.transaction.HeuristicRollbackException
java.lang.SecurityException
java.lang.IllegalStateException
javax.transaction.SystemException
public void rollback() throws java.lang.IllegalStateException, java.lang.SecurityException, javax.transaction.SystemException
rollback
in interface javax.transaction.UserTransaction
java.lang.IllegalStateException
java.lang.SecurityException
javax.transaction.SystemException
public void setRollbackOnly() throws java.lang.IllegalStateException, javax.transaction.SystemException
setRollbackOnly
in interface javax.transaction.UserTransaction
java.lang.IllegalStateException
javax.transaction.SystemException
public void setTransactionTimeout(int timeout) throws javax.transaction.SystemException
setTransactionTimeout
in interface javax.transaction.UserTransaction
timeout
- the transaction timeout
javax.transaction.SystemException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |