caseprovider

package
v0.0.0-...-e9f0680 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2022 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BasicLoader

type BasicLoader struct{}

func (*BasicLoader) LoadGlobalMockCase

func (l *BasicLoader) LoadGlobalMockCase(filePath string) ([]*interact.ImposterMockCase, error)

func (*BasicLoader) LoadItf

func (l *BasicLoader) LoadItf(filePath string) (*mbcase.ItfTask, error)

type CaseLoader

type CaseLoader interface {
	LoadGlobalMockCase(filePath string) ([]*interact.ImposterMockCase, error)
	LoadItf(filePath string) (*mbcase.ItfTask, error)
}

type Config

type Config struct {
	TaskFileSuffix string `yaml:"taskFileSuffix"` // the default test case suffix name. example: ".case.json"

	CaseFiles  []string `yaml:"caseFiles"`
	WatchCases bool     `yaml:"watcherCases"` // whether to enable file listening

	MockFiles []string `yaml:"mockFiles"`   // mock file.
	WatchMock bool     `yaml:"watcherMock"` // whether to enable mock file listening
}

func NewConfig

func NewConfig() *Config

func (*Config) RegisterFlagsWithPrefix

func (c *Config) RegisterFlagsWithPrefix(prefix string, f *pflag.FlagSet)

RegisterFlagsWithPrefix is used to register flags

func (*Config) Validate

func (c *Config) Validate() error

type Provider

type Provider interface {
	// GetAllCaseFromItfName Get all cases form the interface serviceName.
	GetAllCaseFromItfName(serviceName string) []*mbcase.CaseTask
	GetAllCaseFromCaseName(serviceName, caseName string) *mbcase.CaseTask

	GetItfInfoFromItfName(serviceName string) *mbcase.TaskInfo
	// GetAllItfInfo Get all interface info.
	GetAllItfInfo() []*mbcase.TaskInfo
	// GetAllItf Get all interface.
	GetAllItf() []*mbcase.ItfTask

	// GetAllItfWithFileInfo  the interface that carries the file information
	GetAllItfWithFileInfo() []*mbcase.ItfTaskWithFileInfo

	// GetItfSetupCommand Get the Setup Commands of a type under the interface.
	GetItfSetupCommand(serviceName string) []*mbcase.Command
	// GetItfTearDownCommand Get the TearDown Commands of a type under the interface.
	GetItfTearDownCommand(serviceName string) []*mbcase.Command

	GetCaseSetupCommand(serviceName, caseName string) []*mbcase.Command
	GetCaseTearDownCommand(serviceName, caseName string) []*mbcase.Command

	GetMockCasesFromGlobals() []*interact.ImposterMockCase
	GetMockCasesFromItf(serviceName string) []*interact.ImposterMockCase
	GetMockCasesFromCase(serviceName, caseName string) []*interact.ImposterMockCase
}

func New

func New(log logger.Logger, cfg *Config, caseloader CaseLoader) (Provider, error)

Jump to

Keyboard shortcuts

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