tester

package
v0.5.2-rc2 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2018 License: BSD-3-Clause Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ENV_ENABLED         = "TESTER_ENABLED"
	ENV_SETTING_PORT    = "TESTER_PORT"
	ENV_SETTING_SR_HOST = "TESTER_SR_SERVER"
)
View Source
const (
	FLOW_REF = "github.com/TIBCOSoftware/flogo-contrib/action/flow"
)

Variables

This section is empty.

Functions

func DefaultConfig

func DefaultConfig() *util.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]*data.Attribute, 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]*data.Attribute, 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]*data.Attribute, 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 *util.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       []*data.Attribute      `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 added in v0.5.2

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) GetLinkExprManagerFactory

func (fp *TesterProvider) GetLinkExprManagerFactory() definition.LinkExprManagerFactory

func (*TesterProvider) GetMapperFactory

func (fp *TesterProvider) GetMapperFactory() definition.MapperFactory

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