testability-driver 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. data/lib/tdriver-devtools/behaviour/xml/rdoc_behaviour_xml_generator.rb +2 -2
  2. data/lib/tdriver-devtools/tdriver-devtools.rb +1 -1
  3. data/lib/tdriver-devtools/tests/feature_tests/lib/custom_rdoc_generator.rb +3 -3
  4. data/lib/tdriver/base/behaviour/behaviours/object_behaviour_composition.rb +6 -1
  5. data/lib/tdriver/base/behaviour/behaviours/object_behaviour_description.rb +5 -3
  6. data/lib/tdriver/base/behaviour/behaviours/object_composition.rb +1 -1
  7. data/lib/tdriver/base/behaviour/factory.rb +225 -225
  8. data/lib/tdriver/base/errors.rb +1 -1
  9. data/lib/tdriver/base/state_object.rb +227 -179
  10. data/lib/tdriver/base/sut/controller.rb +2 -2
  11. data/lib/tdriver/base/sut/factory.rb +190 -182
  12. data/lib/tdriver/base/sut/generic/behaviours/application.rb +69 -25
  13. data/lib/tdriver/base/sut/generic/behaviours/controller.rb +1 -1
  14. data/lib/tdriver/base/sut/generic/behaviours/find.rb +4 -4
  15. data/lib/tdriver/base/sut/generic/behaviours/flash_behaviour.rb +3 -3
  16. data/lib/tdriver/base/sut/generic/behaviours/sut.rb +350 -165
  17. data/lib/tdriver/base/sut/generic/behaviours/switchbox_behaviour.rb +9 -9
  18. data/lib/tdriver/base/sut/generic/behaviours/verification.rb +191 -103
  19. data/lib/tdriver/base/sut/generic/commands/application.rb +1 -1
  20. data/lib/tdriver/base/sut/generic/commands/key_sequence.rb +1 -1
  21. data/lib/tdriver/base/sut/generic/commands/screen_capture.rb +1 -1
  22. data/lib/tdriver/base/sut/generic/plugin.rb +1 -1
  23. data/lib/tdriver/base/sut/sut.rb +5 -1
  24. data/lib/tdriver/base/test_object/abstract.rb +136 -151
  25. data/lib/tdriver/base/test_object/adapter.rb +293 -82
  26. data/lib/tdriver/base/test_object/behaviours/syncronization.rb +20 -17
  27. data/lib/tdriver/base/test_object/behaviours/test_object.rb +159 -532
  28. data/lib/tdriver/base/test_object/cache.rb +1 -1
  29. data/lib/tdriver/base/test_object/factory.rb +254 -605
  30. data/lib/tdriver/base/test_object/identificator.rb +1 -1
  31. data/lib/tdriver/base/test_object/loader.rb +1 -1
  32. data/lib/tdriver/base/test_object/verification.rb +17 -17
  33. data/lib/tdriver/loader.rb +20 -9
  34. data/lib/tdriver/report/report.rb +5 -0
  35. data/lib/tdriver/report/report_creator.rb +2 -2
  36. data/lib/tdriver/report/report_cucumber_listener.rb +4 -4
  37. data/lib/tdriver/report/report_cucumber_reporter.rb +4 -4
  38. data/lib/tdriver/report/report_execution_statistics.rb +22 -22
  39. data/lib/tdriver/report/report_grouping.rb +2 -2
  40. data/lib/tdriver/report/report_javascript.rb +11 -4
  41. data/lib/tdriver/report/report_test_case_run.rb +2 -2
  42. data/lib/tdriver/report/report_test_run.rb +5 -5
  43. data/lib/tdriver/report/report_test_unit.rb +74 -26
  44. data/lib/tdriver/report/report_writer.rb +70 -13
  45. data/lib/tdriver/tdriver.rb +17 -8
  46. data/lib/tdriver/util/common/array.rb +1 -1
  47. data/lib/tdriver/util/common/crc16.rb +1 -1
  48. data/lib/tdriver/util/common/environment.rb +1 -1
  49. data/lib/tdriver/util/common/file.rb +18 -9
  50. data/lib/tdriver/util/common/gem.rb +1 -1
  51. data/lib/tdriver/util/common/hash.rb +21 -0
  52. data/lib/tdriver/util/common/kernel.rb +1 -1
  53. data/lib/tdriver/util/common/loader.rb +5 -2
  54. data/lib/tdriver/util/common/numeric.rb +54 -3
  55. data/lib/tdriver/util/common/retryable.rb +30 -12
  56. data/lib/tdriver/util/common/stackable.rb +185 -0
  57. data/lib/tdriver/util/common/string.rb +21 -5
  58. data/lib/tdriver/util/{dbaccess/dbaccess.rb → database/access.rb} +4 -1
  59. data/lib/tdriver/util/{dbaccess/dbconnection.rb → database/connection.rb} +3 -0
  60. data/lib/tdriver/util/{dbaccess → database}/error.rb +0 -1
  61. data/lib/tdriver/util/{dbaccess → database}/loader.rb +5 -6
  62. data/lib/tdriver/util/{dynamic_attribute_filter.rb → filters/dynamic_attributes.rb} +1 -1
  63. data/lib/tdriver/util/hooking/hooking.rb +477 -0
  64. data/lib/tdriver/util/loader.rb +35 -29
  65. data/lib/tdriver/util/localisation/error.rb +0 -1
  66. data/lib/tdriver/util/localisation/loader.rb +1 -4
  67. data/lib/tdriver/util/localisation/localisation.rb +30 -27
  68. data/lib/tdriver/util/{common.rb → logger/loader.rb} +2 -4
  69. data/lib/tdriver/util/logger/logger.rb +574 -0
  70. data/lib/tdriver/util/operator_data/loader.rb +4 -3
  71. data/lib/tdriver/util/operator_data/operator_data.rb +5 -5
  72. data/lib/tdriver/util/parameter/parameter.rb +7 -1
  73. data/lib/tdriver/util/parameter/parameter_hash.rb +1 -1
  74. data/lib/tdriver/util/parameter/parameter_template.rb +1 -1
  75. data/lib/tdriver/util/parameter/parameter_user_api.rb +28 -20
  76. data/lib/tdriver/util/parameter/parameter_xml.rb +1 -1
  77. data/lib/tdriver/util/plugin/abstract.rb +1 -1
  78. data/lib/tdriver/util/plugin/service.rb +1 -1
  79. data/lib/tdriver/util/{localisation.rb → recorder/loader.rb} +4 -3
  80. data/lib/tdriver/util/recorder/recorder.rb +66 -0
  81. data/lib/tdriver/util/recorder/scripter.rb +258 -0
  82. data/lib/tdriver/util/{stats.rb → statistics/statistics.rb} +7 -8
  83. data/lib/tdriver/util/user_data/error.rb +0 -1
  84. data/lib/tdriver/util/user_data/loader.rb +1 -2
  85. data/lib/tdriver/util/user_data/user_data.rb +6 -6
  86. data/lib/tdriver/util/video/camera.rb +67 -0
  87. data/lib/tdriver/util/video/camera_linux.rb +139 -0
  88. data/lib/tdriver/util/video/camera_windows.rb +174 -0
  89. data/lib/tdriver/util/video/loader.rb +31 -0
  90. data/lib/tdriver/util/video/video_utils.rb +139 -0
  91. data/lib/tdriver/util/xml/abstraction.rb +56 -5
  92. data/lib/tdriver/util/xml/builder.rb +2 -5
  93. data/lib/tdriver/util/{parameter.rb → xml/comment.rb} +10 -2
  94. data/lib/tdriver/util/xml/loader.rb +32 -22
  95. data/lib/tdriver/util/xml/nil_node.rb +2 -2
  96. data/lib/tdriver/util/xml/parsers/loader.rb +0 -1
  97. data/lib/tdriver/util/xml/parsers/nokogiri/abstraction.rb +18 -44
  98. data/lib/tdriver/util/xml/parsers/nokogiri/attribute.rb +9 -13
  99. data/lib/tdriver/util/xml/parsers/nokogiri/builder.rb +9 -3
  100. data/lib/tdriver/util/xml/parsers/nokogiri/comment.rb +39 -0
  101. data/lib/tdriver/util/xml/parsers/nokogiri/document.rb +6 -11
  102. data/lib/tdriver/util/xml/parsers/nokogiri/element.rb +2 -122
  103. data/lib/tdriver/util/xml/parsers/nokogiri/loader.rb +26 -16
  104. data/lib/tdriver/util/xml/parsers/nokogiri/node.rb +203 -0
  105. data/lib/tdriver/util/xml/parsers/nokogiri/nodeset.rb +1 -2
  106. data/lib/tdriver/util/xml/parsers/nokogiri/text.rb +2 -20
  107. data/lib/tdriver/util/xml/xml.rb +52 -20
  108. data/lib/tdriver/verify/verify.rb +238 -81
  109. data/xml/behaviours/generic.xml +12 -10
  110. metadata +156 -180
  111. data/lib/tdriver/base/test_object/factory_new.rb +0 -202
  112. data/lib/tdriver/util/hooking.rb +0 -434
  113. data/lib/tdriver/util/logger.rb +0 -506
  114. data/lib/tdriver/util/recorder.rb +0 -297
  115. data/lib/tdriver/util/video_utils.rb +0 -384
  116. data/lib/tdriver/util/xml/nil_element.rb +0 -89
@@ -0,0 +1,31 @@
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
+ # video utils module
21
+ require File.expand_path( File.join( File.dirname( __FILE__ ), 'video_utils.rb' ) )
22
+
23
+ # camera implementation
24
+ require File.expand_path( File.join( File.dirname( __FILE__ ), 'camera.rb' ) )
25
+
26
+ # camera windows implementation
27
+ require File.expand_path( File.join( File.dirname( __FILE__ ), 'camera_windows.rb' ) )
28
+
29
+ # camera linux implementation
30
+ require File.expand_path( File.join( File.dirname( __FILE__ ), 'camera_linux.rb' ) )
31
+
@@ -0,0 +1,139 @@
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 VideoUtil ???
23
+
24
+ # Checks if the target video contains enough activity to be considered active or static.
25
+ #
26
+ # === params
27
+ # in_target_video: String, Name and path of video file to analyze
28
+ # in_fps: (optional) Numeric, frames to be analyzed per second
29
+ # in_image_treshold: (optional) Numeric, minimum change between two frames for them to be considered different
30
+ # in_video_treshold: (optional) Numeric, Minimum percentage of frames with changes for the video to be considered alive.
31
+ # in_verbose: (optional) Boolean, True for verbose output including target video statistics
32
+ def self.video_alive?( in_target_video, in_fps = 1, in_image_treshold = 4, in_video_treshold = 35, in_verbose = false )
33
+
34
+ puts "Arguments fps: " << in_fps.inspect << " frame: " << in_image_treshold.inspect << " video: " << in_video_treshold.inspect if in_verbose
35
+
36
+ in_change = in_image_treshold / 100.0
37
+
38
+ alive_temp_folder = "temp_target_alive"
39
+
40
+ require 'RMagick'
41
+
42
+ raise ArgumentError.new( "The FPS argument must be an Interger or a Float, it was a #{ in_fps.class }." ) unless in_fps.kind_of? Numeric
43
+ raise ArgumentError.new( "The frame treshold argument must be an Interger or a Float, it was a #{ in_image_treshold.class }." ) unless in_image_treshold.kind_of? Numeric
44
+ raise ArgumentError.new( "The video treshold argument must be an Interger or a Float, it was a #{ in_video_treshold.class }." ) unless in_video_treshold.kind_of? Numeric
45
+
46
+ ts = Time.now if in_verbose
47
+
48
+ begin
49
+ FileUtils.remove_dir alive_temp_folder
50
+ rescue
51
+ # failed to remove dir, do nothing
52
+ end
53
+
54
+ begin
55
+ FileUtils.mkdir_p alive_temp_folder
56
+ rescue
57
+
58
+ end
59
+
60
+ begin
61
+ File.delete 'video_split.log' if File.exist? 'video_split.log'
62
+ rescue
63
+ end
64
+
65
+ if in_verbose
66
+ system('ffmpeg -v 0 -i '+in_target_video.to_s+' -y -f image2 -r '+in_fps.to_s+' '+alive_temp_folder+'/frame-%05d.png')
67
+ else
68
+ system('ffmpeg 2>video_split.log -v 0 -i '+in_target_video.to_s+' -y -f image2 -r '+in_fps.to_s+' '+alive_temp_folder+'/frame-%05d.png')
69
+ end
70
+
71
+ puts "Video processing duration: " << (Time.now - ts).to_s if in_verbose
72
+
73
+ t_start = Time.now
74
+
75
+ im_files = Dir.glob( alive_temp_folder + '/frame-*.png' )
76
+
77
+ raise RuntimeError.new( "No video frames found for analysis." ) if im_files.size == 0
78
+
79
+ d_max = 0.0
80
+ d_min = 1.0
81
+
82
+ d_sum = 0.0
83
+
84
+ dif_count = 0
85
+
86
+ pre_obj = Magick::ImageList.new(im_files[0])
87
+
88
+ (im_files.size-1).times do | im_index |
89
+
90
+ im_file = Magick::ImageList.new(im_files[ im_index ])
91
+ pre_file = pre_obj
92
+
93
+ dif = pre_file.compare_channel(im_file, Magick::RootMeanSquaredErrorMetric)[1]
94
+ if in_verbose
95
+ d_min = dif unless dif >= d_min
96
+ d_max = dif unless dif <= d_max
97
+ d_sum += dif
98
+ end
99
+ dif_count += 1 if dif > in_change
100
+ puts "Processing image: " << im_file.to_s << " I: " << (im_index+1).to_s << " C: " << dif.to_s if in_verbose
101
+
102
+ pre_obj = im_file
103
+
104
+ end
105
+
106
+ if in_verbose
107
+
108
+ time_now = Time.now
109
+
110
+ puts "Max difference: " << d_max.to_s << "\nMin difference: " << d_min.to_s << "\n"
111
+ puts "Mean difference: " << (d_sum/im_files.size).to_s unless im_files.size == 0
112
+ puts "Count of images exceeding difference tolerance: " << dif_count.to_s
113
+
114
+ puts "Fraction of images exceeding difference tolerance: " << (dif_count.to_f/im_files.size).to_s unless im_files.size == 0
115
+ puts "Analysis duration: " << (time_now - t_start).to_s
116
+ puts "Total duration: " << (time_now - ts).to_s
117
+ end
118
+
119
+ begin
120
+ FileUtils.remove_dir alive_temp_folder
121
+ rescue
122
+ end
123
+
124
+ begin
125
+ File.delete 'video_split.log' if File.exist? 'video_split.log'
126
+ rescue
127
+ end
128
+
129
+ # Check if enough frames had changes
130
+ return (dif_count.to_f/im_files.size)*100 >= in_video_treshold
131
+
132
+ end
133
+
134
+ # enable hooking for performance measurement & debug logging
135
+ TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
136
+
137
+ # end # VideoUtil ???
138
+
139
+ end
@@ -23,17 +23,68 @@ module MobyUtil
23
23
 
24
24
  module Abstraction
25
25
 
26
- attr_accessor :xml, :parser
26
+ attr_accessor :xml
27
27
 
28
- def initialize( xml = nil, parser = nil )
28
+ # TODO: document me
29
+ def initialize( xml = nil )
29
30
 
30
- @xml, @parser = xml, parser
31
+ @xml = xml
31
32
 
32
33
  end
33
34
 
35
+ # TODO: document me
36
+ def comment?
37
+
38
+ self.kind_of?( MobyUtil::XML::Comment )
39
+
40
+ end
41
+
42
+ # TODO: document me
43
+ def text?
44
+
45
+ self.kind_of?( MobyUtil::XML::Text )
46
+
47
+ end
48
+
49
+ # TODO: document me
50
+ def attribute?
51
+
52
+ self.kind_of?( MobyUtil::XML::Attribute )
53
+
54
+ end
55
+
56
+ # TODO: document me
57
+ def nodeset?
58
+
59
+ self.kind_of?( MobyUtil::XML::Nodeset )
60
+
61
+ end
62
+
63
+ # TODO: document me
64
+ def element?
65
+
66
+ self.kind_of?( MobyUtil::XML::Element )
67
+
68
+ end
69
+
70
+ # TODO: document me
71
+ def document?
72
+
73
+ self.kind_of?( MobyUtil::XML::Document )
74
+
75
+ end
76
+
77
+ # TODO: document me
78
+ def nil?
79
+
80
+ self.kind_of?( MobyUtil::XML::NilNode )
81
+
82
+ end
83
+
84
+ # TODO: document me
34
85
  def method_missing( *args )
35
86
 
36
- Kernel::raise RuntimeError.new( "This is abstraction class of %s - XML parser type was not specified correctly" % self.class )
87
+ raise RuntimeError, "This is abstraction class of #{ self.class } - XML parser type was not specified correctly"
37
88
 
38
89
  end
39
90
 
@@ -45,7 +96,7 @@ module MobyUtil
45
96
  end
46
97
 
47
98
  # enable hooking for performance measurement & debug logging
48
- MobyUtil::Hooking.instance.hook_methods( self ) if defined?( MobyUtil::Hooking )
99
+ TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
49
100
 
50
101
  end # Abstraction
51
102
 
@@ -31,11 +31,8 @@ module MobyUtil
31
31
 
32
32
  $stderr.puts "%s:%s warning: deprecated method %s#new, use %s instead" % [ caller.first.split( ":" )[ 0 .. 1 ], self.class, "MobyUtil::XML#build" ].flatten
33
33
 
34
- # get current parser
35
- @parser = MobyUtil::XML.current_parser
36
-
37
34
  # extend builder behaviour of current parser
38
- self.extend( ( @parser )::Builder )
35
+ self.extend( ( MobyUtil::XML.current_parser )::Builder )
39
36
 
40
37
  # create builder object
41
38
  build( &block )
@@ -45,7 +42,7 @@ module MobyUtil
45
42
  end
46
43
 
47
44
  # enable hooking for performance measurement & debug logging
48
- MobyUtil::Hooking.instance.hook_methods( self ) if defined?( MobyUtil::Hooking )
45
+ TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
49
46
 
50
47
  end # Builder
51
48
 
@@ -17,8 +17,16 @@
17
17
  ##
18
18
  ############################################################################
19
19
 
20
+ module MobyUtil
20
21
 
21
- STDOUT.puts "Please require 'util/parameter/loader.rb' instead of 'util/parameter.rb'"
22
+ module XML
22
23
 
23
- require File.expand_path( File.join( File.dirname( __FILE__ ), 'parameter/loader.rb' ) )
24
+ class Comment
24
25
 
26
+ include Abstraction
27
+
28
+ end # Comment
29
+
30
+ end # XML
31
+
32
+ end # MobyUtil
@@ -17,36 +17,46 @@
17
17
  ##
18
18
  ############################################################################
19
19
 
20
- # load parser implementation(s)
21
- require File.expand_path( File.join( File.dirname( __FILE__ ), 'parsers/loader.rb' ) )
20
+ [
22
21
 
23
- # xml related errors
24
- require File.expand_path( File.join( File.dirname( __FILE__ ), 'error.rb' ) )
22
+ # load parser implementations
23
+ 'parsers/loader.rb',
25
24
 
26
- # abstraction module for document, element and nodeset
27
- require File.expand_path( File.join( File.dirname( __FILE__ ), 'abstraction.rb' ) )
25
+ # xml related errors
26
+ 'error.rb',
28
27
 
29
- # document object
30
- require File.expand_path( File.join( File.dirname( __FILE__ ), 'document.rb' ) )
28
+ # abstraction module for document, element and nodeset
29
+ 'abstraction.rb',
31
30
 
32
- # element object
33
- require File.expand_path( File.join( File.dirname( __FILE__ ), 'element.rb' ) )
31
+ # comment object
32
+ 'comment.rb',
34
33
 
35
- # text object
36
- require File.expand_path( File.join( File.dirname( __FILE__ ), 'text.rb' ) )
34
+ # document object
35
+ 'document.rb',
37
36
 
38
- # attribute object
39
- require File.expand_path( File.join( File.dirname( __FILE__ ), 'attribute.rb' ) )
37
+ # element object
38
+ 'element.rb',
40
39
 
41
- # nil element object
42
- require File.expand_path( File.join( File.dirname( __FILE__ ), 'nil_node.rb' ) )
40
+ # text object
41
+ 'text.rb',
43
42
 
44
- # nodeset object
45
- require File.expand_path( File.join( File.dirname( __FILE__ ), 'nodeset.rb' ) )
43
+ # attribute object
44
+ 'attribute.rb',
46
45
 
47
- # xml Builder module
48
- require File.expand_path( File.join( File.dirname( __FILE__ ), 'builder.rb' ) )
46
+ # nil element object
47
+ 'nil_node.rb',
49
48
 
50
- # xml api
51
- require File.expand_path( File.join( File.dirname( __FILE__ ), 'xml.rb' ) )
49
+ # nodeset object
50
+ 'nodeset.rb',
52
51
 
52
+ # xml Builder module
53
+ 'builder.rb',
54
+
55
+ # xml api
56
+ 'xml.rb'
57
+
58
+ ].each{ | filename |
59
+
60
+ require File.expand_path( File.join( File.dirname( __FILE__ ), filename ) )
61
+
62
+ }
@@ -27,7 +27,7 @@ module MobyUtil
27
27
 
28
28
  def method_missing( method, *method_arguments )
29
29
 
30
- raise RuntimeError.new( "Method '%s' is not supported by %s (%s)" % [ method, self.class, @parser ] )
30
+ raise RuntimeError, "Method #{ method.to_s.inspect } is not supported by #{ self.class } object (#{ MobyUtil::XML.current_parser })"
31
31
 
32
32
  end
33
33
 
@@ -86,7 +86,7 @@ module MobyUtil
86
86
  end
87
87
 
88
88
  # enable hooking for performance measurement & debug logging
89
- MobyUtil::Hooking.instance.hook_methods( self ) if defined?( MobyUtil::Hooking )
89
+ TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
90
90
 
91
91
  end # NilElement
92
92
 
@@ -17,6 +17,5 @@
17
17
  ##
18
18
  ############################################################################
19
19
 
20
-
21
20
  # nokogiri parser wrapper
22
21
  require File.expand_path( File.join( File.dirname( __FILE__ ), 'nokogiri/loader.rb' ) )
@@ -28,7 +28,7 @@ module MobyUtil
28
28
  # TODO: Documentation
29
29
  def empty?
30
30
 
31
- @xml.empty?
31
+ @xml.nil?
32
32
 
33
33
  end
34
34
 
@@ -69,77 +69,51 @@ module MobyUtil
69
69
 
70
70
  when ::Nokogiri::XML::Element
71
71
 
72
- element_object( object )
72
+ XML::Element.new( object )
73
+
74
+ when ::Nokogiri::XML::NodeSet
75
+
76
+ XML::Nodeset.new( object )
73
77
 
74
78
  when ::Nokogiri::XML::Text
75
79
 
76
- text_object( object )
80
+ XML::Text.new( object )
77
81
 
78
82
  when ::Nokogiri::XML::Attr
79
83
 
80
- attribute_object( object )
84
+ XML::Attribute.new( object )
85
+
86
+ when ::Nokogiri::XML::Comment
87
+
88
+ XML::Comment.new( object )
81
89
 
82
90
  when ::NilClass
83
91
 
84
- nil_node
92
+ #nil_node
93
+ MobyUtil::XML::NilNode.new( nil )
85
94
 
86
95
  # do not create wrapper object if already wrapped
87
- when ::MobyUtil::XML::Element, ::MobyUtil::XML::Nodeset, ::MobyUtil::XML::Text, ::MobyUtil::XML::Attribute, ::MobyUtil::XML::NilNode
96
+ when ::MobyUtil::XML::Element, ::MobyUtil::XML::Nodeset, ::MobyUtil::XML::Text, ::MobyUtil::XML::Attribute, ::MobyUtil::XML::NilNode, ::MobyUtil::XML::Comment
88
97
 
89
98
  object
90
99
 
91
100
  else
92
101
 
93
- raise NotImplementedError.new( "Object wrapper for node type of #{ object.class } not implemented - Please contact TDriver support" )
102
+ raise NotImplementedError, "Object wrapper for #{ object.class } not implemented - Please contact TDriver support"
94
103
 
95
104
  end
96
105
 
97
106
  end
98
107
 
99
- # method to create MobyUtil::XML::Attribute object
100
- def attribute_object( xml_data )
101
-
102
- MobyUtil::XML::Attribute.new( xml_data, @parser ).extend( Attribute )
103
-
104
- end
105
-
106
- # method to create MobyUtil::XML::Element
107
- def element_object( xml_data )
108
-
109
- MobyUtil::XML::Element.new( xml_data, @parser ).extend( Element )
110
-
111
- end
112
-
113
- # method to create MobyUtil::XML::NilNode
114
- def nil_node
115
-
116
- MobyUtil::XML::NilNode.new( nil, @parser )
117
-
118
- end
119
-
120
- # method to create MobyUtil::XML::Text
121
- def text_object( xml_data )
122
-
123
- MobyUtil::XML::Text.new( xml_data, @parser ).extend( Text )
124
-
125
- end
126
-
127
- # method to create MobyUtil::XML::Nodeset object
128
- def nodeset_object( xml_data )
129
-
130
- MobyUtil::XML::Nodeset.new( xml_data, @parser ).extend( Nodeset )
131
-
132
- end
133
-
134
108
  # TODO: Documentation
135
109
  def method_missing( method, *args, &block )
136
110
 
137
- raise RuntimeError.new( "Method '%s' is not supported by %s (%s)" % [ method, self.class, @parser ] )
111
+ raise RuntimeError, "Method #{ method.to_s.inspect } is not supported by #{ self.class } object (#{ MobyUtil::XML.current_parser })"
138
112
 
139
113
  end
140
114
 
141
115
  # enable hooking for performance measurement & debug logging
142
- MobyUtil::Hooking.instance.hook_methods( self ) if defined?( MobyUtil::Hooking )
116
+ TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
143
117
 
144
118
  end # Abstraction
145
119