Class: ConfigurationService::Test::OrchestrationProviderRegistry

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/configuration_service/test/orchestration_provider_registry.rb

Overview

Singleton registry of test orchestration providers

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.instanceConfigurationService::Test::OrchestrationProviderRegistry

The singleton registry instance



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/configuration_service/test/orchestration_provider_registry.rb', line 18

class OrchestrationProviderRegistry
  include Singleton

  ##
  # Register a test orchestration provider
  #
  # @param [String] identifier
  #   unique identifier for the test orchestration provider
  # @param [Class] provider
  #   the test orchestration provider class (which should have a default/nullary constructor)
  #
  def register(identifier, provider)
    @providers[identifier] = provider
  end

  ##
  # Look up a test orchestration provider
  #
  # @param [String] identifier
  #   the unique identifier for the test orchestration provider.
  #   The provider must already have been registered with {#register}.
  #
  # @return [Class] the test orchestration provider class
  # @return [nil] if no provider has been registered with the given +identifier+
  #
  def lookup(identifier)
    @providers[identifier]
  end

  # @private
  def initialize
    @providers = {}
  end

end

Instance Method Details

#lookup(identifier) ⇒ Class?

Look up a test orchestration provider

Parameters:

  • identifier (String)

    the unique identifier for the test orchestration provider. The provider must already have been registered with #register.

Returns:

  • (Class)

    the test orchestration provider class

  • (nil)

    if no provider has been registered with the given identifier



43
44
45
# File 'lib/configuration_service/test/orchestration_provider_registry.rb', line 43

def lookup(identifier)
  @providers[identifier]
end

#register(identifier, provider) ⇒ Object

Register a test orchestration provider

Parameters:

  • identifier (String)

    unique identifier for the test orchestration provider

  • provider (Class)

    the test orchestration provider class (which should have a default/nullary constructor)



29
30
31
# File 'lib/configuration_service/test/orchestration_provider_registry.rb', line 29

def register(identifier, provider)
  @providers[identifier] = provider
end