Class: QaServer::AuthorityScenario

Inherits:
Object
  • Object
show all
Defined in:
app/models/qa_server/authority_scenario.rb

Direct Known Subclasses

SearchScenario, TermScenario

Constant Summary collapse

DEFAULT_SUBAUTH =
nil
MIN_EXPECTED_SIZE =
200

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(authority:, authority_name:, authority_scenario_config:, scenario_config: nil) ⇒ AuthorityScenario

Returns a new instance of AuthorityScenario.

Parameters:

  • authority (Qa::Authorities::LinkedData::GenericAuthority)

    the instance of the QA authority

  • authority_name (Symbol)

    the name of the authority the scenario tests (e.g. :AGROVOC_DIRECT)

  • authority_scenario_config (Hash)

    configurations from the yml file that pertain to all scenarios regardless of type

  • scenario_config (Hash) (defaults to: nil)

    configuration from the yml file that are specific to a type of scenario



27
28
29
30
31
32
33
34
# File 'app/models/qa_server/authority_scenario.rb', line 27

def initialize(authority:, authority_name:, authority_scenario_config:, scenario_config: nil)
  @authority = authority
  @authority_name = authority_name
  @service = authority_scenario_config['service']
  @context = scenario_config.key?("position") ? false : authority_scenario_config.fetch('context', false)
  @subauthority_name = DEFAULT_SUBAUTH
  @min_result_size = MIN_EXPECTED_SIZE
end

Instance Attribute Details

#authorityQa::Authorities::LinkedData::GenericAuthority (readonly)

Returns authority instance the scenarios run against.

Returns:

  • (Qa::Authorities::LinkedData::GenericAuthority)

    authority instance the scenarios run against



6
7
8
# File 'app/models/qa_server/authority_scenario.rb', line 6

def authority
  @authority
end

#authority_nameSymbol (readonly)

Returns name of the authority the scenarios run against (e.g. :AGROVOC_DIRECT).

Returns:

  • (Symbol)

    name of the authority the scenarios run against (e.g. :AGROVOC_DIRECT)



9
10
11
# File 'app/models/qa_server/authority_scenario.rb', line 9

def authority_name
  @authority_name
end

#min_result_sizeInteger (readonly)

Returns the minimum size of data that must be returned for the scenario to be considered passing.

Returns:

  • (Integer)

    the minimum size of data that must be returned for the scenario to be considered passing



18
19
20
# File 'app/models/qa_server/authority_scenario.rb', line 18

def min_result_size
  @min_result_size
end

#serviceString (readonly)

Returns identifies the primary service provider (e.g. ‘ld4l_cache’, ‘direct’, etc.).

Returns:

  • (String)

    identifies the primary service provider (e.g. ‘ld4l_cache’, ‘direct’, etc.)



12
13
14
# File 'app/models/qa_server/authority_scenario.rb', line 12

def service
  @service
end

#subauthority_nameString (readonly)

Returns name of the subauthority the scenario runs against (e.g. ‘person’).

Returns:

  • (String)

    name of the subauthority the scenario runs against (e.g. ‘person’)



15
16
17
# File 'app/models/qa_server/authority_scenario.rb', line 15

def subauthority_name
  @subauthority_name
end

Instance Method Details

#context?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'app/models/qa_server/authority_scenario.rb', line 36

def context?
  @context
end