Class: ProviderTesting::Helper

Inherits:
Object
  • Object
show all
Defined in:
lib/provider-testing/helper.rb

Overview

some helper functions

Class Method Summary collapse

Class Method Details

.cimomObject

the selected CIMOM, defaults to :sfcb



31
32
33
# File 'lib/provider-testing/helper.rb', line 31

def self.cimom
  @@cimom rescue (self.cimom = :sfcb; @@cimom)
end

.cimom=(name) ⇒ Object

select the CIMOM to be run input: name symbol of CIMOM to run (:sfcb: or :pegasus:)



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/provider-testing/helper.rb', line 17

def self.cimom= name
  @@cimom ||= case name
  when :sfcb
    require_relative "./sfcb"
    Sfcb.new :tmpdir => TMPDIR, :provider => PROVIDERDIR
  when :pegasus
    require_relative "./pegasus"
    Pegasus.new :tmpdir => TMPDIR, :provider => PROVIDERDIR
  else
    raise "Unknown CIMOM #{@cimom}"
  end
end

.setup(klass = "", namespace = "root/cimv2") ⇒ Object

creates a connection the the CIMOM return [client, op] pair of client connection and object path



39
40
41
42
43
44
# File 'lib/provider-testing/helper.rb', line 39

def self.setup klass = "", namespace = "root/cimv2"
  client = Sfcc::Cim::Client.connect(:uri => self.cimom.uri, :verify => false)
  raise "Connection error" unless client
  op = Sfcc::Cim::ObjectPath.new(namespace, klass, client)
  return client, op
end

.teardownObject

should stop the CIMOM (currently doesn’t :-( )



47
48
49
# File 'lib/provider-testing/helper.rb', line 47

def self.teardown
  self.cimom.stop
end