Documentation ¶
Index ¶
- Variables
- type AMQPPublishing
- type Actions
- type ConfigReader
- type Control
- type Cookies
- type FileDefinition
- type HttpHeaders
- type JSONReader
- type Match
- type Mock
- type NonJSONItem
- type Notify
- type Persist
- type PrioritySort
- type Reader
- type Request
- type Requests
- type Response
- type Result
- type Values
- type YAMLReader
Constants ¶
This section is empty.
Variables ¶
var ErrNotFoundPath = errors.New("Configuration path not found")
ErrNotFoundPath error from missing or configuration path
Functions ¶
This section is empty.
Types ¶
type AMQPPublishing ¶
type AMQPPublishing struct { URL string `json:"url"` // url to the amqp server e.g. amqp://guest:guest@localhost:5672/vhost RoutingKey string `json:"routingKey"` // the routing key for posting the message Delay int `json:"delay"` // message send delay in seconds Exchange string `json:"exchange"` // the name of the exchange to post to Body string `json:"body"` // payload of the message // Properties ContentType string `json:"contentType"` // MIME content type ContentEncoding string `json:"contentEncoding"` // MIME content encoding Priority uint8 `json:"priority"` // 0 to 9 CorrelationID string `json:"correlationId"` // correlation identifier ReplyTo string `json:"replyTo"` // address to to reply to (ex: RPC) Expiration string `json:"expiration"` // message expiration spec MessageID string `json:"messageId"` // message identifier Timestamp time.Time `json:"timestamp"` // message timestamp Type string `json:"type"` // message type name UserID string `json:"userId"` // creating user id - ex: "guest" AppID string `json:"appId"` // creating application id }
AMQPPublishing used for sending to AMQP server
type ConfigReader ¶
ConfigReader interface allows recognize if there is available some config reader for an a specific file.
type FileDefinition ¶
type FileDefinition struct { Path string Updates chan []Mock ConfigReaders []ConfigReader }
FileDefinition this struct contains the path of definition and some config readers
func NewFileDefinition ¶
func NewFileDefinition(path string, updatesCh chan []Mock) *FileDefinition
NewFileDefinition file definition constructor
func (*FileDefinition) AddConfigReader ¶
func (fd *FileDefinition) AddConfigReader(reader ConfigReader)
AddConfigReader allows append new readers to able load different config files
func (*FileDefinition) ReadMocksDefinition ¶
func (fd *FileDefinition) ReadMocksDefinition() []Mock
ReadMocksDefinition reads all definitions and return an array of valid mocks
func (*FileDefinition) WatchDir ¶
func (fd *FileDefinition) WatchDir()
WatchDir start the watching process to detect any change on defintions
type HttpHeaders ¶ added in v1.0.0
type JSONReader ¶
type JSONReader struct { }
JSONReader struct created to read json config files
func (JSONReader) CanRead ¶
func (jp JSONReader) CanRead(filename string) bool
CanRead return true if is a json file
type Match ¶
type Match struct { Request Request `json:"request"` Response Response `json:"response"` Result Result `json:"result"` Persist Persist `json:"persist"` }
Match contains the whole information about the request match. The http request, the final response received and the matching result.
type Mock ¶
type Mock struct { Name string Description string `json:"description"` Request Request `json:"request"` Response Response `json:"response"` Persist Persist `json:"persist"` Notify Notify `json:"notify"` Control Control `json:"control"` }
Mock contains the user mock definition
type NonJSONItem ¶
type NonJSONItem struct {
Content string `json:"non_json_content"`
}
NonJSONItem used for storing non JSON content in mongo, by saving it in a the NonJSONContent of a wrapper json content
type Notify ¶ added in v1.0.0
type Notify struct { Amqp AMQPPublishing `json:"amqp"` Http Requests `json:"http"` }
type PrioritySort ¶
type PrioritySort []Mock
PrioritySort mock array sorted by priority
func (PrioritySort) Len ¶
func (s PrioritySort) Len() int
func (PrioritySort) Less ¶
func (s PrioritySort) Less(i, j int) bool
func (PrioritySort) Swap ¶
func (s PrioritySort) Swap(i, j int)
type Reader ¶
type Reader interface { //ReadMockDefinition return an array of mock definitions sort by priority. ReadMocksDefinition() []Mock }
Reader interface contains the funtions to obtain the mock defintions.
type Request ¶
type Request struct { Method string `json:"method"` Path string `json:"path"` QueryStringParameters Values `json:"queryStringParameters"` HttpHeaders Body string `json:"body"` }
type Response ¶
type Response struct { StatusCode int `json:"statusCode"` HttpHeaders Body string `json:"body"` }
type Result ¶
Result contains the match result and the failing matches with different mocks and the reason or the fail.
type YAMLReader ¶
type YAMLReader struct { }
YAMLReader struct created to read yaml config files
func (YAMLReader) CanRead ¶
func (jp YAMLReader) CanRead(filename string) bool
CanRead return true if is a yaml file