class Stella::Testplan
Attributes
plans[R]
Public Class Methods
from_hash(*args)
click to toggle source
Calls superclass method
# File lib/stella/testplan.rb, line 143 def from_hash(*args) me = super(*args) me.usecases.collect! { |uc| Stella::Usecase.from_hash(uc) } me end
global()
click to toggle source
# File lib/stella/testplan.rb, line 166 def global @global ||= {} @global end
global?(name)
click to toggle source
# File lib/stella/testplan.rb, line 163 def global?(name) global.has_key?(name) end
inherited(obj)
click to toggle source
Calls superclass method
# File lib/stella/testplan.rb, line 139 def inherited obj super obj.extend ClassMethods end
plan(klass,v=nil)
click to toggle source
# File lib/stella/testplan.rb, line 152 def plan(klass,v=nil) # Store the class as a string. Ruby calls Object#hash before setting # the hash key which conflicts with Familia::Object.hash. plans[klass.to_s] = v unless v.nil? plans[klass.to_s] rescue NameError => ex nil end
plan?(name)
click to toggle source
# File lib/stella/testplan.rb, line 160 def plan?(name) !plan(name).nil? end
Public Instance Methods
checkup(base_uri, opts={})
click to toggle source
# File lib/stella/testplan.rb, line 101 def checkup base_uri, opts={} opts[:base_uri] = base_uri run Stella::Engine::Checkup, opts end
cust()
click to toggle source
# File lib/stella/testplan.rb, line 73 def cust @cust ||= Customer.from_redis @custid @cust || Customer.anonymous end
destroy!()
click to toggle source
Calls superclass method
# File lib/stella/testplan.rb, line 92 def destroy! raise BS::Problem, "Monitor exists #{index}" if MonitorInfo.exists?(index) host.testplans.rem self unless host.nil? cust.testplans.rem self unless cust.nil? super end
favicon?()
click to toggle source
# File lib/stella/testplan.rb, line 52 def favicon?() !@favicon.nil? && !@favicon.empty? end
first_request()
click to toggle source
# File lib/stella/testplan.rb, line 57 def first_request return if @usecases.empty? @usecases.first.requests.first end
freeze()
click to toggle source
Calls superclass method
# File lib/stella/testplan.rb, line 61 def freeze return if frozen? @usecases.each { |uc| uc.freeze } @id &&= Gibbler::Digest.new(@id || self.digest) super self end
host()
click to toggle source
# File lib/stella/testplan.rb, line 84 def host h = @host.nil? || frozen? ? HostInfo.load_or_create(hostid) : @host frozen? ? h : (@host=h) end
hostid()
click to toggle source
# File lib/stella/testplan.rb, line 88 def hostid h = (@hostid.nil? || frozen?) && first_request ? Stella.canonical_host(first_request.uri) : @hostid frozen? ? h : (@hostid=h) end
id()
click to toggle source
# File lib/stella/testplan.rb, line 47 def id @id ||= gibbler @id end
Also aliased as: planid
init(uri=nil)
click to toggle source
# File lib/stella/testplan.rb, line 40 def init(uri=nil) preprocess if uri req = Stella::RequestTemplate.new :get, Stella.canonical_uri(uri) @usecases << Stella::Usecase.new(req) end end
monitor()
click to toggle source
# File lib/stella/testplan.rb, line 77 def monitor MonitorInfo.from_redis @id end
monitored?()
click to toggle source
# File lib/stella/testplan.rb, line 80 def monitored? mon = monitor mon && mon.enabled end
owner?(guess)
click to toggle source
# File lib/stella/testplan.rb, line 98 def owner?(guess) custid != nil && cust.custid?(guess) end
postprocess()
click to toggle source
# File lib/stella/testplan.rb, line 68 def postprocess @id &&= Gibbler::Digest.new(@id) @notify ||= false @notify &&= false if @notify == 'false' end
preprocess()
click to toggle source
# File lib/stella/testplan.rb, line 53 def preprocess @usecases ||= [] @privacy = false if @privacy.nil? end
run(engine, opts={})
click to toggle source
# File lib/stella/testplan.rb, line 105 def run engine, opts={} testrun = Stella::Testrun.new self, engine.mode, opts engine.run testrun end