Class TTK::Testers::Tester
In: lib/ttk/testers/tester/notifier.rb
lib/ttk/testers/tester/query_node.rb
lib/ttk/testers/tester/config.rb
lib/ttk/testers/tester/remote_status.rb
lib/ttk/testers/tester/score.rb
lib/ttk/testers/tester/running_task.rb
lib/ttk/testers/Tester.rb
Parent: Object

Methods

Included Modules

Abstract DRb::DRbUndumped

Classes and Modules

Module TTK::Testers::Tester::Notification
Class TTK::Testers::Tester::Config
Class TTK::Testers::Tester::Notifier
Class TTK::Testers::Tester::QueryNode
Class TTK::Testers::Tester::RemoteStatus
Class TTK::Testers::Tester::RunningTask
Class TTK::Testers::Tester::Score

Constants

TESTER_VERSION = Version.new(0, 1, '$Rev: 557 $'.gsub!(/\D/, '').to_i)

Attributes

config  [R] 

Public Class methods

[Source]

# File lib/ttk/testers/Tester.rb, line 31
      def initialize(service, name)
        @service = service
        initialize_config(name)
        @notifier = Notifier.new
        @notifier.add_observer(@service)
        @tasks = RunningTask.new
      end

Public Instance methods

Abort a running test. The identifier of a running test is the hash key of the test: test.hash.

[Source]

# File lib/ttk/testers/Tester.rb, line 91
      def abort(test_id)
        Thread.new do
          @tasks.abort(test_id)
        end
      end

Dynamically select a tester.

[Source]

# File lib/ttk/testers/Tester.rb, line 84
      def dynamic_select(&block)
        score = block[@service.uri, { :nb_jobs => @tasks.size } ]
        Score.new(score, (score <= 0) ? nil : self)
      end

Run the query on this tester.

[Source]

# File lib/ttk/testers/Tester.rb, line 55
      def query_tester(query_node)
        query_node.run(self)
        nil
      end

List all requests available on this tester.

[Source]

# File lib/ttk/testers/Tester.rb, line 76
      def requests
        o = Tester.superclass.new
        public_methods.select do |meth|
          not (o.respond_to?(meth) or meth.to_s =~ /^_/)
        end
      end

Load a strategy using the loader in the symtbl and run it.

[Source]

# File lib/ttk/testers/Tester.rb, line 61
      def run_strategy(test, symtbl)
        @notifier.changed
        @notifier.notify_observers(Notification::START_STRATEGY, test)
        saver = Filters::Saver.new
        log = symtbl[:log_factory].create(saver)
        test.symtbl = symtbl[:symtbl_class].new(symtbl)
        prologue_test(test, log)
        status = run_impl_test(test, log)
        epilogue_test(test, log)
        @notifier.changed
        @notifier.notify_observers(Notification::STOP_STRATEGY, test, status)
        RemoteStatus.new(status, saver)
      end

Return a query node if the block return true.

[Source]

# File lib/ttk/testers/Tester.rb, line 46
      def select_tester(&block)
        if block[@service.uri, @config]
          QueryNode.new(@service.uri,
                        @config[:tester_name],
                        @config[:tester_type])
        end
      end

[Source]

# File lib/ttk/testers/Tester.rb, line 41
      def uri
        @service.uri
      end

Protected Instance methods

Do some tasks after a test of the composite has been run.

[Source]

# File lib/ttk/testers/Tester.rb, line 125
      def epilogue_test ( test, log )
        @tasks.delete(test.hash)
      end

Initialize the tester configuration based on rbconfig.

[Source]

# File lib/ttk/testers/Tester.rb, line 99
      def initialize_config(name)
        extra_config = {
          :tester_name => name,
          :tester_type => self.class.to_s.sub!(/^.*:/, ''),
          :tester_hostname => Socket.gethostname,
          :tester_version => TESTER_VERSION
        }
        @config = Config.new(extra_config)
      end

Do some tasks before a test of the composite is run.

[Source]

# File lib/ttk/testers/Tester.rb, line 112
      def prologue_test ( test, log )
        test.symtbl[:tester] = self
        @tasks[test.hash] = test
      end

Do some tasks at the moment where a test of the composite is run.

[Source]

# File lib/ttk/testers/Tester.rb, line 119
      def run_impl_test ( test, log )
        test.run(log)
      end

[Validate]