simple-websocket-vcr 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +2 -0
  3. data/CHANGES.md +16 -2
  4. data/README.md +0 -1
  5. data/lib/simple_websocket_vcr.rb +95 -76
  6. data/lib/simple_websocket_vcr/cassette.rb +115 -36
  7. data/lib/simple_websocket_vcr/configuration.rb +14 -11
  8. data/lib/simple_websocket_vcr/errors.rb +7 -9
  9. data/lib/simple_websocket_vcr/monkey_patch.rb +18 -0
  10. data/lib/simple_websocket_vcr/recordable_websocket_client.rb +97 -97
  11. data/lib/simple_websocket_vcr/version.rb +2 -4
  12. data/simple-websocket-vcr.gemspec +7 -6
  13. data/spec/fixtures/vcr_cassettes/EXPLICIT/some_explicitly_specified_json_cassette.json +30 -0
  14. data/spec/fixtures/vcr_cassettes/EXPLICIT/some_explicitly_specified_yaml_cassette.yml +44 -0
  15. data/spec/fixtures/vcr_cassettes/EXPLICIT/some_template.json +13 -0
  16. data/spec/fixtures/vcr_cassettes/EXPLICIT/some_template.yml +25 -0
  17. data/spec/fixtures/vcr_cassettes/VCR_for_WS/automatically_picked_cassette_name_is_ok,_when_describing_parent_and_example_child1.yml +2 -0
  18. data/spec/fixtures/vcr_cassettes/VCR_for_WS/automatically_picked_cassette_name_is_ok,_when_describing_parent_and_example_child2.yml +2 -0
  19. data/spec/fixtures/vcr_cassettes/VCR_for_WS/{automatically_picked_cassette_name_is_ok,_when_describing_parent_and_example_child1.json → automatically_picked_cassette_name_is_ok,_when_describing_parent_and_example_child2_for_json.json} +0 -0
  20. data/spec/fixtures/vcr_cassettes/VCR_for_WS/automatically_picked_cassette_name_is_ok,_when_using_context_foo_and_example_bar.yml +2 -0
  21. data/spec/fixtures/vcr_cassettes/VCR_for_WS/should_record_also_the_outgoing_communication.yml +11 -0
  22. data/spec/fixtures/vcr_cassettes/VCR_for_WS/{should_record_the_closing_event.json → should_record_the_closing_event(json).json} +1 -1
  23. data/spec/fixtures/vcr_cassettes/VCR_for_WS/should_record_the_closing_event(yaml).yml +6 -0
  24. data/spec/fixtures/vcr_cassettes/VCR_for_WS/should_record_the_very_first_message_caught_on_the_client_yielded_by_the_connect_method.yml +5 -0
  25. data/spec/vcr_spec.rb +160 -57
  26. metadata +62 -51
  27. data/spec/fixtures/vcr_cassettes/EXPLICIT/some_explicitly_specified_cassette.json +0 -30
  28. data/spec/fixtures/vcr_cassettes/VCR_for_WS/automatically_picked_cassette_name_is_ok,_when_describing_parent_and_example_child2.json +0 -3
  29. data/spec/fixtures/vcr_cassettes/VCR_for_WS/automatically_picked_cassette_name_is_ok,_when_using_context_foo_and_example_bar.json +0 -3
  30. data/spec/fixtures/vcr_cassettes/VCR_for_WS/should_record_also_the_outgoing_communication.json +0 -21
  31. data/spec/fixtures/vcr_cassettes/VCR_for_WS/should_record_the_very_first_message_caught_on_the_client_yielded_by_the_connect_method.json +0 -9
@@ -1,11 +1,9 @@
1
- module VCR
2
- module WebSocket
3
- module Errors
4
- class VCRError < StandardError; end
5
- class OperationMismatchError < VCRError; end
6
- class DataMismatchError < VCRError; end
7
- class NoCassetteError < VCRError; end
8
- class NoMoreSessionsError < VCRError; end
9
- end
1
+ module WebSocketVCR
2
+ module Errors
3
+ class VCRError < StandardError; end
4
+ class OperationMismatchError < VCRError; end
5
+ class DataMismatchError < VCRError; end
6
+ class NoCassetteError < VCRError; end
7
+ class NoMoreSessionsError < VCRError; end
10
8
  end
11
9
  end
@@ -0,0 +1,18 @@
1
+ module WebSocket::Client::Simple
2
+ class << self
3
+ alias_method :real_connect, :connect
4
+
5
+ def connect(url, options = {})
6
+ if WebSocketVCR.configuration.hook_uris.any? { |u| url.include?(u) }
7
+ cassette = WebSocketVCR.cassette
8
+ live = cassette.recording?
9
+ real_client = real_connect(url, options) if live
10
+ fake_client = WebSocketVCR::RecordableWebsocketClient.new(cassette, live ? real_client : nil)
11
+ yield fake_client if block_given?
12
+ fake_client
13
+ else
14
+ real_connect(url, options)
15
+ end
16
+ end
17
+ end
18
+ end
@@ -3,129 +3,129 @@ require 'websocket-client-simple'
3
3
  require 'base64'
4
4
  require 'simple_websocket_vcr/errors'
5
5
 
6
- module VCR
7
- module WebSocket
8
- include Errors
6
+ module WebSocketVCR
7
+ include Errors
9
8
 
10
- class RecordableWebsocketClient
11
- include EventEmitter
9
+ class RecordableWebsocketClient
10
+ include EventEmitter
12
11
 
13
- attr_reader :live, :client
14
- attr_accessor :recording, :open, :thread
12
+ attr_reader :live, :client
13
+ attr_accessor :session, :open, :thread
15
14
 
16
- def initialize(cassette, real_client)
17
- fail NoCassetteError 'specify the cassette' unless cassette
15
+ def initialize(cassette, real_client)
16
+ fail NoCassetteError 'specify the cassette' unless cassette
18
17
 
19
- if cassette.recording?
20
- @live = true
21
- @client = real_client
22
- else
23
- @live = false
24
- @open = true
25
- end
26
- @recording = cassette.next_session
18
+ if cassette.recording?
19
+ @live = true
20
+ @client = real_client
21
+ else
22
+ @live = false
23
+ @open = true
27
24
  end
25
+ @session = cassette.next_session
26
+ end
28
27
 
29
- def send(data, opt = { type: :text })
30
- _write(:send, data, opt)
31
- end
28
+ def send(data, opt = { type: :text })
29
+ _write(:send, data, opt)
30
+ end
32
31
 
33
- def on(event, params = {}, &block)
34
- super(event, params, &block) unless @live
35
- _read(event, params, &block)
36
- end
32
+ def on(event, params = {}, &block)
33
+ super(event, params, &block) unless @live
34
+ _read(event, params, &block)
35
+ end
37
36
 
38
- def emit(event, *data)
39
- @recording << { operation: 'read', data: data } if @live
40
- super(event, *data)
41
- end
37
+ def emit(event, *data)
38
+ @session.store(operation: 'read', data: data) if @live
39
+ super(event, *data)
40
+ end
42
41
 
43
- def open?
44
- if @live
45
- @client.open?
46
- else
47
- @open
48
- end
42
+ def open?
43
+ if @live
44
+ @client.open?
45
+ else
46
+ @open
49
47
  end
48
+ end
50
49
 
51
- def close
52
- if @live
53
- @recording << { operation: 'close' }
54
- @client.close
55
- else
56
- sleep 0.5 if @recording.first['operation'] != 'close'
57
- record = @recording.shift
58
- _ensure_operation('close', record['operation'])
59
- Thread.kill @thread if @thread
60
- @open = false
61
- end
50
+ def close
51
+ if @live
52
+ @session.store(operation: 'close')
53
+ @client.close
54
+ else
55
+ sleep 0.5 if @session.head.operation != 'close'
56
+ record = @session.next
57
+ _ensure_operation('close', record.operation)
58
+ Thread.kill @thread if @thread
59
+ @open = false
62
60
  end
61
+ end
63
62
 
64
- private
65
-
66
- def _write(method, data, opt)
67
- text_data = opt[:type] == :text ? data.dup : Base64.encode64(data.dup)
68
- if @live
69
- @client.__send__(method, data, opt)
70
- @recording << { operation: 'write', data: text_data }
71
- else
72
- sleep 0.5 if @recording.first['operation'] != 'write'
73
- record = @recording.shift
74
- _ensure_operation('write', record['operation'])
75
- _ensure_data(text_data, record['data'])
76
- end
63
+ private
64
+
65
+ def _write(method, data, opt)
66
+ text_data = opt[:type] == :text ? data.dup : Base64.encode64(data.dup)
67
+ if @live
68
+ @client.__send__(method, data, opt)
69
+ @session.store(operation: 'write', data: text_data)
70
+ else
71
+ sleep 0.5 if @session.head.operation != 'write'
72
+ record = @session.next
73
+ _ensure_operation('write', record.operation)
74
+ _ensure_data(text_data, record.data)
77
75
  end
76
+ end
78
77
 
79
- def _read(event, params, &block)
80
- if @live
81
- rec = @recording
82
- @client.on(event, params) do |msg|
83
- data = msg.type == :text ? msg.data : Base64.decode64(msg.data)
84
- rec << { operation: 'read', type: msg.type, data: data }
85
- block.call(msg)
86
- end
87
- else
88
- wait_for_reads(event, params[:once])
78
+ def _read(event, params, &_block)
79
+ if @live
80
+ rec = @session
81
+ @client.on(event, params) do |msg|
82
+ data = msg.type == :text ? msg.data : Base64.decode64(msg.data)
83
+ rec.store(operation: 'read', type: msg.type, data: data)
84
+ yield(msg)
89
85
  end
86
+ else
87
+ wait_for_reads(event, params[:once])
90
88
  end
89
+ end
91
90
 
92
- def wait_for_reads(event, once = false)
93
- @thread = Thread.new do
94
- # if the next recorded operation is a 'read', take all the reads until next write
95
- # and translate them to the events
96
- while @open && !@recording.empty?
97
- begin
98
- if @recording.first['operation'] == 'read'
99
- record = @recording.shift
100
- data = record['data']
101
- data = Base64.decode64(msg) if record['type'] != 'text'
102
- data = ::WebSocket::Frame::Data.new(data)
103
- def data.data
104
- self
105
- end
106
- emit(event, data)
107
- break if once
108
- else
109
- sleep 0.1 # TODO: config
91
+ def wait_for_reads(event, once = false)
92
+ @thread = Thread.new do
93
+ # if the next recorded operation is a 'read', take all the reads until next write
94
+ # and translate them to the events
95
+ while @open && !@session.empty?
96
+ begin
97
+ if @session.head.operation == 'read'
98
+ record = @session.next
99
+ data = record.data
100
+ data = Base64.decode64(msg) if record.type != 'text'
101
+ data = ::WebSocket::Frame::Data.new(data)
102
+
103
+ def data.data
104
+ self
110
105
  end
106
+
107
+ emit(event, data)
108
+ break if once
109
+ else
110
+ sleep 0.1 # TODO: config
111
111
  end
112
112
  end
113
113
  end
114
114
  end
115
+ end
115
116
 
116
- def _take_first_read
117
- @recording.delete_at(@recording.index { |record| record['operation'] == 'read' } || @recording.length)
118
- end
117
+ def _take_first_read
118
+ @session.delete_at(@session.index { |record| record.operation == 'read' } || @session.length)
119
+ end
119
120
 
120
- def _ensure_operation(desired, actual)
121
- string = "Expected to '#{desired}' but the next operation in recording was '#{actual}'"
122
- fail string unless desired == actual
123
- end
121
+ def _ensure_operation(desired, actual)
122
+ string = "Expected to '#{desired}' but the next operation in recording was '#{actual}'"
123
+ fail string unless desired == actual
124
+ end
124
125
 
125
- def _ensure_data(desired, actual)
126
- string = "Expected data to be '#{desired}' but next data in recording was '#{actual}'"
127
- fail string unless desired == actual
128
- end
126
+ def _ensure_data(desired, actual)
127
+ string = "Expected data to be '#{desired}' but next data in recording was '#{actual}'"
128
+ fail string unless desired == actual
129
129
  end
130
130
  end
131
131
  end
@@ -1,5 +1,3 @@
1
- module VCR
2
- module WebSocket
3
- VERSION = '0.0.4'.freeze
4
- end
1
+ module WebSocketVCR
2
+ VERSION = '0.0.5'
5
3
  end
@@ -5,7 +5,7 @@ require 'simple_websocket_vcr/version'
5
5
 
6
6
  Gem::Specification.new do |gem|
7
7
  gem.name = 'simple-websocket-vcr'
8
- gem.version = VCR::WebSocket::VERSION
8
+ gem.version = WebSocketVCR::VERSION
9
9
  gem.authors = ['Jirka Kremser']
10
10
  gem.email = ['jkremser@redhat.com']
11
11
  gem.description = 'Websocket VCR add-on'
@@ -19,12 +19,13 @@ Gem::Specification.new do |gem|
19
19
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
20
20
  gem.require_paths = ['lib']
21
21
 
22
- gem.add_development_dependency 'shoulda'
22
+ gem.add_runtime_dependency 'websocket-client-simple', '= 0.3.0'
23
+
24
+ gem.add_development_dependency 'coveralls', '~> 0.8'
23
25
  gem.add_development_dependency 'rspec-rails', '~> 3.0'
24
26
  gem.add_development_dependency 'rake', '~> 11'
25
- gem.add_development_dependency 'vcr'
26
- gem.add_development_dependency 'webmock', '~> 1.7'
27
27
  gem.add_development_dependency 'rubocop', '= 0.34.2'
28
- gem.add_development_dependency 'websocket-client-simple', '~> 0.3'
29
- gem.add_development_dependency 'coveralls'
28
+ gem.add_development_dependency 'shoulda', '~> 3.5'
29
+ gem.add_development_dependency 'vcr', '~> 2.9'
30
+ gem.add_development_dependency 'webmock', '~> 1.7'
30
31
  end
@@ -0,0 +1,30 @@
1
+ [
2
+ [
3
+ {
4
+ "operation": "read",
5
+ "type": "text",
6
+ "data": "WelcomeResponse={\"sessionId\":\"6lLLtFyPAUmpeh3JiSUW3b1D1YN6FTLGHc2Yt8dI\"}"
7
+ },
8
+ {
9
+ "operation": "write",
10
+ "data": "something_1"
11
+ },
12
+ {
13
+ "operation": "read",
14
+ "type": "text",
15
+ "data": "GenericErrorResponse={\"errorMessage\":\"Failed to process message [?]\",\"stackTrace\":\"java.lang.IllegalArgumentException: Cannot deserialize: [something_1]\\n\\tat org.hawkular.cmdgw.api.ApiDeserializer.fromHawkularFormat(ApiDeserializer.java:68)\\n\\tat org.hawkular.cmdgw.api.ApiDeserializer.deserialize(ApiDeserializer.java:84)\\n\\tat org.hawkular.cmdgw.command.ws.server.AbstractGatewayWebSocket.onMessage(AbstractGatewayWebSocket.java:213)\\n\\tat sun.reflect.GeneratedMethodAccessor686.invoke(Unknown Source)\\n\\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\\n\\tat java.lang.reflect.Method.invoke(Method.java:497)\\n\\tat io.undertow.websockets.jsr.annotated.BoundMethod.invoke(BoundMethod.java:87)\\n\\tat io.undertow.websockets.jsr.annotated.AnnotatedEndpoint$2$1.run(AnnotatedEndpoint.java:150)\\n\\tat io.undertow.websockets.jsr.ServerWebSocketContainer.invokeEndpointMethod(ServerWebSocketContainer.java:553)\\n\\tat io.undertow.websockets.jsr.annotated.AnnotatedEndpoint$2.onMessage(AnnotatedEndpoint.java:145)\\n\\tat io.undertow.websockets.jsr.FrameHandler$7.run(FrameHandler.java:283)\\n\\tat io.undertow.websockets.jsr.ServerWebSocketContainer.invokeEndpointMethod(ServerWebSocketContainer.java:553)\\n\\tat io.undertow.websockets.jsr.ServerWebSocketContainer$5.run(ServerWebSocketContainer.java:538)\\n\\tat io.undertow.websockets.jsr.OrderedExecutor$ExecutorTask.run(OrderedExecutor.java:67)\\n\\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)\\n\\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)\\n\\tat java.lang.Thread.run(Thread.java:745)\\n\"}"
16
+ },
17
+ {
18
+ "operation": "write",
19
+ "data": "something_2"
20
+ },
21
+ {
22
+ "operation": "read",
23
+ "type": "text",
24
+ "data": "GenericErrorResponse={\"errorMessage\":\"Failed to process message [?]\",\"stackTrace\":\"java.lang.IllegalArgumentException: Cannot deserialize: [something_2]\\n\\tat org.hawkular.cmdgw.api.ApiDeserializer.fromHawkularFormat(ApiDeserializer.java:68)\\n\\tat org.hawkular.cmdgw.api.ApiDeserializer.deserialize(ApiDeserializer.java:84)\\n\\tat org.hawkular.cmdgw.command.ws.server.AbstractGatewayWebSocket.onMessage(AbstractGatewayWebSocket.java:213)\\n\\tat sun.reflect.GeneratedMethodAccessor686.invoke(Unknown Source)\\n\\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\\n\\tat java.lang.reflect.Method.invoke(Method.java:497)\\n\\tat io.undertow.websockets.jsr.annotated.BoundMethod.invoke(BoundMethod.java:87)\\n\\tat io.undertow.websockets.jsr.annotated.AnnotatedEndpoint$2$1.run(AnnotatedEndpoint.java:150)\\n\\tat io.undertow.websockets.jsr.ServerWebSocketContainer.invokeEndpointMethod(ServerWebSocketContainer.java:553)\\n\\tat io.undertow.websockets.jsr.annotated.AnnotatedEndpoint$2.onMessage(AnnotatedEndpoint.java:145)\\n\\tat io.undertow.websockets.jsr.FrameHandler$7.run(FrameHandler.java:283)\\n\\tat io.undertow.websockets.jsr.ServerWebSocketContainer.invokeEndpointMethod(ServerWebSocketContainer.java:553)\\n\\tat io.undertow.websockets.jsr.ServerWebSocketContainer$5.run(ServerWebSocketContainer.java:538)\\n\\tat io.undertow.websockets.jsr.OrderedExecutor$ExecutorTask.run(OrderedExecutor.java:67)\\n\\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)\\n\\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)\\n\\tat java.lang.Thread.run(Thread.java:745)\\n\"}"
25
+ },
26
+ {
27
+ "operation": "close"
28
+ }
29
+ ]
30
+ ]
@@ -0,0 +1,44 @@
1
+ ---
2
+ websocket_interactions:
3
+ - - operation: read
4
+ type: text
5
+ data: WelcomeResponse={"sessionId":"<%= foobar %>"}
6
+ - operation: write
7
+ data: something_1
8
+ - operation: read
9
+ type: text
10
+ data: 'GenericErrorResponse={"errorMessage":"Failed to process message [?]","stackTrace":"java.lang.IllegalArgumentException:
11
+ Cannot deserialize: [something_1]\n\tat org.hawkular.cmdgw.api.ApiDeserializer.fromHawkularFormat(ApiDeserializer.java:68)\n\tat
12
+ org.hawkular.cmdgw.api.ApiDeserializer.deserialize(ApiDeserializer.java:84)\n\tat
13
+ org.hawkular.cmdgw.command.ws.server.AbstractGatewayWebSocket.onMessage(AbstractGatewayWebSocket.java:213)\n\tat
14
+ sun.reflect.GeneratedMethodAccessor686.invoke(Unknown Source)\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n\tat
15
+ java.lang.reflect.Method.invoke(Method.java:497)\n\tat io.undertow.websockets.jsr.annotated.BoundMethod.invoke(BoundMethod.java:87)\n\tat
16
+ io.undertow.websockets.jsr.annotated.AnnotatedEndpoint$2$1.run(AnnotatedEndpoint.java:150)\n\tat
17
+ io.undertow.websockets.jsr.ServerWebSocketContainer.invokeEndpointMethod(ServerWebSocketContainer.java:553)\n\tat
18
+ io.undertow.websockets.jsr.annotated.AnnotatedEndpoint$2.onMessage(AnnotatedEndpoint.java:145)\n\tat
19
+ io.undertow.websockets.jsr.FrameHandler$7.run(FrameHandler.java:283)\n\tat io.undertow.websockets.jsr.ServerWebSocketContainer.invokeEndpointMethod(ServerWebSocketContainer.java:553)\n\tat
20
+ io.undertow.websockets.jsr.ServerWebSocketContainer$5.run(ServerWebSocketContainer.java:538)\n\tat
21
+ io.undertow.websockets.jsr.OrderedExecutor$ExecutorTask.run(OrderedExecutor.java:67)\n\tat
22
+ java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)\n\tat
23
+ java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)\n\tat
24
+ java.lang.Thread.run(Thread.java:745)\n"}'
25
+ - operation: write
26
+ data: something_2
27
+ - operation: read
28
+ type: text
29
+ data: 'GenericErrorResponse={"errorMessage":"Failed to process message [?]","stackTrace":"java.lang.IllegalArgumentException:
30
+ Cannot deserialize: [something_2]\n\tat org.hawkular.cmdgw.api.ApiDeserializer.fromHawkularFormat(ApiDeserializer.java:68)\n\tat
31
+ org.hawkular.cmdgw.api.ApiDeserializer.deserialize(ApiDeserializer.java:84)\n\tat
32
+ org.hawkular.cmdgw.command.ws.server.AbstractGatewayWebSocket.onMessage(AbstractGatewayWebSocket.java:213)\n\tat
33
+ sun.reflect.GeneratedMethodAccessor686.invoke(Unknown Source)\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n\tat
34
+ java.lang.reflect.Method.invoke(Method.java:497)\n\tat io.undertow.websockets.jsr.annotated.BoundMethod.invoke(BoundMethod.java:87)\n\tat
35
+ io.undertow.websockets.jsr.annotated.AnnotatedEndpoint$2$1.run(AnnotatedEndpoint.java:150)\n\tat
36
+ io.undertow.websockets.jsr.ServerWebSocketContainer.invokeEndpointMethod(ServerWebSocketContainer.java:553)\n\tat
37
+ io.undertow.websockets.jsr.annotated.AnnotatedEndpoint$2.onMessage(AnnotatedEndpoint.java:145)\n\tat
38
+ io.undertow.websockets.jsr.FrameHandler$7.run(FrameHandler.java:283)\n\tat io.undertow.websockets.jsr.ServerWebSocketContainer.invokeEndpointMethod(ServerWebSocketContainer.java:553)\n\tat
39
+ io.undertow.websockets.jsr.ServerWebSocketContainer$5.run(ServerWebSocketContainer.java:538)\n\tat
40
+ io.undertow.websockets.jsr.OrderedExecutor$ExecutorTask.run(OrderedExecutor.java:67)\n\tat
41
+ java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)\n\tat
42
+ java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)\n\tat
43
+ java.lang.Thread.run(Thread.java:745)\n"}'
44
+ - operation: close
@@ -0,0 +1,13 @@
1
+ [
2
+ [
3
+ {
4
+ "operation": "read",
5
+ "type": "text",
6
+ "data": "WelcomeResponse={\"<%= something %>\":\"I_XSiCb1wcQgARIzJ_jRU8k2-kPVblJuNCxhYBnb\"}"
7
+ },
8
+ {
9
+ "operation": "write",
10
+ "data": "<%= bar %>"
11
+ }
12
+ ]
13
+ ]
@@ -0,0 +1,25 @@
1
+ ---
2
+ websocket_interactions:
3
+ - - operation: read
4
+ type: text
5
+ data: WelcomeResponse={"<%= something %>":"KOrViCF_93axNx-WyGlhT6yktwqbJIl97mrxQXC5"}
6
+ - operation: write
7
+ data: something_1
8
+ - operation: read
9
+ type: text
10
+ data: 'GenericErrorResponse={"errorMessage":"Failed to process message [?]","stackTrace":"java.lang.IllegalArgumentException:
11
+ Cannot deserialize: [something_1]\n\tat org.hawkular.cmdgw.api.ApiDeserializer.fromHawkularFormat(ApiDeserializer.java:68)\n\tat
12
+ org.hawkular.cmdgw.api.ApiDeserializer.deserialize(ApiDeserializer.java:84)\n\tat
13
+ org.hawkular.cmdgw.command.ws.server.AbstractGatewayWebSocket.onMessage(AbstractGatewayWebSocket.java:213)\n\tat
14
+ sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\n\tat
15
+ sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n\tat
16
+ java.lang.reflect.Method.invoke(Method.java:497)\n\tat io.undertow.websockets.jsr.annotated.BoundMethod.invoke(BoundMethod.java:87)\n\tat
17
+ io.undertow.websockets.jsr.annotated.AnnotatedEndpoint$2$1.run(AnnotatedEndpoint.java:150)\n\tat
18
+ io.undertow.websockets.jsr.ServerWebSocketContainer.invokeEndpointMethod(ServerWebSocketContainer.java:553)\n\tat
19
+ io.undertow.websockets.jsr.annotated.AnnotatedEndpoint$2.onMessage(AnnotatedEndpoint.java:145)\n\tat
20
+ io.undertow.websockets.jsr.FrameHandler$7.run(FrameHandler.java:283)\n\tat io.undertow.websockets.jsr.ServerWebSocketContainer.invokeEndpointMethod(ServerWebSocketContainer.java:553)\n\tat
21
+ io.undertow.websockets.jsr.ServerWebSocketContainer$5.run(ServerWebSocketContainer.java:538)\n\tat
22
+ io.undertow.websockets.jsr.OrderedExecutor$ExecutorTask.run(OrderedExecutor.java:67)\n\tat
23
+ java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)\n\tat
24
+ java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)\n\tat
25
+ java.lang.Thread.run(Thread.java:745)\n"}'
@@ -0,0 +1,11 @@
1
+ ---
2
+ websocket_interactions:
3
+ - - operation: read
4
+ type: text
5
+ data: WelcomeResponse={"sessionId":"XQVVtE53wxz1lmMsqz2TbmR68ilFzDxLOOpkKGpd"}
6
+ - operation: write
7
+ data: something 1
8
+ - operation: write
9
+ data: something 2
10
+ - operation: write
11
+ data: something 3