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
var client = null;
 
module("Stomp Subscription", {
  setup: function() {
    client = Stomp.client(TEST.url);
    client.debug = TEST.debug;
  },
 
  teardown: function() {
    client.disconnect();
  }
});
 
test("Should receive messages sent to destination after subscribing", 1, function() {
  var msg = 'Is anybody out there?';
 
  client.connect(TEST.login, TEST.password, function() {
    client.subscribe(TEST.destination, function(frame) {
      start();
      equals(frame.body, msg);
    });
 
    client.send(TEST.destination, {}, msg);
  });
 
  stop(TEST.timeout);
});
 
test("Should no longer receive messages after unsubscribing to destination", 1, function() {
  var msg1 = 'Calling all cars!',
      subscription1 = null,
      subscription2 = null;
 
  client.connect(TEST.login, TEST.password, function() {
    subscription1 = client.subscribe(TEST.destination, function(frame) {
      start();
      ok(false, 'Should not have received message!');
    });
 
    subscription2 = client.subscribe(TEST.destination, function(frame) {
      start();
      equals(frame.body, msg1);
    });
 
    subscription1.unsubscribe();
    client.send(TEST.destination, {}, msg1);
  });
 
  stop(TEST.timeout);
});