Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrFilePathIsNotUnderConfigPath = errors.New("File path is not under config path")
var ErrInvalidMockDefinition = errors.New("Invalid mock definition")
ErrInvalidMockDefinition the file contains an invalid mock definition
var ErrMockDoesntExist = errors.New("Mock doesn't exist")
var ErrNotValidParserFound = errors.New("Not valid config reader found")
ErrNotValidParserFound we don't have any config reader valid for this file
Functions ¶
This section is empty.
Types ¶
type ConfigMapper ¶
type ConfigMapper struct {
// contains filtered or unexported fields
}
ConfigMapper this struct contains the path of definition and some config readers
func NewConfigMapper ¶
func NewConfigMapper() *ConfigMapper
NewConfigMapper file definition constructor
func (*ConfigMapper) AddConfigParser ¶
func (fd *ConfigMapper) AddConfigParser(reader Parser)
AddConfigParser allows append new readers to able load different config files
type ConfigMapping ¶
func NewConfigMapping ¶
func NewConfigMapping(path string, mapper *ConfigMapper, fsUpdate chan struct{}) *ConfigMapping
func (*ConfigMapping) Delete ¶
func (fm *ConfigMapping) Delete(URI string) error
func (*ConfigMapping) List ¶
func (fm *ConfigMapping) List() []Mock
type FileWatcher ¶
type FileWatcher struct {
// contains filtered or unexported fields
}
func NewFileWatcher ¶
func NewFileWatcher(path string, fsUpdate chan struct{}) *FileWatcher
func (*FileWatcher) Bind ¶
func (fw *FileWatcher) Bind()
Bind start the watching process to detect any change on defintions
func (*FileWatcher) UnBind ¶
func (fw *FileWatcher) UnBind()
type HttpHeaders ¶ added in v1.0.1
type Match ¶
type Match struct { Time int64 `json:"time"` Request *Request `json:"request"` Response *Response `json:"response"` Result *MatchResult `json:"result"` }
Match contains the whole information about the request match. The http request, the final response received and the matching result.
type MatchError ¶
MatchError contains the tested uri and the match error
type MatchResult ¶
type MatchResult struct { Found bool `json:"match"` URI string `json:"uri"` Errors []MatchError `json:"errors"` }
MatchResult contains the match result and the failing matches with different mocks and the reason or the fail.
type Mock ¶
type Mock struct { URI string Description string `json:"description"` Request Request `json:"request"` Response Response `json:"response"` Control Control `json:"control"` }
Mock contains the user mock definition
type Parser ¶
Parser interface allows recognize if there is available some config reader for an a specific file.
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 Response ¶
type Response struct { StatusCode int `json:"statusCode"` HttpHeaders Body string `json:"body"` }