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.
- checksums.yaml +7 -0
 - data/README.md +16 -0
 - data/bin/start_app_perf +200 -0
 - data/bin/tdriver-devtools +3 -0
 - data/config/sut_parameters.rb +52 -0
 - data/config/sut_setup.rb +32 -0
 - data/config/sut_teardown.rb +32 -0
 - data/config/tdriver_custom_error_recovery.rb +83 -0
 - data/ext/extconf.rb +70 -0
 - data/ext/native_extensions.c +315 -0
 - data/lib/matti.rb +25 -0
 - data/lib/tdriver-devtools/behaviour/old/xml/example/flick-example.rb +120 -0
 - data/lib/tdriver-devtools/behaviour/old/xml/example/impl.rb_invalid +194 -0
 - data/lib/tdriver-devtools/behaviour/old/xml/generate_behaviour_xml.rb +95 -0
 - data/lib/tdriver-devtools/behaviour/old/xml/lib/tdriver_generator.rb +722 -0
 - data/lib/tdriver-devtools/behaviour/old/xml/qdoc_generator.rb +321 -0
 - data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.method.template +43 -0
 - data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.module.template +54 -0
 - data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.argument.template +7 -0
 - data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.argument_type.template +7 -0
 - data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.exception.template +5 -0
 - data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.howto.line.template +2 -0
 - data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.howto.template +5 -0
 - data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.method.template +23 -0
 - data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.template +14 -0
 - data/lib/tdriver-devtools/behaviour/old/xml/update +3 -0
 - data/lib/tdriver-devtools/behaviour/xml/generate.rb +88 -0
 - data/lib/tdriver-devtools/behaviour/xml/rdoc_behaviour_xml_generator.rb +1945 -0
 - data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.argument.default.template +1 -0
 - data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.argument.template +3 -0
 - data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.argument_type.template +4 -0
 - data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.exception.template +4 -0
 - data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.arguments.template +4 -0
 - data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.deprecated.template +3 -0
 - data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.exceptions.template +3 -0
 - data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.info.template +1 -0
 - data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.returns.template +3 -0
 - data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.tables.template +3 -0
 - data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.template +12 -0
 - data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.returns.template +5 -0
 - data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.table.item.template +1 -0
 - data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.table.row.template +2 -0
 - data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.table.template +8 -0
 - data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.template +14 -0
 - data/lib/tdriver-devtools/doc/behaviour_xml/QtExampleGestureBehaviour.xml +138 -0
 - data/lib/tdriver-devtools/doc/behaviour_xml/created.rid +1 -0
 - data/lib/tdriver-devtools/doc/behaviour_xml/tdriver.hash +1 -0
 - data/lib/tdriver-devtools/doc/feature_xml/qt_widget_hold.feature.xml +9 -0
 - data/lib/tdriver-devtools/doc/feature_xml/qt_widget_tap.feature.xml +9 -0
 - data/lib/tdriver-devtools/doc/generate.rb +917 -0
 - data/lib/tdriver-devtools/doc/update +1 -0
 - data/lib/tdriver-devtools/doc/xslt/html.rb +7 -0
 - data/lib/tdriver-devtools/doc/xslt/template.xsl +2170 -0
 - data/lib/tdriver-devtools/doc/xslt/update +3 -0
 - data/lib/tdriver-devtools/plugin/placeholder.txt +1 -0
 - data/lib/tdriver-devtools/tdriver-devtools.rb +404 -0
 - data/lib/tdriver-devtools/tests/feature_tests/example/behaviour_example.rb +100 -0
 - data/lib/tdriver-devtools/tests/feature_tests/generate.rb +82 -0
 - data/lib/tdriver-devtools/tests/feature_tests/lib/custom_rdoc_generator.rb +468 -0
 - data/lib/tdriver-devtools/tests/feature_tests/templates/feature_attribute.template +5 -0
 - data/lib/tdriver-devtools/tests/feature_tests/templates/feature_method.template +5 -0
 - data/lib/tdriver-devtools/tests/feature_tests/templates/scenario_attribute.template +5 -0
 - data/lib/tdriver-devtools/tests/feature_tests/templates/scenario_method.template +5 -0
 - data/lib/tdriver-devtools/tests/feature_tests/update +3 -0
 - data/lib/tdriver.rb +23 -0
 - data/lib/tdriver/base/behaviour/abstract.rb +29 -0
 - data/lib/tdriver/base/behaviour/behaviours/object_abstract.rb +107 -0
 - data/lib/tdriver/base/behaviour/behaviours/object_behaviour_composition.rb +99 -0
 - data/lib/tdriver/base/behaviour/behaviours/object_behaviour_description.rb +278 -0
 - data/lib/tdriver/base/behaviour/behaviours/object_composition.rb +119 -0
 - data/lib/tdriver/base/behaviour/factory.rb +495 -0
 - data/lib/tdriver/base/behaviour/loader.rb +46 -0
 - data/lib/tdriver/base/command_data/command_data.rb +51 -0
 - data/lib/tdriver/base/command_data/loader.rb +29 -0
 - data/lib/tdriver/base/controller/abstraction.rb +56 -0
 - data/lib/tdriver/base/controller/loader.rb +21 -0
 - data/lib/tdriver/base/errors.rb +134 -0
 - data/lib/tdriver/base/loader.rb +47 -0
 - data/lib/tdriver/base/state_object.rb +373 -0
 - data/lib/tdriver/base/sut/adapter.rb +54 -0
 - data/lib/tdriver/base/sut/controller.rb +151 -0
 - data/lib/tdriver/base/sut/factory.rb +339 -0
 - data/lib/tdriver/base/sut/generic/behaviours/agent.rb +77 -0
 - data/lib/tdriver/base/sut/generic/behaviours/application.rb +427 -0
 - data/lib/tdriver/base/sut/generic/behaviours/controller.rb +67 -0
 - data/lib/tdriver/base/sut/generic/behaviours/find.rb +107 -0
 - data/lib/tdriver/base/sut/generic/behaviours/flash_behaviour.rb +337 -0
 - data/lib/tdriver/base/sut/generic/behaviours/sut.rb +1888 -0
 - data/lib/tdriver/base/sut/generic/behaviours/switchbox_behaviour.rb +210 -0
 - data/lib/tdriver/base/sut/generic/behaviours/verification.rb +222 -0
 - data/lib/tdriver/base/sut/generic/commands/agent.rb +43 -0
 - data/lib/tdriver/base/sut/generic/commands/application.rb +274 -0
 - data/lib/tdriver/base/sut/generic/commands/fixture.rb +47 -0
 - data/lib/tdriver/base/sut/generic/commands/key_sequence.rb +94 -0
 - data/lib/tdriver/base/sut/generic/commands/screen_capture.rb +64 -0
 - data/lib/tdriver/base/sut/generic/plugin.rb +97 -0
 - data/lib/tdriver/base/sut/loader.rb +35 -0
 - data/lib/tdriver/base/sut/sut.rb +98 -0
 - data/lib/tdriver/base/test_object/abstract.rb +208 -0
 - data/lib/tdriver/base/test_object/adapter.rb +740 -0
 - data/lib/tdriver/base/test_object/behaviours/syncronization.rb +144 -0
 - data/lib/tdriver/base/test_object/behaviours/test_object.rb +1047 -0
 - data/lib/tdriver/base/test_object/cache.rb +134 -0
 - data/lib/tdriver/base/test_object/factory.rb +684 -0
 - data/lib/tdriver/base/test_object/loader.rb +51 -0
 - data/lib/tdriver/base/test_object/verification.rb +178 -0
 - data/lib/tdriver/base/test_object/xml/abstraction.rb +63 -0
 - data/lib/tdriver/base/test_object/xml/adapter.rb +773 -0
 - data/lib/tdriver/env.rb +21 -0
 - data/lib/tdriver/loader.rb +57 -0
 - data/lib/tdriver/matti.rb +35 -0
 - data/lib/tdriver/report/error_recovery/tdriver_custom_error_recovery.rb +83 -0
 - data/lib/tdriver/report/error_recovery/tdriver_error_recovery.rb +168 -0
 - data/lib/tdriver/report/error_recovery/tdriver_error_recovery_settings.rb +106 -0
 - data/lib/tdriver/report/report.rb +61 -0
 - data/lib/tdriver/report/report_api.rb +348 -0
 - data/lib/tdriver/report/report_combine.rb +86 -0
 - data/lib/tdriver/report/report_crash_file_capture.rb +178 -0
 - data/lib/tdriver/report/report_creator.rb +665 -0
 - data/lib/tdriver/report/report_cucumber.rb +158 -0
 - data/lib/tdriver/report/report_cucumber_listener.rb +184 -0
 - data/lib/tdriver/report/report_cucumber_reporter.rb +181 -0
 - data/lib/tdriver/report/report_data_presentation.rb +156 -0
 - data/lib/tdriver/report/report_data_table.rb +64 -0
 - data/lib/tdriver/report/report_execution_statistics.rb +400 -0
 - data/lib/tdriver/report/report_file_capture.rb +159 -0
 - data/lib/tdriver/report/report_graph_generator.rb +59 -0
 - data/lib/tdriver/report/report_grouping.rb +541 -0
 - data/lib/tdriver/report/report_javascript.rb +199 -0
 - data/lib/tdriver/report/report_junit_xml.rb +147 -0
 - data/lib/tdriver/report/report_rspec.rb +108 -0
 - data/lib/tdriver/report/report_test_case_run.rb +725 -0
 - data/lib/tdriver/report/report_test_run.rb +1476 -0
 - data/lib/tdriver/report/report_test_unit.rb +223 -0
 - data/lib/tdriver/report/report_writer.rb +1621 -0
 - data/lib/tdriver/tdriver.rb +209 -0
 - data/lib/tdriver/util/agent/loader.rb +22 -0
 - data/lib/tdriver/util/agent/service.rb +107 -0
 - data/lib/tdriver/util/common/array.rb +39 -0
 - data/lib/tdriver/util/common/boolean.rb +48 -0
 - data/lib/tdriver/util/common/crc16.rb +149 -0
 - data/lib/tdriver/util/common/environment.rb +154 -0
 - data/lib/tdriver/util/common/error.rb +40 -0
 - data/lib/tdriver/util/common/exception.rb +53 -0
 - data/lib/tdriver/util/common/exceptions.rb +12 -0
 - data/lib/tdriver/util/common/file.rb +328 -0
 - data/lib/tdriver/util/common/gem.rb +109 -0
 - data/lib/tdriver/util/common/hash.rb +288 -0
 - data/lib/tdriver/util/common/kernel.rb +253 -0
 - data/lib/tdriver/util/common/loader.rb +47 -0
 - data/lib/tdriver/util/common/numeric.rb +159 -0
 - data/lib/tdriver/util/common/object.rb +159 -0
 - data/lib/tdriver/util/common/retryable.rb +179 -0
 - data/lib/tdriver/util/common/stackable.rb +185 -0
 - data/lib/tdriver/util/common/string.rb +174 -0
 - data/lib/tdriver/util/database/access.rb +240 -0
 - data/lib/tdriver/util/database/connection.rb +44 -0
 - data/lib/tdriver/util/database/error.rb +34 -0
 - data/lib/tdriver/util/database/loader.rb +28 -0
 - 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 +211 -0
 - data/lib/tdriver/util/hooking/hooking.rb +477 -0
 - data/lib/tdriver/util/keymap/keymap.rb +81 -0
 - data/lib/tdriver/util/loader.rb +80 -0
 - data/lib/tdriver/util/localisation/error.rb +31 -0
 - data/lib/tdriver/util/localisation/loader.rb +25 -0
 - data/lib/tdriver/util/localisation/localisation.rb +762 -0
 - data/lib/tdriver/util/logger/loader.rb +22 -0
 - data/lib/tdriver/util/logger/logger.rb +591 -0
 - data/lib/tdriver/util/operator_data/error.rb +29 -0
 - data/lib/tdriver/util/operator_data/loader.rb +27 -0
 - data/lib/tdriver/util/operator_data/operator_data.rb +93 -0
 - data/lib/tdriver/util/other/config.rb +221 -0
 - data/lib/tdriver/util/parameter/error.rb +48 -0
 - data/lib/tdriver/util/parameter/loader.rb +25 -0
 - data/lib/tdriver/util/parameter/parameter.rb +1161 -0
 - data/lib/tdriver/util/plugin/abstract.rb +61 -0
 - data/lib/tdriver/util/plugin/error.rb +0 -0
 - data/lib/tdriver/util/plugin/loader.rb +28 -0
 - data/lib/tdriver/util/plugin/service.rb +319 -0
 - data/lib/tdriver/util/recorder/loader.rb +25 -0
 - data/lib/tdriver/util/recorder/recorder.rb +72 -0
 - data/lib/tdriver/util/recorder/scripter.rb +294 -0
 - data/lib/tdriver/util/statistics/statistics.rb +89 -0
 - data/lib/tdriver/util/user_data/error.rb +28 -0
 - data/lib/tdriver/util/user_data/loader.rb +25 -0
 - data/lib/tdriver/util/user_data/user_data.rb +104 -0
 - data/lib/tdriver/util/video/camera.rb +67 -0
 - data/lib/tdriver/util/video/camera_linux.rb +153 -0
 - data/lib/tdriver/util/video/camera_windows.rb +174 -0
 - data/lib/tdriver/util/video/loader.rb +31 -0
 - data/lib/tdriver/util/video/video_utils.rb +139 -0
 - data/lib/tdriver/util/xml/abstraction.rb +117 -0
 - data/lib/tdriver/util/xml/attribute.rb +32 -0
 - data/lib/tdriver/util/xml/builder.rb +53 -0
 - data/lib/tdriver/util/xml/comment.rb +32 -0
 - data/lib/tdriver/util/xml/document.rb +32 -0
 - data/lib/tdriver/util/xml/element.rb +32 -0
 - data/lib/tdriver/util/xml/error.rb +46 -0
 - data/lib/tdriver/util/xml/loader.rb +62 -0
 - data/lib/tdriver/util/xml/nil_node.rb +95 -0
 - data/lib/tdriver/util/xml/nodeset.rb +32 -0
 - data/lib/tdriver/util/xml/parsers/libxml/libxml.rb +140 -0
 - data/lib/tdriver/util/xml/parsers/loader.rb +21 -0
 - data/lib/tdriver/util/xml/parsers/nokogiri/abstraction.rb +167 -0
 - data/lib/tdriver/util/xml/parsers/nokogiri/attribute.rb +66 -0
 - data/lib/tdriver/util/xml/parsers/nokogiri/builder.rb +64 -0
 - data/lib/tdriver/util/xml/parsers/nokogiri/comment.rb +39 -0
 - data/lib/tdriver/util/xml/parsers/nokogiri/document.rb +66 -0
 - data/lib/tdriver/util/xml/parsers/nokogiri/element.rb +39 -0
 - data/lib/tdriver/util/xml/parsers/nokogiri/loader.rb +58 -0
 - data/lib/tdriver/util/xml/parsers/nokogiri/node.rb +212 -0
 - data/lib/tdriver/util/xml/parsers/nokogiri/nodeset.rb +237 -0
 - data/lib/tdriver/util/xml/parsers/nokogiri/text.rb +39 -0
 - data/lib/tdriver/util/xml/text.rb +32 -0
 - data/lib/tdriver/util/xml/xml.rb +332 -0
 - data/lib/tdriver/verify/verify.rb +2398 -0
 - data/lib/tdriver/version.rb +21 -0
 - data/xml/behaviours/generic.xml +530 -0
 - data/xml/defaults/generic.xml +11 -0
 - data/xml/defaults/sut_generic.xml +8 -0
 - data/xml/parameters/tdriver_parameters.xml +23 -0
 - data/xml/templates/generic.xml +292 -0
 - metadata +324 -0
 
| 
         @@ -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 
     | 
    
         
            +
            # logger module
         
     | 
| 
      
 21 
     | 
    
         
            +
            require File.expand_path( File.join( File.dirname( __FILE__ ), 'logger.rb' ) )
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
         @@ -0,0 +1,591 @@ 
     | 
|
| 
      
 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 Logger
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                include Singleton
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                attr_reader :include_behaviour_info
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
                def initialize
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                  # Allow all levels to be reported - do not change this!
         
     | 
| 
      
 31 
     | 
    
         
            +
                  @custom_levels = ['debug', 'behaviour', 'info', 'warning', 'error', 'fatal']
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
                  #Log4r::Configurator.custom_levels *@custom_levels.collect{ | level | level.upcase }
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
                  #Log4r::Logger.root.level = Log4r::DEBUG
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                  @enabled_stack = [ false ]
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
                  @logger_instance = nil
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
                  @logger_engine_loaded = false
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
                end
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
                def include_behaviour_info=( value )
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
                  value.check_type( [ TrueClass, FalseClass ], "wrong argument type $1 for include_behaviour_info (expected $2)" )
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
                  @include_behaviour_info = value
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
                end
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
                # allow reporting by passing level as method name, raise exception if method_id not found in @custom_levels array
         
     | 
| 
      
 54 
     | 
    
         
            +
                def method_missing( method_id, *method_arguments )
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
                  method_id_str = method_id.to_s
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
      
 58 
     | 
    
         
            +
                  if @custom_levels.include?( method_id_str )
         
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
      
 60 
     | 
    
         
            +
                    log method_id_str, *method_arguments
         
     | 
| 
      
 61 
     | 
    
         
            +
             
     | 
| 
      
 62 
     | 
    
         
            +
                  else
         
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
      
 64 
     | 
    
         
            +
                    # raise exception
         
     | 
| 
      
 65 
     | 
    
         
            +
                    super
         
     | 
| 
      
 66 
     | 
    
         
            +
             
     | 
| 
      
 67 
     | 
    
         
            +
                  end
         
     | 
| 
      
 68 
     | 
    
         
            +
             
     | 
| 
      
 69 
     | 
    
         
            +
                end
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
      
 71 
     | 
    
         
            +
                # TODO: add documentation
         
     | 
| 
      
 72 
     | 
    
         
            +
                def enabled
         
     | 
| 
      
 73 
     | 
    
         
            +
             
     | 
| 
      
 74 
     | 
    
         
            +
                  @enabled_stack[ -1 ]
         
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
      
 76 
     | 
    
         
            +
                end
         
     | 
| 
      
 77 
     | 
    
         
            +
             
     | 
| 
      
 78 
     | 
    
         
            +
                # TODO: add documentation
         
     | 
| 
      
 79 
     | 
    
         
            +
                def enabled=( value )
         
     | 
| 
      
 80 
     | 
    
         
            +
             
     | 
| 
      
 81 
     | 
    
         
            +
                  @enabled_stack[ -1 ] = value
         
     | 
| 
      
 82 
     | 
    
         
            +
             
     | 
| 
      
 83 
     | 
    
         
            +
                end
         
     | 
| 
      
 84 
     | 
    
         
            +
             
     | 
| 
      
 85 
     | 
    
         
            +
                # TODO: add documentation
         
     | 
| 
      
 86 
     | 
    
         
            +
                def push_enabled( value )
         
     | 
| 
      
 87 
     | 
    
         
            +
             
     | 
| 
      
 88 
     | 
    
         
            +
                  # push current value to stack if given argument is other than boolean
         
     | 
| 
      
 89 
     | 
    
         
            +
                  value = @enabled_stack[ -1 ] unless [ TrueClass, FalseClass ].include?( value.class )
         
     | 
| 
      
 90 
     | 
    
         
            +
             
     | 
| 
      
 91 
     | 
    
         
            +
                  @enabled_stack << value
         
     | 
| 
      
 92 
     | 
    
         
            +
             
     | 
| 
      
 93 
     | 
    
         
            +
                end
         
     | 
| 
      
 94 
     | 
    
         
            +
             
     | 
| 
      
 95 
     | 
    
         
            +
                # TODO: add documentation
         
     | 
| 
      
 96 
     | 
    
         
            +
                def pop_enabled
         
     | 
| 
      
 97 
     | 
    
         
            +
             
     | 
| 
      
 98 
     | 
    
         
            +
                  @enabled_stack.pop if @enabled_stack.count > 1
         
     | 
| 
      
 99 
     | 
    
         
            +
             
     | 
| 
      
 100 
     | 
    
         
            +
                end
         
     | 
| 
      
 101 
     | 
    
         
            +
             
     | 
| 
      
 102 
     | 
    
         
            +
                # TODO: add documentation
         
     | 
| 
      
 103 
     | 
    
         
            +
                def set_report_level( report_level )
         
     | 
| 
      
 104 
     | 
    
         
            +
             
     | 
| 
      
 105 
     | 
    
         
            +
                  if @logger_engine_loaded
         
     | 
| 
      
 106 
     | 
    
         
            +
             
     | 
| 
      
 107 
     | 
    
         
            +
                    Log4r::Logger.root.level = report_level
         
     | 
| 
      
 108 
     | 
    
         
            +
             
     | 
| 
      
 109 
     | 
    
         
            +
                  else
         
     | 
| 
      
 110 
     | 
    
         
            +
             
     | 
| 
      
 111 
     | 
    
         
            +
                    nil
         
     | 
| 
      
 112 
     | 
    
         
            +
             
     | 
| 
      
 113 
     | 
    
         
            +
                  end
         
     | 
| 
      
 114 
     | 
    
         
            +
             
     | 
| 
      
 115 
     | 
    
         
            +
                end
         
     | 
| 
      
 116 
     | 
    
         
            +
             
     | 
| 
      
 117 
     | 
    
         
            +
                # TODO: add documentation
         
     | 
| 
      
 118 
     | 
    
         
            +
                def new_logger( logger_name )
         
     | 
| 
      
 119 
     | 
    
         
            +
             
     | 
| 
      
 120 
     | 
    
         
            +
                  if @logger_engine_loaded
         
     | 
| 
      
 121 
     | 
    
         
            +
             
     | 
| 
      
 122 
     | 
    
         
            +
                    Log4r::Logger.new( logger_name )
         
     | 
| 
      
 123 
     | 
    
         
            +
             
     | 
| 
      
 124 
     | 
    
         
            +
                  else
         
     | 
| 
      
 125 
     | 
    
         
            +
             
     | 
| 
      
 126 
     | 
    
         
            +
                    nil
         
     | 
| 
      
 127 
     | 
    
         
            +
             
     | 
| 
      
 128 
     | 
    
         
            +
                  end
         
     | 
| 
      
 129 
     | 
    
         
            +
             
     | 
| 
      
 130 
     | 
    
         
            +
                end
         
     | 
| 
      
 131 
     | 
    
         
            +
             
     | 
| 
      
 132 
     | 
    
         
            +
                # TODO: add documentation
         
     | 
| 
      
 133 
     | 
    
         
            +
                def get_logger( logger_name )
         
     | 
| 
      
 134 
     | 
    
         
            +
             
     | 
| 
      
 135 
     | 
    
         
            +
                  begin
         
     | 
| 
      
 136 
     | 
    
         
            +
             
     | 
| 
      
 137 
     | 
    
         
            +
                    if @logger_engine_loaded
         
     | 
| 
      
 138 
     | 
    
         
            +
             
     | 
| 
      
 139 
     | 
    
         
            +
                      Log4r::Logger.get( logger_name )
         
     | 
| 
      
 140 
     | 
    
         
            +
             
     | 
| 
      
 141 
     | 
    
         
            +
                    else
         
     | 
| 
      
 142 
     | 
    
         
            +
             
     | 
| 
      
 143 
     | 
    
         
            +
                      nil
         
     | 
| 
      
 144 
     | 
    
         
            +
             
     | 
| 
      
 145 
     | 
    
         
            +
                    end
         
     | 
| 
      
 146 
     | 
    
         
            +
             
     | 
| 
      
 147 
     | 
    
         
            +
                  rescue
         
     | 
| 
      
 148 
     | 
    
         
            +
             
     | 
| 
      
 149 
     | 
    
         
            +
                    raise ArgumentError, "Logger #{ logger_name.inspect } not found"
         
     | 
| 
      
 150 
     | 
    
         
            +
             
     | 
| 
      
 151 
     | 
    
         
            +
                  end
         
     | 
| 
      
 152 
     | 
    
         
            +
             
     | 
| 
      
 153 
     | 
    
         
            +
                end
         
     | 
| 
      
 154 
     | 
    
         
            +
             
     | 
| 
      
 155 
     | 
    
         
            +
                # TODO: add documentation
         
     | 
| 
      
 156 
     | 
    
         
            +
                def create_outputter( outputter_class, *args )
         
     | 
| 
      
 157 
     | 
    
         
            +
             
     | 
| 
      
 158 
     | 
    
         
            +
                  outputter_class.new *args
         
     | 
| 
      
 159 
     | 
    
         
            +
             
     | 
| 
      
 160 
     | 
    
         
            +
                end
         
     | 
| 
      
 161 
     | 
    
         
            +
             
     | 
| 
      
 162 
     | 
    
         
            +
                # TODO: add documentation
         
     | 
| 
      
 163 
     | 
    
         
            +
                def add_outputter( logger_instance, outputter_instance )
         
     | 
| 
      
 164 
     | 
    
         
            +
             
     | 
| 
      
 165 
     | 
    
         
            +
                  logger_instance.add outputter_instance
         
     | 
| 
      
 166 
     | 
    
         
            +
             
     | 
| 
      
 167 
     | 
    
         
            +
                end
         
     | 
| 
      
 168 
     | 
    
         
            +
             
     | 
| 
      
 169 
     | 
    
         
            +
                # TODO: add documentation
         
     | 
| 
      
 170 
     | 
    
         
            +
                def remove_outputter( logger_instance, outputter_instance )
         
     | 
| 
      
 171 
     | 
    
         
            +
             
     | 
| 
      
 172 
     | 
    
         
            +
                  logger_instance.remove outputter_instance
         
     | 
| 
      
 173 
     | 
    
         
            +
             
     | 
| 
      
 174 
     | 
    
         
            +
                end
         
     | 
| 
      
 175 
     | 
    
         
            +
             
     | 
| 
      
 176 
     | 
    
         
            +
                # TODO: add documentation
         
     | 
| 
      
 177 
     | 
    
         
            +
                def set_outputter_pattern( outputter_instance, pattern )
         
     | 
| 
      
 178 
     | 
    
         
            +
             
     | 
| 
      
 179 
     | 
    
         
            +
                  if @logger_engine_loaded
         
     | 
| 
      
 180 
     | 
    
         
            +
             
     | 
| 
      
 181 
     | 
    
         
            +
                    # Allow only FileOutputter instances
         
     | 
| 
      
 182 
     | 
    
         
            +
                    raise ArgumentError, 'Outputter pattern not valid, %M required by minimum' if !/\%M/.match( pattern )
         
     | 
| 
      
 183 
     | 
    
         
            +
             
     | 
| 
      
 184 
     | 
    
         
            +
                    # create pattern for outputter
         
     | 
| 
      
 185 
     | 
    
         
            +
                    outputter_instance.formatter = Log4r::PatternFormatter.new :pattern => pattern
         
     | 
| 
      
 186 
     | 
    
         
            +
             
     | 
| 
      
 187 
     | 
    
         
            +
                  end
         
     | 
| 
      
 188 
     | 
    
         
            +
             
     | 
| 
      
 189 
     | 
    
         
            +
                end
         
     | 
| 
      
 190 
     | 
    
         
            +
             
     | 
| 
      
 191 
     | 
    
         
            +
                # TODO: add documentation
         
     | 
| 
      
 192 
     | 
    
         
            +
                # return logger instance
         
     | 
| 
      
 193 
     | 
    
         
            +
                def self.[]( key )
         
     | 
| 
      
 194 
     | 
    
         
            +
             
     | 
| 
      
 195 
     | 
    
         
            +
                  get_logger key
         
     | 
| 
      
 196 
     | 
    
         
            +
             
     | 
| 
      
 197 
     | 
    
         
            +
                end
         
     | 
| 
      
 198 
     | 
    
         
            +
             
     | 
| 
      
 199 
     | 
    
         
            +
                # TODO: add documentation
         
     | 
| 
      
 200 
     | 
    
         
            +
                def root
         
     | 
| 
      
 201 
     | 
    
         
            +
             
     | 
| 
      
 202 
     | 
    
         
            +
                  if @logger_engine_loaded
         
     | 
| 
      
 203 
     | 
    
         
            +
             
     | 
| 
      
 204 
     | 
    
         
            +
                    Log4r::Logger.global
         
     | 
| 
      
 205 
     | 
    
         
            +
             
     | 
| 
      
 206 
     | 
    
         
            +
                  else
         
     | 
| 
      
 207 
     | 
    
         
            +
             
     | 
| 
      
 208 
     | 
    
         
            +
                    nil
         
     | 
| 
      
 209 
     | 
    
         
            +
             
     | 
| 
      
 210 
     | 
    
         
            +
                  end
         
     | 
| 
      
 211 
     | 
    
         
            +
             
     | 
| 
      
 212 
     | 
    
         
            +
                end
         
     | 
| 
      
 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 
     | 
    
         
            +
             
     | 
| 
      
 227 
     | 
    
         
            +
                # TODO: add documentation
         
     | 
| 
      
 228 
     | 
    
         
            +
                def log( level, *text_array )
         
     | 
| 
      
 229 
     | 
    
         
            +
             
     | 
| 
      
 230 
     | 
    
         
            +
                  if @logger_instance && enabled
         
     | 
| 
      
 231 
     | 
    
         
            +
             
     | 
| 
      
 232 
     | 
    
         
            +
                    # convert to lowercase string
         
     | 
| 
      
 233 
     | 
    
         
            +
                    level = level.to_s.downcase
         
     | 
| 
      
 234 
     | 
    
         
            +
             
     | 
| 
      
 235 
     | 
    
         
            +
                    include_behaviour_info = @include_behaviour_info
         
     | 
| 
      
 236 
     | 
    
         
            +
             
     | 
| 
      
 237 
     | 
    
         
            +
                    # debug log entries and logging by using TDriver.logging.info or MobyUtil::Logging.instance.info etc
         
     | 
| 
      
 238 
     | 
    
         
            +
                    if caller.first =~ /method_missing/
         
     | 
| 
      
 239 
     | 
    
         
            +
             
     | 
| 
      
 240 
     | 
    
         
            +
                      # get correct caller method
         
     | 
| 
      
 241 
     | 
    
         
            +
                      log_caller = caller.at( 1 )
         
     | 
| 
      
 242 
     | 
    
         
            +
             
     | 
| 
      
 243 
     | 
    
         
            +
                      # debug level
         
     | 
| 
      
 244 
     | 
    
         
            +
                      if log_caller =~ /hooking\.rb/
         
     | 
| 
      
 245 
     | 
    
         
            +
             
     | 
| 
      
 246 
     | 
    
         
            +
                        log_caller = caller.at( 3 ).first
         
     | 
| 
      
 247 
     | 
    
         
            +
             
     | 
| 
      
 248 
     | 
    
         
            +
                      end
         
     | 
| 
      
 249 
     | 
    
         
            +
             
     | 
| 
      
 250 
     | 
    
         
            +
                    elsif caller.first =~ /logger\.rb/
         
     | 
| 
      
 251 
     | 
    
         
            +
             
     | 
| 
      
 252 
     | 
    
         
            +
                      # do not add caller info if called from self
         
     | 
| 
      
 253 
     | 
    
         
            +
                      include_behaviour_info = false
         
     | 
| 
      
 254 
     | 
    
         
            +
             
     | 
| 
      
 255 
     | 
    
         
            +
                    else
         
     | 
| 
      
 256 
     | 
    
         
            +
             
     | 
| 
      
 257 
     | 
    
         
            +
                      # normal logging, e.g. behaviour logging from method etc
         
     | 
| 
      
 258 
     | 
    
         
            +
                      log_caller = caller.at( 0 )
         
     | 
| 
      
 259 
     | 
    
         
            +
             
     | 
| 
      
 260 
     | 
    
         
            +
                    end
         
     | 
| 
      
 261 
     | 
    
         
            +
             
     | 
| 
      
 262 
     | 
    
         
            +
                    # log text to given level if logging enabled
         
     | 
| 
      
 263 
     | 
    
         
            +
                    text_array.each{ | text |
         
     | 
| 
      
 264 
     | 
    
         
            +
             
     | 
| 
      
 265 
     | 
    
         
            +
                      @logger_instance.send level, ( include_behaviour_info && !text.empty? ) ? "#{ text.to_s } in #{ log_caller.to_s }" : text.to_s
         
     | 
| 
      
 266 
     | 
    
         
            +
                      if $tdriver_reporter && !text.empty? && text.include?("A temporary information popup")
         
     | 
| 
      
 267 
     | 
    
         
            +
                        $new_test_case.capture_dump(true,:text=> text) if $new_test_case
         
     | 
| 
      
 268 
     | 
    
         
            +
                      end
         
     | 
| 
      
 269 
     | 
    
         
            +
             
     | 
| 
      
 270 
     | 
    
         
            +
                    }
         
     | 
| 
      
 271 
     | 
    
         
            +
             
     | 
| 
      
 272 
     | 
    
         
            +
                    log_to_report_details(caller) if $parameters[:report_script_steps_to_details, nil ]=='true'
         
     | 
| 
      
 273 
     | 
    
         
            +
                    
         
     | 
| 
      
 274 
     | 
    
         
            +
                    
         
     | 
| 
      
 275 
     | 
    
         
            +
                  end
         
     | 
| 
      
 276 
     | 
    
         
            +
             
     | 
| 
      
 277 
     | 
    
         
            +
                end
         
     | 
| 
      
 278 
     | 
    
         
            +
             
     | 
| 
      
 279 
     | 
    
         
            +
                def enable_raise_hooking
         
     | 
| 
      
 280 
     | 
    
         
            +
             
     | 
| 
      
 281 
     | 
    
         
            +
                  # hook Kernel.raise
         
     | 
| 
      
 282 
     | 
    
         
            +
                  def raise( *exception )
         
     | 
| 
      
 283 
     | 
    
         
            +
             
     | 
| 
      
 284 
     | 
    
         
            +
                    begin
         
     | 
| 
      
 285 
     | 
    
         
            +
             
     | 
| 
      
 286 
     | 
    
         
            +
                      super *exception
         
     | 
| 
      
 287 
     | 
    
         
            +
             
     | 
| 
      
 288 
     | 
    
         
            +
                    rescue => raised_exception
         
     | 
| 
      
 289 
     | 
    
         
            +
             
     | 
| 
      
 290 
     | 
    
         
            +
                      raised_exception.backtrace.slice!( 0 )
         
     | 
| 
      
 291 
     | 
    
         
            +
             
     | 
| 
      
 292 
     | 
    
         
            +
                      $logger.log 'warning', *[ '', "(#{ raised_exception.class }) #{ raised_exception.message.split("\n") }", '', raised_exception.backtrace, '' ].flatten
         
     | 
| 
      
 293 
     | 
    
         
            +
             
     | 
| 
      
 294 
     | 
    
         
            +
                      super raised_exception
         
     | 
| 
      
 295 
     | 
    
         
            +
             
     | 
| 
      
 296 
     | 
    
         
            +
                    end
         
     | 
| 
      
 297 
     | 
    
         
            +
             
     | 
| 
      
 298 
     | 
    
         
            +
                  end
         
     | 
| 
      
 299 
     | 
    
         
            +
             
     | 
| 
      
 300 
     | 
    
         
            +
                end
         
     | 
| 
      
 301 
     | 
    
         
            +
             
     | 
| 
      
 302 
     | 
    
         
            +
                def set_debug_exceptions
         
     | 
| 
      
 303 
     | 
    
         
            +
             
     | 
| 
      
 304 
     | 
    
         
            +
                  if ARGV.include?( '--debug_exceptions' ) || $parameters[ :debug_exceptions, 'false' ].to_s.downcase == 'true'
         
     | 
| 
      
 305 
     | 
    
         
            +
             
     | 
| 
      
 306 
     | 
    
         
            +
                    ARGV.delete('--debug_exceptions')
         
     | 
| 
      
 307 
     | 
    
         
            +
             
     | 
| 
      
 308 
     | 
    
         
            +
                    # hook Object(Kernel)#raise
         
     | 
| 
      
 309 
     | 
    
         
            +
                    ::Object.class_exec{
         
     | 
| 
      
 310 
     | 
    
         
            +
             
     | 
| 
      
 311 
     | 
    
         
            +
                      ::Kernel.module_exec{
         
     | 
| 
      
 312 
     | 
    
         
            +
             
     | 
| 
      
 313 
     | 
    
         
            +
                        alias_method :original_raise, :raise
         
     | 
| 
      
 314 
     | 
    
         
            +
             
     | 
| 
      
 315 
     | 
    
         
            +
                        def raise( *args )
         
     | 
| 
      
 316 
     | 
    
         
            +
             
     | 
| 
      
 317 
     | 
    
         
            +
                          begin
         
     | 
| 
      
 318 
     | 
    
         
            +
             
     | 
| 
      
 319 
     | 
    
         
            +
                            # raise and catch exception
         
     | 
| 
      
 320 
     | 
    
         
            +
                            original_raise( *args )
         
     | 
| 
      
 321 
     | 
    
         
            +
             
     | 
| 
      
 322 
     | 
    
         
            +
                          rescue
         
     | 
| 
      
 323 
     | 
    
         
            +
             
     | 
| 
      
 324 
     | 
    
         
            +
                            # remove wrapper calls from backtrace
         
     | 
| 
      
 325 
     | 
    
         
            +
                            while $!.backtrace.first =~ /(logger\.rb).*(raise)/
         
     | 
| 
      
 326 
     | 
    
         
            +
             
     | 
| 
      
 327 
     | 
    
         
            +
                              $!.backtrace.shift
         
     | 
| 
      
 328 
     | 
    
         
            +
             
     | 
| 
      
 329 
     | 
    
         
            +
                            end
         
     | 
| 
      
 330 
     | 
    
         
            +
             
     | 
| 
      
 331 
     | 
    
         
            +
                            puts "[debug] #{ $!.class }: #{ $!.message }\n[debug] Backtrace: \n[debug] #{ $!.backtrace.collect{ | line | "  ... from #{ line }" }.join("\n[debug] ") }\n\n"
         
     | 
| 
      
 332 
     | 
    
         
            +
             
     | 
| 
      
 333 
     | 
    
         
            +
                            # raise exception again
         
     | 
| 
      
 334 
     | 
    
         
            +
                            original_raise $!
         
     | 
| 
      
 335 
     | 
    
         
            +
             
     | 
| 
      
 336 
     | 
    
         
            +
                          end
         
     | 
| 
      
 337 
     | 
    
         
            +
             
     | 
| 
      
 338 
     | 
    
         
            +
                        end
         
     | 
| 
      
 339 
     | 
    
         
            +
             
     | 
| 
      
 340 
     | 
    
         
            +
                      }
         
     | 
| 
      
 341 
     | 
    
         
            +
                    }
         
     | 
| 
      
 342 
     | 
    
         
            +
             
     | 
| 
      
 343 
     | 
    
         
            +
                  end
         
     | 
| 
      
 344 
     | 
    
         
            +
             
     | 
| 
      
 345 
     | 
    
         
            +
                end
         
     | 
| 
      
 346 
     | 
    
         
            +
             
     | 
| 
      
 347 
     | 
    
         
            +
                # TODO: add documentation
         
     | 
| 
      
 348 
     | 
    
         
            +
                def enable_logging
         
     | 
| 
      
 349 
     | 
    
         
            +
             
     | 
| 
      
 350 
     | 
    
         
            +
                  set_debug_exceptions # if enabled
         
     | 
| 
      
 351 
     | 
    
         
            +
             
     | 
| 
      
 352 
     | 
    
         
            +
                  # returns logging level as string
         
     | 
| 
      
 353 
     | 
    
         
            +
                  logging_level = $parameters[ :logging_level, nil ]
         
     | 
| 
      
 354 
     | 
    
         
            +
             
     | 
| 
      
 355 
     | 
    
         
            +
                  # do not enable logging if no logging level is not defined
         
     | 
| 
      
 356 
     | 
    
         
            +
                  return nil if logging_level.nil?
         
     | 
| 
      
 357 
     | 
    
         
            +
             
     | 
| 
      
 358 
     | 
    
         
            +
                  # raise exception if wrong format for logging level
         
     | 
| 
      
 359 
     | 
    
         
            +
                  raise RuntimeError, "Wrong logging level format '#{ logging_level }' defined in TDriver parameter/template XML (expected numeric string)" unless logging_level.numeric?
         
     | 
| 
      
 360 
     | 
    
         
            +
             
     | 
| 
      
 361 
     | 
    
         
            +
                  # convert to integer
         
     | 
| 
      
 362 
     | 
    
         
            +
                  logging_level = logging_level.to_i
         
     | 
| 
      
 363 
     | 
    
         
            +
             
     | 
| 
      
 364 
     | 
    
         
            +
                  # raise exception if unsupported logging level
         
     | 
| 
      
 365 
     | 
    
         
            +
                  raise RuntimeError, "Unsupported logging level '#{ logging_level }' defined in TDriver parameter/template XML (expected 0..5)" unless ( 0..5 ).include?( logging_level )
         
     | 
| 
      
 366 
     | 
    
         
            +
             
     | 
| 
      
 367 
     | 
    
         
            +
                  @include_behaviour_info = $parameters[ :logging_include_behaviour_info, 'false' ].to_s.to_boolean
         
     | 
| 
      
 368 
     | 
    
         
            +
             
     | 
| 
      
 369 
     | 
    
         
            +
                  # UI state XML parse error logging - verify that all required parameters are configured and output folder is created succesfully
         
     | 
| 
      
 370 
     | 
    
         
            +
                  if MobyUtil::KernelHelper.to_boolean( $parameters[ :logging_xml_parse_error_dump, 'false' ] ) == true
         
     | 
| 
      
 371 
     | 
    
         
            +
             
     | 
| 
      
 372 
     | 
    
         
            +
                    begin
         
     | 
| 
      
 373 
     | 
    
         
            +
             
     | 
| 
      
 374 
     | 
    
         
            +
                      if $parameters[ :logging_xml_parse_error_dump_path, nil ].nil?
         
     | 
| 
      
 375 
     | 
    
         
            +
             
     | 
| 
      
 376 
     | 
    
         
            +
                        warn("warning: Configuration parameter :logging_xml_parse_error_dump_path missing, disabling the feature...")
         
     | 
| 
      
 377 
     | 
    
         
            +
             
     | 
| 
      
 378 
     | 
    
         
            +
                        # disable feature
         
     | 
| 
      
 379 
     | 
    
         
            +
                        raise ArgumentError
         
     | 
| 
      
 380 
     | 
    
         
            +
             
     | 
| 
      
 381 
     | 
    
         
            +
                      else
         
     | 
| 
      
 382 
     | 
    
         
            +
             
     | 
| 
      
 383 
     | 
    
         
            +
                        begin
         
     | 
| 
      
 384 
     | 
    
         
            +
             
     | 
| 
      
 385 
     | 
    
         
            +
                          # create error dump folder if not exist, used e.g. when xml parse error
         
     | 
| 
      
 386 
     | 
    
         
            +
                          MobyUtil::FileHelper.mkdir_path( MobyUtil::FileHelper.expand_path( $last_parameter ) )
         
     | 
| 
      
 387 
     | 
    
         
            +
             
     | 
| 
      
 388 
     | 
    
         
            +
                        rescue
         
     | 
| 
      
 389 
     | 
    
         
            +
             
     | 
| 
      
 390 
     | 
    
         
            +
                          warn("warning: Unable to create log folder #{ $parameters[ :logging_xml_parse_error_dump_path ] } for corrupted XML UI state files")
         
     | 
| 
      
 391 
     | 
    
         
            +
             
     | 
| 
      
 392 
     | 
    
         
            +
                          # disable feature
         
     | 
| 
      
 393 
     | 
    
         
            +
                          raise ArgumentError
         
     | 
| 
      
 394 
     | 
    
         
            +
             
     | 
| 
      
 395 
     | 
    
         
            +
                        end
         
     | 
| 
      
 396 
     | 
    
         
            +
             
     | 
| 
      
 397 
     | 
    
         
            +
                      end
         
     | 
| 
      
 398 
     | 
    
         
            +
             
     | 
| 
      
 399 
     | 
    
         
            +
                      if $parameters[ :logging_xml_parse_error_dump_overwrite, nil ].nil?
         
     | 
| 
      
 400 
     | 
    
         
            +
             
     | 
| 
      
 401 
     | 
    
         
            +
                        warn("warning: Configuration parameter :logging_xml_parse_error_dump_overwrite missing, using 'false' as default value")
         
     | 
| 
      
 402 
     | 
    
         
            +
             
     | 
| 
      
 403 
     | 
    
         
            +
                        $parameters[ :logging_xml_parse_error_dump_overwrite ] = 'false'
         
     | 
| 
      
 404 
     | 
    
         
            +
             
     | 
| 
      
 405 
     | 
    
         
            +
                      end
         
     | 
| 
      
 406 
     | 
    
         
            +
             
     | 
| 
      
 407 
     | 
    
         
            +
                    rescue ArgumentError
         
     | 
| 
      
 408 
     | 
    
         
            +
             
     | 
| 
      
 409 
     | 
    
         
            +
                      # disable xml logging
         
     | 
| 
      
 410 
     | 
    
         
            +
                      $parameters[ :logging_xml_parse_error_dump ] = 'false'
         
     | 
| 
      
 411 
     | 
    
         
            +
             
     | 
| 
      
 412 
     | 
    
         
            +
                    rescue
         
     | 
| 
      
 413 
     | 
    
         
            +
             
     | 
| 
      
 414 
     | 
    
         
            +
                      # disable xml logging
         
     | 
| 
      
 415 
     | 
    
         
            +
                      warn( "warning: Disabling logging due to failure (#{ $!.class }: #{ $!.message })" )
         
     | 
| 
      
 416 
     | 
    
         
            +
             
     | 
| 
      
 417 
     | 
    
         
            +
                      $parameters[ :logging_xml_parse_error_dump ] = 'false'
         
     | 
| 
      
 418 
     | 
    
         
            +
             
     | 
| 
      
 419 
     | 
    
         
            +
                    end
         
     | 
| 
      
 420 
     | 
    
         
            +
             
     | 
| 
      
 421 
     | 
    
         
            +
                  else
         
     | 
| 
      
 422 
     | 
    
         
            +
             
     | 
| 
      
 423 
     | 
    
         
            +
                    warn("warning: Configuration parameter :logging_xml_parse_error_dump missing, disabling the feature...")
         
     | 
| 
      
 424 
     | 
    
         
            +
                    $parameters[ :logging_xml_parse_error_dump ] = 'false'
         
     | 
| 
      
 425 
     | 
    
         
            +
             
     | 
| 
      
 426 
     | 
    
         
            +
                  end
         
     | 
| 
      
 427 
     | 
    
         
            +
             
     | 
| 
      
 428 
     | 
    
         
            +
                  unless logging_level.zero?
         
     | 
| 
      
 429 
     | 
    
         
            +
             
     | 
| 
      
 430 
     | 
    
         
            +
                    # logger output path
         
     | 
| 
      
 431 
     | 
    
         
            +
                    outputter_path = MobyUtil::FileHelper.expand_path( $parameters[ :logging_outputter_path ] )
         
     | 
| 
      
 432 
     | 
    
         
            +
             
     | 
| 
      
 433 
     | 
    
         
            +
                    require 'log4r'
         
     | 
| 
      
 434 
     | 
    
         
            +
             
     | 
| 
      
 435 
     | 
    
         
            +
                    require 'log4r/configurator'
         
     | 
| 
      
 436 
     | 
    
         
            +
             
     | 
| 
      
 437 
     | 
    
         
            +
                    Log4r::Configurator.custom_levels *@custom_levels.collect{ | level | level.upcase }
         
     | 
| 
      
 438 
     | 
    
         
            +
             
     | 
| 
      
 439 
     | 
    
         
            +
                    Log4r::Logger.root.level = Log4r::DEBUG
         
     | 
| 
      
 440 
     | 
    
         
            +
             
     | 
| 
      
 441 
     | 
    
         
            +
                    @logger_engine_loaded = true
         
     | 
| 
      
 442 
     | 
    
         
            +
             
     | 
| 
      
 443 
     | 
    
         
            +
                    # disable logging if exception is raised during
         
     | 
| 
      
 444 
     | 
    
         
            +
                    begin
         
     | 
| 
      
 445 
     | 
    
         
            +
             
     | 
| 
      
 446 
     | 
    
         
            +
                      # create outputter folder if not exist
         
     | 
| 
      
 447 
     | 
    
         
            +
                      MobyUtil::FileHelper.mkdir_path( outputter_path )
         
     | 
| 
      
 448 
     | 
    
         
            +
             
     | 
| 
      
 449 
     | 
    
         
            +
                      # create new logger instance
         
     | 
| 
      
 450 
     | 
    
         
            +
                      new_logger( 'TDriver' )
         
     | 
| 
      
 451 
     | 
    
         
            +
             
     | 
| 
      
 452 
     | 
    
         
            +
                      # get logger object reference
         
     | 
| 
      
 453 
     | 
    
         
            +
                      @logger_instance = get_logger( 'TDriver' )
         
     | 
| 
      
 454 
     | 
    
         
            +
             
     | 
| 
      
 455 
     | 
    
         
            +
                      # create unique name for logfile or use default (TDriver.log)
         
     | 
| 
      
 456 
     | 
    
         
            +
                      if $parameters[ :logging_outputter_unique_filename, false ].true?
         
     | 
| 
      
 457 
     | 
    
         
            +
                        filename = "TDriver_#{ Time.now.to_i }.log"
         
     | 
| 
      
 458 
     | 
    
         
            +
                      else
         
     | 
| 
      
 459 
     | 
    
         
            +
                        filename = 'TDriver.log'
         
     | 
| 
      
 460 
     | 
    
         
            +
                      end
         
     | 
| 
      
 461 
     | 
    
         
            +
             
     | 
| 
      
 462 
     | 
    
         
            +
                      # check if outputter is enabled
         
     | 
| 
      
 463 
     | 
    
         
            +
                      if $parameters[ :logging_outputter_enabled, false ].true?
         
     | 
| 
      
 464 
     | 
    
         
            +
             
     | 
| 
      
 465 
     | 
    
         
            +
                        # create new outputter instance type of FileOutputter
         
     | 
| 
      
 466 
     | 
    
         
            +
                        outputter = create_outputter(
         
     | 
| 
      
 467 
     | 
    
         
            +
             
     | 
| 
      
 468 
     | 
    
         
            +
                          # outputter type
         
     | 
| 
      
 469 
     | 
    
         
            +
                          Log4r::FileOutputter,
         
     | 
| 
      
 470 
     | 
    
         
            +
             
     | 
| 
      
 471 
     | 
    
         
            +
                          # outputter name
         
     | 
| 
      
 472 
     | 
    
         
            +
                          "TDriver_LOG",
         
     | 
| 
      
 473 
     | 
    
         
            +
             
     | 
| 
      
 474 
     | 
    
         
            +
                          # outputter filename
         
     | 
| 
      
 475 
     | 
    
         
            +
                          :filename => File.join( outputter_path, filename ),
         
     | 
| 
      
 476 
     | 
    
         
            +
             
     | 
| 
      
 477 
     | 
    
         
            +
                          # append to or truncate file
         
     | 
| 
      
 478 
     | 
    
         
            +
                          :trunc => $parameters[ :logging_outputter_append, false ].false?,
         
     | 
| 
      
 479 
     | 
    
         
            +
             
     | 
| 
      
 480 
     | 
    
         
            +
                          # logging level
         
     | 
| 
      
 481 
     | 
    
         
            +
                          :level => logging_level
         
     | 
| 
      
 482 
     | 
    
         
            +
             
     | 
| 
      
 483 
     | 
    
         
            +
                        )
         
     | 
| 
      
 484 
     | 
    
         
            +
             
     | 
| 
      
 485 
     | 
    
         
            +
                        # set outputter log event write pattern
         
     | 
| 
      
 486 
     | 
    
         
            +
                        set_outputter_pattern( outputter, $parameters[ :logging_outputter_pattern, '%d [%c] [%l] %M' ] )
         
     | 
| 
      
 487 
     | 
    
         
            +
             
     | 
| 
      
 488 
     | 
    
         
            +
                        # add outputter to logger instance
         
     | 
| 
      
 489 
     | 
    
         
            +
                        add_outputter( @logger_instance, outputter )
         
     | 
| 
      
 490 
     | 
    
         
            +
             
     | 
| 
      
 491 
     | 
    
         
            +
                      end
         
     | 
| 
      
 492 
     | 
    
         
            +
             
     | 
| 
      
 493 
     | 
    
         
            +
                      # Add stdout outputter if set on configuration parameters
         
     | 
| 
      
 494 
     | 
    
         
            +
                      if $parameters[ :logging_stdout_outputter_enabled, false ].true?
         
     | 
| 
      
 495 
     | 
    
         
            +
                        stdout_outputter = create_outputter(
         
     | 
| 
      
 496 
     | 
    
         
            +
                          Log4r::StdoutOutputter, # outputter type
         
     | 
| 
      
 497 
     | 
    
         
            +
                          "TDriver_LOG_stdout",	# outputter name
         
     | 
| 
      
 498 
     | 
    
         
            +
                          :level => logging_level # logging level
         
     | 
| 
      
 499 
     | 
    
         
            +
                        )
         
     | 
| 
      
 500 
     | 
    
         
            +
                        set_outputter_pattern( stdout_outputter, $parameters[ :logging_outputter_pattern, '%d [%c] [%l] %M' ] )
         
     | 
| 
      
 501 
     | 
    
         
            +
             
     | 
| 
      
 502 
     | 
    
         
            +
                        add_outputter( @logger_instance, stdout_outputter )
         
     | 
| 
      
 503 
     | 
    
         
            +
             
     | 
| 
      
 504 
     | 
    
         
            +
                      end
         
     | 
| 
      
 505 
     | 
    
         
            +
             
     | 
| 
      
 506 
     | 
    
         
            +
                    rescue
         
     | 
| 
      
 507 
     | 
    
         
            +
             
     | 
| 
      
 508 
     | 
    
         
            +
                      $parameters[ :logging_level ] = '0'
         
     | 
| 
      
 509 
     | 
    
         
            +
             
     | 
| 
      
 510 
     | 
    
         
            +
                      @logger_instance = nil
         
     | 
| 
      
 511 
     | 
    
         
            +
             
     | 
| 
      
 512 
     | 
    
         
            +
                      @enabled_stack = [ false ]
         
     | 
| 
      
 513 
     | 
    
         
            +
             
     | 
| 
      
 514 
     | 
    
         
            +
                      warn("warning: Disabling logging due to failure (#{ $!.class }: #{ $!.message })")
         
     | 
| 
      
 515 
     | 
    
         
            +
             
     | 
| 
      
 516 
     | 
    
         
            +
                      return nil
         
     | 
| 
      
 517 
     | 
    
         
            +
             
     | 
| 
      
 518 
     | 
    
         
            +
                    end
         
     | 
| 
      
 519 
     | 
    
         
            +
             
     | 
| 
      
 520 
     | 
    
         
            +
                    # debug logging
         
     | 
| 
      
 521 
     | 
    
         
            +
                    if ( logging_level == 1 )
         
     | 
| 
      
 522 
     | 
    
         
            +
             
     | 
| 
      
 523 
     | 
    
         
            +
                      # enable exception capturing on debug level
         
     | 
| 
      
 524 
     | 
    
         
            +
                      enable_raise_hooking
         
     | 
| 
      
 525 
     | 
    
         
            +
             
     | 
| 
      
 526 
     | 
    
         
            +
                      # pass logger instance to hooking module
         
     | 
| 
      
 527 
     | 
    
         
            +
                      TDriver::Hooking.logger_instance = MobyUtil::Logger.instance
         
     | 
| 
      
 528 
     | 
    
         
            +
             
     | 
| 
      
 529 
     | 
    
         
            +
                    end
         
     | 
| 
      
 530 
     | 
    
         
            +
             
     | 
| 
      
 531 
     | 
    
         
            +
                    # enable logging
         
     | 
| 
      
 532 
     | 
    
         
            +
                    @enabled_stack = [ true ]
         
     | 
| 
      
 533 
     | 
    
         
            +
             
     | 
| 
      
 534 
     | 
    
         
            +
                    # log event: start logging
         
     | 
| 
      
 535 
     | 
    
         
            +
                    log( 'info' , "", "Logging engine started", "" )
         
     | 
| 
      
 536 
     | 
    
         
            +
             
     | 
| 
      
 537 
     | 
    
         
            +
                  end
         
     | 
| 
      
 538 
     | 
    
         
            +
             
     | 
| 
      
 539 
     | 
    
         
            +
                  report_status_at_exit
         
     | 
| 
      
 540 
     | 
    
         
            +
             
     | 
| 
      
 541 
     | 
    
         
            +
                end
         
     | 
| 
      
 542 
     | 
    
         
            +
             
     | 
| 
      
 543 
     | 
    
         
            +
                def report_status_at_exit
         
     | 
| 
      
 544 
     | 
    
         
            +
             
     | 
| 
      
 545 
     | 
    
         
            +
                  at_exit{
         
     | 
| 
      
 546 
     | 
    
         
            +
             
     | 
| 
      
 547 
     | 
    
         
            +
                    begin
         
     | 
| 
      
 548 
     | 
    
         
            +
             
     | 
| 
      
 549 
     | 
    
         
            +
                      exit_status = nil
         
     | 
| 
      
 550 
     | 
    
         
            +
             
     | 
| 
      
 551 
     | 
    
         
            +
                      case $!
         
     | 
| 
      
 552 
     | 
    
         
            +
             
     | 
| 
      
 553 
     | 
    
         
            +
                        when NilClass
         
     | 
| 
      
 554 
     | 
    
         
            +
             
     | 
| 
      
 555 
     | 
    
         
            +
                          exit_status = ['info', '', 'Execution finished succesfully', '']
         
     | 
| 
      
 556 
     | 
    
         
            +
             
     | 
| 
      
 557 
     | 
    
         
            +
                        when SystemExit
         
     | 
| 
      
 558 
     | 
    
         
            +
             
     | 
| 
      
 559 
     | 
    
         
            +
                          exit_status = ['info', '', 'Execution terminated by system exit', '' ]
         
     | 
| 
      
 560 
     | 
    
         
            +
             
     | 
| 
      
 561 
     | 
    
         
            +
                      else
         
     | 
| 
      
 562 
     | 
    
         
            +
             
     | 
| 
      
 563 
     | 
    
         
            +
                        exit_status = ['error', '', "Execution terminated with exception: #{ caller.first.to_s }: #{ $!.message.split("\n") }", '' ]
         
     | 
| 
      
 564 
     | 
    
         
            +
             
     | 
| 
      
 565 
     | 
    
         
            +
                      end
         
     | 
| 
      
 566 
     | 
    
         
            +
             
     | 
| 
      
 567 
     | 
    
         
            +
                      log( *exit_status )
         
     | 
| 
      
 568 
     | 
    
         
            +
             
     | 
| 
      
 569 
     | 
    
         
            +
                    rescue Exception => ex
         
     | 
| 
      
 570 
     | 
    
         
            +
                      puts ex.message
         
     | 
| 
      
 571 
     | 
    
         
            +
                      puts ex.backtrace
         
     | 
| 
      
 572 
     | 
    
         
            +
             
     | 
| 
      
 573 
     | 
    
         
            +
                    end
         
     | 
| 
      
 574 
     | 
    
         
            +
             
     | 
| 
      
 575 
     | 
    
         
            +
                  }
         
     | 
| 
      
 576 
     | 
    
         
            +
                end
         
     | 
| 
      
 577 
     | 
    
         
            +
             
     | 
| 
      
 578 
     | 
    
         
            +
                def hook_methods( _base )
         
     | 
| 
      
 579 
     | 
    
         
            +
             
     | 
| 
      
 580 
     | 
    
         
            +
                  #STDOUT.puts "Use TDriver::Hooking instead of MobyUtil::Logging.hook_methods (#{ caller(1).first })"
         
     | 
| 
      
 581 
     | 
    
         
            +
             
     | 
| 
      
 582 
     | 
    
         
            +
                  TDriver::Hooking.hook_methods( _base ) #if @enabled
         
     | 
| 
      
 583 
     | 
    
         
            +
             
     | 
| 
      
 584 
     | 
    
         
            +
                end
         
     | 
| 
      
 585 
     | 
    
         
            +
             
     | 
| 
      
 586 
     | 
    
         
            +
              end # Logger
         
     | 
| 
      
 587 
     | 
    
         
            +
             
     | 
| 
      
 588 
     | 
    
         
            +
            end # MobyUtil
         
     | 
| 
      
 589 
     | 
    
         
            +
             
     | 
| 
      
 590 
     | 
    
         
            +
            # set global variable pointing to parameter class
         
     | 
| 
      
 591 
     | 
    
         
            +
            $logger = MobyUtil::Logger.instance
         
     |