internal

package
v2.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ReturnCodesList = func(query string, bindings map[string]string, rebindings map[string]string) ([]string, error) {
	var codes []string
	codes = append(codes, "123")
	codes = append(codes, "456")
	codes = append(codes, "789")
	return codes, nil
}
View Source
var ReturnEmptyCodesList = func(query string, bindings map[string]string, rebindings map[string]string) ([]string, error) {
	return []string{}, nil
}
View Source
var ReturnFiveStrings = func(q string, bindings, rebindings map[string]string) ([]string, error) {
	return []string{"a", "b", "c", "d", "e"}, nil
}

ReturnFiveStrings is a mock implementation for NeptunePool functions that return ([]string, error) which always returns five strings.

View Source
var ReturnInvalidCodeData = func(query string, bindings map[string]string, rebindings map[string]string) ([]string, error) {
	var codes []string
	codes = append(codes, "Not")
	codes = append(codes, "Enough")
	codes = append(codes, "Values")
	return codes, nil
}
View Source
var ReturnMalformedIntRequestErr = func(q string, bindings, rebindings map[string]string) (i int64, err error) {
	return -1, errors.New(" MALFORMED REQUEST ")
}

ReturnMalformedIntRequestErr is a mock implementation for NeptunePool.GetCount() that always returns an error that is judged to be not transient by neptune.isTransientError

View Source
var ReturnMalformedNilInterfaceRequestErr = func(q string, bindings, rebindings map[string]string) ([]graphson.Vertex, error) {
	return nil, errors.New(" MALFORMED REQUEST ")
}

ReturnMalformedNilInterfaceRequestErr is a mock implementation for NeptunePool functions that return ([]graphson.Vertex, error) which always returns an error that is judged to be not transient by neptune.isTransientError

View Source
var ReturnMalformedStringListRequestErr = func(q string, bindings, rebindings map[string]string) ([]string, error) {
	return nil, errors.New(" MALFORMED REQUEST ")
}

ReturnMalformedStringListRequestErr is a mock implementation for NeptunePool functions that return ([]string, error) which always returns an error that is judged to be not transient by neptune.isTransientError

View Source
var ReturnOne = func(q string, bindings, rebindings map[string]string) (i int64, err error) {
	return 1, nil
}

ReturnOne is a mock implementation for NeptunePool.GetCount() that always returns a count of 1.

View Source
var ReturnProperlyFormedDatasetRecord = func(q string, bindings, rebindings map[string]string) ([]string, error) {
	return []string{"exampleDimName", "exampleDatasetEdition", "3", "exampleDatasetID"}, nil
}

ReturnProperlyFormedDatasetRecord is a mock implementation for NeptunePool functions that return ([]string, error) which always returns A single quartet of strings that should satisfy the GetCodeDatasets method.

View Source
var ReturnStringRecordWithNonIntegerFourthElement = func(q string, bindings, rebindings map[string]string) ([]string, error) {
	return []string{"1", "2", "fibble", "3"}, nil
}

ReturnStringRecordWithNonIntegerFourthElement is a mock implementation for NeptunePool functions that return ([]string, error) which always returns 4 strings - in which the third one cannot be cast to an integer.

View Source
var ReturnThreeCodeLists = func(query string, bindings map[string]string, rebindings map[string]string) ([]graphson.Vertex, error) {
	codeLists := []graphson.Vertex{}
	for i := 0; i < 3; i++ {
		vertex := makeCodeListVertex(i, "my-test-edition")
		codeLists = append(codeLists, vertex)
	}
	return codeLists, nil
}

ReturnThreeCodeLists is mock implementation for NeptunePool.Get() that always returns a slice of three graphson.Vertex(s): - of type "_code_list" - with a "listID" property set to "listID_0", "listID_1", and "ListID_2" respectively. - with an "edition" property set to "my-test-edition"

View Source
var ReturnThreeCodeVertices = func(query string, bindings map[string]string, rebindings map[string]string) ([]graphson.Vertex, error) {
	codes := []graphson.Vertex{}
	for i := 0; i < 3; i++ {
		vertex := makeVertex("unused-vertex-type")
		setVertexStringProperty(&vertex, "value", fmt.Sprintf("code_%d", i))
		codes = append(codes, vertex)
	}
	return codes, nil
}

ReturnThreeCodeVertices is mock implementation for NeptunePool.Get() that always returns a slice of three graphson.Vertex(s): - of type "unused-vertex-type" - with a "value" property set to "code_0", "code_1", and "code_2" respectively.

View Source
var ReturnThreeCodes = func(query string, bindings map[string]string, rebindings map[string]string) ([]string, error) {
	var codes []string
	for i := 0; i < 3; i++ {
		codes = append(codes, fmt.Sprintf("label_%d", i))
		codes = append(codes, fmt.Sprintf("code_%d", i))
	}
	return codes, nil
}
View Source
var ReturnThreeEditionVertices = func(query string, bindings map[string]string, rebindings map[string]string) ([]graphson.Vertex, error) {
	editions := []graphson.Vertex{}
	for i := 0; i < 3; i++ {
		vertex := makeVertex("unused-vertex-type")
		setVertexStringProperty(&vertex, "edition", fmt.Sprintf("edition_%d", i))
		editions = append(editions, vertex)
	}
	return editions, nil
}

ReturnThreeEditionVertices is mock implementation for NeptunePool.Get() that always returns a slice of three graphson.Vertex(s): - of type "unused-vertex-type" - with a an "edition" property set to "edition_0", "edition_1", and "edition_2" respectively.

View Source
var ReturnThreeUselessVertices = func(query string, bindings map[string]string, rebindings map[string]string) ([]graphson.Vertex, error) {
	codeLists := []graphson.Vertex{}
	for i := 0; i < 3; i++ {
		vertex := makeVertex("_useless_vertex_type")
		codeLists = append(codeLists, vertex)
	}
	return codeLists, nil
}

ReturnThreeUselessVertices is mock implementation for NeptunePool.Get() that always returns a slice of three graphson.Vertex(s) of type "_useless_vertex_type", and with no properties set.

View Source
var ReturnTwo = func(q string, bindings, rebindings map[string]string) (i int64, err error) {
	return 2, nil
}

ReturnTwo is a mock implementation for NeptunePool.GetCount() that always returns a count of 2.

View Source
var ReturnZero = func(q string, bindings, rebindings map[string]string) (i int64, err error) {
	return 0, nil
}

ReturnZero is a mock implementation for NeptunePool.GetCount() that always returns a count of 0.

View Source
var ReturnZeroVertices = func(query string, bindings map[string]string, rebindings map[string]string) ([]graphson.Vertex, error) {
	return []graphson.Vertex{}, nil
}

ReturnZeroVertices provides an empty list of graphson.Vertex(s)

Functions

func MakeHierarchyVertex added in v2.0.7

func MakeHierarchyVertex(vertexLabel, code, codeLabel string, numberOfChildren int, hasData bool) graphson.Vertex

Types

type NeptunePoolMock

type NeptunePoolMock struct {
	// CloseFunc mocks the Close method.
	CloseFunc func()

	// ExecuteFunc mocks the Execute method.
	ExecuteFunc func(query string, bindings map[string]string, rebindings map[string]string) ([]gremgo.Response, error)

	// GetFunc mocks the Get method.
	GetFunc func(query string, bindings map[string]string, rebindings map[string]string) ([]graphson.Vertex, error)

	// GetCountFunc mocks the GetCount method.
	GetCountFunc func(q string, bindings map[string]string, rebindings map[string]string) (int64, error)

	// GetEFunc mocks the GetE method.
	GetEFunc func(q string, bindings map[string]string, rebindings map[string]string) (interface{}, error)

	// GetStringListFunc mocks the GetStringList method.
	GetStringListFunc func(query string, bindings map[string]string, rebindings map[string]string) ([]string, error)

	// OpenStreamCursorFunc mocks the OpenStreamCursor method.
	OpenStreamCursorFunc func(ctx context.Context, query string, bindings map[string]string, rebindings map[string]string) (*gremgo.Stream, error)
	// contains filtered or unexported fields
}

NeptunePoolMock is a mock implementation of driver.NeptunePool.

    func TestSomethingThatUsesNeptunePool(t *testing.T) {

        // make and configure a mocked driver.NeptunePool
        mockedNeptunePool := &NeptunePoolMock{
            CloseFunc: func()  {
	               panic("mock out the Close method")
            },
            ExecuteFunc: func(query string, bindings map[string]string, rebindings map[string]string) ([]gremgo.Response, error) {
	               panic("mock out the Execute method")
            },
            GetFunc: func(query string, bindings map[string]string, rebindings map[string]string) ([]graphson.Vertex, error) {
	               panic("mock out the Get method")
            },
            GetCountFunc: func(q string, bindings map[string]string, rebindings map[string]string) (int64, error) {
	               panic("mock out the GetCount method")
            },
            GetEFunc: func(q string, bindings map[string]string, rebindings map[string]string) (interface{}, error) {
	               panic("mock out the GetE method")
            },
            GetStringListFunc: func(query string, bindings map[string]string, rebindings map[string]string) ([]string, error) {
	               panic("mock out the GetStringList method")
            },
            OpenStreamCursorFunc: func(ctx context.Context, query string, bindings map[string]string, rebindings map[string]string) (*gremgo.Stream, error) {
	               panic("mock out the OpenStreamCursor method")
            },
        }

        // use mockedNeptunePool in code that requires driver.NeptunePool
        // and then make assertions.

    }

func (*NeptunePoolMock) Close

func (mock *NeptunePoolMock) Close()

Close calls CloseFunc.

func (*NeptunePoolMock) CloseCalls

func (mock *NeptunePoolMock) CloseCalls() []struct {
}

CloseCalls gets all the calls that were made to Close. Check the length with:

len(mockedNeptunePool.CloseCalls())

func (*NeptunePoolMock) Execute

func (mock *NeptunePoolMock) Execute(query string, bindings map[string]string, rebindings map[string]string) ([]gremgo.Response, error)

Execute calls ExecuteFunc.

func (*NeptunePoolMock) ExecuteCalls

func (mock *NeptunePoolMock) ExecuteCalls() []struct {
	Query      string
	Bindings   map[string]string
	Rebindings map[string]string
}

ExecuteCalls gets all the calls that were made to Execute. Check the length with:

len(mockedNeptunePool.ExecuteCalls())

func (*NeptunePoolMock) Get

func (mock *NeptunePoolMock) Get(query string, bindings map[string]string, rebindings map[string]string) ([]graphson.Vertex, error)

Get calls GetFunc.

func (*NeptunePoolMock) GetCalls

func (mock *NeptunePoolMock) GetCalls() []struct {
	Query      string
	Bindings   map[string]string
	Rebindings map[string]string
}

GetCalls gets all the calls that were made to Get. Check the length with:

len(mockedNeptunePool.GetCalls())

func (*NeptunePoolMock) GetCount

func (mock *NeptunePoolMock) GetCount(q string, bindings map[string]string, rebindings map[string]string) (int64, error)

GetCount calls GetCountFunc.

func (*NeptunePoolMock) GetCountCalls

func (mock *NeptunePoolMock) GetCountCalls() []struct {
	Q          string
	Bindings   map[string]string
	Rebindings map[string]string
}

GetCountCalls gets all the calls that were made to GetCount. Check the length with:

len(mockedNeptunePool.GetCountCalls())

func (*NeptunePoolMock) GetE

func (mock *NeptunePoolMock) GetE(q string, bindings map[string]string, rebindings map[string]string) (interface{}, error)

GetE calls GetEFunc.

func (*NeptunePoolMock) GetECalls

func (mock *NeptunePoolMock) GetECalls() []struct {
	Q          string
	Bindings   map[string]string
	Rebindings map[string]string
}

GetECalls gets all the calls that were made to GetE. Check the length with:

len(mockedNeptunePool.GetECalls())

func (*NeptunePoolMock) GetStringList

func (mock *NeptunePoolMock) GetStringList(query string, bindings map[string]string, rebindings map[string]string) ([]string, error)

GetStringList calls GetStringListFunc.

func (*NeptunePoolMock) GetStringListCalls

func (mock *NeptunePoolMock) GetStringListCalls() []struct {
	Query      string
	Bindings   map[string]string
	Rebindings map[string]string
}

GetStringListCalls gets all the calls that were made to GetStringList. Check the length with:

len(mockedNeptunePool.GetStringListCalls())

func (*NeptunePoolMock) OpenStreamCursor

func (mock *NeptunePoolMock) OpenStreamCursor(ctx context.Context, query string, bindings map[string]string, rebindings map[string]string) (*gremgo.Stream, error)

OpenStreamCursor calls OpenStreamCursorFunc.

func (*NeptunePoolMock) OpenStreamCursorCalls

func (mock *NeptunePoolMock) OpenStreamCursorCalls() []struct {
	Ctx        context.Context
	Query      string
	Bindings   map[string]string
	Rebindings map[string]string
}

OpenStreamCursorCalls gets all the calls that were made to OpenStreamCursor. Check the length with:

len(mockedNeptunePool.OpenStreamCursorCalls())

Jump to

Keyboard shortcuts

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