Class Stella::Testplan

  1. lib/stella/testplan.rb
Parent: Storable

Included modules

  1. Gibbler::Complex
  2. Familia
  3. Common::PrivacyMethods
  4. Familia::Stamps

Classes and Modules

Module Stella::Testplan::ClassMethods

Attributes

plans [R]

Public class methods

from_hash (*args)
[show source]
# 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 ()
[show source]
# File lib/stella/testplan.rb, line 166
      def global
        @global ||= {}
        @global
      end
global? (name)
[show source]
# File lib/stella/testplan.rb, line 163
      def global?(name)
        global.has_key?(name)
      end
inherited (obj)
[show source]
# File lib/stella/testplan.rb, line 139
      def inherited obj
        super
        obj.extend ClassMethods
      end
plan (klass,v=nil)
[show 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)
[show source]
# File lib/stella/testplan.rb, line 160
      def plan?(name)
        !plan(name).nil?
      end
plans ()
[show source]
# File lib/stella/testplan.rb, line 148
      def plans
        @plans ||= {}
        @plans
      end

Public instance methods

checkup (base_uri, opts={})
[show 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 ()
[show source]
# File lib/stella/testplan.rb, line 73
    def cust
      @cust ||= Customer.from_redis @custid
      @cust || Customer.anonymous
    end
destroy! ()
[show source]
# 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? ()
[show source]
# File lib/stella/testplan.rb, line 52
    def favicon?() !@favicon.nil? && !@favicon.empty? end
first_request ()
[show source]
# File lib/stella/testplan.rb, line 57
    def first_request
      return if @usecases.empty?
      @usecases.first.requests.first
    end
freeze ()
[show source]
# 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 ()
[show 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 ()
[show 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 ()
[show source]
# File lib/stella/testplan.rb, line 47
    def id 
      @id ||= gibbler
      @id
    end
init (uri=nil)
[show 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 ()
[show source]
# File lib/stella/testplan.rb, line 77
    def monitor
      MonitorInfo.from_redis @id
    end
monitored? ()
[show source]
# File lib/stella/testplan.rb, line 80
    def monitored?
      mon = monitor
      mon && mon.enabled
    end
owner? (guess)
[show source]
# File lib/stella/testplan.rb, line 98
    def owner?(guess)
      custid != nil && cust.custid?(guess)
    end
planid ()

Alias for id

postprocess ()
[show source]
# File lib/stella/testplan.rb, line 68
    def postprocess
      @id &&= Gibbler::Digest.new(@id)
      @notify ||= false 
      @notify &&= false if @notify == 'false'
    end
preprocess ()
[show source]
# File lib/stella/testplan.rb, line 53
    def preprocess
      @usecases ||= []
      @privacy = false if @privacy.nil?
    end
run (engine, opts={})
[show source]
# File lib/stella/testplan.rb, line 105
    def run engine, opts={}
      testrun = Stella::Testrun.new self, engine.mode, opts
      engine.run testrun
    end