testability-driver-qt-sut-plugin 1.2.0 → 1.2.1
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.
@@ -79,14 +79,6 @@ module MobyController
|
|
79
79
|
|
80
80
|
end
|
81
81
|
|
82
|
-
def add_hook( id, &block )
|
83
|
-
|
84
|
-
raise ArgumentError, 'Unable to add hook due to no block was given' unless block_given?
|
85
|
-
|
86
|
-
@hooks[ id ] = block
|
87
|
-
|
88
|
-
end
|
89
|
-
|
90
82
|
# TODO: document me
|
91
83
|
def disconnect
|
92
84
|
|
@@ -289,20 +281,6 @@ module MobyController
|
|
289
281
|
|
290
282
|
private
|
291
283
|
|
292
|
-
# TODO: document me
|
293
|
-
def execute_hook( id, *arguments )
|
294
|
-
|
295
|
-
@hooks[ id ].call( *arguments )
|
296
|
-
|
297
|
-
end
|
298
|
-
|
299
|
-
# TODO: document me
|
300
|
-
def hooked? ( id )
|
301
|
-
|
302
|
-
@hooks.has_key?( id )
|
303
|
-
|
304
|
-
end
|
305
|
-
|
306
284
|
# TODO: document me
|
307
285
|
def read_socket( bytes_count )
|
308
286
|
|
@@ -21,97 +21,97 @@ module MobyController
|
|
21
21
|
|
22
22
|
module QT
|
23
23
|
|
24
|
-
|
24
|
+
module Comms
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
26
|
+
# Command types
|
27
|
+
ERROR_MSG = 0
|
28
|
+
VALID_MSG = 1
|
29
|
+
OK_MESSAGE = "OK"
|
30
30
|
|
31
|
-
|
31
|
+
class Inflator
|
32
32
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
33
|
+
def self.inflate( response )
|
34
|
+
# strip 4 extra bytes written by qt compression, return empty string if no raw data found, otherwise inflate it
|
35
|
+
( raw_data = response[ 4 .. -1 ] ).empty? ? "" : Zlib::Inflate.inflate( raw_data )
|
36
|
+
end
|
37
37
|
|
38
|
-
|
39
|
-
|
38
|
+
# enable hooking for performance measurement & debug logging
|
39
|
+
TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
|
40
40
|
|
41
|
-
|
41
|
+
end # Inflator
|
42
42
|
|
43
43
|
# deprecated: see send_service_request#adapter.rb
|
44
|
-
|
45
|
-
|
44
|
+
# Wrapper for protocol message.
|
45
|
+
class QTResponse
|
46
46
|
|
47
|
-
|
47
|
+
attr_accessor :msg_body, :flag, :crc, :message_id
|
48
48
|
|
49
49
|
# deprecated: see send_service_request#adapter.rb
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
50
|
+
# Initialize QT Response.
|
51
|
+
# == params
|
52
|
+
# command_flag Indicator flad for message type (error or ok)
|
53
|
+
# message_code 0 or an error code
|
54
|
+
# msg_body Body of the message. For command a simple "OK" message for ui state the xml document as string
|
55
|
+
# == returns
|
56
|
+
def initialize( command_flag, msg_body, crc, message_id )
|
57
57
|
|
58
|
-
|
58
|
+
@flag, @msg_body, @crc, @message_id = command_flag, msg_body, crc, message_id
|
59
59
|
|
60
|
-
|
60
|
+
end
|
61
61
|
|
62
62
|
# deprecated: see send_service_request#adapter.rb
|
63
|
-
|
63
|
+
def validate_message( msg_id )
|
64
64
|
|
65
|
-
|
66
|
-
|
65
|
+
#check that response matches the request
|
66
|
+
if @message_id != msg_id
|
67
67
|
|
68
68
|
msg = "Response to request did not match: #{ @message_id.to_s.inspect }!=#{ msg_id.to_s.inspect }"
|
69
69
|
|
70
|
-
|
70
|
+
$logger.fatal msg
|
71
71
|
|
72
72
|
$logger.fatal @msg_body
|
73
73
|
|
74
|
-
|
74
|
+
raise RuntimeError, msg
|
75
75
|
|
76
|
-
|
76
|
+
end
|
77
77
|
|
78
|
-
|
79
|
-
|
78
|
+
#raise error if error flag
|
79
|
+
if @flag == Comms::ERROR_MSG
|
80
80
|
|
81
|
-
|
81
|
+
raise MobyBase::ApplicationNotAvailableError, @msg_body if @msg_body =~ /The application with Id \d+ is no longer available/
|
82
82
|
|
83
|
-
|
83
|
+
raise RuntimeError, @msg_body
|
84
84
|
|
85
85
|
end
|
86
86
|
|
87
|
-
|
87
|
+
end
|
88
88
|
|
89
|
-
|
90
|
-
|
89
|
+
# enable hooking for performance measurement & debug logging
|
90
|
+
TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
|
91
91
|
|
92
|
-
|
92
|
+
end # QTResponse
|
93
93
|
|
94
|
-
|
95
|
-
|
94
|
+
# Message generator for qt tas messages
|
95
|
+
class MessageGenerator
|
96
96
|
|
97
|
-
|
97
|
+
def self.generate( message_data, message_flag = VALID_MSG )
|
98
98
|
|
99
|
-
|
99
|
+
MobyController::QT::Comms::QtMessage.new( message_flag, message_data )
|
100
100
|
|
101
|
-
|
101
|
+
end
|
102
102
|
|
103
|
-
|
104
|
-
|
103
|
+
# enable hooking for performance measurement & debug logging
|
104
|
+
TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
|
105
105
|
|
106
|
-
|
106
|
+
end # MobyController
|
107
107
|
|
108
|
-
|
108
|
+
class QtMessage
|
109
109
|
|
110
|
-
|
110
|
+
attr_reader :flag, :data, :crc, :compression, :size
|
111
111
|
|
112
|
-
|
112
|
+
attr_accessor :message_id
|
113
113
|
|
114
|
-
|
114
|
+
def initialize( message_flag, message_data )
|
115
115
|
|
116
116
|
# message flag
|
117
117
|
@flag = message_flag
|
@@ -129,36 +129,36 @@ module MobyController
|
|
129
129
|
# calculate outgoing message crc; sent in message header to receiver for data validation
|
130
130
|
@crc = TDriver::Checksum.crc16_ibm( @data )
|
131
131
|
|
132
|
-
|
132
|
+
end
|
133
133
|
|
134
|
-
|
134
|
+
def make_binary_message( message_id )
|
135
135
|
|
136
|
-
|
136
|
+
[ @flag, @size, @crc, @compression, message_id, @data ].pack( 'CISCIa*' )
|
137
137
|
|
138
|
-
|
138
|
+
end
|
139
139
|
|
140
|
-
|
140
|
+
def deflate
|
141
141
|
|
142
|
-
|
142
|
+
@compression = 2
|
143
143
|
|
144
|
-
|
144
|
+
#@data = [ (@data.size & 0xff000000) >> 24, (@data.size & 0x00ff0000) >> 16, (@data.size & 0x0000ff00) >> 8, (@data.size & 0x000000ff), Zlib::Deflate.deflate( @data, 9 ) ].pack('C4a*')
|
145
145
|
|
146
146
|
data_size = @data.size
|
147
147
|
|
148
|
-
|
149
|
-
|
148
|
+
# qUncompress required the data length at the beginning so append it - the bytes need to be arranged in the below method (see QByteArray::qUncompress)
|
149
|
+
@data = [ (data_size & 0xff000000) >> 24, (data_size & 0x00ff0000) >> 16, (data_size & 0x0000ff00) >> 8, (data_size & 0x000000ff), Zlib::Deflate.deflate( @data, 9 ) ].pack('C4a*')
|
150
150
|
|
151
151
|
# update data size
|
152
152
|
@size = @data.size
|
153
|
-
|
154
|
-
|
153
|
+
|
154
|
+
end
|
155
155
|
|
156
|
-
|
157
|
-
|
156
|
+
# enable hooking for performance measurement & debug logging
|
157
|
+
TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
|
158
158
|
|
159
|
-
|
159
|
+
end # QtMessage
|
160
160
|
|
161
|
-
|
161
|
+
end # Comms
|
162
162
|
|
163
163
|
end # QT
|
164
164
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: testability-driver-qt-sut-plugin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 29
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 1.2.
|
9
|
+
- 1
|
10
|
+
version: 1.2.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- TDriver team
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-06-
|
18
|
+
date: 2011-06-13 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: testability-driver
|