mock

package
v0.0.0-...-97a2875 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2017 License: Apache-2.0 Imports: 1 Imported by: 0

README

mock

-- import "github.com/Clever/baseworker-go/mock"

Usage

type MockJob
type MockJob struct {
	Payload, Name, GearmanHandle, Id string
	GearmanErr                       error
	GearmanWarnings                  [][]byte
	DataBuffer                       bytes.Buffer
	Numerator, Denominator           int
}

MockJob is a fake Gearman job for tests

func CreateMockJob
func CreateMockJob(payload string) *MockJob

CreateMockJob creates an object that implements the gearman-go/worker#Job interface

func (MockJob) Data
func (m MockJob) Data() []byte

Data returns the Gearman payload

func (MockJob) Err
func (m MockJob) Err() error

Err returns the job's error

func (MockJob) Fn
func (m MockJob) Fn() string

Fn returns the job's name

func (MockJob) Handle
func (m MockJob) Handle() string

Handle returns the job's handle

func (MockJob) OutData
func (m MockJob) OutData() []byte

OutData returns the Gearman outpack data

func (*MockJob) SendData
func (m *MockJob) SendData(data []byte)

SendData appends to the array of job data

func (*MockJob) SendWarning
func (m *MockJob) SendWarning(warning []byte)

SendWarning appends to the array of job warnings

func (MockJob) UniqueId
func (m MockJob) UniqueId() string

UniqueId returns the unique id for the job

func (*MockJob) UpdateStatus
func (m *MockJob) UpdateStatus(numerator, denominator int)

UpdateStatus updates the progress of job

func (*MockJob) Warnings
func (m *MockJob) Warnings() [][]byte

Warnings returns the array of jobs warnings

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockJob

type MockJob struct {
	Payload, Name, GearmanHandle, Id string
	GearmanErr                       error
	GearmanWarnings                  [][]byte
	DataBuffer                       bytes.Buffer
	Numerator, Denominator           int
}

MockJob is a fake Gearman job for tests

func CreateMockJob

func CreateMockJob(payload string) *MockJob

CreateMockJob creates an object that implements the gearman-go/worker#Job interface

func (MockJob) Data

func (m MockJob) Data() []byte

Data returns the Gearman payload

func (MockJob) Err

func (m MockJob) Err() error

Err returns the job's error

func (MockJob) Fn

func (m MockJob) Fn() string

Fn returns the job's name

func (MockJob) Handle

func (m MockJob) Handle() string

Handle returns the job's handle

func (MockJob) OutData

func (m MockJob) OutData() []byte

OutData returns the Gearman outpack data

func (*MockJob) SendData

func (m *MockJob) SendData(data []byte)

SendData appends to the array of job data

func (*MockJob) SendWarning

func (m *MockJob) SendWarning(warning []byte)

SendWarning appends to the array of job warnings

func (MockJob) UniqueId

func (m MockJob) UniqueId() string

UniqueId returns the unique id for the job

func (*MockJob) UpdateStatus

func (m *MockJob) UpdateStatus(numerator, denominator int)

UpdateStatus updates the progress of job

func (*MockJob) Warnings

func (m *MockJob) Warnings() [][]byte

Warnings returns the array of jobs warnings

Jump to

Keyboard shortcuts

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