tester

package
v1.6.9 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: BSD-3-Clause Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RefFlow = "github.com/project-flogo/flow"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FlowTesterFactory added in v0.9.4

type FlowTesterFactory struct {
}

func (*FlowTesterFactory) NewService added in v0.9.4

func (s *FlowTesterFactory) NewService(config *service.Config) (service.Service, error)

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 RestFlowTester added in v0.9.4

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

RestFlowTester is default REST implementation of the EngineTester

func (*RestFlowTester) Name added in v0.9.4

func (ft *RestFlowTester) Name() string

func (*RestFlowTester) RestartFlow added in v0.9.4

func (ft *RestFlowTester) 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 (*RestFlowTester) ResumeFlow added in v0.9.4

func (ft *RestFlowTester) ResumeFlow(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

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 (*RestFlowTester) Start added in v0.9.4

func (ft *RestFlowTester) Start() error

Start implements engine.EngineTester.Start

func (*RestFlowTester) StartFlow added in v0.9.4

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 (*RestFlowTester) Status added in v0.9.4

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

func (*RestFlowTester) Stop added in v0.9.4

func (ft *RestFlowTester) 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

Jump to

Keyboard shortcuts

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