TESTER_VERSION | = | Version.new(0, 1, '$Rev: 557 $'.gsub!(/\D/, '').to_i) |
config | [R] |
# 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
Abort a running test. The identifier of a running test is the hash key of the test: test.hash.
# 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.
# 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.
# 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.
# 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.
# 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.
# 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
Do some tasks after a test of the composite has been run.
# 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.
# 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.
# File lib/ttk/testers/Tester.rb, line 112 def prologue_test ( test, log ) test.symtbl[:tester] = self @tasks[test.hash] = test end