common

package
v0.0.0-...-bd94565 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 23, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HeaderContentType = "Content-Type"
	HeaderAccept      = "Accept"
)
View Source
const (
	ExpressionDateLayoutRFC3339     string = "RFC3339"
	ExpressionDateLayoutRFC3339Nano string = "RFC3339NANO"
)
View Source
const (
	LoggerReservedKeyExpected = "Expected"
	LoggerReservedKeyActual   = "Actual"
)

Variables

View Source
var (
	ErrUnsupportedMediaType = errors.New("unsupported media type")
)
View Source
var (
	ErrUnsupportedWorkerType = errors.New("unsupported worker type")
)

Functions

This section is empty.

Types

type Application

type Application struct {
	// contains filtered or unexported fields
}

func NewApplication

func NewApplication(providers ...interface{}) *Application

func (*Application) Run

func (a *Application) Run(invoker interface{})

type Arguments

type Arguments struct {
	Mode           WorkerType        `short:"m" long:"mode" required:"true"`
	SpecLocation   string            `short:"s" long:"spec-location"`
	SpecType       SpecType          `short:"f" long:"spec-format" default:"oa2"`
	Url            string            `short:"u" long:"url"`
	Variables      map[string]string `short:"v" long:"variable"`
	Tags           []string          `short:"t" long:"tags"`
	CertFilename   string            `long:"cert-filename"`
	KeyFilename    string            `long:"key-filename"`
	ConfigFilename string            `short:"c" long:"config-filename"`
}

type Config

type Config struct {
	Testers   map[string]interface{} `yaml:"testers"`
	Reporters map[string]interface{} `yaml:"reporters"`
	Variables map[string]interface{} `yaml:"variables"`
}

func NewFxConfig

func NewFxConfig(
	arguments Arguments,
	loggerFactory LoggerFactory,
	configProviderFactory ConfigProviderFactory,
) (*Config, error)

type ConfigProvider

type ConfigProvider interface {
	Populate(interface{}) error
	PopulateByKey(string, interface{}) error
}

type ConfigProviderFactory

type ConfigProviderFactory interface {
	CreateByFiles(filenames ...string) (ConfigProvider, error)
	CreateByOptions(options ...config.YAMLOption) (ConfigProvider, error)
}

func NewFxConfigProviderFactory

func NewFxConfigProviderFactory() ConfigProviderFactory

type DataCrawler

type DataCrawler interface {
	Walk(data interface{}, handler DataCrawlerHandler, opts ...DataCrawlerOption)
}

func NewFxDataCrawler

func NewFxDataCrawler() DataCrawler

type DataCrawlerHandler

type DataCrawlerHandler func(k string, v interface{})

type DataCrawlerOption

type DataCrawlerOption func(settings *DataCrawlerSettings)

func WithJoinKeys

func WithJoinKeys() DataCrawlerOption

func WithPrefix

func WithPrefix(prefix string) DataCrawlerOption

func WithSkipCollections

func WithSkipCollections() DataCrawlerOption

type DataCrawlerSettings

type DataCrawlerSettings struct {
	// contains filtered or unexported fields
}

type ExpressionDescriptor

type ExpressionDescriptor struct {
	Type        ExpressionType
	Name        string
	Constructor interface{}
}

type ExpressionFactory

type ExpressionFactory interface {
	Create(exprType ExpressionType, exprName interface{}) (interface{}, error)
}

func NewFxExpressionFactory

func NewFxExpressionFactory(in ExpressionFactoryIn) ExpressionFactory

type ExpressionFactoryIn

type ExpressionFactoryIn struct {
	fx.In
	Descriptors []ExpressionDescriptor `group:"expression_descriptor"`
}

type ExpressionType

type ExpressionType string
const (
	ExpressionTypeAsserter  ExpressionType = "asserter"
	ExpressionTypeGenerator ExpressionType = "generator"
)

type Iterator

type Iterator[T any] interface {
	HasNext() bool
	Next() T
	Reset()
}

func NewListIterator

func NewListIterator[T any](iterable List[T]) Iterator[T]

func NewMapIterator

func NewMapIterator[K comparable, V any](iterable Map[K, V]) Iterator[V]

type List

type List[T any] interface {
	Add(items ...T)
	Set(i int, item T)
	Get(i int) T
	Len() int
	Entries() []T
	Iterator() Iterator[T]
	Remove(i int)
	RemoveAll()
	Sort(f SortFunc[T])
}

func NewList

func NewList[T any](opts ...ListOption) List[T]

func NewListFromSlice

func NewListFromSlice[T any](slice ...T) List[T]

type ListOption

type ListOption func(settings *ListSettings)

func WithListSize

func WithListSize(size int) ListOption

type ListSettings

type ListSettings struct {
	// contains filtered or unexported fields
}

type Logger

type Logger interface {
	Debug(args ...interface{})
	Info(args ...interface{})
	Warn(args ...interface{})
	Error(args ...interface{})
	Fatal(args ...interface{})
	Debugf(format string, args ...interface{})
	Infof(format string, args ...interface{})
	Warnf(format string, args ...interface{})
	Errorf(format string, args ...interface{})
	Fatalf(format string, args ...interface{})
	With(args ...interface{}) Logger
	Infow(string, ...interface{})
	Named(string) Logger
	PrintGroup(msg string, args ...interface{})
	PrintSubGroup(msg string, args ...interface{})
	PrintSubGroupName(msg string, args ...interface{})
	PrintParameter(key string, value interface{})
	PrintParameters(header string, parameters map[string]interface{})
}

type LoggerFactory

type LoggerFactory interface {
	CreateCommonLogger() Logger
	CreateErrorLogger() Logger
	CreateSuccessLogger() Logger
}

func NewFxLoggerFactory

func NewFxLoggerFactory() LoggerFactory

type Map

type Map[K comparable, V any] interface {
	Set(key K, value V)
	Get(key K) (V, bool)
	Len() int
	Entries() map[K]V
	Iterator() Iterator[V]
	Remove(key K)
	RemoveAll()
}

func NewMap

func NewMap[K comparable, V any]() Map[K, V]

type MediaConverter

type MediaConverter interface {
	Marshal(mediaType MediaType, i interface{}) ([]byte, error)
	Unmarshal(mediaType MediaType, buf []byte) (interface{}, error)
}

func NewFxMediaConverter

func NewFxMediaConverter() MediaConverter

type MediaType

type MediaType string
const (
	MediaTypeJson MediaType = "application/json"
	MediaTypeXml  MediaType = "application/xml"
)

type PostProcessor

type PostProcessor struct {
	Type   string
	Config map[string]interface{}
}

type SortFunc

type SortFunc[T any] func(i, j T) bool

type SpecType

type SpecType string
const (
	SpecTypeOA2 SpecType = "oa2"
	SpecTypeOA3 SpecType = "oa3"
)

type Suite

type Suite struct {
	suite.Suite
	Ctrl *gomock.Controller
}

func (*Suite) SetupTest

func (s *Suite) SetupTest()

func (*Suite) TearDownTest

func (s *Suite) TearDownTest()

type Template

type Template struct {
	UID               string
	BaseUrl           string
	Path              string
	Method            string
	HeaderParams      map[string]interface{}
	PathParams        map[string]interface{}
	QueryParams       map[string]interface{}
	CookieParams      map[string]interface{}
	ExpectedResponses map[int]map[string]interface{}
	Bodies            map[string]interface{}
	Tags              []string
	PostProcessors    []PostProcessor
	Priority          int
}

func (*Template) ContainsTags

func (t *Template) ContainsTags(expectedTags []string) bool

func (Template) GetPath

func (t Template) GetPath() string

func (Template) GetQueryParams

func (t Template) GetQueryParams() url.Values

func (Template) GetUrl

func (t Template) GetUrl() string

type TemplateContainer

type TemplateContainer map[string]*Template

func (TemplateContainer) Create

func (c TemplateContainer) Create(exampleName, baseUrl, pathName, httpMethod string) *Template

type Worker

type Worker interface {
	GetType() WorkerType
	Configure(ctx context.Context, arguments Arguments) error
	Run() error
}

type WorkerContainer

type WorkerContainer map[WorkerType]Worker

func NewFxWorkerContainer

func NewFxWorkerContainer(in WorkerContainerFxIn) WorkerContainer

func (WorkerContainer) Get

func (c WorkerContainer) Get(workerType WorkerType) (Worker, error)

type WorkerContainerFxIn

type WorkerContainerFxIn struct {
	fx.In
	Workers []Worker `group:"worker"`
}

type WorkerType

type WorkerType string
const (
	WorkerTypeMock  WorkerType = "mock"
	WorkerTypeTest  WorkerType = "test"
	WorkerTypeTest2 WorkerType = "test2"
	WorkerTypeE2E   WorkerType = "e2e"
)

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL