testability-driver 1.3.1 → 1.3.2
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.
- data/bin/start_app_perf +6 -6
- data/lib/tdriver-devtools/behaviour/xml/rdoc_behaviour_xml_generator.rb +4 -4
- data/lib/tdriver-devtools/doc/xslt/template.xsl +103 -21
- data/lib/tdriver/base/behaviour/behaviours/object_behaviour_description.rb +1 -1
- data/lib/tdriver/base/command_data/loader.rb +6 -2
- data/lib/tdriver/base/loader.rb +21 -14
- data/lib/tdriver/base/state_object.rb +1 -1
- data/lib/tdriver/base/sut/controller.rb +8 -2
- data/lib/tdriver/base/sut/generic/behaviours/sut.rb +103 -46
- data/lib/tdriver/base/sut/generic/behaviours/switchbox_behaviour.rb +2 -2
- data/lib/tdriver/base/sut/generic/behaviours/verification.rb +1 -1
- data/lib/tdriver/base/sut/generic/commands/application.rb +18 -278
- data/lib/tdriver/base/sut/generic/commands/key_sequence.rb +1 -1
- data/lib/tdriver/base/sut/sut.rb +1 -1
- data/lib/tdriver/base/test_object/abstract.rb +1 -1
- data/lib/tdriver/base/test_object/adapter.rb +4 -1
- data/lib/tdriver/base/test_object/behaviours/syncronization.rb +3 -3
- data/lib/tdriver/base/test_object/behaviours/test_object.rb +61 -24
- data/lib/tdriver/base/test_object/cache.rb +6 -4
- data/lib/tdriver/base/test_object/factory.rb +4 -2
- data/lib/tdriver/base/test_object/loader.rb +23 -14
- data/lib/tdriver/base/test_object/xml/abstraction.rb +63 -0
- data/lib/tdriver/base/test_object/xml/adapter.rb +4 -1
- data/lib/tdriver/report/report_test_run.rb +1 -1
- data/lib/tdriver/report/report_writer.rb +4 -3
- data/lib/tdriver/util/common/boolean.rb +10 -13
- data/lib/tdriver/util/common/environment.rb +8 -7
- data/lib/tdriver/util/common/hash.rb +5 -5
- data/lib/tdriver/util/common/numeric.rb +5 -5
- data/lib/tdriver/util/common/object.rb +3 -3
- data/lib/tdriver/util/common/retryable.rb +65 -2
- data/lib/tdriver/util/common/string.rb +4 -4
- data/lib/tdriver/util/database/access.rb +9 -11
- data/lib/tdriver/util/fixture/service.rb +54 -0
- data/lib/tdriver/util/localisation/localisation.rb +3 -2
- data/lib/tdriver/util/logger/logger.rb +55 -41
- data/lib/tdriver/util/parameter/parameter.rb +38 -7
- data/lib/tdriver/util/xml/abstraction.rb +8 -8
- data/lib/tdriver/util/xml/builder.rb +1 -1
- data/lib/tdriver/util/xml/xml.rb +11 -11
- data/lib/tdriver/verify/verify.rb +33 -36
- data/lib/tdriver/version.rb +1 -1
- data/xml/defaults/sut_generic.xml +1 -29
- data/xml/templates/generic.xml +28 -0
- metadata +48 -17
@@ -54,7 +54,7 @@ class Numeric
|
|
54
54
|
if negative?
|
55
55
|
|
56
56
|
# replace macros
|
57
|
-
message.gsub!( '$1',
|
57
|
+
message.gsub!( '$1', inspect )
|
58
58
|
|
59
59
|
raise exception, message, caller
|
60
60
|
|
@@ -70,7 +70,7 @@ class Numeric
|
|
70
70
|
if zero?
|
71
71
|
|
72
72
|
# replace macros
|
73
|
-
message.gsub!( '$1',
|
73
|
+
message.gsub!( '$1', inspect )
|
74
74
|
|
75
75
|
raise exception, message, caller
|
76
76
|
|
@@ -86,7 +86,7 @@ class Numeric
|
|
86
86
|
if positive?
|
87
87
|
|
88
88
|
# replace macros
|
89
|
-
message.gsub!( '$1',
|
89
|
+
message.gsub!( '$1', inspect )
|
90
90
|
|
91
91
|
raise exception, message, caller
|
92
92
|
|
@@ -106,7 +106,7 @@ class Numeric
|
|
106
106
|
raise TypeError, 'wrong argument type #{ message.class } for exception message (expected String)' unless message.kind_of?( String )
|
107
107
|
|
108
108
|
# replace macros
|
109
|
-
message.gsub!( '$1',
|
109
|
+
message.gsub!( '$1', inspect )
|
110
110
|
|
111
111
|
message.gsub!( '$2', range.inspect )
|
112
112
|
|
@@ -122,7 +122,7 @@ class Numeric
|
|
122
122
|
def limit( minimum_value, maximum_value )
|
123
123
|
|
124
124
|
# limit current value
|
125
|
-
|
125
|
+
min( minimum_value ).max( maximum_value )
|
126
126
|
|
127
127
|
end
|
128
128
|
|
@@ -74,7 +74,7 @@ class Object
|
|
74
74
|
|
75
75
|
raise TypeError, "invalid argument type #{ type } for check_type. Did you mean #{ type.class }?", caller unless type.kind_of?( Class )
|
76
76
|
|
77
|
-
if
|
77
|
+
if kind_of?( type )
|
78
78
|
|
79
79
|
found = true
|
80
80
|
|
@@ -91,7 +91,7 @@ class Object
|
|
91
91
|
unless found
|
92
92
|
|
93
93
|
# convert macros
|
94
|
-
[ self.class, verbose_type_list.join,
|
94
|
+
[ self.class, verbose_type_list.join, inspect ].each_with_index{ | param, index | message.gsub!( "$#{ index + 1 }", param.to_s ) }
|
95
95
|
|
96
96
|
# raise the exception
|
97
97
|
raise TypeError, message, caller
|
@@ -144,7 +144,7 @@ class Object
|
|
144
144
|
unless found
|
145
145
|
|
146
146
|
# convert macros
|
147
|
-
[ self.class, verbose_values_list.join,
|
147
|
+
[ self.class, verbose_values_list.join, inspect ].each_with_index{ | param, index | message.gsub!( "$#{ index + 1 }", param.to_s ) }
|
148
148
|
|
149
149
|
# raise the exception
|
150
150
|
raise ArgumentError, message, caller
|
@@ -42,13 +42,45 @@ module MobyUtil
|
|
42
42
|
|
43
43
|
attempt = 1
|
44
44
|
|
45
|
+
|
46
|
+
# number of block arguments
|
47
|
+
_block_arity = block.arity
|
48
|
+
|
49
|
+
if _block_arity > 1
|
50
|
+
|
51
|
+
_block_arity = 2
|
52
|
+
|
53
|
+
elsif _block_arity < 1
|
54
|
+
|
55
|
+
_block_arity = 0
|
56
|
+
|
57
|
+
end
|
58
|
+
|
59
|
+
# last exception
|
60
|
+
_exception = nil
|
61
|
+
|
62
|
+
# default
|
63
|
+
_arguments = []
|
64
|
+
|
45
65
|
begin
|
46
66
|
|
67
|
+
case _block_arity
|
68
|
+
|
69
|
+
when 1
|
70
|
+
arguments = [ attempt ]
|
71
|
+
|
72
|
+
when 2
|
73
|
+
arguments = [ attempt, _exception ]
|
74
|
+
|
75
|
+
end
|
76
|
+
|
47
77
|
# yield given block and pass attempt number as parameter
|
48
|
-
yield(
|
78
|
+
yield( *arguments )
|
49
79
|
|
50
80
|
rescue *options[ :exception ]
|
51
81
|
|
82
|
+
_exception = $!
|
83
|
+
|
52
84
|
if ( attempt < options[ :tries ] ) && ![ *options[ :unless ] ].include?( $!.class )
|
53
85
|
|
54
86
|
sleep_retry_interval( options[ :interval ] ) if options[ :interval ] > 0
|
@@ -84,13 +116,44 @@ module MobyUtil
|
|
84
116
|
# attempt number
|
85
117
|
attempt = 0
|
86
118
|
|
119
|
+
# number of block arguments
|
120
|
+
_block_arity = block.arity
|
121
|
+
|
122
|
+
if _block_arity > 1
|
123
|
+
|
124
|
+
_block_arity = 2
|
125
|
+
|
126
|
+
elsif _block_arity < 1
|
127
|
+
|
128
|
+
_block_arity = 0
|
129
|
+
|
130
|
+
end
|
131
|
+
|
132
|
+
# last exception
|
133
|
+
_exception = nil
|
134
|
+
|
135
|
+
# default
|
136
|
+
_arguments = []
|
137
|
+
|
87
138
|
begin
|
88
139
|
|
140
|
+
case _block_arity
|
141
|
+
|
142
|
+
when 1
|
143
|
+
arguments = [ attempt ]
|
144
|
+
|
145
|
+
when 2
|
146
|
+
arguments = [ attempt, _exception ]
|
147
|
+
|
148
|
+
end
|
149
|
+
|
89
150
|
# execute block
|
90
|
-
yield(
|
151
|
+
yield( *arguments )
|
91
152
|
|
92
153
|
rescue *options[ :exception ]
|
93
154
|
|
155
|
+
_exception = $!
|
156
|
+
|
94
157
|
if (Time.now - start_time) <= options[ :timeout ] && ![ *options[ :unless ] ].include?( $!.class )
|
95
158
|
|
96
159
|
sleep_retry_interval( options[ :interval ] ) if options[ :interval ] > 0
|
@@ -22,13 +22,13 @@ class String
|
|
22
22
|
|
23
23
|
def true?
|
24
24
|
|
25
|
-
/^true$/i.match(
|
25
|
+
/^true$/i.match( to_s ) != nil
|
26
26
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def false?
|
30
30
|
|
31
|
-
/^false$/i.match(
|
31
|
+
/^false$/i.match( to_s ) != nil
|
32
32
|
|
33
33
|
end
|
34
34
|
|
@@ -37,7 +37,7 @@ class String
|
|
37
37
|
if empty?
|
38
38
|
|
39
39
|
# replace macros
|
40
|
-
#message.gsub!( '$1',
|
40
|
+
#message.gsub!( '$1', inspect )
|
41
41
|
|
42
42
|
raise exception, message, caller
|
43
43
|
|
@@ -83,7 +83,7 @@ class String
|
|
83
83
|
# TrueClass/FalseClass
|
84
84
|
def to_boolean( *default )
|
85
85
|
|
86
|
-
if /^(true|false)$/i.match(
|
86
|
+
if /^(true|false)$/i.match( to_s )
|
87
87
|
|
88
88
|
$1.downcase == 'true'
|
89
89
|
|
@@ -69,10 +69,8 @@ module MobyUtil
|
|
69
69
|
# Create first instance of this class if it doesn't exist
|
70
70
|
self.instance
|
71
71
|
|
72
|
-
#raise ArgumentError.new("Invalid connection object provided.") if dbc.nil? or !dbc.kind_of? MobyUtil::DBConnection
|
73
72
|
dbc.check_type( MobyUtil::DBConnection, "Wrong argument type $1 for database connection object (expected $2)" )
|
74
73
|
|
75
|
-
#raise ArgumentError.new("The query qtring must be provided as a non empty string.") if query_string.nil? or query_string.class != String or query_string.empty?
|
76
74
|
query_string.check_type( String, "Wrong variable type $1 for database query string (expected $2)")
|
77
75
|
query_string.not_empty( "Database query string must not be empty string" )
|
78
76
|
|
@@ -84,28 +82,22 @@ module MobyUtil
|
|
84
82
|
|
85
83
|
# Check creation parameters
|
86
84
|
|
87
|
-
#raise DbTypeNotDefinedError.new( "Database type need to be either 'mysql' or 'sqlite'!" ) if db_type == nil
|
88
85
|
db_type.check_type( String, "Wrong argument type $1 for database type (expected $2)" )
|
89
86
|
|
90
|
-
#raise DbTypeNotSupportedError.new( "Database type '#{db_type}' not supported! Type need to be either 'mysql' or 'sqlite'!" ) unless db_type == DB_TYPE_MYSQL or db_type == DB_TYPE_SQLITE
|
91
87
|
db_type.validate( [ DB_TYPE_MYSQL, DB_TYPE_SQLITE ], "Unsupported database type $1 (expected $2)" )
|
92
88
|
|
93
89
|
if ( db_type == DB_TYPE_MYSQL )
|
94
90
|
|
95
|
-
# raise ArgumentError.new("Host must be provided as a non empty string.") if host.nil? or host.class != String or host.empty?
|
96
91
|
host.check_type( String, "Wrong variable type $1 for host (expected $2)" )
|
97
92
|
host.not_empty( "Host must not be empty string" )
|
98
93
|
|
99
|
-
#raise ArgumentError.new("Username must be provided as a non empty string.") if username.nil? or username.class != String or username.empty?
|
100
94
|
username.check_type( String, "Wrong variable type $1 for username (expected $2)" )
|
101
95
|
username.not_empty( "Username must not be empty string" )
|
102
96
|
|
103
|
-
#raise ArgumentError.new("Password must be provided as a string.") if password.nil? or password.class != String
|
104
97
|
password.check_type( String, "Wrong variable type $1 for password (expected $2)")
|
105
98
|
|
106
99
|
end
|
107
100
|
|
108
|
-
#raise ArgumentError.new("The database name must be provided as a non empty string.") if database_name.nil? or database_name.class != String or database_name.empty?
|
109
101
|
database_name.check_type( String, "Wrong variable type $1 for database name (expected $2)" )
|
110
102
|
database_name.not_empty( "Database name must not be empty string" )
|
111
103
|
|
@@ -117,7 +109,14 @@ module MobyUtil
|
|
117
109
|
|
118
110
|
if db_type == DB_TYPE_MYSQL
|
119
111
|
|
120
|
-
|
112
|
+
begin
|
113
|
+
query_result = @@_connections[ host + db_type + database_name ].dbh.query( query_string ) # identical?
|
114
|
+
rescue
|
115
|
+
#Possible timeout in query attempt to recreate the connection and redo the query
|
116
|
+
dbc.dbh = connect_db( db_type, host, username, password, database_name )
|
117
|
+
@@_connections[ host + db_type + database_name ] = dbc
|
118
|
+
query_result = @@_connections[ host + db_type + database_name ].dbh.query( query_string ) # identical?
|
119
|
+
end
|
121
120
|
|
122
121
|
elsif dbc.db_type == DB_TYPE_SQLITE
|
123
122
|
|
@@ -172,7 +171,6 @@ module MobyUtil
|
|
172
171
|
#
|
173
172
|
def self.affected_rows(dbc)
|
174
173
|
|
175
|
-
#raise ArgumentError.new("Invalid connection object provided.") if dbc.nil? or !dbc.kind_of? MobyUtil::DBConnection
|
176
174
|
dbc.check_type( MobyUtil::DBConnection, "Wrong argument type $1 for database connection object (expected $2)" )
|
177
175
|
|
178
176
|
# Check for exsting connection for that host and create it if needed
|
@@ -209,7 +207,7 @@ module MobyUtil
|
|
209
207
|
dbh.query 'SET NAMES utf8' if db_type == DB_TYPE_MYSQL # set the utf8 encoding
|
210
208
|
dbh = SQLite3::Database.new( database_name ) if db_type == DB_TYPE_SQLITE
|
211
209
|
rescue
|
212
|
-
raise SqlConnectError
|
210
|
+
raise SqlConnectError, $!.message
|
213
211
|
end
|
214
212
|
|
215
213
|
return dbh
|
@@ -101,6 +101,57 @@ module TDriver
|
|
101
101
|
|
102
102
|
end # FixturePluginService
|
103
103
|
|
104
|
+
module FixtureSetupFunctions
|
105
|
+
|
106
|
+
def []( name )
|
107
|
+
|
108
|
+
name.check_type [ String, Symbol ], 'wrong argument type $1 for fixture name (expected $2)'
|
109
|
+
|
110
|
+
@target.parameter[ :fixtures ].fetch( name.to_sym ){ | name |
|
111
|
+
|
112
|
+
raise MobyBase::BehaviourError.new( "Fixture", "Failed to execute fixture due to #{ name.to_s.inspect } not found for #{ @target.sut.id.inspect }" )
|
113
|
+
|
114
|
+
}
|
115
|
+
|
116
|
+
end
|
117
|
+
|
118
|
+
def []=( name, plugin )
|
119
|
+
|
120
|
+
name.check_type [ String, Symbol ], 'wrong argument type $1 for fixture name (expected $2)'
|
121
|
+
|
122
|
+
plugin.check_type [ String ], 'wrong argument type $1 for fixture pluin name (expected $2)'
|
123
|
+
|
124
|
+
name = name.to_sym
|
125
|
+
|
126
|
+
plugin = plugin.to_s
|
127
|
+
|
128
|
+
# create fixtures configuration hash unless already exists
|
129
|
+
@target.parameter[ :fixtures ] = {} unless @target.parameter.has_key?( :fixtures )
|
130
|
+
|
131
|
+
if @target.parameter[ :fixtures ].has_key?( name )
|
132
|
+
|
133
|
+
# retrieve existing fixture configuration
|
134
|
+
fixture_hash = @target.parameter[ :fixtures ][ name ]
|
135
|
+
|
136
|
+
else
|
137
|
+
|
138
|
+
# fixture was not found from hash, add sut environment to hash
|
139
|
+
fixture_hash = { :env => @target.instance_variable_get(:@environment) }
|
140
|
+
|
141
|
+
end
|
142
|
+
|
143
|
+
# store plugin name to hash
|
144
|
+
fixture_hash[ :plugin ] = plugin
|
145
|
+
|
146
|
+
# store fixture settings to fixtures configuration hash
|
147
|
+
@target.parameter[ :fixtures ][ name ] = fixture_hash
|
148
|
+
|
149
|
+
self
|
150
|
+
|
151
|
+
end
|
152
|
+
|
153
|
+
end
|
154
|
+
|
104
155
|
class FixtureService
|
105
156
|
|
106
157
|
# remove all public methods
|
@@ -128,6 +179,9 @@ module TDriver
|
|
128
179
|
# store caller backtrace
|
129
180
|
@caller = caller
|
130
181
|
|
182
|
+
# extend with fixture setup functions if self is kind of sut
|
183
|
+
extend FixtureSetupFunctions if @target.sut?
|
184
|
+
|
131
185
|
self
|
132
186
|
|
133
187
|
end
|
@@ -231,9 +231,10 @@ module MobyUtil
|
|
231
231
|
# "Luo" => ["", "227"],
|
232
232
|
# "Sukuma" => ["", "228"],
|
233
233
|
# "Aceh" => ["", "229"],
|
234
|
-
|
234
|
+
"English_India" => ["en_in", "230"], # In e32long.h, Pearl script, but not in Nokia Language Codes Standard
|
235
235
|
"Malay Apac" => ["MA", "326"], # In e32long.h, Pearl script, but not in Nokia Language Codes Standard
|
236
|
-
|
236
|
+
"Indonesian Apac" =>["id_ap", "327"],
|
237
|
+
"English Bangladesh" =>["en_ba", "328"],
|
237
238
|
# "Bengali IN" => ["bn_IN", ""],
|
238
239
|
# "Bosnian" => ["bs", ""],
|
239
240
|
}
|
@@ -1,20 +1,20 @@
|
|
1
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 Testability Driver.
|
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
|
-
##
|
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 Testability Driver.
|
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
18
|
############################################################################
|
19
19
|
|
20
20
|
module MobyUtil
|
@@ -179,7 +179,7 @@ module MobyUtil
|
|
179
179
|
if @logger_engine_loaded
|
180
180
|
|
181
181
|
# Allow only FileOutputter instances
|
182
|
-
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
|
@@ -203,7 +203,7 @@ module MobyUtil
|
|
203
203
|
|
204
204
|
Log4r::Logger.global
|
205
205
|
|
206
|
-
else
|
206
|
+
else
|
207
207
|
|
208
208
|
nil
|
209
209
|
|
@@ -211,6 +211,19 @@ module MobyUtil
|
|
211
211
|
|
212
212
|
end
|
213
213
|
|
214
|
+
# TODO: add documentation
|
215
|
+
def log_to_report_details(script_call)
|
216
|
+
script_call.each do |call|
|
217
|
+
if call.include?('testability-driver')==false and call.include?('ruby')==false and call.include?('.rb')==true and call!=@previous_call
|
218
|
+
if $tdriver_reporter
|
219
|
+
$new_test_case.capture_dump(true,:text=> call) if $new_test_case
|
220
|
+
end
|
221
|
+
break
|
222
|
+
end
|
223
|
+
end
|
224
|
+
@previous_call=script_call
|
225
|
+
end
|
226
|
+
|
214
227
|
# TODO: add documentation
|
215
228
|
def log( level, *text_array )
|
216
229
|
|
@@ -219,7 +232,7 @@ module MobyUtil
|
|
219
232
|
# convert to lowercase string
|
220
233
|
level = level.to_s.downcase
|
221
234
|
|
222
|
-
include_behaviour_info = @include_behaviour_info
|
235
|
+
include_behaviour_info = @include_behaviour_info
|
223
236
|
|
224
237
|
# debug log entries and logging by using TDriver.logging.info or MobyUtil::Logging.instance.info etc
|
225
238
|
if caller.first =~ /method_missing/
|
@@ -253,6 +266,7 @@ module MobyUtil
|
|
253
266
|
|
254
267
|
}
|
255
268
|
|
269
|
+
log_to_report_details(caller) if $parameters[:report_script_steps_to_details, nil ]=='true'
|
256
270
|
end
|
257
271
|
|
258
272
|
end
|
@@ -287,7 +301,7 @@ module MobyUtil
|
|
287
301
|
ARGV.delete('--debug_exceptions')
|
288
302
|
|
289
303
|
# hook Object(Kernel)#raise
|
290
|
-
::Object.class_exec{
|
304
|
+
::Object.class_exec{
|
291
305
|
|
292
306
|
::Kernel.module_exec{
|
293
307
|
|
@@ -297,27 +311,27 @@ module MobyUtil
|
|
297
311
|
|
298
312
|
begin
|
299
313
|
|
300
|
-
# raise and catch exception
|
314
|
+
# raise and catch exception
|
301
315
|
original_raise( *args )
|
302
316
|
|
303
317
|
rescue
|
304
318
|
|
305
319
|
# remove wrapper calls from backtrace
|
306
320
|
while $!.backtrace.first =~ /(logger\.rb).*(raise)/
|
307
|
-
|
321
|
+
|
308
322
|
$!.backtrace.shift
|
309
|
-
|
323
|
+
|
310
324
|
end
|
311
|
-
|
325
|
+
|
312
326
|
puts "[debug] #{ $!.class }: #{ $!.message }\n[debug] Backtrace: \n[debug] #{ $!.backtrace.collect{ | line | " ... from #{ line }" }.join("\n[debug] ") }\n\n"
|
313
|
-
|
327
|
+
|
314
328
|
# raise exception again
|
315
329
|
original_raise $!
|
316
330
|
|
317
|
-
end
|
331
|
+
end
|
318
332
|
|
319
333
|
end
|
320
|
-
|
334
|
+
|
321
335
|
}
|
322
336
|
}
|
323
337
|
|
@@ -354,7 +368,7 @@ module MobyUtil
|
|
354
368
|
|
355
369
|
if $parameters[ :logging_xml_parse_error_dump_path, nil ].nil?
|
356
370
|
|
357
|
-
warn("warning: Configuration parameter :logging_xml_parse_error_dump_path missing, disabling the feature...")
|
371
|
+
warn("warning: Configuration parameter :logging_xml_parse_error_dump_path missing, disabling the feature...")
|
358
372
|
|
359
373
|
# disable feature
|
360
374
|
raise ArgumentError
|
@@ -401,11 +415,11 @@ module MobyUtil
|
|
401
415
|
|
402
416
|
else
|
403
417
|
|
404
|
-
warn("warning: Configuration parameter :logging_xml_parse_error_dump missing, disabling the feature...")
|
418
|
+
warn("warning: Configuration parameter :logging_xml_parse_error_dump missing, disabling the feature...")
|
405
419
|
$parameters[ :logging_xml_parse_error_dump ] = 'false'
|
406
420
|
|
407
421
|
end
|
408
|
-
|
422
|
+
|
409
423
|
unless logging_level.zero?
|
410
424
|
|
411
425
|
# logger output path
|
@@ -421,7 +435,7 @@ module MobyUtil
|
|
421
435
|
|
422
436
|
@logger_engine_loaded = true
|
423
437
|
|
424
|
-
# disable logging if exception is raised during
|
438
|
+
# disable logging if exception is raised during
|
425
439
|
begin
|
426
440
|
|
427
441
|
# create outputter folder if not exist
|
@@ -441,27 +455,27 @@ module MobyUtil
|
|
441
455
|
end
|
442
456
|
|
443
457
|
# check if outputter is enabled
|
444
|
-
if $parameters[ :logging_outputter_enabled, false ].true?
|
458
|
+
if $parameters[ :logging_outputter_enabled, false ].true?
|
445
459
|
|
446
460
|
# create new outputter instance type of FileOutputter
|
447
461
|
outputter = create_outputter(
|
448
462
|
|
449
463
|
# outputter type
|
450
|
-
Log4r::FileOutputter,
|
464
|
+
Log4r::FileOutputter,
|
451
465
|
|
452
466
|
# outputter name
|
453
467
|
"TDriver_LOG",
|
454
468
|
|
455
|
-
# outputter filename
|
456
|
-
:filename => File.join( outputter_path, filename ),
|
469
|
+
# outputter filename
|
470
|
+
:filename => File.join( outputter_path, filename ),
|
457
471
|
|
458
472
|
# append to or truncate file
|
459
|
-
:trunc => $parameters[ :logging_outputter_append, false ].false?,
|
473
|
+
:trunc => $parameters[ :logging_outputter_append, false ].false?,
|
460
474
|
|
461
475
|
# logging level
|
462
476
|
:level => logging_level
|
463
477
|
|
464
|
-
)
|
478
|
+
)
|
465
479
|
|
466
480
|
# set outputter log event write pattern
|
467
481
|
set_outputter_pattern( outputter, $parameters[ :logging_outputter_pattern, '%d [%c] [%l] %M' ] )
|
@@ -470,14 +484,14 @@ module MobyUtil
|
|
470
484
|
add_outputter( @logger_instance, outputter )
|
471
485
|
|
472
486
|
end
|
473
|
-
|
487
|
+
|
474
488
|
# Add stdout outputter if set on configuration parameters
|
475
489
|
if $parameters[ :logging_stdout_outputter_enabled, false ].true?
|
476
490
|
stdout_outputter = create_outputter(
|
477
491
|
Log4r::StdoutOutputter, # outputter type
|
478
492
|
"TDriver_LOG_stdout", # outputter name
|
479
493
|
:level => logging_level # logging level
|
480
|
-
)
|
494
|
+
)
|
481
495
|
set_outputter_pattern( stdout_outputter, $parameters[ :logging_outputter_pattern, '%d [%c] [%l] %M' ] )
|
482
496
|
|
483
497
|
add_outputter( @logger_instance, stdout_outputter )
|
@@ -507,7 +521,7 @@ module MobyUtil
|
|
507
521
|
# pass logger instance to hooking module
|
508
522
|
TDriver::Hooking.logger_instance = MobyUtil::Logger.instance
|
509
523
|
|
510
|
-
end
|
524
|
+
end
|
511
525
|
|
512
526
|
# enable logging
|
513
527
|
@enabled_stack = [ true ]
|
@@ -563,7 +577,7 @@ module MobyUtil
|
|
563
577
|
end
|
564
578
|
|
565
579
|
end # Logger
|
566
|
-
|
580
|
+
|
567
581
|
end # MobyUtil
|
568
582
|
|
569
583
|
# set global variable pointing to parameter class
|