Project: lixa
Code Location: https://lixa.svn.sourceforge.net/svnroot/lixa/tests//tests
Browse
/
Download File
xa_5_26.at
AT_BANNER([XA: 5.26 ax_reg/ax_unreg])

AT_SETUP([XA/5.26/0.0 (ax_reg)])
# XA specification: page 26
# A resource manager calls ax_reg() to inform a transaction manager that it is
# about to perform work on behalf of an application thread of control. The
# transaction manager, in turn, replies to the resource manager with an
# indication of whether or not that work should be performed on behalf of a
# transaction branch. If the transaction manager determines that the calling
# thread of control is involved in a branch, upon successful return, xid
# points to a valid XID. If the resource manager.s work is outside any global
# transaction, xid points to NULLXID.
#
# A resource manager must call this function from the same thread of control
# that originally called ax_reg(). A resource manager taking advantage of this
# facility must have TMREGISTER set in the flags element of its xa_switch_t
# structure (see Chapter 4). Moreover, ax_unreg() returns failure [TMER_TMERR]
# when issued by a resource manager that has not set TMREGISTER.
#
# The function.s first argument, rmid, is the integer that the resource
# manager received when the transaction manager called xa_open(). It
# identifies the resource manager in the thread of control.
#
# [TMER_PROTO]
#    The routine was invoked in an improper context. See Chapter 6 for details.
AT_DATA([monkey1s.conf],
[[# monkey R.M.config
xa_open/0
xa_start/0
xa_end/0
xa_rollback/0
xa_close/0
]])
AT_DATA([monkey2s.conf],
[[# monkey R.M.config
xa_open/0
xa_start/0
xa_end/0
xa_rollback/0
xa_close/0
]])
AT_DATA([monkey1d.conf],
[[# monkey R.M.config
xa_open/0
xa_close/0
]])
AT_DATA([monkey2d.conf],
[[# monkey R.M.config
xa_open/0
xa_end/0
xa_rollback/0
xa_close/0
]])
AT_CHECK([export LIXA_PROFILE=CASE_PROF_0002 ; lixa_test_exec.sh reset start case0027 0 2>$TESTS_TMP_FILE1], [0], [ignore], [ignore])
AT_CHECK([cat $TESTS_TMP_FILE1 | tee $TESTS_TMP_FILE2 && grep 'lixa_monkeyrm_call_ax_reg.*NULL XID.*rmid=2' $TESTS_TMP_FILE2], [0], [ignore], [ignore])
AT_CHECK([cat $TESTS_TMP_FILE1 | tee $TESTS_TMP_FILE2 && grep 'lixa_monkeyrm_call_ax_reg.*valid XID.*rmid=3' $TESTS_TMP_FILE2], [0], [ignore], [ignore])
AT_CLEANUP

AT_SETUP([XA/5.29/0.0 (ax_unreg)])
# XA specification: page 29
# 
AT_DATA([monkey1s.conf],
[[# monkey R.M.config
xa_open/0
xa_start/0
xa_end/0
xa_rollback/0
xa_close/0
]])
AT_DATA([monkey2s.conf],
[[# monkey R.M.config
xa_open/0
xa_start/0
xa_end/0
xa_rollback/0
xa_close/0
]])
AT_DATA([monkey1d.conf],
[[# monkey R.M.config
xa_open/0
xa_close/0
]])
AT_DATA([monkey2d.conf],
[[# monkey R.M.config
xa_open/0
xa_close/0
]])
AT_CHECK([export LIXA_PROFILE=CASE_PROF_0002 ; lixa_test_exec.sh noreset stop case0028 0 2>$TESTS_TMP_FILE1], [0], [ignore], [ignore])
AT_CHECK([cat $TESTS_TMP_FILE1 | tee $TESTS_TMP_FILE2 && grep 'lixa_monkeyrm_call_ax_reg.*NULL XID.*rmid=2' $TESTS_TMP_FILE2], [0], [ignore], [ignore])
AT_CHECK([cat $TESTS_TMP_FILE1 | tee $TESTS_TMP_FILE2 && grep 'lixa_monkeyrm_call_ax_reg.*valid XID.*rmid=3' $TESTS_TMP_FILE2], [0], [ignore], [ignore])
AT_CLEANUP