# Author:: Nicolas Pouillard . # Copyright:: Copyright (c) 2005 TTK Team. All rights reserved. # License:: LGPL # Revision:: $Id: /w/fey/uttk/trunk/lib/uttk/strategies/Jump.rb 53986 2007-01-14T15:03:21.549822Z ertai $ module Uttk module Strategies # Jump to a specific url and run a strategy. class Jump < Strategy include Concrete # # Methods # def run_impl super @status = @to.jump_and_eval mk_input do |output| @log.new_node 'Remote execution' do YAML.load_from_io(output.open) do |notif| @log.send(*notif) end end # @log.up end if @status.is_a? Status raise @status else raise_error "Bad status: `#{@status.inspect}'" end end protected :run_impl def mk_input dumpable_symtbl = SymTbl.new dumpable_symtbl.merge!(@symtbl) dumpable_symtbl.local.delete :log dumpable_symtbl[:master_pwd] = @symtbl[:pwd] marshaled_input = Marshal.dump([@test, dumpable_symtbl]).dump input = " # require 'rubygems' # require_gem 'uttk' # require 'uttk' uttk_dir = '#{Uttk.dir.expand_path}' require \"\#{uttk_dir}\" # FIXME Move the getopts in lib and make it lazy loaded require \"\#{uttk_dir.to_path.parent.parent/'bin'/'getopts'/'uttk'}\" test, root_symtbl = Marshal.load #{marshaled_input} opts = Uttk::Getopts::Uttk.parse(['-F', 'Notif']) root_symtbl.merge! opts symtbl = Uttk.default_symtbl(root_symtbl).new_child test.uttk_testify(symtbl).run " end protected :mk_input def to= ( anObject ) @to = anObject @url = anObject.to_url end # # Attributes # attribute :to, 'the destination url', [String, URI::Generic], :mandatory attribute :test, 'the test to run on the destination url', :mandatory, :invisible, :dont_expand end # class Jump end # module Strategies end # module Uttk