testability-driver 1.3.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. data/ext/native_extensions.c +53 -25
  2. data/lib/matti.rb +0 -5
  3. data/lib/tdriver/base/behaviour/behaviours/object_behaviour_description.rb +4 -4
  4. data/lib/tdriver/base/behaviour/factory.rb +120 -7
  5. data/lib/tdriver/base/errors.rb +1 -1
  6. data/lib/tdriver/base/state_object.rb +3 -2
  7. data/lib/tdriver/base/sut/controller.rb +2 -2
  8. data/lib/tdriver/base/sut/factory.rb +207 -201
  9. data/lib/tdriver/base/sut/generic/behaviours/application.rb +3 -6
  10. data/lib/tdriver/base/sut/generic/behaviours/find.rb +1 -1
  11. data/lib/tdriver/base/sut/generic/behaviours/flash_behaviour.rb +14 -14
  12. data/lib/tdriver/base/sut/generic/behaviours/sut.rb +5 -5
  13. data/lib/tdriver/base/sut/generic/behaviours/switchbox_behaviour.rb +14 -14
  14. data/lib/tdriver/base/sut/generic/behaviours/verification.rb +3 -18
  15. data/lib/tdriver/base/sut/generic/commands/key_sequence.rb +6 -6
  16. data/lib/tdriver/base/sut/generic/plugin.rb +4 -9
  17. data/lib/tdriver/base/sut/sut.rb +2 -6
  18. data/lib/tdriver/base/test_object/abstract.rb +1 -1
  19. data/lib/tdriver/base/test_object/adapter.rb +5 -5
  20. data/lib/tdriver/base/test_object/behaviours/syncronization.rb +7 -6
  21. data/lib/tdriver/base/test_object/behaviours/test_object.rb +18 -18
  22. data/lib/tdriver/base/test_object/factory.rb +147 -96
  23. data/lib/tdriver/base/test_object/verification.rb +6 -9
  24. data/lib/tdriver/base/test_object/xml/adapter.rb +5 -5
  25. data/lib/tdriver/matti.rb +1 -1
  26. data/lib/tdriver/report/error_recovery/tdriver_error_recovery.rb +17 -8
  27. data/lib/tdriver/report/error_recovery/tdriver_error_recovery_settings.rb +7 -7
  28. data/lib/tdriver/report/report_api.rb +172 -79
  29. data/lib/tdriver/report/report_crash_file_capture.rb +4 -7
  30. data/lib/tdriver/report/report_creator.rb +16 -20
  31. data/lib/tdriver/report/report_file_capture.rb +3 -3
  32. data/lib/tdriver/report/report_javascript.rb +3 -3
  33. data/lib/tdriver/report/report_test_case_run.rb +20 -10
  34. data/lib/tdriver/report/report_test_run.rb +11 -10
  35. data/lib/tdriver/report/report_writer.rb +13 -11
  36. data/lib/tdriver/tdriver.rb +6 -6
  37. data/lib/tdriver/util/common/array.rb +2 -2
  38. data/lib/tdriver/util/common/file.rb +9 -11
  39. data/lib/tdriver/util/common/gem.rb +1 -1
  40. data/lib/tdriver/util/common/kernel.rb +4 -4
  41. data/lib/tdriver/util/common/retryable.rb +2 -2
  42. data/lib/tdriver/util/common/string.rb +2 -3
  43. data/lib/tdriver/util/hooking/hooking.rb +2 -2
  44. data/lib/tdriver/util/localisation/localisation.rb +12 -12
  45. data/lib/tdriver/util/logger/logger.rb +7 -25
  46. data/lib/tdriver/util/operator_data/operator_data.rb +5 -5
  47. data/lib/tdriver/util/parameter/parameter.rb +2 -2
  48. data/lib/tdriver/util/plugin/abstract.rb +4 -3
  49. data/lib/tdriver/util/plugin/service.rb +31 -4
  50. data/lib/tdriver/util/recorder/recorder.rb +4 -4
  51. data/lib/tdriver/util/user_data/user_data.rb +5 -5
  52. data/lib/tdriver/util/video/camera_windows.rb +1 -1
  53. data/lib/tdriver/util/xml/builder.rb +3 -1
  54. data/lib/tdriver/util/xml/parsers/libxml/libxml.rb +1 -1
  55. data/lib/tdriver/util/xml/xml.rb +5 -5
  56. data/lib/tdriver/verify/verify.rb +26 -26
  57. data/lib/tdriver/version.rb +1 -1
  58. data/xml/behaviours/generic.xml +1 -2
  59. metadata +2 -3
  60. data/lib/tdriver/verify/verify.rb_org +0 -630
@@ -23,8 +23,8 @@ module MobyUtil
23
23
 
24
24
  def self.rindex_regexp( array, pattern )
25
25
 
26
- Kernel::raise TypeError.new("Unexpected variable type '%s' for array (Expected: %s)" % [ array.class, 'Array'] ) unless array.kind_of?( Array )
27
- Kernel::raise TypeError.new("Unexpected variable type '%s' for regular expression pattern (Expected: %s)" % [ pattern.class, 'Regexp'] ) unless pattern.kind_of?( Regexp )
26
+ array.check_type Array, 'wrong argument type $1 for array (expected $2)'
27
+ pattern.check_type Regexp, 'wrong argument type $1 for regular expression pattern (expected $2)'
28
28
 
29
29
  # return nil if no matches found, otherwise return index of value
30
30
  return nil if ( array.reverse.each_index{ | index | return @rindex if array[ ( @rindex = ( ( array.size-1 ) - index ) ) ] =~ pattern; } )
@@ -65,7 +65,7 @@ module MobyUtil
65
65
 
66
66
  require_files = Dir.glob( MobyUtil::FileHelper.fix_path( path ) )
67
67
 
68
- Kernel::raise RuntimeError, "File not found #{ path }" if !File.directory?( path ) && !File.file?( path ) && require_files.empty?
68
+ raise RuntimeError, "File not found #{ path }" if !File.directory?( path ) && !File.file?( path ) && require_files.empty?
69
69
 
70
70
  # load each module found from given folder
71
71
  require_files.each { | module_name |
@@ -86,7 +86,6 @@ module MobyUtil
86
86
  # String:: String presentation of fixed path
87
87
  def self.fix_path( path )
88
88
 
89
- #Kernel::raise ArgumentError.new( "Invalid argument format %s (Expected: %s)" % [ path.class, "String" ] ) unless path.kind_of?( String )
90
89
  path.check_type( String, "Wrong argument type $1 for file path (expected $2)" )
91
90
 
92
91
  # replace back-/slashes to File::SEPARATOR
@@ -115,14 +114,13 @@ module MobyUtil
115
114
  # === returns
116
115
  # String:: String containing expanded file path
117
116
  # === raises
118
- # ArgumentError:: Unexpected argument type '%s' for path (Expected: %s)
117
+ # TypeError:: Wrong argument type <class> for file path (expected <class>)
119
118
  # ArgumentError:: Given path is empty
120
119
  def self.is_relative_path?( path )
121
120
 
122
- #Kernel::raise ArgumentError.new("Unexpected argument type '%s' for path (Expected: %s)" % [ path.class, 'String' ] ) unless path.kind_of?( String )
123
121
  path.check_type( String, "Wrong argument type $1 for file path (expected $2)" )
124
122
 
125
- #Kernel::raise ArgumentError.new("Given path is empty") if path.empty?
123
+ #raise ArgumentError.new("Given path is empty") if path.empty?
126
124
  path.not_empty( "Filepath must not be empty string" )
127
125
 
128
126
  dirname = File.dirname( path )
@@ -175,22 +173,22 @@ module MobyUtil
175
173
  #file_path.check_type( String, "wrong argument type $1 for get_file method (expected $2)")
176
174
 
177
175
  # raise exception if file name is empty or nil
178
- Kernel::raise EmptyFilenameError, "File name is empty or not defined" if file_path.nil? || file_path.to_s.empty?
176
+ raise EmptyFilenameError, "File name is empty or not defined" if file_path.nil? || file_path.to_s.empty?
179
177
 
180
178
  # raise exception if file name is file_path variable format other than string
181
- Kernel::raise UnexpectedVariableTypeError.new( "Invalid filename format %s (Expected: %s)" % [ file_path.class, "String"] ) if !file_path.kind_of?( String )
179
+ raise UnexpectedVariableTypeError.new( "Invalid filename format #{ file_path.class } (expected: String)") if !file_path.kind_of?( String )
182
180
 
183
181
  file_path = MobyUtil::FileHelper.expand_path( file_path )
184
182
 
185
183
  # raise exception if file not found
186
- Kernel::raise FileNotFoundError.new( "File not found: #{ file_path }" ) unless File.exist?( file_path )
184
+ raise FileNotFoundError.new( "File not found: #{ file_path }" ) unless File.exist?( file_path )
187
185
 
188
186
  begin
189
187
  # read all content of file
190
188
  file_content = IO.read( file_path )
191
189
  rescue => ex
192
190
  # raise exception if error occured during reading the file
193
- Kernel::raise IOError.new("Error occured while reading file #{ file_path }\nDescription: #{ ex.message }")
191
+ raise IOError.new("Error occured while reading file #{ file_path }\nDescription: #{ ex.message }")
194
192
  end
195
193
 
196
194
  # return file content
@@ -229,7 +227,7 @@ module MobyUtil
229
227
 
230
228
  rescue => exception
231
229
 
232
- Kernel::raise IOError.new("Error occured while creating folder #{ current_path } (#{ exception.message })")
230
+ raise IOError.new("Error occured while creating folder #{ current_path } (#{ exception.message })")
233
231
 
234
232
  end
235
233
 
@@ -288,7 +286,7 @@ module MobyUtil
288
286
  # create destination folder if it doesn't exist and create_folders flag is enabled
289
287
  MobyUtil::FileHelper.mkdir_path( destination_folder ) if create_folders
290
288
 
291
- Kernel::raise RuntimeError.new( "Unable to copy %s to %s due to source file does not exist" % [ source, destination ] ) unless File.exist?( source )
289
+ raise RuntimeError.new( "Unable to copy #{ source } to #{ destination } due to source file does not exist" ) unless File.exist?( source )
292
290
 
293
291
  ::FileUtils.copy(
294
292
 
@@ -91,7 +91,7 @@ module MobyUtil
91
91
  # TODO: document
92
92
  def self.install( *parameters, &block )
93
93
 
94
- Kernel::raise ArgumentError.new( "Target folder must be specified as first argument" ) if parameters.empty?
94
+ raise ArgumentError.new( "Target folder must be specified as first argument" ) if parameters.empty?
95
95
 
96
96
  yield( *parameters )
97
97
 
@@ -132,7 +132,7 @@ module MobyUtil
132
132
 
133
133
  rescue
134
134
 
135
- Kernel::raise NameError.new( "Invalid constant %s" % constant_name )
135
+ raise NameError, "invalid constant #{ constant_name }"
136
136
 
137
137
  end
138
138
 
@@ -195,7 +195,7 @@ module MobyUtil
195
195
  # TODO: document me
196
196
  ( call_stack.size - 2 ).times do | index |
197
197
 
198
- file_path << "%s:" % call_stack[ index ]
198
+ file_path << "#{ call_stack[ index ].to_s }:"
199
199
 
200
200
  end
201
201
 
@@ -222,9 +222,9 @@ module MobyUtil
222
222
  lines = source.readlines
223
223
 
224
224
  # raise exception if line number is larger than total number of lines
225
- Kernel::raise RuntimeError.new(
225
+ raise RuntimeError.new(
226
226
 
227
- "Unable to fetch line %s from source file %s due to it is out of range (total lines: %s)" % [ start_line, filename, lines.size ]
227
+ "Unable to fetch line #{ start_line.to_s } from source file #{ filename } due to it is out of range (total lines: #{ lines.size })"
228
228
 
229
229
  ) if start_line > lines.size
230
230
 
@@ -60,7 +60,7 @@ module MobyUtil
60
60
  end
61
61
 
62
62
  # raise exception with correct exception backtrace
63
- Kernel::raise $!
63
+ raise $!
64
64
 
65
65
  end
66
66
 
@@ -102,7 +102,7 @@ module MobyUtil
102
102
  end
103
103
 
104
104
  # raise exception with correct exception backtrace
105
- Kernel::raise $!
105
+ raise $!
106
106
 
107
107
  end
108
108
 
@@ -126,7 +126,6 @@ module MobyUtil
126
126
  def self.boolean?( string )
127
127
 
128
128
  # raise exception if argument type other than String
129
- #Kernel::raise ArgumentError.new("Invalid argument format %s (Expected: %s)" % [ string.class, "String" ]) unless string.kind_of?( String )
130
129
  string.check_type( String, "Wrong argument type $1 (Expected $2)" )
131
130
 
132
131
  /^(true|false)$/i.match( string ).kind_of?( MatchData )
@@ -142,7 +141,7 @@ module MobyUtil
142
141
 
143
142
  # raise exception if argument type other than String
144
143
 
145
- Kernel::raise ArgumentError.new("Invalid argument format %s (Expected: %s)" % [ string.class, "String" ]) unless string.kind_of?( String )
144
+ string.check_type String, 'Wrong argument type $1 (expected: $2)'
146
145
 
147
146
  /^[0-9]+$/.match( string ).kind_of?( MatchData )
148
147
 
@@ -161,7 +160,7 @@ module MobyUtil
161
160
 
162
161
  else
163
162
 
164
- Kernel::raise ArgumentError.new("Invalid value '%s' for boolean (Expected: %s)" % [ string, "'true', 'false'" ] )
163
+ raise ArgumentError.new("Invalid value #{ string.inspect } for boolean (expected: \"true\" or \"false\")" )
165
164
 
166
165
  end
167
166
 
@@ -405,7 +405,7 @@ module TDriver
405
405
 
406
406
  else
407
407
 
408
- Kernel::raise ArgumentError.new("Invalid sorting rule, valid rules are :name, :times_called, :total_time, :total_time_no_subs, :percentage or :average_time")
408
+ raise ArgumentError.new("Invalid sorting rule, valid rules are :name, :times_called, :total_time, :total_time_no_subs, :percentage or :average_time")
409
409
 
410
410
  end
411
411
 
@@ -421,7 +421,7 @@ module TDriver
421
421
 
422
422
  else
423
423
 
424
- Kernel::raise ArgumentError.new("Invalid sort order rule, valid rules are :ascending, :descending")
424
+ raise ArgumentError.new("Invalid sort order rule, valid rules are :ascending, :descending")
425
425
 
426
426
  end
427
427
 
@@ -301,9 +301,9 @@ module MobyUtil
301
301
  #
302
302
  def self.translation( logical_name, language, table_name, file_name = nil , plurality = nil, lengthvariant = nil )
303
303
 
304
- Kernel::raise LogicalNameNotFoundError.new( "Logical name cannot be nil" ) if logical_name == nil
305
- Kernel::raise LanguageNotFoundError.new( "Language cannot be nil" ) if language == nil
306
- Kernel::raise TableNotFoundError.new( "Table name cannot be nil" ) if table_name == nil
304
+ raise LogicalNameNotFoundError.new( "Logical name cannot be nil" ) if logical_name == nil
305
+ raise LanguageNotFoundError.new( "Language cannot be nil" ) if language == nil
306
+ raise TableNotFoundError.new( "Table name cannot be nil" ) if table_name == nil
307
307
 
308
308
  # Avoid system column names for language columns and user only downcase
309
309
  language = language.to_s.downcase
@@ -329,13 +329,13 @@ module MobyUtil
329
329
  # Returns a uniform set of results as an array of rows, rows beeing an array of values ( Array<Array<String>> )
330
330
  result = MobyUtil::DBAccess.query( db_connection, query_string )
331
331
  rescue
332
- # if column referring to language is not found then Kernel::raise error for language not found
333
- Kernel::raise LanguageNotFoundError.new( "No language '#{ language }' found" ) unless $!.message.index( "Unknown column" ) == nil
334
- Kernel::raise SqlError.new( $!.message )
332
+ # if column referring to language is not found then raise error for language not found
333
+ raise LanguageNotFoundError.new( "No language '#{ language }' found" ) unless $!.message.index( "Unknown column" ) == nil
334
+ raise SqlError.new( $!.message )
335
335
  end
336
336
 
337
337
  # Return only the first column of the row or and array of the values of the first column if multiple rows have been found
338
- Kernel::raise LogicalNameNotFoundError.new( "No translation found for logical name '#{ logical_name }' in language '#{ language }' with given plurality and lengthvariant." ) if ( result.empty?)
338
+ raise LogicalNameNotFoundError.new( "No translation found for logical name '#{ logical_name }' in language '#{ language }' with given plurality and lengthvariant." ) if ( result.empty?)
339
339
  if result.length > 1
340
340
  # Result is an Array of rows (Array<String>)! We want the first column of each row.
341
341
  result_array = Array.new
@@ -389,8 +389,8 @@ module MobyUtil
389
389
  # description: When its not possible to parse the file provided
390
390
  #
391
391
  def self.upload_translation_file( file, table_name, db_connection = nil, column_names_map = {}, record_sql = false)
392
- Kernel::raise ArgumentError.new("") if file.nil? or file.empty?
393
- Kernel::raise ArgumentError.new("") if table_name.nil? or table_name.empty?
392
+ raise ArgumentError.new("") if file.nil? or file.empty?
393
+ raise ArgumentError.new("") if table_name.nil? or table_name.empty?
394
394
 
395
395
  # Get a connection to the DB
396
396
  if db_connection.nil? or !db_connection.kind_of? MobyUtil::DBConnection
@@ -405,13 +405,13 @@ module MobyUtil
405
405
  if file.match(/.*\.ts/) or file.match(/.*\.qm/)
406
406
  # Check File and convert to TS File if needed
407
407
  tsFile = MobyUtil::Localisation.convert_to_ts( file )
408
- Kernel::raise Exception.new("Failed to convert #{file} to .ts") if tsFile == nil
408
+ raise Exception.new("Failed to convert #{file} to .ts") if tsFile == nil
409
409
  # Collect data for INSERT query from TS File
410
410
  language, data = MobyUtil::Localisation.parse_ts_file( tsFile, column_names_map )
411
- Kernel::raise Exception.new("Error while parsing #{file}.") if language == nil or data == ""
411
+ raise Exception.new("Error while parsing #{file}.") if language == nil or data == ""
412
412
  elsif file.match(/.*\.loc/)
413
413
  language, data = MobyUtil::Localisation.parse_loc_file( file, column_names_map )
414
- Kernel::raise Exception.new("Error while parsing #{file}. The file might have no translations.") if language.nil? or language.empty? or data.nil? or data.empty?
414
+ raise Exception.new("Error while parsing #{file}. The file might have no translations.") if language.nil? or language.empty? or data.nil? or data.empty?
415
415
  end
416
416
  # Upload language data to DB for current language file
417
417
  MobyUtil::Localisation.upload_data( language, data, table_name, db_connection, record_sql )
@@ -146,7 +146,7 @@ module MobyUtil
146
146
 
147
147
  rescue
148
148
 
149
- Kernel::raise ArgumentError, "Logger #{ logger_name.inspect } not found"
149
+ raise ArgumentError, "Logger #{ logger_name.inspect } not found"
150
150
 
151
151
  end
152
152
 
@@ -179,7 +179,7 @@ module MobyUtil
179
179
  if @logger_engine_loaded
180
180
 
181
181
  # Allow only FileOutputter instances
182
- Kernel::raise ArgumentError, 'Outputter pattern not valid, %M required by minimum' if !/\%M/.match( pattern )
182
+ raise ArgumentError, 'Outputter pattern not valid, %M required by minimum' if !/\%M/.match( pattern )
183
183
 
184
184
  # create pattern for outputter
185
185
  outputter_instance.formatter = Log4r::PatternFormatter.new :pattern => pattern
@@ -260,7 +260,7 @@ module MobyUtil
260
260
  def enable_raise_hooking
261
261
 
262
262
  # hook Kernel.raise
263
- def Kernel::raise( *exception )
263
+ def raise( *exception )
264
264
 
265
265
  begin
266
266
 
@@ -286,20 +286,6 @@ module MobyUtil
286
286
 
287
287
  ARGV.delete('--debug_exceptions')
288
288
 
289
- # for debugging to see every occured exception
290
- def Kernel.raise( *args )
291
- #begin
292
- # raise and catch exception
293
- super( *args )
294
- #rescue
295
- # remove wrapper call from backtrace
296
- # $!.backtrace.shift
297
- #puts "%s: %s\nBacktrace: \n%s\n\n" % [ $!.class, $!.message, $!.backtrace.collect{ | line | " %s" % line }.join("\n") ]
298
- # raise exception again
299
- # super $!
300
- #end
301
- end
302
-
303
289
  # hook Object(Kernel)#raise
304
290
  ::Object.class_exec{
305
291
 
@@ -323,11 +309,7 @@ module MobyUtil
323
309
 
324
310
  end
325
311
 
326
- puts "[debug] %s: %s\n[debug] Backtrace: \n[debug] %s\n\n" % [
327
- $!.class,
328
- $!.message,
329
- $!.backtrace.collect{ | line | " ... from %s" % line }.join("\n[debug] ")
330
- ]
312
+ puts "[debug] #{ $!.class }: #{ $!.message }\n[debug] Backtrace: \n[debug] #{ $!.backtrace.collect{ | line | " ... from #{ line }" }.join("\n[debug] ") }\n\n"
331
313
 
332
314
  # raise exception again
333
315
  original_raise $!
@@ -355,13 +337,13 @@ module MobyUtil
355
337
  return nil if logging_level.nil?
356
338
 
357
339
  # raise exception if wrong format for logging level
358
- Kernel::raise RuntimeError, "Wrong logging level format '#{ logging_level }' defined in TDriver parameter/template XML (expected numeric string)" unless logging_level.numeric?
340
+ raise RuntimeError, "Wrong logging level format '#{ logging_level }' defined in TDriver parameter/template XML (expected numeric string)" unless logging_level.numeric?
359
341
 
360
342
  # convert to integer
361
343
  logging_level = logging_level.to_i
362
344
 
363
345
  # raise exception if unsupported logging level
364
- Kernel::raise RuntimeError, "Unsupported logging level '#{ logging_level }' defined in TDriver parameter/template XML (expected 0..5)" unless ( 0..5 ).include?( logging_level )
346
+ raise RuntimeError, "Unsupported logging level '#{ logging_level }' defined in TDriver parameter/template XML (expected 0..5)" unless ( 0..5 ).include?( logging_level )
365
347
 
366
348
  @include_behaviour_info = $parameters[ :logging_include_behaviour_info, 'false' ].to_s.to_boolean
367
349
 
@@ -559,7 +541,7 @@ module MobyUtil
559
541
 
560
542
  else
561
543
 
562
- exit_status = ['error', '', "Execution terminated with exception: %s: %s" % [ caller.first, $!.message.split("\n") ], '' ]
544
+ exit_status = ['error', '', "Execution terminated with exception: #{ caller.first.to_s }: #{ $!.message.split("\n") }", '' ]
563
545
 
564
546
  end
565
547
 
@@ -58,7 +58,7 @@ module MobyUtil
58
58
  #
59
59
  def self.retrieve( operator_data_lname, operator, table_name )
60
60
 
61
- Kernel::raise OperatorDataNotFoundError.new( "Search string parameter cannot be nil" ) if operator_data_lname == nil
61
+ raise OperatorDataNotFoundError.new( "Search string parameter cannot be nil" ) if operator_data_lname == nil
62
62
 
63
63
  # Get Localization parameters for DB Connection
64
64
  db_type = $parameters[ :operator_data_db_type, nil ].to_s.downcase
@@ -75,13 +75,13 @@ module MobyUtil
75
75
  begin
76
76
  result = MobyUtil::DBAccess.query( db_connection, query_string )
77
77
  rescue
78
- # if data column to be searched is not found then Kernel::raise error for search column not found
79
- Kernel::raise OperatorDataColumnNotFoundError.new( "Search column 'Value' not found in database" ) unless $!.message.index( "Unknown column" ) == nil
80
- Kernel::raise SqlError.new( $!.message )
78
+ # if data column to be searched is not found then raise error for search column not found
79
+ raise OperatorDataColumnNotFoundError.new( "Search column 'Value' not found in database" ) unless $!.message.index( "Unknown column" ) == nil
80
+ raise SqlError.new( $!.message )
81
81
  end
82
82
 
83
83
  # Return always the first column of the row
84
- Kernel::raise OperatorDataNotFoundError.new("No matches found for search string '#{ operator_data_lname }' in search column 'LogicalName' for opreator #{ operator }" ) if ( result.empty?)
84
+ raise OperatorDataNotFoundError.new("No matches found for search string '#{ operator_data_lname }' in search column 'LogicalName' for opreator #{ operator }" ) if ( result.empty?)
85
85
  # Result is an Array of rows (Array<String>)! We want the first column of the first row.
86
86
  return result[0][0]
87
87
 
@@ -1055,7 +1055,7 @@ module MobyUtil
1055
1055
 
1056
1056
  class << self
1057
1057
 
1058
- undef :inspect
1058
+ undef :inspect if respond_to?( :inspect )
1059
1059
 
1060
1060
  def new
1061
1061
 
@@ -1090,7 +1090,7 @@ module MobyUtil
1090
1090
 
1091
1091
  class << self
1092
1092
 
1093
- undef :inspect
1093
+ undef :inspect if respond_to?( :inspect )
1094
1094
 
1095
1095
  def new
1096
1096
 
@@ -25,18 +25,19 @@ module MobyUtil
25
25
  ## plugin configuration, constructor and deconstructor methods
26
26
  def self.plugin_name
27
27
 
28
- Kernel::raise PluginError.new( "Plugin name not defined in implementation (%s)" % [ self.name ] )
28
+ raise PluginError, "Plugin name not defined in implementation (#{ self.name })"
29
+
29
30
  end
30
31
 
31
32
  def self.plugin_type
32
33
 
33
- Kernel::raise PluginError.new( "Plugin type not defined in implementation (%s)" % [ self.name ] )
34
+ raise PluginError, "Plugin type not defined in implementation (#{ self.name })"
34
35
 
35
36
  end
36
37
 
37
38
  def self.plugin_required_tdriver_version
38
39
 
39
- Kernel::raise PluginError.new( "Required TDriver version not defined in plugin implementation (%s)" % [ self.name ] )
40
+ raise PluginError, "Required TDriver version not defined in plugin implementation (#{ self.name })"
40
41
 
41
42
  end
42
43
 
@@ -42,6 +42,8 @@ module TDriver
42
42
  # list of enabled plugins
43
43
  @enabled_plugins = []
44
44
 
45
+ @plugin_order = []
46
+
45
47
  end
46
48
 
47
49
  # TODO: document me
@@ -74,6 +76,18 @@ module TDriver
74
76
 
75
77
  end
76
78
 
79
+ def update_enabled_plugins_list
80
+
81
+ @enabled_plugins = @plugin_order.inject([]){ | result, name |
82
+
83
+ result << name if @registered_plugins.fetch( name, {} )[ :enabled ].true?
84
+
85
+ result
86
+
87
+ }
88
+
89
+ end
90
+
77
91
  end # self
78
92
 
79
93
  # TODO: document me
@@ -127,7 +141,9 @@ module TDriver
127
141
  @registered_plugins[ plugin_name ][ :enabled ] = true
128
142
 
129
143
  # add name to enabled plugins list
130
- @enabled_plugins << plugin_name unless @enabled_plugins.include?( plugin_name )
144
+ #@enabled_plugins << plugin_name unless @enabled_plugins.include?( plugin_name )
145
+
146
+ update_enabled_plugins_list
131
147
 
132
148
  rescue
133
149
 
@@ -146,7 +162,9 @@ module TDriver
146
162
  @registered_plugins[ plugin_name ][ :enabled ] = false
147
163
 
148
164
  # remove name from enabled plugins list
149
- @enabled_plugins.delete( plugin_name )
165
+ #@enabled_plugins.delete( plugin_name )
166
+
167
+ update_enabled_plugins_list
150
168
 
151
169
  rescue
152
170
 
@@ -184,13 +202,17 @@ module TDriver
184
202
  # set plugin to enabled state
185
203
  :enabled => true
186
204
 
187
- }
205
+ }
206
+
207
+ @plugin_order << plugin_name
188
208
 
189
209
  # register plugin
190
210
  plugin_module.register_plugin
191
211
 
192
212
  # add name to enabled plugins list
193
- @enabled_plugins << plugin_name unless @enabled_plugins.include?( plugin_name )
213
+ #@enabled_plugins << plugin_name unless @enabled_plugins.include?( plugin_name )
214
+
215
+ update_enabled_plugins_list
194
216
 
195
217
  end
196
218
 
@@ -208,6 +230,11 @@ module TDriver
208
230
  # remove from the plugins hash
209
231
  @enabled_plugins.delete( plugin_name )
210
232
 
233
+ update_enabled_plugins_list
234
+
235
+ # remove from plugins list (registration order)
236
+ @plugin_order.delete( plugin_name )
237
+
211
238
  rescue
212
239
 
213
240
  raise ArgumentError, "Failed to unregister plugin due to plugin #{ plugin_name.inspect } is not registered"