fabric-sdk-go: github.com/hyperledger/fabric-sdk-go/pkg/fab/mocks Index | Files

package mocks

import "github.com/hyperledger/fabric-sdk-go/pkg/fab/mocks"

Index

Package Files

mockbroadcastserver.go mockcaclient.go mockchannel.go mockchconfig.go mockchprovider.go mockconfig.go mockcontext.go mockcryptosuite.go mockdata.go mockdiscovery.go mockendorserserver.go mockeventservice.go mockfabricprovider.go mockidentity.go mockidentitymgr.go mocklocal.go mockmembership.go mockmsp.go mockmspmanager.go mockorderer.go mockpeer.go mockselection.go mocktransactor.go

Variables

var TestBlock = &po.DeliverResponse{
    Type: &po.DeliverResponse_Block{
        Block: &common.Block{
            Data: &common.BlockData{
                Data: [][]byte{[]byte("test")},
            },
        },
    },
}

TestBlock is a test block

func CreateBlockWithCCEvent Uses

func CreateBlockWithCCEvent(events *pp.ChaincodeEvent, txID string,
    channelID string) (*common.Block, error)

CreateBlockWithCCEvent creates a mock block

func CreateBlockWithCCEventAndTxStatus Uses

func CreateBlockWithCCEventAndTxStatus(events *pp.ChaincodeEvent, txID string,
    channelID string, txValidationCode pp.TxValidationCode) (*common.Block, error)

CreateBlockWithCCEventAndTxStatus creates a mock block with the given CC event and TX validation code

func NewMockCAClient Uses

func NewMockCAClient(orgName string, cryptoProvider core.CryptoSuite) (api.CAClient, error)

NewMockCAClient Constructor for a CA client.

func NewMockCryptoConfig Uses

func NewMockCryptoConfig() core.CryptoSuiteConfig

NewMockCryptoConfig ...

func NewMockCryptoConfigCustomized Uses

func NewMockCryptoConfigCustomized(tlsEnabled, mutualTLSEnabled, errorCase bool) core.CryptoSuiteConfig

NewMockCryptoConfigCustomized ...

func NewMockEndpointConfig Uses

func NewMockEndpointConfig() fab.EndpointConfig

NewMockEndpointConfig ...

func NewMockEndpointConfigCustomized Uses

func NewMockEndpointConfigCustomized(tlsEnabled, mutualTLSEnabled, errorCase bool) fab.EndpointConfig

NewMockEndpointConfigCustomized ...

func NewMockIdentity Uses

func NewMockIdentity(err error) (msp.Identity, error)

NewMockIdentity creates new mock identity

func NewMockIdentityConfig Uses

func NewMockIdentityConfig() msp.IdentityConfig

NewMockIdentityConfig ...

func NewMockIdentityConfigCustomized Uses

func NewMockIdentityConfigCustomized(tlsEnabled, mutualTLSEnabled, errorCase bool) msp.IdentityConfig

NewMockIdentityConfigCustomized ...

func NewMockIdentityManager Uses

func NewMockIdentityManager(opts ...UsersOption) msp.IdentityManager

NewMockIdentityManager Constructor for a identity manager.

func NewMockSigningIdentity Uses

func NewMockSigningIdentity() (msp.SigningIdentity, error)

NewMockSigningIdentity ...

func NewMockTransactionHeader Uses

func NewMockTransactionHeader(channelID string) (fab.TransactionHeader, error)

NewMockTransactionHeader creates mock TxnID based on mock user.

func NewRwSet Uses

func NewRwSet(ccID string) *rwsetutil.NsRwSet

NewRwSet returns a new read-write set for the given chaincode

func NewSimpleMockBlock Uses

func NewSimpleMockBlock() *common.Block

NewSimpleMockBlock returns a simple mock block

func NewSimpleMockError Uses

func NewSimpleMockError() error

NewSimpleMockError returns a error

type Channel Uses

type Channel struct {
    context.Client
    // contains filtered or unexported fields
}

Channel supplies the configuration for channel context client

func NewMockChannel Uses

func NewMockChannel(channelID string) (*Channel, error)

NewMockChannel creates new mock channel

func (*Channel) ChannelID Uses

func (c *Channel) ChannelID() string

ChannelID returns channel ID

func (*Channel) ChannelService Uses

func (c *Channel) ChannelService() fab.ChannelService

ChannelService returns channel service

func (*Channel) Providers Uses

func (c *Channel) Providers() context.Client

Providers returns core providers

type DeliverySession Uses

type DeliverySession struct {
    Deliveries     chan *common.Block
    DeliveryErrors chan error
    DeliveryQueue  chan interface{}
}

DeliverySession enables simulation of multiple calls to the orderer Each call is internally represented by a DeliverySession Note that SDK's orderer.SendDeliver function returns only upon the delivery channel is closed, so the only way to simulate multiple calls is to have each call handled by a separate delivery channel

func (*DeliverySession) Close Uses

func (s *DeliverySession) Close()

Close closes a delivery session

type LocalContext Uses

type LocalContext struct {
    *MockContext
    // contains filtered or unexported fields
}

LocalContext supplies the configuration for channel context client

func NewMockLocalContext Uses

func NewMockLocalContext(client *MockContext, discoveryProvider fab.LocalDiscoveryProvider) *LocalContext

NewMockLocalContext creates new mock local context

func (*LocalContext) LocalDiscoveryService Uses

func (c *LocalContext) LocalDiscoveryService() fab.DiscoveryService

LocalDiscoveryService returns the local discovery service

type MockBroadcastServer Uses

type MockBroadcastServer struct {
    DeliverError   error
    BroadcastError error
    Creds          credentials.TransportCredentials

    DeliverResponse         *po.DeliverResponse
    BroadcastCustomResponse *po.BroadcastResponse

    BroadcastInternalServerError bool
    // Use the MockBroadCastServer with either a common.Block or a pb.FilteredBlock channel (do not set both)
    Deliveries         chan *common.Block
    FilteredDeliveries chan *pb.FilteredBlock
    // contains filtered or unexported fields
}

MockBroadcastServer mock broadcast server

func (*MockBroadcastServer) Broadcast Uses

func (m *MockBroadcastServer) Broadcast(server po.AtomicBroadcast_BroadcastServer) error

Broadcast mock broadcast

func (*MockBroadcastServer) Deliver Uses

func (m *MockBroadcastServer) Deliver(server po.AtomicBroadcast_DeliverServer) error

Deliver mock deliver

func (*MockBroadcastServer) Start Uses

func (m *MockBroadcastServer) Start(address string) string

Start the mock broadcast server

func (*MockBroadcastServer) Stop Uses

func (m *MockBroadcastServer) Stop()

Stop the mock broadcast server and wait for completion.

type MockCAClient Uses

type MockCAClient struct {
}

MockCAClient is a mock CAClient

func (*MockCAClient) AddAffiliation Uses

func (mgr *MockCAClient) AddAffiliation(request *api.AffiliationRequest) (*api.AffiliationResponse, error)

AddAffiliation add affiliation

func (*MockCAClient) CreateIdentity Uses

func (mgr *MockCAClient) CreateIdentity(request *api.IdentityRequest) (*api.IdentityResponse, error)

CreateIdentity creates an identity

func (*MockCAClient) Enroll Uses

func (mgr *MockCAClient) Enroll(request *api.EnrollmentRequest) error

Enroll enrolls a user with a Fabric network

func (*MockCAClient) GetAffiliation Uses

func (mgr *MockCAClient) GetAffiliation(affiliation, caname string) (*api.AffiliationResponse, error)

GetAffiliation get an affiliation

func (*MockCAClient) GetAllAffiliations Uses

func (mgr *MockCAClient) GetAllAffiliations(caname string) (*api.AffiliationResponse, error)

GetAllAffiliations get all affiliations

func (*MockCAClient) GetAllIdentities Uses

func (mgr *MockCAClient) GetAllIdentities(caname string) ([]*api.IdentityResponse, error)

GetAllIdentities returns all identities that the caller is authorized to see

func (*MockCAClient) GetCAInfo Uses

func (mgr *MockCAClient) GetCAInfo() (*api.GetCAInfoResponse, error)

GetCAInfo returns generic CA information

func (*MockCAClient) GetIdentity Uses

func (mgr *MockCAClient) GetIdentity(id, caname string) (*api.IdentityResponse, error)

GetIdentity returns an identity by id

func (*MockCAClient) ModifyAffiliation Uses

func (mgr *MockCAClient) ModifyAffiliation(request *api.ModifyAffiliationRequest) (*api.AffiliationResponse, error)

ModifyAffiliation update an affiliation

func (*MockCAClient) ModifyIdentity Uses

func (mgr *MockCAClient) ModifyIdentity(request *api.IdentityRequest) (*api.IdentityResponse, error)

ModifyIdentity updates identity

func (*MockCAClient) Reenroll Uses

func (mgr *MockCAClient) Reenroll(request *api.ReenrollmentRequest) error

Reenroll re-enrolls a user

func (*MockCAClient) Register Uses

func (mgr *MockCAClient) Register(request *api.RegistrationRequest) (string, error)

Register registers a user with a Fabric network

func (*MockCAClient) RemoveAffiliation Uses

func (mgr *MockCAClient) RemoveAffiliation(request *api.AffiliationRequest) (*api.AffiliationResponse, error)

RemoveAffiliation remove an affiliation

func (*MockCAClient) RemoveIdentity Uses

func (mgr *MockCAClient) RemoveIdentity(request *api.RemoveIdentityRequest) (*api.IdentityResponse, error)

RemoveIdentity removes identity

func (*MockCAClient) Revoke Uses

func (mgr *MockCAClient) Revoke(request *api.RevocationRequest) (*api.RevocationResponse, error)

Revoke revokes a user

type MockChannelCfg Uses

type MockChannelCfg struct {
    MockID           string
    MockBlockNumber  uint64
    MockMSPs         []*msp.MSPConfig
    MockAnchorPeers  []*fab.OrgAnchorPeer
    MockOrderers     []string
    MockVersions     *fab.Versions
    MockMembership   fab.ChannelMembership
    MockCapabilities map[fab.ConfigGroupKey]map[string]bool
}

MockChannelCfg contains mock channel configuration

func NewMockChannelCfg Uses

func NewMockChannelCfg(id string) *MockChannelCfg

NewMockChannelCfg ...

func (*MockChannelCfg) AnchorPeers Uses

func (cfg *MockChannelCfg) AnchorPeers() []*fab.OrgAnchorPeer

AnchorPeers returns anchor peers

func (*MockChannelCfg) BlockNumber Uses

func (cfg *MockChannelCfg) BlockNumber() uint64

BlockNumber returns block number

func (*MockChannelCfg) HasCapability Uses

func (cfg *MockChannelCfg) HasCapability(group fab.ConfigGroupKey, capability string) bool

HasCapability indicates whether or not the given group has the given capability

func (*MockChannelCfg) ID Uses

func (cfg *MockChannelCfg) ID() string

ID returns name

func (*MockChannelCfg) MSPs Uses

func (cfg *MockChannelCfg) MSPs() []*msp.MSPConfig

MSPs returns msps

func (*MockChannelCfg) Orderers Uses

func (cfg *MockChannelCfg) Orderers() []string

Orderers returns orderers

func (*MockChannelCfg) Versions Uses

func (cfg *MockChannelCfg) Versions() *fab.Versions

Versions returns versions

type MockChannelConfig Uses

type MockChannelConfig struct {
    // contains filtered or unexported fields
}

MockChannelConfig mockcore query channel configuration

func NewMockChannelConfig Uses

func NewMockChannelConfig(ctx context.Client, channelID string) (*MockChannelConfig, error)

NewMockChannelConfig mockcore channel config implementation

func (*MockChannelConfig) Query Uses

func (c *MockChannelConfig) Query(reqCtx reqContext.Context) (fab.ChannelCfg, error)

Query mockcore query for channel configuration

func (*MockChannelConfig) QueryBlock Uses

func (c *MockChannelConfig) QueryBlock(reqCtx reqContext.Context) (*common.Block, error)

QueryBlock mockcore query for channel configuration block

type MockChannelContext Uses

type MockChannelContext struct {
    *MockContext

    Channel fab.ChannelService
    // contains filtered or unexported fields
}

MockChannelContext holds the client context plus channel-specific entities

func NewMockChannelContext Uses

func NewMockChannelContext(context *MockContext, channelID string) *MockChannelContext

NewMockChannelContext returns a new MockChannelContext

func (*MockChannelContext) ChannelID Uses

func (c *MockChannelContext) ChannelID() string

ChannelID returns the channel ID

func (*MockChannelContext) ChannelService Uses

func (c *MockChannelContext) ChannelService() fab.ChannelService

ChannelService returns the ChannelService

func (*MockChannelContext) GetMetrics Uses

func (c *MockChannelContext) GetMetrics() *metrics.ClientMetrics

GetMetrics not used in this mockcontext

type MockChannelProvider Uses

type MockChannelProvider struct {
    // contains filtered or unexported fields
}

MockChannelProvider holds a mock channel provider.

func NewMockChannelProvider Uses

func NewMockChannelProvider(ctx core.Providers) (*MockChannelProvider, error)

NewMockChannelProvider returns a mock ChannelProvider

func (*MockChannelProvider) ChannelService Uses

func (cp *MockChannelProvider) ChannelService(ctx fab.ClientContext, channelID string) (fab.ChannelService, error)

ChannelService returns a mock ChannelService

func (*MockChannelProvider) SetCustomChannelService Uses

func (cp *MockChannelProvider) SetCustomChannelService(customChannelService fab.ChannelService)

SetCustomChannelService sets custom channel service for unit-test purposes

type MockChannelService Uses

type MockChannelService struct {
    // contains filtered or unexported fields
}

MockChannelService holds a mock channel service.

func (*MockChannelService) ChannelConfig Uses

func (cs *MockChannelService) ChannelConfig() (fab.ChannelCfg, error)

ChannelConfig returns channel config

func (*MockChannelService) Config Uses

func (cs *MockChannelService) Config() (fab.ChannelConfig, error)

Config ...

func (*MockChannelService) Discovery Uses

func (cs *MockChannelService) Discovery() (fab.DiscoveryService, error)

Discovery returns a mock DiscoveryService

func (*MockChannelService) EventService Uses

func (cs *MockChannelService) EventService(opts ...options.Opt) (fab.EventService, error)

EventService returns a mock event service

func (*MockChannelService) Membership Uses

func (cs *MockChannelService) Membership() (fab.ChannelMembership, error)

Membership returns member identification

func (*MockChannelService) Selection Uses

func (cs *MockChannelService) Selection() (fab.SelectionService, error)

Selection returns a mock SelectionService

func (*MockChannelService) SetCustomMembership Uses

func (cs *MockChannelService) SetCustomMembership(customMembership fab.ChannelMembership)

SetCustomMembership sets custom channel membership for unit-test purposes

func (*MockChannelService) SetDiscovery Uses

func (cs *MockChannelService) SetDiscovery(discovery fab.DiscoveryService)

SetDiscovery sets the mock DiscoveryService

func (*MockChannelService) SetOrderers Uses

func (cs *MockChannelService) SetOrderers(orderers []string)

SetOrderers sets orderes to mock channel service for unit-test purposes

func (*MockChannelService) SetSelection Uses

func (cs *MockChannelService) SetSelection(selection fab.SelectionService)

SetSelection sets the mock SelectionService

func (*MockChannelService) SetTransactor Uses

func (cs *MockChannelService) SetTransactor(t fab.Transactor)

SetTransactor changes the return value of Transactor

func (*MockChannelService) Transactor Uses

func (cs *MockChannelService) Transactor(reqCtx reqContext.Context) (fab.Transactor, error)

Transactor returns a mock transactor

type MockConfig Uses

type MockConfig struct {
    CustomTLSCACertPool fab.CertPool
    // contains filtered or unexported fields
}

MockConfig ...

func (*MockConfig) CAClientCert Uses

func (c *MockConfig) CAClientCert(org string) ([]byte, bool)

CAClientCert Read configuration option for the fabric CA client cert for given org

func (*MockConfig) CAClientKey Uses

func (c *MockConfig) CAClientKey(org string) ([]byte, bool)

CAClientKey Read configuration option for the fabric CA client key for given org

func (*MockConfig) CAConfig Uses

func (c *MockConfig) CAConfig(org string) (*msp.CAConfig, bool)

CAConfig not implemented

func (*MockConfig) CAKeyStorePath Uses

func (c *MockConfig) CAKeyStorePath() string

CAKeyStorePath not implemented

func (*MockConfig) CAServerCerts Uses

func (c *MockConfig) CAServerCerts(org string) ([][]byte, bool)

CAServerCerts Read configuration option for the server certificates for given org

func (*MockConfig) ChannelConfig Uses

func (c *MockConfig) ChannelConfig(channelID string) *fab.ChannelEndpointConfig

ChannelConfig returns the channel configuration

func (*MockConfig) ChannelOrderers Uses

func (c *MockConfig) ChannelOrderers(name string) []fab.OrdererConfig

ChannelOrderers returns a list of channel orderers

func (*MockConfig) ChannelPeers Uses

func (c *MockConfig) ChannelPeers(name string) []fab.ChannelPeer

ChannelPeers returns the channel peers configuration

func (*MockConfig) Client Uses

func (c *MockConfig) Client() *msp.ClientConfig

Client ...

func (*MockConfig) CredentialStorePath Uses

func (c *MockConfig) CredentialStorePath() string

CredentialStorePath ...

func (*MockConfig) CryptoConfigPath Uses

func (c *MockConfig) CryptoConfigPath() string

CryptoConfigPath ...

func (*MockConfig) IsSecurityEnabled Uses

func (c *MockConfig) IsSecurityEnabled() bool

IsSecurityEnabled ...

func (*MockConfig) KeyStorePath Uses

func (c *MockConfig) KeyStorePath() string

KeyStorePath ...

func (*MockConfig) Lookup Uses

func (c *MockConfig) Lookup(key string) (interface{}, bool)

Lookup gets the Value from config file by Key

func (*MockConfig) NetworkConfig Uses

func (c *MockConfig) NetworkConfig() *fab.NetworkConfig

NetworkConfig not implemented

func (*MockConfig) NetworkPeers Uses

func (c *MockConfig) NetworkPeers() []fab.NetworkPeer

NetworkPeers returns the mock network peers configuration

func (*MockConfig) OrdererConfig Uses

func (c *MockConfig) OrdererConfig(name string) (*fab.OrdererConfig, bool)

OrdererConfig not implemented

func (*MockConfig) OrderersConfig Uses

func (c *MockConfig) OrderersConfig() []fab.OrdererConfig

OrderersConfig returns a list of defined orderers

func (*MockConfig) PeerConfig Uses

func (c *MockConfig) PeerConfig(nameOrURL string) (*fab.PeerConfig, bool)

PeerConfig Retrieves a specific peer from the configuration by org and name

func (*MockConfig) PeersConfig Uses

func (c *MockConfig) PeersConfig(org string) ([]fab.PeerConfig, bool)

PeersConfig Retrieves the fabric peers from the config file provided

func (*MockConfig) SecurityAlgorithm Uses

func (c *MockConfig) SecurityAlgorithm() string

SecurityAlgorithm ...

func (*MockConfig) SecurityLevel Uses

func (c *MockConfig) SecurityLevel() int

SecurityLevel ...

func (*MockConfig) SecurityProvider Uses

func (c *MockConfig) SecurityProvider() string

SecurityProvider ...

func (*MockConfig) SecurityProviderLabel Uses

func (c *MockConfig) SecurityProviderLabel() string

SecurityProviderLabel ...

func (*MockConfig) SecurityProviderLibPath Uses

func (c *MockConfig) SecurityProviderLibPath() string

SecurityProviderLibPath will be set only if provider is PKCS11

func (*MockConfig) SecurityProviderPin Uses

func (c *MockConfig) SecurityProviderPin() string

SecurityProviderPin ...

func (*MockConfig) SetCustomChannelConfig Uses

func (c *MockConfig) SetCustomChannelConfig(channelID string, config *fab.ChannelEndpointConfig)

SetCustomChannelConfig sets the config for the given channel

func (*MockConfig) SetCustomNetworkPeerCfg Uses

func (c *MockConfig) SetCustomNetworkPeerCfg(customNetworkPeerCfg []fab.NetworkPeer)

SetCustomNetworkPeerCfg sets custom orderer config for unit-tests

func (*MockConfig) SetCustomOrdererCfg Uses

func (c *MockConfig) SetCustomOrdererCfg(customOrdererCfg *fab.OrdererConfig)

SetCustomOrdererCfg sets custom orderer config for unit-tests

func (*MockConfig) SetCustomPeerCfg Uses

func (c *MockConfig) SetCustomPeerCfg(customPeerCfg *fab.PeerConfig)

SetCustomPeerCfg sets custom orderer config for unit-tests

func (*MockConfig) SetCustomRandomOrdererCfg Uses

func (c *MockConfig) SetCustomRandomOrdererCfg(customRandomOrdererCfg *fab.OrdererConfig)

SetCustomRandomOrdererCfg sets custom random orderer config for unit-tests

func (*MockConfig) SoftVerify Uses

func (c *MockConfig) SoftVerify() bool

SoftVerify flag

func (*MockConfig) TLSCACertPool Uses

func (c *MockConfig) TLSCACertPool() fab.CertPool

TLSCACertPool ...

func (*MockConfig) TLSClientCerts Uses

func (c *MockConfig) TLSClientCerts() []tls.Certificate

TLSClientCerts ...

func (*MockConfig) TcertBatchSize Uses

func (c *MockConfig) TcertBatchSize() int

TcertBatchSize ...

func (*MockConfig) Timeout Uses

func (c *MockConfig) Timeout(arg fab.TimeoutType) time.Duration

Timeout not implemented

type MockConfigBlockBuilder Uses

type MockConfigBlockBuilder struct {
    MockConfigGroupBuilder
    Index           uint64
    LastConfigIndex uint64
}

MockConfigBlockBuilder is used to build a mock Chain configuration block

func (*MockConfigBlockBuilder) Build Uses

func (b *MockConfigBlockBuilder) Build() *common.Block

Build creates a mock Chain configuration Block

type MockConfigGroupBuilder Uses

type MockConfigGroupBuilder struct {
    Version                 uint64
    ModPolicy               string
    OrdererAddress          string
    MSPNames                []string
    RootCA                  string
    Groups                  map[string]*common.ConfigGroup
    ChannelCapabilities     []string
    ApplicationCapabilities []string
    OrdererCapabilities     []string
    PolicyRefs              []string
}

MockConfigGroupBuilder is used to build a mock ConfigGroup

type MockConfigUpdateEnvelopeBuilder Uses

type MockConfigUpdateEnvelopeBuilder struct {
    MockConfigGroupBuilder
    ChannelID string
}

MockConfigUpdateEnvelopeBuilder builds a mock ConfigUpdateEnvelope

func (*MockConfigUpdateEnvelopeBuilder) Build Uses

func (b *MockConfigUpdateEnvelopeBuilder) Build() *common.Envelope

Build builds an Envelope that contains a mock ConfigUpdateEnvelope

func (*MockConfigUpdateEnvelopeBuilder) BuildBytes Uses

func (b *MockConfigUpdateEnvelopeBuilder) BuildBytes() []byte

BuildBytes builds an Envelope that contains a mock ConfigUpdateEnvelope and returns the marshaled bytes

func (*MockConfigUpdateEnvelopeBuilder) BuildConfigUpdateBytes Uses

func (b *MockConfigUpdateEnvelopeBuilder) BuildConfigUpdateBytes() []byte

BuildConfigUpdateBytes builds an mock ConfigUpdate returns the marshaled bytes

type MockContext Uses

type MockContext struct {
    *MockProviderContext
    SigningIdentity msp.SigningIdentity
}

MockContext holds core providers and identity to enable mocking.

func NewMockContext Uses

func NewMockContext(si msp.SigningIdentity) *MockContext

NewMockContext creates a MockContext consisting of defaults and an identity

func (MockContext) EnrollmentCertificate Uses

func (m MockContext) EnrollmentCertificate() []byte

EnrollmentCertificate Returns the underlying ECert representing this user’s identity.

func (MockContext) Identifier Uses

func (m MockContext) Identifier() *msp.IdentityIdentifier

Identifier returns the identifier of that identity

func (MockContext) PrivateKey Uses

func (m MockContext) PrivateKey() core.Key

PrivateKey returns the crypto suite representation of the private key

func (MockContext) PublicVersion Uses

func (m MockContext) PublicVersion() msp.Identity

PublicVersion returns the public parts of this identity

func (MockContext) Serialize Uses

func (m MockContext) Serialize() ([]byte, error)

Serialize converts an identity to bytes

func (MockContext) Sign Uses

func (m MockContext) Sign(msg []byte) ([]byte, error)

Sign the message

func (MockContext) Verify Uses

func (m MockContext) Verify(msg []byte, sig []byte) error

Verify a signature over some message using this identity as reference

type MockCryptoSuite Uses

type MockCryptoSuite struct {
}

MockCryptoSuite implementation

func (*MockCryptoSuite) GetHash Uses

func (m *MockCryptoSuite) GetHash(opts core.HashOpts) (hash.Hash, error)

GetHash mock get hash

func (*MockCryptoSuite) GetKey Uses

func (m *MockCryptoSuite) GetKey(ski []byte) (k core.Key, err error)

GetKey mock get key

func (*MockCryptoSuite) Hash Uses

func (m *MockCryptoSuite) Hash(msg []byte, opts core.HashOpts) (hash []byte, err error)

Hash mock hash

func (*MockCryptoSuite) KeyGen Uses

func (m *MockCryptoSuite) KeyGen(opts core.KeyGenOpts) (k core.Key, err error)

KeyGen mock key gen

func (*MockCryptoSuite) KeyImport Uses

func (m *MockCryptoSuite) KeyImport(raw interface{},
    opts core.KeyImportOpts) (k core.Key, err error)

KeyImport mock key import

func (*MockCryptoSuite) Sign Uses

func (m *MockCryptoSuite) Sign(k core.Key, digest []byte,
    opts core.SignerOpts) (signature []byte, err error)

Sign mock signing

func (*MockCryptoSuite) Verify Uses

func (m *MockCryptoSuite) Verify(k core.Key, signature, digest []byte, opts core.SignerOpts) (valid bool, err error)

Verify mock verify implementation

type MockEndorserServer Uses

type MockEndorserServer struct {
    Creds         credentials.TransportCredentials
    ProposalError error

    AddkvWrite bool
    // contains filtered or unexported fields
}

MockEndorserServer mock endoreser server to process endorsement proposals

func (*MockEndorserServer) ProcessProposal Uses

func (m *MockEndorserServer) ProcessProposal(context context.Context,
    proposal *pb.SignedProposal) (*pb.ProposalResponse, error)

ProcessProposal mock implementation that returns success if error is not set error if it is

func (*MockEndorserServer) Start Uses

func (m *MockEndorserServer) Start(address string) string

Start the mock broadcast server

func (*MockEndorserServer) Stop Uses

func (m *MockEndorserServer) Stop()

Stop the mock broadcast server and wait for completion.

type MockEventService Uses

type MockEventService struct {
    TxStatusRegCh    chan *dispatcher.TxStatusReg
    TxValidationCode pb.TxValidationCode
    Timeout          bool
}

MockEventService implements a mock event service

func NewMockEventService Uses

func NewMockEventService() *MockEventService

NewMockEventService returns a new mock event service

func (*MockEventService) RegisterBlockEvent Uses

func (m *MockEventService) RegisterBlockEvent(filter ...fab.BlockFilter) (fab.Registration, <-chan *fab.BlockEvent, error)

RegisterBlockEvent registers for block events.

func (*MockEventService) RegisterChaincodeEvent Uses

func (m *MockEventService) RegisterChaincodeEvent(ccID, eventFilter string) (fab.Registration, <-chan *fab.CCEvent, error)

RegisterChaincodeEvent registers for chaincode events.

func (*MockEventService) RegisterFilteredBlockEvent Uses

func (m *MockEventService) RegisterFilteredBlockEvent() (fab.Registration, <-chan *fab.FilteredBlockEvent, error)

RegisterFilteredBlockEvent registers for filtered block events.

func (*MockEventService) RegisterTxStatusEvent Uses

func (m *MockEventService) RegisterTxStatusEvent(txID string) (fab.Registration, <-chan *fab.TxStatusEvent, error)

RegisterTxStatusEvent registers for transaction status events.

func (*MockEventService) Unregister Uses

func (m *MockEventService) Unregister(reg fab.Registration)

Unregister removes the given registration.

type MockGrpcOrderer Uses

type MockGrpcOrderer struct {
    Creds credentials.TransportCredentials

    OrdererURL string
    // contains filtered or unexported fields
}

MockGrpcOrderer is a mock fabricclient.Orderer to test connectivity to the orderer. It only wraps a GRPC server. Note that calling broadcast doesn't deliver anythng. This implies that the broadcast side and the deliver side are totally independent from the mocking point of view.

func NewMockGrpcOrderer Uses

func NewMockGrpcOrderer(url string, tls credentials.TransportCredentials) *MockGrpcOrderer

NewMockGrpcOrderer will create a new instance for the given url and TLS credentials (optional)

func (*MockGrpcOrderer) SendBroadcast Uses

func (o *MockGrpcOrderer) SendBroadcast(ctx reqContext.Context, envelope *fab.SignedEnvelope) (*common.Status, error)

SendBroadcast accepts client broadcast calls and attempts connection to the grpc server it does not attempt to broadcast the envelope, it only tries to connect to the server

func (*MockGrpcOrderer) SendDeliver Uses

func (o *MockGrpcOrderer) SendDeliver(ctx reqContext.Context, envelope *fab.SignedEnvelope) (chan *common.Block, chan error)

SendDeliver is not used and can be implemented for special GRPC connectivity in the future

func (*MockGrpcOrderer) Start Uses

func (o *MockGrpcOrderer) Start() string

Start with start the underlying GRPC server for this MockGrpcOrderer it updates the OrdererUrl with the address returned by the GRPC server

func (*MockGrpcOrderer) Stop Uses

func (o *MockGrpcOrderer) Stop()

Stop the mock broadcast server and wait for completion.

func (*MockGrpcOrderer) URL Uses

func (o *MockGrpcOrderer) URL() string

URL returns the URL of the mock GRPC Orderer

type MockIdentity Uses

type MockIdentity struct {
    Err error
}

MockIdentity implements identity

func (*MockIdentity) Anonymous Uses

func (id *MockIdentity) Anonymous() bool

Anonymous ...

func (*MockIdentity) ExpiresAt Uses

func (id *MockIdentity) ExpiresAt() time.Time

ExpiresAt returns the time at which the Identity expires.

func (*MockIdentity) GetIdentifier Uses

func (id *MockIdentity) GetIdentifier() *msp.IdentityIdentifier

GetIdentifier returns the identifier (MSPID/IDID) for this instance

func (*MockIdentity) GetMSPIdentifier Uses

func (id *MockIdentity) GetMSPIdentifier() string

GetMSPIdentifier returns the MSP identifier for this instance

func (*MockIdentity) GetOrganizationalUnits Uses

func (id *MockIdentity) GetOrganizationalUnits() []*msp.OUIdentifier

GetOrganizationalUnits returns the OU for this instance

func (*MockIdentity) SatisfiesPrincipal Uses

func (id *MockIdentity) SatisfiesPrincipal(principal *msp_protos.MSPPrincipal) error

SatisfiesPrincipal returns null if this instance matches the supplied principal or an error otherwise

func (*MockIdentity) Serialize Uses

func (id *MockIdentity) Serialize() ([]byte, error)

Serialize returns a byte array representation of this identity

func (*MockIdentity) Validate Uses

func (id *MockIdentity) Validate() error

Validate returns nil if this instance is a valid identity or an error otherwise

func (*MockIdentity) Verify Uses

func (id *MockIdentity) Verify(msg []byte, sig []byte) error

Verify checks against a signature and a message to determine whether this identity produced the signature; it returns nil if so or an error otherwise

type MockIdentityManager Uses

type MockIdentityManager struct {
    // contains filtered or unexported fields
}

MockIdentityManager is a mock IdentityManager

func (*MockIdentityManager) CreateSigningIdentity Uses

func (mgr *MockIdentityManager) CreateSigningIdentity(opts ...msp.SigningIdentityOption) (msp.SigningIdentity, error)

CreateSigningIdentity creates a signing identity with the given options

func (*MockIdentityManager) GetSigningIdentity Uses

func (mgr *MockIdentityManager) GetSigningIdentity(id string) (msp.SigningIdentity, error)

GetSigningIdentity will return an identity that can be used to cryptographically sign an object

type MockInfraProvider Uses

type MockInfraProvider struct {
    // contains filtered or unexported fields
}

MockInfraProvider represents the default implementation of Fabric objects.

func (*MockInfraProvider) Close Uses

func (f *MockInfraProvider) Close()

Close mock close function

func (*MockInfraProvider) CommManager Uses

func (f *MockInfraProvider) CommManager() fab.CommManager

CommManager returns comm provider

func (*MockInfraProvider) CreateChannelCfg Uses

func (f *MockInfraProvider) CreateChannelCfg(ctx fab.ClientContext, name string) (fab.ChannelCfg, error)

CreateChannelCfg creates the channel configuration

func (*MockInfraProvider) CreateChannelConfig Uses

func (f *MockInfraProvider) CreateChannelConfig(channelID string) (fab.ChannelConfig, error)

CreateChannelConfig initializes the channel config

func (*MockInfraProvider) CreateChannelMembership Uses

func (f *MockInfraProvider) CreateChannelMembership(ctx fab.ClientContext, channel string) (fab.ChannelMembership, error)

CreateChannelMembership returns a channel member identifier

func (*MockInfraProvider) CreateEventService Uses

func (f *MockInfraProvider) CreateEventService(ic fab.ClientContext, channelID string, opts ...options.Opt) (fab.EventService, error)

CreateEventService creates the event service.

func (*MockInfraProvider) CreateOrdererFromConfig Uses

func (f *MockInfraProvider) CreateOrdererFromConfig(cfg *fab.OrdererConfig) (fab.Orderer, error)

CreateOrdererFromConfig creates a default implementation of Orderer based on configuration.

func (*MockInfraProvider) CreatePeerFromConfig Uses

func (f *MockInfraProvider) CreatePeerFromConfig(peerCfg *fab.NetworkPeer) (fab.Peer, error)

CreatePeerFromConfig returns a new default implementation of Peer based configuration

func (*MockInfraProvider) SetCustomOrderer Uses

func (f *MockInfraProvider) SetCustomOrderer(customOrderer fab.Orderer)

SetCustomOrderer creates a default implementation of Orderer based on configuration.

type MockMSP Uses

type MockMSP struct {
    Err error
}

MockMSP implements mock msp

func NewMockMSP Uses

func NewMockMSP(err error) *MockMSP

NewMockMSP creates mock msp

func (*MockMSP) DeserializeIdentity Uses

func (m *MockMSP) DeserializeIdentity(serializedIdentity []byte) (msp.Identity, error)

DeserializeIdentity mockcore deserialize identity

func (*MockMSP) GetDefaultSigningIdentity Uses

func (m *MockMSP) GetDefaultSigningIdentity() (msp.SigningIdentity, error)

GetDefaultSigningIdentity returns the default signing identity

func (*MockMSP) GetIdentifier Uses

func (m *MockMSP) GetIdentifier() (string, error)

GetIdentifier returns the provider identifier

func (*MockMSP) GetMSPs Uses

func (m *MockMSP) GetMSPs() (map[string]msp.MSP, error)

GetMSPs Provides a list of Membership Service providers

func (*MockMSP) GetSigningIdentity Uses

func (m *MockMSP) GetSigningIdentity(identifier *msp.IdentityIdentifier) (msp.SigningIdentity, error)

GetSigningIdentity returns a signing identity corresponding to the provided identifier

func (*MockMSP) GetTLSIntermediateCerts Uses

func (m *MockMSP) GetTLSIntermediateCerts() [][]byte

GetTLSIntermediateCerts returns the TLS intermediate root certificates for this MSP

func (*MockMSP) GetTLSRootCerts Uses

func (m *MockMSP) GetTLSRootCerts() [][]byte

GetTLSRootCerts returns the TLS root certificates for this MSP

func (*MockMSP) GetType Uses

func (m *MockMSP) GetType() msp.ProviderType

GetType returns the provider type

func (*MockMSP) GetVersion Uses

func (m *MockMSP) GetVersion() msp.MSPVersion

GetVersion returns the version of this MSP

func (*MockMSP) IsWellFormed Uses

func (m *MockMSP) IsWellFormed(identity *msp_protos.SerializedIdentity) error

IsWellFormed checks if the given identity can be deserialized into its provider-specific form

func (*MockMSP) SatisfiesPrincipal Uses

func (m *MockMSP) SatisfiesPrincipal(id msp.Identity, principal *msp_protos.MSPPrincipal) error

SatisfiesPrincipal checks whether the identity matches the description supplied in MSPPrincipal.

func (*MockMSP) Setup Uses

func (m *MockMSP) Setup(config *msp_protos.MSPConfig) error

Setup the MSP instance according to configuration information

func (*MockMSP) Validate Uses

func (m *MockMSP) Validate(id msp.Identity) error

Validate checks whether the supplied identity is valid

type MockMSPManager Uses

type MockMSPManager struct {
    MSPs map[string]msp.MSP
    Err  error
}

MockMSPManager implements mock msp manager

func NewMockMSPManager Uses

func NewMockMSPManager(msps map[string]msp.MSP) *MockMSPManager

NewMockMSPManager mockcore msp manager

func NewMockMSPManagerWithError Uses

func NewMockMSPManagerWithError(msps map[string]msp.MSP, err error) *MockMSPManager

NewMockMSPManagerWithError mockcore msp manager

func (*MockMSPManager) DeserializeIdentity Uses

func (mgr *MockMSPManager) DeserializeIdentity(serializedIdentity []byte) (msp.Identity, error)

DeserializeIdentity mockcore deserialize identity

func (*MockMSPManager) GetMSPs Uses

func (mgr *MockMSPManager) GetMSPs() (map[string]msp.MSP, error)

GetMSPs Provides a list of Membership Service providers

func (*MockMSPManager) IsWellFormed Uses

func (mgr *MockMSPManager) IsWellFormed(identity *msp_protos.SerializedIdentity) error

IsWellFormed checks if the given identity can be deserialized into its provider-specific form

func (*MockMSPManager) Setup Uses

func (mgr *MockMSPManager) Setup(msps []msp.MSP) error

Setup the MSP manager instance according to configuration information

type MockMembership Uses

type MockMembership struct {
    ValidateErr error
    VerifyErr   error
    // contains filtered or unexported fields
}

MockMembership mock member id

func NewMockMembership Uses

func NewMockMembership() *MockMembership

NewMockMembership new mock member id

func NewMockMembershipWithMSPFilter Uses

func NewMockMembershipWithMSPFilter(mspsToBeExlcluded []string) *MockMembership

NewMockMembershipWithMSPFilter return new mock membership where given MSPs will be excluded for ContainsMSP test

func (*MockMembership) ContainsMSP Uses

func (m *MockMembership) ContainsMSP(msp string) bool

ContainsMSP mocks membership.ContainsMSP

func (*MockMembership) Validate Uses

func (m *MockMembership) Validate(serializedID []byte) error

Validate if the given ID was issued by the channel's members

func (*MockMembership) Verify Uses

func (m *MockMembership) Verify(serializedID []byte, msg []byte, sig []byte) error

Verify the given signature

type MockOrderer Uses

type MockOrderer struct {
    OrdererURL        string
    BroadcastListener chan *fab.SignedEnvelope
    BroadcastErrors   chan error
    // These queues are used to detach the client, to avoid deadlocks
    BroadcastQueue        chan *fab.SignedEnvelope
    DeliverySessions      chan *DeliverySession
    DeliverySessionsQueue chan *DeliverySession
}

MockOrderer is a mock fabricclient.Orderer Note that calling broadcast doesn't deliver anythng. This implies that the broadcast side and the deliver side are totally independent from the mocking point of view.

func NewMockOrderer Uses

func NewMockOrderer(url string, broadcastListener chan *fab.SignedEnvelope) *MockOrderer

NewMockOrderer ...

func (*MockOrderer) CloseQueue Uses

func (o *MockOrderer) CloseQueue()

CloseQueue ends the mock broadcast and delivery queues

func (*MockOrderer) EnqueueForSendDeliver Uses

func (o *MockOrderer) EnqueueForSendDeliver(values ...interface{})

EnqueueForSendDeliver enqueues mock values for delivery Each call to this function will prepare orderer to handle exactly one (subsequent) call to SendDeliver

func (*MockOrderer) EnqueueSendBroadcastError Uses

func (o *MockOrderer) EnqueueSendBroadcastError(err error)

EnqueueSendBroadcastError enqueues error

func (*MockOrderer) SendBroadcast Uses

func (o *MockOrderer) SendBroadcast(ctx reqContext.Context, envelope *fab.SignedEnvelope) (*common.Status, error)

SendBroadcast accepts client broadcast calls and reports them to the listener channel Returns the first enqueued error, or nil if there are no enqueued errors

func (*MockOrderer) SendDeliver Uses

func (o *MockOrderer) SendDeliver(ctx reqContext.Context, envelope *fab.SignedEnvelope) (chan *common.Block, chan error)

SendDeliver returns the channels for delivery of prepared mock values and errors (if any)

func (*MockOrderer) URL Uses

func (o *MockOrderer) URL() string

URL returns the URL of the mock Orderer

type MockPeer Uses

type MockPeer struct {
    RWLock               *sync.RWMutex
    Error                error
    MockName             string
    MockURL              string
    MockRoles            []string
    MockCert             *pem.Block
    Payload              []byte
    ResponseMessage      string
    MockMSP              string
    Status               int32
    ProcessProposalCalls int
    Endorser             []byte
    ChaincodeID          string
    RwSets               []*rwsetutil.NsRwSet
}

MockPeer is a mock fabricsdk.Peer.

func NewMockPeer Uses

func NewMockPeer(name string, url string) *MockPeer

NewMockPeer creates basic mock peer

func (*MockPeer) EnrollmentCertificate Uses

func (p *MockPeer) EnrollmentCertificate() *pem.Block

EnrollmentCertificate returns the mock peer's mock enrollment certificate

func (*MockPeer) MSPID Uses

func (p *MockPeer) MSPID() string

MSPID gets the Peer mspID.

func (*MockPeer) Name Uses

func (p *MockPeer) Name() string

Name returns the mock peer's mock name

func (*MockPeer) ProcessTransactionProposal Uses

func (p *MockPeer) ProcessTransactionProposal(ctx reqContext.Context, tp fab.ProcessProposalRequest) (*fab.TransactionProposalResponse, error)

ProcessTransactionProposal does not send anything anywhere but returns an empty mock ProposalResponse

func (*MockPeer) Roles Uses

func (p *MockPeer) Roles() []string

Roles returns the mock peer's mock roles

func (*MockPeer) SetChaincodeID Uses

func (p *MockPeer) SetChaincodeID(ccID string)

SetChaincodeID sets the ID of the chaincode that was invoked. This ID will be set in the ChaincodeAction of the proposal response payload.

func (*MockPeer) SetEnrollmentCertificate Uses

func (p *MockPeer) SetEnrollmentCertificate(pem *pem.Block)

SetEnrollmentCertificate sets the mock peer's mock enrollment certificate

func (*MockPeer) SetMSPID Uses

func (p *MockPeer) SetMSPID(mspID string)

SetMSPID sets the Peer mspID.

func (*MockPeer) SetName Uses

func (p *MockPeer) SetName(name string)

SetName sets the mock peer's mock name

func (*MockPeer) SetRoles Uses

func (p *MockPeer) SetRoles(roles []string)

SetRoles sets the mock peer's mock roles

func (*MockPeer) SetRwSets Uses

func (p *MockPeer) SetRwSets(rwSets ...*rwsetutil.NsRwSet)

SetRwSets sets the read-write sets that will be set in the proposal response payload

func (*MockPeer) URL Uses

func (p *MockPeer) URL() string

URL returns the mock peer's mock URL

type MockProviderContext Uses

type MockProviderContext struct {
    // contains filtered or unexported fields
}

MockProviderContext holds core providers to enable mocking.

func NewMockProviderContext Uses

func NewMockProviderContext(userOpts ...ProviderOption) *MockProviderContext

NewMockProviderContext creates a MockProviderContext consisting of defaults

func NewMockProviderContextCustom Uses

func NewMockProviderContextCustom(cryptoConfig core.CryptoSuiteConfig, endpointConfig fab.EndpointConfig, identityConfig msp.IdentityConfig, cryptoSuite core.CryptoSuite, signer core.SigningManager, userStore msp.UserStore, identityManager map[string]msp.IdentityManager) *MockProviderContext

NewMockProviderContextCustom creates a MockProviderContext consisting of the arguments

func (*MockProviderContext) ChannelProvider Uses

func (pc *MockProviderContext) ChannelProvider() fab.ChannelProvider

ChannelProvider returns channel provider

func (*MockProviderContext) CryptoSuite Uses

func (pc *MockProviderContext) CryptoSuite() core.CryptoSuite

CryptoSuite returns the mock crypto suite.

func (*MockProviderContext) CryptoSuiteConfig Uses

func (pc *MockProviderContext) CryptoSuiteConfig() core.CryptoSuiteConfig

CryptoSuiteConfig ...

func (*MockProviderContext) EndpointConfig Uses

func (pc *MockProviderContext) EndpointConfig() fab.EndpointConfig

EndpointConfig returns mock end point config

func (*MockProviderContext) GetMetrics Uses

func (pc *MockProviderContext) GetMetrics() *metrics.ClientMetrics

GetMetrics not used in this mockcontext

func (*MockProviderContext) IdentityConfig Uses

func (pc *MockProviderContext) IdentityConfig() msp.IdentityConfig

IdentityConfig returns the Identity config

func (*MockProviderContext) IdentityManager Uses

func (pc *MockProviderContext) IdentityManager(orgName string) (msp.IdentityManager, bool)

IdentityManager returns the identity manager

func (*MockProviderContext) InfraProvider Uses

func (pc *MockProviderContext) InfraProvider() fab.InfraProvider

InfraProvider returns fabric provider

func (*MockProviderContext) LocalDiscoveryProvider Uses

func (pc *MockProviderContext) LocalDiscoveryProvider() fab.LocalDiscoveryProvider

LocalDiscoveryProvider returns a local discovery provider

func (*MockProviderContext) PrivateKey Uses

func (pc *MockProviderContext) PrivateKey() core.Key

PrivateKey returns the crypto suite representation of the private key

func (*MockProviderContext) PublicVersion Uses

func (pc *MockProviderContext) PublicVersion() msp.Identity

PublicVersion returns the public parts of this identity

func (*MockProviderContext) SetCryptoSuiteConfig Uses

func (pc *MockProviderContext) SetCryptoSuiteConfig(config core.CryptoSuiteConfig)

SetCryptoSuiteConfig sets the mock cryptosuite configuration.

func (*MockProviderContext) SetCustomChannelProvider Uses

func (pc *MockProviderContext) SetCustomChannelProvider(customChannelProvider fab.ChannelProvider)

SetCustomChannelProvider sets custom channel provider for unit-test purposes

func (*MockProviderContext) SetCustomInfraProvider Uses

func (pc *MockProviderContext) SetCustomInfraProvider(customInfraProvider fab.InfraProvider)

SetCustomInfraProvider sets custom fabric provider for unit-test purposes

func (*MockProviderContext) SetEndpointConfig Uses

func (pc *MockProviderContext) SetEndpointConfig(config fab.EndpointConfig)

SetEndpointConfig sets the mock endpoint configuration.

func (*MockProviderContext) SetIdentityConfig Uses

func (pc *MockProviderContext) SetIdentityConfig(config msp.IdentityConfig)

SetIdentityConfig sets the mock msp identity configuration.

func (*MockProviderContext) Sign Uses

func (pc *MockProviderContext) Sign(msg []byte) ([]byte, error)

Sign the message

func (*MockProviderContext) SigningManager Uses

func (pc *MockProviderContext) SigningManager() core.SigningManager

SigningManager returns the mock signing manager.

func (*MockProviderContext) UserStore Uses

func (pc *MockProviderContext) UserStore() msp.UserStore

UserStore returns the mock usser store

type MockSelectionService Uses

type MockSelectionService struct {
    Error error
    Peers []fab.Peer
}

MockSelectionService implements mock selection service

func NewMockSelectionService Uses

func NewMockSelectionService(err error, peers ...fab.Peer) *MockSelectionService

NewMockSelectionService returns mock selection service

func (*MockSelectionService) GetEndorsersForChaincode Uses

func (ds *MockSelectionService) GetEndorsersForChaincode(chaincodes []*fab.ChaincodeCall, opts ...options.Opt) ([]fab.Peer, error)

GetEndorsersForChaincode mockcore retrieving endorsing peers

type MockSigningIdentity Uses

type MockSigningIdentity struct {
    // we embed everything from a base identity
    MockIdentity

    // signer corresponds to the object that can produce signatures from this identity
    Signer crypto.Signer
}

MockSigningIdentity ...

func (*MockSigningIdentity) GetPublicVersion Uses

func (id *MockSigningIdentity) GetPublicVersion() msp.Identity

GetPublicVersion ...

func (*MockSigningIdentity) Sign Uses

func (id *MockSigningIdentity) Sign(msg []byte) ([]byte, error)

Sign produces a signature over msg, signed by this instance

type MockStaticDiscoveryProvider Uses

type MockStaticDiscoveryProvider struct {
    Error error
    Peers []fab.Peer
    // contains filtered or unexported fields
}

MockStaticDiscoveryProvider implements mock discovery provider

func NewMockDiscoveryProvider Uses

func NewMockDiscoveryProvider(err error, peers []fab.Peer) *MockStaticDiscoveryProvider

NewMockDiscoveryProvider returns mock discovery provider

func (*MockStaticDiscoveryProvider) CreateLocalDiscoveryService Uses

func (dp *MockStaticDiscoveryProvider) CreateLocalDiscoveryService(mspID string) (fab.DiscoveryService, error)

CreateLocalDiscoveryService return local discovery service

func (*MockStaticDiscoveryProvider) SetCustomDiscoveryService Uses

func (dp *MockStaticDiscoveryProvider) SetCustomDiscoveryService(customDiscoveryService fab.DiscoveryService)

SetCustomDiscoveryService sets custom discoveryService

type MockStaticDiscoveryService Uses

type MockStaticDiscoveryService struct {
    Error error
    Peers []fab.Peer
}

MockStaticDiscoveryService implements mock discovery service

func NewMockDiscoveryService Uses

func NewMockDiscoveryService(err error, peers ...fab.Peer) *MockStaticDiscoveryService

NewMockDiscoveryService returns a new MockStaticDiscoveryService

func (*MockStaticDiscoveryService) GetPeers Uses

func (ds *MockStaticDiscoveryService) GetPeers() ([]fab.Peer, error)

GetPeers is used to discover eligible peers for chaincode

type MockTransactionHeader Uses

type MockTransactionHeader struct {
    MockID        fab.TransactionID
    MockCreator   []byte
    MockNonce     []byte
    MockChannelID string
}

MockTransactionHeader supplies a transaction ID and metadata.

func (*MockTransactionHeader) ChannelID Uses

func (th *MockTransactionHeader) ChannelID() string

ChannelID returns the transaction's target channel identifier.

func (*MockTransactionHeader) Creator Uses

func (th *MockTransactionHeader) Creator() []byte

Creator returns the transaction creator's identity bytes.

func (*MockTransactionHeader) Nonce Uses

func (th *MockTransactionHeader) Nonce() []byte

Nonce returns the transaction's generated nonce.

func (*MockTransactionHeader) TransactionID Uses

func (th *MockTransactionHeader) TransactionID() fab.TransactionID

TransactionID returns the transaction's computed identifier.

type MockTransactor Uses

type MockTransactor struct {
    Ctx       reqContex.Context
    ChannelID string
    Orderers  []fab.Orderer
}

MockTransactor provides an implementation of Transactor that exposes all its context.

func (*MockTransactor) CreateTransaction Uses

func (t *MockTransactor) CreateTransaction(request fab.TransactionRequest) (*fab.Transaction, error)

CreateTransaction create a transaction with proposal response.

func (*MockTransactor) CreateTransactionHeader Uses

func (t *MockTransactor) CreateTransactionHeader(opts ...fab.TxnHeaderOpt) (fab.TransactionHeader, error)

CreateTransactionHeader creates a Transaction Header based on the current context.

func (*MockTransactor) SendTransaction Uses

func (t *MockTransactor) SendTransaction(tx *fab.Transaction) (*fab.TransactionResponse, error)

SendTransaction send a transaction to the chain’s orderer service (one or more orderer endpoints) for consensus and committing to the ledger.

func (*MockTransactor) SendTransactionProposal Uses

func (t *MockTransactor) SendTransactionProposal(proposal *fab.TransactionProposal, targets []fab.ProposalProcessor) ([]*fab.TransactionProposalResponse, error)

SendTransactionProposal sends a TransactionProposal to the target peers.

type ProviderOption Uses

type ProviderOption func(*ProviderUsersOptions) error

ProviderOption describes a functional parameter for the New constructor

func WithProviderUser Uses

func WithProviderUser(username string, org string) ProviderOption

WithProviderUser option

type ProviderUsersOptions Uses

type ProviderUsersOptions struct {
    // contains filtered or unexported fields
}

ProviderUsersOptions ...

type UsersOption Uses

type UsersOption func(*UsersOptions) error

UsersOption describes a functional parameter for the New constructor

func WithUser Uses

func WithUser(username string, org string) UsersOption

WithUser option

func WithUsers Uses

func WithUsers(users map[string]msp.SigningIdentity) UsersOption

WithUsers option

type UsersOptions Uses

type UsersOptions struct {
    // contains filtered or unexported fields
}

UsersOptions holds optional users

Package mocks imports 49 packages (graph) and is imported by 5 packages. Updated 2019-09-12. Refresh now. Tools for package owners.