testability-driver 1.2.1 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/tdriver-devtools +0 -0
- data/ext/native_extensions.c +165 -6
- data/lib/tdriver-devtools/behaviour/old/xml/update +0 -0
- data/lib/tdriver-devtools/behaviour/xml/generate.rb +0 -0
- data/lib/tdriver-devtools/behaviour/xml/rdoc_behaviour_xml_generator.rb +15 -1
- data/lib/tdriver-devtools/doc/update +0 -0
- data/lib/tdriver-devtools/doc/xslt/template.xsl +24 -14
- data/lib/tdriver-devtools/doc/xslt/update +0 -0
- data/lib/tdriver-devtools/tdriver-devtools.rb +0 -0
- data/lib/tdriver-devtools/tests/feature_tests/update +0 -0
- data/lib/tdriver/base/behaviour/{behaviour.rb → abstract.rb} +3 -6
- data/lib/tdriver/base/behaviour/behaviours/object_abstract.rb +107 -0
- data/lib/tdriver/base/behaviour/behaviours/object_behaviour_composition.rb +2 -2
- data/lib/tdriver/base/behaviour/behaviours/object_behaviour_description.rb +47 -37
- data/lib/tdriver/base/behaviour/factory.rb +260 -382
- data/lib/tdriver/base/behaviour/loader.rb +22 -4
- data/lib/tdriver/base/controller/abstraction.rb +56 -0
- data/lib/tdriver/base/controller/loader.rb +21 -0
- data/lib/tdriver/base/loader.rb +3 -1
- data/lib/tdriver/base/sut/controller.rb +91 -74
- data/lib/tdriver/base/sut/factory.rb +8 -8
- data/lib/tdriver/base/sut/generic/behaviours/agent.rb +77 -0
- data/lib/tdriver/base/sut/generic/behaviours/sut.rb +116 -96
- data/lib/tdriver/base/sut/generic/commands/agent.rb +43 -0
- data/lib/tdriver/base/sut/sut.rb +10 -8
- data/lib/tdriver/base/test_object/abstract.rb +25 -24
- data/lib/tdriver/base/test_object/adapter.rb +67 -44
- data/lib/tdriver/base/test_object/behaviours/test_object.rb +79 -20
- data/lib/tdriver/base/test_object/factory.rb +45 -15
- data/lib/tdriver/base/test_object/xml/adapter.rb +80 -57
- data/lib/tdriver/env.rb +0 -0
- data/lib/tdriver/loader.rb +0 -0
- data/lib/tdriver/matti.rb +0 -0
- data/lib/tdriver/report/error_recovery/tdriver_error_recovery.rb +1 -0
- data/lib/tdriver/report/report.rb +2 -1
- data/lib/tdriver/report/report_crash_file_capture.rb +12 -0
- data/lib/tdriver/report/report_creator.rb +6 -2
- data/lib/tdriver/report/report_execution_statistics.rb +27 -11
- data/lib/tdriver/report/report_graph_generator.rb +59 -0
- data/lib/tdriver/report/report_test_case_run.rb +34 -2
- data/lib/tdriver/report/report_writer.rb +12 -0
- data/lib/tdriver/tdriver.rb +12 -1
- data/lib/tdriver/util/agent/loader.rb +22 -0
- data/lib/tdriver/util/agent/service.rb +107 -0
- data/lib/tdriver/util/common/crc16.rb +17 -10
- data/lib/tdriver/util/common/hash.rb +4 -1
- data/lib/tdriver/util/common/kernel.rb +11 -0
- data/lib/tdriver/util/common/numeric.rb +48 -0
- data/lib/tdriver/util/common/object.rb +5 -2
- data/lib/tdriver/util/common/string.rb +8 -1
- data/lib/tdriver/util/filters/attribute_filter.rb +121 -0
- data/lib/tdriver/util/filters/loader.rb +29 -0
- data/lib/tdriver/util/fixture/loader.rb +22 -0
- data/lib/tdriver/util/fixture/service.rb +157 -0
- data/lib/tdriver/util/loader.rb +8 -2
- data/lib/tdriver/util/logger/logger.rb +12 -6
- data/lib/tdriver/util/other/config.rb +0 -0
- data/lib/tdriver/util/parameter/parameter.rb +221 -152
- data/lib/tdriver/util/plugin/error.rb +0 -0
- data/lib/tdriver/util/video/camera_linux.rb +36 -22
- data/lib/tdriver/util/xml/parsers/nokogiri/abstraction.rb +3 -13
- data/lib/tdriver/util/xml/parsers/nokogiri/node.rb +13 -8
- data/lib/tdriver/util/xml/parsers/nokogiri/nodeset.rb +51 -9
- data/lib/tdriver/util/xml/xml.rb +4 -2
- data/lib/tdriver/verify/verify.rb +280 -621
- data/lib/tdriver/version.rb +1 -1
- data/xml/behaviours/generic.xml +34 -0
- data/xml/templates/generic.xml +20 -3
- metadata +168 -240
- data/lib/tdriver-devtools/tests/feature_tests/output/application_closable_0x3f.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/application_close.feature +0 -15
- data/lib/tdriver-devtools/tests/feature_tests/output/application_environment.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/application_executable_name.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/application_uid.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/created.rid +0 -1
- data/lib/tdriver-devtools/tests/feature_tests/output/find_find.feature +0 -15
- data/lib/tdriver-devtools/tests/feature_tests/output/flash_behaviour_flash.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/flash_behaviour_flash_images.feature +0 -15
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_application.feature +0 -15
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_capture_screen.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_child.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_clear_verify_blocks.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_connect.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_controller_execution_order.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_controller_execution_order_0x3d.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_current_application_id.feature +0 -15
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_disconnect.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_dump_count.feature +0 -15
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_freeze.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_frozen.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_get_application_id.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_get_object.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_get_operator_data.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_get_ui_dump.feature +0 -15
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_get_user_information.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_input.feature +0 -15
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_parameter.feature +0 -15
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_press_key.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_received_data.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_refresh.feature +0 -20
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_refresh_timeout.feature +0 -15
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_refresh_tries.feature +0 -15
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_refresh_ui_dump.feature +0 -20
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_run.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_sent_data.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_state.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_translate.feature +0 -30
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_ui_type.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_ui_version.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_unfreeze.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_update.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_verify_always.feature +0 -20
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_verify_blocks.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_x_path.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_xml_data.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_xml_data_0x3d.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_xml_data_crc.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/switchbox_behaviour_power_down.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/switchbox_behaviour_power_status.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/switchbox_behaviour_power_up.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/switchbox_behaviour_reset.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/verification_test_object_exists_0x3f.feature +0 -15
- data/lib/tdriver/base/behaviour/factory_new.rb +0 -409
- data/lib/tdriver/base/test_object/identificator.rb +0 -518
- data/lib/tdriver/util/filters/dynamic_attributes.rb +0 -189
@@ -34,7 +34,14 @@ class String
|
|
34
34
|
|
35
35
|
def not_empty( message = "String must not be empty", exception = ArgumentError )
|
36
36
|
|
37
|
-
|
37
|
+
if empty?
|
38
|
+
|
39
|
+
# replace macros
|
40
|
+
#message.gsub!( '$1', self.inspect )
|
41
|
+
|
42
|
+
raise exception, message, caller
|
43
|
+
|
44
|
+
end
|
38
45
|
|
39
46
|
self
|
40
47
|
|
@@ -0,0 +1,121 @@
|
|
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
|
+
##
|
18
|
+
############################################################################
|
19
|
+
|
20
|
+
module TDriver
|
21
|
+
|
22
|
+
class AttributeFilter
|
23
|
+
|
24
|
+
# TODO: document me
|
25
|
+
def self.add_attribute( attribute )
|
26
|
+
|
27
|
+
_attribute = attribute.to_s
|
28
|
+
|
29
|
+
unless @attributes.include?( _attribute )
|
30
|
+
|
31
|
+
@attributes << _attribute.to_s
|
32
|
+
|
33
|
+
@attributes_string = @attributes.join( ',' )
|
34
|
+
|
35
|
+
yield if block_given?
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
# TODO: document me
|
42
|
+
def self.add_attributes( attributes )
|
43
|
+
|
44
|
+
updated_list = @attributes | attributes.collect{ | value | value.to_s }
|
45
|
+
|
46
|
+
unless updated_list == @attributes
|
47
|
+
|
48
|
+
@attributes = updated_list
|
49
|
+
|
50
|
+
@attributes_string = @attributes.join( ',' )
|
51
|
+
|
52
|
+
yield if block_given?
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
# TODO: document me
|
59
|
+
def self.has_attribute?( attribute )
|
60
|
+
|
61
|
+
@attributes.include?( attribute.to_s )
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
# TODO: document me
|
66
|
+
def self.filter_string
|
67
|
+
|
68
|
+
@attributes_string
|
69
|
+
|
70
|
+
end
|
71
|
+
|
72
|
+
# TODO: document me
|
73
|
+
def self.reset
|
74
|
+
|
75
|
+
@attributes_string = ""
|
76
|
+
|
77
|
+
@attributes = []
|
78
|
+
|
79
|
+
end
|
80
|
+
|
81
|
+
class << self
|
82
|
+
|
83
|
+
private
|
84
|
+
|
85
|
+
# TODO: document me
|
86
|
+
def initialize_class
|
87
|
+
|
88
|
+
@attributes_string = ""
|
89
|
+
|
90
|
+
@attributes = []
|
91
|
+
|
92
|
+
end
|
93
|
+
|
94
|
+
end
|
95
|
+
|
96
|
+
# initialize attribute filter class
|
97
|
+
initialize_class
|
98
|
+
|
99
|
+
# enable hooking for performance measurement & debug logging
|
100
|
+
TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
|
101
|
+
|
102
|
+
end # AttributeFilter
|
103
|
+
|
104
|
+
end # TDriver
|
105
|
+
|
106
|
+
# for backwards compatibility
|
107
|
+
module MobyUtil
|
108
|
+
|
109
|
+
class DynamicAttributeFilter
|
110
|
+
|
111
|
+
def self.instance
|
112
|
+
|
113
|
+
warn_caller '$1:$2 warning: deprecated class MobyUtil::DynamicAttributeFilter; please use static TDriver::AttributeFilter class instead'
|
114
|
+
|
115
|
+
TDriver::AttributeFilter
|
116
|
+
|
117
|
+
end
|
118
|
+
|
119
|
+
end # DynamicAttributeFilter
|
120
|
+
|
121
|
+
end # MobyUtil
|
@@ -0,0 +1,29 @@
|
|
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
|
+
##
|
18
|
+
############################################################################
|
19
|
+
|
20
|
+
[
|
21
|
+
|
22
|
+
# dynamic attribute filter module
|
23
|
+
'attribute_filter.rb'
|
24
|
+
|
25
|
+
].each{ | filename |
|
26
|
+
|
27
|
+
require File.expand_path( File.join( File.dirname( __FILE__ ), filename ) )
|
28
|
+
|
29
|
+
}
|
@@ -0,0 +1,22 @@
|
|
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
|
+
##
|
18
|
+
############################################################################
|
19
|
+
|
20
|
+
# fixture services module
|
21
|
+
require File.expand_path( File.join( File.dirname( __FILE__ ), 'service.rb' ) )
|
22
|
+
|
@@ -0,0 +1,157 @@
|
|
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
|
+
##
|
18
|
+
############################################################################
|
19
|
+
|
20
|
+
module TDriver
|
21
|
+
|
22
|
+
class FixturePluginService
|
23
|
+
|
24
|
+
# remove all public methods
|
25
|
+
instance_methods.each{ | method |
|
26
|
+
|
27
|
+
undef_method( method ) unless method =~ /^__|^(methods|inspect|to_s|class|nil?|extend)/
|
28
|
+
|
29
|
+
}
|
30
|
+
|
31
|
+
# TODO: document me
|
32
|
+
def initialize( options = {} )
|
33
|
+
|
34
|
+
# verify that options is type of hash
|
35
|
+
options.check_type Hash, 'wrong argument type $1 for fixture service options (expected $2)'
|
36
|
+
|
37
|
+
# verify that name is defined in options hash
|
38
|
+
options.require_key :name
|
39
|
+
|
40
|
+
options.require_key :arguments
|
41
|
+
|
42
|
+
options.require_key :target
|
43
|
+
|
44
|
+
options.require_key :configuration
|
45
|
+
|
46
|
+
# store given options
|
47
|
+
@options = options
|
48
|
+
|
49
|
+
# store caller backtrace
|
50
|
+
@caller = caller
|
51
|
+
|
52
|
+
self
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
def method_missing( fixture_method, arguments = {} )
|
57
|
+
|
58
|
+
begin
|
59
|
+
|
60
|
+
arguments.check_type Hash, 'wrong argument type $1 for fixture method arguments (expected $2)'
|
61
|
+
|
62
|
+
result = nil
|
63
|
+
|
64
|
+
_async = @options[ :arguments ][ :async ].true?
|
65
|
+
|
66
|
+
_target = @options[ :target ]
|
67
|
+
|
68
|
+
_fixture_name = @options[ :name ].to_s
|
69
|
+
|
70
|
+
_fixture_method = fixture_method.to_s
|
71
|
+
|
72
|
+
_sut = _target.sut
|
73
|
+
|
74
|
+
params = { :name => _fixture_name.to_s, :command_name => _fixture_method, :parameters => arguments, :async => _async }
|
75
|
+
|
76
|
+
if _target.sut?
|
77
|
+
|
78
|
+
params.merge!( :application_id => nil, :object_id => _target.id, :object_type => :Application )
|
79
|
+
|
80
|
+
else
|
81
|
+
|
82
|
+
params.merge!( :application_id => _target.get_application_id, :object_id => _target.id, :object_type => _target.attribute( 'objectType' ).to_sym )
|
83
|
+
|
84
|
+
end
|
85
|
+
|
86
|
+
result = _sut.execute_command( MobyCommand::Fixture.new( params ) )
|
87
|
+
|
88
|
+
rescue
|
89
|
+
|
90
|
+
$logger.behaviour "FAIL;Failed when calling fixture #{ @options[:arguments ].inspect } with name #{ _fixture_name.inspect }, method #{ _fixture_method.inspect } and parameters #{ arguments.inspect }.;#{ _target.id.to_s };sut;{};fixture;"
|
91
|
+
|
92
|
+
raise MobyBase::BehaviourError.new("Fixture", "Failed when calling fixture #{ @options[:arguments ].inspect } with name #{ _fixture_name.inspect }, method #{ _fixture_method.inspect } and parameters #{ arguments.inspect }")
|
93
|
+
|
94
|
+
end
|
95
|
+
|
96
|
+
$logger.behaviour "PASS;The fixture command (#{ @options[ :arguments ]}) was executed successfully with name #{ _fixture_name.inspect }, method #{ _fixture_method.inspect } and parameters #{ arguments.inspect }.;#{ _target.id.to_s };sut;{};fixture;"
|
97
|
+
|
98
|
+
result
|
99
|
+
|
100
|
+
end
|
101
|
+
|
102
|
+
end # FixturePluginService
|
103
|
+
|
104
|
+
class FixtureService
|
105
|
+
|
106
|
+
# remove all public methods
|
107
|
+
instance_methods.each{ | method |
|
108
|
+
|
109
|
+
undef_method( method ) unless method =~ /^__|^(methods|inspect|to_s|class|nil?|extend)/
|
110
|
+
|
111
|
+
}
|
112
|
+
|
113
|
+
# TODO: document me
|
114
|
+
def initialize( options = {} )
|
115
|
+
|
116
|
+
# verify that options is type of hash
|
117
|
+
options.check_type Hash, 'wrong argument type $1 for fixture service options (expected $2)'
|
118
|
+
|
119
|
+
# verify that target object is defined in options hash
|
120
|
+
options.require_key :target
|
121
|
+
|
122
|
+
# store given options
|
123
|
+
@options = options
|
124
|
+
|
125
|
+
# store sut variable
|
126
|
+
@target = options[ :target ]
|
127
|
+
|
128
|
+
# store caller backtrace
|
129
|
+
@caller = caller
|
130
|
+
|
131
|
+
self
|
132
|
+
|
133
|
+
end
|
134
|
+
|
135
|
+
def method_missing( name, arguments = {} )
|
136
|
+
|
137
|
+
arguments.check_type Hash, 'wrong argument type $1 for fixture options (expected $2)'
|
138
|
+
|
139
|
+
_fixtures = $parameters[ @target.sut.id ][ :fixtures, {} ]
|
140
|
+
|
141
|
+
if _fixtures.has_key?( name )
|
142
|
+
|
143
|
+
FixturePluginService.new( :target => @target, :name => name, :arguments => arguments, :configuration => _fixtures[ name ] )
|
144
|
+
|
145
|
+
else
|
146
|
+
|
147
|
+
$logger.behaviour "FAIL;Failed to execute fixture due to #{ name.inspect } not foudn for #{ @target.sut.id.inspect }.;#{ @target.id.to_s };sut;{};fixture;"
|
148
|
+
|
149
|
+
raise MobyBase::BehaviourError.new( "Fixture", "Failed to execute fixture due to #{ name.to_s.inspect } not found for #{ @target.sut.id.inspect }" )
|
150
|
+
|
151
|
+
end
|
152
|
+
|
153
|
+
end
|
154
|
+
|
155
|
+
end # FixtureService
|
156
|
+
|
157
|
+
end # TDriver
|
data/lib/tdriver/util/loader.rb
CHANGED
@@ -37,8 +37,8 @@ require 'rubygems'
|
|
37
37
|
# statistics module
|
38
38
|
'statistics/statistics.rb',
|
39
39
|
|
40
|
-
#
|
41
|
-
'filters/
|
40
|
+
# filter modules
|
41
|
+
'filters/loader.rb',
|
42
42
|
|
43
43
|
# plugin service modules
|
44
44
|
'plugin/loader.rb',
|
@@ -61,6 +61,12 @@ require 'rubygems'
|
|
61
61
|
# recorder and scripter modules
|
62
62
|
'recorder/loader.rb',
|
63
63
|
|
64
|
+
# agent service command modules
|
65
|
+
'agent/loader.rb',
|
66
|
+
|
67
|
+
# fixture service modules
|
68
|
+
'fixture/loader.rb',
|
69
|
+
|
64
70
|
# video capture/util modules
|
65
71
|
'video/loader.rb',
|
66
72
|
|
@@ -452,10 +452,14 @@ module MobyUtil
|
|
452
452
|
@logger_instance = get_logger( 'TDriver' )
|
453
453
|
|
454
454
|
# create unique name for logfile or use default (TDriver.log)
|
455
|
-
|
455
|
+
if $parameters[ :logging_outputter_unique_filename, false ].true?
|
456
|
+
filename = "TDriver_#{ Time.now.to_i }.log"
|
457
|
+
else
|
458
|
+
filename = 'TDriver.log'
|
459
|
+
end
|
456
460
|
|
457
461
|
# check if outputter is enabled
|
458
|
-
if
|
462
|
+
if $parameters[ :logging_outputter_enabled, false ].true?
|
459
463
|
|
460
464
|
# create new outputter instance type of FileOutputter
|
461
465
|
outputter = create_outputter(
|
@@ -470,7 +474,7 @@ module MobyUtil
|
|
470
474
|
:filename => File.join( outputter_path, filename ),
|
471
475
|
|
472
476
|
# append to or truncate file
|
473
|
-
:trunc =>
|
477
|
+
:trunc => $parameters[ :logging_outputter_append, false ].false?,
|
474
478
|
|
475
479
|
# logging level
|
476
480
|
:level => logging_level
|
@@ -478,7 +482,7 @@ module MobyUtil
|
|
478
482
|
)
|
479
483
|
|
480
484
|
# set outputter log event write pattern
|
481
|
-
set_outputter_pattern( outputter,
|
485
|
+
set_outputter_pattern( outputter, $parameters[ :logging_outputter_pattern, '%d [%c] [%l] %M' ] )
|
482
486
|
|
483
487
|
# add outputter to logger instance
|
484
488
|
add_outputter( @logger_instance, outputter )
|
@@ -486,14 +490,16 @@ module MobyUtil
|
|
486
490
|
end
|
487
491
|
|
488
492
|
# Add stdout outputter if set on configuration parameters
|
489
|
-
if
|
493
|
+
if $parameters[ :logging_stdout_outputter_enabled, false ].true?
|
490
494
|
stdout_outputter = create_outputter(
|
491
495
|
Log4r::StdoutOutputter, # outputter type
|
492
496
|
"TDriver_LOG_stdout", # outputter name
|
493
497
|
:level => logging_level # logging level
|
494
498
|
)
|
495
|
-
set_outputter_pattern( stdout_outputter,
|
499
|
+
set_outputter_pattern( stdout_outputter, $parameters[ :logging_outputter_pattern, '%d [%c] [%l] %M' ] )
|
500
|
+
|
496
501
|
add_outputter( @logger_instance, stdout_outputter )
|
502
|
+
|
497
503
|
end
|
498
504
|
|
499
505
|
rescue
|
File without changes
|
@@ -427,6 +427,65 @@ module TDriver
|
|
427
427
|
|
428
428
|
case element.name
|
429
429
|
|
430
|
+
when 'include'
|
431
|
+
|
432
|
+
directory = MobyUtil::FileHelper.expand_path( attributes[ 'directory' ] )
|
433
|
+
|
434
|
+
files_pattern = Regexp.new( attributes[ 'files' ] )
|
435
|
+
|
436
|
+
=begin
|
437
|
+
pattern_flags = attributes[ 'flags' ].to_s.each_char.inject( 0 ){ | flags, char |
|
438
|
+
|
439
|
+
case char
|
440
|
+
|
441
|
+
when /m/i
|
442
|
+
|
443
|
+
flags += Regexp::MULTILINE
|
444
|
+
|
445
|
+
when /i/i
|
446
|
+
|
447
|
+
flags += Regexp::IGNORECASE
|
448
|
+
|
449
|
+
when /x/i
|
450
|
+
|
451
|
+
flags += Regexp::EXTENDED
|
452
|
+
|
453
|
+
else
|
454
|
+
|
455
|
+
raise ArgumentError, "Invalid regular expression pattern flag #{ char.inspect } (expected: 'm', 'i' or 'x')"
|
456
|
+
|
457
|
+
end
|
458
|
+
|
459
|
+
}
|
460
|
+
=end
|
461
|
+
|
462
|
+
value = ParameterHash.new
|
463
|
+
|
464
|
+
included_files = []
|
465
|
+
|
466
|
+
# iterate each found file from given directory
|
467
|
+
Dir.glob( File.join( directory, '*' ) ).each do | file |
|
468
|
+
|
469
|
+
# and merge content of the file if filename matches with given files pattern
|
470
|
+
if File.basename( file ) =~ files_pattern
|
471
|
+
|
472
|
+
value.merge!( process_file( file, false ) )
|
473
|
+
|
474
|
+
included_files << file
|
475
|
+
|
476
|
+
end
|
477
|
+
|
478
|
+
end
|
479
|
+
|
480
|
+
# merge included values to results
|
481
|
+
results.merge!( value )
|
482
|
+
|
483
|
+
# store included files to :included_files value
|
484
|
+
name = "included_files"
|
485
|
+
|
486
|
+
# append to :included files value
|
487
|
+
value = ( results[ name.to_sym, [] ].concat( included_files ) ).compact.uniq
|
488
|
+
|
430
489
|
when 'keymap'
|
431
490
|
|
432
491
|
# use element name as parameter name ("keymap")
|
@@ -672,8 +731,12 @@ module TDriver
|
|
672
731
|
|
673
732
|
end
|
674
733
|
|
675
|
-
# apply global parameters to root level (e.g.
|
676
|
-
@parameters.recursive_merge!(
|
734
|
+
# apply global parameters to root level (e.g. TDriver::Parameter[ :logging_outputter_enabled ])
|
735
|
+
@parameters.recursive_merge!(
|
736
|
+
|
737
|
+
get_template( 'global' )
|
738
|
+
|
739
|
+
)
|
677
740
|
|
678
741
|
# load and apply default parameter values
|
679
742
|
load_default_parameters if options[ :load_default_parameters ] == true
|
@@ -694,7 +757,7 @@ module TDriver
|
|
694
757
|
end
|
695
758
|
|
696
759
|
# TODO: document me
|
697
|
-
def process_file( filename )
|
760
|
+
def process_file( filename, root = true )
|
698
761
|
|
699
762
|
begin
|
700
763
|
|
@@ -702,7 +765,9 @@ module TDriver
|
|
702
765
|
file_content = load_file( filename )
|
703
766
|
|
704
767
|
# parse file content and retrieve root element
|
705
|
-
root_element = MobyUtil::XML.parse_string( file_content )
|
768
|
+
root_element = MobyUtil::XML.parse_string( file_content ) #.root
|
769
|
+
|
770
|
+
root_element = root_element.root if root == true
|
706
771
|
|
707
772
|
# parse root element
|
708
773
|
process_element( root_element )
|
@@ -766,192 +831,196 @@ module TDriver
|
|
766
831
|
|
767
832
|
end # self
|
768
833
|
|
769
|
-
|
770
|
-
def self.parse_file( filename, reset_parameters = false )
|
834
|
+
class << self
|
771
835
|
|
772
|
-
#
|
773
|
-
|
836
|
+
# TODO: document me
|
837
|
+
def parse_file( filename, reset_parameters = false )
|
774
838
|
|
775
|
-
|
776
|
-
|
839
|
+
# check argument type for filename
|
840
|
+
filename.check_type [ String ], 'wrong argument type $1 for filename argument (expected $2)'
|
777
841
|
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
# load and parse given file
|
782
|
-
load_parameters_file( filename )
|
783
|
-
|
784
|
-
end
|
785
|
-
|
786
|
-
# TODO: document me
|
787
|
-
def self.parse_string( source, merge_hashes = true )
|
788
|
-
|
789
|
-
# check argument type for source
|
790
|
-
source.check_type [ String ], 'wrong argument type $1 for source XML argument (expected $2)'
|
842
|
+
# check argument type for filename
|
843
|
+
reset_parameters.check_type [ TrueClass, FalseClass ], 'wrong argument type $1 for reset_parameters boolean argument (expected $2)'
|
791
844
|
|
792
|
-
|
793
|
-
|
845
|
+
# reset parameter hash if requested
|
846
|
+
@parameters.clear if reset_parameters == true
|
847
|
+
|
848
|
+
# load and parse given file
|
849
|
+
load_parameters_file( filename )
|
850
|
+
|
851
|
+
end
|
852
|
+
|
853
|
+
# TODO: document me
|
854
|
+
def parse_string( source, merge_hashes = true )
|
855
|
+
|
856
|
+
# check argument type for source
|
857
|
+
source.check_type [ String ], 'wrong argument type $1 for source XML argument (expected $2)'
|
858
|
+
|
859
|
+
# check argument type for merge_hashes
|
860
|
+
merge_hashes.check_type [ TrueClass, FalseClass ], 'wrong argument type $1 for merge_hashes argument (expected $2)'
|
861
|
+
|
862
|
+
# process xml string, returns hash as result
|
863
|
+
hash = process_string( source )
|
794
864
|
|
795
|
-
|
796
|
-
|
865
|
+
if merge_hashes
|
866
|
+
|
867
|
+
@parameters.recursive_merge!( hash )
|
868
|
+
|
869
|
+
else
|
797
870
|
|
798
|
-
|
871
|
+
@parameters.merge!( hash )
|
872
|
+
|
873
|
+
end
|
799
874
|
|
800
|
-
|
875
|
+
end
|
876
|
+
|
877
|
+
# TODO: document me
|
878
|
+
def clear
|
801
879
|
|
802
|
-
|
803
|
-
|
804
|
-
@parameters.
|
880
|
+
@parameter_files.clear
|
881
|
+
|
882
|
+
@parameters.clear
|
805
883
|
|
806
884
|
end
|
807
|
-
|
808
|
-
end
|
809
|
-
|
810
|
-
# TODO: document me
|
811
|
-
def self.clear
|
812
|
-
|
813
|
-
@parameter_files.clear
|
814
|
-
|
815
|
-
@parameters.clear
|
816
|
-
|
817
|
-
end
|
818
885
|
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
|
886
|
+
# TODO: document me
|
887
|
+
def files
|
888
|
+
|
889
|
+
# return loaded parameter files list
|
890
|
+
@parameter_files
|
891
|
+
|
892
|
+
end
|
826
893
|
|
827
|
-
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
894
|
+
# TODO: document me
|
895
|
+
def template_files
|
896
|
+
|
897
|
+
# return loaded parameter files list
|
898
|
+
@template_files
|
899
|
+
|
900
|
+
end
|
834
901
|
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
|
902
|
+
# TODO: document me
|
903
|
+
def has_key?( key )
|
904
|
+
|
905
|
+
@parameters.has_key?( key )
|
906
|
+
|
907
|
+
end
|
841
908
|
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
|
847
|
-
|
909
|
+
# TODO: document me
|
910
|
+
def has_value?( key )
|
911
|
+
|
912
|
+
@parameters.has_value?( key )
|
913
|
+
|
914
|
+
end
|
848
915
|
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
|
853
|
-
|
854
|
-
|
916
|
+
# TODO: document me
|
917
|
+
def keys
|
918
|
+
|
919
|
+
@parameters.keys
|
920
|
+
|
921
|
+
end
|
855
922
|
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
|
861
|
-
|
923
|
+
# TODO: document me
|
924
|
+
def values
|
925
|
+
|
926
|
+
@parameters.values
|
927
|
+
|
928
|
+
end
|
862
929
|
|
863
|
-
|
864
|
-
|
865
|
-
|
866
|
-
|
867
|
-
|
868
|
-
|
930
|
+
# TODO: document me
|
931
|
+
def []( key, *default )
|
932
|
+
|
933
|
+
@parameters[ key, *default ]
|
934
|
+
|
935
|
+
end
|
869
936
|
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
|
874
|
-
|
875
|
-
|
937
|
+
# TODO: document me
|
938
|
+
def []=( key, value )
|
939
|
+
|
940
|
+
@parameters[ key ] = value
|
941
|
+
|
942
|
+
end
|
876
943
|
|
877
|
-
|
878
|
-
|
944
|
+
# TODO: document me
|
945
|
+
def fetch( key, *default, &block )
|
879
946
|
|
880
|
-
|
947
|
+
@parameters.__send__( :[], key, *default, &block )
|
881
948
|
|
882
|
-
|
949
|
+
end
|
883
950
|
|
884
|
-
|
885
|
-
|
951
|
+
# TODO: document me
|
952
|
+
def if_found( key, &block )
|
886
953
|
|
887
|
-
|
954
|
+
@parameters.__send__( :if_found, key, &block )
|
888
955
|
|
889
|
-
|
956
|
+
end
|
890
957
|
|
891
|
-
|
892
|
-
|
893
|
-
|
894
|
-
|
895
|
-
|
896
|
-
|
897
|
-
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
|
958
|
+
# TODO: document me
|
959
|
+
def delete( key )
|
960
|
+
|
961
|
+
@parameters.delete( key )
|
962
|
+
|
963
|
+
end
|
964
|
+
|
965
|
+
# TODO: document me
|
966
|
+
def inspect
|
967
|
+
|
968
|
+
@parameters.inspect
|
969
|
+
|
970
|
+
end
|
904
971
|
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
|
972
|
+
# TODO: document me
|
973
|
+
def templates
|
974
|
+
|
975
|
+
@templates
|
976
|
+
|
977
|
+
end
|
911
978
|
|
912
|
-
|
979
|
+
def parameters
|
913
980
|
|
914
|
-
|
915
|
-
|
916
|
-
hash
|
981
|
+
warn "warning: deprecated method #{ self.name }##{ __method__ }; please use #{ self.name }#hash instead"
|
917
982
|
|
918
|
-
|
983
|
+
hash
|
984
|
+
|
985
|
+
end
|
919
986
|
|
920
|
-
|
921
|
-
|
922
|
-
@parameters
|
987
|
+
def hash
|
923
988
|
|
924
|
-
|
989
|
+
@parameters
|
990
|
+
|
991
|
+
end
|
925
992
|
|
926
|
-
|
927
|
-
|
993
|
+
# TODO: document me
|
994
|
+
def reset
|
928
995
|
|
929
|
-
|
930
|
-
|
931
|
-
|
996
|
+
reset_hashes
|
997
|
+
|
998
|
+
end
|
932
999
|
|
933
|
-
|
934
|
-
|
935
|
-
|
936
|
-
|
937
|
-
|
938
|
-
|
939
|
-
|
940
|
-
# deprecated methods
|
941
|
-
def self.reset_parameters
|
942
|
-
|
943
|
-
warn "warning: deprecated method #{ self.name }##{ __method__ }; please use #{ self.name }#reset instead"
|
944
|
-
|
945
|
-
reset
|
1000
|
+
# TODO: document me
|
1001
|
+
def configured_suts
|
1002
|
+
|
1003
|
+
@sut_list
|
1004
|
+
|
1005
|
+
end
|
946
1006
|
|
947
|
-
|
1007
|
+
# deprecated methods
|
1008
|
+
def reset_parameters
|
1009
|
+
|
1010
|
+
warn "warning: deprecated method #{ self.name }##{ __method__ }; please use #{ self.name }#reset instead"
|
1011
|
+
|
1012
|
+
reset
|
1013
|
+
|
1014
|
+
end
|
1015
|
+
|
1016
|
+
# load parameter xml files
|
1017
|
+
def load_parameters_xml( filename, reset = false )
|
948
1018
|
|
949
|
-
|
950
|
-
def self.load_parameters_xml( filename, reset = false )
|
1019
|
+
warn "warning: deprecated method #{ self.name }##{ __method__ }; please use #{ self.name }#parse_file instead"
|
951
1020
|
|
952
|
-
|
1021
|
+
parse_file( filename, reset )
|
953
1022
|
|
954
|
-
|
1023
|
+
end
|
955
1024
|
|
956
1025
|
end
|
957
1026
|
|