engine

package
v0.0.0-...-8eaeb25 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DolusExpectationEngine

type DolusExpectationEngine struct {
	GenerationConfig generator.GenerationConfig
	// contains filtered or unexported fields
}

func NewDolusExpectationEngine

func NewDolusExpectationEngine(
	generationConfig generator.GenerationConfig,
) (dolusExpectationEngine *DolusExpectationEngine)

func (*DolusExpectationEngine) AddExpectation

func (e *DolusExpectationEngine) AddExpectation(
	expect expectation.Expectation,
	validateExpectationSchema bool) error

func (*DolusExpectationEngine) GetExpectations

func (e *DolusExpectationEngine) GetExpectations(expectationType *expectation.ExpectationType, path *string, method *string) []expectation.Expectation

func (*DolusExpectationEngine) GetResponseForRequest

func (e *DolusExpectationEngine) GetResponseForRequest(
	request *http.Request,
	requestParameters schema.RequestParameters,
	pathTemplate string,
) (*expectation.Response, error)

GetResponseForRequest returns the response for the given request

func (*DolusExpectationEngine) GetRouteManager

func (e *DolusExpectationEngine) GetRouteManager() RouteManager

GetRouteManager implements ExpectationEngine.

func (*DolusExpectationEngine) SetRouteManager

func (e *DolusExpectationEngine) SetRouteManager(routeManager RouteManager)

SetRouteManager implements ExpectationEngine.

type ExpectationEngine

type ExpectationEngine interface {
	// AddExpectation adds an expectation to the engine
	AddExpectation(expectation expectation.Expectation,
		validateExpectationSchema bool) error

	// GetExpectations returns the expectations for the given expectation type. Expectations can be filtered by path, method and expectation type.
	GetExpectations(expectationType *expectation.ExpectationType, path *string, method *string) []expectation.Expectation

	// GetResponseForRequest returns the response for the given request
	GetResponseForRequest(
		request *http.Request,
		reqParams schema.RequestParameters,
		path string,
	) (*expectation.Response, error)

	// SetRouteManager sets the route manager for the engine
	SetRouteManager(routeManager RouteManager)

	// GetRouteManager returns the route manager for the engine
	GetRouteManager() RouteManager
}

type ExpectationEngineMock

type ExpectationEngineMock struct {
	mock.Mock
}

ExpectationEngineMock is an autogenerated mock type for the ExpectationEngine type

func NewExpectationEngineMock

func NewExpectationEngineMock(t interface {
	mock.TestingT
	Cleanup(func())
}) *ExpectationEngineMock

NewExpectationEngineMock creates a new instance of ExpectationEngineMock. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*ExpectationEngineMock) AddExpectation

func (_m *ExpectationEngineMock) AddExpectation(_a0 expectation.Expectation, validateExpectationSchema bool) error

AddExpectation provides a mock function with given fields: _a0, validateExpectationSchema

func (*ExpectationEngineMock) EXPECT

func (*ExpectationEngineMock) GetExpectations

func (_m *ExpectationEngineMock) GetExpectations(expectationType *expectation.ExpectationType, path *string, method *string) []expectation.Expectation

GetExpectations provides a mock function with given fields: expectationType, path, method

func (*ExpectationEngineMock) GetResponseForRequest

func (_m *ExpectationEngineMock) GetResponseForRequest(request *http.Request, reqParams schema.RequestParameters, path string) (*expectation.Response, error)

GetResponseForRequest provides a mock function with given fields: request, reqParams, path

func (*ExpectationEngineMock) GetRouteManager

func (_m *ExpectationEngineMock) GetRouteManager() RouteManager

GetRouteManager provides a mock function with given fields:

func (*ExpectationEngineMock) SetRouteManager

func (_m *ExpectationEngineMock) SetRouteManager(routeManager RouteManager)

SetRouteManager provides a mock function with given fields: routeManager

type ExpectationEngineMock_AddExpectation_Call

type ExpectationEngineMock_AddExpectation_Call struct {
	*mock.Call
}

ExpectationEngineMock_AddExpectation_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddExpectation'

func (*ExpectationEngineMock_AddExpectation_Call) Return

func (*ExpectationEngineMock_AddExpectation_Call) Run

func (*ExpectationEngineMock_AddExpectation_Call) RunAndReturn

type ExpectationEngineMock_Expecter

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

func (*ExpectationEngineMock_Expecter) AddExpectation

func (_e *ExpectationEngineMock_Expecter) AddExpectation(_a0 interface{}, validateExpectationSchema interface{}) *ExpectationEngineMock_AddExpectation_Call

AddExpectation is a helper method to define mock.On call

  • _a0 expectation.Expectation
  • validateExpectationSchema bool

func (*ExpectationEngineMock_Expecter) GetExpectations

func (_e *ExpectationEngineMock_Expecter) GetExpectations(expectationType interface{}, path interface{}, method interface{}) *ExpectationEngineMock_GetExpectations_Call

GetExpectations is a helper method to define mock.On call

  • expectationType *expectation.ExpectationType
  • path *string
  • method *string

func (*ExpectationEngineMock_Expecter) GetResponseForRequest

func (_e *ExpectationEngineMock_Expecter) GetResponseForRequest(request interface{}, reqParams interface{}, path interface{}) *ExpectationEngineMock_GetResponseForRequest_Call

GetResponseForRequest is a helper method to define mock.On call

  • request *http.Request
  • reqParams schema.RequestParameters
  • path string

func (*ExpectationEngineMock_Expecter) GetRouteManager

GetRouteManager is a helper method to define mock.On call

func (*ExpectationEngineMock_Expecter) SetRouteManager

func (_e *ExpectationEngineMock_Expecter) SetRouteManager(routeManager interface{}) *ExpectationEngineMock_SetRouteManager_Call

SetRouteManager is a helper method to define mock.On call

  • routeManager RouteManager

type ExpectationEngineMock_GetExpectations_Call

type ExpectationEngineMock_GetExpectations_Call struct {
	*mock.Call
}

ExpectationEngineMock_GetExpectations_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetExpectations'

func (*ExpectationEngineMock_GetExpectations_Call) Return

func (*ExpectationEngineMock_GetExpectations_Call) Run

type ExpectationEngineMock_GetResponseForRequest_Call

type ExpectationEngineMock_GetResponseForRequest_Call struct {
	*mock.Call
}

ExpectationEngineMock_GetResponseForRequest_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetResponseForRequest'

func (*ExpectationEngineMock_GetResponseForRequest_Call) Return

func (*ExpectationEngineMock_GetResponseForRequest_Call) Run

type ExpectationEngineMock_GetRouteManager_Call

type ExpectationEngineMock_GetRouteManager_Call struct {
	*mock.Call
}

ExpectationEngineMock_GetRouteManager_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetRouteManager'

func (*ExpectationEngineMock_GetRouteManager_Call) Return

func (*ExpectationEngineMock_GetRouteManager_Call) Run

func (*ExpectationEngineMock_GetRouteManager_Call) RunAndReturn

type ExpectationEngineMock_SetRouteManager_Call

type ExpectationEngineMock_SetRouteManager_Call struct {
	*mock.Call
}

ExpectationEngineMock_SetRouteManager_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetRouteManager'

func (*ExpectationEngineMock_SetRouteManager_Call) Return

func (*ExpectationEngineMock_SetRouteManager_Call) Run

func (*ExpectationEngineMock_SetRouteManager_Call) RunAndReturn

type RouteManager

type RouteManager interface {
	// AddRoute registers a new route with the route manager. If the route already exists, it will be overwritten.
	AddRoute(route schema.Route,

		routeProperty *schema.RouteProperty)
	// RemoveRoute removes a route from the manager.
	RemoveRoute(route schema.Route)

	// GetRoutes returns all the routes registered with the manager.
	GetRoutes() []schema.Route

	GetRouteProperties() map[schema.Route]*schema.RouteProperty

	// GetRouteProperty returns the route property for the given route.
	GetRouteProperty(route schema.Route) *schema.RouteProperty

	// GetRequestSchema returns the request schema for the given route.
	GetRequestSchema(route schema.Route) dstruct.DynamicStructModifier

	// GetResponseSchema returns the response schema for the given route.
	GetResponseSchema(route schema.Route) dstruct.DynamicStructModifier
}

type RouteManagerImpl

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

func NewRouteManager

func NewRouteManager() *RouteManagerImpl

func (*RouteManagerImpl) AddRoute

func (r *RouteManagerImpl) AddRoute(route schema.Route, routeProperty *schema.RouteProperty)

AddRoute implements RouteManager.

func (*RouteManagerImpl) GetRequestSchema

func (r *RouteManagerImpl) GetRequestSchema(route schema.Route) dstruct.DynamicStructModifier

GetRequestSchema implements RouteManager.

func (*RouteManagerImpl) GetResponseSchema

func (r *RouteManagerImpl) GetResponseSchema(route schema.Route) dstruct.DynamicStructModifier

GetResponseSchema implements RouteManager.

func (*RouteManagerImpl) GetRouteProperties

func (r *RouteManagerImpl) GetRouteProperties() map[schema.Route]*schema.RouteProperty

func (*RouteManagerImpl) GetRouteProperty

func (r *RouteManagerImpl) GetRouteProperty(route schema.Route) *schema.RouteProperty

GetRouteProperty implements RouteManager.

func (*RouteManagerImpl) GetRoutes

func (r *RouteManagerImpl) GetRoutes() []schema.Route

GetRoutes implements RouteManager.

func (*RouteManagerImpl) RemoveRoute

func (r *RouteManagerImpl) RemoveRoute(route schema.Route)

RemoveRoute implements RouteManager.

Jump to

Keyboard shortcuts

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