testability-driver-qt-sut-plugin 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. data/env.rb +26 -0
  2. data/installer/extconf.rb +62 -0
  3. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin.rb +23 -0
  4. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/action.rb +156 -0
  5. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/application.rb +318 -0
  6. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/attribute.rb +227 -0
  7. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/behaviour.rb +140 -0
  8. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/configure_behaviour.rb +317 -0
  9. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/events.rb +165 -0
  10. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/file_transfer.rb +333 -0
  11. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/find.rb +80 -0
  12. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/fixture.rb +178 -0
  13. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/gesture.rb +906 -0
  14. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/infologger.rb +604 -0
  15. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/key_press.rb +152 -0
  16. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/locale_db.rb +151 -0
  17. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/method.rb +85 -0
  18. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/multitouch.rb +455 -0
  19. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/os.rb +100 -0
  20. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/qt_api_method.rb +148 -0
  21. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/record.rb +124 -0
  22. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/screen_capture.rb +283 -0
  23. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/sut.rb +492 -0
  24. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/synchronization.rb +113 -0
  25. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/treewidgetitemcolumn.rb +93 -0
  26. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/type_text.rb +97 -0
  27. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/view_item.rb +97 -0
  28. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/webkit.rb +230 -0
  29. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/widget.rb +663 -0
  30. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/action.rb +30 -0
  31. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/configure_command.rb +38 -0
  32. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/drag.rb +44 -0
  33. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/find_object.rb +50 -0
  34. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/fixture.rb +45 -0
  35. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/group.rb +48 -0
  36. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/infologger_command.rb +38 -0
  37. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/qt.rb +170 -0
  38. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/tap.rb +54 -0
  39. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/widget.rb +226 -0
  40. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/application.rb +264 -0
  41. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/configure_command.rb +60 -0
  42. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/find_object.rb +114 -0
  43. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/fixture.rb +67 -0
  44. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/group.rb +52 -0
  45. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/infologger_command.rb +62 -0
  46. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/key_sequence.rb +99 -0
  47. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/screen_capture.rb +54 -0
  48. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/tap.rb +51 -0
  49. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/widget.rb +72 -0
  50. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/plugin.rb +119 -0
  51. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/sut/adapter.rb +225 -0
  52. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/sut/communication.rb +154 -0
  53. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/sut/controller.rb +58 -0
  54. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/util/fixture_parameter.rb +77 -0
  55. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/util/widget.rb +82 -0
  56. data/lib/testability-driver-qt-sut-plugin.rb +24 -0
  57. data/xml/behaviour/qt.xml +717 -0
  58. data/xml/defaults/sut_qt.xml +9 -0
  59. data/xml/keymap/qt.xml +321 -0
  60. data/xml/template/qt.xml +124 -0
  61. metadata +141 -0
@@ -0,0 +1,54 @@
1
+ ############################################################################
2
+ ##
3
+ ## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4
+ ## All rights reserved.
5
+ ## Contact: Nokia Corporation (testabilitydriver@nokia.com)
6
+ ##
7
+ ## This file is part of TDriver.
8
+ ##
9
+ ## If you have questions regarding the use of this file, please contact
10
+ ## Nokia at testabilitydriver@nokia.com .
11
+ ##
12
+ ## This library is free software; you can redistribute it and/or
13
+ ## modify it under the terms of the GNU Lesser General Public
14
+ ## License version 2.1 as published by the Free Software Foundation
15
+ ## and appearing in the file LICENSE.LGPL included in the packaging
16
+ ## of this file.
17
+ ##
18
+ ############################################################################
19
+
20
+ module MobyController
21
+
22
+ module QT
23
+
24
+ module ScreenCapture
25
+
26
+ def set_adapter( adapter )
27
+ @sut_adapter = adapter
28
+ end
29
+
30
+ def execute
31
+
32
+ @sut_adapter.send_service_request(
33
+ Comms::MessageGenerator.generate(
34
+ Nokogiri::XML::Builder.new{
35
+ TasCommands( :id=> 1, :service => "screenShot" ) {
36
+ Target( :TasId => 1, :type => "Application" ) {
37
+ Command( :name => "Screenshot", :format => @context.image_mime_type, :draw => @context.redraw.to_s )
38
+ }
39
+ }
40
+ }.to_xml
41
+ )
42
+ )
43
+
44
+ end
45
+
46
+ # enable hooking for performance measurement & debug logging
47
+ MobyUtil::Hooking.instance.hook_methods( self ) if defined?( MobyUtil::Hooking )
48
+
49
+
50
+ end # ScreenCapture
51
+
52
+ end # QT
53
+
54
+ end # MobyController
@@ -0,0 +1,51 @@
1
+ ############################################################################
2
+ ##
3
+ ## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4
+ ## All rights reserved.
5
+ ## Contact: Nokia Corporation (testabilitydriver@nokia.com)
6
+ ##
7
+ ## This file is part of TDriver.
8
+ ##
9
+ ## If you have questions regarding the use of this file, please contact
10
+ ## Nokia at testabilitydriver@nokia.com .
11
+ ##
12
+ ## This library is free software; you can redistribute it and/or
13
+ ## modify it under the terms of the GNU Lesser General Public
14
+ ## License version 2.1 as published by the Free Software Foundation
15
+ ## and appearing in the file LICENSE.LGPL included in the packaging
16
+ ## of this file.
17
+ ##
18
+ ############################################################################
19
+
20
+ module MobyController
21
+
22
+ module QT
23
+
24
+ module Tap
25
+
26
+ def set_adapter( adapter )
27
+ @sut_adapter = adapter
28
+ end
29
+
30
+ def execute
31
+
32
+ command_xml = Nokogiri::XML::Builder.new{
33
+ TasCommands( :service => "uiCommand" ) {
34
+ Target( :TasId => 1, :type => "Application" ) {
35
+ Command( :name => "TapScreen", :x => get_x, :y => get_y, :button => 1, :count => 1, :mouseMove => true, :useCoordinates => true, :time_to_hold => get_hold )
36
+ }
37
+ }
38
+ }.to_xml
39
+
40
+ @sut_adapter.send_service_request(Comms::MessageGenerator.generate(command_xml))
41
+
42
+ end
43
+
44
+ # enable hooking for performance measurement & debug logging
45
+ MobyUtil::Hooking.instance.hook_methods( self ) if defined?( MobyUtil::Hooking )
46
+
47
+ end # Tap
48
+
49
+ end # QT
50
+
51
+ end # MobyController
@@ -0,0 +1,72 @@
1
+ ############################################################################
2
+ ##
3
+ ## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4
+ ## All rights reserved.
5
+ ## Contact: Nokia Corporation (testabilitydriver@nokia.com)
6
+ ##
7
+ ## This file is part of TDriver.
8
+ ##
9
+ ## If you have questions regarding the use of this file, please contact
10
+ ## Nokia at testabilitydriver@nokia.com .
11
+ ##
12
+ ## This library is free software; you can redistribute it and/or
13
+ ## modify it under the terms of the GNU Lesser General Public
14
+ ## License version 2.1 as published by the Free Software Foundation
15
+ ## and appearing in the file LICENSE.LGPL included in the packaging
16
+ ## of this file.
17
+ ##
18
+ ############################################################################
19
+
20
+
21
+
22
+ module MobyController
23
+
24
+ module QT
25
+
26
+ module WidgetCommand
27
+
28
+ # Execute the command).
29
+ # Sends the message to the device using the @sut_adapter (see base class)
30
+ # == params
31
+ # == returns
32
+ # == raises
33
+ # NotImplementedError: raised if unsupported command type
34
+ def execute
35
+ command_params = {:eventType => get_event_type, :name => get_command_name}
36
+ command_params.merge!(get_command_params) if get_command_params
37
+
38
+ builder = Nokogiri::XML::Builder.new{
39
+ TasCommands( :id=> get_application_id, :transitions => get_transitions, :service => get_service || 'uiCommand' ) {
40
+ Target( :TasId => get_object_id, :type => get_object_type ) {
41
+ if get_command_value.kind_of? Array
42
+ get_command_value.each do | command_part |
43
+ Command( command_part[ :value ], command_part[ :params ] )
44
+ end
45
+ else
46
+ Command( get_command_value || "", command_params )
47
+ end
48
+ }
49
+ }
50
+ }
51
+
52
+ if @sut_adapter.group?
53
+ @sut_adapter.append_command(builder.doc.root.children)
54
+ else
55
+ @sut_adapter.send_service_request(Comms::MessageGenerator.generate(builder.to_xml))
56
+ end
57
+
58
+ end
59
+
60
+ def set_adapter( adapter )
61
+ @sut_adapter = adapter
62
+ end
63
+
64
+ # enable hooking for performance measurement & debug logging
65
+ MobyUtil::Hooking.instance.hook_methods( self ) if defined?( MobyUtil::Hooking )
66
+
67
+
68
+ end #module Action
69
+
70
+ end #module QT
71
+
72
+ end #module MobyController
@@ -0,0 +1,119 @@
1
+ ############################################################################
2
+ ##
3
+ ## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4
+ ## All rights reserved.
5
+ ## Contact: Nokia Corporation (testabilitydriver@nokia.com)
6
+ ##
7
+ ## This file is part of TDriver.
8
+ ##
9
+ ## If you have questions regarding the use of this file, please contact
10
+ ## Nokia at testabilitydriver@nokia.com .
11
+ ##
12
+ ## This library is free software; you can redistribute it and/or
13
+ ## modify it under the terms of the GNU Lesser General Public
14
+ ## License version 2.1 as published by the Free Software Foundation
15
+ ## and appearing in the file LICENSE.LGPL included in the packaging
16
+ ## of this file.
17
+ ##
18
+ ############################################################################
19
+
20
+ # verify that TDriver is loaded
21
+ Kernel::raise RuntimeError.new( "SUT plugin requires TDriver" ) unless (defined?( MATTI ) || defined?( TDriver ))
22
+
23
+ module MobyPlugin
24
+
25
+ module QT
26
+
27
+ class SUT < MobyUtil::Plugin
28
+
29
+ ## plugin configuration, constructor and deconstructor methods
30
+ def self.plugin_name
31
+
32
+ # return plugin name as string
33
+ "testability-driver-qt-sut-plugin"
34
+ #File.basename( __FILE__, '.rb' ).downcase # => "tdriver-qt-sut-plugin"
35
+
36
+ end
37
+
38
+ def self.plugin_type
39
+
40
+ # return plugin type as symbol
41
+ :sut
42
+
43
+ end
44
+
45
+ def self.register_plugin
46
+
47
+ # load plugin specific implementation or other initialization etc.
48
+ MobyUtil::FileHelper.load_modules(
49
+
50
+ # load utility module(s)
51
+ 'util/*.rb',
52
+
53
+ # sut adapter
54
+ 'sut/communication.rb',
55
+
56
+ # sut adapter
57
+ 'sut/adapter.rb',
58
+
59
+ # sut controller
60
+ 'sut/controller.rb',
61
+
62
+ # qt behaviour abstract
63
+ 'behaviours/behaviour.rb',
64
+
65
+ # load behaviour(s)
66
+ 'behaviours/*.rb',
67
+
68
+ # load command(s)
69
+ 'commands/*.rb',
70
+
71
+ # load command controller(s)
72
+ 'controllers/*.rb'
73
+
74
+ )
75
+
76
+ end
77
+
78
+ def self.unregister_plugin
79
+
80
+ # unregister plugin
81
+
82
+ end
83
+
84
+ ## plugin specific methods
85
+
86
+ # return sut type that plugin implements
87
+ def self.sut_type
88
+
89
+ # return sut type as string
90
+ "QT"
91
+
92
+ end
93
+
94
+ # returns SUT object - this method will be called from MobyBase::SUTFactory
95
+ def self.make_sut( sut_id )
96
+
97
+ # tcp/ip read/write timeouts, default: 15 (seconds)
98
+ socket_read_timeout = MobyUtil::Parameter[ sut_id ][ :socket_read_timeout, "15" ].to_i
99
+ socket_write_timeout = MobyUtil::Parameter[ sut_id ][ :socket_write_timeout, "15" ].to_i
100
+
101
+ MobyBase::SUT.new(
102
+ MobyBase::SutController.new( "QT", MobyController::QT::SutAdapter.new( sut_id, socket_read_timeout, socket_write_timeout ) ),
103
+ MobyBase::TestObjectFactory.instance,
104
+ sut_id
105
+ )
106
+
107
+ end
108
+
109
+ # enable hooking for performance measurement & debug logging
110
+ MobyUtil::Hooking.instance.hook_methods( self ) if defined?( MobyUtil::Hooking )
111
+
112
+ # register plugin
113
+ MobyUtil::PluginService.instance.register_plugin( self ) # Note: self is MobyPlugin::QT::SUT
114
+
115
+ end # SUT
116
+
117
+ end # QT
118
+
119
+ end # MobyPlugin
@@ -0,0 +1,225 @@
1
+ ############################################################################
2
+ ##
3
+ ## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4
+ ## All rights reserved.
5
+ ## Contact: Nokia Corporation (testabilitydriver@nokia.com)
6
+ ##
7
+ ## This file is part of TDriver.
8
+ ##
9
+ ## If you have questions regarding the use of this file, please contact
10
+ ## Nokia at testabilitydriver@nokia.com .
11
+ ##
12
+ ## This library is free software; you can redistribute it and/or
13
+ ## modify it under the terms of the GNU Lesser General Public
14
+ ## License version 2.1 as published by the Free Software Foundation
15
+ ## and appearing in the file LICENSE.LGPL included in the packaging
16
+ ## of this file.
17
+ ##
18
+ ############################################################################
19
+
20
+ module MobyController
21
+
22
+ module QT
23
+
24
+ # Sut adapter that used TCP/IP connections to send and receive data from QT side.
25
+ class SutAdapter < MobyController::SutAdapter
26
+
27
+ attr_reader :sut_id
28
+
29
+ attr_accessor(
30
+
31
+ :socket_read_timeout,
32
+ :socket_write_timeout,
33
+ :socket_received_bytes,
34
+ :socket_sent_bytes
35
+
36
+ )
37
+
38
+ # TODO: better way to set the host and port parameters
39
+ # Initialize the tcp adapter for communicating with the device.
40
+ # Communication is done using two tcp channels one form commanding
41
+ # the device and one for receiving ui state data.
42
+ # UI state data receivin is done in a seprate thread so it is good
43
+ # once usage is complete the shutdown_comms is called
44
+ # == params
45
+ # sut_id id for the sut so that client details can be fetched from params
46
+ def initialize( sut_id, receive_timeout = 25, send_timeout = 25 )
47
+
48
+ @socket = nil
49
+ @connected = false
50
+ @socket_received_bytes=0
51
+ @socket_sent_bytes=0
52
+
53
+ @sut_id = sut_id
54
+
55
+ # set timeouts
56
+ @socket_read_timeout = receive_timeout
57
+ @socket_write_timeout = send_timeout
58
+
59
+ @counter = rand( 1000 )
60
+
61
+ # connect socket
62
+ #connect( @sut_id )
63
+
64
+ end
65
+
66
+ def disconnect
67
+
68
+ @socket.close if @connected
69
+
70
+ @connected = false
71
+
72
+ end
73
+
74
+ def connect( id = nil )
75
+
76
+ id ||= @sut_id
77
+
78
+ begin
79
+
80
+ @socket = TCPSocket.open( MobyUtil::Parameter[ id ][ :qttas_server_ip ], MobyUtil::Parameter[ id ][ :qttas_server_port ].to_i )
81
+
82
+ rescue => ex
83
+
84
+ ip = "no ip" if ( ip = MobyUtil::Parameter[ id ][ :qttas_server_ip, "" ] ).empty?
85
+ port = "no port" if ( port = MobyUtil::Parameter[ id ][ :qttas_server_port, "" ] ).empty?
86
+
87
+ Kernel::raise IOError.new("Unable to connect QTTAS server, verify that it is running properly (#{ ip }:#{ port }): .\nException: #{ ex.message }")
88
+ end
89
+
90
+ @connected = true
91
+
92
+ end
93
+
94
+ def group?
95
+ @_group
96
+ end
97
+
98
+ # Set the document builder for the grouped behaviour message.
99
+ def set_message_builder(builder)
100
+ @_group = true
101
+ @_builder = builder
102
+ end
103
+
104
+ def append_command(node_list)
105
+ node_list.each {|ch| @_builder.doc.root.add_child(ch)}
106
+ end
107
+
108
+ # Sends a grouped command message to the server. Sets group to false and nils the builder
109
+ # to prevent future behviours of being grouped (unless so wanted)
110
+ # == returns
111
+ # the amout of commands grouped (and send)
112
+ def send_grouped_request
113
+ @_group = false
114
+ size = @_builder.doc.root.children.size
115
+ send_service_request(Comms::MessageGenerator.generate(@_builder.to_xml))
116
+ @_builder = nil
117
+ size
118
+ end
119
+
120
+ # Send the message to the qt server
121
+ # If there is no exception propagated the send to the device was successful
122
+ # == params
123
+ # message:: message in qttas protocol format
124
+ # == returns
125
+ # the response body
126
+ def send_service_request( message, return_crc = false )
127
+
128
+ connect if !@connected
129
+
130
+ # set request message id
131
+ message.message_id = ( @counter += 1 )
132
+
133
+ # write request message to socket
134
+ write_socket( message.make_binary_message(@counter) )
135
+
136
+ # read response to determine was the message handled properly and parse the header
137
+ # header[ 0 ] = command_flag
138
+ # header[ 1 ] = body_size
139
+ # header[ 2 ] = crc
140
+ # header[ 3 ] = compression_flag
141
+ # header[ 4 ] = message_id
142
+ header = nil
143
+ body = nil
144
+
145
+ read_message_id = 0
146
+ until read_message_id == @counter
147
+ header = read_socket( 12 ).unpack( 'CISCI' )
148
+
149
+ # read the message body and compare crc checksum
150
+ Kernel::raise IOError.new( "CRC do not match. Maybe the message is corrupted!" ) if CRC::Crc16.crc16_ibm( body = read_socket( header[ 1 ] ) , 0xffff ) != header[ 2 ]
151
+
152
+ # validate response message; check that response message id matches the request
153
+ # if smaller than expected try to read the next message but if bigger raise error
154
+ read_message_id = header[ 4 ]
155
+ if read_message_id < @counter
156
+ MobyUtil::Logger.instance.log "warning" , "Response to request did not match: \"#{ header[ 4 ].to_s }\"<\"#{ @counter.to_s }\""
157
+ elsif read_message_id > @counter
158
+ MobyUtil::Logger.instance.log "fatal" , "Response to request did not match: \"#{ header[ 4 ].to_s }\">\"#{ @counter.to_s }\""
159
+ # save to file?
160
+ MobyUtil::Logger.instance.log "fatal" , body
161
+ Kernel::raise RuntimeError.new( "Response to request did not match: \"#{ header[ 4 ].to_s }\"!=\"#{ @counter.to_s }\"" )
162
+ end
163
+ end
164
+
165
+ # inflate the message body if compressed
166
+ if ( header[ 3 ] == 2 )
167
+
168
+ body = Zlib::Inflate.inflate( body ) unless ( body = body[ 4..-1 ] ).empty?
169
+
170
+ end
171
+
172
+ # raise exception if messages error flag is set
173
+ # Flag statuses:
174
+ # 0 -> ERROR_MSG
175
+ # 1 -> VALID_MSG
176
+ # 2 -> OK_MESSAGE
177
+ Kernel::raise RuntimeError.new( body ) if header[ 0 ] == 0
178
+
179
+ # return the body ( and crc if required )
180
+ return_crc ? [ body, header[ 2 ] ] : body
181
+
182
+ end
183
+
184
+ private
185
+
186
+ def read_socket( bytes_count )
187
+
188
+ # store time before start receving data
189
+ start_time = Time.now
190
+
191
+ # verify that there is data available to be read
192
+ Kernel::raise IOError.new( "Socket reading timeout (%i) exceeded for %i bytes" % [ @socket_read_timeout, bytes_count ] ) if TCPSocket::select( [ @socket ], nil, nil, @socket_read_timeout ).nil?
193
+
194
+ # read data from socket
195
+ read_buffer = @socket.read( bytes_count ){
196
+
197
+ Kernel::raise IOError.new( "Socket reading timeout (%i) exceeded for %i bytes" % [ @socket_read_timeout, bytes_count ] ) if ( Time.now - start_time ) > @socket_read_timeout
198
+
199
+ }
200
+
201
+ Kernel::raise IOError.new( "Socket reading error for %i bytes - No data retrieved" % [ bytes_count ] ) if read_buffer.nil?
202
+ @socket_received_bytes+=read_buffer.size
203
+ read_buffer
204
+
205
+ end
206
+
207
+ def write_socket( data )
208
+ @socket_sent_bytes+=data.size
209
+
210
+ @socket.write( data )
211
+
212
+ # verify that there is no data in writing buffer
213
+ Kernel::raise IOError.new( "Socket writing timeout (%i) exceeded for %i bytes" % [ @socket_write_timeout, data.length ] ) if TCPSocket::select( nil, [ @socket ], nil, @socket_write_timeout ).nil?
214
+
215
+ end
216
+
217
+ # enable hooking for performance measurement & debug logging
218
+ MobyUtil::Hooking.instance.hook_methods( self ) if defined?( MobyUtil::Hooking )
219
+
220
+
221
+ end # SutAdapter
222
+
223
+ end # QT
224
+
225
+ end # MobyController