tester

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2019 License: BSD-3-Clause Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvEnabled       = "TESTER_ENABLED"
	EnvSettingPort   = "TESTER_PORT"
	EnvSettingSrHost = "TESTER_SR_SERVER"
)
View Source
const (
	RefFlow = "github.com/qingcloudhx/flow"
)

Variables

This section is empty.

Functions

func DefaultConfig

func DefaultConfig() *support.ServiceConfig

Types

type RequestProcessor

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

RequestProcessor processes request objects and invokes the corresponding flow Manager methods

func NewRequestProcessor

func NewRequestProcessor() *RequestProcessor

NewRequestProcessor creates a new RequestProcessor

func (*RequestProcessor) RestartFlow

func (rp *RequestProcessor) RestartFlow(restartRequest *RestartRequest) (results map[string]interface{}, err error)

RestartFlow handles a RestartRequest for a FlowInstance. This will generate an ID for the new FlowInstance and queue a RestartRequest.

func (*RequestProcessor) ResumeFlow

func (rp *RequestProcessor) ResumeFlow(resumeRequest *ResumeRequest) (results map[string]interface{}, err error)

ResumeFlow handles a ResumeRequest for a FlowInstance. This will queue a RestartRequest.

func (*RequestProcessor) StartFlow

func (rp *RequestProcessor) StartFlow(startRequest *StartRequest) (results map[string]interface{}, err error)

StartFlow handles a StartRequest for a FlowInstance. This will generate an ID for the new FlowInstance and queue a StartRequest.

type RestEngineTester

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

RestEngineTester is default REST implementation of the EngineTester

func NewRestEngineTester

func NewRestEngineTester(config *support.ServiceConfig) *RestEngineTester

NewRestEngineTester creates a new REST EngineTester

func (*RestEngineTester) Enabled

func (et *RestEngineTester) Enabled() bool

func (*RestEngineTester) Name

func (et *RestEngineTester) Name() string

func (*RestEngineTester) RestartFlow

func (et *RestEngineTester) RestartFlow(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

RestartFlow restarts a Flow Instance (POST "/flow/restart").

To post a restart flow, try this at a shell: $ curl -H "Content-Type: application/json" -X POST -d '{...}' http://localhost:8080/flow/restart

func (*RestEngineTester) ResumeFlow

ResumeFlow resumes a Flow Instance (POST "/flow/resume").

To post a resume flow, try this at a shell: $ curl -H "Content-Type: application/json" -X POST -d '{...}' http://localhost:8080/flow/resume

func (*RestEngineTester) Start

func (et *RestEngineTester) Start() error

Start implements engine.EngineTester.Start

func (*RestEngineTester) StartFlow

StartFlow starts a new Flow Instance (POST "/flow/start").

To post a start flow, try this at a shell: $ curl -H "Content-Type: application/json" -X POST -d '{"flowUri":"base"}' http://localhost:8080/flow/start

func (*RestEngineTester) Status

Status is a basic health check for the server to determine if it is up

func (*RestEngineTester) Stop

func (et *RestEngineTester) Stop() error

Stop implements engine.EngineTester.Stop

type RestartRequest

type RestartRequest struct {
	InitialState *instance.IndependentInstance `json:"initialState"`
	Data         map[string]interface{}        `json:"data"`
	Interceptor  *support.Interceptor          `json:"interceptor"`
	Patch        *support.Patch                `json:"patch"`
}

RestartRequest describes a request for restarting a FlowInstance todo: can be merged into StartRequest

type ResumeRequest

type ResumeRequest struct {
	State       *instance.IndependentInstance `json:"state"`
	Data        map[string]interface{}        `json:"data"`
	Interceptor *support.Interceptor          `json:"interceptor"`
	Patch       *support.Patch                `json:"patch"`
}

ResumeRequest describes a request for resuming a FlowInstance todo: Data for resume request should be directed to waiting task

type Server

type Server struct {
	*http.Server
	// contains filtered or unexported fields
}

Server the server structure

func NewServer

func NewServer(addr string, handler http.Handler) *Server

NewServer creates a new server instance param server - is a instance of http.Server, can be nil and a default one will be created

func (*Server) InstanceID

func (s *Server) InstanceID() string

InstanceID is the server instance ID

func (*Server) IsStarted

func (s *Server) IsStarted() bool

IsStarted checks if the server is started note: will return true even if the server is stopped but there are still some requests to finish

func (*Server) Start

func (s *Server) Start() error

Start starts the server note: command isn't blocking, will exit after run

func (*Server) Stop

func (s *Server) Stop() error

Stop sends stop command to the server

func (*Server) WaitStop

func (s *Server) WaitStop(timeout time.Duration) error

WaitStop waits until server is stopped and all requests are finish timeout - is the time to wait for the requests to finish after the server is stopped note: will return error if there are still some requests not finished

type StartRequest

type StartRequest struct {
	FlowURI     string                 `json:"flowUri"`
	Data        map[string]interface{} `json:"data"`
	Attrs       map[string]interface{} `json:"attrs"`
	Interceptor *support.Interceptor   `json:"interceptor"`
	Patch       *support.Patch         `json:"patch"`
	ReplyTo     string                 `json:"replyTo"`
}

StartRequest describes a request for starting a FlowInstance

type TesterProvider

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

ExtensionProvider is the extension provider for the flow action

func NewExtensionProvider

func NewExtensionProvider() *TesterProvider

func (*TesterProvider) GetDefaultFlowModel

func (fp *TesterProvider) GetDefaultFlowModel() *model.FlowModel

func (*TesterProvider) GetFlowProvider

func (fp *TesterProvider) GetFlowProvider() definition.Provider

func (*TesterProvider) GetFlowTester

func (fp *TesterProvider) GetFlowTester() *RestEngineTester

func (*TesterProvider) GetScriptExprFactory

func (fp *TesterProvider) GetScriptExprFactory() expression.Factory

func (*TesterProvider) GetStateRecorder

func (fp *TesterProvider) GetStateRecorder() instance.StateRecorder

Jump to

Keyboard shortcuts

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