Class: Pact::V2::Provider::PactConfig::Mixed

Inherits:
Base
  • Object
show all
Defined in:
lib/pact/v2/provider/pact_config/mixed.rb

Overview

Mixed config allows composing one of each: async, grpc, http

Instance Attribute Summary collapse

Attributes inherited from Base

#broker_password, #broker_token, #broker_url, #broker_username, #consumer_branch, #consumer_name, #consumer_version, #consumer_version_selectors, #consumer_version_tags, #enable_pending, #fail_if_no_pacts_found, #include_wip_pacts_since, #log_level, #logger, #pact_dir, #pact_proxy_port, #pact_uri, #provider_build_uri, #provider_name, #provider_setup_port, #provider_setup_server, #provider_version, #provider_version_branch, #provider_version_tags, #publish_verification_results, #verify_only

Instance Method Summary collapse

Methods inherited from Base

#after_teardown, #before_setup, #message_setup_url, #new_provider_state, #new_verifier, #pact_broker_proxy_url, #provider_setup_url, #stop_servers

Constructor Details

#initialize(provider_name:, opts: {}) ⇒ Mixed

Returns a new instance of Mixed.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/pact/v2/provider/pact_config/mixed.rb', line 11

def initialize(provider_name:, opts: {})
  super
  @provider_setup_server = ProviderServerRunner.new(port: @provider_setup_port, logger: @logger)
  if @broker_url.present?
    @pact_proxy_server = PactBrokerProxyRunner.new(
      port: @pact_proxy_port,
      pact_broker_host: @broker_url,
      pact_broker_user: @broker_username,
      pact_broker_password: @broker_password,
      pact_broker_token: @broker_token,
      logger: @logger
    )
  end
  @http_config = opts[:http] ? Http.new(provider_name: provider_name, opts: opts[:http].merge(provider_setup_server: provider_setup_server, pact_proxy_server: @pact_proxy_server)) : nil
  @grpc_config = opts[:grpc] ? Grpc.new(provider_name: provider_name, opts: opts[:grpc].merge(provider_setup_server: provider_setup_server, pact_proxy_server: @pact_proxy_server)) : nil
  @async_config = opts[:async] ? Async.new(provider_name: provider_name, opts: opts[:async].merge(provider_setup_server: provider_setup_server, pact_proxy_server: @pact_proxy_server)) : nil
end

Instance Attribute Details

#async_configObject (readonly)

Returns the value of attribute async_config.



9
10
11
# File 'lib/pact/v2/provider/pact_config/mixed.rb', line 9

def async_config
  @async_config
end

#grpc_configObject (readonly)

Returns the value of attribute grpc_config.



9
10
11
# File 'lib/pact/v2/provider/pact_config/mixed.rb', line 9

def grpc_config
  @grpc_config
end

#http_configObject (readonly)

Returns the value of attribute http_config.



9
10
11
# File 'lib/pact/v2/provider/pact_config/mixed.rb', line 9

def http_config
  @http_config
end

Instance Method Details

#configsObject



29
30
31
# File 'lib/pact/v2/provider/pact_config/mixed.rb', line 29

def configs
  [@async_config, @grpc_config, @http_config].compact
end

#start_serversObject



33
34
# File 'lib/pact/v2/provider/pact_config/mixed.rb', line 33

def start_servers
end