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,1888 @@ 
     | 
|
| 
      
 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 MobyBehaviour
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
              # == description
         
     | 
| 
      
 23 
     | 
    
         
            +
              # Describes the behaviour of SUT, aka the methods that can be used to control SUT
         
     | 
| 
      
 24 
     | 
    
         
            +
              #
         
     | 
| 
      
 25 
     | 
    
         
            +
              # == behaviour
         
     | 
| 
      
 26 
     | 
    
         
            +
              # GenericSut
         
     | 
| 
      
 27 
     | 
    
         
            +
              #
         
     | 
| 
      
 28 
     | 
    
         
            +
              # == requires
         
     | 
| 
      
 29 
     | 
    
         
            +
              # *
         
     | 
| 
      
 30 
     | 
    
         
            +
              #
         
     | 
| 
      
 31 
     | 
    
         
            +
              # == input_type
         
     | 
| 
      
 32 
     | 
    
         
            +
              # *
         
     | 
| 
      
 33 
     | 
    
         
            +
              #
         
     | 
| 
      
 34 
     | 
    
         
            +
              # == sut_type
         
     | 
| 
      
 35 
     | 
    
         
            +
              # *
         
     | 
| 
      
 36 
     | 
    
         
            +
              #
         
     | 
| 
      
 37 
     | 
    
         
            +
              # == sut_version
         
     | 
| 
      
 38 
     | 
    
         
            +
              # *
         
     | 
| 
      
 39 
     | 
    
         
            +
              #
         
     | 
| 
      
 40 
     | 
    
         
            +
              # == objects
         
     | 
| 
      
 41 
     | 
    
         
            +
              # sut
         
     | 
| 
      
 42 
     | 
    
         
            +
              #
         
     | 
| 
      
 43 
     | 
    
         
            +
              module SUT
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
                include MobyBehaviour::Behaviour
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
                # == nodoc
         
     | 
| 
      
 48 
     | 
    
         
            +
                attr_accessor(
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
                  :dump_count,                # number of UI dump requests done to current SUT
         
     | 
| 
      
 51 
     | 
    
         
            +
                  :current_application_id,    # id of the current appication if set
         
     | 
| 
      
 52 
     | 
    
         
            +
                  :input,                     # the input method used for interacting with this sut as a symbol, eg. :key or :touch.
         
     | 
| 
      
 53 
     | 
    
         
            +
                  :refresh_tries,             # number of retries for ui dump on error case
         
     | 
| 
      
 54 
     | 
    
         
            +
                  :refresh_timeout            # timeout between timeout retry
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
                )
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
      
 58 
     | 
    
         
            +
                # == nodoc
         
     | 
| 
      
 59 
     | 
    
         
            +
                attr_reader(
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
      
 61 
     | 
    
         
            +
                  :xml_data,          # sut xml_data
         
     | 
| 
      
 62 
     | 
    
         
            +
                  :x_path,            # x_path pattern for xml_data
         
     | 
| 
      
 63 
     | 
    
         
            +
                  :ui_type,           # type of the UI used on the sut, ie. s60, qt, windows
         
     | 
| 
      
 64 
     | 
    
         
            +
                  :ui_version,        # version of the ui used on the sut, ie 3.2.3
         
     | 
| 
      
 65 
     | 
    
         
            +
                  :frozen,            # flag that tells if the ui dump getting is disabled
         
     | 
| 
      
 66 
     | 
    
         
            +
                  :xml_data_checksum, # checksum of the previous ui state message
         
     | 
| 
      
 67 
     | 
    
         
            +
                  :verify_blocks,     # verify blocks
         
     | 
| 
      
 68 
     | 
    
         
            +
                  :sut
         
     | 
| 
      
 69 
     | 
    
         
            +
             
     | 
| 
      
 70 
     | 
    
         
            +
                )
         
     | 
| 
      
 71 
     | 
    
         
            +
             
     | 
| 
      
 72 
     | 
    
         
            +
              private
         
     | 
| 
      
 73 
     | 
    
         
            +
             
     | 
| 
      
 74 
     | 
    
         
            +
                # this method will be automatically invoked after module is extended to sut object
         
     | 
| 
      
 75 
     | 
    
         
            +
                def self.extended( target_object )
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
      
 77 
     | 
    
         
            +
                  target_object.instance_exec{
         
     | 
| 
      
 78 
     | 
    
         
            +
             
     | 
| 
      
 79 
     | 
    
         
            +
                    initialize_settings
         
     | 
| 
      
 80 
     | 
    
         
            +
             
     | 
| 
      
 81 
     | 
    
         
            +
                  }
         
     | 
| 
      
 82 
     | 
    
         
            +
             
     | 
| 
      
 83 
     | 
    
         
            +
                end
         
     | 
| 
      
 84 
     | 
    
         
            +
             
     | 
| 
      
 85 
     | 
    
         
            +
                # TODO: document me
         
     | 
| 
      
 86 
     | 
    
         
            +
                def initialize_settings
         
     | 
| 
      
 87 
     | 
    
         
            +
             
     | 
| 
      
 88 
     | 
    
         
            +
                  # default values
         
     | 
| 
      
 89 
     | 
    
         
            +
                  @x_path = '.'
         
     | 
| 
      
 90 
     | 
    
         
            +
                  @xml_data = ""
         
     | 
| 
      
 91 
     | 
    
         
            +
                  @dump_count = 0
         
     | 
| 
      
 92 
     | 
    
         
            +
             
     | 
| 
      
 93 
     | 
    
         
            +
                  # determines that should child test objects be updated
         
     | 
| 
      
 94 
     | 
    
         
            +
                  @update_childs = true
         
     | 
| 
      
 95 
     | 
    
         
            +
                  
         
     | 
| 
      
 96 
     | 
    
         
            +
                  @last_xml_data = nil
         
     | 
| 
      
 97 
     | 
    
         
            +
                  @frozen = false
         
     | 
| 
      
 98 
     | 
    
         
            +
             
     | 
| 
      
 99 
     | 
    
         
            +
                  # initialize cache for sut children
         
     | 
| 
      
 100 
     | 
    
         
            +
                  @child_object_cache = TDriver::TestObjectCache.new
         
     | 
| 
      
 101 
     | 
    
         
            +
             
     | 
| 
      
 102 
     | 
    
         
            +
                  @current_application_id = nil
         
     | 
| 
      
 103 
     | 
    
         
            +
             
     | 
| 
      
 104 
     | 
    
         
            +
                  # create empty hash for sut parameters if sut id not found from parameters
         
     | 
| 
      
 105 
     | 
    
         
            +
                  $parameters[ @id ] = {} unless $parameters.has_key?( @id )
         
     | 
| 
      
 106 
     | 
    
         
            +
             
     | 
| 
      
 107 
     | 
    
         
            +
                  @input            = sut_parameters[ :input_type,             'key' ].to_sym
         
     | 
| 
      
 108 
     | 
    
         
            +
                  @refresh_tries    = sut_parameters[ :ui_state_refresh_tries, '5'   ].to_f
         
     | 
| 
      
 109 
     | 
    
         
            +
                  @refresh_interval = sut_parameters[ :refresh_interval,       '0.5' ].to_f
         
     | 
| 
      
 110 
     | 
    
         
            +
             
     | 
| 
      
 111 
     | 
    
         
            +
                  # load verify blocks from defined sut configuration file 
         
     | 
| 
      
 112 
     | 
    
         
            +
                  @verify_blocks    = load_verify_blocks( sut_parameters[ :verify_blocks, nil ] )
         
     | 
| 
      
 113 
     | 
    
         
            +
                  
         
     | 
| 
      
 114 
     | 
    
         
            +
                end
         
     | 
| 
      
 115 
     | 
    
         
            +
                
         
     | 
| 
      
 116 
     | 
    
         
            +
              public
         
     | 
| 
      
 117 
     | 
    
         
            +
             
     | 
| 
      
 118 
     | 
    
         
            +
                # == description
         
     | 
| 
      
 119 
     | 
    
         
            +
                # Connects selected SUT according to configuration in tdriver_parameters.xml.
         
     | 
| 
      
 120 
     | 
    
         
            +
                # == arguments
         
     | 
| 
      
 121 
     | 
    
         
            +
                # id
         
     | 
| 
      
 122 
     | 
    
         
            +
                #  Symbol
         
     | 
| 
      
 123 
     | 
    
         
            +
                #   description: SUT id
         
     | 
| 
      
 124 
     | 
    
         
            +
                #   example: :sut_qt
         
     | 
| 
      
 125 
     | 
    
         
            +
                # == returns
         
     | 
| 
      
 126 
     | 
    
         
            +
                # Boolean
         
     | 
| 
      
 127 
     | 
    
         
            +
                #  description: Determines if SUT is connected
         
     | 
| 
      
 128 
     | 
    
         
            +
                #  example: true
         
     | 
| 
      
 129 
     | 
    
         
            +
                def connect( id )
         
     | 
| 
      
 130 
     | 
    
         
            +
             
     | 
| 
      
 131 
     | 
    
         
            +
                  @sut_controller.connect( id )
         
     | 
| 
      
 132 
     | 
    
         
            +
             
     | 
| 
      
 133 
     | 
    
         
            +
                end
         
     | 
| 
      
 134 
     | 
    
         
            +
             
     | 
| 
      
 135 
     | 
    
         
            +
                # == description
         
     | 
| 
      
 136 
     | 
    
         
            +
                # Disconnects the current SUT
         
     | 
| 
      
 137 
     | 
    
         
            +
                # == returns
         
     | 
| 
      
 138 
     | 
    
         
            +
                # Boolean
         
     | 
| 
      
 139 
     | 
    
         
            +
                #  description: Determines if SUT is connected
         
     | 
| 
      
 140 
     | 
    
         
            +
                #  example: false
         
     | 
| 
      
 141 
     | 
    
         
            +
                # == examples
         
     | 
| 
      
 142 
     | 
    
         
            +
                #  @sut.disconnect
         
     | 
| 
      
 143 
     | 
    
         
            +
                def disconnect
         
     | 
| 
      
 144 
     | 
    
         
            +
             
     | 
| 
      
 145 
     | 
    
         
            +
                  @sut_controller.disconnect
         
     | 
| 
      
 146 
     | 
    
         
            +
             
     | 
| 
      
 147 
     | 
    
         
            +
                end
         
     | 
| 
      
 148 
     | 
    
         
            +
             
     | 
| 
      
 149 
     | 
    
         
            +
                # == description
         
     | 
| 
      
 150 
     | 
    
         
            +
                # Retrieves the total amount of data received in bytes
         
     | 
| 
      
 151 
     | 
    
         
            +
                # == returns
         
     | 
| 
      
 152 
     | 
    
         
            +
                # Fixnum
         
     | 
| 
      
 153 
     | 
    
         
            +
                #  description: Total amount of data received in bytes
         
     | 
| 
      
 154 
     | 
    
         
            +
                #  example: 65535
         
     | 
| 
      
 155 
     | 
    
         
            +
                # == examples
         
     | 
| 
      
 156 
     | 
    
         
            +
                #  @sut.disconnect
         
     | 
| 
      
 157 
     | 
    
         
            +
                def received_data
         
     | 
| 
      
 158 
     | 
    
         
            +
             
     | 
| 
      
 159 
     | 
    
         
            +
                  @sut_controller.received_bytes
         
     | 
| 
      
 160 
     | 
    
         
            +
             
     | 
| 
      
 161 
     | 
    
         
            +
                end
         
     | 
| 
      
 162 
     | 
    
         
            +
             
     | 
| 
      
 163 
     | 
    
         
            +
                # == description
         
     | 
| 
      
 164 
     | 
    
         
            +
                # Retrieves the total amount of data sent in bytes
         
     | 
| 
      
 165 
     | 
    
         
            +
                # == returns
         
     | 
| 
      
 166 
     | 
    
         
            +
                # Fixnum
         
     | 
| 
      
 167 
     | 
    
         
            +
                #  description: Total amount of data sent in bytes
         
     | 
| 
      
 168 
     | 
    
         
            +
                #  example: 65535
         
     | 
| 
      
 169 
     | 
    
         
            +
                # == examples
         
     | 
| 
      
 170 
     | 
    
         
            +
                #  @sut.sent_data
         
     | 
| 
      
 171 
     | 
    
         
            +
                def sent_data
         
     | 
| 
      
 172 
     | 
    
         
            +
             
     | 
| 
      
 173 
     | 
    
         
            +
                  @sut_controller.sent_bytes
         
     | 
| 
      
 174 
     | 
    
         
            +
             
     | 
| 
      
 175 
     | 
    
         
            +
                end
         
     | 
| 
      
 176 
     | 
    
         
            +
             
     | 
| 
      
 177 
     | 
    
         
            +
                # == description
         
     | 
| 
      
 178 
     | 
    
         
            +
                # Function to disable taking UI dumps from target for a moment. This method might be deprecated in future release.\n
         
     | 
| 
      
 179 
     | 
    
         
            +
                # \n
         
     | 
| 
      
 180 
     | 
    
         
            +
                # [b]NOTE:[/b] Remember to enable ui dumps again using unfreeze!
         
     | 
| 
      
 181 
     | 
    
         
            +
                # == returns
         
     | 
| 
      
 182 
     | 
    
         
            +
                # NilClass
         
     | 
| 
      
 183 
     | 
    
         
            +
                #  description: -
         
     | 
| 
      
 184 
     | 
    
         
            +
                #  example: -
         
     | 
| 
      
 185 
     | 
    
         
            +
                def freeze
         
     | 
| 
      
 186 
     | 
    
         
            +
             
     | 
| 
      
 187 
     | 
    
         
            +
            =begin
         
     | 
| 
      
 188 
     | 
    
         
            +
                  if use_find_objects
         
     | 
| 
      
 189 
     | 
    
         
            +
             
     | 
| 
      
 190 
     | 
    
         
            +
                    warn("warning: SUT##{ __method__ } is not supported when use_find_objects optimization is enabled")
         
     | 
| 
      
 191 
     | 
    
         
            +
             
     | 
| 
      
 192 
     | 
    
         
            +
                  else
         
     | 
| 
      
 193 
     | 
    
         
            +
             
     | 
| 
      
 194 
     | 
    
         
            +
                    @frozen = true
         
     | 
| 
      
 195 
     | 
    
         
            +
             
     | 
| 
      
 196 
     | 
    
         
            +
                  end
         
     | 
| 
      
 197 
     | 
    
         
            +
            =end
         
     | 
| 
      
 198 
     | 
    
         
            +
             
     | 
| 
      
 199 
     | 
    
         
            +
                  @frozen = true
         
     | 
| 
      
 200 
     | 
    
         
            +
             
     | 
| 
      
 201 
     | 
    
         
            +
             
     | 
| 
      
 202 
     | 
    
         
            +
                  nil
         
     | 
| 
      
 203 
     | 
    
         
            +
             
     | 
| 
      
 204 
     | 
    
         
            +
                end
         
     | 
| 
      
 205 
     | 
    
         
            +
             
     | 
| 
      
 206 
     | 
    
         
            +
                # == description
         
     | 
| 
      
 207 
     | 
    
         
            +
                # Function to enable taking ui dumps from target. This method might be deprecated in future release.\n
         
     | 
| 
      
 208 
     | 
    
         
            +
                # \n
         
     | 
| 
      
 209 
     | 
    
         
            +
                # == returns
         
     | 
| 
      
 210 
     | 
    
         
            +
                # NilClass
         
     | 
| 
      
 211 
     | 
    
         
            +
                #  description: -
         
     | 
| 
      
 212 
     | 
    
         
            +
                #  example: -
         
     | 
| 
      
 213 
     | 
    
         
            +
                def unfreeze
         
     | 
| 
      
 214 
     | 
    
         
            +
             
     | 
| 
      
 215 
     | 
    
         
            +
            =begin
         
     | 
| 
      
 216 
     | 
    
         
            +
                  if use_find_objects
         
     | 
| 
      
 217 
     | 
    
         
            +
             
     | 
| 
      
 218 
     | 
    
         
            +
                    warn("warning: SUT##{ __method__ } is not supported when use_find_objects optimization is enabled")
         
     | 
| 
      
 219 
     | 
    
         
            +
             
     | 
| 
      
 220 
     | 
    
         
            +
                  else
         
     | 
| 
      
 221 
     | 
    
         
            +
             
     | 
| 
      
 222 
     | 
    
         
            +
                    @frozen = false
         
     | 
| 
      
 223 
     | 
    
         
            +
             
     | 
| 
      
 224 
     | 
    
         
            +
                  end
         
     | 
| 
      
 225 
     | 
    
         
            +
            =end
         
     | 
| 
      
 226 
     | 
    
         
            +
             
     | 
| 
      
 227 
     | 
    
         
            +
                  @frozen = false
         
     | 
| 
      
 228 
     | 
    
         
            +
             
     | 
| 
      
 229 
     | 
    
         
            +
                  nil
         
     | 
| 
      
 230 
     | 
    
         
            +
             
     | 
| 
      
 231 
     | 
    
         
            +
                end
         
     | 
| 
      
 232 
     | 
    
         
            +
             
     | 
| 
      
 233 
     | 
    
         
            +
                # == nodoc
         
     | 
| 
      
 234 
     | 
    
         
            +
                # == description
         
     | 
| 
      
 235 
     | 
    
         
            +
                # Force to use user defined ui state (e.g. for debugging purposes). Freezes the SUT xml_data, until unfreezed or set to nil.
         
     | 
| 
      
 236 
     | 
    
         
            +
                #
         
     | 
| 
      
 237 
     | 
    
         
            +
                # == arguments
         
     | 
| 
      
 238 
     | 
    
         
            +
                # xml
         
     | 
| 
      
 239 
     | 
    
         
            +
                #  String
         
     | 
| 
      
 240 
     | 
    
         
            +
                #   description: Freeze SUT XML data with given XML string
         
     | 
| 
      
 241 
     | 
    
         
            +
                #   example: "<tasMessage>.....</tasMessage>"
         
     | 
| 
      
 242 
     | 
    
         
            +
                #  MobyUtil::XML::Element
         
     | 
| 
      
 243 
     | 
    
         
            +
                #   description: Freeze SUT XML data with given XML element
         
     | 
| 
      
 244 
     | 
    
         
            +
                #   example: -
         
     | 
| 
      
 245 
     | 
    
         
            +
                #  NilClass
         
     | 
| 
      
 246 
     | 
    
         
            +
                #   description: Unfreeze SUT XML data
         
     | 
| 
      
 247 
     | 
    
         
            +
                #   example: nil
         
     | 
| 
      
 248 
     | 
    
         
            +
                #
         
     | 
| 
      
 249 
     | 
    
         
            +
                # == returns
         
     | 
| 
      
 250 
     | 
    
         
            +
                # NilClass
         
     | 
| 
      
 251 
     | 
    
         
            +
                #  description: This method doesn't return anything
         
     | 
| 
      
 252 
     | 
    
         
            +
                #  example: -
         
     | 
| 
      
 253 
     | 
    
         
            +
                #
         
     | 
| 
      
 254 
     | 
    
         
            +
                # == exception
         
     | 
| 
      
 255 
     | 
    
         
            +
                # TypeError
         
     | 
| 
      
 256 
     | 
    
         
            +
                #  description: Wrong argument type <class> for XML (expected MobyUtil::XML::Element, String or NilClass)
         
     | 
| 
      
 257 
     | 
    
         
            +
                def xml_data=( xml )
         
     | 
| 
      
 258 
     | 
    
         
            +
             
     | 
| 
      
 259 
     | 
    
         
            +
                  xml.check_type( [ MobyUtil::XML::Element, String, NilClass ], "Wrong argument type $1 for XML (expected $2)" )
         
     | 
| 
      
 260 
     | 
    
         
            +
             
     | 
| 
      
 261 
     | 
    
         
            +
                  if xml.kind_of?( MobyUtil::XML::Element )
         
     | 
| 
      
 262 
     | 
    
         
            +
             
     | 
| 
      
 263 
     | 
    
         
            +
                    @test_object_adapter = @test_object_adapter.identify_test_object_adapter_from_data( xml )
         
     | 
| 
      
 264 
     | 
    
         
            +
             
     | 
| 
      
 265 
     | 
    
         
            +
                    @xml_data = xml
         
     | 
| 
      
 266 
     | 
    
         
            +
                    @frozen = true
         
     | 
| 
      
 267 
     | 
    
         
            +
                    @forced_xml = true
         
     | 
| 
      
 268 
     | 
    
         
            +
             
     | 
| 
      
 269 
     | 
    
         
            +
                  elsif xml.kind_of?( String )
         
     | 
| 
      
 270 
     | 
    
         
            +
             
     | 
| 
      
 271 
     | 
    
         
            +
                    @test_object_adapter = @test_object_adapter.identify_test_object_adapter_from_data( xml )
         
     | 
| 
      
 272 
     | 
    
         
            +
             
     | 
| 
      
 273 
     | 
    
         
            +
                    @xml_data = MobyUtil::XML.parse_string( xml )
         
     | 
| 
      
 274 
     | 
    
         
            +
                    @frozen = true
         
     | 
| 
      
 275 
     | 
    
         
            +
                    @forced_xml = true
         
     | 
| 
      
 276 
     | 
    
         
            +
             
     | 
| 
      
 277 
     | 
    
         
            +
                  elsif xml.kind_of?( NilClass )
         
     | 
| 
      
 278 
     | 
    
         
            +
             
     | 
| 
      
 279 
     | 
    
         
            +
                    @xml_data = nil
         
     | 
| 
      
 280 
     | 
    
         
            +
                    @frozen = false
         
     | 
| 
      
 281 
     | 
    
         
            +
                    @forced_xml = false
         
     | 
| 
      
 282 
     | 
    
         
            +
             
     | 
| 
      
 283 
     | 
    
         
            +
                  end
         
     | 
| 
      
 284 
     | 
    
         
            +
             
     | 
| 
      
 285 
     | 
    
         
            +
                  nil
         
     | 
| 
      
 286 
     | 
    
         
            +
             
     | 
| 
      
 287 
     | 
    
         
            +
                end
         
     | 
| 
      
 288 
     | 
    
         
            +
             
     | 
| 
      
 289 
     | 
    
         
            +
             
     | 
| 
      
 290 
     | 
    
         
            +
                # TODO: merge TestObject#child and SUT#child
         
     | 
| 
      
 291 
     | 
    
         
            +
                # == description
         
     | 
| 
      
 292 
     | 
    
         
            +
                # Creates a child test object from this SUT. SUT object will be associated as child test objects parent.\n
         
     | 
| 
      
 293 
     | 
    
         
            +
                # \n
         
     | 
| 
      
 294 
     | 
    
         
            +
                # [b]NOTE:[/b] Subsequent calls to TestObject#child( rule ) always returns reference to same Testobject:\n
         
     | 
| 
      
 295 
     | 
    
         
            +
                # [code]a = sut.child( :type => 'Button', :text => '1' )
         
     | 
| 
      
 296 
     | 
    
         
            +
                # b = sut.child( :type => 'Button', :text => '1' )
         
     | 
| 
      
 297 
     | 
    
         
            +
                # a.eql?( b ) # => true[/code]
         
     | 
| 
      
 298 
     | 
    
         
            +
                # \n
         
     | 
| 
      
 299 
     | 
    
         
            +
                # [b]NOTE:[/b] If the parameter 'use_find_object' in tdriver_parameters.xml is true (default), objects with visibleOnScreen value 'false' might be 
         
     | 
| 
      
 300 
     | 
    
         
            +
                # optimized out and not appear in the results.
         
     | 
| 
      
 301 
     | 
    
         
            +
                # \n
         
     | 
| 
      
 302 
     | 
    
         
            +
                # == arguments
         
     | 
| 
      
 303 
     | 
    
         
            +
                # attributes
         
     | 
| 
      
 304 
     | 
    
         
            +
                #  Hash
         
     | 
| 
      
 305 
     | 
    
         
            +
                #   description: Hash object holding information for identifying which child to create
         
     | 
| 
      
 306 
     | 
    
         
            +
                #   example: { :type => "application" }
         
     | 
| 
      
 307 
     | 
    
         
            +
                #
         
     | 
| 
      
 308 
     | 
    
         
            +
                # == returns
         
     | 
| 
      
 309 
     | 
    
         
            +
                # TestObject
         
     | 
| 
      
 310 
     | 
    
         
            +
                #  description: New child test object or reference to existing child
         
     | 
| 
      
 311 
     | 
    
         
            +
                #  example: -
         
     | 
| 
      
 312 
     | 
    
         
            +
                def child( attributes )
         
     | 
| 
      
 313 
     | 
    
         
            +
             
     | 
| 
      
 314 
     | 
    
         
            +
                  ###############################################################################################################
         
     | 
| 
      
 315 
     | 
    
         
            +
                  #
         
     | 
| 
      
 316 
     | 
    
         
            +
                  #  NOTICE: Please do not add anything unnessecery to this method, it might cause a major performance impact
         
     | 
| 
      
 317 
     | 
    
         
            +
                  #
         
     | 
| 
      
 318 
     | 
    
         
            +
             
     | 
| 
      
 319 
     | 
    
         
            +
                  # verify attributes argument format
         
     | 
| 
      
 320 
     | 
    
         
            +
                  attributes.check_type( Hash, "Wrong argument type $1 for attributes (expected $2)" )
         
     | 
| 
      
 321 
     | 
    
         
            +
             
     | 
| 
      
 322 
     | 
    
         
            +
                  # store original hash
         
     | 
| 
      
 323 
     | 
    
         
            +
                  creation_hash = attributes.clone
         
     | 
| 
      
 324 
     | 
    
         
            +
             
     | 
| 
      
 325 
     | 
    
         
            +
                  identification_directives = creation_hash.strip_dynamic_attributes!
         
     | 
| 
      
 326 
     | 
    
         
            +
             
     | 
| 
      
 327 
     | 
    
         
            +
                  # raise exception if wrong value type given for ;__logging
         
     | 
| 
      
 328 
     | 
    
         
            +
                  identification_directives[ :__logging ].check_type(
         
     | 
| 
      
 329 
     | 
    
         
            +
             
     | 
| 
      
 330 
     | 
    
         
            +
                    [ TrueClass, FalseClass ],
         
     | 
| 
      
 331 
     | 
    
         
            +
             
     | 
| 
      
 332 
     | 
    
         
            +
                    "Wrong value type $1 for :__logging test object creation directive (expected $2)"
         
     | 
| 
      
 333 
     | 
    
         
            +
             
     | 
| 
      
 334 
     | 
    
         
            +
                  ) if identification_directives.has_key?( :__logging )
         
     | 
| 
      
 335 
     | 
    
         
            +
             
     | 
| 
      
 336 
     | 
    
         
            +
                  # disable logging if requested, remove pair from creation_hash
         
     | 
| 
      
 337 
     | 
    
         
            +
                  $logger.push_enabled( identification_directives[ :__logging ] || $logger.enabled )
         
     | 
| 
      
 338 
     | 
    
         
            +
             
     | 
| 
      
 339 
     | 
    
         
            +
                  begin
         
     | 
| 
      
 340 
     | 
    
         
            +
             
     | 
| 
      
 341 
     | 
    
         
            +
                    # TODO: refactor me
         
     | 
| 
      
 342 
     | 
    
         
            +
                    child_test_object = @test_object_factory.get_test_objects(
         
     | 
| 
      
 343 
     | 
    
         
            +
             
     | 
| 
      
 344 
     | 
    
         
            +
                      # current object as parent, can be either TestObject or SUT
         
     | 
| 
      
 345 
     | 
    
         
            +
                      :parent => self,
         
     | 
| 
      
 346 
     | 
    
         
            +
             
     | 
| 
      
 347 
     | 
    
         
            +
                      # test object identification hash
         
     | 
| 
      
 348 
     | 
    
         
            +
                      :object_attributes_hash => creation_hash,
         
     | 
| 
      
 349 
     | 
    
         
            +
             
     | 
| 
      
 350 
     | 
    
         
            +
                      :identification_directives => identification_directives
         
     | 
| 
      
 351 
     | 
    
         
            +
             
     | 
| 
      
 352 
     | 
    
         
            +
                    )
         
     | 
| 
      
 353 
     | 
    
         
            +
             
     | 
| 
      
 354 
     | 
    
         
            +
                  rescue MobyBase::MultipleTestObjectsIdentifiedError
         
     | 
| 
      
 355 
     | 
    
         
            +
             
     | 
| 
      
 356 
     | 
    
         
            +
                    $logger.behaviour "FAIL;Multiple child objects matched criteria.;#{ id };sut;{};child;#{ attributes.inspect }"
         
     | 
| 
      
 357 
     | 
    
         
            +
             
     | 
| 
      
 358 
     | 
    
         
            +
                    raise
         
     | 
| 
      
 359 
     | 
    
         
            +
             
     | 
| 
      
 360 
     | 
    
         
            +
                  rescue MobyBase::TestObjectNotFoundError
         
     | 
| 
      
 361 
     | 
    
         
            +
             
     | 
| 
      
 362 
     | 
    
         
            +
                    $logger.behaviour "FAIL;The child object could not be found.;#{ id };sut;{};child;#{ attributes.inspect }"
         
     | 
| 
      
 363 
     | 
    
         
            +
             
     | 
| 
      
 364 
     | 
    
         
            +
                    raise
         
     | 
| 
      
 365 
     | 
    
         
            +
             
     | 
| 
      
 366 
     | 
    
         
            +
                  rescue Exception
         
     | 
| 
      
 367 
     | 
    
         
            +
             
     | 
| 
      
 368 
     | 
    
         
            +
                    $logger.behaviour "FAIL;Failed when trying to find child object.;#{ id };sut;{};child;#{ attributes.inspect }"
         
     | 
| 
      
 369 
     | 
    
         
            +
             
     | 
| 
      
 370 
     | 
    
         
            +
                    raise
         
     | 
| 
      
 371 
     | 
    
         
            +
             
     | 
| 
      
 372 
     | 
    
         
            +
                  ensure
         
     | 
| 
      
 373 
     | 
    
         
            +
             
     | 
| 
      
 374 
     | 
    
         
            +
                    # restore original logger state
         
     | 
| 
      
 375 
     | 
    
         
            +
                    $logger.pop_enabled
         
     | 
| 
      
 376 
     | 
    
         
            +
             
     | 
| 
      
 377 
     | 
    
         
            +
                  end
         
     | 
| 
      
 378 
     | 
    
         
            +
             
     | 
| 
      
 379 
     | 
    
         
            +
                  # return child test object
         
     | 
| 
      
 380 
     | 
    
         
            +
                  child_test_object
         
     | 
| 
      
 381 
     | 
    
         
            +
             
     | 
| 
      
 382 
     | 
    
         
            +
                end
         
     | 
| 
      
 383 
     | 
    
         
            +
             
     | 
| 
      
 384 
     | 
    
         
            +
             
     | 
| 
      
 385 
     | 
    
         
            +
                # == description
         
     | 
| 
      
 386 
     | 
    
         
            +
                # Method for executing sut specific setup method
         
     | 
| 
      
 387 
     | 
    
         
            +
                # https://projects.forum.nokia.com/Testabilitydriver/wiki/FeatureSutSetupTeardown
         
     | 
| 
      
 388 
     | 
    
         
            +
                # == returns
         
     | 
| 
      
 389 
     | 
    
         
            +
                # Result
         
     | 
| 
      
 390 
     | 
    
         
            +
                #  description: -
         
     | 
| 
      
 391 
     | 
    
         
            +
                #  example: -
         
     | 
| 
      
 392 
     | 
    
         
            +
                # == exceptions
         
     | 
| 
      
 393 
     | 
    
         
            +
                # BehaviourError
         
     | 
| 
      
 394 
     | 
    
         
            +
                #  description: If the implementation is missing for the method
         
     | 
| 
      
 395 
     | 
    
         
            +
                def setup
         
     | 
| 
      
 396 
     | 
    
         
            +
             
     | 
| 
      
 397 
     | 
    
         
            +
                  if sut_parameters[ :sut_setup, nil ] || sut_parameters[ :setup, nil ]
         
     | 
| 
      
 398 
     | 
    
         
            +
             
     | 
| 
      
 399 
     | 
    
         
            +
                    if sut_parameters[ :sut_setup, nil ]
         
     | 
| 
      
 400 
     | 
    
         
            +
             
     | 
| 
      
 401 
     | 
    
         
            +
                      require MobyUtil::FileHelper.expand_path( sut_parameters[ :sut_setup ] )
         
     | 
| 
      
 402 
     | 
    
         
            +
             
     | 
| 
      
 403 
     | 
    
         
            +
                      $logger.behaviour "PASS;sut.setup method found"
         
     | 
| 
      
 404 
     | 
    
         
            +
             
     | 
| 
      
 405 
     | 
    
         
            +
                      setup
         
     | 
| 
      
 406 
     | 
    
         
            +
             
     | 
| 
      
 407 
     | 
    
         
            +
                      $logger.behaviour "PASS;sut.setup executed"
         
     | 
| 
      
 408 
     | 
    
         
            +
             
     | 
| 
      
 409 
     | 
    
         
            +
                    end
         
     | 
| 
      
 410 
     | 
    
         
            +
             
     | 
| 
      
 411 
     | 
    
         
            +
                    if sut_parameters[ :setup, nil ]
         
     | 
| 
      
 412 
     | 
    
         
            +
             
     | 
| 
      
 413 
     | 
    
         
            +
                      $logger.behaviour "PASS;sut.setup parameters found"
         
     | 
| 
      
 414 
     | 
    
         
            +
             
     | 
| 
      
 415 
     | 
    
         
            +
                      methods = sut_parameters[ :setup ]
         
     | 
| 
      
 416 
     | 
    
         
            +
             
     | 
| 
      
 417 
     | 
    
         
            +
                      methods.each do | method |
         
     | 
| 
      
 418 
     | 
    
         
            +
             
     | 
| 
      
 419 
     | 
    
         
            +
                        m = method[0].to_s
         
     | 
| 
      
 420 
     | 
    
         
            +
             
     | 
| 
      
 421 
     | 
    
         
            +
                        args = method[1]
         
     | 
| 
      
 422 
     | 
    
         
            +
             
     | 
| 
      
 423 
     | 
    
         
            +
                        if args.to_s == ""
         
     | 
| 
      
 424 
     | 
    
         
            +
             
     | 
| 
      
 425 
     | 
    
         
            +
                          eval("self.#{m}")
         
     | 
| 
      
 426 
     | 
    
         
            +
             
     | 
| 
      
 427 
     | 
    
         
            +
                        else
         
     | 
| 
      
 428 
     | 
    
         
            +
             
     | 
| 
      
 429 
     | 
    
         
            +
                          eval("self.#{m}(:#{args.to_sym})")
         
     | 
| 
      
 430 
     | 
    
         
            +
             
     | 
| 
      
 431 
     | 
    
         
            +
                        end
         
     | 
| 
      
 432 
     | 
    
         
            +
             
     | 
| 
      
 433 
     | 
    
         
            +
                      end
         
     | 
| 
      
 434 
     | 
    
         
            +
             
     | 
| 
      
 435 
     | 
    
         
            +
                      $logger.behaviour "PASS;sut.setup parameter methods executed"
         
     | 
| 
      
 436 
     | 
    
         
            +
             
     | 
| 
      
 437 
     | 
    
         
            +
                    end
         
     | 
| 
      
 438 
     | 
    
         
            +
             
     | 
| 
      
 439 
     | 
    
         
            +
                  else
         
     | 
| 
      
 440 
     | 
    
         
            +
             
     | 
| 
      
 441 
     | 
    
         
            +
                    $logger.behaviour "FAIL;No methods or parameters found for sut.setup"
         
     | 
| 
      
 442 
     | 
    
         
            +
                    raise MobyBase::BehaviourError.new("Setup", "Failed to load sut.setup method check the :sut_setup parameter")
         
     | 
| 
      
 443 
     | 
    
         
            +
                    
         
     | 
| 
      
 444 
     | 
    
         
            +
                  end
         
     | 
| 
      
 445 
     | 
    
         
            +
             
     | 
| 
      
 446 
     | 
    
         
            +
                end
         
     | 
| 
      
 447 
     | 
    
         
            +
             
     | 
| 
      
 448 
     | 
    
         
            +
                # == description
         
     | 
| 
      
 449 
     | 
    
         
            +
                # Method for executing sut specific teardown method
         
     | 
| 
      
 450 
     | 
    
         
            +
                # https://projects.forum.nokia.com/Testabilitydriver/wiki/FeatureSutSetupTeardown
         
     | 
| 
      
 451 
     | 
    
         
            +
                # == returns
         
     | 
| 
      
 452 
     | 
    
         
            +
                # Result
         
     | 
| 
      
 453 
     | 
    
         
            +
                #  description: -
         
     | 
| 
      
 454 
     | 
    
         
            +
                #  example: -
         
     | 
| 
      
 455 
     | 
    
         
            +
                # == exceptions
         
     | 
| 
      
 456 
     | 
    
         
            +
                # BehaviourError
         
     | 
| 
      
 457 
     | 
    
         
            +
                #  description: If the implementation is missing for the method
         
     | 
| 
      
 458 
     | 
    
         
            +
                def teardown
         
     | 
| 
      
 459 
     | 
    
         
            +
             
     | 
| 
      
 460 
     | 
    
         
            +
                  if sut_parameters[ :sut_teardown, nil ] || sut_parameters[ :teardown, nil ]
         
     | 
| 
      
 461 
     | 
    
         
            +
             
     | 
| 
      
 462 
     | 
    
         
            +
                    if sut_parameters[ :sut_teardown, nil ]
         
     | 
| 
      
 463 
     | 
    
         
            +
             
     | 
| 
      
 464 
     | 
    
         
            +
                      require MobyUtil::FileHelper.expand_path(sut_parameters[ :sut_teardown ])
         
     | 
| 
      
 465 
     | 
    
         
            +
             
     | 
| 
      
 466 
     | 
    
         
            +
                      $logger.behaviour "PASS;sut.teardown method found"
         
     | 
| 
      
 467 
     | 
    
         
            +
             
     | 
| 
      
 468 
     | 
    
         
            +
                      teardown
         
     | 
| 
      
 469 
     | 
    
         
            +
             
     | 
| 
      
 470 
     | 
    
         
            +
                      $logger.behaviour "PASS;sut.teardown executed"
         
     | 
| 
      
 471 
     | 
    
         
            +
             
     | 
| 
      
 472 
     | 
    
         
            +
                    end
         
     | 
| 
      
 473 
     | 
    
         
            +
             
     | 
| 
      
 474 
     | 
    
         
            +
                    if sut_parameters[ :teardown, nil ]
         
     | 
| 
      
 475 
     | 
    
         
            +
             
     | 
| 
      
 476 
     | 
    
         
            +
                      $logger.behaviour "PASS;sut.teardown parameters found"
         
     | 
| 
      
 477 
     | 
    
         
            +
             
     | 
| 
      
 478 
     | 
    
         
            +
                      methods = sut_parameters[ :teardown ]
         
     | 
| 
      
 479 
     | 
    
         
            +
             
     | 
| 
      
 480 
     | 
    
         
            +
                      methods.each do | method |
         
     | 
| 
      
 481 
     | 
    
         
            +
             
     | 
| 
      
 482 
     | 
    
         
            +
                        m = method[0].to_s
         
     | 
| 
      
 483 
     | 
    
         
            +
             
     | 
| 
      
 484 
     | 
    
         
            +
                        args = method[1]
         
     | 
| 
      
 485 
     | 
    
         
            +
             
     | 
| 
      
 486 
     | 
    
         
            +
                        if args.to_s == ""
         
     | 
| 
      
 487 
     | 
    
         
            +
             
     | 
| 
      
 488 
     | 
    
         
            +
                          eval("self.#{m}")
         
     | 
| 
      
 489 
     | 
    
         
            +
             
     | 
| 
      
 490 
     | 
    
         
            +
                        else
         
     | 
| 
      
 491 
     | 
    
         
            +
             
     | 
| 
      
 492 
     | 
    
         
            +
                          eval("self.#{m}(:#{args.to_sym})")
         
     | 
| 
      
 493 
     | 
    
         
            +
             
     | 
| 
      
 494 
     | 
    
         
            +
                        end
         
     | 
| 
      
 495 
     | 
    
         
            +
             
     | 
| 
      
 496 
     | 
    
         
            +
                      end
         
     | 
| 
      
 497 
     | 
    
         
            +
             
     | 
| 
      
 498 
     | 
    
         
            +
                      $logger.behaviour "PASS;sut.teardown parameter methods executed"
         
     | 
| 
      
 499 
     | 
    
         
            +
             
     | 
| 
      
 500 
     | 
    
         
            +
                    end
         
     | 
| 
      
 501 
     | 
    
         
            +
             
     | 
| 
      
 502 
     | 
    
         
            +
                  else
         
     | 
| 
      
 503 
     | 
    
         
            +
             
     | 
| 
      
 504 
     | 
    
         
            +
                    $logger.behaviour "FAIL;No method or parameters found for sut.teardown"
         
     | 
| 
      
 505 
     | 
    
         
            +
             
     | 
| 
      
 506 
     | 
    
         
            +
                    raise MobyBase::BehaviourError.new("Teardown", "Failed to load sut.teardown method check the :sut_teardown parameter")
         
     | 
| 
      
 507 
     | 
    
         
            +
                    
         
     | 
| 
      
 508 
     | 
    
         
            +
                  end
         
     | 
| 
      
 509 
     | 
    
         
            +
             
     | 
| 
      
 510 
     | 
    
         
            +
                end
         
     | 
| 
      
 511 
     | 
    
         
            +
             
     | 
| 
      
 512 
     | 
    
         
            +
                # == description
         
     | 
| 
      
 513 
     | 
    
         
            +
                # Creates a state object of current test object or given XML as argument. The state object is static and thus is not refreshed or synchronized.
         
     | 
| 
      
 514 
     | 
    
         
            +
                #
         
     | 
| 
      
 515 
     | 
    
         
            +
                # == arguments
         
     | 
| 
      
 516 
     | 
    
         
            +
                # source_data
         
     | 
| 
      
 517 
     | 
    
         
            +
                #  String
         
     | 
| 
      
 518 
     | 
    
         
            +
                #   description: Object state as XML string
         
     | 
| 
      
 519 
     | 
    
         
            +
                #   example: -
         
     | 
| 
      
 520 
     | 
    
         
            +
                #  MobyBase::XML::Element
         
     | 
| 
      
 521 
     | 
    
         
            +
                #   description: Object state as XML element
         
     | 
| 
      
 522 
     | 
    
         
            +
                #   example: -
         
     | 
| 
      
 523 
     | 
    
         
            +
                #
         
     | 
| 
      
 524 
     | 
    
         
            +
                # parent_object
         
     | 
| 
      
 525 
     | 
    
         
            +
                #  MobyBase::TestObject
         
     | 
| 
      
 526 
     | 
    
         
            +
                #   description: Parent object
         
     | 
| 
      
 527 
     | 
    
         
            +
                #   example: -
         
     | 
| 
      
 528 
     | 
    
         
            +
                #  MobyBase::SUT
         
     | 
| 
      
 529 
     | 
    
         
            +
                #   description: Parent object
         
     | 
| 
      
 530 
     | 
    
         
            +
                #   example: -
         
     | 
| 
      
 531 
     | 
    
         
            +
                #  NilClass
         
     | 
| 
      
 532 
     | 
    
         
            +
                #   description: No parent object defined
         
     | 
| 
      
 533 
     | 
    
         
            +
                #   example: nil
         
     | 
| 
      
 534 
     | 
    
         
            +
                #
         
     | 
| 
      
 535 
     | 
    
         
            +
                # == returns
         
     | 
| 
      
 536 
     | 
    
         
            +
                # MobyBase::StateObject
         
     | 
| 
      
 537 
     | 
    
         
            +
                #  description: State of this SUT, test object or given XML
         
     | 
| 
      
 538 
     | 
    
         
            +
                #  example: -
         
     | 
| 
      
 539 
     | 
    
         
            +
                #
         
     | 
| 
      
 540 
     | 
    
         
            +
                # == exceptions
         
     | 
| 
      
 541 
     | 
    
         
            +
                # ArgumentError
         
     | 
| 
      
 542 
     | 
    
         
            +
                #  description: Wrong argmument type given
         
     | 
| 
      
 543 
     | 
    
         
            +
                # RuntimeError
         
     | 
| 
      
 544 
     | 
    
         
            +
                #  description: If the XML source for the object is not in initialized
         
     | 
| 
      
 545 
     | 
    
         
            +
                def state_object( source_data = nil, parent_object = nil )
         
     | 
| 
      
 546 
     | 
    
         
            +
             
     | 
| 
      
 547 
     | 
    
         
            +
                  if source_data.nil?
         
     | 
| 
      
 548 
     | 
    
         
            +
             
     | 
| 
      
 549 
     | 
    
         
            +
                    # refresh if xml data is empty
         
     | 
| 
      
 550 
     | 
    
         
            +
                    refresh if @xml_data.empty?
         
     | 
| 
      
 551 
     | 
    
         
            +
             
     | 
| 
      
 552 
     | 
    
         
            +
                    raise RuntimeError, "Can not create state object of SUT with id #{ @id.inspect }, no XML content or SUT not initialized properly." if @xml_data.empty?
         
     | 
| 
      
 553 
     | 
    
         
            +
             
     | 
| 
      
 554 
     | 
    
         
            +
                    source_data = @test_object_adapter.state_object_xml( @xml_data, @id )
         
     | 
| 
      
 555 
     | 
    
         
            +
             
     | 
| 
      
 556 
     | 
    
         
            +
                    parent_object = self
         
     | 
| 
      
 557 
     | 
    
         
            +
             
     | 
| 
      
 558 
     | 
    
         
            +
                  end
         
     | 
| 
      
 559 
     | 
    
         
            +
             
     | 
| 
      
 560 
     | 
    
         
            +
                  # verify that type of xml_source argument is correct
         
     | 
| 
      
 561 
     | 
    
         
            +
                  source_data.check_type [ String, MobyUtil::XML::Element ], 'wrong argument type $1 for state object source data (expected $2)'
         
     | 
| 
      
 562 
     | 
    
         
            +
             
     | 
| 
      
 563 
     | 
    
         
            +
                  parent_object.check_type [ MobyBase::SUT, MobyBase::TestObject, MobyBase::StateObject, NilClass ], 'wrong argument type $1 for parent object (expected $2)'
         
     | 
| 
      
 564 
     | 
    
         
            +
             
     | 
| 
      
 565 
     | 
    
         
            +
                  MobyBase::StateObject.new( 
         
     | 
| 
      
 566 
     | 
    
         
            +
             
     | 
| 
      
 567 
     | 
    
         
            +
                    :source_data => source_data, 
         
     | 
| 
      
 568 
     | 
    
         
            +
                    :parent => parent_object,
         
     | 
| 
      
 569 
     | 
    
         
            +
                    :test_object_adapter => @test_object_adapter
         
     | 
| 
      
 570 
     | 
    
         
            +
             
     | 
| 
      
 571 
     | 
    
         
            +
                  )
         
     | 
| 
      
 572 
     | 
    
         
            +
             
     | 
| 
      
 573 
     | 
    
         
            +
                end
         
     | 
| 
      
 574 
     | 
    
         
            +
             
     | 
| 
      
 575 
     | 
    
         
            +
                # == description
         
     | 
| 
      
 576 
     | 
    
         
            +
                # Returns the current foreground application or one which matches with given attributes rules.
         
     | 
| 
      
 577 
     | 
    
         
            +
                #
         
     | 
| 
      
 578 
     | 
    
         
            +
                # == arguments
         
     | 
| 
      
 579 
     | 
    
         
            +
                # target
         
     | 
| 
      
 580 
     | 
    
         
            +
                #  Hash
         
     | 
| 
      
 581 
     | 
    
         
            +
                #   description: Hash defining required expected attributes of the application
         
     | 
| 
      
 582 
     | 
    
         
            +
                #   example: { :name => "testapp" }
         
     | 
| 
      
 583 
     | 
    
         
            +
                #  String
         
     | 
| 
      
 584 
     | 
    
         
            +
                #   description: Name of application
         
     | 
| 
      
 585 
     | 
    
         
            +
                #   example: "testapp"
         
     | 
| 
      
 586 
     | 
    
         
            +
                #
         
     | 
| 
      
 587 
     | 
    
         
            +
                # == returns
         
     | 
| 
      
 588 
     | 
    
         
            +
                # MobyBase::TestObject
         
     | 
| 
      
 589 
     | 
    
         
            +
                #  description: Current foreground application or one that meets hash rules
         
     | 
| 
      
 590 
     | 
    
         
            +
                #  example: -
         
     | 
| 
      
 591 
     | 
    
         
            +
                #
         
     | 
| 
      
 592 
     | 
    
         
            +
                # == exceptions
         
     | 
| 
      
 593 
     | 
    
         
            +
                # TypeError
         
     | 
| 
      
 594 
     | 
    
         
            +
                #  description: Wrong argument type <class> for attributes (expected Hash)
         
     | 
| 
      
 595 
     | 
    
         
            +
                #
         
     | 
| 
      
 596 
     | 
    
         
            +
                def application( target = {} )
         
     | 
| 
      
 597 
     | 
    
         
            +
             
     | 
| 
      
 598 
     | 
    
         
            +
                  begin
         
     | 
| 
      
 599 
     | 
    
         
            +
             
     | 
| 
      
 600 
     | 
    
         
            +
                    # raise exception if argument type other than hash
         
     | 
| 
      
 601 
     | 
    
         
            +
                    target.check_type( [ String, Hash ], "Wrong argument type $1 for application identification rules (expected $2)" )
         
     | 
| 
      
 602 
     | 
    
         
            +
             
     | 
| 
      
 603 
     | 
    
         
            +
                    # if target application is given as string, interpret it as application name
         
     | 
| 
      
 604 
     | 
    
         
            +
                    target = { :name => target.to_s } if target.kind_of?( String )
         
     | 
| 
      
 605 
     | 
    
         
            +
             
     | 
| 
      
 606 
     | 
    
         
            +
                    target[ :type ] = 'application'
         
     | 
| 
      
 607 
     | 
    
         
            +
             
     | 
| 
      
 608 
     | 
    
         
            +
                    target[ :__parent_application ] = nil
         
     | 
| 
      
 609 
     | 
    
         
            +
             
     | 
| 
      
 610 
     | 
    
         
            +
                    @current_application_id = nil if target[ :id ].nil?
         
     | 
| 
      
 611 
     | 
    
         
            +
             
     | 
| 
      
 612 
     | 
    
         
            +
                    # create test object and return it as result
         
     | 
| 
      
 613 
     | 
    
         
            +
                    test_object = child( target )
         
     | 
| 
      
 614 
     | 
    
         
            +
             
     | 
| 
      
 615 
     | 
    
         
            +
                    # store parent application to test object
         
     | 
| 
      
 616 
     | 
    
         
            +
                    test_object.instance_variable_set( :@parent_application, test_object )
         
     | 
| 
      
 617 
     | 
    
         
            +
             
     | 
| 
      
 618 
     | 
    
         
            +
                    test_object
         
     | 
| 
      
 619 
     | 
    
         
            +
             
     | 
| 
      
 620 
     | 
    
         
            +
                  rescue
         
     | 
| 
      
 621 
     | 
    
         
            +
             
     | 
| 
      
 622 
     | 
    
         
            +
                    $logger.behaviour(
         
     | 
| 
      
 623 
     | 
    
         
            +
                      "FAIL;Failed to find application.;#{ id.to_s };sut;{};application;#{ target.kind_of?( Hash ) ? target.inspect : target.class.to_s }"
         
     | 
| 
      
 624 
     | 
    
         
            +
                    )
         
     | 
| 
      
 625 
     | 
    
         
            +
             
     | 
| 
      
 626 
     | 
    
         
            +
                    # raise same exception
         
     | 
| 
      
 627 
     | 
    
         
            +
                    raise
         
     | 
| 
      
 628 
     | 
    
         
            +
             
     | 
| 
      
 629 
     | 
    
         
            +
                  ensure
         
     | 
| 
      
 630 
     | 
    
         
            +
             
     | 
| 
      
 631 
     | 
    
         
            +
                    $logger.behaviour "PASS;Application found.;#{ id.to_s };sut;{};application;#{ target.inspect }" if $!.nil?
         
     | 
| 
      
 632 
     | 
    
         
            +
             
     | 
| 
      
 633 
     | 
    
         
            +
                  end
         
     | 
| 
      
 634 
     | 
    
         
            +
             
     | 
| 
      
 635 
     | 
    
         
            +
                end
         
     | 
| 
      
 636 
     | 
    
         
            +
             
     | 
| 
      
 637 
     | 
    
         
            +
                # == description
         
     | 
| 
      
 638 
     | 
    
         
            +
                # Screen capture function to take snapshot of SUTs current display view
         
     | 
| 
      
 639 
     | 
    
         
            +
                #
         
     | 
| 
      
 640 
     | 
    
         
            +
                # == arguments
         
     | 
| 
      
 641 
     | 
    
         
            +
                # arguments
         
     | 
| 
      
 642 
     | 
    
         
            +
                #  Hash
         
     | 
| 
      
 643 
     | 
    
         
            +
                #   description:
         
     | 
| 
      
 644 
     | 
    
         
            +
                #    Options to be used for screen capture. See [link="#capture_options_table"]Options table[/link] for valid keys
         
     | 
| 
      
 645 
     | 
    
         
            +
                #   example: ( :filename => "output.png" )
         
     | 
| 
      
 646 
     | 
    
         
            +
                #
         
     | 
| 
      
 647 
     | 
    
         
            +
                # == tables
         
     | 
| 
      
 648 
     | 
    
         
            +
                # capture_options_table
         
     | 
| 
      
 649 
     | 
    
         
            +
                #  title: Options table
         
     | 
| 
      
 650 
     | 
    
         
            +
                #  |Key|Type|Description|Example|Required|
         
     | 
| 
      
 651 
     | 
    
         
            +
                #  |:filename|String|Store output binary to this file. Absolute or relative path supported.|:filename => "screen_shots/output.png"|Yes|
         
     | 
| 
      
 652 
     | 
    
         
            +
                #
         
     | 
| 
      
 653 
     | 
    
         
            +
                # == returns
         
     | 
| 
      
 654 
     | 
    
         
            +
                # NilClass
         
     | 
| 
      
 655 
     | 
    
         
            +
                #   description: -
         
     | 
| 
      
 656 
     | 
    
         
            +
                #   example: -
         
     | 
| 
      
 657 
     | 
    
         
            +
                #
         
     | 
| 
      
 658 
     | 
    
         
            +
                # == exceptions
         
     | 
| 
      
 659 
     | 
    
         
            +
                # TypeError
         
     | 
| 
      
 660 
     | 
    
         
            +
                #   description: Wrong argument type <class> (expected Hash)
         
     | 
| 
      
 661 
     | 
    
         
            +
                #
         
     | 
| 
      
 662 
     | 
    
         
            +
                # ArgumentError
         
     | 
| 
      
 663 
     | 
    
         
            +
                #   description: Output filename (:filename) not defined in argument hash
         
     | 
| 
      
 664 
     | 
    
         
            +
                #
         
     | 
| 
      
 665 
     | 
    
         
            +
                # ArgumentError
         
     | 
| 
      
 666 
     | 
    
         
            +
                #  description: Wrong argument type <class> for output filename (expected String)
         
     | 
| 
      
 667 
     | 
    
         
            +
                #
         
     | 
| 
      
 668 
     | 
    
         
            +
                # ArgumentError
         
     | 
| 
      
 669 
     | 
    
         
            +
                #   description: Output filename must not be empty string
         
     | 
| 
      
 670 
     | 
    
         
            +
                #
         
     | 
| 
      
 671 
     | 
    
         
            +
                def capture_screen( arguments )
         
     | 
| 
      
 672 
     | 
    
         
            +
             
     | 
| 
      
 673 
     | 
    
         
            +
                  begin
         
     | 
| 
      
 674 
     | 
    
         
            +
             
     | 
| 
      
 675 
     | 
    
         
            +
                    # raise exception with default message if wrong argument type given
         
     | 
| 
      
 676 
     | 
    
         
            +
                    arguments.check_type( Hash, "Wrong argument type $1 (expected $2)" )
         
     | 
| 
      
 677 
     | 
    
         
            +
             
     | 
| 
      
 678 
     | 
    
         
            +
                    # legacy support: support also :Filename
         
     | 
| 
      
 679 
     | 
    
         
            +
                    arguments[ :filename ] = arguments.delete( :Filename ) if arguments.has_key?( :Filename )
         
     | 
| 
      
 680 
     | 
    
         
            +
             
     | 
| 
      
 681 
     | 
    
         
            +
                    # raise exception with default message if hash doesn't contain required key
         
     | 
| 
      
 682 
     | 
    
         
            +
                    arguments.require_key( :filename, "Output filename ($1) not defined in argument hash" )
         
     | 
| 
      
 683 
     | 
    
         
            +
             
     | 
| 
      
 684 
     | 
    
         
            +
                    # verify that filename is type of String
         
     | 
| 
      
 685 
     | 
    
         
            +
                    arguments[ :filename ].check_type( String, "Wrong argument type $1 for output filename (expected $2)" )
         
     | 
| 
      
 686 
     | 
    
         
            +
             
     | 
| 
      
 687 
     | 
    
         
            +
                    # verify that filename is not empty string
         
     | 
| 
      
 688 
     | 
    
         
            +
                    arguments[ :filename ].not_empty( "Output filename must not be empty string" )
         
     | 
| 
      
 689 
     | 
    
         
            +
             
     | 
| 
      
 690 
     | 
    
         
            +
                    # create screen capture command object
         
     | 
| 
      
 691 
     | 
    
         
            +
                    command = MobyCommand::ScreenCapture.new()
         
     | 
| 
      
 692 
     | 
    
         
            +
             
     | 
| 
      
 693 
     | 
    
         
            +
                    command.redraw = arguments[ :Redraw ] if arguments[ :Redraw ]
         
     | 
| 
      
 694 
     | 
    
         
            +
             
     | 
| 
      
 695 
     | 
    
         
            +
                    # execute command and write binary to file
         
     | 
| 
      
 696 
     | 
    
         
            +
                    File.open( File.expand_path( arguments[ :filename ] ), 'wb:binary' ){ | file |
         
     | 
| 
      
 697 
     | 
    
         
            +
             
     | 
| 
      
 698 
     | 
    
         
            +
                      file << execute_command( command )
         
     | 
| 
      
 699 
     | 
    
         
            +
             
     | 
| 
      
 700 
     | 
    
         
            +
                    }
         
     | 
| 
      
 701 
     | 
    
         
            +
             
     | 
| 
      
 702 
     | 
    
         
            +
                  rescue
         
     | 
| 
      
 703 
     | 
    
         
            +
             
     | 
| 
      
 704 
     | 
    
         
            +
                    $logger.behaviour "FAIL;Failed to capture screen.;#{ id.to_s };sut;{};capture_screen;#{ arguments.kind_of?( Hash ) ? arguments.inspect : arguments.class.to_s }"
         
     | 
| 
      
 705 
     | 
    
         
            +
             
     | 
| 
      
 706 
     | 
    
         
            +
                    raise
         
     | 
| 
      
 707 
     | 
    
         
            +
             
     | 
| 
      
 708 
     | 
    
         
            +
                  end
         
     | 
| 
      
 709 
     | 
    
         
            +
             
     | 
| 
      
 710 
     | 
    
         
            +
                  $logger.behaviour "PASS;Screen was captured successfully.;#{ id.to_s };sut;{};capture_screen;#{ arguments.inspect }"
         
     | 
| 
      
 711 
     | 
    
         
            +
             
     | 
| 
      
 712 
     | 
    
         
            +
                  nil
         
     | 
| 
      
 713 
     | 
    
         
            +
             
     | 
| 
      
 714 
     | 
    
         
            +
                end
         
     | 
| 
      
 715 
     | 
    
         
            +
             
     | 
| 
      
 716 
     | 
    
         
            +
                # == description
         
     | 
| 
      
 717 
     | 
    
         
            +
                # Instructs the SUT to start the specified application if it is not currenly being executed
         
     | 
| 
      
 718 
     | 
    
         
            +
                # The application will also be brought to the foregound.
         
     | 
| 
      
 719 
     | 
    
         
            +
                #
         
     | 
| 
      
 720 
     | 
    
         
            +
                # == arguments
         
     | 
| 
      
 721 
     | 
    
         
            +
                # target
         
     | 
| 
      
 722 
     | 
    
         
            +
                #  Hash
         
     | 
| 
      
 723 
     | 
    
         
            +
                #   description: Used to indetify the application to be executed. All symbols defined in the hash must match with the launched application. See application [link="#run_hash_arguments"]run argument hash keys[/link] table.
         
     | 
| 
      
 724 
     | 
    
         
            +
                #   example: { :name => "calculator" }
         
     | 
| 
      
 725 
     | 
    
         
            +
                #  String
         
     | 
| 
      
 726 
     | 
    
         
            +
                #   description: If target application is given in String format it is interpreted as application name. String "calculator"' is equivalent to {:name => "calculator"} hash.
         
     | 
| 
      
 727 
     | 
    
         
            +
                #   example: "calculator"
         
     | 
| 
      
 728 
     | 
    
         
            +
                #
         
     | 
| 
      
 729 
     | 
    
         
            +
                # == tables
         
     | 
| 
      
 730 
     | 
    
         
            +
                # run_hash_arguments
         
     | 
| 
      
 731 
     | 
    
         
            +
                #  title: Run argument hash keys
         
     | 
| 
      
 732 
     | 
    
         
            +
                #  description: The following symbols can be defined in the hash, at least one them must be defined.
         
     | 
| 
      
 733 
     | 
    
         
            +
                #  |Key|Type|Description|Example|
         
     | 
| 
      
 734 
     | 
    
         
            +
                #  |:uid|String or Integer|Unique ID of the application|{ :uid => 268458181 }|
         
     | 
| 
      
 735 
     | 
    
         
            +
                #  |:name|String|Executable name of the application|{ :name => 'calculator' }|
         
     | 
| 
      
 736 
     | 
    
         
            +
                #  |:restart_if_running|Boolean|Restart application if already running|{ :restart_if_running => true }|
         
     | 
| 
      
 737 
     | 
    
         
            +
                #  |:arguments|String|Comma separated list of arguments passed to the application when it is started|{ :arguments => '--nogui,-v' }|
         
     | 
| 
      
 738 
     | 
    
         
            +
                #  |:check_pid|Boolean|Overrides default value of SUT parameter :application_check_pid; When set to true, process id is used to test object identification|false|
         
     | 
| 
      
 739 
     | 
    
         
            +
                #   |:sleep_time|Integer|Number of seconds to sleep immediately after launching the process|{ :sleep_time => 10 }|
         
     | 
| 
      
 740 
     | 
    
         
            +
                #   |:start_command|String|When set, the run method will execute this command and expect the application provided by the :name key to be launched. Note that applications launched this way can't be sent a Kill message and its start up events and signals may not be recorded.|{ :start_command => 'start_app_batch',:name => 'calculator' }|
         
     | 
| 
      
 741 
     | 
    
         
            +
                #   |:try_attach|Boolean|If set to true, run will attempt to attach to an existing application with the given name or id. If not found the application will be launched as normal. If more than 1 are found then an exception is thrown|{:try_attach => true, :name => 'calculator'}|
         
     | 
| 
      
 742 
     | 
    
         
            +
                #   |:environment|String|Environment variables you want to pass to started process, passed as key value pairs separated by '=' and pairs separated by spaces |{ :environment => 'LC_ALL=en SPECIAL_VAR=value' }|
         
     | 
| 
      
 743 
     | 
    
         
            +
                #   |:events_to_listen|String|List of events you want to start listening to when application starts, passed as comma separated string.  You can retrieve a list of events fired by a test object by first enabling event listening and then using the get_events method. See methods enable_events, get_events and disable_events |{ :events_to_listen => 'Paint,Show' }|
         
     | 
| 
      
 744 
     | 
    
         
            +
                #   |:signals_to_listen|String|List of signals you want to start listening to when application starts, passed as comma separated string. Check your application class what signals it can emit, or you can use the 'signal' fixture's 'list_signal' method to retrieve an xml string listing all the signals the object can emit.  E.g. xml = @object.fixture('signal', 'list_signals')|{ :signals_to_listen => 'applicationReady()' }|
         
     | 
| 
      
 745 
     | 
    
         
            +
                #
         
     | 
| 
      
 746 
     | 
    
         
            +
                # == returns
         
     | 
| 
      
 747 
     | 
    
         
            +
                # TestObject
         
     | 
| 
      
 748 
     | 
    
         
            +
                #  description: Test object of the started application
         
     | 
| 
      
 749 
     | 
    
         
            +
                #  example: -
         
     | 
| 
      
 750 
     | 
    
         
            +
                #
         
     | 
| 
      
 751 
     | 
    
         
            +
                # == exceptions
         
     | 
| 
      
 752 
     | 
    
         
            +
                # TypeError
         
     | 
| 
      
 753 
     | 
    
         
            +
                #  description: Wrong argument type <class> for run method (expected Hash)
         
     | 
| 
      
 754 
     | 
    
         
            +
                #
         
     | 
| 
      
 755 
     | 
    
         
            +
                # ArgumentError
         
     | 
| 
      
 756 
     | 
    
         
            +
                #  description: Required key :uid or :name not found from argument hash
         
     | 
| 
      
 757 
     | 
    
         
            +
                #
         
     | 
| 
      
 758 
     | 
    
         
            +
                # VerificationError
         
     | 
| 
      
 759 
     | 
    
         
            +
                #  description: If no application test object can be found after starting the application, or the found object does not match the launched application
         
     | 
| 
      
 760 
     | 
    
         
            +
                #
         
     | 
| 
      
 761 
     | 
    
         
            +
                def run( target )
         
     | 
| 
      
 762 
     | 
    
         
            +
             
     | 
| 
      
 763 
     | 
    
         
            +
                  begin
         
     | 
| 
      
 764 
     | 
    
         
            +
             
     | 
| 
      
 765 
     | 
    
         
            +
                    # set the refresh interval to zero while the application is launched
         
     | 
| 
      
 766 
     | 
    
         
            +
                    #orig_interval = sut_parameters[ :refresh_interval ]
         
     | 
| 
      
 767 
     | 
    
         
            +
                    #sut_parameters[ :refresh_interval ] = '0'
         
     | 
| 
      
 768 
     | 
    
         
            +
             
     | 
| 
      
 769 
     | 
    
         
            +
                    # raise exception if argument type other than hash
         
     | 
| 
      
 770 
     | 
    
         
            +
                    target.check_type( [ String, Hash ], "Wrong argument type $1 for run method (expected $2)" )
         
     | 
| 
      
 771 
     | 
    
         
            +
             
     | 
| 
      
 772 
     | 
    
         
            +
                    # if target application is given as string, interpret it as application name
         
     | 
| 
      
 773 
     | 
    
         
            +
                    target = { :name => target.to_s } if target.kind_of?( String )
         
     | 
| 
      
 774 
     | 
    
         
            +
             
     | 
| 
      
 775 
     | 
    
         
            +
                    # default value for missing keys
         
     | 
| 
      
 776 
     | 
    
         
            +
                    target.default = nil
         
     | 
| 
      
 777 
     | 
    
         
            +
             
     | 
| 
      
 778 
     | 
    
         
            +
                    # raise exception if :uid or :name not found from hash
         
     | 
| 
      
 779 
     | 
    
         
            +
                    target.require_one( [ :uid, :name ], "Required key :uid or :name not found from argument hash" )
         
     | 
| 
      
 780 
     | 
    
         
            +
             
     | 
| 
      
 781 
     | 
    
         
            +
                    # due to bug #1488
         
     | 
| 
      
 782 
     | 
    
         
            +
                    sleep_time = ( target[ :sleep_after_launch ] || target[ :sleep_time ] ).to_i
         
     | 
| 
      
 783 
     | 
    
         
            +
             
     | 
| 
      
 784 
     | 
    
         
            +
                    timeout_time = sut_parameters[ :application_synchronization_timeout, '5' ].to_f
         
     | 
| 
      
 785 
     | 
    
         
            +
             
     | 
| 
      
 786 
     | 
    
         
            +
                    retry_interval = sut_parameters[ :application_synchronization_retry_interval, '0.5' ].to_f
         
     | 
| 
      
 787 
     | 
    
         
            +
             
     | 
| 
      
 788 
     | 
    
         
            +
                    if target.has_key?( :check_pid )
         
     | 
| 
      
 789 
     | 
    
         
            +
             
     | 
| 
      
 790 
     | 
    
         
            +
                      check_pid = target[ :check_pid ].check_type [ TrueClass, FalseClass ], 'wrong argument type $1 for SUT#run :check_pid (expected $2)' 
         
     | 
| 
      
 791 
     | 
    
         
            +
                    
         
     | 
| 
      
 792 
     | 
    
         
            +
                    else
         
     | 
| 
      
 793 
     | 
    
         
            +
                                
         
     | 
| 
      
 794 
     | 
    
         
            +
                      # due to bug #1710; pid checking must be configurable
         
     | 
| 
      
 795 
     | 
    
         
            +
                      check_pid = sut_parameters[ :application_check_pid, false ].to_s.to_boolean( false )
         
     | 
| 
      
 796 
     | 
    
         
            +
             
     | 
| 
      
 797 
     | 
    
         
            +
                    end
         
     | 
| 
      
 798 
     | 
    
         
            +
             
     | 
| 
      
 799 
     | 
    
         
            +
                    raise ArgumentError, "Sleep time need to be >= 0" unless sleep_time >= 0
         
     | 
| 
      
 800 
     | 
    
         
            +
             
     | 
| 
      
 801 
     | 
    
         
            +
                    # try to find an existing app with the current arguments
         
     | 
| 
      
 802 
     | 
    
         
            +
                    if target[ :try_attach ] || target[:restart_if_running]
         
     | 
| 
      
 803 
     | 
    
         
            +
             
     | 
| 
      
 804 
     | 
    
         
            +
                      app_list = MobyBase::StateObject.new( 
         
     | 
| 
      
 805 
     | 
    
         
            +
             
     | 
| 
      
 806 
     | 
    
         
            +
                        :source_data => list_apps,
         
     | 
| 
      
 807 
     | 
    
         
            +
                        :parent => nil,
         
     | 
| 
      
 808 
     | 
    
         
            +
                        :test_object_adapter => @test_object_adapter
         
     | 
| 
      
 809 
     | 
    
         
            +
             
     | 
| 
      
 810 
     | 
    
         
            +
                      )
         
     | 
| 
      
 811 
     | 
    
         
            +
             
     | 
| 
      
 812 
     | 
    
         
            +
                      # either ID or NAME have been passed to identify the application
         
     | 
| 
      
 813 
     | 
    
         
            +
                      # raise exception if more than one app has been found for this id/name
         
     | 
| 
      
 814 
     | 
    
         
            +
                      # otherwhise attempt to get the application test object
         
     | 
| 
      
 815 
     | 
    
         
            +
             
     | 
| 
      
 816 
     | 
    
         
            +
                      app_info = find_app(app_list, {:id => target[ :uid ]}) if target[ :uid ] != nil
         
     | 
| 
      
 817 
     | 
    
         
            +
                      app_info = find_app(app_list, {:name => target[ :name ]}) unless app_info
         
     | 
| 
      
 818 
     | 
    
         
            +
             
     | 
| 
      
 819 
     | 
    
         
            +
                      app = application(:id => app_info.id) if app_info
         
     | 
| 
      
 820 
     | 
    
         
            +
             
     | 
| 
      
 821 
     | 
    
         
            +
                      if target[:restart_if_running] && app
         
     | 
| 
      
 822 
     | 
    
         
            +
             
     | 
| 
      
 823 
     | 
    
         
            +
                        # Close the application,
         
     | 
| 
      
 824 
     | 
    
         
            +
                        app.close # (:force_kill => true)
         
     | 
| 
      
 825 
     | 
    
         
            +
             
     | 
| 
      
 826 
     | 
    
         
            +
                      elsif app
         
     | 
| 
      
 827 
     | 
    
         
            +
                        
         
     | 
| 
      
 828 
     | 
    
         
            +
                        begin
         
     | 
| 
      
 829 
     | 
    
         
            +
             
     | 
| 
      
 830 
     | 
    
         
            +
                          app.bring_to_foreground
         
     | 
| 
      
 831 
     | 
    
         
            +
             
     | 
| 
      
 832 
     | 
    
         
            +
                        rescue Exception => e
         
     | 
| 
      
 833 
     | 
    
         
            +
             
     | 
| 
      
 834 
     | 
    
         
            +
                          $logger.warning "Could not bring app to foreground"
         
     | 
| 
      
 835 
     | 
    
         
            +
             
     | 
| 
      
 836 
     | 
    
         
            +
                        end
         
     | 
| 
      
 837 
     | 
    
         
            +
             
     | 
| 
      
 838 
     | 
    
         
            +
                        return app
         
     | 
| 
      
 839 
     | 
    
         
            +
             
     | 
| 
      
 840 
     | 
    
         
            +
                      end
         
     | 
| 
      
 841 
     | 
    
         
            +
             
     | 
| 
      
 842 
     | 
    
         
            +
                    end
         
     | 
| 
      
 843 
     | 
    
         
            +
             
     | 
| 
      
 844 
     | 
    
         
            +
                    if ( target[ :start_command ] != nil )
         
     | 
| 
      
 845 
     | 
    
         
            +
             
     | 
| 
      
 846 
     | 
    
         
            +
                      raise MobyBase::BehaviourError.new("Run", "Failed to load execute_shell_method") unless respond_to?("execute_shell_command")
         
     | 
| 
      
 847 
     | 
    
         
            +
             
     | 
| 
      
 848 
     | 
    
         
            +
                      execute_shell_command( target[ :start_command ], :detached => "true" )
         
     | 
| 
      
 849 
     | 
    
         
            +
             
     | 
| 
      
 850 
     | 
    
         
            +
                    else
         
     | 
| 
      
 851 
     | 
    
         
            +
             
     | 
| 
      
 852 
     | 
    
         
            +
                      # execute the application control service request
         
     | 
| 
      
 853 
     | 
    
         
            +
                      # the run request will return the pid if all goes well
         
     | 
| 
      
 854 
     | 
    
         
            +
                      app_pid = nil
         
     | 
| 
      
 855 
     | 
    
         
            +
             
     | 
| 
      
 856 
     | 
    
         
            +
                      app_pid = execute_command(
         
     | 
| 
      
 857 
     | 
    
         
            +
                        MobyCommand::Application.new(
         
     | 
| 
      
 858 
     | 
    
         
            +
                          :Run,
         
     | 
| 
      
 859 
     | 
    
         
            +
                          { 
         
     | 
| 
      
 860 
     | 
    
         
            +
                            :application_name => target[ :name ],
         
     | 
| 
      
 861 
     | 
    
         
            +
                            :application_uid => target[ :uid ],
         
     | 
| 
      
 862 
     | 
    
         
            +
                            :sut => self,
         
     | 
| 
      
 863 
     | 
    
         
            +
                            :arguments => target[ :arguments ],
         
     | 
| 
      
 864 
     | 
    
         
            +
                            :environment => target[ :environment ],
         
     | 
| 
      
 865 
     | 
    
         
            +
                            :working_directory => target[ :working_directory ],
         
     | 
| 
      
 866 
     | 
    
         
            +
                            :events_to_listen => target[ :events_to_listen ],
         
     | 
| 
      
 867 
     | 
    
         
            +
                            :signals_to_listen => target[ :signals_to_listen ]
         
     | 
| 
      
 868 
     | 
    
         
            +
                          }
         
     | 
| 
      
 869 
     | 
    
         
            +
                        )
         
     | 
| 
      
 870 
     | 
    
         
            +
                      )
         
     | 
| 
      
 871 
     | 
    
         
            +
             
     | 
| 
      
 872 
     | 
    
         
            +
                    end
         
     | 
| 
      
 873 
     | 
    
         
            +
             
     | 
| 
      
 874 
     | 
    
         
            +
                    # do not remove this, unless qttas server & plugin handles the syncronization between plugin registration & first ui state request
         
     | 
| 
      
 875 
     | 
    
         
            +
                    # first ui dump is requested too early and target/server seems not be ready...
         
     | 
| 
      
 876 
     | 
    
         
            +
                    sleep sleep_time if sleep_time > 0
         
     | 
| 
      
 877 
     | 
    
         
            +
                 
         
     | 
| 
      
 878 
     | 
    
         
            +
                    # Now the application id is its PID that we get from the execute_command response
         
     | 
| 
      
 879 
     | 
    
         
            +
                    expected_attributes = { :type => 'application' }
         
     | 
| 
      
 880 
     | 
    
         
            +
             
     | 
| 
      
 881 
     | 
    
         
            +
                    # fix to bug #1710; pid checking must be configurable
         
     | 
| 
      
 882 
     | 
    
         
            +
                    if check_pid == true
         
     | 
| 
      
 883 
     | 
    
         
            +
                    
         
     | 
| 
      
 884 
     | 
    
         
            +
                      expected_attributes[ :id ] = app_pid unless app_pid.nil?
         
     | 
| 
      
 885 
     | 
    
         
            +
             
     | 
| 
      
 886 
     | 
    
         
            +
                    end        
         
     | 
| 
      
 887 
     | 
    
         
            +
                            
         
     | 
| 
      
 888 
     | 
    
         
            +
                    expected_attributes[ :FullName ] = target[ :name ] unless target[ :name ].nil?
         
     | 
| 
      
 889 
     | 
    
         
            +
             
     | 
| 
      
 890 
     | 
    
         
            +
                    # For error reporting
         
     | 
| 
      
 891 
     | 
    
         
            +
                    error_details = target[ :name ].nil? ? "" : "name: " << target[ :name ].to_s
         
     | 
| 
      
 892 
     | 
    
         
            +
                    error_details << ( error_details.empty? ? "" : ", ") << "id: " << target[ :uid ].to_s if !target[ :uid ].nil?
         
     | 
| 
      
 893 
     | 
    
         
            +
             
     | 
| 
      
 894 
     | 
    
         
            +
                    # Calculate the application name from :FullName ( used later )
         
     | 
| 
      
 895 
     | 
    
         
            +
                    app_name = target[ :name ].nil? ? "" : "name: " << target[ :name ].to_s
         
     | 
| 
      
 896 
     | 
    
         
            +
             
     | 
| 
      
 897 
     | 
    
         
            +
                    if( !expected_attributes[ :FullName ].nil? )
         
     | 
| 
      
 898 
     | 
    
         
            +
                      if( expected_attributes[ :FullName ].include?('/') )
         
     | 
| 
      
 899 
     | 
    
         
            +
                        app_name = expected_attributes[ :FullName ].split('/')[ expected_attributes[ :FullName ].split( '/' ).size-1 ]
         
     | 
| 
      
 900 
     | 
    
         
            +
                        app_name.slice!( ".exe" )
         
     | 
| 
      
 901 
     | 
    
         
            +
                        expected_attributes[ :name ] = app_name
         
     | 
| 
      
 902 
     | 
    
         
            +
             
     | 
| 
      
 903 
     | 
    
         
            +
                      elsif( expected_attributes[ :FullName ].include?("\\") )
         
     | 
| 
      
 904 
     | 
    
         
            +
                        app_name = expected_attributes[ :FullName ].split("\\")[ expected_attributes[ :FullName ].split( "\\" ).size-1 ]
         
     | 
| 
      
 905 
     | 
    
         
            +
                        app_name.slice!( ".exe" )
         
     | 
| 
      
 906 
     | 
    
         
            +
                        expected_attributes[:name] = app_name
         
     | 
| 
      
 907 
     | 
    
         
            +
             
     | 
| 
      
 908 
     | 
    
         
            +
                      else
         
     | 
| 
      
 909 
     | 
    
         
            +
                        app_name = expected_attributes[ :FullName ]
         
     | 
| 
      
 910 
     | 
    
         
            +
                        app_name.slice!( ".exe" )
         
     | 
| 
      
 911 
     | 
    
         
            +
                        expected_attributes[ :name ] = app_name
         
     | 
| 
      
 912 
     | 
    
         
            +
             
     | 
| 
      
 913 
     | 
    
         
            +
                      end
         
     | 
| 
      
 914 
     | 
    
         
            +
             
     | 
| 
      
 915 
     | 
    
         
            +
                      expected_attributes.delete( :FullName )
         
     | 
| 
      
 916 
     | 
    
         
            +
                      expected_attributes.delete( :name )
         
     | 
| 
      
 917 
     | 
    
         
            +
                    end
         
     | 
| 
      
 918 
     | 
    
         
            +
             
     | 
| 
      
 919 
     | 
    
         
            +
                    # Wait for application to register and then create the application test object
         
     | 
| 
      
 920 
     | 
    
         
            +
                    begin
         
     | 
| 
      
 921 
     | 
    
         
            +
             
     | 
| 
      
 922 
     | 
    
         
            +
                      MobyUtil::Retryable.until(
         
     | 
| 
      
 923 
     | 
    
         
            +
                        :timeout => timeout_time,
         
     | 
| 
      
 924 
     | 
    
         
            +
                        :interval => retry_interval,
         
     | 
| 
      
 925 
     | 
    
         
            +
                        :exception => MobyBase::ApplicationNotAvailableError) {
         
     | 
| 
      
 926 
     | 
    
         
            +
             
     | 
| 
      
 927 
     | 
    
         
            +
                        # verify that application is launched and application test object is found from xml
         
     | 
| 
      
 928 
     | 
    
         
            +
                        expected_attributes.delete( :name )
         
     | 
| 
      
 929 
     | 
    
         
            +
             
     | 
| 
      
 930 
     | 
    
         
            +
                        wait_child(
         
     | 
| 
      
 931 
     | 
    
         
            +
             
     | 
| 
      
 932 
     | 
    
         
            +
                          # attributes to identify application object
         
     | 
| 
      
 933 
     | 
    
         
            +
                          expected_attributes,
         
     | 
| 
      
 934 
     | 
    
         
            +
             
     | 
| 
      
 935 
     | 
    
         
            +
                          # timeout to for application synchronization
         
     | 
| 
      
 936 
     | 
    
         
            +
                          timeout_time,
         
     | 
| 
      
 937 
     | 
    
         
            +
             
     | 
| 
      
 938 
     | 
    
         
            +
                          # wait retry interval and try again if application was not found
         
     | 
| 
      
 939 
     | 
    
         
            +
                          retry_interval
         
     | 
| 
      
 940 
     | 
    
         
            +
             
     | 
| 
      
 941 
     | 
    
         
            +
                        )
         
     | 
| 
      
 942 
     | 
    
         
            +
             
     | 
| 
      
 943 
     | 
    
         
            +
                        expected_attributes[ :name ] = app_name
         
     | 
| 
      
 944 
     | 
    
         
            +
                        # retrieve application object element from sut.xml_data
         
     | 
| 
      
 945 
     | 
    
         
            +
             
     | 
| 
      
 946 
     | 
    
         
            +
                        @matches, unused_rule = @test_object_adapter.get_objects( xml_data, expected_attributes, true )
         
     | 
| 
      
 947 
     | 
    
         
            +
             
     | 
| 
      
 948 
     | 
    
         
            +
                        # raise exception if application element was not found; this shouldn't ever happen?
         
     | 
| 
      
 949 
     | 
    
         
            +
                        raise MobyBase::ApplicationNotAvailableError if @matches.count == 0
         
     | 
| 
      
 950 
     | 
    
         
            +
             
     | 
| 
      
 951 
     | 
    
         
            +
                      }
         
     | 
| 
      
 952 
     | 
    
         
            +
             
     | 
| 
      
 953 
     | 
    
         
            +
                      # create application test object
         
     | 
| 
      
 954 
     | 
    
         
            +
                      foreground_app = @test_object_factory.make_test_object(
         
     | 
| 
      
 955 
     | 
    
         
            +
             
     | 
| 
      
 956 
     | 
    
         
            +
                        :parent => self,
         
     | 
| 
      
 957 
     | 
    
         
            +
             
     | 
| 
      
 958 
     | 
    
         
            +
                        :parent_application => nil,
         
     | 
| 
      
 959 
     | 
    
         
            +
             
     | 
| 
      
 960 
     | 
    
         
            +
                        :object_attributes_hash => expected_attributes,
         
     | 
| 
      
 961 
     | 
    
         
            +
             
     | 
| 
      
 962 
     | 
    
         
            +
                        :xml_object => @matches.first
         
     | 
| 
      
 963 
     | 
    
         
            +
             
     | 
| 
      
 964 
     | 
    
         
            +
                      )
         
     | 
| 
      
 965 
     | 
    
         
            +
             
     | 
| 
      
 966 
     | 
    
         
            +
                      # store application reference to test application; this will be passed to it's child test object(s)
         
     | 
| 
      
 967 
     | 
    
         
            +
                      foreground_app.instance_variable_set( :@parent_application, foreground_app )
         
     | 
| 
      
 968 
     | 
    
         
            +
             
     | 
| 
      
 969 
     | 
    
         
            +
                      # application was not found; this scenario shouldn't ever happen?
         
     | 
| 
      
 970 
     | 
    
         
            +
                      #raise MobyBase::TestObjectNotFoundError unless foreground_app.kind_of?( MobyBehaviour::Application )
         
     | 
| 
      
 971 
     | 
    
         
            +
             
     | 
| 
      
 972 
     | 
    
         
            +
                    rescue MobyBase::TestObjectNotFoundError
         
     | 
| 
      
 973 
     | 
    
         
            +
             
     | 
| 
      
 974 
     | 
    
         
            +
                      raise MobyBase::VerificationError, "No application type test object was found on the device after starting the application."
         
     | 
| 
      
 975 
     | 
    
         
            +
             
     | 
| 
      
 976 
     | 
    
         
            +
                    rescue MobyBase::SyncTimeoutError
         
     | 
| 
      
 977 
     | 
    
         
            +
             
     | 
| 
      
 978 
     | 
    
         
            +
                      raise MobyBase::VerificationError, "The application (#{ error_details }) was not found on the sut after being launched."
         
     | 
| 
      
 979 
     | 
    
         
            +
             
     | 
| 
      
 980 
     | 
    
         
            +
                    end
         
     | 
| 
      
 981 
     | 
    
         
            +
             
     | 
| 
      
 982 
     | 
    
         
            +
                  # raise behaviour error if any exception is raised
         
     | 
| 
      
 983 
     | 
    
         
            +
                  rescue
         
     | 
| 
      
 984 
     | 
    
         
            +
             
     | 
| 
      
 985 
     | 
    
         
            +
                    $logger.behaviour "FAIL;Failed to launch application.;#{ id.to_s };sut;{};run;#{ target.kind_of?( Hash ) ? target.inspect : target.class.to_s }"
         
     | 
| 
      
 986 
     | 
    
         
            +
             
     | 
| 
      
 987 
     | 
    
         
            +
                    raise MobyBase::BehaviourError.new("Run", "Failed to launch application")
         
     | 
| 
      
 988 
     | 
    
         
            +
             
     | 
| 
      
 989 
     | 
    
         
            +
                  end
         
     | 
| 
      
 990 
     | 
    
         
            +
             
     | 
| 
      
 991 
     | 
    
         
            +
                  $logger.behaviour "PASS;The application was launched successfully.;#{ id.to_s };sut;{};run;#{ target.inspect }"
         
     | 
| 
      
 992 
     | 
    
         
            +
             
     | 
| 
      
 993 
     | 
    
         
            +
                  foreground_app
         
     | 
| 
      
 994 
     | 
    
         
            +
             
     | 
| 
      
 995 
     | 
    
         
            +
                end
         
     | 
| 
      
 996 
     | 
    
         
            +
             
     | 
| 
      
 997 
     | 
    
         
            +
                # == description
         
     | 
| 
      
 998 
     | 
    
         
            +
                # Performs a key press or key press sequence to SUT. Key press sequence can contain more complex operations such as holding multiple keys down at the same. Key map file is provided by SUT plugin and is configured in TDriver parameters and/or SUT template XML file (tdriver_parameters.xml).\n
         
     | 
| 
      
 999 
     | 
    
         
            +
                # \n
         
     | 
| 
      
 1000 
     | 
    
         
            +
                # [b]Note for Qt users:[/b]\n
         
     | 
| 
      
 1001 
     | 
    
         
            +
                # If the focus is not currently on target object you need to use the it's own press_key method or tap it before sending any key press events.
         
     | 
| 
      
 1002 
     | 
    
         
            +
                #
         
     | 
| 
      
 1003 
     | 
    
         
            +
                # == tables
         
     | 
| 
      
 1004 
     | 
    
         
            +
                # press_key_sequences
         
     | 
| 
      
 1005 
     | 
    
         
            +
                #  title: Keypress sequence types
         
     | 
| 
      
 1006 
     | 
    
         
            +
                #  description: Describes different types of keypresses. All types are symbols. The amount of time each key are held and time between presses can be specified in tdriver_parameters.xml: short_press are for "normal" keypresses, while long_press are for keypresses of type :LongPress
         
     | 
| 
      
 1007 
     | 
    
         
            +
                #  |Type|Description|Example|
         
     | 
| 
      
 1008 
     | 
    
         
            +
                #  |:KeyDown|Holds key down on SUT until it is released|MobyCommand::KeySequence.new(:kShift, :KeyDown)|
         
     | 
| 
      
 1009 
     | 
    
         
            +
                #  |:KeyUp|Releases a key that was held down on SUT|MobyCommand::KeySequence.new(:kShift, :KeyUp)|
         
     | 
| 
      
 1010 
     | 
    
         
            +
                #  |:LongPress|Holds a key as long_press_timeout specifies in tdriver_parameters.xml. Please note also long_press_interval (Only for S60)|MobyCommand::KeySequence.new( :kApp, :LongPress )|
         
     | 
| 
      
 1011 
     | 
    
         
            +
                #
         
     | 
| 
      
 1012 
     | 
    
         
            +
                # == tables
         
     | 
| 
      
 1013 
     | 
    
         
            +
                # press_key_sequences_methods
         
     | 
| 
      
 1014 
     | 
    
         
            +
                #  title: Keypress sequence methods
         
     | 
| 
      
 1015 
     | 
    
         
            +
                #  description: Specifies possible altering methods for keysequnces. All keysequences are created with MobyCommand::KeySequence.new
         
     | 
| 
      
 1016 
     | 
    
         
            +
                #  |Type|Description|Example|
         
     | 
| 
      
 1017 
     | 
    
         
            +
                #  |:KeyDown|Holds key down on SUT until it is released|MobyCommand::KeySequence.new(:kShift, :KeyDown)|
         
     | 
| 
      
 1018 
     | 
    
         
            +
                #  |:KeyUp|Releases a key that was held down on SUT|MobyCommand::KeySequence.new(:kShift, :KeyUp)|
         
     | 
| 
      
 1019 
     | 
    
         
            +
                #  |:LongPress|Holds a key as long_press_timeout specifies in tdriver_parameters.xml. Please note also long_press_interval (Only for S60)|MobyCommand::KeySequence.new( :kApp, :LongPress )|
         
     | 
| 
      
 1020 
     | 
    
         
            +
                #
         
     | 
| 
      
 1021 
     | 
    
         
            +
                # == arguments
         
     | 
| 
      
 1022 
     | 
    
         
            +
                # value
         
     | 
| 
      
 1023 
     | 
    
         
            +
                #  Symbol
         
     | 
| 
      
 1024 
     | 
    
         
            +
                #   description: one of the key symbols defined in /tdriver/keymaps/
         
     | 
| 
      
 1025 
     | 
    
         
            +
                #   example: @sut.press_key(:kDown)
         
     | 
| 
      
 1026 
     | 
    
         
            +
                #  MobyCommand::KeySequence
         
     | 
| 
      
 1027 
     | 
    
         
            +
                #   description: a KeySequence object of key symbols
         
     | 
| 
      
 1028 
     | 
    
         
            +
                #   example: @sut.press_key( MobyCommand::KeySequence.new(:kDown).times!(3).append!(:kLeft) )
         
     | 
| 
      
 1029 
     | 
    
         
            +
                #
         
     | 
| 
      
 1030 
     | 
    
         
            +
                # == returns
         
     | 
| 
      
 1031 
     | 
    
         
            +
                # NilClass
         
     | 
| 
      
 1032 
     | 
    
         
            +
                #  description: -
         
     | 
| 
      
 1033 
     | 
    
         
            +
                #  example: -
         
     | 
| 
      
 1034 
     | 
    
         
            +
                #
         
     | 
| 
      
 1035 
     | 
    
         
            +
                # == exceptions
         
     | 
| 
      
 1036 
     | 
    
         
            +
                # TypeError
         
     | 
| 
      
 1037 
     | 
    
         
            +
                #  description: Wrong argument type $1 for press_key (expected $2)
         
     | 
| 
      
 1038 
     | 
    
         
            +
                #
         
     | 
| 
      
 1039 
     | 
    
         
            +
                def press_key( value )
         
     | 
| 
      
 1040 
     | 
    
         
            +
             
     | 
| 
      
 1041 
     | 
    
         
            +
                  begin
         
     | 
| 
      
 1042 
     | 
    
         
            +
             
     | 
| 
      
 1043 
     | 
    
         
            +
                    value.check_type( [ Symbol, MobyCommand::KeySequence ], "Wrong argument type $1 for press_key (expected $2)" )
         
     | 
| 
      
 1044 
     | 
    
         
            +
             
     | 
| 
      
 1045 
     | 
    
         
            +
                    if value.kind_of?( Symbol )
         
     | 
| 
      
 1046 
     | 
    
         
            +
             
     | 
| 
      
 1047 
     | 
    
         
            +
                      sequence = MobyCommand::KeySequence.new( value )
         
     | 
| 
      
 1048 
     | 
    
         
            +
                    
         
     | 
| 
      
 1049 
     | 
    
         
            +
                    else
         
     | 
| 
      
 1050 
     | 
    
         
            +
             
     | 
| 
      
 1051 
     | 
    
         
            +
                      sequence = value
         
     | 
| 
      
 1052 
     | 
    
         
            +
                    
         
     | 
| 
      
 1053 
     | 
    
         
            +
                    end
         
     | 
| 
      
 1054 
     | 
    
         
            +
             
     | 
| 
      
 1055 
     | 
    
         
            +
                    sequence.set_sut( self )
         
     | 
| 
      
 1056 
     | 
    
         
            +
             
     | 
| 
      
 1057 
     | 
    
         
            +
                    execute_command( sequence )
         
     | 
| 
      
 1058 
     | 
    
         
            +
             
     | 
| 
      
 1059 
     | 
    
         
            +
                  rescue
         
     | 
| 
      
 1060 
     | 
    
         
            +
             
     | 
| 
      
 1061 
     | 
    
         
            +
                    $logger.behaviour "FAIL;Failed to press key(s).;#{id.to_s};sut;{};press_key;#{ value }"
         
     | 
| 
      
 1062 
     | 
    
         
            +
             
     | 
| 
      
 1063 
     | 
    
         
            +
                    raise
         
     | 
| 
      
 1064 
     | 
    
         
            +
             
     | 
| 
      
 1065 
     | 
    
         
            +
                  end
         
     | 
| 
      
 1066 
     | 
    
         
            +
             
     | 
| 
      
 1067 
     | 
    
         
            +
                  $logger.behaviour "PASS;Successfully pressed key(s).;#{ id.to_s };sut;{};press_key;#{ value }"
         
     | 
| 
      
 1068 
     | 
    
         
            +
             
     | 
| 
      
 1069 
     | 
    
         
            +
                  nil
         
     | 
| 
      
 1070 
     | 
    
         
            +
             
     | 
| 
      
 1071 
     | 
    
         
            +
                end
         
     | 
| 
      
 1072 
     | 
    
         
            +
             
     | 
| 
      
 1073 
     | 
    
         
            +
                # == description
         
     | 
| 
      
 1074 
     | 
    
         
            +
                # Wrapper function to access sut specific parameters.
         
     | 
| 
      
 1075 
     | 
    
         
            +
                # Parameters for each sut are stored in the parameters xml file under group tag with name attribute matching the SUT id
         
     | 
| 
      
 1076 
     | 
    
         
            +
                #
         
     | 
| 
      
 1077 
     | 
    
         
            +
                # == arguments
         
     | 
| 
      
 1078 
     | 
    
         
            +
                # *arguments
         
     | 
| 
      
 1079 
     | 
    
         
            +
                #  String
         
     | 
| 
      
 1080 
     | 
    
         
            +
                #   description: Optional argument which is the name of parameter.
         
     | 
| 
      
 1081 
     | 
    
         
            +
                #   example: 'new_parameter'
         
     | 
| 
      
 1082 
     | 
    
         
            +
                #  Symbol
         
     | 
| 
      
 1083 
     | 
    
         
            +
                #   description: Optional argument which is the name of parameter.
         
     | 
| 
      
 1084 
     | 
    
         
            +
                #    example: :product
         
     | 
| 
      
 1085 
     | 
    
         
            +
                #
         
     | 
| 
      
 1086 
     | 
    
         
            +
                # == returns
         
     | 
| 
      
 1087 
     | 
    
         
            +
                # String
         
     | 
| 
      
 1088 
     | 
    
         
            +
                #   description: Value matching the parameter name given as argument
         
     | 
| 
      
 1089 
     | 
    
         
            +
                #   example: 'testability-driver-qt-sut-plugin'
         
     | 
| 
      
 1090 
     | 
    
         
            +
                #
         
     | 
| 
      
 1091 
     | 
    
         
            +
                # TDriver::ParameterHash
         
     | 
| 
      
 1092 
     | 
    
         
            +
                #   description: Hash of values, if no arguments is specified
         
     | 
| 
      
 1093 
     | 
    
         
            +
                #   example: { :value => '1', :inner_hash => { :another_value => 100 } }
         
     | 
| 
      
 1094 
     | 
    
         
            +
                #
         
     | 
| 
      
 1095 
     | 
    
         
            +
                # == exceptions
         
     | 
| 
      
 1096 
     | 
    
         
            +
                # ParameterNotFoundError
         
     | 
| 
      
 1097 
     | 
    
         
            +
                #   description: If the parameter with the given name does not exist
         
     | 
| 
      
 1098 
     | 
    
         
            +
                #
         
     | 
| 
      
 1099 
     | 
    
         
            +
                # == example
         
     | 
| 
      
 1100 
     | 
    
         
            +
                # parameter_hash = @sut.parameter   #returns the hash of all sut parameters
         
     | 
| 
      
 1101 
     | 
    
         
            +
                # value = @sut.parameter[:product]   #returns the value for parameter 'product' for this particular sut
         
     | 
| 
      
 1102 
     | 
    
         
            +
                # value = @sut.parameter['non_existing_parameter'] #raises exception that 'non_existing_parameter' was not found
         
     | 
| 
      
 1103 
     | 
    
         
            +
                # value = sut.parameter['non_existing_parameter', 'default'] #returns default value if given parameter is not found
         
     | 
| 
      
 1104 
     | 
    
         
            +
                # sut.parameter[:new_parameter] ='new_value'  # set the value of parameter 'product' for this particular sut
         
     | 
| 
      
 1105 
     | 
    
         
            +
                def parameter( *arguments )
         
     | 
| 
      
 1106 
     | 
    
         
            +
             
     | 
| 
      
 1107 
     | 
    
         
            +
                  if ( arguments.count == 0 )
         
     | 
| 
      
 1108 
     | 
    
         
            +
             
     | 
| 
      
 1109 
     | 
    
         
            +
                    $parameters[ @id ]
         
     | 
| 
      
 1110 
     | 
    
         
            +
             
     | 
| 
      
 1111 
     | 
    
         
            +
                  else
         
     | 
| 
      
 1112 
     | 
    
         
            +
             
     | 
| 
      
 1113 
     | 
    
         
            +
                    $parameters[ @id ][ *arguments ]
         
     | 
| 
      
 1114 
     | 
    
         
            +
             
     | 
| 
      
 1115 
     | 
    
         
            +
                  end
         
     | 
| 
      
 1116 
     | 
    
         
            +
             
     | 
| 
      
 1117 
     | 
    
         
            +
                end
         
     | 
| 
      
 1118 
     | 
    
         
            +
             
     | 
| 
      
 1119 
     | 
    
         
            +
                # == description
         
     | 
| 
      
 1120 
     | 
    
         
            +
                # Wrapper function to return translated string for this SUT to read the values from localisation database.
         
     | 
| 
      
 1121 
     | 
    
         
            +
                #
         
     | 
| 
      
 1122 
     | 
    
         
            +
                # == arguments
         
     | 
| 
      
 1123 
     | 
    
         
            +
                # logical_name
         
     | 
| 
      
 1124 
     | 
    
         
            +
                #  String
         
     | 
| 
      
 1125 
     | 
    
         
            +
                #   description: Logical name (LNAME) of the item to be translated. If prefix for User Information or Operator Data are used then the appropiate retrieve methods will be called
         
     | 
| 
      
 1126 
     | 
    
         
            +
                #   example: "txt_button_ok"
         
     | 
| 
      
 1127 
     | 
    
         
            +
                #  Symbol
         
     | 
| 
      
 1128 
     | 
    
         
            +
                #   description: Symbol form of the logical name (LNAME) of the item to be translated.
         
     | 
| 
      
 1129 
     | 
    
         
            +
                #   example: :txt_button_ok
         
     | 
| 
      
 1130 
     | 
    
         
            +
                #
         
     | 
| 
      
 1131 
     | 
    
         
            +
                # file_name
         
     | 
| 
      
 1132 
     | 
    
         
            +
                #  String
         
     | 
| 
      
 1133 
     | 
    
         
            +
                #   description: Optional FNAME search argument for the translation
         
     | 
| 
      
 1134 
     | 
    
         
            +
                #   example: "agenda"
         
     | 
| 
      
 1135 
     | 
    
         
            +
                #   default: nil
         
     | 
| 
      
 1136 
     | 
    
         
            +
                #
         
     | 
| 
      
 1137 
     | 
    
         
            +
                # plurality
         
     | 
| 
      
 1138 
     | 
    
         
            +
                #  String
         
     | 
| 
      
 1139 
     | 
    
         
            +
                #   description: Optional PLURALITY search argument for the translation
         
     | 
| 
      
 1140 
     | 
    
         
            +
                #   example: "a" or "singular"
         
     | 
| 
      
 1141 
     | 
    
         
            +
                #  default: nil
         
     | 
| 
      
 1142 
     | 
    
         
            +
                #
         
     | 
| 
      
 1143 
     | 
    
         
            +
                # numerus
         
     | 
| 
      
 1144 
     | 
    
         
            +
                #  String
         
     | 
| 
      
 1145 
     | 
    
         
            +
                #   description: Optional numeral replacement of an '%Ln | %1' tag on the translated string
         
     | 
| 
      
 1146 
     | 
    
         
            +
                #   example: "1"
         
     | 
| 
      
 1147 
     | 
    
         
            +
                #   default: nil
         
     | 
| 
      
 1148 
     | 
    
         
            +
                #  Integer
         
     | 
| 
      
 1149 
     | 
    
         
            +
                #   description: Optional numeral replacement of an '%Ln | %1 | %D | %U | %N' tag on the translated string
         
     | 
| 
      
 1150 
     | 
    
         
            +
                #   example: 1
         
     | 
| 
      
 1151 
     | 
    
         
            +
                #  Array
         
     | 
| 
      
 1152 
     | 
    
         
            +
                #   description: Optional numeral replacements for multiple '%L1 | %1, %L2 | %2, ...' tags on the translated string
         
     | 
| 
      
 1153 
     | 
    
         
            +
                #   example: [ 3, 2]
         
     | 
| 
      
 1154 
     | 
    
         
            +
                #
         
     | 
| 
      
 1155 
     | 
    
         
            +
                # lengthvariant
         
     | 
| 
      
 1156 
     | 
    
         
            +
                #  String
         
     | 
| 
      
 1157 
     | 
    
         
            +
                #   description: Optional argument to specify a length variant with its priority number (1-9). Translations with no length variants are considered a variant of priority "1". The default 'nil' value will retrieve all variants available.
         
     | 
| 
      
 1158 
     | 
    
         
            +
                #   example: "1"
         
     | 
| 
      
 1159 
     | 
    
         
            +
                #   default: nil
         
     | 
| 
      
 1160 
     | 
    
         
            +
                #
         
     | 
| 
      
 1161 
     | 
    
         
            +
                # == returns
         
     | 
| 
      
 1162 
     | 
    
         
            +
                # String
         
     | 
| 
      
 1163 
     | 
    
         
            +
                #  description: Translation matching the logical_name
         
     | 
| 
      
 1164 
     | 
    
         
            +
                #  example: "Ok"
         
     | 
| 
      
 1165 
     | 
    
         
            +
                # Array
         
     | 
| 
      
 1166 
     | 
    
         
            +
                #  description: If multiple translations have been found for the search conditions an Array with all Strings be returned
         
     | 
| 
      
 1167 
     | 
    
         
            +
                #  example: ["Ok", "OK"]
         
     | 
| 
      
 1168 
     | 
    
         
            +
                #
         
     | 
| 
      
 1169 
     | 
    
         
            +
                # == exceptions
         
     | 
| 
      
 1170 
     | 
    
         
            +
                # LanguageNotFoundError
         
     | 
| 
      
 1171 
     | 
    
         
            +
                #  description: In case language is not found
         
     | 
| 
      
 1172 
     | 
    
         
            +
                #
         
     | 
| 
      
 1173 
     | 
    
         
            +
                # LogicalNameNotFoundError
         
     | 
| 
      
 1174 
     | 
    
         
            +
                #  description: In case no logical name is not found for current language
         
     | 
| 
      
 1175 
     | 
    
         
            +
                #
         
     | 
| 
      
 1176 
     | 
    
         
            +
                # SqlError
         
     | 
| 
      
 1177 
     | 
    
         
            +
                #  description: In case there are problems with the database connectivity
         
     | 
| 
      
 1178 
     | 
    
         
            +
                #
         
     | 
| 
      
 1179 
     | 
    
         
            +
                def translate( logical_name, file_name = nil, plurality = nil, numerus = nil, lengthvariant = nil )
         
     | 
| 
      
 1180 
     | 
    
         
            +
             
     | 
| 
      
 1181 
     | 
    
         
            +
                  raise LogicalNameNotFoundError, "Logical name is nil" if logical_name.nil?
         
     | 
| 
      
 1182 
     | 
    
         
            +
             
     | 
| 
      
 1183 
     | 
    
         
            +
                  translation_type = "localisation"
         
     | 
| 
      
 1184 
     | 
    
         
            +
             
     | 
| 
      
 1185 
     | 
    
         
            +
                  # Check for User Information prefix( "uif_...")
         
     | 
| 
      
 1186 
     | 
    
         
            +
                  $parameters[ :user_data_logical_string_identifier, 'uif_' ].split('|').each do |identifier|
         
     | 
| 
      
 1187 
     | 
    
         
            +
             
     | 
| 
      
 1188 
     | 
    
         
            +
                    if logical_name.to_s.index(identifier)==0
         
     | 
| 
      
 1189 
     | 
    
         
            +
             
     | 
| 
      
 1190 
     | 
    
         
            +
                      translation_type="user_data"
         
     | 
| 
      
 1191 
     | 
    
         
            +
             
     | 
| 
      
 1192 
     | 
    
         
            +
                    end
         
     | 
| 
      
 1193 
     | 
    
         
            +
             
     | 
| 
      
 1194 
     | 
    
         
            +
                  end
         
     | 
| 
      
 1195 
     | 
    
         
            +
             
     | 
| 
      
 1196 
     | 
    
         
            +
                  # Check for Operator Data prefix( "operator_...")
         
     | 
| 
      
 1197 
     | 
    
         
            +
                  $parameters[ :operator_data_logical_string_identifier, 'operator_' ].split('|').each do |identifier|
         
     | 
| 
      
 1198 
     | 
    
         
            +
             
     | 
| 
      
 1199 
     | 
    
         
            +
                    if logical_name.to_s.index(identifier)==0
         
     | 
| 
      
 1200 
     | 
    
         
            +
             
     | 
| 
      
 1201 
     | 
    
         
            +
                      translation_type="operator_data"
         
     | 
| 
      
 1202 
     | 
    
         
            +
             
     | 
| 
      
 1203 
     | 
    
         
            +
                    end
         
     | 
| 
      
 1204 
     | 
    
         
            +
             
     | 
| 
      
 1205 
     | 
    
         
            +
                  end
         
     | 
| 
      
 1206 
     | 
    
         
            +
             
     | 
| 
      
 1207 
     | 
    
         
            +
                  case translation_type
         
     | 
| 
      
 1208 
     | 
    
         
            +
             
     | 
| 
      
 1209 
     | 
    
         
            +
                  when "user_data"
         
     | 
| 
      
 1210 
     | 
    
         
            +
             
     | 
| 
      
 1211 
     | 
    
         
            +
                    get_user_information( logical_name )
         
     | 
| 
      
 1212 
     | 
    
         
            +
             
     | 
| 
      
 1213 
     | 
    
         
            +
                  when "operator_data"
         
     | 
| 
      
 1214 
     | 
    
         
            +
             
     | 
| 
      
 1215 
     | 
    
         
            +
                    get_operator_data( logical_name )
         
     | 
| 
      
 1216 
     | 
    
         
            +
             
     | 
| 
      
 1217 
     | 
    
         
            +
                  when "localisation"
         
     | 
| 
      
 1218 
     | 
    
         
            +
             
     | 
| 
      
 1219 
     | 
    
         
            +
                    language = nil
         
     | 
| 
      
 1220 
     | 
    
         
            +
             
     | 
| 
      
 1221 
     | 
    
         
            +
                    if ( sut_parameters[ :read_lang_from_app ]=='true')
         
     | 
| 
      
 1222 
     | 
    
         
            +
             
     | 
| 
      
 1223 
     | 
    
         
            +
                      #read localeName app
         
     | 
| 
      
 1224 
     | 
    
         
            +
                      language = application.attribute("localeName")
         
     | 
| 
      
 1225 
     | 
    
         
            +
             
     | 
| 
      
 1226 
     | 
    
         
            +
                      #determine the language from the locale
         
     | 
| 
      
 1227 
     | 
    
         
            +
                      language = language.split('_')[0].to_s if (language!=nil && !language.empty?)
         
     | 
| 
      
 1228 
     | 
    
         
            +
             
     | 
| 
      
 1229 
     | 
    
         
            +
                    else
         
     | 
| 
      
 1230 
     | 
    
         
            +
             
     | 
| 
      
 1231 
     | 
    
         
            +
                      language = sut_parameters[ :language ]
         
     | 
| 
      
 1232 
     | 
    
         
            +
             
     | 
| 
      
 1233 
     | 
    
         
            +
                    end
         
     | 
| 
      
 1234 
     | 
    
         
            +
             
     | 
| 
      
 1235 
     | 
    
         
            +
                    raise LanguageNotFoundError, "Language cannot be determind to perform translation" if ( language.nil? || language.empty? )
         
     | 
| 
      
 1236 
     | 
    
         
            +
             
     | 
| 
      
 1237 
     | 
    
         
            +
                    translation = MobyUtil::Localisation.translation(
         
     | 
| 
      
 1238 
     | 
    
         
            +
                      logical_name,
         
     | 
| 
      
 1239 
     | 
    
         
            +
                      language,
         
     | 
| 
      
 1240 
     | 
    
         
            +
                      sut_parameters[ :localisation_server_database_tablename ],
         
     | 
| 
      
 1241 
     | 
    
         
            +
                      file_name,
         
     | 
| 
      
 1242 
     | 
    
         
            +
                      plurality,
         
     | 
| 
      
 1243 
     | 
    
         
            +
                      lengthvariant
         
     | 
| 
      
 1244 
     | 
    
         
            +
                    )
         
     | 
| 
      
 1245 
     | 
    
         
            +
             
     | 
| 
      
 1246 
     | 
    
         
            +
                    if translation.kind_of? String and !numerus.nil?
         
     | 
| 
      
 1247 
     | 
    
         
            +
             
     | 
| 
      
 1248 
     | 
    
         
            +
                      if numerus.kind_of? Array
         
     | 
| 
      
 1249 
     | 
    
         
            +
             
     | 
| 
      
 1250 
     | 
    
         
            +
                        translation.gsub!(/%[L]?(\d)/){|s| numerus[($1.to_i) -1] }
         
     | 
| 
      
 1251 
     | 
    
         
            +
             
     | 
| 
      
 1252 
     | 
    
         
            +
                      elsif numerus.kind_of? String or numerus.kind_of? Integer
         
     | 
| 
      
 1253 
     | 
    
         
            +
             
     | 
| 
      
 1254 
     | 
    
         
            +
                        translation.gsub!(/%(Ln|1|U|D|N)/){|s| numerus.to_s}
         
     | 
| 
      
 1255 
     | 
    
         
            +
             
     | 
| 
      
 1256 
     | 
    
         
            +
                      end
         
     | 
| 
      
 1257 
     | 
    
         
            +
             
     | 
| 
      
 1258 
     | 
    
         
            +
                    elsif translation.kind_of? Array and !numerus.nil?
         
     | 
| 
      
 1259 
     | 
    
         
            +
             
     | 
| 
      
 1260 
     | 
    
         
            +
                      translation.each do |trans|
         
     | 
| 
      
 1261 
     | 
    
         
            +
             
     | 
| 
      
 1262 
     | 
    
         
            +
                        if numerus.kind_of? Array
         
     | 
| 
      
 1263 
     | 
    
         
            +
             
     | 
| 
      
 1264 
     | 
    
         
            +
                          trans.gsub!(/%[L]?(\d)/){|s| numerus[($1.to_i) -1] }
         
     | 
| 
      
 1265 
     | 
    
         
            +
             
     | 
| 
      
 1266 
     | 
    
         
            +
                        elsif numerus.kind_of? String or numerus.kind_of? Integer
         
     | 
| 
      
 1267 
     | 
    
         
            +
             
     | 
| 
      
 1268 
     | 
    
         
            +
                          trans.gsub!(/%(Ln|1|U|D|N)/){|s| numerus.to_s}
         
     | 
| 
      
 1269 
     | 
    
         
            +
             
     | 
| 
      
 1270 
     | 
    
         
            +
                        end
         
     | 
| 
      
 1271 
     | 
    
         
            +
             
     | 
| 
      
 1272 
     | 
    
         
            +
                      end
         
     | 
| 
      
 1273 
     | 
    
         
            +
             
     | 
| 
      
 1274 
     | 
    
         
            +
                    end
         
     | 
| 
      
 1275 
     | 
    
         
            +
             
     | 
| 
      
 1276 
     | 
    
         
            +
                    translation
         
     | 
| 
      
 1277 
     | 
    
         
            +
             
     | 
| 
      
 1278 
     | 
    
         
            +
                  end
         
     | 
| 
      
 1279 
     | 
    
         
            +
             
     | 
| 
      
 1280 
     | 
    
         
            +
                end
         
     | 
| 
      
 1281 
     | 
    
         
            +
             
     | 
| 
      
 1282 
     | 
    
         
            +
                # == nodoc
         
     | 
| 
      
 1283 
     | 
    
         
            +
                # == description
         
     | 
| 
      
 1284 
     | 
    
         
            +
                # Translates all symbol values in hash using SUT's translate method.
         
     | 
| 
      
 1285 
     | 
    
         
            +
                #
         
     | 
| 
      
 1286 
     | 
    
         
            +
                # == arguments
         
     | 
| 
      
 1287 
     | 
    
         
            +
                # hash
         
     | 
| 
      
 1288 
     | 
    
         
            +
                #  Hash
         
     | 
| 
      
 1289 
     | 
    
         
            +
                #   description: containing key and value pairs. The hash will get modified if symbols are found from values
         
     | 
| 
      
 1290 
     | 
    
         
            +
                #   example: {:text=>:translate_me}
         
     | 
| 
      
 1291 
     | 
    
         
            +
                #
         
     | 
| 
      
 1292 
     | 
    
         
            +
                # == returns
         
     | 
| 
      
 1293 
     | 
    
         
            +
                # Hash
         
     | 
| 
      
 1294 
     | 
    
         
            +
                #  description: Translated hash
         
     | 
| 
      
 1295 
     | 
    
         
            +
                #  example: {:text=>'translated_text'}
         
     | 
| 
      
 1296 
     | 
    
         
            +
                # == exceptions
         
     | 
| 
      
 1297 
     | 
    
         
            +
                # LanguageNotFoundError
         
     | 
| 
      
 1298 
     | 
    
         
            +
                #   description: In case of language is not found
         
     | 
| 
      
 1299 
     | 
    
         
            +
                #
         
     | 
| 
      
 1300 
     | 
    
         
            +
                # LogicalNameNotFoundError
         
     | 
| 
      
 1301 
     | 
    
         
            +
                #  description: In case of logical name is not found for current language
         
     | 
| 
      
 1302 
     | 
    
         
            +
                #
         
     | 
| 
      
 1303 
     | 
    
         
            +
                # MySqlConnectError
         
     | 
| 
      
 1304 
     | 
    
         
            +
                #  description: In case problems with the db connectivity
         
     | 
| 
      
 1305 
     | 
    
         
            +
                #
         
     | 
| 
      
 1306 
     | 
    
         
            +
                def translate_values!( hash, file_name = nil, plurality = nil, numerus = nil, lengthvariant = nil )
         
     | 
| 
      
 1307 
     | 
    
         
            +
             
     | 
| 
      
 1308 
     | 
    
         
            +
                  hash.each_pair do | _key, _value |
         
     | 
| 
      
 1309 
     | 
    
         
            +
             
     | 
| 
      
 1310 
     | 
    
         
            +
                    next if [ :name, :type, :id ].include?( _key )
         
     | 
| 
      
 1311 
     | 
    
         
            +
             
     | 
| 
      
 1312 
     | 
    
         
            +
                    hash[ _key ] = translate( _value, file_name, plurality, numerus, lengthvariant ) if _value.kind_of?( Symbol )
         
     | 
| 
      
 1313 
     | 
    
         
            +
             
     | 
| 
      
 1314 
     | 
    
         
            +
                  end unless hash.nil?
         
     | 
| 
      
 1315 
     | 
    
         
            +
             
     | 
| 
      
 1316 
     | 
    
         
            +
                end
         
     | 
| 
      
 1317 
     | 
    
         
            +
             
     | 
| 
      
 1318 
     | 
    
         
            +
                # == description
         
     | 
| 
      
 1319 
     | 
    
         
            +
                # Wrapper function to retrieve user information for this SUT from the user information database.
         
     | 
| 
      
 1320 
     | 
    
         
            +
                #
         
     | 
| 
      
 1321 
     | 
    
         
            +
                # == arguments
         
     | 
| 
      
 1322 
     | 
    
         
            +
                # user_data_lname
         
     | 
| 
      
 1323 
     | 
    
         
            +
                #  String
         
     | 
| 
      
 1324 
     | 
    
         
            +
                #   description: Logical name (LNAME) of the user information item to be retrieved.
         
     | 
| 
      
 1325 
     | 
    
         
            +
                #   example: "uif_first_name"
         
     | 
| 
      
 1326 
     | 
    
         
            +
                #  Symbol
         
     | 
| 
      
 1327 
     | 
    
         
            +
                #   description: Symbol form of the logical name (LNAME) of the user information item to be retrieved.
         
     | 
| 
      
 1328 
     | 
    
         
            +
                #   example: :uif_first_name
         
     | 
| 
      
 1329 
     | 
    
         
            +
                #
         
     | 
| 
      
 1330 
     | 
    
         
            +
                # == returns
         
     | 
| 
      
 1331 
     | 
    
         
            +
                # String
         
     | 
| 
      
 1332 
     | 
    
         
            +
                #  description: User data string
         
     | 
| 
      
 1333 
     | 
    
         
            +
                #  example: "Ivan"
         
     | 
| 
      
 1334 
     | 
    
         
            +
                # Array
         
     | 
| 
      
 1335 
     | 
    
         
            +
                #  description: Array of Strings when multiple user data strings found.
         
     | 
| 
      
 1336 
     | 
    
         
            +
                #  example: ["Ivan", "Manolo"]
         
     | 
| 
      
 1337 
     | 
    
         
            +
                #
         
     | 
| 
      
 1338 
     | 
    
         
            +
                # == exceptions
         
     | 
| 
      
 1339 
     | 
    
         
            +
                # UserDataNotFoundError
         
     | 
| 
      
 1340 
     | 
    
         
            +
                #  description: In case the desired user data is not found
         
     | 
| 
      
 1341 
     | 
    
         
            +
                #
         
     | 
| 
      
 1342 
     | 
    
         
            +
                # UserDataColumnNotFoundError
         
     | 
| 
      
 1343 
     | 
    
         
            +
                #  description: In case the desired data column name to be used for the output is not found
         
     | 
| 
      
 1344 
     | 
    
         
            +
                #
         
     | 
| 
      
 1345 
     | 
    
         
            +
                # SqlError
         
     | 
| 
      
 1346 
     | 
    
         
            +
                #  description: In case there are problems with the database connectivity
         
     | 
| 
      
 1347 
     | 
    
         
            +
                #
         
     | 
| 
      
 1348 
     | 
    
         
            +
                def get_user_information( user_data_lname )
         
     | 
| 
      
 1349 
     | 
    
         
            +
             
     | 
| 
      
 1350 
     | 
    
         
            +
                  MobyUtil::UserData.retrieve(
         
     | 
| 
      
 1351 
     | 
    
         
            +
             
     | 
| 
      
 1352 
     | 
    
         
            +
                    user_data_lname,
         
     | 
| 
      
 1353 
     | 
    
         
            +
             
     | 
| 
      
 1354 
     | 
    
         
            +
                    # language
         
     | 
| 
      
 1355 
     | 
    
         
            +
                    sut_parameters[ :language ],
         
     | 
| 
      
 1356 
     | 
    
         
            +
             
     | 
| 
      
 1357 
     | 
    
         
            +
                    # table name
         
     | 
| 
      
 1358 
     | 
    
         
            +
                    sut_parameters[ :user_data_server_database_tablename ]
         
     | 
| 
      
 1359 
     | 
    
         
            +
             
     | 
| 
      
 1360 
     | 
    
         
            +
                  )
         
     | 
| 
      
 1361 
     | 
    
         
            +
             
     | 
| 
      
 1362 
     | 
    
         
            +
                end
         
     | 
| 
      
 1363 
     | 
    
         
            +
             
     | 
| 
      
 1364 
     | 
    
         
            +
                # == description
         
     | 
| 
      
 1365 
     | 
    
         
            +
                # Wrapper function to retrieve operator data for this SUT from the operator data database.
         
     | 
| 
      
 1366 
     | 
    
         
            +
                #
         
     | 
| 
      
 1367 
     | 
    
         
            +
                # == arguments
         
     | 
| 
      
 1368 
     | 
    
         
            +
                # operator_data_lname
         
     | 
| 
      
 1369 
     | 
    
         
            +
                #  String
         
     | 
| 
      
 1370 
     | 
    
         
            +
                #   description: Logical name (LNAME) of the operator data item to be retrieved.
         
     | 
| 
      
 1371 
     | 
    
         
            +
                #   example: "operator_welcome_message"
         
     | 
| 
      
 1372 
     | 
    
         
            +
                #  Symbol
         
     | 
| 
      
 1373 
     | 
    
         
            +
                #   description: Symbol form of the logical name (LNAME) of the operator data item to be retrieved.
         
     | 
| 
      
 1374 
     | 
    
         
            +
                #   example: :operator_welcome_message
         
     | 
| 
      
 1375 
     | 
    
         
            +
                #
         
     | 
| 
      
 1376 
     | 
    
         
            +
                # == returns
         
     | 
| 
      
 1377 
     | 
    
         
            +
                # String
         
     | 
| 
      
 1378 
     | 
    
         
            +
                #  description: User data string
         
     | 
| 
      
 1379 
     | 
    
         
            +
                #  example: "Welcome to Orange"
         
     | 
| 
      
 1380 
     | 
    
         
            +
                #
         
     | 
| 
      
 1381 
     | 
    
         
            +
                # == exceptions
         
     | 
| 
      
 1382 
     | 
    
         
            +
                # OperatorDataNotFoundError
         
     | 
| 
      
 1383 
     | 
    
         
            +
                #  description: In case the desired operator data is not found
         
     | 
| 
      
 1384 
     | 
    
         
            +
                #
         
     | 
| 
      
 1385 
     | 
    
         
            +
                # OperatorDataColumnNotFoundError
         
     | 
| 
      
 1386 
     | 
    
         
            +
                #  description: In case the desired data column name to be used for the output is not found
         
     | 
| 
      
 1387 
     | 
    
         
            +
                #
         
     | 
| 
      
 1388 
     | 
    
         
            +
                # SqlError
         
     | 
| 
      
 1389 
     | 
    
         
            +
                #  description: In case there are problems with the database connectivity
         
     | 
| 
      
 1390 
     | 
    
         
            +
                #
         
     | 
| 
      
 1391 
     | 
    
         
            +
                def get_operator_data( operator_data_lname )
         
     | 
| 
      
 1392 
     | 
    
         
            +
             
     | 
| 
      
 1393 
     | 
    
         
            +
                  MobyUtil::OperatorData.retrieve(
         
     | 
| 
      
 1394 
     | 
    
         
            +
             
     | 
| 
      
 1395 
     | 
    
         
            +
                    operator_data_lname,
         
     | 
| 
      
 1396 
     | 
    
         
            +
             
     | 
| 
      
 1397 
     | 
    
         
            +
                    # operator
         
     | 
| 
      
 1398 
     | 
    
         
            +
                    sut_parameters[ :operator_selected ],
         
     | 
| 
      
 1399 
     | 
    
         
            +
             
     | 
| 
      
 1400 
     | 
    
         
            +
                    # table name
         
     | 
| 
      
 1401 
     | 
    
         
            +
                    sut_parameters[ :operator_data_server_database_tablename ]
         
     | 
| 
      
 1402 
     | 
    
         
            +
             
     | 
| 
      
 1403 
     | 
    
         
            +
                  )
         
     | 
| 
      
 1404 
     | 
    
         
            +
             
     | 
| 
      
 1405 
     | 
    
         
            +
                end
         
     | 
| 
      
 1406 
     | 
    
         
            +
             
     | 
| 
      
 1407 
     | 
    
         
            +
                # == nodoc
         
     | 
| 
      
 1408 
     | 
    
         
            +
                # Function to update all children of current SUT
         
     | 
| 
      
 1409 
     | 
    
         
            +
                # Iterates on all children of the SUT and calls TestObject#update on all children
         
     | 
| 
      
 1410 
     | 
    
         
            +
                # === params
         
     | 
| 
      
 1411 
     | 
    
         
            +
                # === returns
         
     | 
| 
      
 1412 
     | 
    
         
            +
                # ?
         
     | 
| 
      
 1413 
     | 
    
         
            +
                # === raises
         
     | 
| 
      
 1414 
     | 
    
         
            +
                def update
         
     | 
| 
      
 1415 
     | 
    
         
            +
             
     | 
| 
      
 1416 
     | 
    
         
            +
                  if @update_childs
         
     | 
| 
      
 1417 
     | 
    
         
            +
             
     | 
| 
      
 1418 
     | 
    
         
            +
                    @child_object_cache.each_object{ | test_object |
         
     | 
| 
      
 1419 
     | 
    
         
            +
             
     | 
| 
      
 1420 
     | 
    
         
            +
                      test_object.send( :update, @xml_data )
         
     | 
| 
      
 1421 
     | 
    
         
            +
             
     | 
| 
      
 1422 
     | 
    
         
            +
                      #test_object.update( @xml_data )
         
     | 
| 
      
 1423 
     | 
    
         
            +
             
     | 
| 
      
 1424 
     | 
    
         
            +
                    }
         
     | 
| 
      
 1425 
     | 
    
         
            +
             
     | 
| 
      
 1426 
     | 
    
         
            +
                    @update_childs = false
         
     | 
| 
      
 1427 
     | 
    
         
            +
             
     | 
| 
      
 1428 
     | 
    
         
            +
                    # childs were updated
         
     | 
| 
      
 1429 
     | 
    
         
            +
                    true
         
     | 
| 
      
 1430 
     | 
    
         
            +
             
     | 
| 
      
 1431 
     | 
    
         
            +
                  else
         
     | 
| 
      
 1432 
     | 
    
         
            +
             
     | 
| 
      
 1433 
     | 
    
         
            +
                    # nothing was updated
         
     | 
| 
      
 1434 
     | 
    
         
            +
                    false
         
     | 
| 
      
 1435 
     | 
    
         
            +
             
     | 
| 
      
 1436 
     | 
    
         
            +
                  end
         
     | 
| 
      
 1437 
     | 
    
         
            +
             
     | 
| 
      
 1438 
     | 
    
         
            +
                end
         
     | 
| 
      
 1439 
     | 
    
         
            +
             
     | 
| 
      
 1440 
     | 
    
         
            +
                # == nodoc
         
     | 
| 
      
 1441 
     | 
    
         
            +
                def refresh( refresh_args = {}, creation_attributes = {} )
         
     | 
| 
      
 1442 
     | 
    
         
            +
             
     | 
| 
      
 1443 
     | 
    
         
            +
                  refresh_ui_dump( refresh_args, creation_attributes )
         
     | 
| 
      
 1444 
     | 
    
         
            +
             
     | 
| 
      
 1445 
     | 
    
         
            +
                  # update childs if required, returns true or false
         
     | 
| 
      
 1446 
     | 
    
         
            +
                  update_childs
         
     | 
| 
      
 1447 
     | 
    
         
            +
             
     | 
| 
      
 1448 
     | 
    
         
            +
                end
         
     | 
| 
      
 1449 
     | 
    
         
            +
             
     | 
| 
      
 1450 
     | 
    
         
            +
                # == description
         
     | 
| 
      
 1451 
     | 
    
         
            +
                # Verify always is a method for sut that allows constant verifications for the UI state.
         
     | 
| 
      
 1452 
     | 
    
         
            +
                #
         
     | 
| 
      
 1453 
     | 
    
         
            +
                # == arguments
         
     | 
| 
      
 1454 
     | 
    
         
            +
                # expected
         
     | 
| 
      
 1455 
     | 
    
         
            +
                #  Object
         
     | 
| 
      
 1456 
     | 
    
         
            +
                #   description: Ruby object that equals to the return value of the block
         
     | 
| 
      
 1457 
     | 
    
         
            +
                #   example: true
         
     | 
| 
      
 1458 
     | 
    
         
            +
                #
         
     | 
| 
      
 1459 
     | 
    
         
            +
                # message
         
     | 
| 
      
 1460 
     | 
    
         
            +
                #  String
         
     | 
| 
      
 1461 
     | 
    
         
            +
                #   description: Message if an error occurs
         
     | 
| 
      
 1462 
     | 
    
         
            +
                #   example: 'Required element was not found'
         
     | 
| 
      
 1463 
     | 
    
         
            +
                #
         
     | 
| 
      
 1464 
     | 
    
         
            +
                # &block
         
     | 
| 
      
 1465 
     | 
    
         
            +
                #  Proc
         
     | 
| 
      
 1466 
     | 
    
         
            +
                #   description: Code block to execute.
         
     | 
| 
      
 1467 
     | 
    
         
            +
                #   example: { @sut.xml_data.empty? == false }
         
     | 
| 
      
 1468 
     | 
    
         
            +
                #
         
     | 
| 
      
 1469 
     | 
    
         
            +
                # &block#sut
         
     | 
| 
      
 1470 
     | 
    
         
            +
                #  MobyBase::SUT
         
     | 
| 
      
 1471 
     | 
    
         
            +
                #   description:
         
     | 
| 
      
 1472 
     | 
    
         
            +
                #     Current SUT object is passed as block parameter. If the verify block is defined outside the scope of
         
     | 
| 
      
 1473 
     | 
    
         
            +
                #     the current SUT (e.g. the SUT configuration file), this can be used to get a handle to the current SUT.
         
     | 
| 
      
 1474 
     | 
    
         
            +
                #   example: -
         
     | 
| 
      
 1475 
     | 
    
         
            +
                #
         
     | 
| 
      
 1476 
     | 
    
         
            +
                # == returns
         
     | 
| 
      
 1477 
     | 
    
         
            +
                # NilClass
         
     | 
| 
      
 1478 
     | 
    
         
            +
                #  description: This method doesn't pass return value
         
     | 
| 
      
 1479 
     | 
    
         
            +
                #  example: -
         
     | 
| 
      
 1480 
     | 
    
         
            +
                #
         
     | 
| 
      
 1481 
     | 
    
         
            +
                # == exceptions
         
     | 
| 
      
 1482 
     | 
    
         
            +
                # MobyBase::VerificationError
         
     | 
| 
      
 1483 
     | 
    
         
            +
                #  description: If verification failed
         
     | 
| 
      
 1484 
     | 
    
         
            +
                def verify_always( expected, message = nil, &block )
         
     | 
| 
      
 1485 
     | 
    
         
            +
             
     | 
| 
      
 1486 
     | 
    
         
            +
                  @verify_blocks << MobyUtil::VerifyBlock.new( block,expected, message, 0, MobyUtil::KernelHelper.find_source( caller( 3 ).first.to_s ) )
         
     | 
| 
      
 1487 
     | 
    
         
            +
             
     | 
| 
      
 1488 
     | 
    
         
            +
                  nil
         
     | 
| 
      
 1489 
     | 
    
         
            +
             
     | 
| 
      
 1490 
     | 
    
         
            +
                end
         
     | 
| 
      
 1491 
     | 
    
         
            +
             
     | 
| 
      
 1492 
     | 
    
         
            +
                # == description
         
     | 
| 
      
 1493 
     | 
    
         
            +
                # Clears all verification blocks added to the sut through verify_always() method and
         
     | 
| 
      
 1494 
     | 
    
         
            +
                # verify_blocks configuration parameter in the tdriver parameters file
         
     | 
| 
      
 1495 
     | 
    
         
            +
                #
         
     | 
| 
      
 1496 
     | 
    
         
            +
                # == returns
         
     | 
| 
      
 1497 
     | 
    
         
            +
                # Array
         
     | 
| 
      
 1498 
     | 
    
         
            +
                #  description: Empty array
         
     | 
| 
      
 1499 
     | 
    
         
            +
                #  example: []
         
     | 
| 
      
 1500 
     | 
    
         
            +
                def clear_verify_blocks
         
     | 
| 
      
 1501 
     | 
    
         
            +
             
     | 
| 
      
 1502 
     | 
    
         
            +
                  @verify_blocks = []
         
     | 
| 
      
 1503 
     | 
    
         
            +
             
     | 
| 
      
 1504 
     | 
    
         
            +
                end
         
     | 
| 
      
 1505 
     | 
    
         
            +
             
     | 
| 
      
 1506 
     | 
    
         
            +
                # == nodoc
         
     | 
| 
      
 1507 
     | 
    
         
            +
                def get_application_id
         
     | 
| 
      
 1508 
     | 
    
         
            +
             
     | 
| 
      
 1509 
     | 
    
         
            +
                  # retrieve application object from sut.xml_data
         
     | 
| 
      
 1510 
     | 
    
         
            +
                  matches, unused_rule = @test_object_adapter.get_objects( xml_data, { :type => 'application' }, true )
         
     | 
| 
      
 1511 
     | 
    
         
            +
             
     | 
| 
      
 1512 
     | 
    
         
            +
                  # retrieve id attribute if application test object found
         
     | 
| 
      
 1513 
     | 
    
         
            +
                  if matches.count > 0
         
     | 
| 
      
 1514 
     | 
    
         
            +
             
     | 
| 
      
 1515 
     | 
    
         
            +
                    # return id attribute value
         
     | 
| 
      
 1516 
     | 
    
         
            +
                    @test_object_adapter.test_object_element_attribute( matches.first, 'id' )
         
     | 
| 
      
 1517 
     | 
    
         
            +
             
     | 
| 
      
 1518 
     | 
    
         
            +
                  else
         
     | 
| 
      
 1519 
     | 
    
         
            +
             
     | 
| 
      
 1520 
     | 
    
         
            +
                    # application not found
         
     | 
| 
      
 1521 
     | 
    
         
            +
                    '-1'
         
     | 
| 
      
 1522 
     | 
    
         
            +
             
     | 
| 
      
 1523 
     | 
    
         
            +
                  end
         
     | 
| 
      
 1524 
     | 
    
         
            +
             
     | 
| 
      
 1525 
     | 
    
         
            +
                end
         
     | 
| 
      
 1526 
     | 
    
         
            +
                
         
     | 
| 
      
 1527 
     | 
    
         
            +
                # == nodoc
         
     | 
| 
      
 1528 
     | 
    
         
            +
                # == description
         
     | 
| 
      
 1529 
     | 
    
         
            +
                # == returns
         
     | 
| 
      
 1530 
     | 
    
         
            +
                def agent
         
     | 
| 
      
 1531 
     | 
    
         
            +
             
     | 
| 
      
 1532 
     | 
    
         
            +
                  # pass agent command service object          
         
     | 
| 
      
 1533 
     | 
    
         
            +
                  TDriver::AgentService.new( :sut => self )
         
     | 
| 
      
 1534 
     | 
    
         
            +
                
         
     | 
| 
      
 1535 
     | 
    
         
            +
                end
         
     | 
| 
      
 1536 
     | 
    
         
            +
             
     | 
| 
      
 1537 
     | 
    
         
            +
                # == nodoc
         
     | 
| 
      
 1538 
     | 
    
         
            +
                # == description
         
     | 
| 
      
 1539 
     | 
    
         
            +
                # == returns
         
     | 
| 
      
 1540 
     | 
    
         
            +
                def use_find_objects=( value )
         
     | 
| 
      
 1541 
     | 
    
         
            +
                
         
     | 
| 
      
 1542 
     | 
    
         
            +
                  value.check_type [ TrueClass, FalseClass ], 'wrong argument type $1 for use_find_objects (expected $2)'
         
     | 
| 
      
 1543 
     | 
    
         
            +
                  
         
     | 
| 
      
 1544 
     | 
    
         
            +
                  sut_parameters[ :use_find_object ] = value
         
     | 
| 
      
 1545 
     | 
    
         
            +
                
         
     | 
| 
      
 1546 
     | 
    
         
            +
                end
         
     | 
| 
      
 1547 
     | 
    
         
            +
             
     | 
| 
      
 1548 
     | 
    
         
            +
                # == nodoc
         
     | 
| 
      
 1549 
     | 
    
         
            +
                # == description
         
     | 
| 
      
 1550 
     | 
    
         
            +
                # == returns
         
     | 
| 
      
 1551 
     | 
    
         
            +
                def use_find_objects
         
     | 
| 
      
 1552 
     | 
    
         
            +
                    
         
     | 
| 
      
 1553 
     | 
    
         
            +
                  sut_parameters[ :use_find_object, false ].true? && respond_to?( 'find_object' ).true?
         
     | 
| 
      
 1554 
     | 
    
         
            +
                
         
     | 
| 
      
 1555 
     | 
    
         
            +
                end
         
     | 
| 
      
 1556 
     | 
    
         
            +
             
     | 
| 
      
 1557 
     | 
    
         
            +
              private
         
     | 
| 
      
 1558 
     | 
    
         
            +
             
     | 
| 
      
 1559 
     | 
    
         
            +
                # TODO: document me
         
     | 
| 
      
 1560 
     | 
    
         
            +
                def update_childs
         
     | 
| 
      
 1561 
     | 
    
         
            +
             
     | 
| 
      
 1562 
     | 
    
         
            +
                  # update childs only if ui state is new
         
     | 
| 
      
 1563 
     | 
    
         
            +
                  update if @update_childs
         
     | 
| 
      
 1564 
     | 
    
         
            +
             
     | 
| 
      
 1565 
     | 
    
         
            +
                end
         
     | 
| 
      
 1566 
     | 
    
         
            +
             
     | 
| 
      
 1567 
     | 
    
         
            +
                # == nodoc
         
     | 
| 
      
 1568 
     | 
    
         
            +
                # Function asks for fresh xml ui data from the device and stores the result
         
     | 
| 
      
 1569 
     | 
    
         
            +
                # == returns
         
     | 
| 
      
 1570 
     | 
    
         
            +
                # MobyUtil::XML::Element:: xml document containing valid xml fragment describing the current state of the device
         
     | 
| 
      
 1571 
     | 
    
         
            +
                def refresh_ui_dump( refresh_args = {}, creation_attributes = [] )
         
     | 
| 
      
 1572 
     | 
    
         
            +
             
     | 
| 
      
 1573 
     | 
    
         
            +
                  current_time = Time.now
         
     | 
| 
      
 1574 
     | 
    
         
            +
             
     | 
| 
      
 1575 
     | 
    
         
            +
                  unless @frozen
         
     | 
| 
      
 1576 
     | 
    
         
            +
             
     | 
| 
      
 1577 
     | 
    
         
            +
                    # duplicate refresh arguments hash
         
     | 
| 
      
 1578 
     | 
    
         
            +
                    refresh_arguments = refresh_args.clone
         
     | 
| 
      
 1579 
     | 
    
         
            +
             
     | 
| 
      
 1580 
     | 
    
         
            +
                    MobyUtil::Retryable.while(
         
     | 
| 
      
 1581 
     | 
    
         
            +
             
     | 
| 
      
 1582 
     | 
    
         
            +
                      :tries => @refresh_tries, :interval => @refresh_interval, :unless => [ MobyBase::ControllerNotFoundError, MobyBase::CommandNotFoundError, MobyBase::ApplicationNotAvailableError ]
         
     | 
| 
      
 1583 
     | 
    
         
            +
             
     | 
| 
      
 1584 
     | 
    
         
            +
                    ){
         
     | 
| 
      
 1585 
     | 
    
         
            +
             
     | 
| 
      
 1586 
     | 
    
         
            +
                      # store as local variable for less AST lookups
         
     | 
| 
      
 1587 
     | 
    
         
            +
                      xml_data_checksum = @xml_data_checksum
         
     | 
| 
      
 1588 
     | 
    
         
            +
             
     | 
| 
      
 1589 
     | 
    
         
            +
                      # use find_object if set on and the method exists
         
     | 
| 
      
 1590 
     | 
    
         
            +
                      if use_find_objects
         
     | 
| 
      
 1591 
     | 
    
         
            +
             
     | 
| 
      
 1592 
     | 
    
         
            +
                        # retrieve new ui dump xml and checksum
         
     | 
| 
      
 1593 
     | 
    
         
            +
                        new_xml_data, new_checksum = find_object( refresh_arguments, creation_attributes, xml_data_checksum )
         
     | 
| 
      
 1594 
     | 
    
         
            +
             
     | 
| 
      
 1595 
     | 
    
         
            +
                        new_checksum = xml_data_checksum if new_xml_data.empty?
         
     | 
| 
      
 1596 
     | 
    
         
            +
             
     | 
| 
      
 1597 
     | 
    
         
            +
                      else
         
     | 
| 
      
 1598 
     | 
    
         
            +
             
     | 
| 
      
 1599 
     | 
    
         
            +
                        # retrieve new ui dump xml and checksum
         
     | 
| 
      
 1600 
     | 
    
         
            +
                        new_xml_data, new_checksum = execute_command(  
         
     | 
| 
      
 1601 
     | 
    
         
            +
                        
         
     | 
| 
      
 1602 
     | 
    
         
            +
                          MobyCommand::Application.new(
         
     | 
| 
      
 1603 
     | 
    
         
            +
                            :State,
         
     | 
| 
      
 1604 
     | 
    
         
            +
                            {
         
     | 
| 
      
 1605 
     | 
    
         
            +
                              :application_name => refresh_args[ :FullName ] || refresh_args[ :name ],
         
     | 
| 
      
 1606 
     | 
    
         
            +
                              :application_uid => refresh_args[ :id ],
         
     | 
| 
      
 1607 
     | 
    
         
            +
                              :sut => self,
         
     | 
| 
      
 1608 
     | 
    
         
            +
                              :refresh_arguments => refresh_args,
         
     | 
| 
      
 1609 
     | 
    
         
            +
                              :checksum => xml_data_checksum,
         
     | 
| 
      
 1610 
     | 
    
         
            +
                              :flags => {:useViewCrop=>sut_parameters[ :use_view_crop, 'false' ]}
         
     | 
| 
      
 1611 
     | 
    
         
            +
                            }
         
     | 
| 
      
 1612 
     | 
    
         
            +
                          )
         
     | 
| 
      
 1613 
     | 
    
         
            +
                        
         
     | 
| 
      
 1614 
     | 
    
         
            +
                        )
         
     | 
| 
      
 1615 
     | 
    
         
            +
             
     | 
| 
      
 1616 
     | 
    
         
            +
                        new_checksum = xml_data_checksum if new_xml_data.empty?
         
     | 
| 
      
 1617 
     | 
    
         
            +
             
     | 
| 
      
 1618 
     | 
    
         
            +
                      end
         
     | 
| 
      
 1619 
     | 
    
         
            +
             
     | 
| 
      
 1620 
     | 
    
         
            +
                      # parse the xml if checksum does not match with previously retrieved checksum
         
     | 
| 
      
 1621 
     | 
    
         
            +
                      if ( xml_data_checksum == 0 || new_checksum != xml_data_checksum || new_checksum.blank? )
         
     | 
| 
      
 1622 
     | 
    
         
            +
             
     | 
| 
      
 1623 
     | 
    
         
            +
                        # parse new xml string, return cached object if one is found; checksum is used for caching and identifying the duplicate xml strings
         
     | 
| 
      
 1624 
     | 
    
         
            +
                        xml_data, from_cache = MobyUtil::XML.parse_string( new_xml_data, new_checksum )
         
     | 
| 
      
 1625 
     | 
    
         
            +
             
     | 
| 
      
 1626 
     | 
    
         
            +
                        # store new xml data object
         
     | 
| 
      
 1627 
     | 
    
         
            +
                        @xml_data = xml_data
         
     | 
| 
      
 1628 
     | 
    
         
            +
             
     | 
| 
      
 1629 
     | 
    
         
            +
                        # store xml checksum to be compared while next ui dump request; do not reparse xml if checksum values are equal
         
     | 
| 
      
 1630 
     | 
    
         
            +
                        @xml_data_checksum = new_checksum
         
     | 
| 
      
 1631 
     | 
    
         
            +
             
     | 
| 
      
 1632 
     | 
    
         
            +
                        # mark that child objects needs to be updated 
         
     | 
| 
      
 1633 
     | 
    
         
            +
                        @update_childs = true #unless from_cache
         
     | 
| 
      
 1634 
     | 
    
         
            +
             
     | 
| 
      
 1635 
     | 
    
         
            +
                      end
         
     | 
| 
      
 1636 
     | 
    
         
            +
             
     | 
| 
      
 1637 
     | 
    
         
            +
                      # increase number of sent ui dump requests by one
         
     | 
| 
      
 1638 
     | 
    
         
            +
                      @dump_count += 1
         
     | 
| 
      
 1639 
     | 
    
         
            +
             
     | 
| 
      
 1640 
     | 
    
         
            +
                      # store timestamp of last performed ui dump request 
         
     | 
| 
      
 1641 
     | 
    
         
            +
                      @_previous_refresh = Time.now
         
     | 
| 
      
 1642 
     | 
    
         
            +
             
     | 
| 
      
 1643 
     | 
    
         
            +
                    }
         
     | 
| 
      
 1644 
     | 
    
         
            +
             
     | 
| 
      
 1645 
     | 
    
         
            +
                  end
         
     | 
| 
      
 1646 
     | 
    
         
            +
             
     | 
| 
      
 1647 
     | 
    
         
            +
                  @xml_data
         
     | 
| 
      
 1648 
     | 
    
         
            +
                  
         
     | 
| 
      
 1649 
     | 
    
         
            +
                end
         
     | 
| 
      
 1650 
     | 
    
         
            +
             
     | 
| 
      
 1651 
     | 
    
         
            +
                # TODO: document me
         
     | 
| 
      
 1652 
     | 
    
         
            +
                # Usage disable for now.
         
     | 
| 
      
 1653 
     | 
    
         
            +
                def fetch_references( xml )
         
     | 
| 
      
 1654 
     | 
    
         
            +
             
     | 
| 
      
 1655 
     | 
    
         
            +
                  pids = []
         
     | 
| 
      
 1656 
     | 
    
         
            +
             
     | 
| 
      
 1657 
     | 
    
         
            +
                  x_prev = ''
         
     | 
| 
      
 1658 
     | 
    
         
            +
                  y_prev = ''
         
     | 
| 
      
 1659 
     | 
    
         
            +
             
     | 
| 
      
 1660 
     | 
    
         
            +
                  while true
         
     | 
| 
      
 1661 
     | 
    
         
            +
             
     | 
| 
      
 1662 
     | 
    
         
            +
                    nodes = xml.xpath( '//object[@type = "TDriverRef"]' )
         
     | 
| 
      
 1663 
     | 
    
         
            +
             
     | 
| 
      
 1664 
     | 
    
         
            +
                    idx = 1
         
     | 
| 
      
 1665 
     | 
    
         
            +
             
     | 
| 
      
 1666 
     | 
    
         
            +
                    nodes.each { | element |
         
     | 
| 
      
 1667 
     | 
    
         
            +
             
     | 
| 
      
 1668 
     | 
    
         
            +
                      pid = element.at_xpath('//attribute[@name = "uri"]/value/text()').content #[ 0 ].to_s
         
     | 
| 
      
 1669 
     | 
    
         
            +
             
     | 
| 
      
 1670 
     | 
    
         
            +
                      if pid.nil? or pid.empty? or pid.to_i <= 0 # invalid reference
         
     | 
| 
      
 1671 
     | 
    
         
            +
             
     | 
| 
      
 1672 
     | 
    
         
            +
                        element.remove
         
     | 
| 
      
 1673 
     | 
    
         
            +
                        next
         
     | 
| 
      
 1674 
     | 
    
         
            +
             
     | 
| 
      
 1675 
     | 
    
         
            +
                      end
         
     | 
| 
      
 1676 
     | 
    
         
            +
             
     | 
| 
      
 1677 
     | 
    
         
            +
                      #  Element parent not supported, so query the parent coords
         
     | 
| 
      
 1678 
     | 
    
         
            +
                      x_abs = xml.xpath( '//object[@type = "TDriverRef"]/../../attributes/attribute[@name ="x_absolute"]/value/text()' )[ idx - 1 ]
         
     | 
| 
      
 1679 
     | 
    
         
            +
                      y_abs = xml.xpath( '//object[@type = "TDriverRef"]/../../attributes/attribute[@name ="y_absolute"]/value/text()' )[ idx - 1 ]
         
     | 
| 
      
 1680 
     | 
    
         
            +
             
     | 
| 
      
 1681 
     | 
    
         
            +
                      # window size
         
     | 
| 
      
 1682 
     | 
    
         
            +
                      winSize = xml.at_xpath( "//objects/object[@type = 'MainWindow']/attributes/attribute[@name ='size']/value/text()" ).content #[ 0 ].to_s
         
     | 
| 
      
 1683 
     | 
    
         
            +
             
     | 
| 
      
 1684 
     | 
    
         
            +
                      # ref-ref parent does not know x coordinate, use the grandparent xys
         
     | 
| 
      
 1685 
     | 
    
         
            +
                      x_prev = x_abs.to_s unless x_abs.nil?
         
     | 
| 
      
 1686 
     | 
    
         
            +
                      y_prev = y_abs.to_s unless y_abs.nil?
         
     | 
| 
      
 1687 
     | 
    
         
            +
             
     | 
| 
      
 1688 
     | 
    
         
            +
                      idx += 1
         
     | 
| 
      
 1689 
     | 
    
         
            +
             
     | 
| 
      
 1690 
     | 
    
         
            +
                      if !pid.empty?
         
     | 
| 
      
 1691 
     | 
    
         
            +
             
     | 
| 
      
 1692 
     | 
    
         
            +
                        begin
         
     | 
| 
      
 1693 
     | 
    
         
            +
             
     | 
| 
      
 1694 
     | 
    
         
            +
            =begin
         
     | 
| 
      
 1695 
     | 
    
         
            +
                          subdata =
         
     | 
| 
      
 1696 
     | 
    
         
            +
                            MobyUtil::XML.parse_string(
         
     | 
| 
      
 1697 
     | 
    
         
            +
                            execute_command(
         
     | 
| 
      
 1698 
     | 
    
         
            +
                              MobyCommand::Application.new(
         
     | 
| 
      
 1699 
     | 
    
         
            +
                                :State,
         
     | 
| 
      
 1700 
     | 
    
         
            +
                                nil,
         
     | 
| 
      
 1701 
     | 
    
         
            +
                                pid,
         
     | 
| 
      
 1702 
     | 
    
         
            +
                                self,
         
     | 
| 
      
 1703 
     | 
    
         
            +
                                nil,
         
     | 
| 
      
 1704 
     | 
    
         
            +
                                nil,
         
     | 
| 
      
 1705 
     | 
    
         
            +
                                nil,
         
     | 
| 
      
 1706 
     | 
    
         
            +
                                nil,
         
     | 
| 
      
 1707 
     | 
    
         
            +
                                nil,
         
     | 
| 
      
 1708 
     | 
    
         
            +
                                {
         
     | 
| 
      
 1709 
     | 
    
         
            +
                                  'x_parent_absolute' => x_prev,
         
     | 
| 
      
 1710 
     | 
    
         
            +
                                  'y_parent_absolute' => y_prev,
         
     | 
| 
      
 1711 
     | 
    
         
            +
                                  'embedded' => 'true',
         
     | 
| 
      
 1712 
     | 
    
         
            +
                                  'parent_size' => winSize
         
     | 
| 
      
 1713 
     | 
    
         
            +
                                }
         
     | 
| 
      
 1714 
     | 
    
         
            +
                              )
         
     | 
| 
      
 1715 
     | 
    
         
            +
                            )[ 0 ]
         
     | 
| 
      
 1716 
     | 
    
         
            +
                          )
         
     | 
| 
      
 1717 
     | 
    
         
            +
            =end
         
     | 
| 
      
 1718 
     | 
    
         
            +
             
     | 
| 
      
 1719 
     | 
    
         
            +
                          subdata =
         
     | 
| 
      
 1720 
     | 
    
         
            +
                            MobyUtil::XML.parse_string(
         
     | 
| 
      
 1721 
     | 
    
         
            +
                            execute_command(
         
     | 
| 
      
 1722 
     | 
    
         
            +
                              MobyCommand::Application.new(
         
     | 
| 
      
 1723 
     | 
    
         
            +
                                :State,
         
     | 
| 
      
 1724 
     | 
    
         
            +
                                {
         
     | 
| 
      
 1725 
     | 
    
         
            +
                                  :application_uid => pid,
         
     | 
| 
      
 1726 
     | 
    
         
            +
                                  :sut => self,
         
     | 
| 
      
 1727 
     | 
    
         
            +
                                  :flags => {
         
     | 
| 
      
 1728 
     | 
    
         
            +
                                    'x_parent_absolute' => x_prev,
         
     | 
| 
      
 1729 
     | 
    
         
            +
                                    'y_parent_absolute' => y_prev,
         
     | 
| 
      
 1730 
     | 
    
         
            +
                                    'embedded' => 'true',
         
     | 
| 
      
 1731 
     | 
    
         
            +
                                    'parent_size' => winSize
         
     | 
| 
      
 1732 
     | 
    
         
            +
                                  }
         
     | 
| 
      
 1733 
     | 
    
         
            +
                                }
         
     | 
| 
      
 1734 
     | 
    
         
            +
                              )
         
     | 
| 
      
 1735 
     | 
    
         
            +
                            )[ 0 ]
         
     | 
| 
      
 1736 
     | 
    
         
            +
                          )
         
     | 
| 
      
 1737 
     | 
    
         
            +
             
     | 
| 
      
 1738 
     | 
    
         
            +
                          child = subdata.root.xpath('//object')[0]
         
     | 
| 
      
 1739 
     | 
    
         
            +
             
     | 
| 
      
 1740 
     | 
    
         
            +
                          # Remove the attribute with the pid retrieval was not successful.
         
     | 
| 
      
 1741 
     | 
    
         
            +
                          # (server returns the previous hit if not found)
         
     | 
| 
      
 1742 
     | 
    
         
            +
                          if child.attribute('id' ) != pid
         
     | 
| 
      
 1743 
     | 
    
         
            +
             
     | 
| 
      
 1744 
     | 
    
         
            +
                            element.remove
         
     | 
| 
      
 1745 
     | 
    
         
            +
             
     | 
| 
      
 1746 
     | 
    
         
            +
                          else
         
     | 
| 
      
 1747 
     | 
    
         
            +
             
     | 
| 
      
 1748 
     | 
    
         
            +
                            # Remove the application layer
         
     | 
| 
      
 1749 
     | 
    
         
            +
                            objs = child.xpath( '/tasMessage/tasInfo/object/objects/*' )
         
     | 
| 
      
 1750 
     | 
    
         
            +
             
     | 
| 
      
 1751 
     | 
    
         
            +
                            if !objs.nil?
         
     | 
| 
      
 1752 
     | 
    
         
            +
             
     | 
| 
      
 1753 
     | 
    
         
            +
                              objs.each { | el | element.add_previous_sibling( el ) }
         
     | 
| 
      
 1754 
     | 
    
         
            +
             
     | 
| 
      
 1755 
     | 
    
         
            +
                              element.remove
         
     | 
| 
      
 1756 
     | 
    
         
            +
             
     | 
| 
      
 1757 
     | 
    
         
            +
                            end
         
     | 
| 
      
 1758 
     | 
    
         
            +
             
     | 
| 
      
 1759 
     | 
    
         
            +
                          end
         
     | 
| 
      
 1760 
     | 
    
         
            +
             
     | 
| 
      
 1761 
     | 
    
         
            +
                        rescue MobyBase::ApplicationNotAvailableError => e
         
     | 
| 
      
 1762 
     | 
    
         
            +
             
     | 
| 
      
 1763 
     | 
    
         
            +
                          # Ignore the application not available error
         
     | 
| 
      
 1764 
     | 
    
         
            +
                          return xml
         
     | 
| 
      
 1765 
     | 
    
         
            +
             
     | 
| 
      
 1766 
     | 
    
         
            +
                        end
         
     | 
| 
      
 1767 
     | 
    
         
            +
             
     | 
| 
      
 1768 
     | 
    
         
            +
                      else
         
     | 
| 
      
 1769 
     | 
    
         
            +
             
     | 
| 
      
 1770 
     | 
    
         
            +
                        return xml
         
     | 
| 
      
 1771 
     | 
    
         
            +
             
     | 
| 
      
 1772 
     | 
    
         
            +
                      end
         
     | 
| 
      
 1773 
     | 
    
         
            +
             
     | 
| 
      
 1774 
     | 
    
         
            +
                    }
         
     | 
| 
      
 1775 
     | 
    
         
            +
             
     | 
| 
      
 1776 
     | 
    
         
            +
                    return xml if nodes.empty?
         
     | 
| 
      
 1777 
     | 
    
         
            +
             
     | 
| 
      
 1778 
     | 
    
         
            +
                  end
         
     | 
| 
      
 1779 
     | 
    
         
            +
             
     | 
| 
      
 1780 
     | 
    
         
            +
                end
         
     | 
| 
      
 1781 
     | 
    
         
            +
             
     | 
| 
      
 1782 
     | 
    
         
            +
                def find_app( app_list, search_params )
         
     | 
| 
      
 1783 
     | 
    
         
            +
             
     | 
| 
      
 1784 
     | 
    
         
            +
                  app_info = nil
         
     | 
| 
      
 1785 
     | 
    
         
            +
             
     | 
| 
      
 1786 
     | 
    
         
            +
                  begin
         
     | 
| 
      
 1787 
     | 
    
         
            +
             
     | 
| 
      
 1788 
     | 
    
         
            +
                    app_info = app_list.application( search_params )
         
     | 
| 
      
 1789 
     | 
    
         
            +
             
     | 
| 
      
 1790 
     | 
    
         
            +
                  rescue MobyBase::TestObjectNotFoundError
         
     | 
| 
      
 1791 
     | 
    
         
            +
             
     | 
| 
      
 1792 
     | 
    
         
            +
                    app_info = nil
         
     | 
| 
      
 1793 
     | 
    
         
            +
             
     | 
| 
      
 1794 
     | 
    
         
            +
                  end
         
     | 
| 
      
 1795 
     | 
    
         
            +
             
     | 
| 
      
 1796 
     | 
    
         
            +
                  app_info
         
     | 
| 
      
 1797 
     | 
    
         
            +
                end
         
     | 
| 
      
 1798 
     | 
    
         
            +
             
     | 
| 
      
 1799 
     | 
    
         
            +
                def load_verify_blocks( filename )
         
     | 
| 
      
 1800 
     | 
    
         
            +
             
     | 
| 
      
 1801 
     | 
    
         
            +
                  # load verify blocks if filename not empty
         
     | 
| 
      
 1802 
     | 
    
         
            +
                  unless filename.blank?
         
     | 
| 
      
 1803 
     | 
    
         
            +
             
     | 
| 
      
 1804 
     | 
    
         
            +
                    # verify that file exists
         
     | 
| 
      
 1805 
     | 
    
         
            +
                    if File.exists?( filename )
         
     | 
| 
      
 1806 
     | 
    
         
            +
             
     | 
| 
      
 1807 
     | 
    
         
            +
                      # load verify blocks configuration file
         
     | 
| 
      
 1808 
     | 
    
         
            +
                      load filename
         
     | 
| 
      
 1809 
     | 
    
         
            +
             
     | 
| 
      
 1810 
     | 
    
         
            +
                      # return collection of verify blocks; reference directly to VERIFY_BLOCKS must not be used, due to it may get cleared by user
         
     | 
| 
      
 1811 
     | 
    
         
            +
                      SutParameters::VERIFY_BLOCKS.collect{ | block | block }
         
     | 
| 
      
 1812 
     | 
    
         
            +
             
     | 
| 
      
 1813 
     | 
    
         
            +
                    else
         
     | 
| 
      
 1814 
     | 
    
         
            +
                    
         
     | 
| 
      
 1815 
     | 
    
         
            +
                      # return empty array due to file didn't exist
         
     | 
| 
      
 1816 
     | 
    
         
            +
                      []
         
     | 
| 
      
 1817 
     | 
    
         
            +
                    
         
     | 
| 
      
 1818 
     | 
    
         
            +
                    end
         
     | 
| 
      
 1819 
     | 
    
         
            +
             
     | 
| 
      
 1820 
     | 
    
         
            +
                  else
         
     | 
| 
      
 1821 
     | 
    
         
            +
                  
         
     | 
| 
      
 1822 
     | 
    
         
            +
                    # return empty array due to no filename was given
         
     | 
| 
      
 1823 
     | 
    
         
            +
                    []
         
     | 
| 
      
 1824 
     | 
    
         
            +
                  
         
     | 
| 
      
 1825 
     | 
    
         
            +
                  end
         
     | 
| 
      
 1826 
     | 
    
         
            +
             
     | 
| 
      
 1827 
     | 
    
         
            +
                end
         
     | 
| 
      
 1828 
     | 
    
         
            +
             
     | 
| 
      
 1829 
     | 
    
         
            +
                # accessor for sut parameters
         
     | 
| 
      
 1830 
     | 
    
         
            +
                def sut_parameters
         
     | 
| 
      
 1831 
     | 
    
         
            +
                
         
     | 
| 
      
 1832 
     | 
    
         
            +
                  $parameters[ @id ]
         
     | 
| 
      
 1833 
     | 
    
         
            +
                
         
     | 
| 
      
 1834 
     | 
    
         
            +
                end
         
     | 
| 
      
 1835 
     | 
    
         
            +
             
     | 
| 
      
 1836 
     | 
    
         
            +
              public # deprecated
         
     | 
| 
      
 1837 
     | 
    
         
            +
             
     | 
| 
      
 1838 
     | 
    
         
            +
                # == nodoc
         
     | 
| 
      
 1839 
     | 
    
         
            +
                # function to get TestObject
         
     | 
| 
      
 1840 
     | 
    
         
            +
                # TODO: Still under construction. Should be able to create single descendant of the SUT
         
     | 
| 
      
 1841 
     | 
    
         
            +
                # Then is Should create path (parent-child-child-child...) until reaching the particular TestObject
         
     | 
| 
      
 1842 
     | 
    
         
            +
                # TODO: Document me when I'm ready
         
     | 
| 
      
 1843 
     | 
    
         
            +
                def get_object( object_id )
         
     | 
| 
      
 1844 
     | 
    
         
            +
             
     | 
| 
      
 1845 
     | 
    
         
            +
                  warn "warning: deprecated method SUT#get_object; please use SUT#child instead"
         
     | 
| 
      
 1846 
     | 
    
         
            +
             
     | 
| 
      
 1847 
     | 
    
         
            +
                  child( object_id )
         
     | 
| 
      
 1848 
     | 
    
         
            +
             
     | 
| 
      
 1849 
     | 
    
         
            +
                end
         
     | 
| 
      
 1850 
     | 
    
         
            +
             
     | 
| 
      
 1851 
     | 
    
         
            +
                # == nodoc
         
     | 
| 
      
 1852 
     | 
    
         
            +
                #TODO: Update documentation
         
     | 
| 
      
 1853 
     | 
    
         
            +
                #TODO: Is this function deprecated? (see SUT#refresh_ui_dump)
         
     | 
| 
      
 1854 
     | 
    
         
            +
                #TODO: rethink get_ui_dump and refresh --> functions!
         
     | 
| 
      
 1855 
     | 
    
         
            +
                # function to query for UIDump.
         
     | 
| 
      
 1856 
     | 
    
         
            +
                # == returns
         
     | 
| 
      
 1857 
     | 
    
         
            +
                # xmlDocument:: REXML::Document object containing valid xml fragment
         
     | 
| 
      
 1858 
     | 
    
         
            +
                # == raises
         
     | 
| 
      
 1859 
     | 
    
         
            +
                # someException:: If Dump does not conform to the tasMessage schema error is raised
         
     | 
| 
      
 1860 
     | 
    
         
            +
                def get_ui_dump( refresh_args = {} )
         
     | 
| 
      
 1861 
     | 
    
         
            +
             
     | 
| 
      
 1862 
     | 
    
         
            +
                  #$stderr.puts "warning: SUT#get_ui_dump is deprecated, please use SUT#refresh_ui_dump instead."
         
     | 
| 
      
 1863 
     | 
    
         
            +
             
     | 
| 
      
 1864 
     | 
    
         
            +
                  refresh_ui_dump( refresh_args, {} )
         
     | 
| 
      
 1865 
     | 
    
         
            +
             
     | 
| 
      
 1866 
     | 
    
         
            +
                end
         
     | 
| 
      
 1867 
     | 
    
         
            +
             
     | 
| 
      
 1868 
     | 
    
         
            +
                # This method is deprecated, please use [link="#GenericSut:state_object"]SUT#state_object[/link] instead.
         
     | 
| 
      
 1869 
     | 
    
         
            +
                # == deprecated
         
     | 
| 
      
 1870 
     | 
    
         
            +
                # 1.1.1
         
     | 
| 
      
 1871 
     | 
    
         
            +
                #
         
     | 
| 
      
 1872 
     | 
    
         
            +
                # == description
         
     | 
| 
      
 1873 
     | 
    
         
            +
                # This method is deprecated, please use SUT#state_object
         
     | 
| 
      
 1874 
     | 
    
         
            +
                #
         
     | 
| 
      
 1875 
     | 
    
         
            +
                def state
         
     | 
| 
      
 1876 
     | 
    
         
            +
             
     | 
| 
      
 1877 
     | 
    
         
            +
                  warn "warning: deprecated method SUT#state; please use SUT#state_object instead"
         
     | 
| 
      
 1878 
     | 
    
         
            +
             
     | 
| 
      
 1879 
     | 
    
         
            +
                  state_object
         
     | 
| 
      
 1880 
     | 
    
         
            +
             
     | 
| 
      
 1881 
     | 
    
         
            +
                end
         
     | 
| 
      
 1882 
     | 
    
         
            +
             
     | 
| 
      
 1883 
     | 
    
         
            +
                # enable hooking for performance measurement & debug logging
         
     | 
| 
      
 1884 
     | 
    
         
            +
                TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
         
     | 
| 
      
 1885 
     | 
    
         
            +
             
     | 
| 
      
 1886 
     | 
    
         
            +
              end # SUT
         
     | 
| 
      
 1887 
     | 
    
         
            +
             
     | 
| 
      
 1888 
     | 
    
         
            +
            end # MobyBehaviour
         
     |