<commit_before>module("Stomp Transaction");

test("Send a message in a transaction and abort", function() {
  
  var txid = "txid_" + Math.random();
  var body = Math.random();
  
  var client = Stomp.client(TEST.url);
  
  client.debug = TEST.debug;
  client.connect(TEST.login, TEST.password,
    function() {
      client.subscribe(TEST.destination, function(message)
      {
        start();
        // we should receive the 2nd message outside the transaction
        equals(message.body, "outside");
        client.disconnect();
      });
      
      client.begin(txid);
      client.send(TEST.destination, {transaction: txid}, body);
      client.abort(txid);
      client.send(TEST.destination, {}, "outside");
    });
    stop(TEST.timeout);
});

test("Send a message in a transaction and commit", function() {
  <commit_msg>tests<commit_after>module("Stomp Transaction");

test("Send a message in a transaction and abort", function() {
  
  var txid = "txid_" + Math.random();
  var body = Math.random();
  var body2 = Math.random();
  
  var client = Stomp.client(TEST.url);
  
  client.debug = TEST.debug;
  client.connect(TEST.login, TEST.password,
    function() {
      client.subscribe(TEST.destination, function(message)
      {
        start();
        // we should receive the 2nd message outside the transaction
        equals(message.body, body2);
        client.disconnect();
      });
      
      client.begin(txid);
      client.send(TEST.destination, {transaction: txid}, body);
      client.abort(txid);
      client.send(TEST.destination, {}, body2);
    });
    stop(TEST.timeout);
});

test("Send a message in a transaction and commit", function() {
  
{'fraction_non_alphanumeric': 0.14200831847890671, 'fraction_numerical': 0.0029708853238265003, 'mean_word_length': 2.916279069767442, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2099542', 'n_tokens_mistral': 499, 'n_tokens_neox': 494, 'n_words': 121}