cutedriver-driver 2.0.0.20210120164037

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.
Files changed (226) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +16 -0
  3. data/bin/start_app_perf +200 -0
  4. data/bin/tdriver-devtools +3 -0
  5. data/config/sut_parameters.rb +52 -0
  6. data/config/sut_setup.rb +32 -0
  7. data/config/sut_teardown.rb +32 -0
  8. data/config/tdriver_custom_error_recovery.rb +83 -0
  9. data/ext/extconf.rb +70 -0
  10. data/ext/native_extensions.c +315 -0
  11. data/lib/matti.rb +25 -0
  12. data/lib/tdriver-devtools/behaviour/old/xml/example/flick-example.rb +120 -0
  13. data/lib/tdriver-devtools/behaviour/old/xml/example/impl.rb_invalid +194 -0
  14. data/lib/tdriver-devtools/behaviour/old/xml/generate_behaviour_xml.rb +95 -0
  15. data/lib/tdriver-devtools/behaviour/old/xml/lib/tdriver_generator.rb +722 -0
  16. data/lib/tdriver-devtools/behaviour/old/xml/qdoc_generator.rb +321 -0
  17. data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.method.template +43 -0
  18. data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.module.template +54 -0
  19. data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.argument.template +7 -0
  20. data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.argument_type.template +7 -0
  21. data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.exception.template +5 -0
  22. data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.howto.line.template +2 -0
  23. data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.howto.template +5 -0
  24. data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.method.template +23 -0
  25. data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.template +14 -0
  26. data/lib/tdriver-devtools/behaviour/old/xml/update +3 -0
  27. data/lib/tdriver-devtools/behaviour/xml/generate.rb +88 -0
  28. data/lib/tdriver-devtools/behaviour/xml/rdoc_behaviour_xml_generator.rb +1945 -0
  29. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.argument.default.template +1 -0
  30. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.argument.template +3 -0
  31. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.argument_type.template +4 -0
  32. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.exception.template +4 -0
  33. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.arguments.template +4 -0
  34. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.deprecated.template +3 -0
  35. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.exceptions.template +3 -0
  36. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.info.template +1 -0
  37. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.returns.template +3 -0
  38. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.tables.template +3 -0
  39. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.template +12 -0
  40. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.returns.template +5 -0
  41. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.table.item.template +1 -0
  42. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.table.row.template +2 -0
  43. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.table.template +8 -0
  44. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.template +14 -0
  45. data/lib/tdriver-devtools/doc/behaviour_xml/QtExampleGestureBehaviour.xml +138 -0
  46. data/lib/tdriver-devtools/doc/behaviour_xml/created.rid +1 -0
  47. data/lib/tdriver-devtools/doc/behaviour_xml/tdriver.hash +1 -0
  48. data/lib/tdriver-devtools/doc/feature_xml/qt_widget_hold.feature.xml +9 -0
  49. data/lib/tdriver-devtools/doc/feature_xml/qt_widget_tap.feature.xml +9 -0
  50. data/lib/tdriver-devtools/doc/generate.rb +917 -0
  51. data/lib/tdriver-devtools/doc/update +1 -0
  52. data/lib/tdriver-devtools/doc/xslt/html.rb +7 -0
  53. data/lib/tdriver-devtools/doc/xslt/template.xsl +2170 -0
  54. data/lib/tdriver-devtools/doc/xslt/update +3 -0
  55. data/lib/tdriver-devtools/plugin/placeholder.txt +1 -0
  56. data/lib/tdriver-devtools/tdriver-devtools.rb +404 -0
  57. data/lib/tdriver-devtools/tests/feature_tests/example/behaviour_example.rb +100 -0
  58. data/lib/tdriver-devtools/tests/feature_tests/generate.rb +82 -0
  59. data/lib/tdriver-devtools/tests/feature_tests/lib/custom_rdoc_generator.rb +468 -0
  60. data/lib/tdriver-devtools/tests/feature_tests/templates/feature_attribute.template +5 -0
  61. data/lib/tdriver-devtools/tests/feature_tests/templates/feature_method.template +5 -0
  62. data/lib/tdriver-devtools/tests/feature_tests/templates/scenario_attribute.template +5 -0
  63. data/lib/tdriver-devtools/tests/feature_tests/templates/scenario_method.template +5 -0
  64. data/lib/tdriver-devtools/tests/feature_tests/update +3 -0
  65. data/lib/tdriver.rb +23 -0
  66. data/lib/tdriver/base/behaviour/abstract.rb +29 -0
  67. data/lib/tdriver/base/behaviour/behaviours/object_abstract.rb +107 -0
  68. data/lib/tdriver/base/behaviour/behaviours/object_behaviour_composition.rb +99 -0
  69. data/lib/tdriver/base/behaviour/behaviours/object_behaviour_description.rb +278 -0
  70. data/lib/tdriver/base/behaviour/behaviours/object_composition.rb +119 -0
  71. data/lib/tdriver/base/behaviour/factory.rb +495 -0
  72. data/lib/tdriver/base/behaviour/loader.rb +46 -0
  73. data/lib/tdriver/base/command_data/command_data.rb +51 -0
  74. data/lib/tdriver/base/command_data/loader.rb +29 -0
  75. data/lib/tdriver/base/controller/abstraction.rb +56 -0
  76. data/lib/tdriver/base/controller/loader.rb +21 -0
  77. data/lib/tdriver/base/errors.rb +134 -0
  78. data/lib/tdriver/base/loader.rb +47 -0
  79. data/lib/tdriver/base/state_object.rb +373 -0
  80. data/lib/tdriver/base/sut/adapter.rb +54 -0
  81. data/lib/tdriver/base/sut/controller.rb +151 -0
  82. data/lib/tdriver/base/sut/factory.rb +339 -0
  83. data/lib/tdriver/base/sut/generic/behaviours/agent.rb +77 -0
  84. data/lib/tdriver/base/sut/generic/behaviours/application.rb +427 -0
  85. data/lib/tdriver/base/sut/generic/behaviours/controller.rb +67 -0
  86. data/lib/tdriver/base/sut/generic/behaviours/find.rb +107 -0
  87. data/lib/tdriver/base/sut/generic/behaviours/flash_behaviour.rb +337 -0
  88. data/lib/tdriver/base/sut/generic/behaviours/sut.rb +1888 -0
  89. data/lib/tdriver/base/sut/generic/behaviours/switchbox_behaviour.rb +210 -0
  90. data/lib/tdriver/base/sut/generic/behaviours/verification.rb +222 -0
  91. data/lib/tdriver/base/sut/generic/commands/agent.rb +43 -0
  92. data/lib/tdriver/base/sut/generic/commands/application.rb +274 -0
  93. data/lib/tdriver/base/sut/generic/commands/fixture.rb +47 -0
  94. data/lib/tdriver/base/sut/generic/commands/key_sequence.rb +94 -0
  95. data/lib/tdriver/base/sut/generic/commands/screen_capture.rb +64 -0
  96. data/lib/tdriver/base/sut/generic/plugin.rb +97 -0
  97. data/lib/tdriver/base/sut/loader.rb +35 -0
  98. data/lib/tdriver/base/sut/sut.rb +98 -0
  99. data/lib/tdriver/base/test_object/abstract.rb +208 -0
  100. data/lib/tdriver/base/test_object/adapter.rb +740 -0
  101. data/lib/tdriver/base/test_object/behaviours/syncronization.rb +144 -0
  102. data/lib/tdriver/base/test_object/behaviours/test_object.rb +1047 -0
  103. data/lib/tdriver/base/test_object/cache.rb +134 -0
  104. data/lib/tdriver/base/test_object/factory.rb +684 -0
  105. data/lib/tdriver/base/test_object/loader.rb +51 -0
  106. data/lib/tdriver/base/test_object/verification.rb +178 -0
  107. data/lib/tdriver/base/test_object/xml/abstraction.rb +63 -0
  108. data/lib/tdriver/base/test_object/xml/adapter.rb +773 -0
  109. data/lib/tdriver/env.rb +21 -0
  110. data/lib/tdriver/loader.rb +57 -0
  111. data/lib/tdriver/matti.rb +35 -0
  112. data/lib/tdriver/report/error_recovery/tdriver_custom_error_recovery.rb +83 -0
  113. data/lib/tdriver/report/error_recovery/tdriver_error_recovery.rb +168 -0
  114. data/lib/tdriver/report/error_recovery/tdriver_error_recovery_settings.rb +106 -0
  115. data/lib/tdriver/report/report.rb +61 -0
  116. data/lib/tdriver/report/report_api.rb +348 -0
  117. data/lib/tdriver/report/report_combine.rb +86 -0
  118. data/lib/tdriver/report/report_crash_file_capture.rb +178 -0
  119. data/lib/tdriver/report/report_creator.rb +665 -0
  120. data/lib/tdriver/report/report_cucumber.rb +158 -0
  121. data/lib/tdriver/report/report_cucumber_listener.rb +184 -0
  122. data/lib/tdriver/report/report_cucumber_reporter.rb +181 -0
  123. data/lib/tdriver/report/report_data_presentation.rb +156 -0
  124. data/lib/tdriver/report/report_data_table.rb +64 -0
  125. data/lib/tdriver/report/report_execution_statistics.rb +400 -0
  126. data/lib/tdriver/report/report_file_capture.rb +159 -0
  127. data/lib/tdriver/report/report_graph_generator.rb +59 -0
  128. data/lib/tdriver/report/report_grouping.rb +541 -0
  129. data/lib/tdriver/report/report_javascript.rb +199 -0
  130. data/lib/tdriver/report/report_junit_xml.rb +147 -0
  131. data/lib/tdriver/report/report_rspec.rb +108 -0
  132. data/lib/tdriver/report/report_test_case_run.rb +725 -0
  133. data/lib/tdriver/report/report_test_run.rb +1476 -0
  134. data/lib/tdriver/report/report_test_unit.rb +223 -0
  135. data/lib/tdriver/report/report_writer.rb +1621 -0
  136. data/lib/tdriver/tdriver.rb +209 -0
  137. data/lib/tdriver/util/agent/loader.rb +22 -0
  138. data/lib/tdriver/util/agent/service.rb +107 -0
  139. data/lib/tdriver/util/common/array.rb +39 -0
  140. data/lib/tdriver/util/common/boolean.rb +48 -0
  141. data/lib/tdriver/util/common/crc16.rb +149 -0
  142. data/lib/tdriver/util/common/environment.rb +154 -0
  143. data/lib/tdriver/util/common/error.rb +40 -0
  144. data/lib/tdriver/util/common/exception.rb +53 -0
  145. data/lib/tdriver/util/common/exceptions.rb +12 -0
  146. data/lib/tdriver/util/common/file.rb +328 -0
  147. data/lib/tdriver/util/common/gem.rb +109 -0
  148. data/lib/tdriver/util/common/hash.rb +288 -0
  149. data/lib/tdriver/util/common/kernel.rb +253 -0
  150. data/lib/tdriver/util/common/loader.rb +47 -0
  151. data/lib/tdriver/util/common/numeric.rb +159 -0
  152. data/lib/tdriver/util/common/object.rb +159 -0
  153. data/lib/tdriver/util/common/retryable.rb +179 -0
  154. data/lib/tdriver/util/common/stackable.rb +185 -0
  155. data/lib/tdriver/util/common/string.rb +174 -0
  156. data/lib/tdriver/util/database/access.rb +240 -0
  157. data/lib/tdriver/util/database/connection.rb +44 -0
  158. data/lib/tdriver/util/database/error.rb +34 -0
  159. data/lib/tdriver/util/database/loader.rb +28 -0
  160. data/lib/tdriver/util/filters/attribute_filter.rb +121 -0
  161. data/lib/tdriver/util/filters/loader.rb +29 -0
  162. data/lib/tdriver/util/fixture/loader.rb +22 -0
  163. data/lib/tdriver/util/fixture/service.rb +211 -0
  164. data/lib/tdriver/util/hooking/hooking.rb +477 -0
  165. data/lib/tdriver/util/keymap/keymap.rb +81 -0
  166. data/lib/tdriver/util/loader.rb +80 -0
  167. data/lib/tdriver/util/localisation/error.rb +31 -0
  168. data/lib/tdriver/util/localisation/loader.rb +25 -0
  169. data/lib/tdriver/util/localisation/localisation.rb +762 -0
  170. data/lib/tdriver/util/logger/loader.rb +22 -0
  171. data/lib/tdriver/util/logger/logger.rb +591 -0
  172. data/lib/tdriver/util/operator_data/error.rb +29 -0
  173. data/lib/tdriver/util/operator_data/loader.rb +27 -0
  174. data/lib/tdriver/util/operator_data/operator_data.rb +93 -0
  175. data/lib/tdriver/util/other/config.rb +221 -0
  176. data/lib/tdriver/util/parameter/error.rb +48 -0
  177. data/lib/tdriver/util/parameter/loader.rb +25 -0
  178. data/lib/tdriver/util/parameter/parameter.rb +1161 -0
  179. data/lib/tdriver/util/plugin/abstract.rb +61 -0
  180. data/lib/tdriver/util/plugin/error.rb +0 -0
  181. data/lib/tdriver/util/plugin/loader.rb +28 -0
  182. data/lib/tdriver/util/plugin/service.rb +319 -0
  183. data/lib/tdriver/util/recorder/loader.rb +25 -0
  184. data/lib/tdriver/util/recorder/recorder.rb +72 -0
  185. data/lib/tdriver/util/recorder/scripter.rb +294 -0
  186. data/lib/tdriver/util/statistics/statistics.rb +89 -0
  187. data/lib/tdriver/util/user_data/error.rb +28 -0
  188. data/lib/tdriver/util/user_data/loader.rb +25 -0
  189. data/lib/tdriver/util/user_data/user_data.rb +104 -0
  190. data/lib/tdriver/util/video/camera.rb +67 -0
  191. data/lib/tdriver/util/video/camera_linux.rb +153 -0
  192. data/lib/tdriver/util/video/camera_windows.rb +174 -0
  193. data/lib/tdriver/util/video/loader.rb +31 -0
  194. data/lib/tdriver/util/video/video_utils.rb +139 -0
  195. data/lib/tdriver/util/xml/abstraction.rb +117 -0
  196. data/lib/tdriver/util/xml/attribute.rb +32 -0
  197. data/lib/tdriver/util/xml/builder.rb +53 -0
  198. data/lib/tdriver/util/xml/comment.rb +32 -0
  199. data/lib/tdriver/util/xml/document.rb +32 -0
  200. data/lib/tdriver/util/xml/element.rb +32 -0
  201. data/lib/tdriver/util/xml/error.rb +46 -0
  202. data/lib/tdriver/util/xml/loader.rb +62 -0
  203. data/lib/tdriver/util/xml/nil_node.rb +95 -0
  204. data/lib/tdriver/util/xml/nodeset.rb +32 -0
  205. data/lib/tdriver/util/xml/parsers/libxml/libxml.rb +140 -0
  206. data/lib/tdriver/util/xml/parsers/loader.rb +21 -0
  207. data/lib/tdriver/util/xml/parsers/nokogiri/abstraction.rb +167 -0
  208. data/lib/tdriver/util/xml/parsers/nokogiri/attribute.rb +66 -0
  209. data/lib/tdriver/util/xml/parsers/nokogiri/builder.rb +64 -0
  210. data/lib/tdriver/util/xml/parsers/nokogiri/comment.rb +39 -0
  211. data/lib/tdriver/util/xml/parsers/nokogiri/document.rb +66 -0
  212. data/lib/tdriver/util/xml/parsers/nokogiri/element.rb +39 -0
  213. data/lib/tdriver/util/xml/parsers/nokogiri/loader.rb +58 -0
  214. data/lib/tdriver/util/xml/parsers/nokogiri/node.rb +212 -0
  215. data/lib/tdriver/util/xml/parsers/nokogiri/nodeset.rb +237 -0
  216. data/lib/tdriver/util/xml/parsers/nokogiri/text.rb +39 -0
  217. data/lib/tdriver/util/xml/text.rb +32 -0
  218. data/lib/tdriver/util/xml/xml.rb +332 -0
  219. data/lib/tdriver/verify/verify.rb +2398 -0
  220. data/lib/tdriver/version.rb +21 -0
  221. data/xml/behaviours/generic.xml +530 -0
  222. data/xml/defaults/generic.xml +11 -0
  223. data/xml/defaults/sut_generic.xml +8 -0
  224. data/xml/parameters/tdriver_parameters.xml +23 -0
  225. data/xml/templates/generic.xml +292 -0
  226. metadata +324 -0
@@ -0,0 +1,209 @@
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
+ # Framework main file that needs to be included in tests.
21
+ # Used for setting up testing environment, eg
22
+ #
23
+ # require File.join( ENV['TDRIVER_HOME'] , 'tdriver.rb' )
24
+ # @sut = TDriver.sut(:Id =>'sut_qt') # for Qt, id in configuration file sut_qt
25
+ #
26
+ # Please see class documentation for more info
27
+
28
+ # initializing tdriver
29
+ $TDRIVER_INITIALIZED = false
30
+
31
+ # unicode support for 1.8.7
32
+ $KCODE = 'u' if RUBY_VERSION < "1.9"
33
+
34
+ # prevent Object#id Warnings
35
+ Object.send( :undef_method, :id ) if Object.respond_to?( :id )
36
+
37
+ # load all required components
38
+ require File.expand_path( File.join( File.dirname( __FILE__ ), 'loader.rb' ) )
39
+
40
+ module TDriver
41
+
42
+ class << self
43
+
44
+ # Function to create and (or if already created re-) connect SUT object
45
+ # === params
46
+ # hash:: Defines SUT type, identification attributes etc.
47
+ # :id:: Valid id that can be matched in tdriver_parameters.xml
48
+ # === raises
49
+ # ArgumentError:: Wrong argument type <class> (expected Hash)
50
+ # ArgumentError:: SUT type not defined
51
+ # ArgumentError:: SUT type <name> not supported
52
+ # ArgumentError:: Sut id not given
53
+ # MobyUtil::ParameterFileNotFoundError:: if paramter file (tdriver_parameters.xml in TDriver home directory) is not found
54
+ # === returns
55
+ # Object:: Object that SUTFactory returns
56
+ # === example
57
+ # @sut = TDriver.connect_sut(:Id =>'sut_qt') # for qt, id in configuration file sut_qt
58
+ def connect_sut( sut_attributes = {} )
59
+
60
+ TDriver::SUTFactory.make( sut_attributes )
61
+
62
+ end
63
+
64
+ # Function to disconnect SUT object.
65
+ # === params
66
+ # hash:: Defines SUT type, identification attributes etc.
67
+ # :id:: Valid id that can be matched in tdriver_parameters.xml and is already connected
68
+ # === raises
69
+ # ArgumentError:: Not connected to device 'id' if not connected at all / device already disconnected
70
+ # ArgumentError:: Sut id not given
71
+ # === returns
72
+ # Object:: SUT object
73
+ # === example
74
+ # @sut = TDriver.disconnect_sut(:Id =>'sut_qt') # for qt, should be connected already
75
+ def disconnect_sut( sut_attributes = {} )
76
+
77
+ TDriver::SUTFactory.disconnect_sut( sut_attributes )
78
+
79
+ end
80
+
81
+ # Function to reboot SUT object.
82
+ # === params
83
+ # hash:: Defines SUT type, identification attributes etc.
84
+ # :id:: Valid id that can be matched in tdriver_parameters.xml and is already connected
85
+ # === raises
86
+ # ArgumentError:: Not connected to device 'id' if not connected at all / device already disconnected
87
+ # ArgumentError:: Sut id not given
88
+ # === example
89
+ # @sut = TDriver.reboot_sut(:Id => 'sut_qt') # for Qt, should be connected already
90
+ def reboot_sut( sut_attributes = {} )
91
+
92
+ TDriver::SUTFactory.reboot_sut( sut_attributes )
93
+
94
+ end
95
+
96
+ # Wrapper for SUT functionality. For documentation, please see TDriver::connect_sut
97
+ def sut( *args )
98
+
99
+ connect_sut( *args )
100
+
101
+ end
102
+
103
+ # Wrapper for TDriver::Parameter.configured_suts to retrieve all configured sut names
104
+ def suts
105
+
106
+ $parameters.configured_suts
107
+
108
+ end
109
+
110
+ # Wrapper for TDriver::ParameterUserAPI class with methods e.g. [] and []=, files and load_xml etc.
111
+ def parameter( *arguments )
112
+
113
+ if arguments.count == 0
114
+
115
+ $parameters_api
116
+
117
+ else
118
+
119
+ $parameters_api[ *arguments ]
120
+
121
+ end
122
+
123
+ end
124
+
125
+ # TODO: document me
126
+ def state_object( options )
127
+
128
+ # create state object with given options
129
+ MobyBase::StateObject.new( options )
130
+
131
+ end
132
+
133
+ # == nodoc
134
+ # Wrapper for MobyUtil::Logger class
135
+ def logger
136
+
137
+ $logger
138
+
139
+ end
140
+
141
+ # == nodoc
142
+ # TODO: document me
143
+ def config_dir
144
+
145
+ if ENV['TDRIVER_HOME']
146
+
147
+ config_dir = ENV['TDRIVER_HOME']
148
+
149
+ elsif MobyUtil::EnvironmentHelper.windows?
150
+
151
+ config_dir = "c:/tdriver"
152
+
153
+ else
154
+
155
+ config_dir = "/etc/tdriver"
156
+
157
+ end
158
+
159
+ File.expand_path( config_dir )
160
+
161
+ end
162
+
163
+ # == nodoc
164
+ # TODO: document me
165
+ def library_dir
166
+
167
+ File.expand_path( File.dirname( __FILE__ ) )
168
+
169
+ end
170
+
171
+ # == nodoc
172
+ # TODO: document me
173
+ def version
174
+
175
+ ENV['TDRIVER_VERSION'] || "unknown"
176
+
177
+ end
178
+
179
+ private
180
+
181
+ # TODO: document me
182
+ def initialize_tdriver
183
+
184
+ # initialize parameters
185
+ $parameters.init
186
+
187
+ # enable logging engine
188
+ $logger.enable_logging
189
+
190
+ # set xml cache buffer size
191
+ MobyUtil::XML.buffer_size = $parameters[ :xml_cache_buffer_size, 10 ].to_i
192
+
193
+ # load behaviours
194
+ TDriver::BehaviourFactory.init( :path => File.join( config_dir, 'behaviours' ) )
195
+
196
+ # initialization done, everything is ready
197
+ $TDRIVER_INITIALIZED = true
198
+
199
+ end
200
+
201
+ end
202
+
203
+ # enable hooking for performance measurement & debug logging
204
+ TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
205
+
206
+ # initialize TDriver
207
+ initialize_tdriver
208
+
209
+ end # TDriver
@@ -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
+ # agent command services module
21
+ require File.expand_path( File.join( File.dirname( __FILE__ ), 'service.rb' ) )
22
+
@@ -0,0 +1,107 @@
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 AgentService
23
+
24
+ =begin
25
+ # remove all public methods
26
+ instance_methods.each{ | method |
27
+ undef_method( method ) unless method =~ /^__|^(methods|inspect|to_s|class|nil?|extend)/
28
+ }
29
+
30
+ # required by commands method to list available services
31
+ private :methods
32
+ =end
33
+
34
+ # TODO: document me
35
+ def initialize( options = {} )
36
+
37
+ # verify that options is type of hash
38
+ options.check_type Hash, 'wrong argument type $1 for AgentCommandService options (expected $2)'
39
+
40
+ # verify that sut is defined in options hash
41
+ options.require_key :sut
42
+
43
+ sut = options[ :sut ]
44
+
45
+ TDriver::BehaviourFactory.apply_behaviour(
46
+ :object => self,
47
+ :object_type => [ 'AgentCommandService' ],
48
+ :env => [ '*', *sut.environment.to_s.split(";") ],
49
+ :input_type => [ '*', *sut.input.to_s.split(";") ],
50
+ :version => [ '*', *sut.ui_version.to_s.split(";") ]
51
+ )
52
+
53
+ # store given options
54
+ @options = options
55
+
56
+ # store sut variable
57
+ @sut = sut
58
+
59
+ # store caller backtrace
60
+ @caller = caller
61
+
62
+ end
63
+
64
+ # TODO: document me
65
+ def commands
66
+
67
+ class << self
68
+
69
+ # retrieve all public methods
70
+ instance_methods( false ).select{ | name | true unless name =~ /^__|^commands$/ }
71
+
72
+ end
73
+
74
+ end
75
+
76
+ private
77
+
78
+ # TODO: document me
79
+ def execute_command( command_data_object )
80
+
81
+ begin
82
+
83
+ # execute command
84
+ @sut.__send__( :execute_command, command_data_object )
85
+
86
+ rescue MobyBase::ControllerNotFoundError
87
+
88
+ # raise exception if sut doesn't have controller for the command data object
89
+ raise NotImplementedError, "Agent command #{ command_data_object.parameters[ :command ].inspect } is not supported on #{ @sut.id.inspect }", @caller
90
+
91
+ end
92
+
93
+ end
94
+
95
+ private
96
+
97
+ # TODO: document me
98
+ def method_missing( id, *args )
99
+
100
+ # raise exception if unknown command or not supported by sut
101
+ raise RuntimeError, "agent command #{ id.inspect } not supported by #{ @options[ :sut ].id }", caller
102
+
103
+ end
104
+
105
+ end # AgentCommandService
106
+
107
+ end # TDriver
@@ -0,0 +1,39 @@
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 MobyUtil
21
+
22
+ class ArrayHelper
23
+
24
+ def self.rindex_regexp( array, pattern )
25
+
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
+
29
+ # return nil if no matches found, otherwise return index of value
30
+ return nil if ( array.reverse.each_index{ | index | return @rindex if array[ ( @rindex = ( ( array.size-1 ) - index ) ) ] =~ pattern; } )
31
+
32
+ end
33
+
34
+ # enable hooking for performance measurement & debug logging
35
+ TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
36
+
37
+ end # ArrayHelper
38
+
39
+ end # MobyUtil
@@ -0,0 +1,48 @@
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
+ # extend Ruby TrueClass class functionality
21
+ class TrueClass
22
+
23
+ # TODO: document me
24
+ def true?
25
+ true
26
+ end
27
+
28
+ # TODO: document me
29
+ def false?
30
+ false
31
+ end
32
+
33
+ end
34
+
35
+ # extend Ruby FalseClass class functionality
36
+ class FalseClass
37
+
38
+ # TODO: document me
39
+ def true?
40
+ false
41
+ end
42
+
43
+ # TODO: document me
44
+ def false?
45
+ true
46
+ end
47
+
48
+ end
@@ -0,0 +1,149 @@
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 Checksum
23
+
24
+ class << self
25
+
26
+ private
27
+
28
+ def initialize_class
29
+
30
+ @CCITT_16 = [
31
+ 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50A5, 0x60C6, 0x70E7,
32
+ 0x8108, 0x9129, 0xA14A, 0xB16B, 0xC18C, 0xD1AD, 0xE1CE, 0xF1EF,
33
+ 0x1231, 0x0210, 0x3273, 0x2252, 0x52B5, 0x4294, 0x72F7, 0x62D6,
34
+ 0x9339, 0x8318, 0xB37B, 0xA35A, 0xD3BD, 0xC39C, 0xF3FF, 0xE3DE,
35
+ 0x2462, 0x3443, 0x0420, 0x1401, 0x64E6, 0x74C7, 0x44A4, 0x5485,
36
+ 0xA56A, 0xB54B, 0x8528, 0x9509, 0xE5EE, 0xF5CF, 0xC5AC, 0xD58D,
37
+ 0x3653, 0x2672, 0x1611, 0x0630, 0x76D7, 0x66F6, 0x5695, 0x46B4,
38
+ 0xB75B, 0xA77A, 0x9719, 0x8738, 0xF7DF, 0xE7FE, 0xD79D, 0xC7BC,
39
+ 0x48C4, 0x58E5, 0x6886, 0x78A7, 0x0840, 0x1861, 0x2802, 0x3823,
40
+ 0xC9CC, 0xD9ED, 0xE98E, 0xF9AF, 0x8948, 0x9969, 0xA90A, 0xB92B,
41
+ 0x5AF5, 0x4AD4, 0x7AB7, 0x6A96, 0x1A71, 0x0A50, 0x3A33, 0x2A12,
42
+ 0xDBFD, 0xCBDC, 0xFBBF, 0xEB9E, 0x9B79, 0x8B58, 0xBB3B, 0xAB1A,
43
+ 0x6CA6, 0x7C87, 0x4CE4, 0x5CC5, 0x2C22, 0x3C03, 0x0C60, 0x1C41,
44
+ 0xEDAE, 0xFD8F, 0xCDEC, 0xDDCD, 0xAD2A, 0xBD0B, 0x8D68, 0x9D49,
45
+ 0x7E97, 0x6EB6, 0x5ED5, 0x4EF4, 0x3E13, 0x2E32, 0x1E51, 0x0E70,
46
+ 0xFF9F, 0xEFBE, 0xDFDD, 0xCFFC, 0xBF1B, 0xAF3A, 0x9F59, 0x8F78,
47
+ 0x9188, 0x81A9, 0xB1CA, 0xA1EB, 0xD10C, 0xC12D, 0xF14E, 0xE16F,
48
+ 0x1080, 0x00A1, 0x30C2, 0x20E3, 0x5004, 0x4025, 0x7046, 0x6067,
49
+ 0x83B9, 0x9398, 0xA3FB, 0xB3DA, 0xC33D, 0xD31C, 0xE37F, 0xF35E,
50
+ 0x02B1, 0x1290, 0x22F3, 0x32D2, 0x4235, 0x5214, 0x6277, 0x7256,
51
+ 0xB5EA, 0xA5CB, 0x95A8, 0x8589, 0xF56E, 0xE54F, 0xD52C, 0xC50D,
52
+ 0x34E2, 0x24C3, 0x14A0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405,
53
+ 0xA7DB, 0xB7FA, 0x8799, 0x97B8, 0xE75F, 0xF77E, 0xC71D, 0xD73C,
54
+ 0x26D3, 0x36F2, 0x0691, 0x16B0, 0x6657, 0x7676, 0x4615, 0x5634,
55
+ 0xD94C, 0xC96D, 0xF90E, 0xE92F, 0x99C8, 0x89E9, 0xB98A, 0xA9AB,
56
+ 0x5844, 0x4865, 0x7806, 0x6827, 0x18C0, 0x08E1, 0x3882, 0x28A3,
57
+ 0xCB7D, 0xDB5C, 0xEB3F, 0xFB1E, 0x8BF9, 0x9BD8, 0xABBB, 0xBB9A,
58
+ 0x4A75, 0x5A54, 0x6A37, 0x7A16, 0x0AF1, 0x1AD0, 0x2AB3, 0x3A92,
59
+ 0xFD2E, 0xED0F, 0xDD6C, 0xCD4D, 0xBDAA, 0xAD8B, 0x9DE8, 0x8DC9,
60
+ 0x7C26, 0x6C07, 0x5C64, 0x4C45, 0x3CA2, 0x2C83, 0x1CE0, 0x0CC1,
61
+ 0xEF1F, 0xFF3E, 0xCF5D, 0xDF7C, 0xAF9B, 0xBFBA, 0x8FD9, 0x9FF8,
62
+ 0x6E17, 0x7E36, 0x4E55, 0x5E74, 0x2E93, 0x3EB2, 0x0ED1, 0x1EF0
63
+ ]
64
+
65
+ @IBM_16 = [
66
+ 0x0000, 0x1081, 0x2102, 0x3183,
67
+ 0x4204, 0x5285, 0x6306, 0x7387,
68
+ 0x8408, 0x9489, 0xa50a, 0xb58b,
69
+ 0xc60c, 0xd68d, 0xe70e, 0xf78f
70
+ ]
71
+
72
+ end
73
+
74
+ public
75
+
76
+ # check if implementation is already loaded from TDriver native Ruby C Extension; native crc routines are ~10% faster
77
+ unless instance_methods.include?( 'native_extension' )
78
+
79
+ # CRC-16-CCITT
80
+ def crc16( buf, crc = 0 )
81
+
82
+ # calculate the checksum
83
+ buf.each_byte{ | x | crc = ( ( crc << 8 ) ^ @CCITT_16[ ( crc >> 8 ) ^ x ] ) & 0xffff }
84
+
85
+ # result
86
+ crc
87
+
88
+ end # crc16
89
+
90
+ # determines that native extension is not in use
91
+ def native_extension
92
+
93
+ false
94
+
95
+ end
96
+
97
+ # IBM-CRC-16: fallback when native extensions are not supported (e.g. jruby)
98
+ def crc16_ibm( buf, crc = 0xffff )
99
+
100
+ buf.each_byte do | c |
101
+
102
+ crc = ( ( crc >> 4 ) & 0x0fff ) ^ @IBM_16[ ( ( crc ^ c ) & 15 ) ]
103
+
104
+ crc = ( ( crc >> 4 ) & 0x0fff ) ^ @IBM_16[ ( ( crc ^ ( c >> 4 ) ) & 15 ) ]
105
+
106
+ end
107
+
108
+ # result
109
+ ~crc & 0xffff
110
+
111
+ end # crc16_ibm
112
+
113
+ end # unless
114
+
115
+ end # self
116
+
117
+ # enable hooking for performance measurement & debug logging
118
+ TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
119
+
120
+ # initialize the class
121
+ initialize_class
122
+
123
+ end
124
+
125
+ end
126
+
127
+ # deprecated
128
+ module CRC
129
+
130
+ class Crc16
131
+
132
+ class << self
133
+
134
+ def method_missing( id, *args )
135
+
136
+ #warn_caller "$1:$2 warning: deprecated method, use TDriver::Checksum##{ id.to_s } instead of CRC::Crc16##{ id.to_s }"
137
+
138
+ TDriver::Checksum.__send__( id, *args )
139
+
140
+ end
141
+
142
+ end
143
+
144
+ # enable hooking for performance measurement & debug logging
145
+ TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
146
+
147
+ end
148
+
149
+ end