Class: TDriver::AgentService

Inherits:
Object
  • Object
show all
Defined in:
lib/tdriver/util/agent/service.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ AgentService

TODO: document me



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/tdriver/util/agent/service.rb', line 35

def initialize( options = {} )

  # verify that options is type of hash
  options.check_type Hash, 'wrong argument type $1 for AgentCommandService options (expected $2)'

  # verify that sut is defined in options hash
  options.require_key :sut

  sut = options[ :sut ]

  TDriver::BehaviourFactory.apply_behaviour( 
    :object       => self,
    :object_type  => [ 'AgentCommandService'                  ],
    :env          => [ '*', *sut.environment.to_s.split(";")  ],
    :input_type   => [ '*', *sut.input.to_s.split(";")        ],
    :version      => [ '*', *sut.ui_version.to_s.split(";")   ]
  )

  # store given options
  @options = options

  # store sut variable
  @sut = sut
  
  # store caller backtrace
  @caller = caller

end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(id, *args) ⇒ Object (private)

TODO: document me

Raises:

  • (RuntimeError)


98
99
100
101
102
103
# File 'lib/tdriver/util/agent/service.rb', line 98

def method_missing( id, *args )

  # raise exception if unknown command or not supported by sut 
  raise RuntimeError, "agent command #{ id.inspect } not supported by #{ @options[ :sut ].id }", caller

end

Instance Method Details

#commandsObject

TODO: document me



65
66
67
68
69
70
71
72
73
74
# File 'lib/tdriver/util/agent/service.rb', line 65

def commands
  
  class << self

    # retrieve all public methods
    instance_methods( false ).select{ | name | true unless name =~ /^__|^commands$/ }      

  end

end