Documentation ¶
Index ¶
- func AMPublishCode(t testing.TB, am core.ArtifactManager, domain core.RecordRef, ...) (typeRef *core.RecordRef, codeRef *core.RecordRef, classRef *core.RecordRef, ...)
- func Build() (string, string, error)
- func CBORMarshal(t testing.TB, o interface{}) []byte
- func CBORUnMarshal(t testing.TB, data []byte) interface{}
- func CBORUnMarshalToSlice(t testing.TB, in []byte) []interface{}
- func PrependGoPath(path string) string
- func WriteFile(dir string, name string, text string) error
- type ContractsBuilder
- type TestArtifactManager
- func (t *TestArtifactManager) ActivateClass(domain core.RecordRef, request core.RecordRef, code core.RecordRef) (*core.RecordID, error)
- func (t *TestArtifactManager) ActivateObject(domain core.RecordRef, request core.RecordRef, class core.RecordRef, ...) (*core.RecordID, error)
- func (t *TestArtifactManager) ActivateObjectDelegate(domain, request, class, parent core.RecordRef, memory []byte) (*core.RecordID, error)
- func (t *TestArtifactManager) DeactivateClass(domain core.RecordRef, request core.RecordRef, class core.RecordRef) (*core.RecordID, error)
- func (t *TestArtifactManager) DeactivateObject(domain core.RecordRef, request core.RecordRef, obj core.RecordRef) (*core.RecordID, error)
- func (t *TestArtifactManager) DeclareType(domain core.RecordRef, request core.RecordRef, typeDec []byte) (*core.RecordRef, error)
- func (t *TestArtifactManager) DeployCode(domain core.RecordRef, request core.RecordRef, ...) (*core.RecordRef, error)
- func (t *TestArtifactManager) GenesisRef() *core.RecordRef
- func (t *TestArtifactManager) GetChildren(parent core.RecordRef, pulse *core.PulseNumber) (core.RefIterator, error)
- func (t *TestArtifactManager) GetClass(object core.RecordRef, state *core.RecordRef) (core.ClassDescriptor, error)
- func (t *TestArtifactManager) GetCode(code core.RecordRef, machinePref []core.MachineType) (core.CodeDescriptor, error)
- func (t *TestArtifactManager) GetDelegate(head, asClass core.RecordRef) (*core.RecordRef, error)
- func (t *TestArtifactManager) GetObject(object core.RecordRef, state *core.RecordRef) (core.ObjectDescriptor, error)
- func (t *TestArtifactManager) RegisterRequest(message core.Message) (*core.RecordRef, error)
- func (t *TestArtifactManager) Start(components core.Components) error
- func (t *TestArtifactManager) Stop() error
- func (t *TestArtifactManager) UpdateClass(domain core.RecordRef, request core.RecordRef, class core.RecordRef, ...) (*core.RecordID, error)
- func (t *TestArtifactManager) UpdateObject(domain core.RecordRef, request core.RecordRef, obj core.RecordRef, ...) (*core.RecordID, error)
- type TestClassDescriptor
- type TestCodeDescriptor
- type TestMessageBus
- func (eb *TestMessageBus) Register(p core.MessageType, handler core.MessageHandler) error
- func (eb *TestMessageBus) Send(msg core.Message) (resp core.Reply, err error)
- func (*TestMessageBus) SendAsync(msg core.Message)
- func (*TestMessageBus) Start(components core.Components) error
- func (*TestMessageBus) Stop() error
- type TestObjectDescriptor
- func (t *TestObjectDescriptor) Children(pulse *core.PulseNumber) (core.RefIterator, error)
- func (t *TestObjectDescriptor) ClassDescriptor(state *core.RecordRef) (core.ClassDescriptor, error)
- func (t *TestObjectDescriptor) HeadRef() *core.RecordRef
- func (t *TestObjectDescriptor) Memory() []byte
- func (t *TestObjectDescriptor) StateID() *core.RecordID
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AMPublishCode ¶
func AMPublishCode( t testing.TB, am core.ArtifactManager, domain core.RecordRef, request core.RecordRef, mtype core.MachineType, code []byte, ) ( typeRef *core.RecordRef, codeRef *core.RecordRef, classRef *core.RecordRef, err error, )
AMPublishCode publishes code on ledger
func CBORMarshal ¶
CBORMarshal - testing serialize helper
func CBORUnMarshal ¶
CBORUnMarshal - testing deserialize helper
func CBORUnMarshalToSlice ¶
CBORUnMarshalToSlice - wrapper for CBORUnMarshal, expects slice
func PrependGoPath ¶
PrependGoPath prepends `path` to GOPATH environment variable accounting for possibly for default value. Returns new value. NOTE: that environment is not changed
Types ¶
type ContractsBuilder ¶
type ContractsBuilder struct { ArtifactManager core.ArtifactManager IccPath string Classes map[string]*core.RecordRef Codes map[string]*core.RecordRef // contains filtered or unexported fields }
ContractsBuilder for tests
func NewContractBuilder ¶
func NewContractBuilder(am core.ArtifactManager, icc string) *ContractsBuilder
NewContractBuilder returns a new `ContractsBuilder`, takes in: path to tmp directory, artifact manager, ...
func (*ContractsBuilder) Build ¶
func (cb *ContractsBuilder) Build(contracts map[string]string) error
Build ...
func (*ContractsBuilder) Clean ¶
func (cb *ContractsBuilder) Clean()
Clean deletes tmp directory used for contracts building
type TestArtifactManager ¶
type TestArtifactManager struct { Types []core.MachineType Codes map[core.RecordRef]*TestCodeDescriptor Objects map[core.RecordRef]*TestObjectDescriptor Classes map[core.RecordRef]*TestClassDescriptor }
TestArtifactManager implementation for tests
func NewTestArtifactManager ¶
func NewTestArtifactManager() *TestArtifactManager
NewTestArtifactManager implementation for tests
func (*TestArtifactManager) ActivateClass ¶
func (t *TestArtifactManager) ActivateClass(domain core.RecordRef, request core.RecordRef, code core.RecordRef) (*core.RecordID, error)
ActivateClass implementation for tests
func (*TestArtifactManager) ActivateObject ¶
func (t *TestArtifactManager) ActivateObject(domain core.RecordRef, request core.RecordRef, class core.RecordRef, parent core.RecordRef, memory []byte) (*core.RecordID, error)
ActivateObject implementation for tests
func (*TestArtifactManager) ActivateObjectDelegate ¶
func (t *TestArtifactManager) ActivateObjectDelegate(domain, request, class, parent core.RecordRef, memory []byte) (*core.RecordID, error)
ActivateObjectDelegate implementation for tests
func (*TestArtifactManager) DeactivateClass ¶
func (t *TestArtifactManager) DeactivateClass(domain core.RecordRef, request core.RecordRef, class core.RecordRef) (*core.RecordID, error)
DeactivateClass implementation for tests
func (*TestArtifactManager) DeactivateObject ¶
func (t *TestArtifactManager) DeactivateObject(domain core.RecordRef, request core.RecordRef, obj core.RecordRef) (*core.RecordID, error)
DeactivateObject implementation for tests
func (*TestArtifactManager) DeclareType ¶
func (t *TestArtifactManager) DeclareType(domain core.RecordRef, request core.RecordRef, typeDec []byte) (*core.RecordRef, error)
DeclareType implementation for tests
func (*TestArtifactManager) DeployCode ¶
func (t *TestArtifactManager) DeployCode(domain core.RecordRef, request core.RecordRef, codeMap map[core.MachineType][]byte) (*core.RecordRef, error)
DeployCode implementation for tests
func (*TestArtifactManager) GenesisRef ¶
func (t *TestArtifactManager) GenesisRef() *core.RecordRef
GenesisRef implementation for tests
func (*TestArtifactManager) GetChildren ¶
func (t *TestArtifactManager) GetChildren(parent core.RecordRef, pulse *core.PulseNumber) (core.RefIterator, error)
GetChildren implementation for tests
func (*TestArtifactManager) GetClass ¶
func (t *TestArtifactManager) GetClass(object core.RecordRef, state *core.RecordRef) (core.ClassDescriptor, error)
GetClass implementation for tests
func (*TestArtifactManager) GetCode ¶
func (t *TestArtifactManager) GetCode(code core.RecordRef, machinePref []core.MachineType) (core.CodeDescriptor, error)
GetCode implementation for tests
func (*TestArtifactManager) GetDelegate ¶
GetDelegate implementation for tests
func (*TestArtifactManager) GetObject ¶
func (t *TestArtifactManager) GetObject(object core.RecordRef, state *core.RecordRef) (core.ObjectDescriptor, error)
GetObject implementation for tests
func (*TestArtifactManager) RegisterRequest ¶
RegisterRequest implementation for tests
func (*TestArtifactManager) Start ¶
func (t *TestArtifactManager) Start(components core.Components) error
Start implementation for tests
func (*TestArtifactManager) Stop ¶
func (t *TestArtifactManager) Stop() error
Stop implementation for tests
type TestClassDescriptor ¶
type TestClassDescriptor struct { AM *TestArtifactManager ARef *core.RecordRef ACode *core.RecordRef }
TestClassDescriptor ...
func (*TestClassDescriptor) CodeDescriptor ¶
func (t *TestClassDescriptor) CodeDescriptor(machinePref []core.MachineType) (core.CodeDescriptor, error)
CodeDescriptor ...
func (*TestClassDescriptor) HeadRef ¶
func (t *TestClassDescriptor) HeadRef() *core.RecordRef
HeadRef ...
func (*TestClassDescriptor) StateID ¶
func (t *TestClassDescriptor) StateID() *core.RecordID
StateID ...
type TestCodeDescriptor ¶
type TestCodeDescriptor struct { ARef core.RecordRef ACode []byte AMachineType core.MachineType }
TestCodeDescriptor implementation for tests
func (*TestCodeDescriptor) Code ¶
func (t *TestCodeDescriptor) Code() []byte
Code implementation for tests
func (*TestCodeDescriptor) MachineType ¶
func (t *TestCodeDescriptor) MachineType() core.MachineType
MachineType implementation for tests
func (*TestCodeDescriptor) Ref ¶
func (t *TestCodeDescriptor) Ref() *core.RecordRef
Ref implementation for tests
type TestMessageBus ¶
type TestMessageBus struct {
LogicRunner core.LogicRunner
}
TestMessageBus can execute messages on LogicRunner.
func NewTestMessageBus ¶
func NewTestMessageBus(lr core.LogicRunner) *TestMessageBus
NewTestMessageBus creates TestMessageBus which mocks the real one.
func (*TestMessageBus) Register ¶
func (eb *TestMessageBus) Register(p core.MessageType, handler core.MessageHandler) error
Register is the dummy mock of Register method
func (*TestMessageBus) SendAsync ¶
func (*TestMessageBus) SendAsync(msg core.Message)
SendAsync sends message async
func (*TestMessageBus) Start ¶
func (*TestMessageBus) Start(components core.Components) error
Start is the dummy mock of Start method.
func (*TestMessageBus) Stop ¶
func (*TestMessageBus) Stop() error
Stop is the dummy mock of Stop method.
type TestObjectDescriptor ¶
type TestObjectDescriptor struct { AM *TestArtifactManager Data []byte Code *core.RecordRef Class *core.RecordRef Delegates map[core.RecordRef]core.RecordRef ChildrenContainer []core.RecordRef }
TestObjectDescriptor implementation for tests
func (*TestObjectDescriptor) Children ¶
func (t *TestObjectDescriptor) Children(pulse *core.PulseNumber) (core.RefIterator, error)
Children implementation for tests
func (*TestObjectDescriptor) ClassDescriptor ¶
func (t *TestObjectDescriptor) ClassDescriptor(state *core.RecordRef) (core.ClassDescriptor, error)
ClassDescriptor implementation for tests
func (*TestObjectDescriptor) HeadRef ¶
func (t *TestObjectDescriptor) HeadRef() *core.RecordRef
HeadRef implementation for tests
func (*TestObjectDescriptor) Memory ¶
func (t *TestObjectDescriptor) Memory() []byte
Memory implementation for tests
func (*TestObjectDescriptor) StateID ¶
func (t *TestObjectDescriptor) StateID() *core.RecordID
StateID implementation for tests