regurgitator is a lightweight, modular, extendable java framework that you configure to ‘regurgitate’ canned or clever responses to incoming requests; useful for quickly mocking or prototyping services without writing any code. simply configure, deploy and run.
start your reading here: regurgitator-all
upon invocation, regurgitator models each incoming request as a message
, passed to regurgitator for processing. this message holds all data accessible by the steps configured to run, and is passed to each step as it is executed. depending on its type, a step might read from, add to, or aggregate together data from within the message. when the processing required is complete (and if configured to do so) a step will return a response (or responses) to the incoming request, effectively ending the invocation - job done.
accept request (as message) => execute steps (build responses using message data) => send back response(s)
a message may be pre-populated with input data before regurgitator is invoked, such as metadata about an http call. each data item is stored in the message as a parameter
, stored under a context
, which groups a set of related parameters together. the default context is simply parameters
. some more specific contexts (for http) include request-headers
, response-payload
and global-metadata
. the message also provides the response callback mechanism through which responses are sent back out of regurgitator. see code example here.
a message can also be auto-populated with data that persists between requests, through the use of global data
and sessions
.
regurgitator-core provides the following basic steps:
sequence
(xml, json, yml) a collection of steps, run one after anotherdecision
(xml, json, yml) a collection of steps where rules
and conditions
dictate which steps to runcreate-parameter
(xml, json, yml) store a data item as a parameter within the message, with a name and a typebuild-parameter
(xml, json, yml) build a parameter using a value builder
, aggregating many parameter valuesgenerate-parameter
(xml, json, yml) create a parameter value from scratch, using a value generator
create-response
(xml, json, yml) return a response from regurgitator; either a static value or from a parameteridentify-session
(xml, json, yml) use the value of a parameter to identify / look up a session object, to hold data between requestsrecord-message
(xml, json, yml) output the contents of a message
, at any point during processing, to a file or standard outputmore steps are available in other modules (ext, web, mq)
regurgitator uses the following set of constructs / concepts to provide it’s processing:
parameter type
each parameter has a type, which dictates how it is represented, as well as how it can be merged with another parameter. provided types include STRING
NUMBER
and DECIMAL
along with list and set typesvalue builder
aggregates many parameter values into one. provided builders include support for popular templating enginesvalue generator
create a value from scratch, such as a random number or UUIDvalue processor
all steps that involve parameters can have extra processing wired in, to alter their initial value after it has been created, built or generatedrules behaviour
while rules determine how decision
steps choose which child step to execute, rules behaviour
govern what to do if more than one rule passescondition behaviour
all conditions for a rule must be met for it to pass. each condition evaluates a parameter; its behaviour governs the kind of evaluation performedjust as custom steps can be added to extend regurgitator to meet your needs, you can also provide your own construct implementations to further extend the capabilities of the framework.
regurgitator-core provides the following basic constructs:
STRING
based on the java.lang.String
java typeNUMBER
based on the java.lang.Long
java typeDECIMAL
based on the java.lang.Double
java typeall of the above have list and set types, holding collections of the java type, e.g. LIST_OF_STRING
, SET_OF_DECIMAL
number-generator
(xml, json, yml) generates a random number parameter valueuuid-generator
(xml, json, yml) generates a unique UUID parameter valueextract-processor
(xml, json, yml) extract one value from another, using java’s java.text.MessageFormat syntaxsubstitute-processor
(xml, json, yml) processes a string value, replacing instances of one string with anotherat-index-processor
(xml, json, yml) processes a collection, returning the data item at a given indexindex-of-processor
(xml, json, yml) processes a collection, returning the index of a given data valuesize-processor
(xml, json, yml) processes a collection, returning its sizeall-matches
first-match
first-match-onwards
rules behaviours are explained alongside decision steps here: xml, json, yml
equals
equals-param
exists
contains
contains-param
matches
condition behaviours are explained alongside decision steps here: xml, json, yml
more constructs are available in other modules (ext, web)