Class: MockServer::LoadFeeder
- Inherits:
-
Object
- Object
- MockServer::LoadFeeder
- Defined in:
- lib/mockserver/models.rb
Overview
Parameterized test data (a data feeder) for a load scenario: an inline dataset
from which one row is selected per iteration and exposed to the templated
request. Supply EITHER rows (inline list of column-name to value maps, the
primary form) OR data + format (raw CSV/JSON parsed server-side).
strategy (+CIRCULAR+, RANDOM or SEQUENTIAL) chooses how a row is picked.
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#format ⇒ Object
Returns the value of attribute format.
-
#rows ⇒ Object
Returns the value of attribute rows.
-
#strategy ⇒ Object
Returns the value of attribute strategy.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(rows: nil, data: nil, format: nil, strategy: nil) ⇒ LoadFeeder
constructor
A new instance of LoadFeeder.
- #to_h ⇒ Object
Constructor Details
#initialize(rows: nil, data: nil, format: nil, strategy: nil) ⇒ LoadFeeder
Returns a new instance of LoadFeeder.
3091 3092 3093 3094 3095 3096 |
# File 'lib/mockserver/models.rb', line 3091 def initialize(rows: nil, data: nil, format: nil, strategy: nil) @rows = rows @data = data @format = format @strategy = strategy end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
3089 3090 3091 |
# File 'lib/mockserver/models.rb', line 3089 def data @data end |
#format ⇒ Object
Returns the value of attribute format.
3089 3090 3091 |
# File 'lib/mockserver/models.rb', line 3089 def format @format end |
#rows ⇒ Object
Returns the value of attribute rows.
3089 3090 3091 |
# File 'lib/mockserver/models.rb', line 3089 def rows @rows end |
#strategy ⇒ Object
Returns the value of attribute strategy.
3089 3090 3091 |
# File 'lib/mockserver/models.rb', line 3089 def strategy @strategy end |
Class Method Details
.from_hash(data) ⇒ Object
3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 |
# File 'lib/mockserver/models.rb', line 3107 def self.from_hash(data) return nil if data.nil? new( rows: data['rows'], data: data['data'], format: data['format'], strategy: data['strategy'] ) end |
Instance Method Details
#to_h ⇒ Object
3098 3099 3100 3101 3102 3103 3104 3105 |
# File 'lib/mockserver/models.rb', line 3098 def to_h MockServer.strip_none({ 'rows' => @rows, 'data' => @data, 'format' => @format, 'strategy' => @strategy }) end |