testing

package
v0.0.0-...-28893bc Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2015 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StubWorkflow      = "stub"
	ShortStubWorkflow = "stub"
	StubVersion       = "1"
)

Variables

View Source
var (
	StubTaskList      = &swf.TaskList{Name: S(fmt.Sprintf("%s->%s", StubWorkflow, StubVersion))}
	ShortStubTaskList = &swf.TaskList{Name: S(fmt.Sprintf("%s->%s", ShortStubWorkflow, StubVersion))}
)

Functions

func NoOpActivityInterceptor

func NoOpActivityInterceptor() activity.ActivityInterceptor

func ShortStubFSM

func ShortStubFSM(domain string, client fsm.SWFOps) *fsm.FSM

func ShortStubState

func ShortStubState() fsm.Decider

func StubFSM

func StubFSM(domain string, client fsm.SWFOps) *fsm.FSM

func StubState

func StubState() fsm.Decider

func TestDecisionInterceptor

func TestDecisionInterceptor(testID string, stubbedWorkflows, stubbedShortWorkflows []string) fsm.DecisionInterceptor

intercept any attempts to start a workflow and launch the stub workflow instead.

func TestFailOnceActivityInterceptor

func TestFailOnceActivityInterceptor() activity.ActivityInterceptor

interceptor that fails the activity once per activity and returns to actual result subsequent time used to test error handling and retries of activities in fsms

func TestReplicator

func TestReplicator(decisionOutcomes chan DecisionOutcome) fsm.ReplicationHandler

func TestSWF

func TestSWF(client fsm.ClientSWFOps, stubbedWorkflow ...string) fsm.ClientSWFOps

Types

type DecisionOutcome

type DecisionOutcome struct {
	DecisionTask *swf.PollForDecisionTaskOutput
	State        *fsm.SerializedState
	Decisions    []*swf.Decision
}

type StateData

type StateData struct {
	State string
	Data  interface{}
}

type StubSWFClient

type StubSWFClient struct {
	fsm.ClientSWFOps
	// contains filtered or unexported fields
}

intercept any attempts to start a workflow and launch the stub workflow instead.

func (*StubSWFClient) StartWorkflowExecution

func (s *StubSWFClient) StartWorkflowExecution(req *swf.StartWorkflowExecutionInput) (resp *swf.StartWorkflowExecutionOutput, err error)

type TestAdapter

type TestAdapter interface {
	TestName() string
	Logf(format string, args ...interface{})
	Fatalf(format string, args ...interface{})
	FailNow()
}

type TestConfig

type TestConfig struct {
	Testing               TestAdapter
	FSM                   *fsm.FSM
	StubFSM               *fsm.FSM
	Workers               []*activity.ActivityWorker
	StubbedWorkflows      []string
	ShortStubbedWorkflows []string
	DefaultWaitTimeout    int
	FailActivitiesOnce    bool
}

type TestListener

type TestListener struct {
	DefaultWait time.Duration

	TestID string
	// contains filtered or unexported fields
}

func NewTestListener

func NewTestListener(t TestConfig) *TestListener

func (*TestListener) AwaitData

func (tl *TestListener) AwaitData(workflowID string, predicate func(*StateData) bool)

func (*TestListener) AwaitDataFor

func (tl *TestListener) AwaitDataFor(workflowID string, waitFor time.Duration, predicate func(*StateData) bool)

func (*TestListener) AwaitDecision

func (tl *TestListener) AwaitDecision(workflowID string, predicate func(*swf.Decision) bool)

func (*TestListener) AwaitDecisionFor

func (tl *TestListener) AwaitDecisionFor(workflowID string, waitFor time.Duration, predicate func(*swf.Decision) bool)

func (*TestListener) AwaitEvent

func (tl *TestListener) AwaitEvent(workflowID string, predicate func(*swf.HistoryEvent) bool)

func (*TestListener) AwaitEventFor

func (tl *TestListener) AwaitEventFor(workflowID string, waitFor time.Duration, predicate func(*swf.HistoryEvent) bool)

func (*TestListener) AwaitState

func (tl *TestListener) AwaitState(workflowID, state string)

func (*TestListener) AwaitStateFor

func (tl *TestListener) AwaitStateFor(workflowID, state string, waitFor time.Duration)

func (*TestListener) RegisterDataInterest

func (tl *TestListener) RegisterDataInterest(workflowID string) chan *StateData

func (*TestListener) RegisterDecisionInterest

func (tl *TestListener) RegisterDecisionInterest(workflowID string) chan *swf.Decision

func (*TestListener) RegisterHistoryInterest

func (tl *TestListener) RegisterHistoryInterest(workflowID string) chan *swf.HistoryEvent

func (*TestListener) RegisterStateInterest

func (tl *TestListener) RegisterStateInterest(workflowID string) chan string

func (*TestListener) Start

func (tl *TestListener) Start()

func (*TestListener) Stop

func (tl *TestListener) Stop()

func (*TestListener) TestFsmTaskList

func (tl *TestListener) TestFsmTaskList() string

func (*TestListener) TestWorkerTaskList

func (tl *TestListener) TestWorkerTaskList(w *activity.ActivityWorker) string

Jump to

Keyboard shortcuts

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