<commit_before>########################################################################
#
# byteman script used to ensure that core tests can sequence various
# operations which normally depend upon waiting around for a background
# thread to be scheduled.
#

#########################################################################
# 3 rules to stop the log purger from proceeding until it is signalled
# at a suitable point during a test. the log purger also signals in
# order to allow the test code to detect that a purge has completed
# should it wish to do so

# rule to ensure the transaction log purger uses a very small timeout
# so that it is ready to proceed straight away when signalled

RULE override TRANSACTION_LOG_PURGE_TIME
CLASS com.arjuna.ats.internal.arjuna.objectstore.LogStore
METHOD <clinit>
AT ENTRY
BIND NOTHING
IF TRUE
DO com.arjuna.ats.arjuna.common.arjPropertyManager.getObjectStoreEnvironmentBean().setPurgeTime(100)
ENDRULE

# rule to ensure that the LogStore does not proceed to purge any
# logs until the test signals it do so

RULE delay log purge
CLASS com.arjuna.ats.internal.arjuna.objectstore.LogPurger
METHOD run()
AT CALL writeRemovalEntries
BIND NOTHING
IF TRUE
DO debug("LogStore waiting before purge"),
   waitFor("LogStore.purge"),
   flag("LogStore do purge"),
   debug("LogStore proceeding with purge")
ENDRULE

# matching rule to ensure that the LogStore signals any thread which
# is waiting for it to finish purging the logs

RULE done log purge
CLASS com.arjuna.ats.internal.arjuna.objectstore.LogPurger
METHOD run()
AFTER CALL truncateLogs
BIND NOTHING
IF TRUE
DO debug("Signalling purge complete"),
   signalWake("LogStore.purged", true),
   flag("LogStore done purge"),
   debug("Signalled purge complete")
ENDRULE

#########################################################################
#
# rules appropriate to specific tests
#
# n.b. several of the test don't want the purger to run. this happens by
# default since the purger hist the waitFor and never gets signalled
#

#########################################################################
# LogStoreRecoveryTest wants to delay the purge until it is ready for it
# and then delay proceeding with the test until the purge has actually
# happened

RULE log store recovery test allow purge to proceed
CLASS com.hp.mwtests.ts.arjuna.objectstore.LogStoreRecoveryTest
METHOD test()<commit_msg>JBTM-1349 fix byteman script (set flag before signaling<commit_after>########################################################################
#
# byteman script used to ensure that core tests can sequence various
# operations which normally depend upon waiting around for a background
# thread to be scheduled.
#

#########################################################################
# 3 rules to stop the log purger from proceeding until it is signalled
# at a suitable point during a test. the log purger also signals in
# order to allow the test code to detect that a purge has completed
# should it wish to do so

# rule to ensure the transaction log purger uses a very small timeout
# so that it is ready to proceed straight away when signalled

RULE override TRANSACTION_LOG_PURGE_TIME
CLASS com.arjuna.ats.internal.arjuna.objectstore.LogStore
METHOD <clinit>
AT ENTRY
BIND NOTHING
IF TRUE
DO com.arjuna.ats.arjuna.common.arjPropertyManager.getObjectStoreEnvironmentBean().setPurgeTime(100)
ENDRULE

# rule to ensure that the LogStore does not proceed to purge any
# logs until the test signals it do so

RULE delay log purge
CLASS com.arjuna.ats.internal.arjuna.objectstore.LogPurger
METHOD run()
AT CALL writeRemovalEntries
BIND NOTHING
IF TRUE
DO debug("LogStore waiting before purge"),
   waitFor("LogStore.purge"),
   flag("LogStore do purge"),
   debug("LogStore proceeding with purge")
ENDRULE

# matching rule to ensure that the LogStore signals any thread which
# is waiting for it to finish purging the logs

RULE done log purge
CLASS com.arjuna.ats.internal.arjuna.objectstore.LogPurger
METHOD run()
AFTER CALL truncateLogs
BIND NOTHING
IF TRUE
DO debug("Signalling purge complete"),
   flag("LogStore done purge"),
   signalWake("LogStore.purged", true),
   debug("Signalled purge complete")
ENDRULE

#########################################################################
#
# rules appropriate to specific tests
#
# n.b. several of the test don't want the purger to run. this happens by
# default since the purger hist the waitFor and never gets signalled
#

#########################################################################
# LogStoreRecoveryTest wants to delay the purge until it is ready for it
# and then delay proceeding with the test until the purge has actually
# happened

RULE log store recovery test allow purge to proceed
CLASS com.hp.mwtests.ts.arjuna.objectstore.LogStoreRecoveryTest
METHOD test()
{'fraction_non_alphanumeric': 0.16886870355078448, 'fraction_numerical': 0.002477291494632535, 'mean_word_length': 5.520861372812921, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5932441', 'n_tokens_mistral': 1319, 'n_tokens_neox': 1249, 'n_words': 556}