OWL ITS + 탐지시스템(인터넷 진흥원)
jhjang
2021-10-14 722a8a9409f3bbe3da0a1c77d709d68cfb0a6705
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
module("Stomp Transaction");
 
test("Send a message in a transaction and abort", function() {
  
  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();
      });
      
      var tx = client.begin("txid_" + Math.random());
      client.send(TEST.destination, {transaction: tx.id}, body);
      tx.abort();
      client.send(TEST.destination, {}, body2);
    });
    stop(TEST.timeout);
});
 
test("Send a message in a transaction and commit", function() {
  
  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();
        equals(message.body, body);
        client.disconnect();
      });
      var tx = client.begin();
      client.send(TEST.destination, {transaction: tx.id}, body);
      tx.commit();
    });
    stop(TEST.timeout);
});
 
test("Send a message outside a transaction and abort", function() {
 
  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 message since it was sent outside the transaction
        equals(message.body, body);
        client.disconnect();
      });
 
      var tx = client.begin();
      client.send(TEST.destination, {}, body);
      tx.abort();
    });
    stop(TEST.timeout);
});