github.com/yacovm/fabric@v2.0.0-alpha.0.20191128145320-c5d4087dc723+incompatible/common/mocks/config/application.go (about) 1 /* 2 Copyright IBM Corp. 2017 All Rights Reserved. 3 4 SPDX-License-Identifier: Apache-2.0 5 */ 6 7 package config 8 9 import ( 10 "github.com/hyperledger/fabric/common/channelconfig" 11 ) 12 13 type MockApplication struct { 14 CapabilitiesRv channelconfig.ApplicationCapabilities 15 Acls map[string]string 16 } 17 18 func (m *MockApplication) Organizations() map[string]channelconfig.ApplicationOrg { 19 return nil 20 } 21 22 func (m *MockApplication) Capabilities() channelconfig.ApplicationCapabilities { 23 return m.CapabilitiesRv 24 } 25 26 func (m *MockApplication) PolicyRefForAPI(apiName string) string { 27 if m.Acls == nil { 28 return "" 29 } 30 return m.Acls[apiName] 31 } 32 33 // Returns the mock which itself is a provider 34 func (m *MockApplication) APIPolicyMapper() channelconfig.PolicyMapper { 35 return m 36 } 37 38 type MockApplicationCapabilities struct { 39 SupportedRv error 40 ForbidDuplicateTXIdInBlockRv bool 41 ACLsRv bool 42 PrivateChannelDataRv bool 43 CollectionUpgradeRv bool 44 V1_1ValidationRv bool 45 V1_2ValidationRv bool 46 LifecycleV20Rv bool 47 KeyLevelEndorsementRv bool 48 V1_3ValidationRv bool 49 V2_0ValidationRv bool 50 StorePvtDataOfInvalidTxRv bool 51 } 52 53 func (mac *MockApplicationCapabilities) Supported() error { 54 return mac.SupportedRv 55 } 56 57 func (mac *MockApplicationCapabilities) ForbidDuplicateTXIdInBlock() bool { 58 return mac.ForbidDuplicateTXIdInBlockRv 59 } 60 61 func (mac *MockApplicationCapabilities) ACLs() bool { 62 return mac.ACLsRv 63 } 64 65 func (mac *MockApplicationCapabilities) PrivateChannelData() bool { 66 return mac.PrivateChannelDataRv 67 } 68 69 func (mac *MockApplicationCapabilities) CollectionUpgrade() bool { 70 return mac.CollectionUpgradeRv 71 } 72 73 func (mac *MockApplicationCapabilities) V1_1Validation() bool { 74 return mac.V1_1ValidationRv 75 } 76 77 func (mac *MockApplicationCapabilities) V1_2Validation() bool { 78 return mac.V1_2ValidationRv 79 } 80 81 func (mac *MockApplicationCapabilities) LifecycleV20() bool { 82 return mac.LifecycleV20Rv 83 } 84 85 func (mac *MockApplicationCapabilities) MetadataLifecycle() bool { 86 return false 87 } 88 89 func (mac *MockApplicationCapabilities) KeyLevelEndorsement() bool { 90 return mac.KeyLevelEndorsementRv 91 } 92 93 func (mac *MockApplicationCapabilities) V1_3Validation() bool { 94 return mac.V1_3ValidationRv 95 } 96 97 func (mac *MockApplicationCapabilities) V2_0Validation() bool { 98 return mac.V2_0ValidationRv 99 } 100 101 func (mac *MockApplicationCapabilities) StorePvtDataOfInvalidTx() bool { 102 return mac.StorePvtDataOfInvalidTxRv 103 }