Documentation
¶
Index ¶
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
BodyAppend string `json:"bodyAppend"` // text or JSON to be appended to the body
// 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 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
Request Request `json:"request"`
Response Response `json:"response"`
Persist Persist `json:"persist"`
Control struct {
Priority int `json:"priority"`
Delay int `json:"delay"`
Crazy bool `json:"crazy"`
ProxyBaseURL string `json:"proxyBaseURL"`
} `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 Persist ¶
type Persist struct {
Name string `json:"name"`
Delete bool `json:"delete"`
AMQP AMQPPublishing `json:"amqp"`
}
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 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