testability-driver-qt-sut-plugin 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -52,9 +52,13 @@ module MobyBehaviour
52
52
  # == arguments
53
53
  # attribute
54
54
  # String
55
- # description: Name of the attribute to be set
55
+ # description: Name of the attribute to be set as string
56
56
  # example: "text"
57
57
  #
58
+ # Symbol
59
+ # description: Name of the attribute to be set as symbol
60
+ # example: :text
61
+ #
58
62
  # value
59
63
  # String
60
64
  # description: New value of the attribute.
@@ -64,10 +68,26 @@ module MobyBehaviour
64
68
  # description: New value of the attribute.
65
69
  # example: 200
66
70
  #
67
- # Boolean
71
+ # TrueClass
68
72
  # description: New value of the attribute.
69
73
  # example: true
70
74
  #
75
+ # FalseClass
76
+ # description: New value of the attribute.
77
+ # example: false
78
+ #
79
+ # Date
80
+ # description: New value of the attribute.
81
+ # example: Date.today
82
+ #
83
+ # Time
84
+ # description: New value of the attribute.
85
+ # example: Time.now
86
+ #
87
+ # DateTime
88
+ # description: New value of the attribute.
89
+ # example: DateTime.now
90
+ #
71
91
  # type
72
92
  # String
73
93
  # description: Type of the value. If this argument is not given, the type will be detected based on the class of the value argument.
@@ -94,13 +114,27 @@ module MobyBehaviour
94
114
  # description: One of the arguments is not valid
95
115
  # RuntimeError
96
116
  # description: Setting of the attribute failed
97
- def set_attribute(attribute, value, type = nil)
117
+ def set_attribute( attribute, value, type = nil )
118
+
119
+ # verify attribute argument variable type
120
+ attribute.check_type [ Symbol, String ], 'wrong argument type $1 for attribute name (expected $2)'
121
+
122
+ # verify type argument variable type
123
+ type.check_type [ NilClass, String ], 'wrong argument type $1 for attribute type (expected $2)'
124
+
125
+ # convert symbol to string
126
+ attribute = attribute.to_s if attribute.kind_of?( Symbol )
98
127
 
99
- Kernel::raise ArgumentError.new( "Attribute-name was empty" ) if attribute.empty?
100
- Kernel::raise ArgumentError.new( "Argument type must be nil or a non empty String." ) unless type.nil? || ( type.kind_of?( String ) && !type.empty? )
128
+ # raise exception if attribute name was not given
129
+ attribute.not_empty 'attribute name cannot be be empty string'
130
+
131
+ type.not_empty 'argument type must be either nil or non empty string' if type.kind_of?( String )
132
+
133
+ # in qt_behaviour
134
+ command = command_params
101
135
 
102
- command = command_params #in qt_behaviour
103
136
  command.transitions_off
137
+
104
138
  command.command_name( 'SetAttribute' )
105
139
 
106
140
  case type
@@ -0,0 +1,300 @@
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 MobyBehaviour
21
+
22
+ module QT
23
+
24
+ # == description
25
+ #
26
+ # == behaviour
27
+ # QtSettings
28
+ #
29
+ # == requires
30
+ # testability-driver-qt-sut-plugin
31
+ #
32
+ # == input_type
33
+ # *
34
+ #
35
+ # == sut_type
36
+ # QT
37
+ #
38
+ # == sut_version
39
+ # *
40
+ #
41
+ # == objects
42
+ # *
43
+ #
44
+ module Settings
45
+
46
+ include MobyBehaviour::QT::Behaviour
47
+
48
+
49
+ # == description
50
+ # Sets the given settings to the settings storage defined in the setting indentifiers.
51
+ # QSettings documentation will give more information on how the settigns are created
52
+ # and accessed.
53
+ #
54
+ # == arguments
55
+ # identifiers
56
+ # Hash
57
+ # description: Idenfifiers for the settings. See QSettings documentations for details on how
58
+ # settings are accessed. You can use either direct file name or organization and
59
+ # application name way to access and edit the settings.
60
+ # See [link="#identifier_params_table1"]file path access [/link] and
61
+ # [link="#identifier_params_table2"]registry access [/link] on how
62
+ # specify the idenfitication details for the settings to be accessed.
63
+ #
64
+ # example: File name: {:fileName => '/etc/init/settings.ini', :format => 'Ini'}
65
+ # Registry: {:organization => 'Tdriver', :application => 'qttasserver'}
66
+ #
67
+ # values
68
+ # Hash
69
+ # description: Setting values to be edited (key and value)
70
+ # example: {:setting => 'value'}
71
+ #
72
+ # == tables
73
+ # identifier_params_table1
74
+ # title: Hash argument when using file path
75
+ # description: Valid values when using filepath to access settings.
76
+ # |Key|Description|Example|
77
+ # |:fileName|Settings file name or path to registry|:fileName => '/etc/init/settings.ini'|
78
+ # |:format|Settings storage format. Possible values: Ini, Native, Invalid|:format => 'Ini'|
79
+ #
80
+ # identifier_params_table2
81
+ # title: Hash argument when using registry type access to settings
82
+ # description: Valid values when using registry type way to access settings.
83
+ # |Key|Description|Example|
84
+ # |:organization|Organization for the settings|:organization => 'MySoft'|
85
+ # |:application|Application using the settings|:application => 'MyApp'|
86
+ # |:format|Settings storage format. Possible values: ini, native, invalid. Defaults to Native if not set.|:format => 'native'|
87
+ # |:scope|Scope of the settings. User specific or system wide. Possible values: user, system. Defaults to user.|:scope => 'system'|
88
+ #
89
+ # == returns
90
+ # NilClass
91
+ # description: -
92
+ # example: -
93
+ #
94
+ # == exceptions
95
+ # ArgumentError
96
+ # description: In case the given parameters are not valid.
97
+ #
98
+ def set_settings(identifiers, values)
99
+
100
+ begin
101
+ raise ArgumentError.new("No values to set") unless values
102
+
103
+ params = generate_fixture_params(identifiers, values)
104
+
105
+ self.fixture('setting', 'set', params)
106
+
107
+ rescue Exception => e
108
+
109
+ $logger.log "behaviour" , "FAIL;Failed set settings \"#{identifiers.to_s}\", \"#{values.to_s}\".;set_settings;"
110
+ Kernel::raise e
111
+
112
+ end
113
+
114
+ $logger.log "behaviour" , "PASS;Operation set settings executed successfully \"#{identifiers.to_s}\", \"#{values.to_s}\".;set_settings;"
115
+
116
+ nil
117
+ end
118
+
119
+
120
+ # == description
121
+ # Remove the settings corresponding to the given keys from the settings idenfitied by
122
+ # the identifiers.
123
+ #
124
+ # == arguments
125
+ # identifiers
126
+ # Hash
127
+ # description: Idenfifiers for the settings. See QSettings documentations for details on how
128
+ # settings are accessed. You can use either direct file name or organization and
129
+ # application name way to access and edit the settings.
130
+ # See [link="#identifier_params_table1"]file path access [/link] and
131
+ # [link="#identifier_params_table2"]registry access [/link] on how
132
+ # specify the idenfitication details for the settings to be accessed.
133
+ #
134
+ # example: File name: {:fileName => '/etc/init/settings.ini', :format => 'Ini'}
135
+ # Registry: {:organization => 'Tdriver', :application => 'qttasserver'}
136
+ #
137
+ # setting_keys
138
+ # Array
139
+ # description: Array of settings keys which are to be removed.
140
+ # example: [setting1, setting2]
141
+ #
142
+ # == returns
143
+ # NilClass
144
+ # description: -
145
+ # example: -
146
+ #
147
+ # == exceptions
148
+ # ArgumentError
149
+ # description: In case the given parameters are not valid.
150
+ #
151
+ def remove_settings(identifiers, setting_keys)
152
+ begin
153
+ raise ArgumentError.new("No settings to remove") unless setting_keys
154
+
155
+ params = generate_fixture_params(identifiers, nil)
156
+ setting_keys.each{|value| params[value.to_sym] = ''}
157
+
158
+ self.fixture('setting', 'remove', params)
159
+
160
+ rescue Exception => e
161
+
162
+ $logger.log "behaviour" , "FAIL;Failed remove settings \"#{identifiers.to_s}\", \"#{setting_keys.to_s}\".;remove_settings;"
163
+ Kernel::raise e
164
+
165
+ end
166
+
167
+ $logger.log "behaviour" , "PASS;Operation remove settings executed successfully \"#{identifiers.to_s}\", \"#{setting_keys.to_s}\".;remove_settings;"
168
+
169
+ nil
170
+
171
+ end
172
+
173
+ # == description
174
+ # Read the setting values corresponding to the given keys from the settings idenfitied by
175
+ # the identifiers.
176
+ #
177
+ # == arguments
178
+ # identifiers
179
+ # Hash
180
+ # description: Idenfifiers for the settings. See QSettings documentations for details on how
181
+ # settings are accessed. You can use either direct file name or organization and
182
+ # application name way to access and edit the settings.
183
+ # See [link="#identifier_params_table1"]file path access [/link] and
184
+ # [link="#identifier_params_table2"]registry access [/link] on how
185
+ # specify the idenfitication details for the settings to be accessed.
186
+ #
187
+ # example: File name: {:fileName => '/etc/init/settings.ini', :format => 'Ini'}
188
+ # Registry: {:organization => 'Tdriver', :application => 'qttasserver'}
189
+ #
190
+ # setting_keys
191
+ # Array
192
+ # description: Array of settings keys which are to be removed.
193
+ # example: [setting1, setting2]
194
+ #
195
+ # == returns
196
+ # Hash
197
+ # description: Hash table with key value pairs for the settings read.
198
+ # example: {:setting => 'value'}
199
+ #
200
+ # == exceptions
201
+ # ArgumentError
202
+ # description: In case the given parameters are not valid.
203
+ #
204
+ def read_settings(identifiers, setting_keys)
205
+ hash = nil
206
+ begin
207
+ raise ArgumentError.new("No settings to read") unless setting_keys
208
+
209
+ params = generate_fixture_params(identifiers, nil)
210
+ setting_keys.each{|value| params[value.to_sym] = ''}
211
+
212
+ hash = eval(self.fixture('setting', 'read', params))
213
+
214
+ rescue Exception => e
215
+
216
+ $logger.log "behaviour" , "FAIL;Failed read settings \"#{identifiers.to_s}\", \"#{setting_keys.to_s}\".;read_settings;"
217
+ Kernel::raise e
218
+
219
+ end
220
+
221
+ $logger.log "behaviour" , "PASS;Operation read settings executed successfully \"#{identifiers.to_s}\", \"#{setting_keys.to_s}\".;read_settings;"
222
+
223
+ hash
224
+
225
+ end
226
+
227
+ # == description
228
+ # Read the all the setting values from the settings idenfitied by
229
+ # the identifiers.
230
+ #
231
+ # == arguments
232
+ # identifiers
233
+ # Hash
234
+ # description: Idenfifiers for the settings. See QSettings documentations for details on how
235
+ # settings are accessed. You can use either direct file name or organization and
236
+ # application name way to access and edit the settings.
237
+ # See [link="#identifier_params_table1"]file path access [/link] and
238
+ # [link="#identifier_params_table2"]registry access [/link] on how
239
+ # specify the idenfitication details for the settings to be accessed.
240
+ #
241
+ # example: File name: {:fileName => '/etc/init/settings.ini', :format => 'Ini'}
242
+ # Registry: {:organization => 'Tdriver', :application => 'qttasserver'}
243
+ #
244
+ #
245
+ # == returns
246
+ # Hash
247
+ # description: Hash table with key value pairs for the settings read.
248
+ # example: {:setting => 'value'}
249
+ #
250
+ # == exceptions
251
+ # ArgumentError
252
+ # description: In case the given parameters are not valid.
253
+ #
254
+ def read_all_settings(identifiers)
255
+ hash = nil
256
+ begin
257
+
258
+ params = generate_fixture_params(identifiers, nil)
259
+ hash = eval(self.fixture('setting', 'readAll', params))
260
+
261
+ rescue Exception => e
262
+
263
+ $logger.log "behaviour" , "FAIL;Failed read all settings \"#{identifiers.to_s}\".;read_all_settings;"
264
+ Kernel::raise e
265
+
266
+ end
267
+
268
+ $logger.log "behaviour" , "PASS;Operation read all settings executed successfully \"#{identifiers.to_s}\".;read_all_settings;"
269
+
270
+ hash
271
+
272
+ end
273
+
274
+ private
275
+
276
+ def generate_fixture_params(identifiers, params)
277
+
278
+ raise ArgumentError.new("No enough information to access settings. Define filename or organization") unless identifiers[:fileName] or identifiers[:organization]
279
+ raise ArgumentError.new("Cannot define both fileName and organization.") if identifiers[:fileName] and identifiers[:organization]
280
+
281
+ fixture_params = Hash.new
282
+ fixture_params[:settingFileName] = identifiers[:fileName] if identifiers[:fileName]
283
+ fixture_params[:settingOrganization] = identifiers[:organization] if identifiers[:organization]
284
+
285
+ fixture_params[:settingApplication] = identifiers[:application] if identifiers[:application]
286
+ fixture_params[:settingFormat] = identifiers[:format] if identifiers[:format]
287
+ fixture_params[:settingScope] = identifiers[:scope] if identifiers[:scope]
288
+ fixture_params.merge!(params) if params
289
+ fixture_params
290
+ end
291
+
292
+ # enable hooking for performance measurement & debug logging
293
+ TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
294
+
295
+
296
+ end # Settings
297
+
298
+ end
299
+
300
+ end # MobyBase
@@ -1,3 +1,4 @@
1
+ # -*- coding: utf-8 -*-
1
2
  ############################################################################
2
3
  ##
3
4
  ## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
@@ -116,11 +117,11 @@ module MobyBehaviour
116
117
  begin
117
118
  # execute the application control service request
118
119
  apps = execute_command( MobyCommand::Application.new( :ListStartedApps ) )
119
- MobyUtil::Logger.instance.log "behaviour", "PASS;Successfully listed applications.;#{ id };sut;{};list_started_apps;"
120
+ $logger.log "behaviour", "PASS;Successfully listed applications.;#{ id };sut;{};list_started_apps;"
120
121
 
121
122
  rescue Exception => e
122
123
 
123
- MobyUtil::Logger.instance.log "behaviour", "FAIL;Failed to list applications.;#{ id };sut;{};list_started_apps;"
124
+ $logger.log "behaviour", "FAIL;Failed to list applications.;#{ id };sut;{};list_started_apps;"
124
125
  Kernel::raise RuntimeError.new( "Unable to list started applications: Exception: #{ e.message } (#{ e.class })" )
125
126
 
126
127
  end
@@ -189,6 +190,7 @@ module MobyBehaviour
189
190
  # RuntimeError
190
191
  # description: Timeout of %s seconds reached. %s
191
192
  def execute_shell_command(command, param = { :detached => "false"} )
193
+
192
194
  Kernel::raise ArgumentError.new("The command argument must be a non empty String.") unless ( command.kind_of?( String ) and !command.empty? )
193
195
  Kernel::raise ArgumentError.new("The parameters argumet must be a Hash.") unless ( param.kind_of?(Hash) )
194
196
 
@@ -201,29 +203,36 @@ module MobyBehaviour
201
203
  # Launch the program execution into the background, wait for it to finish.
202
204
  if param[:wait].to_s == "true"
203
205
  param[:threaded] = "true"
204
- pid = execute_command( MobyCommand::Application.new( :Shell, command, nil, nil, nil, nil, nil, nil, param ) ).to_i
206
+
207
+ #pid = execute_command( MobyCommand::Application.new( :Shell, command, nil, nil, nil, nil, nil, nil, param ) ).to_i
208
+
209
+ pid = execute_command( MobyCommand::Application.new( :Shell, { :application_name => command, :flags => param } ) ).to_i
210
+
205
211
  data = ""
206
212
  if pid != 0
207
- time = Time.new + timeout
208
- while true
209
- obj = shell_command(pid)
210
- sleep 1
211
- data += obj['output']
212
- if Time.new > time
213
- command_params = {:kill => 'true'}
214
- command_output = shell_command(pid, command_params)['output']
215
- Kernel::raise RuntimeError.new( "Timeout of #{timeout.to_s} seconds reached. #{command_output}")
216
- elsif obj['status'] == "RUNNING"
217
- next
218
- else
219
- break
213
+ time = Time.new + timeout
214
+ while true
215
+ obj = shell_command(pid)
216
+ sleep 1
217
+ data += obj['output']
218
+ if Time.new > time
219
+ command_params = {:kill => 'true'}
220
+ command_output = shell_command(pid, command_params)['output']
221
+ Kernel::raise RuntimeError.new( "Timeout of #{timeout.to_s} seconds reached. #{command_output}")
222
+ elsif obj['status'] == "RUNNING"
223
+ next
224
+ else
225
+ break
226
+ end
220
227
  end
221
228
  end
222
- end
223
229
  return data
224
230
  end
225
231
 
226
- return execute_command( MobyCommand::Application.new( :Shell, command, nil, nil, nil, nil, nil, nil, param ) ).to_s
232
+ #return execute_command( MobyCommand::Application.new( :Shell, command, nil, nil, nil, nil, nil, nil, nil, param ) ).to_s
233
+
234
+ return execute_command( MobyCommand::Application.new( :Shell, { :application_name => command, :flags => param } ) ).to_s
235
+
227
236
  end
228
237
 
229
238
  # == description
@@ -260,7 +269,11 @@ module MobyBehaviour
260
269
  def shell_command(pid, param = {} )
261
270
  Kernel::raise ArgumentError.new("pid argument should be positive integer.") unless pid.to_i > 0
262
271
  param[ :status ] = 'true'
263
- xml_source = execute_command( MobyCommand::Application.new( :Shell, pid.to_s, nil, nil, nil, nil, nil, nil, param ) ).to_s
272
+
273
+ #xml_source = execute_command( MobyCommand::Application.new( :Shell, pid.to_s, nil, nil, nil, nil, nil, nil, nil, param ) ).to_s
274
+
275
+ xml_source = execute_command( MobyCommand::Application.new( :Shell, { :application_name => pid.to_s, :flags => param } ) ).to_s
276
+
264
277
  if param[:kill].nil?
265
278
  xml = Nokogiri::XML(xml_source)
266
279
  data = {}
@@ -314,12 +327,12 @@ module MobyBehaviour
314
327
 
315
328
  rescue Exception => e
316
329
 
317
- MobyUtil::Logger.instance.log "behaviour" , "FAIL;Failed to find application.;#{id.to_s};sut;{};application;" << (hash_uid.kind_of?(Hash) ? hash_uid.inspect : hash_uid.class.to_s)
330
+ $logger.log "behaviour" , "FAIL;Failed to find application.;#{id.to_s};sut;{};application;" << (hash_uid.kind_of?(Hash) ? hash_uid.inspect : hash_uid.class.to_s)
318
331
  Kernel::raise e
319
332
 
320
333
  end
321
334
 
322
- MobyUtil::Logger.instance.log "behaviour" , "PASS;Application found.;#{id.to_s};sut;{};application;" << hash_uid.inspect
335
+ $logger.log "behaviour" , "PASS;Application found.;#{id.to_s};sut;{};application;" << hash_uid.inspect
323
336
 
324
337
  app_child
325
338
 
@@ -334,8 +347,13 @@ module MobyBehaviour
334
347
  # example: -
335
348
  # == exceptions
336
349
  def system_information
337
- xml_source = execute_command( MobyCommand::Application.new( :SystemInfo, nil) )
350
+
351
+ # xml_source = execute_command( MobyCommand::Application.new( :SystemInfo, nil) )
352
+
353
+ xml_source = execute_command( MobyCommand::Application.new( :SystemInfo ) )
354
+
338
355
  MobyBase::StateObject.new( xml_source )
356
+
339
357
  end
340
358
 
341
359
  # == description
@@ -492,18 +510,34 @@ module MobyBehaviour
492
510
  def log_process_mem_start(thread_name, file_name = nil, timestamp_type = nil, interval_s = nil)
493
511
  status = nil
494
512
  begin
513
+
514
+ =begin
495
515
  status = execute_command(
496
516
  MobyCommand::Application.new(
497
517
  :ProcessMemLoggingStart,
498
518
  thread_name,
499
519
  nil, nil, nil, nil, nil, nil,
500
520
  {:file_name => file_name, :timestamp => timestamp_type, :interval_s => interval_s} ) )
521
+ =end
522
+
523
+ status = execute_command(
524
+ MobyCommand::Application.new(
525
+ :ProcessMemLoggingStart,
526
+ { :application_name => thread_name, :flags => { :file_name => file_name, :timestamp => timestamp_type, :interval_s => interval_s } }
527
+ )
528
+ )
529
+
501
530
  $logger.log "behaviour", "PASS;Successfully started process memory logging.;#{ id };sut;{};log_process_mem_start;"
531
+
502
532
  rescue Exception => e
533
+
503
534
  $logger.log "behaviour", "FAIL;Failed to start process memory logging.;#{ id };sut;{};log_process_mem_start;"
504
535
  Kernel::raise RuntimeError.new( "Unable to start process memory logging: Exception: #{ e.message } (#{ e.class })" )
536
+
505
537
  end
538
+
506
539
  status
540
+
507
541
  end
508
542
 
509
543
  # == nodoc
@@ -533,12 +567,23 @@ module MobyBehaviour
533
567
  def log_process_mem_stop(thread_name, return_data = nil)
534
568
  log = nil
535
569
  begin
570
+
571
+ =begin
536
572
  log = execute_command(
537
573
  MobyCommand::Application.new(
538
574
  :ProcessMemLoggingStop,
539
575
  thread_name,
540
576
  nil, nil, nil, nil, nil, nil,
541
577
  {:return_data => return_data} ) )
578
+ =end
579
+
580
+ log = execute_command(
581
+ MobyCommand::Application.new(
582
+ :ProcessMemLoggingStop,
583
+ { :application_name => thread_name, :flags => { :return_data => return_data } }
584
+ )
585
+ )
586
+
542
587
  $logger.log "behaviour", "PASS;Successfully stopped process memory logging.;#{ id };sut;{};log_process_mem_stop;"
543
588
  rescue Exception => e
544
589
  $logger.log "behaviour", "FAIL;Failed to stop process memory logging.;#{ id };sut;{};log_process_mem_stop;"
@@ -564,18 +609,34 @@ module MobyBehaviour
564
609
  # description: -
565
610
  # example: -
566
611
  #
567
- def cpu_load_start(load)
612
+ def cpu_load_start( cpu_load )
568
613
  begin
614
+
615
+ =begin
569
616
  status = execute_command(
570
617
  MobyCommand::Application.new(
571
618
  :CpuLoadStart,
572
619
  nil, nil, nil, nil, nil, nil, nil,
573
- {:cpu_load => load} ) )
620
+ {:cpu_load => cpu_load} ) )
621
+ =end
622
+
623
+ status = execute_command(
624
+ MobyCommand::Application.new(
625
+ :CpuLoadStart,
626
+ { :flags => { :cpu_load => cpu_load } }
627
+ )
628
+ )
629
+
574
630
  $logger.log "behaviour", "PASS;Successfully started generating CPU load.;#{ id };sut;{};cpu_load_start;"
631
+
575
632
  rescue Exception => e
633
+
576
634
  $logger.log "behaviour", "FAIL;Failed to start generating CPU load.;#{ id };sut;{};cpu_load_start;"
635
+
577
636
  Kernel::raise RuntimeError.new( "Unable to start generating CPU load: Exception: #{ e.message } (#{ e.class })" )
637
+
578
638
  end
639
+
579
640
  end
580
641
 
581
642
  # == description
@@ -644,7 +705,7 @@ module MobyBehaviour
644
705
  # the behaviour returns the amout of behaviours
645
706
  # sleep to avoid sending messages to the app untill the
646
707
  # commands have been executed
647
- sleep (ret*interval)
708
+ sleep ( ret * interval )
648
709
 
649
710
  $logger.log "behaviour", "PASS;Successfully executed grouped behaviours.;#{ id };sut;{};group_behaviours;"
650
711
  rescue Exception => e
@@ -688,7 +749,6 @@ module MobyBehaviour
688
749
 
689
750
  # enable hooking for performance measurement & debug logging
690
751
  TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
691
-
692
752
  end
693
753
 
694
754
  end
@@ -34,9 +34,10 @@ module MobyPlugin
34
34
  ## plugin configuration, constructor and deconstructor methods
35
35
  def self.plugin_name
36
36
 
37
+ #File.basename( __FILE__, '.rb' ).downcase # => "tdriver-qt-sut-plugin"
38
+
37
39
  # return plugin name as string
38
40
  "testability-driver-qt-sut-plugin"
39
- #File.basename( __FILE__, '.rb' ).downcase # => "tdriver-qt-sut-plugin"
40
41
 
41
42
  end
42
43
 
@@ -52,19 +53,19 @@ module MobyPlugin
52
53
  # load plugin specific implementation or other initialization etc.
53
54
  MobyUtil::FileHelper.load_modules(
54
55
 
55
- # load utility module(s)
56
+ # load utility modules
56
57
  'util/*.rb',
57
58
 
58
- # sut adapter
59
+ # sut communication class
59
60
  'sut/communication.rb',
60
61
 
61
- # sut adapter
62
+ # sut adapter class
62
63
  'sut/adapter.rb',
63
64
 
64
65
  # sut controller
65
66
  'sut/controller.rb',
66
67
 
67
- # qt behaviour abstract
68
+ # qt behaviour abstraction class
68
69
  'behaviours/behaviour.rb',
69
70
 
70
71
  # load behaviour(s)
@@ -99,13 +100,34 @@ module MobyPlugin
99
100
  # returns SUT object - this method will be called from MobyBase::SUTFactory
100
101
  def self.make_sut( sut_id )
101
102
 
102
- # tcp/ip read/write timeouts, default: 15 (seconds)
103
- socket_read_timeout = $parameters[ sut_id ][ :socket_read_timeout, "15" ].to_i
104
- socket_write_timeout = $parameters[ sut_id ][ :socket_write_timeout, "15" ].to_i
105
-
103
+ # create sut object
106
104
  MobyBase::SUT.new(
107
- MobyBase::SutController.new( "QT", MobyController::QT::SutAdapter.new( sut_id, socket_read_timeout, socket_write_timeout ) ),
108
- MobyBase::TestObjectFactory.instance,
105
+
106
+ # create controller for sut
107
+ MobyBase::SutController.new(
108
+
109
+ # controller id
110
+ "QT",
111
+
112
+ # create sut adapter
113
+ MobyController::QT::SutAdapter.new(
114
+
115
+ # sut id
116
+ sut_id,
117
+
118
+ # tcp/ip read timeouts, default: 15 (seconds)
119
+ $parameters[ sut_id ][ :socket_read_timeout, "15" ].to_i,
120
+
121
+ # tcp/ip write timeouts, default: 15 (seconds)
122
+ $parameters[ sut_id ][ :socket_write_timeout, "15" ].to_i
123
+ )
124
+
125
+ ),
126
+
127
+ # pass test object factory class
128
+ MobyBase::TestObjectFactory.instance,
129
+
130
+ # pass sut id
109
131
  sut_id
110
132
  )
111
133
 
@@ -115,7 +137,7 @@ module MobyPlugin
115
137
  TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
116
138
 
117
139
  # register plugin
118
- MobyUtil::PluginService.instance.register_plugin( self ) # Note: self is MobyPlugin::QT::SUT
140
+ TDriver::PluginService.register_plugin( self )
119
141
 
120
142
  end # SUT
121
143
 
@@ -203,10 +203,14 @@ module MobyController
203
203
  # inflate the message body if compressed
204
204
  if ( header[ 3 ] == 2 )
205
205
 
206
- # remove leading 4 bytes
207
- body = body[ 4 .. -1 ]
208
-
209
- body = Zlib::Inflate.inflate( body ) unless body.empty?
206
+ if $parameters[ @sut_id ][ :win_native, false ] == "true"
207
+ zstream = Zlib::Inflate.new(-Zlib::MAX_WBITS)
208
+ body = zstream.inflate(body) unless body.empty?
209
+ else
210
+ # remove leading 4 bytes
211
+ body = body[ 4 .. -1 ]
212
+ body = Zlib::Inflate.inflate( body ) unless body.empty?
213
+ end
210
214
 
211
215
  end
212
216
 
@@ -167,6 +167,7 @@ module MobyUtil
167
167
  'application_path' => @_application_name,
168
168
  'arguments' => arguments,
169
169
  'environment' => @_environment,
170
+ 'directory' => @_working_directory,
170
171
  'events_to_listen' => @_events_to_listen,
171
172
  'signals_to_listen' => @_signals_to_listen,
172
173
  'start_command' => @_start_command
@@ -676,6 +676,32 @@
676
676
 
677
677
  </behaviour>
678
678
 
679
+
680
+ <behaviour name="Settings" object_type="sut" sut_type="QT" env="qt" input_type="*" version="*">
681
+
682
+ <module name="MobyBehaviour::QT::Settings" />
683
+
684
+ <methods>
685
+ <method name="set_settings">
686
+ <description>Set settintgs</description>
687
+ <example>set_settins</example>
688
+ </method>
689
+ <method name="remove_settings">
690
+ <description>Remove settings.</description>
691
+ <example>remove_settings</example>
692
+ </method>
693
+ <method name="read_settings">
694
+ <description>Read settings</description>
695
+ <example>read_settings</example>
696
+ </method>
697
+ <method name="read_all_settings">
698
+ <description>Read all settings</description>
699
+ <example>read_all_settings</example>
700
+ </method>
701
+ </methods>
702
+
703
+ </behaviour>
704
+
679
705
  <behaviour name="QtInfoLoggerBehaviour" object_type="sut;application" sut_type="QT" env="qt" input_type="*" version="*">
680
706
 
681
707
  <module name="MobyBehaviour::QT::InfoLoggerBehaviour" />
@@ -317,5 +317,5 @@
317
317
  <parameter name="kPlay" value="0x01020005"/>
318
318
  <parameter name="kSleep" value="0x01020004"/>
319
319
  <parameter name="kZoom" value="0x01020006"/>
320
- <parameter name="kCancel" valu="0x01020001"/>
321
- </keymap>
320
+ <parameter name="kCancel" value="0x01020001"/>
321
+ </keymap>
@@ -17,7 +17,7 @@
17
17
  <parameter name="input_type" value="touch" /> <!-- overwrites default value -->
18
18
 
19
19
  <!-- keymap definitions -->
20
- <keymap xml_file="keymaps/qt.xml" />
20
+ <keymap xml_file="keymaps/qt.xml" env="qt" />
21
21
 
22
22
  <!-- gesture defaults -->
23
23
  <parameter name="gesture_flick_distance" value="150" />
@@ -83,6 +83,7 @@
83
83
  <fixture name="mobilitysysinfo" plugin="mobilitysysinfofixture" env="qt"/>
84
84
  <fixture name="contact" plugin="contactfixture" env="qt"/>
85
85
  <fixture name="launch" plugin="launchfixture" env="qt"/>
86
+ <fixture name="setting" plugin="settingfixture" env="qt"/>
86
87
  </fixtures>
87
88
  </template>
88
89
 
metadata CHANGED
@@ -1,7 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: testability-driver-qt-sut-plugin
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ hash: 17
5
+ prerelease:
6
+ segments:
7
+ - 1
8
+ - 1
9
+ - 1
10
+ version: 1.1.1
5
11
  platform: ruby
6
12
  authors:
7
13
  - TDriver team
@@ -9,19 +15,24 @@ autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
17
 
12
- date: 2011-03-11 00:00:00 +02:00
13
- default_executable:
18
+ date: 2011-04-12 00:00:00 Z
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
21
  name: testability-driver
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
20
25
  requirements:
21
26
  - - ">="
22
27
  - !ruby/object:Gem::Version
28
+ hash: 57
29
+ segments:
30
+ - 0
31
+ - 8
32
+ - 3
23
33
  version: 0.8.3
24
- version:
34
+ type: :runtime
35
+ version_requirements: *id001
25
36
  description:
26
37
  email: testabilitydriver@nokia.com
27
38
  executables: []
@@ -52,6 +63,7 @@ files:
52
63
  - lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/qt_api_method.rb
53
64
  - lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/record.rb
54
65
  - lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/screen_capture.rb
66
+ - lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/settings.rb
55
67
  - lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/sut.rb
56
68
  - lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/synchronization.rb
57
69
  - lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/treewidgetitemcolumn.rb
@@ -92,7 +104,7 @@ files:
92
104
  - xml/defaults/sut_qt.xml
93
105
  - xml/keymap/qt.xml
94
106
  - xml/template/qt.xml
95
- has_rdoc: true
107
+ - installer/extconf.rb
96
108
  homepage: http://gitorious.org/tdriver
97
109
  licenses: []
98
110
 
@@ -102,21 +114,27 @@ rdoc_options: []
102
114
  require_paths:
103
115
  - lib/testability-driver-plugins/
104
116
  required_ruby_version: !ruby/object:Gem::Requirement
117
+ none: false
105
118
  requirements:
106
119
  - - ">="
107
120
  - !ruby/object:Gem::Version
121
+ hash: 3
122
+ segments:
123
+ - 0
108
124
  version: "0"
109
- version:
110
125
  required_rubygems_version: !ruby/object:Gem::Requirement
126
+ none: false
111
127
  requirements:
112
128
  - - ">="
113
129
  - !ruby/object:Gem::Version
130
+ hash: 3
131
+ segments:
132
+ - 0
114
133
  version: "0"
115
- version:
116
134
  requirements: []
117
135
 
118
136
  rubyforge_project:
119
- rubygems_version: 1.3.5
137
+ rubygems_version: 1.7.2
120
138
  signing_key:
121
139
  specification_version: 3
122
140
  summary: Testability Driver - Testability Driver Interface Qt SUT plugin