From 9563e6e2c420ce75000a548f460e013b7a287c25 Mon Sep 17 00:00:00 2001 From: Sam Yuan Date: Sun, 11 Jun 2023 12:12:02 +0800 Subject: [PATCH 1/2] decouple from sdk and upgrade to protos v2 Signed-off-by: Sam Yuan --- cmd/commands/chaincode/chaincode.go | 4 +- cmd/commands/chaincode/chaincode_test.go | 124 -- cmd/commands/chaincode/events_test.go | 174 -- cmd/commands/chaincode/install.go | 14 +- cmd/commands/chaincode/install_test.go | 215 --- cmd/commands/chaincode/instantiate.go | 18 +- cmd/commands/chaincode/instantiate_test.go | 198 -- cmd/commands/chaincode/invoke.go | 8 +- cmd/commands/chaincode/invoke_test.go | 166 -- cmd/commands/chaincode/list.go | 7 +- cmd/commands/chaincode/list_test.go | 185 -- cmd/commands/chaincode/package.go | 7 +- cmd/commands/chaincode/query.go | 8 +- cmd/commands/chaincode/query_test.go | 155 -- cmd/commands/chaincode/upgrade.go | 18 +- cmd/commands/chaincode/upgrade_test.go | 198 -- cmd/commands/channel/channel.go | 4 +- cmd/commands/channel/channel_test.go | 108 -- cmd/commands/channel/config_test.go | 173 -- cmd/commands/channel/create.go | 7 +- cmd/commands/channel/create_test.go | 169 -- cmd/commands/channel/join.go | 6 +- cmd/commands/channel/join_test.go | 172 -- cmd/commands/channel/list.go | 7 +- cmd/commands/channel/list_test.go | 157 -- cmd/commands/channel/update.go | 7 +- cmd/commands/channel/update_test.go | 169 -- cmd/commands/common/common.go | 21 +- cmd/commands/lifecycle/approve.go | 21 +- cmd/commands/lifecycle/approve_test.go | 241 --- .../lifecycle/checkcommitreadiness.go | 11 +- .../lifecycle/checkcommitreadiness_test.go | 243 --- cmd/commands/lifecycle/commit.go | 7 +- cmd/commands/lifecycle/commit_test.go | 226 --- cmd/commands/lifecycle/getinstalledpkg.go | 7 +- .../lifecycle/getinstalledpkg_test.go | 208 --- cmd/commands/lifecycle/install.go | 9 +- cmd/commands/lifecycle/install_test.go | 233 --- cmd/commands/lifecycle/lifecycle.go | 4 +- cmd/commands/lifecycle/lifecycle_test.go | 126 -- cmd/commands/lifecycle/package.go | 9 +- cmd/commands/lifecycle/queryapproved.go | 8 +- cmd/commands/lifecycle/queryapproved_test.go | 231 --- cmd/commands/lifecycle/querycommitted.go | 8 +- cmd/commands/lifecycle/querycommitted_test.go | 218 --- cmd/commands/lifecycle/queryinstalled.go | 9 +- cmd/commands/lifecycle/queryinstalled_test.go | 236 --- go.mod | 29 +- go.sum | 294 +-- pkg/fabric/fabric.go | 13 +- pkg/fabric/fabric_test.go | 6 +- pkg/fabric/interfaces.go | 40 +- pkg/fabric/mocks/channel.go | 405 ---- pkg/fabric/mocks/channelcfg.go | 497 ----- pkg/fabric/mocks/event.go | 401 ---- pkg/fabric/mocks/factory.go | 451 ----- pkg/fabric/mocks/ledger.go | 522 ------ pkg/fabric/mocks/msp.go | 1354 -------------- pkg/fabric/mocks/resmgmt.go | 1648 ----------------- 59 files changed, 167 insertions(+), 10047 deletions(-) delete mode 100644 cmd/commands/chaincode/chaincode_test.go delete mode 100644 cmd/commands/chaincode/events_test.go delete mode 100644 cmd/commands/chaincode/install_test.go delete mode 100644 cmd/commands/chaincode/instantiate_test.go delete mode 100644 cmd/commands/chaincode/invoke_test.go delete mode 100644 cmd/commands/chaincode/list_test.go delete mode 100644 cmd/commands/chaincode/query_test.go delete mode 100644 cmd/commands/chaincode/upgrade_test.go delete mode 100644 cmd/commands/channel/channel_test.go delete mode 100644 cmd/commands/channel/config_test.go delete mode 100644 cmd/commands/channel/create_test.go delete mode 100644 cmd/commands/channel/join_test.go delete mode 100644 cmd/commands/channel/list_test.go delete mode 100644 cmd/commands/channel/update_test.go delete mode 100644 cmd/commands/lifecycle/approve_test.go delete mode 100644 cmd/commands/lifecycle/checkcommitreadiness_test.go delete mode 100644 cmd/commands/lifecycle/commit_test.go delete mode 100644 cmd/commands/lifecycle/getinstalledpkg_test.go delete mode 100644 cmd/commands/lifecycle/install_test.go delete mode 100644 cmd/commands/lifecycle/lifecycle_test.go delete mode 100644 cmd/commands/lifecycle/queryapproved_test.go delete mode 100644 cmd/commands/lifecycle/querycommitted_test.go delete mode 100644 cmd/commands/lifecycle/queryinstalled_test.go delete mode 100644 pkg/fabric/mocks/channel.go delete mode 100644 pkg/fabric/mocks/channelcfg.go delete mode 100644 pkg/fabric/mocks/event.go delete mode 100644 pkg/fabric/mocks/factory.go delete mode 100644 pkg/fabric/mocks/ledger.go delete mode 100644 pkg/fabric/mocks/msp.go delete mode 100644 pkg/fabric/mocks/resmgmt.go diff --git a/cmd/commands/chaincode/chaincode.go b/cmd/commands/chaincode/chaincode.go index b82caf6..12c6fee 100644 --- a/cmd/commands/chaincode/chaincode.go +++ b/cmd/commands/chaincode/chaincode.go @@ -51,12 +51,12 @@ type BaseCommand struct { func (c *BaseCommand) Complete() error { var err error - if c.Factory == nil { + /*if c.Factory == nil { c.Factory, err = fabric.NewFactory(c.Settings.Config) if err != nil { return err } - } + }*/ c.Channel, err = c.Factory.Channel() if err != nil { diff --git a/cmd/commands/chaincode/chaincode_test.go b/cmd/commands/chaincode/chaincode_test.go deleted file mode 100644 index 6d9eb81..0000000 --- a/cmd/commands/chaincode/chaincode_test.go +++ /dev/null @@ -1,124 +0,0 @@ -/* -Copyright State Street Corp. All Rights Reserved. - -SPDX-License-Identifier: Apache-2.0 -*/ - -package chaincode_test - -import ( - "bytes" - "errors" - "fmt" - "os" - "testing" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/spf13/cobra" - - "github.com/hyperledger/fabric-cli/cmd/commands/chaincode" - "github.com/hyperledger/fabric-cli/pkg/environment" - "github.com/hyperledger/fabric-cli/pkg/fabric/mocks" -) - -func TestChaincode(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "Chaincode Suite") -} - -var _ = Describe("ChaincodeCommand", func() { - var ( - cmd *cobra.Command - settings *environment.Settings - out *bytes.Buffer - ) - - Context("when creating a command from settings", func() { - BeforeEach(func() { - out = new(bytes.Buffer) - - settings = &environment.Settings{ - Home: environment.Home(os.TempDir()), - Streams: environment.Streams{ - Out: out, - }, - } - }) - - JustBeforeEach(func() { - cmd = chaincode.NewChaincodeCommand(settings) - }) - - It("should create a chaincode command", func() { - Expect(cmd.Name()).To(Equal("chaincode")) - Expect(cmd.HasSubCommands()).To(BeTrue()) - Expect(cmd.Execute()).Should(Succeed()) - Expect(fmt.Sprint(out)).To(ContainSubstring("chaincode [command]")) - Expect(fmt.Sprint(out)).To(ContainSubstring("list")) - Expect(fmt.Sprint(out)).To(ContainSubstring("install")) - Expect(fmt.Sprint(out)).To(ContainSubstring("instantiate")) - Expect(fmt.Sprint(out)).To(ContainSubstring("upgrade")) - Expect(fmt.Sprint(out)).To(ContainSubstring("query")) - Expect(fmt.Sprint(out)).To(ContainSubstring("invoke")) - Expect(fmt.Sprint(out)).To(ContainSubstring("events")) - }) - }) -}) - -var _ = Describe("BaseChaincodeCommand", func() { - var c *chaincode.BaseCommand - - BeforeEach(func() { - c = &chaincode.BaseCommand{} - }) - - Describe("Complete", func() { - var ( - err error - factory *mocks.Factory - channelClient *mocks.Channel - resmgmtClient *mocks.ResourceManagement - ) - - BeforeEach(func() { - factory = &mocks.Factory{} - channelClient = &mocks.Channel{} - resmgmtClient = &mocks.ResourceManagement{} - - factory.ResourceManagementReturns(resmgmtClient, nil) - factory.ChannelReturns(channelClient, nil) - - c.Factory = factory - }) - - JustBeforeEach(func() { - err = c.Complete() - }) - - It("should complete", func() { - Expect(err).To(BeNil()) - Expect(c.Channel).NotTo(BeNil()) - }) - - Context("when factory fails to create channel client", func() { - BeforeEach(func() { - factory.ChannelReturns(nil, errors.New("factory error")) - }) - - It("should fail with factory error", func() { - Expect(err).NotTo(BeNil()) - }) - }) - - Context("when factory fails to create resmgmt client", func() { - BeforeEach(func() { - factory.ResourceManagementReturns(nil, errors.New("factory error")) - }) - - It("should fail with factory error", func() { - Expect(err).NotTo(BeNil()) - }) - }) - }) -}) diff --git a/cmd/commands/chaincode/events_test.go b/cmd/commands/chaincode/events_test.go deleted file mode 100644 index 484a290..0000000 --- a/cmd/commands/chaincode/events_test.go +++ /dev/null @@ -1,174 +0,0 @@ -/* -Copyright State Street Corp. All Rights Reserved. - -SPDX-License-Identifier: Apache-2.0 -*/ - -package chaincode_test - -import ( - "bytes" - "errors" - "fmt" - "os" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/spf13/cobra" - - "github.com/hyperledger/fabric-cli/cmd/commands/chaincode" - "github.com/hyperledger/fabric-cli/pkg/environment" - "github.com/hyperledger/fabric-cli/pkg/fabric/mocks" - "github.com/hyperledger/fabric-sdk-go/pkg/common/providers/fab" -) - -var _ = Describe("ChaincodeEventsCommand", func() { - var ( - cmd *cobra.Command - settings *environment.Settings - out *bytes.Buffer - - args []string - ) - - BeforeEach(func() { - out = new(bytes.Buffer) - - settings = &environment.Settings{ - Home: environment.Home(os.TempDir()), - Streams: environment.Streams{ - Out: out, - }, - } - - args = os.Args - }) - - JustBeforeEach(func() { - cmd = chaincode.NewChaincodeEventsCommand(settings) - }) - - AfterEach(func() { - os.Args = args - }) - - It("should create a chaincode events command", func() { - Expect(cmd.Name()).To(Equal("events")) - Expect(cmd.HasSubCommands()).To(BeFalse()) - }) - - It("should provide a help prompt", func() { - os.Args = append(os.Args, "--help") - - Expect(cmd.Execute()).Should(Succeed()) - Expect(fmt.Sprint(out)).To(ContainSubstring("events ")) - }) -}) - -var _ = Describe("ChaincodeEventsImplementation", func() { - var ( - impl *chaincode.EventsCommand - err error - out *bytes.Buffer - settings *environment.Settings - factory *mocks.Factory - client *mocks.Channel - ) - - BeforeEach(func() { - out = new(bytes.Buffer) - - settings = &environment.Settings{ - Home: environment.Home(os.TempDir()), - Streams: environment.Streams{ - Out: out, - }, - } - - factory = &mocks.Factory{} - client = &mocks.Channel{} - - impl = &chaincode.EventsCommand{} - impl.Settings = settings - impl.Factory = factory - }) - - It("should not be nil", func() { - Expect(impl).ShouldNot(BeNil()) - }) - - Describe("Validate", func() { - JustBeforeEach(func() { - err = impl.Validate() - }) - - It("should fail when name is not set", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(Equal("chaincode name not specified")) - }) - - Context("when chaincode name is set", func() { - BeforeEach(func() { - impl.ChaincodeName = "mycc" - }) - - It("should succeed with chaincode name is set", func() { - Expect(err).To(BeNil()) - }) - }) - }) - - Describe("Run", func() { - var ( - eventch chan *fab.CCEvent - runDone chan struct{} - ) - - BeforeEach(func() { - impl.ChaincodeName = "mycc" - - impl.Channel = client - - eventch = make(chan *fab.CCEvent, 1) - }) - - JustBeforeEach(func() { - runDone = make(chan struct{}) - go func() { - err = impl.Run() - close(runDone) - }() - }) - - AfterEach(func() { - close(eventch) - <-runDone - }) - - Context("when channel client succeeds", func() { - BeforeEach(func() { - eventch <- &fab.CCEvent{ - TxID: "1", - } - - client.RegisterChaincodeEventReturns(struct{}{}, eventch, nil) - }) - - It("should process chaincode events", func() { - Expect(err).To(BeNil()) - }) - }) - - Context("when channel client fails", func() { - BeforeEach(func() { - client.RegisterChaincodeEventReturns(nil, nil, errors.New("events error")) - }) - - It("should fail process chaincode events", func() { - <-runDone // Wait for goroutine to terminate (we expect error) - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(ContainSubstring("events error")) - }) - }) - }) -}) diff --git a/cmd/commands/chaincode/install.go b/cmd/commands/chaincode/install.go index c1e4a05..0150054 100644 --- a/cmd/commands/chaincode/install.go +++ b/cmd/commands/chaincode/install.go @@ -11,10 +11,6 @@ import ( "fmt" "io/ioutil" - "github.com/hyperledger/fabric-protos-go/peer" - "github.com/hyperledger/fabric-sdk-go/pkg/client/resmgmt" - "github.com/hyperledger/fabric-sdk-go/pkg/common/errors/retry" - "github.com/hyperledger/fabric-sdk-go/pkg/fab/resource" "github.com/spf13/cobra" "github.com/hyperledger/fabric-cli/pkg/environment" @@ -84,17 +80,19 @@ func (c *InstallCommand) Validate() error { // Run executes the command func (c *InstallCommand) Run() error { - context, err := c.Settings.Config.GetCurrentContext() + // context + _, err := c.Settings.Config.GetCurrentContext() if err != nil { return err } - pkg, err := ioutil.ReadFile(c.ChaincodePath) + //pkg + _, err = ioutil.ReadFile(c.ChaincodePath) if err != nil { return err } - req := resmgmt.InstallCCRequest{ + /*req := resmgmt.InstallCCRequest{ Name: c.ChaincodeName, Path: c.ChaincodePath, Version: c.ChaincodeVersion, @@ -111,7 +109,7 @@ func (c *InstallCommand) Run() error { if _, err := c.ResourceManagement.InstallCC(req, options...); err != nil { return err - } + }*/ fmt.Fprintf(c.Settings.Streams.Out, "successfully installed chaincode '%s'\n", c.ChaincodeName) diff --git a/cmd/commands/chaincode/install_test.go b/cmd/commands/chaincode/install_test.go deleted file mode 100644 index 6ee8102..0000000 --- a/cmd/commands/chaincode/install_test.go +++ /dev/null @@ -1,215 +0,0 @@ -/* -Copyright State Street Corp. All Rights Reserved. - -SPDX-License-Identifier: Apache-2.0 -*/ - -package chaincode_test - -import ( - "bytes" - "errors" - "fmt" - "os" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/spf13/cobra" - - "github.com/hyperledger/fabric-cli/cmd/commands/chaincode" - "github.com/hyperledger/fabric-cli/pkg/environment" - "github.com/hyperledger/fabric-cli/pkg/fabric/mocks" - "github.com/hyperledger/fabric-sdk-go/pkg/client/resmgmt" -) - -var _ = Describe("ChaincodeInstallCommand", func() { - var ( - cmd *cobra.Command - settings *environment.Settings - out *bytes.Buffer - - args []string - ) - - BeforeEach(func() { - out = new(bytes.Buffer) - - settings = &environment.Settings{ - Home: environment.Home(os.TempDir()), - Streams: environment.Streams{ - Out: out, - }, - } - - args = os.Args - }) - - JustBeforeEach(func() { - cmd = chaincode.NewChaincodeInstallCommand(settings) - }) - - AfterEach(func() { - os.Args = args - }) - - It("should create a chaincode install command", func() { - Expect(cmd.Name()).To(Equal("install")) - Expect(cmd.HasSubCommands()).To(BeFalse()) - }) - - It("should provide a help prompt", func() { - os.Args = append(os.Args, "--help") - - Expect(cmd.Execute()).Should(Succeed()) - Expect(fmt.Sprint(out)).To(ContainSubstring("install ")) - }) -}) - -var _ = Describe("ChaincodeInstallImplementation", func() { - var ( - impl *chaincode.InstallCommand - err error - out *bytes.Buffer - settings *environment.Settings - factory *mocks.Factory - client *mocks.ResourceManagement - ) - - BeforeEach(func() { - out = new(bytes.Buffer) - - settings = &environment.Settings{ - Home: environment.Home(os.TempDir()), - Streams: environment.Streams{ - Out: out, - }, - } - - factory = &mocks.Factory{} - client = &mocks.ResourceManagement{} - - impl = &chaincode.InstallCommand{} - impl.Settings = settings - impl.Factory = factory - }) - - It("should not be nil", func() { - Expect(impl).ShouldNot(BeNil()) - }) - - Describe("Validate", func() { - JustBeforeEach(func() { - err = impl.Validate() - }) - - It("should fail when name is not set", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(Equal("chaincode name not specified")) - }) - - Context("when chaincode version is not set", func() { - BeforeEach(func() { - impl.ChaincodeName = "mycc" - }) - - It("should fail without chaincode version", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(Equal("chaincode version not specified")) - }) - }) - - Context("when chaincode path is not set", func() { - BeforeEach(func() { - impl.ChaincodeName = "mycc" - impl.ChaincodeVersion = "0.0.0" - }) - - It("should fail without chaincode path", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(Equal("chaincode path not specified")) - }) - }) - - Context("when all arguments are set", func() { - BeforeEach(func() { - impl.ChaincodeName = "mycc" - impl.ChaincodeVersion = "0.0.0" - impl.ChaincodePath = "path" - }) - - It("should succeed with all arguments", func() { - Expect(err).To(BeNil()) - }) - }) - }) - - Describe("Run", func() { - BeforeEach(func() { - impl.ChaincodeName = "mycc" - impl.ChaincodeVersion = "0.0.0" - impl.ChaincodePath = "./testdata/chaincode/example/example.go" - impl.ResourceManagement = client - }) - - JustBeforeEach(func() { - err = impl.Run() - }) - - It("should fail without a current context", func() { - Expect(err).NotTo(BeNil()) - }) - - Context("when chaincode path is invalid", func() { - BeforeEach(func() { - settings.Config = &environment.Config{ - Contexts: map[string]*environment.Context{ - "foo": {}, - }, - CurrentContext: "foo", - } - - impl.ChaincodePath = "path/to/chaincode" - }) - - It("should fail with an invalid path", func() { - Expect(err).NotTo(BeNil()) - }) - }) - - Context("when resmgmt client succeeds", func() { - BeforeEach(func() { - settings.Config = &environment.Config{ - Contexts: map[string]*environment.Context{ - "foo": {}, - }, - CurrentContext: "foo", - } - - client.InstallCCReturns([]resmgmt.InstallCCResponse{}, nil) - }) - - It("should succeed with chaincode install", func() { - Expect(err).To(BeNil()) - Expect(fmt.Sprint(out)).To(Equal("successfully installed chaincode 'mycc'\n")) - }) - }) - - Context("when resmgmt client fails", func() { - BeforeEach(func() { - settings.Config = &environment.Config{ - Contexts: map[string]*environment.Context{ - "foo": {}, - }, - CurrentContext: "foo", - } - - client.InstallCCReturns(nil, errors.New("install error")) - }) - - It("should fail to install chaincode", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(ContainSubstring("install error")) - }) - }) - }) -}) diff --git a/cmd/commands/chaincode/instantiate.go b/cmd/commands/chaincode/instantiate.go index f58f071..9ab03e1 100644 --- a/cmd/commands/chaincode/instantiate.go +++ b/cmd/commands/chaincode/instantiate.go @@ -12,8 +12,6 @@ import ( "fmt" "github.com/hyperledger/fabric-cli/cmd/commands/common" - "github.com/hyperledger/fabric-sdk-go/pkg/client/resmgmt" - "github.com/hyperledger/fabric-sdk-go/pkg/common/errors/retry" "github.com/spf13/cobra" "github.com/hyperledger/fabric-cli/pkg/environment" @@ -92,27 +90,31 @@ func (c *InstantiateCommand) Validate() error { // Run executes the command func (c *InstantiateCommand) Run() error { - context, err := c.Settings.Config.GetCurrentContext() + //context + _, err := c.Settings.Config.GetCurrentContext() if err != nil { return err } - args, err := json.Marshal(c.ChaincodeArgs) + //args + _, err = json.Marshal(c.ChaincodeArgs) if err != nil { return err } - policy, err := common.GetChaincodePolicy(c.ChaincodePolicy) + //policy + _, err = common.GetChaincodePolicy(c.ChaincodePolicy) if err != nil { return err } - collectionsConfig, err := common.GetCollectionConfigFromFile(c.ChaincodeCollectionsConfig) + //collectionsConfig + _, err = common.GetCollectionConfigFromFile(c.ChaincodeCollectionsConfig) if err != nil { return err } - req := resmgmt.InstantiateCCRequest{ + /*req := resmgmt.InstantiateCCRequest{ Name: c.ChaincodeName, Path: c.ChaincodePath, Version: c.ChaincodeVersion, @@ -128,7 +130,7 @@ func (c *InstantiateCommand) Run() error { if _, err := c.ResourceManagement.InstantiateCC(context.Channel, req, options...); err != nil { return err - } + }*/ fmt.Fprintf(c.Settings.Streams.Out, "successfully instantiated chaincode '%s'\n", c.ChaincodeName) diff --git a/cmd/commands/chaincode/instantiate_test.go b/cmd/commands/chaincode/instantiate_test.go deleted file mode 100644 index f9a09a4..0000000 --- a/cmd/commands/chaincode/instantiate_test.go +++ /dev/null @@ -1,198 +0,0 @@ -/* -Copyright State Street Corp. All Rights Reserved. - -SPDX-License-Identifier: Apache-2.0 -*/ - -package chaincode_test - -import ( - "bytes" - "errors" - "fmt" - "os" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/spf13/cobra" - - "github.com/hyperledger/fabric-cli/cmd/commands/chaincode" - "github.com/hyperledger/fabric-cli/pkg/environment" - "github.com/hyperledger/fabric-cli/pkg/fabric/mocks" - "github.com/hyperledger/fabric-sdk-go/pkg/client/resmgmt" -) - -var _ = Describe("ChaincodeInstantiateCommand", func() { - var ( - cmd *cobra.Command - settings *environment.Settings - out *bytes.Buffer - - args []string - ) - - BeforeEach(func() { - out = new(bytes.Buffer) - - settings = &environment.Settings{ - Home: environment.Home(os.TempDir()), - Streams: environment.Streams{ - Out: out, - }, - } - - args = os.Args - }) - - JustBeforeEach(func() { - cmd = chaincode.NewChaincodeInstantiateCommand(settings) - }) - - AfterEach(func() { - os.Args = args - }) - - It("should create a chaincode instantiate command", func() { - Expect(cmd.Name()).To(Equal("instantiate")) - Expect(cmd.HasSubCommands()).To(BeFalse()) - }) - - It("should provide a help prompt", func() { - os.Args = append(os.Args, "--help") - - Expect(cmd.Execute()).Should(Succeed()) - Expect(fmt.Sprint(out)).To(ContainSubstring("instantiate ")) - }) -}) - -var _ = Describe("ChaincodeInstantiateImplementation", func() { - var ( - impl *chaincode.InstantiateCommand - err error - out *bytes.Buffer - settings *environment.Settings - factory *mocks.Factory - client *mocks.ResourceManagement - ) - - BeforeEach(func() { - out = new(bytes.Buffer) - - settings = &environment.Settings{ - Home: environment.Home(os.TempDir()), - Streams: environment.Streams{ - Out: out, - }, - } - - factory = &mocks.Factory{} - client = &mocks.ResourceManagement{} - - impl = &chaincode.InstantiateCommand{} - impl.Settings = settings - impl.Factory = factory - }) - - It("should not be nil", func() { - Expect(impl).ShouldNot(BeNil()) - }) - - Describe("Validate", func() { - JustBeforeEach(func() { - err = impl.Validate() - }) - - It("should fail when name is not set", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(Equal("chaincode name not specified")) - }) - - Context("when chaincode version is not set", func() { - BeforeEach(func() { - impl.ChaincodeName = "mycc" - }) - - It("should fail without chaincode version", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(Equal("chaincode version not specified")) - }) - }) - - Context("when chaincode path is not set", func() { - BeforeEach(func() { - impl.ChaincodeName = "mycc" - impl.ChaincodeVersion = "0.0.0" - }) - - It("should fail without chaincode path", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(Equal("chaincode path not specified")) - }) - }) - - Context("when all arguments are set", func() { - BeforeEach(func() { - impl.ChaincodeName = "mycc" - impl.ChaincodeVersion = "0.0.0" - impl.ChaincodePath = "path" - }) - - It("should succeed with all arguments", func() { - Expect(err).To(BeNil()) - }) - }) - }) - - Describe("Run", func() { - BeforeEach(func() { - impl.ChaincodeName = "mycc" - impl.ChaincodeVersion = "0.0.0" - impl.ChaincodePath = "github.com/hyperledger/fabric-cli/cmd/commands/chaincode/testdata/chaincode/example" - impl.ResourceManagement = client - }) - - JustBeforeEach(func() { - err = impl.Run() - }) - - It("should fail without a current context", func() { - Expect(err).NotTo(BeNil()) - }) - - Context("when resmgmt client succeeds", func() { - BeforeEach(func() { - settings.Config = &environment.Config{ - Contexts: map[string]*environment.Context{ - "foo": {}, - }, - CurrentContext: "foo", - } - - client.InstantiateCCReturns(resmgmt.InstantiateCCResponse{}, nil) - }) - - It("should succeed with chaincode instantiate", func() { - Expect(err).To(BeNil()) - Expect(fmt.Sprint(out)).To(Equal("successfully instantiated chaincode 'mycc'\n")) - }) - }) - - Context("when resmgmt client fails", func() { - BeforeEach(func() { - settings.Config = &environment.Config{ - Contexts: map[string]*environment.Context{ - "foo": {}, - }, - CurrentContext: "foo", - } - - client.InstantiateCCReturns(resmgmt.InstantiateCCResponse{}, errors.New("instantiate error")) - }) - - It("should fail to instantiate chaincode", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(ContainSubstring("instantiate error")) - }) - }) - }) -}) diff --git a/cmd/commands/chaincode/invoke.go b/cmd/commands/chaincode/invoke.go index 3ed7379..568e84a 100644 --- a/cmd/commands/chaincode/invoke.go +++ b/cmd/commands/chaincode/invoke.go @@ -8,13 +8,9 @@ package chaincode import ( "errors" - "fmt" - "github.com/hyperledger/fabric-sdk-go/pkg/client/channel" - "github.com/hyperledger/fabric-sdk-go/pkg/common/errors/retry" "github.com/spf13/cobra" - "github.com/hyperledger/fabric-cli/cmd/commands/common" "github.com/hyperledger/fabric-cli/pkg/environment" ) @@ -79,7 +75,7 @@ func (c *InvokeCommand) Validate() error { // Run executes the command func (c *InvokeCommand) Run() error { - fcn := c.ChaincodeFcn + /*fcn := c.ChaincodeFcn if c.IsInit { fcn = "Init" } @@ -97,6 +93,6 @@ func (c *InvokeCommand) Run() error { } fmt.Fprintln(c.Settings.Streams.Out, string(resp.Payload)) - + */ return nil } diff --git a/cmd/commands/chaincode/invoke_test.go b/cmd/commands/chaincode/invoke_test.go deleted file mode 100644 index 8cb40e9..0000000 --- a/cmd/commands/chaincode/invoke_test.go +++ /dev/null @@ -1,166 +0,0 @@ -/* -Copyright State Street Corp. All Rights Reserved. - -SPDX-License-Identifier: Apache-2.0 -*/ - -package chaincode_test - -import ( - "bytes" - "errors" - "fmt" - "os" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/spf13/cobra" - - "github.com/hyperledger/fabric-cli/cmd/commands/chaincode" - "github.com/hyperledger/fabric-cli/pkg/environment" - "github.com/hyperledger/fabric-cli/pkg/fabric/mocks" - "github.com/hyperledger/fabric-sdk-go/pkg/client/channel" -) - -var _ = Describe("ChaincodeInvokeCommand", func() { - var ( - cmd *cobra.Command - settings *environment.Settings - out *bytes.Buffer - - args []string - ) - - BeforeEach(func() { - out = new(bytes.Buffer) - - settings = &environment.Settings{ - Home: environment.Home(os.TempDir()), - Streams: environment.Streams{ - Out: out, - }, - } - - args = os.Args - }) - - JustBeforeEach(func() { - cmd = chaincode.NewChaincodeInvokeCommand(settings) - }) - - AfterEach(func() { - os.Args = args - }) - - It("should create a chaincode invoke command", func() { - Expect(cmd.Name()).To(Equal("invoke")) - Expect(cmd.HasSubCommands()).To(BeFalse()) - }) - - It("should provide a help prompt", func() { - os.Args = append(os.Args, "--help") - - Expect(cmd.Execute()).Should(Succeed()) - Expect(fmt.Sprint(out)).To(ContainSubstring("invoke ")) - }) -}) - -var _ = Describe("ChaincodeInvokeImplementation", func() { - var ( - impl *chaincode.InvokeCommand - err error - out *bytes.Buffer - settings *environment.Settings - factory *mocks.Factory - client *mocks.Channel - ) - - BeforeEach(func() { - out = new(bytes.Buffer) - - settings = &environment.Settings{ - Home: environment.Home(os.TempDir()), - Streams: environment.Streams{ - Out: out, - }, - } - - factory = &mocks.Factory{} - client = &mocks.Channel{} - - impl = &chaincode.InvokeCommand{} - impl.Settings = settings - impl.Factory = factory - }) - - It("should not be nil", func() { - Expect(impl).ShouldNot(BeNil()) - }) - - Describe("Validate", func() { - JustBeforeEach(func() { - err = impl.Validate() - }) - - It("should fail when name is not set", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(Equal("chaincode name not specified")) - }) - - Context("when chaincode name is set", func() { - BeforeEach(func() { - impl.ChaincodeName = "mycc" - }) - - It("should succeed with chaincode name is set", func() { - Expect(err).To(BeNil()) - }) - }) - - Context("when --is-init is set", func() { - BeforeEach(func() { - impl.ChaincodeName = "mycc" - impl.IsInit = true - }) - - It("should succeed with chaincode name is set", func() { - Expect(err).To(BeNil()) - }) - }) - }) - - Describe("Run", func() { - BeforeEach(func() { - impl.ChaincodeName = "mycc" - - impl.Channel = client - }) - - JustBeforeEach(func() { - - err = impl.Run() - - }) - - Context("when channel client succeeds", func() { - BeforeEach(func() { - client.ExecuteReturns(channel.Response{}, nil) - }) - - It("should successfully invoke chaincode", func() { - Expect(err).To(BeNil()) - }) - }) - - Context("when channel client fails", func() { - BeforeEach(func() { - client.ExecuteReturns(channel.Response{}, errors.New("invoke error")) - }) - - It("should fail to invoke chaincode invoke", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(ContainSubstring("invoke error")) - }) - }) - }) -}) diff --git a/cmd/commands/chaincode/list.go b/cmd/commands/chaincode/list.go index 2802bb1..b210f01 100644 --- a/cmd/commands/chaincode/list.go +++ b/cmd/commands/chaincode/list.go @@ -7,9 +7,6 @@ SPDX-License-Identifier: Apache-2.0 package chaincode import ( - "fmt" - - "github.com/hyperledger/fabric-sdk-go/pkg/client/resmgmt" "github.com/spf13/cobra" "github.com/hyperledger/fabric-cli/pkg/environment" @@ -52,7 +49,7 @@ type ListCommand struct { // Run executes the command func (c *ListCommand) Run() error { - if !c.Installed && !c.Instantiated { + /*if !c.Installed && !c.Instantiated { c.Installed = true c.Instantiated = true } @@ -89,6 +86,6 @@ func (c *ListCommand) Run() error { fmt.Fprintf(c.Settings.Streams.Out, " - %s\n", chaincode.Name) } } - + */ return nil } diff --git a/cmd/commands/chaincode/list_test.go b/cmd/commands/chaincode/list_test.go deleted file mode 100644 index a6edac3..0000000 --- a/cmd/commands/chaincode/list_test.go +++ /dev/null @@ -1,185 +0,0 @@ -/* -Copyright State Street Corp. All Rights Reserved. - -SPDX-License-Identifier: Apache-2.0 -*/ - -package chaincode_test - -import ( - "bytes" - "errors" - "fmt" - "os" - - pb "github.com/hyperledger/fabric-protos-go/peer" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/spf13/cobra" - - "github.com/hyperledger/fabric-cli/cmd/commands/chaincode" - "github.com/hyperledger/fabric-cli/pkg/environment" - "github.com/hyperledger/fabric-cli/pkg/fabric/mocks" -) - -var _ = Describe("ChaincodeListCommand", func() { - var ( - cmd *cobra.Command - settings *environment.Settings - out *bytes.Buffer - - args []string - ) - - BeforeEach(func() { - out = new(bytes.Buffer) - - settings = &environment.Settings{ - Home: environment.Home(os.TempDir()), - Streams: environment.Streams{ - Out: out, - }, - } - - args = os.Args - }) - - JustBeforeEach(func() { - cmd = chaincode.NewChaincodeListCommand(settings) - }) - - AfterEach(func() { - os.Args = args - }) - - It("should create a chaincode list command", func() { - Expect(cmd.Name()).To(Equal("list")) - Expect(cmd.HasSubCommands()).To(BeFalse()) - }) - - It("should provide a help prompt", func() { - os.Args = append(os.Args, "--help") - - Expect(cmd.Execute()).Should(Succeed()) - Expect(fmt.Sprint(out)).To(ContainSubstring("list")) - }) -}) - -var _ = Describe("ChaincodeListImplementation", func() { - var ( - impl *chaincode.ListCommand - err error - out *bytes.Buffer - settings *environment.Settings - factory *mocks.Factory - client *mocks.ResourceManagement - ) - - BeforeEach(func() { - out = new(bytes.Buffer) - - settings = &environment.Settings{ - Home: environment.Home(os.TempDir()), - Streams: environment.Streams{ - Out: out, - }, - } - - factory = &mocks.Factory{} - client = &mocks.ResourceManagement{} - - impl = &chaincode.ListCommand{} - impl.Settings = settings - impl.Factory = factory - }) - - It("should not be nil", func() { - Expect(impl).ShouldNot(BeNil()) - }) - - Describe("Run", func() { - BeforeEach(func() { - impl.ResourceManagement = client - }) - - JustBeforeEach(func() { - err = impl.Run() - }) - - It("should fail without a current context", func() { - Expect(err).NotTo(BeNil()) - }) - - Context("when resmgmt client succeeds", func() { - BeforeEach(func() { - settings.Config = &environment.Config{ - Contexts: map[string]*environment.Context{ - "foo": {}, - }, - CurrentContext: "foo", - } - - client.QueryInstalledChaincodesReturns(&pb.ChaincodeQueryResponse{ - Chaincodes: []*pb.ChaincodeInfo{ - { - Name: "mycc", - }, - }, - }, nil) - client.QueryInstantiatedChaincodesReturns(&pb.ChaincodeQueryResponse{ - Chaincodes: []*pb.ChaincodeInfo{ - { - Name: "mycc", - }, - }, - }, nil) - }) - - It("should succeed with chaincode list", func() { - Expect(err).To(BeNil()) - - }) - }) - - Context("when resmgmt client fails to list installed chaincode", func() { - BeforeEach(func() { - impl.Installed = true - - settings.Config = &environment.Config{ - Contexts: map[string]*environment.Context{ - "foo": {}, - }, - CurrentContext: "foo", - } - - client.QueryInstalledChaincodesReturns(nil, errors.New("list error")) - }) - - It("should fail to list installed chaincode", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(ContainSubstring("list error")) - }) - }) - - Context("when resmgmt client fails to list instantiated chaincode", func() { - BeforeEach(func() { - impl.Instantiated = true - - settings.Config = &environment.Config{ - Contexts: map[string]*environment.Context{ - "foo": {}, - }, - CurrentContext: "foo", - } - - client.QueryInstalledChaincodesReturns(nil, errors.New("list error")) - }) - - It("should fail to list instantiated chaincode", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(ContainSubstring("list error")) - }) - }) - }) -}) diff --git a/cmd/commands/chaincode/package.go b/cmd/commands/chaincode/package.go index c0d002b..aeb5893 100644 --- a/cmd/commands/chaincode/package.go +++ b/cmd/commands/chaincode/package.go @@ -2,11 +2,8 @@ package chaincode import ( "errors" - "fmt" - "io/ioutil" "github.com/hyperledger/fabric-cli/pkg/environment" - "github.com/hyperledger/fabric-sdk-go/pkg/fab/ccpackager/gopackager" "github.com/spf13/cobra" ) @@ -60,7 +57,7 @@ func (c *PackageCommand) Validate() error { // Run executes the command func (c *PackageCommand) Run() error { - pkg, err := gopackager.NewCCPackage(c.ChaincodePath, "") + /*pkg, err := gopackager.NewCCPackage(c.ChaincodePath, "") if err != nil { return err } @@ -70,6 +67,6 @@ func (c *PackageCommand) Run() error { } fmt.Fprintf(c.Settings.Streams.Out, "successfully packaged chaincode '%s'\n", c.ChaincodeName) - + */ return nil } diff --git a/cmd/commands/chaincode/query.go b/cmd/commands/chaincode/query.go index 83ee739..db0aabc 100644 --- a/cmd/commands/chaincode/query.go +++ b/cmd/commands/chaincode/query.go @@ -8,13 +8,9 @@ package chaincode import ( "errors" - "fmt" - "github.com/hyperledger/fabric-sdk-go/pkg/client/channel" - "github.com/hyperledger/fabric-sdk-go/pkg/common/errors/retry" "github.com/spf13/cobra" - "github.com/hyperledger/fabric-cli/cmd/commands/common" "github.com/hyperledger/fabric-cli/pkg/environment" ) @@ -77,7 +73,7 @@ func (c *QueryCommand) Validate() error { // Run executes the command func (c *QueryCommand) Run() error { - req := channel.Request{ + /*req := channel.Request{ ChaincodeID: c.ChaincodeName, Fcn: c.ChaincodeFcn, Args: common.AsByteArgs(c.ChaincodeArgs), @@ -89,6 +85,6 @@ func (c *QueryCommand) Run() error { } fmt.Fprintln(c.Settings.Streams.Out, string(resp.Payload)) - + */ return nil } diff --git a/cmd/commands/chaincode/query_test.go b/cmd/commands/chaincode/query_test.go deleted file mode 100644 index 6fcfa48..0000000 --- a/cmd/commands/chaincode/query_test.go +++ /dev/null @@ -1,155 +0,0 @@ -/* -Copyright State Street Corp. All Rights Reserved. - -SPDX-License-Identifier: Apache-2.0 -*/ - -package chaincode_test - -import ( - "bytes" - "errors" - "fmt" - "os" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/spf13/cobra" - - "github.com/hyperledger/fabric-cli/cmd/commands/chaincode" - "github.com/hyperledger/fabric-cli/pkg/environment" - "github.com/hyperledger/fabric-cli/pkg/fabric/mocks" - "github.com/hyperledger/fabric-sdk-go/pkg/client/channel" -) - -var _ = Describe("ChaincodeQueryCommand", func() { - var ( - cmd *cobra.Command - settings *environment.Settings - out *bytes.Buffer - - args []string - ) - - BeforeEach(func() { - out = new(bytes.Buffer) - - settings = &environment.Settings{ - Home: environment.Home(os.TempDir()), - Streams: environment.Streams{ - Out: out, - }, - } - - args = os.Args - }) - - JustBeforeEach(func() { - cmd = chaincode.NewChaincodeQueryCommand(settings) - }) - - AfterEach(func() { - os.Args = args - }) - - It("should create a chaincode query command", func() { - Expect(cmd.Name()).To(Equal("query")) - Expect(cmd.HasSubCommands()).To(BeFalse()) - }) - - It("should provide a help prompt", func() { - os.Args = append(os.Args, "--help") - - Expect(cmd.Execute()).Should(Succeed()) - Expect(fmt.Sprint(out)).To(ContainSubstring("query ")) - }) -}) - -var _ = Describe("ChaincodeQueryImplementation", func() { - var ( - impl *chaincode.QueryCommand - err error - out *bytes.Buffer - settings *environment.Settings - factory *mocks.Factory - client *mocks.Channel - ) - - BeforeEach(func() { - out = new(bytes.Buffer) - - settings = &environment.Settings{ - Home: environment.Home(os.TempDir()), - Streams: environment.Streams{ - Out: out, - }, - } - - factory = &mocks.Factory{} - client = &mocks.Channel{} - - impl = &chaincode.QueryCommand{} - impl.Settings = settings - impl.Factory = factory - }) - - It("should not be nil", func() { - Expect(impl).ShouldNot(BeNil()) - }) - - Describe("Validate", func() { - JustBeforeEach(func() { - err = impl.Validate() - }) - - It("should fail when name is not set", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(Equal("chaincode name not specified")) - }) - - Context("when chaincode name is set", func() { - BeforeEach(func() { - impl.ChaincodeName = "mycc" - }) - - It("should succeed with chaincode name", func() { - Expect(err).To(BeNil()) - }) - }) - }) - - Describe("Run", func() { - BeforeEach(func() { - impl.ChaincodeName = "mycc" - - impl.Channel = client - }) - - JustBeforeEach(func() { - - err = impl.Run() - - }) - - Context("when channel client succeeds", func() { - BeforeEach(func() { - client.QueryReturns(channel.Response{}, nil) - }) - - It("should successfully run chaincode query", func() { - Expect(err).To(BeNil()) - }) - }) - - Context("when channel client fails", func() { - BeforeEach(func() { - client.QueryReturns(channel.Response{}, errors.New("query error")) - }) - - It("should fail to run chaincode query", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(ContainSubstring("query error")) - }) - }) - }) -}) diff --git a/cmd/commands/chaincode/upgrade.go b/cmd/commands/chaincode/upgrade.go index 213dda1..ae97a41 100644 --- a/cmd/commands/chaincode/upgrade.go +++ b/cmd/commands/chaincode/upgrade.go @@ -11,8 +11,6 @@ import ( "errors" "fmt" - "github.com/hyperledger/fabric-sdk-go/pkg/client/resmgmt" - "github.com/hyperledger/fabric-sdk-go/pkg/common/errors/retry" "github.com/spf13/cobra" "github.com/hyperledger/fabric-cli/cmd/commands/common" @@ -92,27 +90,31 @@ func (c *UpgradeCommand) Validate() error { // Run executes the command func (c *UpgradeCommand) Run() error { - context, err := c.Settings.Config.GetCurrentContext() + //context + _, err := c.Settings.Config.GetCurrentContext() if err != nil { return err } - args, err := json.Marshal(c.ChaincodeArgs) + //args + _, err = json.Marshal(c.ChaincodeArgs) if err != nil { return err } - policy, err := common.GetChaincodePolicy(c.ChaincodePolicy) + //policy + _, err = common.GetChaincodePolicy(c.ChaincodePolicy) if err != nil { return err } - collectionsConfig, err := common.GetCollectionConfigFromFile(c.ChaincodeCollectionsConfig) + //collectionsConfig + _, err = common.GetCollectionConfigFromFile(c.ChaincodeCollectionsConfig) if err != nil { return err } - req := resmgmt.UpgradeCCRequest{ + /*req := resmgmt.UpgradeCCRequest{ Name: c.ChaincodeName, Path: c.ChaincodePath, Version: c.ChaincodeVersion, @@ -128,7 +130,7 @@ func (c *UpgradeCommand) Run() error { if _, err := c.ResourceManagement.UpgradeCC(context.Channel, req, options...); err != nil { return err - } + }*/ fmt.Fprintf(c.Settings.Streams.Out, "successfully upgraded chaincode '%s'\n", c.ChaincodeName) diff --git a/cmd/commands/chaincode/upgrade_test.go b/cmd/commands/chaincode/upgrade_test.go deleted file mode 100644 index 6c7d097..0000000 --- a/cmd/commands/chaincode/upgrade_test.go +++ /dev/null @@ -1,198 +0,0 @@ -/* -Copyright State Street Corp. All Rights Reserved. - -SPDX-License-Identifier: Apache-2.0 -*/ - -package chaincode_test - -import ( - "bytes" - "errors" - "fmt" - "os" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/spf13/cobra" - - "github.com/hyperledger/fabric-cli/cmd/commands/chaincode" - "github.com/hyperledger/fabric-cli/pkg/environment" - "github.com/hyperledger/fabric-cli/pkg/fabric/mocks" - "github.com/hyperledger/fabric-sdk-go/pkg/client/resmgmt" -) - -var _ = Describe("ChaincodeUpgradeCommand", func() { - var ( - cmd *cobra.Command - settings *environment.Settings - out *bytes.Buffer - - args []string - ) - - BeforeEach(func() { - out = new(bytes.Buffer) - - settings = &environment.Settings{ - Home: environment.Home(os.TempDir()), - Streams: environment.Streams{ - Out: out, - }, - } - - args = os.Args - }) - - JustBeforeEach(func() { - cmd = chaincode.NewChaincodeUpgradeCommand(settings) - }) - - AfterEach(func() { - os.Args = args - }) - - It("should create a chaincode upgrade command", func() { - Expect(cmd.Name()).To(Equal("upgrade")) - Expect(cmd.HasSubCommands()).To(BeFalse()) - }) - - It("should provide a help prompt", func() { - os.Args = append(os.Args, "--help") - - Expect(cmd.Execute()).Should(Succeed()) - Expect(fmt.Sprint(out)).To(ContainSubstring("upgrade ")) - }) -}) - -var _ = Describe("ChaincodeUpgradeImplementation", func() { - var ( - impl *chaincode.UpgradeCommand - err error - out *bytes.Buffer - settings *environment.Settings - factory *mocks.Factory - client *mocks.ResourceManagement - ) - - BeforeEach(func() { - out = new(bytes.Buffer) - - settings = &environment.Settings{ - Home: environment.Home(os.TempDir()), - Streams: environment.Streams{ - Out: out, - }, - } - - factory = &mocks.Factory{} - client = &mocks.ResourceManagement{} - - impl = &chaincode.UpgradeCommand{} - impl.Settings = settings - impl.Factory = factory - }) - - It("should not be nil", func() { - Expect(impl).ShouldNot(BeNil()) - }) - - Describe("Validate", func() { - JustBeforeEach(func() { - err = impl.Validate() - }) - - It("should fail when name is not set", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(Equal("chaincode name not specified")) - }) - - Context("when chaincode version is not set", func() { - BeforeEach(func() { - impl.ChaincodeName = "mycc" - }) - - It("should fail without chaincode version", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(Equal("chaincode version not specified")) - }) - }) - - Context("when chaincode path is not set", func() { - BeforeEach(func() { - impl.ChaincodeName = "mycc" - impl.ChaincodeVersion = "0.0.0" - }) - - It("should fail without chaincode path", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(Equal("chaincode path not specified")) - }) - }) - - Context("when all arguments are set", func() { - BeforeEach(func() { - impl.ChaincodeName = "mycc" - impl.ChaincodeVersion = "0.0.0" - impl.ChaincodePath = "path" - }) - - It("should succeed with all arguments", func() { - Expect(err).To(BeNil()) - }) - }) - }) - - Describe("Run", func() { - BeforeEach(func() { - impl.ChaincodeName = "mycc" - impl.ChaincodeVersion = "0.0.0" - impl.ChaincodePath = "github.com/hyperledger/fabric-cli/cmd/commands/chaincode/testdata/chaincode/example" - impl.ResourceManagement = client - }) - - JustBeforeEach(func() { - err = impl.Run() - }) - - It("should fail without a current context", func() { - Expect(err).NotTo(BeNil()) - }) - - Context("when resmgmt client succeeds", func() { - BeforeEach(func() { - settings.Config = &environment.Config{ - Contexts: map[string]*environment.Context{ - "foo": {}, - }, - CurrentContext: "foo", - } - - client.UpgradeCCReturns(resmgmt.UpgradeCCResponse{}, nil) - }) - - It("should succeed with chaincode upgrade", func() { - Expect(err).To(BeNil()) - Expect(fmt.Sprint(out)).To(Equal("successfully upgraded chaincode 'mycc'\n")) - }) - }) - - Context("when resmgmt client fails", func() { - BeforeEach(func() { - settings.Config = &environment.Config{ - Contexts: map[string]*environment.Context{ - "foo": {}, - }, - CurrentContext: "foo", - } - - client.UpgradeCCReturns(resmgmt.UpgradeCCResponse{}, errors.New("upgrade error")) - }) - - It("should fail to upgrade chaincode", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(ContainSubstring("upgrade error")) - }) - }) - }) -}) diff --git a/cmd/commands/channel/channel.go b/cmd/commands/channel/channel.go index ecb930b..68c0d23 100644 --- a/cmd/commands/channel/channel.go +++ b/cmd/commands/channel/channel.go @@ -47,13 +47,13 @@ type BaseCommand struct { func (c *BaseCommand) Complete() error { var err error - if c.Factory == nil { + /*if c.Factory == nil { c.Factory, err = fabric.NewFactory(c.Settings.Config) if err != nil { return err } } - + */ c.ResourceManagement, err = c.Factory.ResourceManagement() if err != nil { return err diff --git a/cmd/commands/channel/channel_test.go b/cmd/commands/channel/channel_test.go deleted file mode 100644 index 1de4421..0000000 --- a/cmd/commands/channel/channel_test.go +++ /dev/null @@ -1,108 +0,0 @@ -/* -Copyright State Street Corp. All Rights Reserved. - -SPDX-License-Identifier: Apache-2.0 -*/ - -package channel_test - -import ( - "bytes" - "errors" - "fmt" - "os" - "testing" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/spf13/cobra" - - "github.com/hyperledger/fabric-cli/cmd/commands/channel" - "github.com/hyperledger/fabric-cli/pkg/environment" - "github.com/hyperledger/fabric-cli/pkg/fabric/mocks" -) - -func TestChannel(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "Channel Suite") -} - -var _ = Describe("ChannelCommand", func() { - var ( - cmd *cobra.Command - settings *environment.Settings - out *bytes.Buffer - ) - - Context("when creating a command from settings", func() { - BeforeEach(func() { - out = new(bytes.Buffer) - - settings = &environment.Settings{ - Home: environment.Home(os.TempDir()), - Streams: environment.Streams{ - Out: out, - }, - } - }) - - JustBeforeEach(func() { - cmd = channel.NewChannelCommand(settings) - }) - - It("should create a channel command", func() { - Expect(cmd.Name()).To(Equal("channel")) - Expect(cmd.HasSubCommands()).To(BeTrue()) - Expect(cmd.Execute()).Should(Succeed()) - Expect(fmt.Sprint(out)).To(ContainSubstring("channel [command]")) - Expect(fmt.Sprint(out)).To(ContainSubstring("create")) - Expect(fmt.Sprint(out)).To(ContainSubstring("join")) - Expect(fmt.Sprint(out)).To(ContainSubstring("update")) - Expect(fmt.Sprint(out)).To(ContainSubstring("list")) - Expect(fmt.Sprint(out)).To(ContainSubstring("config")) - }) - }) -}) -var _ = Describe("BaseChannelCommand", func() { - var c *channel.BaseCommand - - BeforeEach(func() { - c = &channel.BaseCommand{} - }) - - Describe("Complete", func() { - var ( - err error - factory *mocks.Factory - client *mocks.ResourceManagement - ) - - BeforeEach(func() { - factory = &mocks.Factory{} - client = &mocks.ResourceManagement{} - - factory.ResourceManagementReturns(client, nil) - - c.Factory = factory - }) - - JustBeforeEach(func() { - err = c.Complete() - }) - - It("should complete", func() { - Expect(err).To(BeNil()) - Expect(c.ResourceManagement).NotTo(BeNil()) - }) - - Context("when resmgmt fails", func() { - BeforeEach(func() { - factory.ResourceManagementReturns(nil, errors.New("factory error")) - }) - - It("should fail with factory error", func() { - Expect(err).NotTo(BeNil()) - }) - }) - }) -}) diff --git a/cmd/commands/channel/config_test.go b/cmd/commands/channel/config_test.go deleted file mode 100644 index 898e9f1..0000000 --- a/cmd/commands/channel/config_test.go +++ /dev/null @@ -1,173 +0,0 @@ -/* -Copyright State Street Corp. All Rights Reserved. - -SPDX-License-Identifier: Apache-2.0 -*/ - -package channel_test - -import ( - "bytes" - "errors" - "fmt" - "os" - - "github.com/hyperledger/fabric-sdk-go/pkg/common/providers/fab" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/spf13/cobra" - - "github.com/hyperledger/fabric-cli/cmd/commands/channel" - "github.com/hyperledger/fabric-cli/pkg/environment" - "github.com/hyperledger/fabric-cli/pkg/fabric/mocks" -) - -var _ = Describe("ChannelConfigCommand", func() { - var ( - cmd *cobra.Command - settings *environment.Settings - out *bytes.Buffer - - args []string - ) - - BeforeEach(func() { - out = new(bytes.Buffer) - - settings = &environment.Settings{ - Home: environment.Home(os.TempDir()), - Streams: environment.Streams{ - Out: out, - }, - } - - args = os.Args - }) - - JustBeforeEach(func() { - cmd = channel.NewChannelConfigCommand(settings) - }) - - AfterEach(func() { - os.Args = args - }) - - It("should create a channel config command", func() { - Expect(cmd.Name()).To(Equal("config")) - Expect(cmd.HasSubCommands()).To(BeFalse()) - }) - - It("should provide a help prompt", func() { - os.Args = append(os.Args, "--help") - - Expect(cmd.Execute()).Should(Succeed()) - Expect(fmt.Sprint(out)).To(ContainSubstring("config")) - }) -}) - -var _ = Describe("ChannelConfigImplementation", func() { - var ( - impl *channel.ConfigCommand - err error - out *bytes.Buffer - settings *environment.Settings - factory *mocks.Factory - client *mocks.ResourceManagement - ) - - BeforeEach(func() { - out = new(bytes.Buffer) - - settings = &environment.Settings{ - Home: environment.Home(os.TempDir()), - Streams: environment.Streams{ - Out: out, - }, - } - - factory = &mocks.Factory{} - client = &mocks.ResourceManagement{} - - impl = &channel.ConfigCommand{} - impl.Settings = settings - impl.Factory = factory - }) - - It("should not be nil", func() { - Expect(impl).ShouldNot(BeNil()) - }) - - Describe("Validate", func() { - JustBeforeEach(func() { - err = impl.Validate() - }) - - It("should fail without channel id", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(Equal("channel id not specified")) - }) - - Context("when channel id is set", func() { - BeforeEach(func() { - impl.ChannelID = "mychannel" - }) - - It("should succeed with channel id set", func() { - Expect(err).To(BeNil()) - }) - }) - }) - - Describe("Run", func() { - var ( - cfg *mocks.ChannelCfg - ) - - BeforeEach(func() { - impl.ResourceManagement = client - }) - - JustBeforeEach(func() { - err = impl.Run() - }) - - Context("when resmgmt client succeeds", func() { - BeforeEach(func() { - cfg = &mocks.ChannelCfg{} - cfg.IDReturns("mychannel") - cfg.BlockNumberReturns(0) - cfg.OrderersReturns([]string{ - "orderer.example.com", - }) - cfg.AnchorPeersReturns([]*fab.OrgAnchorPeer{ - { - Host: "peer.example.com", - Port: 8888, - Org: "foo", - }, - }) - - client.QueryConfigFromOrdererReturns(cfg, nil) - }) - - It("should succeed with channel config", func() { - Expect(err).To(BeNil()) - Expect(fmt.Sprint(out)).To(ContainSubstring("mychannel")) - Expect(fmt.Sprint(out)).To(ContainSubstring("0")) - Expect(fmt.Sprint(out)).To(ContainSubstring("orderer.example.com")) - Expect(fmt.Sprint(out)).To(ContainSubstring("peer.example.com:8888 (foo)")) - }) - }) - - Context("when resmgmt client fails", func() { - BeforeEach(func() { - client.QueryConfigFromOrdererReturns(nil, errors.New("query error")) - }) - - It("should fail to get channel config", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(ContainSubstring("query error")) - }) - }) - }) -}) diff --git a/cmd/commands/channel/create.go b/cmd/commands/channel/create.go index 564d987..694d1f0 100644 --- a/cmd/commands/channel/create.go +++ b/cmd/commands/channel/create.go @@ -8,10 +8,7 @@ package channel import ( "errors" - "fmt" - "os" - "github.com/hyperledger/fabric-sdk-go/pkg/client/resmgmt" "github.com/spf13/cobra" "github.com/hyperledger/fabric-cli/pkg/environment" @@ -75,7 +72,7 @@ func (c *CreateCommand) Validate() error { // Run executes the command func (c *CreateCommand) Run() error { - r, err := os.Open(c.ChannelTX) + /*r, err := os.Open(c.ChannelTX) if err != nil { return err } @@ -90,6 +87,6 @@ func (c *CreateCommand) Run() error { } fmt.Fprintf(c.Settings.Streams.Out, "successfully created channel '%s'\n", c.ChannelID) - + */ return nil } diff --git a/cmd/commands/channel/create_test.go b/cmd/commands/channel/create_test.go deleted file mode 100644 index 7dfbf33..0000000 --- a/cmd/commands/channel/create_test.go +++ /dev/null @@ -1,169 +0,0 @@ -/* -Copyright State Street Corp. All Rights Reserved. - -SPDX-License-Identifier: Apache-2.0 -*/ - -package channel_test - -import ( - "bytes" - "errors" - "fmt" - "os" - - "github.com/hyperledger/fabric-sdk-go/pkg/client/resmgmt" - "github.com/hyperledger/fabric-sdk-go/pkg/common/providers/fab" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/spf13/cobra" - - "github.com/hyperledger/fabric-cli/cmd/commands/channel" - "github.com/hyperledger/fabric-cli/pkg/environment" - "github.com/hyperledger/fabric-cli/pkg/fabric/mocks" -) - -var _ = Describe("ChannelCreateCommand", func() { - var ( - cmd *cobra.Command - settings *environment.Settings - out *bytes.Buffer - - args []string - ) - - BeforeEach(func() { - out = new(bytes.Buffer) - - settings = &environment.Settings{ - Home: environment.Home(os.TempDir()), - Streams: environment.Streams{ - Out: out, - }, - } - - args = os.Args - }) - - JustBeforeEach(func() { - cmd = channel.NewChannelCreateCommand(settings) - }) - - AfterEach(func() { - os.Args = args - }) - - It("should create a channel create command", func() { - Expect(cmd.Name()).To(Equal("create")) - Expect(cmd.HasSubCommands()).To(BeFalse()) - }) - - It("should provide a help prompt", func() { - os.Args = append(os.Args, "--help") - - Expect(cmd.Execute()).Should(Succeed()) - Expect(fmt.Sprint(out)).To(ContainSubstring("create ")) - }) -}) - -var _ = Describe("ChannelCreateImplementation", func() { - var ( - impl *channel.CreateCommand - err error - out *bytes.Buffer - settings *environment.Settings - factory *mocks.Factory - client *mocks.ResourceManagement - ) - - BeforeEach(func() { - out = new(bytes.Buffer) - - settings = &environment.Settings{ - Home: environment.Home(os.TempDir()), - Streams: environment.Streams{ - Out: out, - }, - } - - factory = &mocks.Factory{} - client = &mocks.ResourceManagement{} - - impl = &channel.CreateCommand{} - impl.Settings = settings - impl.Factory = factory - }) - - It("should not be nil", func() { - Expect(impl).ShouldNot(BeNil()) - }) - - Describe("Validate", func() { - JustBeforeEach(func() { - err = impl.Validate() - }) - - It("should fail without channel id", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(Equal("channel id not specified")) - }) - - Context("when channel id is set", func() { - BeforeEach(func() { - impl.ChannelID = "mychannel" - }) - - It("should fail without channel tx", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(Equal("channel tx path not specified")) - }) - }) - - Context("when channel id and tx are set", func() { - BeforeEach(func() { - impl.ChannelID = "mychannel" - impl.ChannelTX = "./testdata/channel.tx" - }) - - It("should succeed with channel id and tx path set", func() { - Expect(err).To(BeNil()) - }) - }) - }) - - Describe("Run", func() { - BeforeEach(func() { - impl.ChannelID = "mychannel" - impl.ChannelTX = "./testdata/channel.tx" - impl.ResourceManagement = client - }) - - JustBeforeEach(func() { - err = impl.Run() - }) - - Context("when resmgmt client succeeds", func() { - BeforeEach(func() { - client.SaveChannelReturns(resmgmt.SaveChannelResponse{ - TransactionID: fab.TransactionID("123"), - }, nil) - }) - - It("should succeed with channel create", func() { - Expect(err).To(BeNil()) - Expect(fmt.Sprint(out)).To(Equal("successfully created channel 'mychannel'\n")) - }) - }) - - Context("when resmgmt client fails", func() { - BeforeEach(func() { - client.SaveChannelReturns(resmgmt.SaveChannelResponse{}, errors.New("save error")) - }) - - It("should fail to create channel", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(ContainSubstring("save error")) - }) - }) - }) -}) diff --git a/cmd/commands/channel/join.go b/cmd/commands/channel/join.go index c7bb16e..19e42cf 100644 --- a/cmd/commands/channel/join.go +++ b/cmd/commands/channel/join.go @@ -8,9 +8,7 @@ package channel import ( "errors" - "fmt" - "github.com/hyperledger/fabric-sdk-go/pkg/client/resmgmt" "github.com/spf13/cobra" "github.com/hyperledger/fabric-cli/pkg/environment" @@ -68,7 +66,7 @@ func (c *JoinCommand) Validate() error { // Run executes the command func (c *JoinCommand) Run() error { - context, err := c.Settings.Config.GetCurrentContext() + /*context, err := c.Settings.Config.GetCurrentContext() if err != nil { return err } @@ -82,6 +80,6 @@ func (c *JoinCommand) Run() error { } fmt.Fprintf(c.Settings.Streams.Out, "successfully joined channel '%s'\n", c.ChannelID) - + */ return nil } diff --git a/cmd/commands/channel/join_test.go b/cmd/commands/channel/join_test.go deleted file mode 100644 index 765cad6..0000000 --- a/cmd/commands/channel/join_test.go +++ /dev/null @@ -1,172 +0,0 @@ -/* -Copyright State Street Corp. All Rights Reserved. - -SPDX-License-Identifier: Apache-2.0 -*/ - -package channel_test - -import ( - "bytes" - "errors" - "fmt" - "os" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/spf13/cobra" - - "github.com/hyperledger/fabric-cli/cmd/commands/channel" - "github.com/hyperledger/fabric-cli/pkg/environment" - "github.com/hyperledger/fabric-cli/pkg/fabric/mocks" -) - -var _ = Describe("ChannelJoinCommand", func() { - var ( - cmd *cobra.Command - settings *environment.Settings - out *bytes.Buffer - - args []string - ) - - BeforeEach(func() { - out = new(bytes.Buffer) - - settings = &environment.Settings{ - Home: environment.Home(os.TempDir()), - Streams: environment.Streams{ - Out: out, - }, - } - - args = os.Args - }) - - JustBeforeEach(func() { - cmd = channel.NewChannelJoinCommand(settings) - }) - - AfterEach(func() { - os.Args = args - }) - - It("should create a channel join command", func() { - Expect(cmd.Name()).To(Equal("join")) - Expect(cmd.HasSubCommands()).To(BeFalse()) - }) - - It("should provide a help prompt", func() { - os.Args = append(os.Args, "--help") - - Expect(cmd.Execute()).Should(Succeed()) - Expect(fmt.Sprint(out)).To(ContainSubstring("join ")) - }) -}) - -var _ = Describe("ChannelJoinImplementation", func() { - var ( - impl *channel.JoinCommand - err error - out *bytes.Buffer - settings *environment.Settings - factory *mocks.Factory - client *mocks.ResourceManagement - ) - - BeforeEach(func() { - out = new(bytes.Buffer) - - settings = &environment.Settings{ - Home: environment.Home(os.TempDir()), - Streams: environment.Streams{ - Out: out, - }, - } - - factory = &mocks.Factory{} - client = &mocks.ResourceManagement{} - - impl = &channel.JoinCommand{} - impl.Settings = settings - impl.Factory = factory - }) - - It("should not be nil", func() { - Expect(impl).ShouldNot(BeNil()) - }) - - Describe("Validate", func() { - JustBeforeEach(func() { - err = impl.Validate() - }) - - It("should fail without channel id", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(Equal("channel id not specified")) - }) - - Context("when channel id is set", func() { - BeforeEach(func() { - impl.ChannelID = "mychannel" - }) - - It("should succeed with channel id set", func() { - Expect(err).To(BeNil()) - }) - }) - }) - - Describe("Run", func() { - BeforeEach(func() { - impl.ChannelID = "mychannel" - impl.ResourceManagement = client - }) - - JustBeforeEach(func() { - err = impl.Run() - }) - - It("should fail without context", func() { - Expect(err).NotTo(BeNil()) - }) - - Context("when resmgmt client succeeds", func() { - BeforeEach(func() { - settings.Config = &environment.Config{ - CurrentContext: "foo", - Contexts: map[string]*environment.Context{ - "foo": { - Peers: []string{"peer0", "peer1"}, - }, - }, - } - client.JoinChannelReturns(nil) - }) - - It("should succeed with channel join", func() { - Expect(err).To(BeNil()) - Expect(fmt.Sprint(out)).To(Equal("successfully joined channel 'mychannel'\n")) - }) - }) - - Context("when resmgmt client fails", func() { - BeforeEach(func() { - settings.Config = &environment.Config{ - CurrentContext: "foo", - Contexts: map[string]*environment.Context{ - "foo": { - Peers: []string{"peer0", "peer1"}, - }, - }, - } - client.JoinChannelReturns(errors.New("join error")) - }) - - It("should fail to get channel join", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(ContainSubstring("join error")) - }) - }) - }) -}) diff --git a/cmd/commands/channel/list.go b/cmd/commands/channel/list.go index 7b742ff..384229a 100644 --- a/cmd/commands/channel/list.go +++ b/cmd/commands/channel/list.go @@ -7,9 +7,6 @@ SPDX-License-Identifier: Apache-2.0 package channel import ( - "fmt" - - "github.com/hyperledger/fabric-sdk-go/pkg/client/resmgmt" "github.com/spf13/cobra" "github.com/hyperledger/fabric-cli/pkg/environment" @@ -45,7 +42,7 @@ type ListCommand struct { // Run executes the command func (c *ListCommand) Run() error { - context, err := c.Settings.Config.GetCurrentContext() + /*context, err := c.Settings.Config.GetCurrentContext() if err != nil { return err } @@ -63,6 +60,6 @@ func (c *ListCommand) Run() error { for _, channel := range resp.Channels { fmt.Fprintf(c.Settings.Streams.Out, " - %s\n", channel.ChannelId) } - + */ return nil } diff --git a/cmd/commands/channel/list_test.go b/cmd/commands/channel/list_test.go deleted file mode 100644 index 934f9b4..0000000 --- a/cmd/commands/channel/list_test.go +++ /dev/null @@ -1,157 +0,0 @@ -/* -Copyright State Street Corp. All Rights Reserved. - -SPDX-License-Identifier: Apache-2.0 -*/ - -package channel_test - -import ( - "bytes" - "errors" - "fmt" - "os" - - pb "github.com/hyperledger/fabric-protos-go/peer" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/spf13/cobra" - - "github.com/hyperledger/fabric-cli/cmd/commands/channel" - "github.com/hyperledger/fabric-cli/pkg/environment" - "github.com/hyperledger/fabric-cli/pkg/fabric/mocks" -) - -var _ = Describe("ChannelListCommand", func() { - var ( - cmd *cobra.Command - settings *environment.Settings - out *bytes.Buffer - - args []string - ) - - BeforeEach(func() { - out = new(bytes.Buffer) - - settings = &environment.Settings{ - Home: environment.Home(os.TempDir()), - Streams: environment.Streams{ - Out: out, - }, - } - - args = os.Args - }) - - JustBeforeEach(func() { - cmd = channel.NewChannelListCommand(settings) - }) - - AfterEach(func() { - os.Args = args - }) - - It("should create a channel list command", func() { - Expect(cmd.Name()).To(Equal("list")) - Expect(cmd.HasSubCommands()).To(BeFalse()) - }) - - It("should provide a help prompt", func() { - os.Args = append(os.Args, "--help") - - Expect(cmd.Execute()).Should(Succeed()) - Expect(fmt.Sprint(out)).To(ContainSubstring("list")) - }) -}) - -var _ = Describe("ChannelListImplementation", func() { - var ( - impl *channel.ListCommand - err error - out *bytes.Buffer - settings *environment.Settings - factory *mocks.Factory - client *mocks.ResourceManagement - ) - - BeforeEach(func() { - out = new(bytes.Buffer) - - settings = &environment.Settings{ - Home: environment.Home(os.TempDir()), - Streams: environment.Streams{ - Out: out, - }, - } - - factory = &mocks.Factory{} - client = &mocks.ResourceManagement{} - - impl = &channel.ListCommand{} - impl.Settings = settings - impl.Factory = factory - }) - - It("should not be nil", func() { - Expect(impl).ShouldNot(BeNil()) - }) - - Describe("Run", func() { - BeforeEach(func() { - impl.ResourceManagement = client - }) - - JustBeforeEach(func() { - err = impl.Run() - }) - - It("should fail without context", func() { - Expect(err).NotTo(BeNil()) - }) - - Context("when resmgmt client succeeds", func() { - BeforeEach(func() { - settings.Config = &environment.Config{ - CurrentContext: "foo", - Contexts: map[string]*environment.Context{ - "foo": { - Peers: []string{"peer0", "peer1"}, - }, - }, - } - client.QueryChannelsReturns(&pb.ChannelQueryResponse{ - Channels: []*pb.ChannelInfo{ - { - ChannelId: "mychannel", - }, - }, - }, nil) - }) - - It("should succeed with channel list", func() { - Expect(err).To(BeNil()) - Expect(fmt.Sprint(out)).To(ContainSubstring("mychannel")) - }) - }) - - Context("when resmgmt client fails", func() { - BeforeEach(func() { - settings.Config = &environment.Config{ - CurrentContext: "foo", - Contexts: map[string]*environment.Context{ - "foo": { - Peers: []string{"peer0", "peer1"}, - }, - }, - } - client.QueryChannelsReturns(nil, errors.New("query error")) - }) - - It("should fail to get channel list", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(ContainSubstring("query error")) - }) - }) - }) -}) diff --git a/cmd/commands/channel/update.go b/cmd/commands/channel/update.go index 786a781..24db9f5 100644 --- a/cmd/commands/channel/update.go +++ b/cmd/commands/channel/update.go @@ -8,10 +8,7 @@ package channel import ( "errors" - "fmt" - "os" - "github.com/hyperledger/fabric-sdk-go/pkg/client/resmgmt" "github.com/spf13/cobra" "github.com/hyperledger/fabric-cli/pkg/environment" @@ -71,7 +68,7 @@ func (c *UpdateCommand) Validate() error { // Run executes the command func (c *UpdateCommand) Run() error { - r, err := os.Open(c.ChannelTX) + /*r, err := os.Open(c.ChannelTX) if err != nil { return err } @@ -86,6 +83,6 @@ func (c *UpdateCommand) Run() error { } fmt.Fprintf(c.Settings.Streams.Out, "successfully updated channel '%s'\n", c.ChannelID) - + */ return nil } diff --git a/cmd/commands/channel/update_test.go b/cmd/commands/channel/update_test.go deleted file mode 100644 index 38f378a..0000000 --- a/cmd/commands/channel/update_test.go +++ /dev/null @@ -1,169 +0,0 @@ -/* -Copyright State Street Corp. All Rights Reserved. - -SPDX-License-Identifier: Apache-2.0 -*/ - -package channel_test - -import ( - "bytes" - "errors" - "fmt" - "os" - - "github.com/hyperledger/fabric-sdk-go/pkg/client/resmgmt" - "github.com/hyperledger/fabric-sdk-go/pkg/common/providers/fab" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/spf13/cobra" - - "github.com/hyperledger/fabric-cli/cmd/commands/channel" - "github.com/hyperledger/fabric-cli/pkg/environment" - "github.com/hyperledger/fabric-cli/pkg/fabric/mocks" -) - -var _ = Describe("ChannelUpdateCommand", func() { - var ( - cmd *cobra.Command - settings *environment.Settings - out *bytes.Buffer - - args []string - ) - - BeforeEach(func() { - out = new(bytes.Buffer) - - settings = &environment.Settings{ - Home: environment.Home(os.TempDir()), - Streams: environment.Streams{ - Out: out, - }, - } - - args = os.Args - }) - - JustBeforeEach(func() { - cmd = channel.NewChannelUpdateCommand(settings) - }) - - AfterEach(func() { - os.Args = args - }) - - It("should create a channel update command", func() { - Expect(cmd.Name()).To(Equal("update")) - Expect(cmd.HasSubCommands()).To(BeFalse()) - }) - - It("should provide a help prompt", func() { - os.Args = append(os.Args, "--help") - - Expect(cmd.Execute()).Should(Succeed()) - Expect(fmt.Sprint(out)).To(ContainSubstring("update ")) - }) -}) - -var _ = Describe("ChannelUpdateImplementation", func() { - var ( - impl *channel.UpdateCommand - err error - out *bytes.Buffer - settings *environment.Settings - factory *mocks.Factory - client *mocks.ResourceManagement - ) - - BeforeEach(func() { - out = new(bytes.Buffer) - - settings = &environment.Settings{ - Home: environment.Home(os.TempDir()), - Streams: environment.Streams{ - Out: out, - }, - } - - factory = &mocks.Factory{} - client = &mocks.ResourceManagement{} - - impl = &channel.UpdateCommand{} - impl.Settings = settings - impl.Factory = factory - }) - - It("should not be nil", func() { - Expect(impl).ShouldNot(BeNil()) - }) - - Describe("Validate", func() { - JustBeforeEach(func() { - err = impl.Validate() - }) - - It("should fail without channel id", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(Equal("channel id not specified")) - }) - - Context("when channel id is set", func() { - BeforeEach(func() { - impl.ChannelID = "mychannel" - }) - - It("should fail without channel tx", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(Equal("channel tx path not specified")) - }) - }) - - Context("when channel id and tx are set", func() { - BeforeEach(func() { - impl.ChannelID = "mychannel" - impl.ChannelTX = "./testdata/channel.tx" - }) - - It("should succeed with channel id and tx path set", func() { - Expect(err).To(BeNil()) - }) - }) - }) - - Describe("Run", func() { - BeforeEach(func() { - impl.ChannelID = "mychannel" - impl.ChannelTX = "./testdata/channel.tx" - impl.ResourceManagement = client - }) - - JustBeforeEach(func() { - err = impl.Run() - }) - - Context("when resmgmt client succeeds", func() { - BeforeEach(func() { - client.SaveChannelReturns(resmgmt.SaveChannelResponse{ - TransactionID: fab.TransactionID("123"), - }, nil) - }) - - It("should succeed with channel update", func() { - Expect(err).To(BeNil()) - Expect(fmt.Sprint(out)).To(Equal("successfully updated channel 'mychannel'\n")) - }) - }) - - Context("when resmgmt client fails", func() { - BeforeEach(func() { - client.SaveChannelReturns(resmgmt.SaveChannelResponse{}, errors.New("save error")) - }) - - It("should fail to update channel", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(ContainSubstring("save error")) - }) - }) - }) -}) diff --git a/cmd/commands/common/common.go b/cmd/commands/common/common.go index 5a8642d..694dfd3 100644 --- a/cmd/commands/common/common.go +++ b/cmd/commands/common/common.go @@ -5,10 +5,8 @@ import ( "errors" "io/ioutil" - "github.com/hyperledger/fabric-protos-go/common" - pb "github.com/hyperledger/fabric-protos-go/peer" - - "github.com/hyperledger/fabric-sdk-go/third_party/github.com/hyperledger/fabric/common/policydsl" + "github.com/hyperledger/fabric-protos-go-apiv2/common" + pb "github.com/hyperledger/fabric-protos-go-apiv2/peer" ) // CollectionConfigJSON contains the parameters for a collection configuration @@ -45,13 +43,13 @@ func GetCollectionsConfigFromBytes(bytes []byte) ([]*pb.CollectionConfig, error) ccarray := make([]*pb.CollectionConfig, 0, len(cconf)) for _, cconfitem := range cconf { - p, err := policydsl.FromString(cconfitem.Policy) - if err != nil { - return nil, err - } + //p, err := policydsl.FromString(cconfitem.Policy) + //if err != nil { + // return nil, err + //} cpc := &pb.CollectionPolicyConfig{ Payload: &pb.CollectionPolicyConfig_SignaturePolicy{ - SignaturePolicy: p, + //SignaturePolicy: p, }, } cc := &pb.CollectionConfig{ @@ -74,7 +72,7 @@ func GetCollectionsConfigFromBytes(bytes []byte) ([]*pb.CollectionConfig, error) // GetChaincodePolicy returns the signature policy from the given policy string func GetChaincodePolicy(policyString string) (*common.SignaturePolicyEnvelope, error) { - if len(policyString) == 0 { + /*if len(policyString) == 0 { return policydsl.AcceptAllPolicy, nil } @@ -82,7 +80,8 @@ func GetChaincodePolicy(policyString string) (*common.SignaturePolicyEnvelope, e if err != nil { return nil, errors.New("error parsing chaincode policy") } - return policy, nil + return policy, nil*/ + return nil, nil } // AsByteArgs converts the given string array into an array of byte arrays so that they diff --git a/cmd/commands/lifecycle/approve.go b/cmd/commands/lifecycle/approve.go index 10793c9..6d9a575 100644 --- a/cmd/commands/lifecycle/approve.go +++ b/cmd/commands/lifecycle/approve.go @@ -10,12 +10,9 @@ import ( "fmt" "strconv" - "github.com/hyperledger/fabric-sdk-go/pkg/client/resmgmt" - "github.com/hyperledger/fabric-sdk-go/pkg/common/errors/retry" "github.com/pkg/errors" "github.com/spf13/cobra" - "github.com/hyperledger/fabric-cli/cmd/commands/common" "github.com/hyperledger/fabric-cli/pkg/environment" ) @@ -111,12 +108,13 @@ func (c *ApproveCommand) Validate() error { // Run executes the command func (c *ApproveCommand) Run() error { - context, err := c.Settings.Config.GetCurrentContext() + //context + _, err := c.Settings.Config.GetCurrentContext() if err != nil { return err } - signaturePolicy, err := common.GetChaincodePolicy(c.SignaturePolicy) + /*signaturePolicy, err := common.GetChaincodePolicy(c.SignaturePolicy) if err != nil { return err } @@ -124,21 +122,22 @@ func (c *ApproveCommand) Run() error { collectionsConfig, err := common.GetCollectionConfigFromFile(c.CollectionsConfig) if err != nil { return err - } + }*/ - sequence, err := strconv.ParseInt(c.Sequence, 10, 64) + //sequence + _, err = strconv.ParseInt(c.Sequence, 10, 64) if err != nil { return errors.WithMessage(err, "invalid sequence") } - req := resmgmt.LifecycleApproveCCRequest{ + /*req := resmgmt.LifecycleApproveCCRequest{ Name: c.Name, Version: c.Version, PackageID: c.PackageID, Sequence: sequence, - SignaturePolicy: signaturePolicy, + SignaturePolicy: nil, ChannelConfigPolicy: c.ChannelConfigPolicy, - CollectionConfig: collectionsConfig, + CollectionConfig: nil, InitRequired: c.InitRequired, EndorsementPlugin: c.EndorsementPlugin, ValidationPlugin: c.ValidationPlugin, @@ -151,7 +150,7 @@ func (c *ApproveCommand) Run() error { if _, err := c.ResourceManagement.LifecycleApproveCC(context.Channel, req, options...); err != nil { return err - } + }*/ fmt.Fprintf(c.Settings.Streams.Out, "successfully approved chaincode '%s'\n", c.Name) diff --git a/cmd/commands/lifecycle/approve_test.go b/cmd/commands/lifecycle/approve_test.go deleted file mode 100644 index a0b77e7..0000000 --- a/cmd/commands/lifecycle/approve_test.go +++ /dev/null @@ -1,241 +0,0 @@ -/* -Copyright SecureKey Technologies Inc. All Rights Reserved. - -SPDX-License-Identifier: Apache-2.0 -*/ - -package lifecycle_test - -import ( - "bytes" - "errors" - "fmt" - "os" - - "github.com/hyperledger/fabric-cli/cmd/commands/lifecycle" - "github.com/hyperledger/fabric-sdk-go/pkg/client/resmgmt" - "github.com/hyperledger/fabric-sdk-go/pkg/common/providers/fab" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/spf13/cobra" - - "github.com/hyperledger/fabric-cli/pkg/environment" - "github.com/hyperledger/fabric-cli/pkg/fabric/mocks" -) - -var _ = Describe("LifecycleApproveCommand", func() { - var ( - cmd *cobra.Command - settings *environment.Settings - out *bytes.Buffer - - args []string - ) - - BeforeEach(func() { - out = new(bytes.Buffer) - - settings = &environment.Settings{ - Home: environment.Home(os.TempDir()), - Streams: environment.Streams{ - Out: out, - }, - } - - args = os.Args - }) - - JustBeforeEach(func() { - cmd = lifecycle.NewApproveCommand(settings) - }) - - AfterEach(func() { - os.Args = args - }) - - It("should create a lifecycle approve command", func() { - Expect(cmd.Name()).To(Equal("approve")) - Expect(cmd.HasSubCommands()).To(BeFalse()) - }) - - It("should provide a help prompt", func() { - os.Args = append(os.Args, "--help") - - Expect(cmd.Execute()).Should(Succeed()) - Expect(fmt.Sprint(out)).To(ContainSubstring("approve ")) - }) -}) - -var _ = Describe("LifecycleApproveImplementation", func() { - var ( - impl *lifecycle.ApproveCommand - err error - out *bytes.Buffer - settings *environment.Settings - factory *mocks.Factory - client *mocks.ResourceManagement - ) - - BeforeEach(func() { - out = new(bytes.Buffer) - - settings = &environment.Settings{ - Home: environment.Home(os.TempDir()), - Streams: environment.Streams{ - Out: out, - }, - } - - factory = &mocks.Factory{} - client = &mocks.ResourceManagement{} - - impl = &lifecycle.ApproveCommand{} - impl.Settings = settings - impl.Factory = factory - }) - - It("should not be nil", func() { - Expect(impl).ShouldNot(BeNil()) - }) - - Describe("Validate", func() { - JustBeforeEach(func() { - err = impl.Validate() - }) - - It("should fail when name is not set", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(Equal("chaincode name not specified")) - }) - - Context("when chaincode version is not set", func() { - BeforeEach(func() { - impl.Name = "mycc" - }) - - It("should fail without chaincode version", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(Equal("chaincode version not specified")) - }) - }) - - Context("when chaincode package ID is not set", func() { - BeforeEach(func() { - impl.Name = "mycc" - impl.Version = "0.0.0" - }) - - It("should fail without chaincode package ID", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(Equal("chaincode package ID not specified")) - }) - }) - - Context("when chaincode sequence is not set", func() { - BeforeEach(func() { - impl.Name = "mycc" - impl.Version = "0.0.0" - impl.PackageID = "pkg1" - }) - - It("should fail without chaincode sequence", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(Equal("sequence not specified")) - }) - }) - - Context("when chaincode sequence is not greater than 0", func() { - BeforeEach(func() { - impl.Name = "mycc" - impl.Version = "0.0.0" - impl.PackageID = "pkg1" - impl.Sequence = "-1" - }) - - It("should fail with chaincode sequence not greater than 0", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(Equal("sequence must be greater than 0")) - }) - }) - - Context("when chaincode sequence is invalid", func() { - BeforeEach(func() { - impl.Name = "mycc" - impl.Version = "0.0.0" - impl.PackageID = "pkg1" - impl.Sequence = "xxx" - }) - - It("should fail with chaincode sequence is invalid", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(ContainSubstring("invalid sequence")) - }) - }) - - Context("when all arguments are set", func() { - BeforeEach(func() { - impl.Name = "mycc" - impl.Version = "0.0.0" - impl.PackageID = "pkg1" - impl.Sequence = "1" - }) - - It("should succeed with all arguments", func() { - Expect(err).To(BeNil()) - }) - }) - }) - - Describe("Run", func() { - BeforeEach(func() { - impl.Name = "mycc" - impl.Version = "0.0.0" - impl.Sequence = "1" - impl.ResourceManagement = client - }) - - JustBeforeEach(func() { - err = impl.Run() - }) - - It("should fail without a current context", func() { - Expect(err).NotTo(BeNil()) - }) - - Context("when resmgmt client succeeds", func() { - BeforeEach(func() { - settings.Config = &environment.Config{ - Contexts: map[string]*environment.Context{ - "foo": {}, - }, - CurrentContext: "foo", - } - - client.InstantiateCCReturns(resmgmt.InstantiateCCResponse{}, nil) - }) - - It("should succeed with chaincode approve", func() { - Expect(err).To(BeNil()) - Expect(fmt.Sprint(out)).To(Equal("successfully approved chaincode 'mycc'\n")) - }) - }) - - Context("when resmgmt client fails", func() { - BeforeEach(func() { - settings.Config = &environment.Config{ - Contexts: map[string]*environment.Context{ - "foo": {}, - }, - CurrentContext: "foo", - } - - client.LifecycleApproveCCReturns(fab.TransactionID(""), errors.New("approve error")) - }) - - It("should fail to approve chaincode", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(ContainSubstring("approve error")) - }) - }) - }) -}) diff --git a/cmd/commands/lifecycle/checkcommitreadiness.go b/cmd/commands/lifecycle/checkcommitreadiness.go index 27e428c..d2a807d 100644 --- a/cmd/commands/lifecycle/checkcommitreadiness.go +++ b/cmd/commands/lifecycle/checkcommitreadiness.go @@ -9,9 +9,6 @@ package lifecycle import ( "strconv" - "github.com/hyperledger/fabric-cli/cmd/commands/common" - "github.com/hyperledger/fabric-sdk-go/pkg/client/resmgmt" - "github.com/hyperledger/fabric-sdk-go/pkg/common/errors/retry" "github.com/pkg/errors" "github.com/spf13/cobra" @@ -102,7 +99,7 @@ func (c *CheckCommitReadinessCommand) Validate() error { // Run executes the command func (c *CheckCommitReadinessCommand) Run() error { - context, err := c.Settings.Config.GetCurrentContext() + /*context, err := c.Settings.Config.GetCurrentContext() if err != nil { return err } @@ -122,7 +119,7 @@ func (c *CheckCommitReadinessCommand) Run() error { return errors.WithMessage(err, "invalid sequence") } - resp, err := c.ResourceManagement.LifecycleCheckCCCommitReadiness( + /*resp, err := c.ResourceManagement.LifecycleCheckCCCommitReadiness( context.Channel, resmgmt.LifecycleCheckCCCommitReadinessRequest{ Name: c.Name, @@ -146,11 +143,12 @@ func (c *CheckCommitReadinessCommand) Run() error { return c.printJSONResponse(resp) } - c.printResponse(resp) + c.printResponse(resp)*/ return nil } +/* func (c *CheckCommitReadinessCommand) printResponse(crr resmgmt.LifecycleCheckCCCommitReadinessResponse) { var approvingOrgs []string var nonApprovingOrgs []string @@ -166,3 +164,4 @@ func (c *CheckCommitReadinessCommand) printResponse(crr resmgmt.LifecycleCheckCC c.printf("Approving orgs: %s\n", approvingOrgs) c.printf("Non-approving orgs: %s\n", nonApprovingOrgs) } +*/ diff --git a/cmd/commands/lifecycle/checkcommitreadiness_test.go b/cmd/commands/lifecycle/checkcommitreadiness_test.go deleted file mode 100644 index d2799c9..0000000 --- a/cmd/commands/lifecycle/checkcommitreadiness_test.go +++ /dev/null @@ -1,243 +0,0 @@ -/* -Copyright SecureKey Technologies Inc. All Rights Reserved. - -SPDX-License-Identifier: Apache-2.0 -*/ - -package lifecycle_test - -import ( - "bytes" - "errors" - "fmt" - "os" - - "github.com/hyperledger/fabric-sdk-go/pkg/client/resmgmt" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/spf13/cobra" - - "github.com/hyperledger/fabric-cli/cmd/commands/lifecycle" - "github.com/hyperledger/fabric-cli/pkg/environment" - "github.com/hyperledger/fabric-cli/pkg/fabric/mocks" -) - -const ( - checkCommitReadinessPlainTextResponse = "Approving orgs: [org1]\nNon-approving orgs: [org2]\n" - checkCommitReadinessJSONResponse = `{"approvals":{"org1":true,"org2":false}}` -) - -var _ = Describe("LifecycleChaincodeCheckCommitReadinessCommand", func() { - var ( - cmd *cobra.Command - settings *environment.Settings - out *bytes.Buffer - - args []string - ) - - BeforeEach(func() { - out = new(bytes.Buffer) - - settings = &environment.Settings{ - Home: environment.Home(os.TempDir()), - Streams: environment.Streams{ - Out: out, - }, - } - - args = os.Args - }) - - JustBeforeEach(func() { - cmd = lifecycle.NewCheckCommitReadinessCommand(settings) - }) - - AfterEach(func() { - os.Args = args - }) - - It("should create a chaincode checkcommitreadiness command", func() { - Expect(cmd.Name()).To(Equal("checkcommitreadiness")) - Expect(cmd.HasSubCommands()).To(BeFalse()) - }) - - It("should provide a help prompt", func() { - os.Args = append(os.Args, "--help") - - Expect(cmd.Execute()).Should(Succeed()) - Expect(fmt.Sprint(out)).To(ContainSubstring("checkcommitreadiness")) - }) -}) - -var _ = Describe("LifecycleChaincodeCheckCommitReadinessImplementation", func() { - var ( - impl *lifecycle.CheckCommitReadinessCommand - err error - out *bytes.Buffer - settings *environment.Settings - factory *mocks.Factory - client *mocks.ResourceManagement - ) - - BeforeEach(func() { - out = new(bytes.Buffer) - - settings = &environment.Settings{ - Home: environment.Home(os.TempDir()), - Streams: environment.Streams{ - Out: out, - }, - } - - factory = &mocks.Factory{} - client = &mocks.ResourceManagement{} - - impl = &lifecycle.CheckCommitReadinessCommand{} - impl.Settings = settings - impl.Factory = factory - }) - - It("should not be nil", func() { - Expect(impl).ShouldNot(BeNil()) - }) - - Describe("Validate", func() { - JustBeforeEach(func() { - err = impl.Validate() - }) - - It("should fail when chaincode name is not set", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(Equal("chaincode name not specified")) - }) - - Context("when chaincode version is not set", func() { - BeforeEach(func() { - impl.Name = "mycc" - }) - - It("should fail without chaincode version", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(Equal("chaincode version not specified")) - }) - }) - - Context("when chaincode sequence is not set", func() { - BeforeEach(func() { - impl.Name = "mycc" - impl.Version = "0.0.0" - }) - - It("should fail without chaincode sequence", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(Equal("sequence not specified")) - }) - }) - - Context("when chaincode sequence is not greater than 0", func() { - BeforeEach(func() { - impl.Name = "mycc" - impl.Version = "0.0.0" - impl.Sequence = "-1" - }) - - It("should fail with chaincode sequence not greater than 0", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(Equal("sequence must be greater than 0")) - }) - }) - - Context("when chaincode sequence is invalid", func() { - BeforeEach(func() { - impl.Name = "mycc" - impl.Version = "0.0.0" - impl.Sequence = "xxx" - }) - - It("should fail with chaincode sequence is invalid", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(ContainSubstring("invalid sequence")) - }) - }) - - Context("when all arguments are set", func() { - BeforeEach(func() { - impl.Name = "mycc" - impl.Version = "0.0.0" - impl.Sequence = "1" - }) - - It("should succeed with all arguments", func() { - Expect(err).To(BeNil()) - }) - }) - }) - - Describe("Run", func() { - BeforeEach(func() { - impl.Name = "cc1" - impl.Sequence = "1" - - result := resmgmt.LifecycleCheckCCCommitReadinessResponse{ - Approvals: map[string]bool{"org1": true, "org2": false}, - } - - client.LifecycleCheckCCCommitReadinessReturns(result, nil) - impl.ResourceManagement = client - }) - - JustBeforeEach(func() { - err = impl.Run() - }) - - Context("when resmgmt client succeeds", func() { - BeforeEach(func() { - settings.Config = &environment.Config{ - Contexts: map[string]*environment.Context{ - "foo": { - Peers: []string{"peer1"}, - }, - }, - CurrentContext: "foo", - } - }) - - It("should succeed with plain text response", func() { - Expect(err).To(BeNil()) - Expect(fmt.Sprint(out)).To(Equal(checkCommitReadinessPlainTextResponse)) - }) - - When("the output format is set to json", func() { - BeforeEach(func() { - impl.OutputFormat = "json" - }) - - It("should succeed with JSON response", func() { - Expect(err).To(BeNil()) - Expect(fmt.Sprint(out)).To(Equal(checkCommitReadinessJSONResponse)) - }) - }) - }) - - Context("when resmgmt client fails", func() { - BeforeEach(func() { - settings.Config = &environment.Config{ - Contexts: map[string]*environment.Context{ - "foo": { - Peers: []string{"peer1"}, - }, - }, - CurrentContext: "foo", - } - - client.LifecycleCheckCCCommitReadinessReturns(resmgmt.LifecycleCheckCCCommitReadinessResponse{}, errors.New("check commit readiness error")) - }) - - It("should fail to check chaincode for commit readiness", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(ContainSubstring("check commit readiness error")) - }) - }) - }) -}) diff --git a/cmd/commands/lifecycle/commit.go b/cmd/commands/lifecycle/commit.go index ca12283..d6a41a9 100644 --- a/cmd/commands/lifecycle/commit.go +++ b/cmd/commands/lifecycle/commit.go @@ -7,15 +7,11 @@ SPDX-License-Identifier: Apache-2.0 package lifecycle import ( - "fmt" "strconv" - "github.com/hyperledger/fabric-sdk-go/pkg/client/resmgmt" - "github.com/hyperledger/fabric-sdk-go/pkg/common/errors/retry" "github.com/pkg/errors" "github.com/spf13/cobra" - "github.com/hyperledger/fabric-cli/cmd/commands/common" "github.com/hyperledger/fabric-cli/pkg/environment" ) @@ -107,7 +103,7 @@ func (c *CommitCommand) Validate() error { // Run executes the command func (c *CommitCommand) Run() error { - context, err := c.Settings.Config.GetCurrentContext() + /*context, err := c.Settings.Config.GetCurrentContext() if err != nil { return err } @@ -155,5 +151,6 @@ func (c *CommitCommand) Run() error { fmt.Fprintf(c.Settings.Streams.Out, "successfully committed chaincode '%s'\n", c.Name) + return nil*/ return nil } diff --git a/cmd/commands/lifecycle/commit_test.go b/cmd/commands/lifecycle/commit_test.go deleted file mode 100644 index 1b512e7..0000000 --- a/cmd/commands/lifecycle/commit_test.go +++ /dev/null @@ -1,226 +0,0 @@ -/* -Copyright SecureKey Technologies Inc. All Rights Reserved. - -SPDX-License-Identifier: Apache-2.0 -*/ - -package lifecycle_test - -import ( - "bytes" - "errors" - "fmt" - "os" - - "github.com/hyperledger/fabric-sdk-go/pkg/client/resmgmt" - "github.com/hyperledger/fabric-sdk-go/pkg/common/providers/fab" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/spf13/cobra" - - "github.com/hyperledger/fabric-cli/cmd/commands/lifecycle" - "github.com/hyperledger/fabric-cli/pkg/environment" - "github.com/hyperledger/fabric-cli/pkg/fabric/mocks" -) - -var _ = Describe("LifecycleCommitCommand", func() { - var ( - cmd *cobra.Command - settings *environment.Settings - out *bytes.Buffer - - args []string - ) - - BeforeEach(func() { - out = new(bytes.Buffer) - - settings = &environment.Settings{ - Home: environment.Home(os.TempDir()), - Streams: environment.Streams{ - Out: out, - }, - } - - args = os.Args - }) - - JustBeforeEach(func() { - cmd = lifecycle.NewCommitCommand(settings) - }) - - AfterEach(func() { - os.Args = args - }) - - It("should create a lifecycle commit command", func() { - Expect(cmd.Name()).To(Equal("commit")) - Expect(cmd.HasSubCommands()).To(BeFalse()) - }) - - It("should provide a help prompt", func() { - os.Args = append(os.Args, "--help") - - Expect(cmd.Execute()).Should(Succeed()) - Expect(fmt.Sprint(out)).To(ContainSubstring("commit ")) - }) -}) - -var _ = Describe("LifecycleCommitImplementation", func() { - var ( - impl *lifecycle.CommitCommand - err error - out *bytes.Buffer - settings *environment.Settings - factory *mocks.Factory - client *mocks.ResourceManagement - ) - - BeforeEach(func() { - out = new(bytes.Buffer) - - settings = &environment.Settings{ - Home: environment.Home(os.TempDir()), - Streams: environment.Streams{ - Out: out, - }, - } - - factory = &mocks.Factory{} - client = &mocks.ResourceManagement{} - - impl = &lifecycle.CommitCommand{} - impl.Settings = settings - impl.Factory = factory - }) - - It("should not be nil", func() { - Expect(impl).ShouldNot(BeNil()) - }) - - Describe("Validate", func() { - JustBeforeEach(func() { - err = impl.Validate() - }) - - It("should fail when name is not set", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(Equal("chaincode name not specified")) - }) - - Context("when chaincode version is not set", func() { - BeforeEach(func() { - impl.Name = "mycc" - }) - - It("should fail without chaincode version", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(Equal("chaincode version not specified")) - }) - }) - - Context("when chaincode sequence is not set", func() { - BeforeEach(func() { - impl.Name = "mycc" - impl.Version = "0.0.0" - }) - - It("should fail without chaincode sequence", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(Equal("sequence not specified")) - }) - }) - - Context("when chaincode sequence is not greater than 0", func() { - BeforeEach(func() { - impl.Name = "mycc" - impl.Version = "0.0.0" - impl.Sequence = "-1" - }) - - It("should fail with chaincode sequence not greater than 0", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(Equal("sequence must be greater than 0")) - }) - }) - - Context("when chaincode sequence is invalid", func() { - BeforeEach(func() { - impl.Name = "mycc" - impl.Version = "0.0.0" - impl.Sequence = "xxx" - }) - - It("should fail with chaincode sequence is invalid", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(ContainSubstring("invalid sequence")) - }) - }) - - Context("when all arguments are set", func() { - BeforeEach(func() { - impl.Name = "mycc" - impl.Version = "0.0.0" - impl.Sequence = "1" - impl.Peers = []string{"peer1"} - }) - - It("should succeed with all arguments", func() { - Expect(err).To(BeNil()) - }) - }) - }) - - Describe("Run", func() { - BeforeEach(func() { - impl.Name = "mycc" - impl.Version = "0.0.0" - impl.Sequence = "1" - impl.ResourceManagement = client - }) - - JustBeforeEach(func() { - err = impl.Run() - }) - - It("should fail without a current context", func() { - Expect(err).NotTo(BeNil()) - }) - - Context("when resmgmt client succeeds", func() { - BeforeEach(func() { - settings.Config = &environment.Config{ - Contexts: map[string]*environment.Context{ - "foo": {}, - }, - CurrentContext: "foo", - } - - client.InstantiateCCReturns(resmgmt.InstantiateCCResponse{}, nil) - }) - - It("should succeed with chaincode commit", func() { - Expect(err).To(BeNil()) - Expect(fmt.Sprint(out)).To(Equal("successfully committed chaincode 'mycc'\n")) - }) - }) - - Context("when resmgmt client fails", func() { - BeforeEach(func() { - settings.Config = &environment.Config{ - Contexts: map[string]*environment.Context{ - "foo": {}, - }, - CurrentContext: "foo", - } - - client.LifecycleCommitCCReturns(fab.TransactionID(""), errors.New("commit error")) - }) - - It("should fail to commit chaincode", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(ContainSubstring("commit error")) - }) - }) - }) -}) diff --git a/cmd/commands/lifecycle/getinstalledpkg.go b/cmd/commands/lifecycle/getinstalledpkg.go index 0255dbc..49a0d70 100644 --- a/cmd/commands/lifecycle/getinstalledpkg.go +++ b/cmd/commands/lifecycle/getinstalledpkg.go @@ -9,10 +9,7 @@ package lifecycle import ( "io/ioutil" "os" - "path/filepath" - "github.com/hyperledger/fabric-sdk-go/pkg/client/resmgmt" - "github.com/hyperledger/fabric-sdk-go/pkg/common/errors/retry" "github.com/pkg/errors" "github.com/spf13/cobra" @@ -81,7 +78,7 @@ func (c *GetInstalledPkgCommand) Validate() error { // Run executes the command func (c *GetInstalledPkgCommand) Run() error { - pkgBytes, err := c.ResourceManagement.LifecycleGetInstalledCCPackage( + /*pkgBytes, err := c.ResourceManagement.LifecycleGetInstalledCCPackage( c.PackageID, resmgmt.WithRetry(retry.DefaultResMgmtOpts), resmgmt.WithTargetEndpoints(c.Peer), @@ -101,6 +98,6 @@ func (c *GetInstalledPkgCommand) Run() error { } c.printf("Chaincode package saved to %s\n", filePath) - + */ return nil } diff --git a/cmd/commands/lifecycle/getinstalledpkg_test.go b/cmd/commands/lifecycle/getinstalledpkg_test.go deleted file mode 100644 index 0c5846d..0000000 --- a/cmd/commands/lifecycle/getinstalledpkg_test.go +++ /dev/null @@ -1,208 +0,0 @@ -/* -Copyright SecureKey Technologies Inc. All Rights Reserved. - -SPDX-License-Identifier: Apache-2.0 -*/ - -package lifecycle_test - -import ( - "bytes" - "errors" - "fmt" - "os" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/spf13/cobra" - - "github.com/hyperledger/fabric-cli/cmd/commands/lifecycle" - "github.com/hyperledger/fabric-cli/pkg/environment" - "github.com/hyperledger/fabric-cli/pkg/fabric/mocks" -) - -var _ = Describe("LifecycleChaincodeGetInstalledPackageCommand", func() { - var ( - cmd *cobra.Command - settings *environment.Settings - out *bytes.Buffer - - args []string - ) - - BeforeEach(func() { - out = new(bytes.Buffer) - - settings = &environment.Settings{ - Home: environment.Home(os.TempDir()), - Streams: environment.Streams{ - Out: out, - }, - } - - args = os.Args - }) - - JustBeforeEach(func() { - cmd = lifecycle.NewGetInstalledPkgCommand(settings) - }) - - AfterEach(func() { - os.Args = args - }) - - It("should create a chaincode getinstalledpackage command", func() { - Expect(cmd.Name()).To(Equal("getinstalledpackage")) - Expect(cmd.HasSubCommands()).To(BeFalse()) - }) - - It("should provide a help prompt", func() { - os.Args = append(os.Args, "--help") - - Expect(cmd.Execute()).Should(Succeed()) - Expect(fmt.Sprint(out)).To(ContainSubstring("getinstalledpackage ")) - }) -}) - -var _ = Describe("LifecycleChaincodeGetInstalledPackageImplementation", func() { - var ( - impl *lifecycle.GetInstalledPkgCommand - err error - out *bytes.Buffer - settings *environment.Settings - factory *mocks.Factory - client *mocks.ResourceManagement - ) - - BeforeEach(func() { - out = new(bytes.Buffer) - - settings = &environment.Settings{ - Home: environment.Home(os.TempDir()), - Streams: environment.Streams{ - Out: out, - }, - } - - factory = &mocks.Factory{} - client = &mocks.ResourceManagement{} - - impl = &lifecycle.GetInstalledPkgCommand{} - impl.Settings = settings - impl.Factory = factory - }) - - It("should not be nil", func() { - Expect(impl).ShouldNot(BeNil()) - }) - - Describe("Validate", func() { - JustBeforeEach(func() { - err = impl.Validate() - }) - - It("should fail when peer is not set", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(Equal("peer not specified")) - }) - - Context("when package ID is not set", func() { - BeforeEach(func() { - impl.Peer = "peer1" - }) - - It("should fail without package ID", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(Equal("package ID not specified")) - }) - }) - - Context("when all arguments are set", func() { - BeforeEach(func() { - impl.Peer = "peer1" - impl.PackageID = "pkg1" - }) - - It("should succeed with all arguments", func() { - Expect(err).To(BeNil()) - }) - }) - }) - - Describe("Run", func() { - var filePath string - - BeforeEach(func() { - impl.Peer = "peer1" - impl.PackageID = "pkg1" - impl.WriteFile = func(filename string, data []byte, perm os.FileMode) error { - filePath = filename - return nil - } - - result := []byte("pkg1") - - client.LifecycleGetInstalledCCPackageReturns(result, nil) - impl.ResourceManagement = client - }) - - JustBeforeEach(func() { - err = impl.Run() - }) - - Context("when failed to write file", func() { - BeforeEach(func() { - settings.Config = &environment.Config{ - Contexts: map[string]*environment.Context{ - "foo": {}, - }, - CurrentContext: "foo", - } - - impl.WriteFile = func(filename string, data []byte, perm os.FileMode) error { - filePath = filename - return fmt.Errorf("injected write file error") - } - }) - - It("should fail with writer error", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(Equal(fmt.Sprintf("failed to write chaincode package to file %s: injected write file error", filePath))) - }) - }) - - Context("when resmgmt client succeeds", func() { - BeforeEach(func() { - settings.Config = &environment.Config{ - Contexts: map[string]*environment.Context{ - "foo": {}, - }, - CurrentContext: "foo", - } - }) - - It("should succeed with getinstalledpackage", func() { - Expect(err).To(BeNil()) - Expect(fmt.Sprint(out)).To(Equal(fmt.Sprintf("Chaincode package saved to %s\n", filePath))) - }) - }) - - Context("when resmgmt client fails", func() { - BeforeEach(func() { - settings.Config = &environment.Config{ - Contexts: map[string]*environment.Context{ - "foo": {}, - }, - CurrentContext: "foo", - } - - client.LifecycleGetInstalledCCPackageReturns(nil, errors.New("get installed error")) - }) - - It("should fail to get installed chaincode package", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(ContainSubstring("get installed error")) - }) - }) - }) -}) diff --git a/cmd/commands/lifecycle/install.go b/cmd/commands/lifecycle/install.go index 9520417..3e4d846 100644 --- a/cmd/commands/lifecycle/install.go +++ b/cmd/commands/lifecycle/install.go @@ -8,12 +8,7 @@ package lifecycle import ( "errors" - "fmt" - "io/ioutil" - "github.com/hyperledger/fabric-sdk-go/pkg/client/resmgmt" - "github.com/hyperledger/fabric-sdk-go/pkg/common/errors/retry" - "github.com/hyperledger/fabric-sdk-go/pkg/fab/ccpackager/lifecycle" "github.com/spf13/cobra" "github.com/hyperledger/fabric-cli/pkg/environment" @@ -76,7 +71,7 @@ func (c *InstallCommand) Validate() error { // Run executes the command func (c *InstallCommand) Run() error { - context, err := c.Settings.Config.GetCurrentContext() + /*context, err := c.Settings.Config.GetCurrentContext() if err != nil { return err } @@ -104,6 +99,6 @@ func (c *InstallCommand) Run() error { } else { fmt.Fprintf(c.Settings.Streams.Out, "successfully installed chaincode '%s'. Package ID '%s'\n", c.Label, responses[0].PackageID) } - + */ return nil } diff --git a/cmd/commands/lifecycle/install_test.go b/cmd/commands/lifecycle/install_test.go deleted file mode 100644 index 2b07ed3..0000000 --- a/cmd/commands/lifecycle/install_test.go +++ /dev/null @@ -1,233 +0,0 @@ -/* -Copyright SecureKey Technologies Inc. All Rights Reserved. - -SPDX-License-Identifier: Apache-2.0 -*/ - -package lifecycle_test - -import ( - "bytes" - "errors" - "fmt" - "os" - - "github.com/hyperledger/fabric-sdk-go/pkg/client/resmgmt" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/spf13/cobra" - - "github.com/hyperledger/fabric-cli/cmd/commands/lifecycle" - "github.com/hyperledger/fabric-cli/pkg/environment" - "github.com/hyperledger/fabric-cli/pkg/fabric/mocks" -) - -var _ = Describe("LifecycleChaincodeInstallCommand", func() { - var ( - cmd *cobra.Command - settings *environment.Settings - out *bytes.Buffer - - args []string - ) - - BeforeEach(func() { - out = new(bytes.Buffer) - - settings = &environment.Settings{ - Home: environment.Home(os.TempDir()), - Streams: environment.Streams{ - Out: out, - }, - } - - args = os.Args - }) - - JustBeforeEach(func() { - cmd = lifecycle.NewInstallCommand(settings) - }) - - AfterEach(func() { - os.Args = args - }) - - It("should create a chaincode install command", func() { - Expect(cmd.Name()).To(Equal("install")) - Expect(cmd.HasSubCommands()).To(BeFalse()) - }) - - It("should provide a help prompt", func() { - os.Args = append(os.Args, "--help") - - Expect(cmd.Execute()).Should(Succeed()) - Expect(fmt.Sprint(out)).To(ContainSubstring("install ")) - }) -}) - -var _ = Describe("LifecycleChaincodeInstallImplementation", func() { - var ( - impl *lifecycle.InstallCommand - err error - out *bytes.Buffer - settings *environment.Settings - factory *mocks.Factory - client *mocks.ResourceManagement - ) - - BeforeEach(func() { - out = new(bytes.Buffer) - - settings = &environment.Settings{ - Home: environment.Home(os.TempDir()), - Streams: environment.Streams{ - Out: out, - }, - } - - factory = &mocks.Factory{} - client = &mocks.ResourceManagement{} - - impl = &lifecycle.InstallCommand{} - impl.Settings = settings - impl.Factory = factory - }) - - It("should not be nil", func() { - Expect(impl).ShouldNot(BeNil()) - }) - - Describe("Validate", func() { - JustBeforeEach(func() { - err = impl.Validate() - }) - - It("should fail when label is not set", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(Equal("chaincode label not specified")) - }) - - Context("when chaincode path is not set", func() { - BeforeEach(func() { - impl.Label = "mycc" - }) - - It("should fail without chaincode path", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(Equal("chaincode path not specified")) - }) - }) - - Context("when all arguments are set", func() { - BeforeEach(func() { - impl.Label = "mycc" - impl.Path = "path" - }) - - It("should succeed with all arguments", func() { - Expect(err).To(BeNil()) - }) - }) - }) - - Describe("Run", func() { - BeforeEach(func() { - impl.Label = "mycc" - impl.Path = "./testdata/chaincode/example/example.go" - - result := []resmgmt.LifecycleInstallCCResponse{ - { - PackageID: "pkg1", - }, - } - - client.LifecycleInstallCCReturns(result, nil) - impl.ResourceManagement = client - }) - - JustBeforeEach(func() { - err = impl.Run() - }) - - It("should fail without a current context", func() { - Expect(err).NotTo(BeNil()) - }) - - Context("when chaincode path is invalid", func() { - BeforeEach(func() { - settings.Config = &environment.Config{ - Contexts: map[string]*environment.Context{ - "foo": {}, - }, - CurrentContext: "foo", - } - - impl.Path = "path/to/chaincode" - }) - - It("should fail with an invalid path", func() { - Expect(err).NotTo(BeNil()) - }) - }) - - Context("when resmgmt client succeeds", func() { - BeforeEach(func() { - settings.Config = &environment.Config{ - Contexts: map[string]*environment.Context{ - "foo": {}, - }, - CurrentContext: "foo", - } - - client.LifecycleInstallCCReturns([]resmgmt.LifecycleInstallCCResponse{ - { - Target: "peer1", - Status: 200, - PackageID: "pkg1", - }, - }, nil) - }) - - It("should succeed with chaincode install", func() { - Expect(err).To(BeNil()) - Expect(fmt.Sprint(out)).To(Equal("successfully installed chaincode 'mycc'. Package ID 'pkg1'\n")) - }) - }) - - Context("when no responses from client", func() { - BeforeEach(func() { - settings.Config = &environment.Config{ - Contexts: map[string]*environment.Context{ - "foo": {}, - }, - CurrentContext: "foo", - } - - client.LifecycleInstallCCReturns(nil, nil) - }) - - It("should succeed with chaincode install", func() { - Expect(err).To(BeNil()) - Expect(fmt.Sprint(out)).To(ContainSubstring("chaincode 'mycc' has already been installed on all peers")) - }) - }) - - Context("when resmgmt client fails", func() { - BeforeEach(func() { - settings.Config = &environment.Config{ - Contexts: map[string]*environment.Context{ - "foo": {}, - }, - CurrentContext: "foo", - } - - client.LifecycleInstallCCReturns(nil, errors.New("install error")) - }) - - It("should fail to install chaincode", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(ContainSubstring("install error")) - }) - }) - }) -}) diff --git a/cmd/commands/lifecycle/lifecycle.go b/cmd/commands/lifecycle/lifecycle.go index 0fd63e3..205c956 100644 --- a/cmd/commands/lifecycle/lifecycle.go +++ b/cmd/commands/lifecycle/lifecycle.go @@ -61,12 +61,12 @@ type BaseCommand struct { func (c *BaseCommand) Complete() error { var err error - if c.Factory == nil { + /*if c.Factory == nil { c.Factory, err = fabric.NewFactory(c.Settings.Config) if err != nil { return err } - } + }*/ c.Channel, err = c.Factory.Channel() if err != nil { diff --git a/cmd/commands/lifecycle/lifecycle_test.go b/cmd/commands/lifecycle/lifecycle_test.go deleted file mode 100644 index cc88984..0000000 --- a/cmd/commands/lifecycle/lifecycle_test.go +++ /dev/null @@ -1,126 +0,0 @@ -/* -Copyright SecureKey Technologies Inc. All Rights Reserved. - -SPDX-License-Identifier: Apache-2.0 -*/ - -package lifecycle_test - -import ( - "bytes" - "errors" - "fmt" - "os" - "testing" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/spf13/cobra" - - "github.com/hyperledger/fabric-cli/cmd/commands/lifecycle" - "github.com/hyperledger/fabric-cli/pkg/environment" - "github.com/hyperledger/fabric-cli/pkg/fabric/mocks" -) - -func TestLifecycle(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "Lifecycle Suite") -} - -var _ = Describe("LifecycleChaincodeCommand", func() { - var ( - cmd *cobra.Command - settings *environment.Settings - out *bytes.Buffer - ) - - Context("when creating a command from settings", func() { - BeforeEach(func() { - out = new(bytes.Buffer) - - settings = &environment.Settings{ - Home: environment.Home(os.TempDir()), - Streams: environment.Streams{ - Out: out, - }, - } - }) - - JustBeforeEach(func() { - cmd = lifecycle.NewCommand(settings) - }) - - It("should create a lifecycle command", func() { - Expect(cmd.Name()).To(Equal("lifecycle")) - Expect(cmd.HasSubCommands()).To(BeTrue()) - Expect(cmd.Execute()).Should(Succeed()) - Expect(fmt.Sprint(out)).To(ContainSubstring("lifecycle [command]")) - Expect(fmt.Sprint(out)).To(ContainSubstring("package")) - Expect(fmt.Sprint(out)).To(ContainSubstring("install")) - Expect(fmt.Sprint(out)).To(ContainSubstring("approve")) - Expect(fmt.Sprint(out)).To(ContainSubstring("commit")) - Expect(fmt.Sprint(out)).To(ContainSubstring("queryinstalled")) - Expect(fmt.Sprint(out)).To(ContainSubstring("getinstalledpackage")) - Expect(fmt.Sprint(out)).To(ContainSubstring("queryapproved")) - Expect(fmt.Sprint(out)).To(ContainSubstring("checkcommitreadiness")) - Expect(fmt.Sprint(out)).To(ContainSubstring("querycommitted")) - }) - }) -}) - -var _ = Describe("LifecycleBaseChaincodeCommand", func() { - var c *lifecycle.BaseCommand - - BeforeEach(func() { - c = &lifecycle.BaseCommand{} - }) - - Describe("Complete", func() { - var ( - err error - factory *mocks.Factory - channelClient *mocks.Channel - resmgmtClient *mocks.ResourceManagement - ) - - BeforeEach(func() { - factory = &mocks.Factory{} - channelClient = &mocks.Channel{} - resmgmtClient = &mocks.ResourceManagement{} - - factory.ResourceManagementReturns(resmgmtClient, nil) - factory.ChannelReturns(channelClient, nil) - - c.Factory = factory - }) - - JustBeforeEach(func() { - err = c.Complete() - }) - - It("should complete", func() { - Expect(err).To(BeNil()) - Expect(c.Channel).NotTo(BeNil()) - }) - - Context("when factory fails to create channel client", func() { - BeforeEach(func() { - factory.ChannelReturns(nil, errors.New("factory error")) - }) - - It("should fail with factory error", func() { - Expect(err).NotTo(BeNil()) - }) - }) - - Context("when factory fails to create resmgmt client", func() { - BeforeEach(func() { - factory.ResourceManagementReturns(nil, errors.New("factory error")) - }) - - It("should fail with factory error", func() { - Expect(err).NotTo(BeNil()) - }) - }) - }) -}) diff --git a/cmd/commands/lifecycle/package.go b/cmd/commands/lifecycle/package.go index c7c98ed..e8149fb 100644 --- a/cmd/commands/lifecycle/package.go +++ b/cmd/commands/lifecycle/package.go @@ -8,12 +8,9 @@ package lifecycle import ( "errors" - "fmt" - "io/ioutil" "strings" - pb "github.com/hyperledger/fabric-protos-go/peer" - lifecyclepkg "github.com/hyperledger/fabric-sdk-go/pkg/fab/ccpackager/lifecycle" + pb "github.com/hyperledger/fabric-protos-go-apiv2/peer" "github.com/spf13/cobra" "github.com/hyperledger/fabric-cli/pkg/environment" @@ -79,7 +76,7 @@ func (c *PackageCommand) Validate() error { // Run executes the command func (c *PackageCommand) Run() error { - pkgBytes, err := lifecyclepkg.NewCCPackage(&lifecyclepkg.Descriptor{ + /*pkgBytes, err := lifecyclepkg.NewCCPackage(&lifecyclepkg.Descriptor{ Path: c.Path, Type: pb.ChaincodeSpec_Type(pb.ChaincodeSpec_Type_value[strings.ToUpper(c.Type)]), Label: c.Label, @@ -93,6 +90,6 @@ func (c *PackageCommand) Run() error { } fmt.Fprintf(c.Settings.Streams.Out, "successfully packaged chaincode '%s'\n", c.Label) - + */ return nil } diff --git a/cmd/commands/lifecycle/queryapproved.go b/cmd/commands/lifecycle/queryapproved.go index adb1e45..3f7673b 100644 --- a/cmd/commands/lifecycle/queryapproved.go +++ b/cmd/commands/lifecycle/queryapproved.go @@ -9,8 +9,6 @@ package lifecycle import ( "strconv" - "github.com/hyperledger/fabric-sdk-go/pkg/client/resmgmt" - "github.com/hyperledger/fabric-sdk-go/pkg/common/errors/retry" "github.com/pkg/errors" "github.com/spf13/cobra" @@ -78,7 +76,7 @@ func (c *QueryApprovedCommand) Validate() error { // Run executes the command func (c *QueryApprovedCommand) Run() error { - context, err := c.Settings.Config.GetCurrentContext() + /*context, err := c.Settings.Config.GetCurrentContext() if err != nil { return err } @@ -109,10 +107,11 @@ func (c *QueryApprovedCommand) Run() error { } c.printResponse(approvedChaincode) - + */ return nil } +/* func (c *QueryApprovedCommand) printResponse(ac resmgmt.LifecycleApprovedChaincodeDefinition) { c.printf("Name: %s, Version: %s, Package ID: %s, Sequence: %d, Validation Plugin: %s,"+ " Endorsement Plugin: %s, Channel Config Policy: %s, Init Required: %t\n", @@ -126,3 +125,4 @@ func (c *QueryApprovedCommand) printResponse(ac resmgmt.LifecycleApprovedChainco cfg.Name, cfg.BlockToLive, cfg.MaximumPeerCount, cfg.RequiredPeerCount, cfg.MemberOnlyRead, cfg.MemberOnlyWrite) } } +*/ diff --git a/cmd/commands/lifecycle/queryapproved_test.go b/cmd/commands/lifecycle/queryapproved_test.go deleted file mode 100644 index f6a885d..0000000 --- a/cmd/commands/lifecycle/queryapproved_test.go +++ /dev/null @@ -1,231 +0,0 @@ -/* -Copyright SecureKey Technologies Inc. All Rights Reserved. - -SPDX-License-Identifier: Apache-2.0 -*/ - -package lifecycle_test - -import ( - "bytes" - "errors" - "fmt" - "os" - - pb "github.com/hyperledger/fabric-protos-go/peer" - "github.com/hyperledger/fabric-sdk-go/pkg/client/resmgmt" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/spf13/cobra" - - "github.com/hyperledger/fabric-cli/cmd/commands/lifecycle" - "github.com/hyperledger/fabric-cli/pkg/environment" - "github.com/hyperledger/fabric-cli/pkg/fabric/mocks" -) - -const ( - queryApprovedPlainTextResponse = "Name: cc1, Version: v1, Package ID: pkg1, Sequence: 1, Validation Plugin: vscc," + - " Endorsement Plugin: escc, Channel Config Policy: ccpolicy, Init Required: true\n- Collection: coll1," + - " Blocks to Live: 1, Maximum Peer Count: 2, Required Peer Count: 1, MemberOnlyRead: false, cfg.MemberOnlyWrite: false\n" - queryApprovedJSONResponse = `{"name":"cc1","version":"v1","sequence":1,"endorsement_plugin":"escc","validation_plugin":"vscc"` + - `,"channel_config_policy":"ccpolicy","collection_config":[{"Payload":{"StaticCollectionConfig":` + - `{"name":"coll1","required_peer_count":1,"maximum_peer_count":2,"block_to_live":1}}}],"init_required":true,"package_id":"pkg1"}` -) - -var _ = Describe("LifecycleChaincodeQueryApprovedCommand", func() { - var ( - cmd *cobra.Command - settings *environment.Settings - out *bytes.Buffer - - args []string - ) - - BeforeEach(func() { - out = new(bytes.Buffer) - - settings = &environment.Settings{ - Home: environment.Home(os.TempDir()), - Streams: environment.Streams{ - Out: out, - }, - } - - args = os.Args - }) - - JustBeforeEach(func() { - cmd = lifecycle.NewQueryApprovedCommand(settings) - }) - - AfterEach(func() { - os.Args = args - }) - - It("should create a chaincode 'query approved' command", func() { - Expect(cmd.Name()).To(Equal("queryapproved")) - Expect(cmd.HasSubCommands()).To(BeFalse()) - }) - - It("should provide a help prompt", func() { - os.Args = append(os.Args, "--help") - - Expect(cmd.Execute()).Should(Succeed()) - Expect(fmt.Sprint(out)).To(ContainSubstring("queryapproved")) - }) -}) - -var _ = Describe("LifecycleChaincodeQueryApprovedImplementation", func() { - var ( - impl *lifecycle.QueryApprovedCommand - err error - out *bytes.Buffer - settings *environment.Settings - factory *mocks.Factory - client *mocks.ResourceManagement - ) - - BeforeEach(func() { - out = new(bytes.Buffer) - - settings = &environment.Settings{ - Home: environment.Home(os.TempDir()), - Streams: environment.Streams{ - Out: out, - }, - } - - factory = &mocks.Factory{} - client = &mocks.ResourceManagement{} - - impl = &lifecycle.QueryApprovedCommand{} - impl.Settings = settings - impl.Factory = factory - }) - - It("should not be nil", func() { - Expect(impl).ShouldNot(BeNil()) - }) - - Describe("Validate", func() { - JustBeforeEach(func() { - err = impl.Validate() - }) - - Context("when chaincode is not set", func() { - It("should fail without chaincode", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(Equal("chaincode name not specified")) - }) - }) - - Context("when invalid sequence is set", func() { - BeforeEach(func() { - impl.ChaincodeName = "cc1" - impl.Sequence = "xxx" - }) - - It("should fail with invalid sequence", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(ContainSubstring("invalid sequence")) - }) - }) - - Context("when all arguments are set", func() { - BeforeEach(func() { - impl.ChaincodeName = "cc1" - impl.Sequence = "1" - }) - - It("should succeed with all arguments", func() { - Expect(err).To(BeNil()) - }) - }) - }) - - Describe("Run", func() { - BeforeEach(func() { - impl.ChaincodeName = "cc1" - impl.Sequence = "1" - - result := resmgmt.LifecycleApprovedChaincodeDefinition{ - Name: "cc1", - Version: "v1", - Sequence: 1, - PackageID: "pkg1", - ValidationPlugin: "vscc", - EndorsementPlugin: "escc", - ChannelConfigPolicy: "ccpolicy", - InitRequired: true, - CollectionConfig: []*pb.CollectionConfig{ - { - Payload: &pb.CollectionConfig_StaticCollectionConfig{ - StaticCollectionConfig: &pb.StaticCollectionConfig{ - Name: "coll1", - RequiredPeerCount: 1, - MaximumPeerCount: 2, - BlockToLive: 1, - }, - }, - }, - }, - } - - client.LifecycleQueryApprovedCCReturns(result, nil) - impl.ResourceManagement = client - }) - - JustBeforeEach(func() { - err = impl.Run() - }) - - Context("when resmgmt client succeeds", func() { - BeforeEach(func() { - settings.Config = &environment.Config{ - Contexts: map[string]*environment.Context{ - "foo": { - Peers: []string{"peer1"}, - }, - }, - CurrentContext: "foo", - } - }) - - It("should succeed with plain text response", func() { - Expect(err).To(BeNil()) - Expect(fmt.Sprint(out)).To(Equal(queryApprovedPlainTextResponse)) - }) - - When("the output format is set to json", func() { - BeforeEach(func() { - impl.OutputFormat = "json" - }) - - It("should succeed with JSON response", func() { - Expect(err).To(BeNil()) - Expect(fmt.Sprint(out)).To(Equal(queryApprovedJSONResponse)) - }) - }) - }) - - Context("when resmgmt client fails", func() { - BeforeEach(func() { - settings.Config = &environment.Config{ - Contexts: map[string]*environment.Context{ - "foo": { - Peers: []string{"peer1"}, - }, - }, - CurrentContext: "foo", - } - - client.LifecycleQueryApprovedCCReturns(resmgmt.LifecycleApprovedChaincodeDefinition{}, errors.New("query approved error")) - }) - - It("should fail to query approved chaincodes", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(ContainSubstring("query approved error")) - }) - }) - }) -}) diff --git a/cmd/commands/lifecycle/querycommitted.go b/cmd/commands/lifecycle/querycommitted.go index 06c7b13..02c89cf 100644 --- a/cmd/commands/lifecycle/querycommitted.go +++ b/cmd/commands/lifecycle/querycommitted.go @@ -7,8 +7,6 @@ SPDX-License-Identifier: Apache-2.0 package lifecycle import ( - "github.com/hyperledger/fabric-sdk-go/pkg/client/resmgmt" - "github.com/hyperledger/fabric-sdk-go/pkg/common/errors/retry" "github.com/pkg/errors" "github.com/spf13/cobra" @@ -66,7 +64,7 @@ func (c *QueryCommittedCommand) Validate() error { // Run executes the command func (c *QueryCommittedCommand) Run() error { - context, err := c.Settings.Config.GetCurrentContext() + /*context, err := c.Settings.Config.GetCurrentContext() if err != nil { return err } @@ -88,10 +86,11 @@ func (c *QueryCommittedCommand) Run() error { } c.printResponse(committedChaincodes) - + */ return nil } +/* func (c *QueryCommittedCommand) printResponse(defs []resmgmt.LifecycleChaincodeDefinition) { if len(defs) == 0 { c.println("No committed chaincodes") @@ -125,3 +124,4 @@ func (c *QueryCommittedCommand) printResponse(defs []resmgmt.LifecycleChaincodeD } } } +*/ diff --git a/cmd/commands/lifecycle/querycommitted_test.go b/cmd/commands/lifecycle/querycommitted_test.go deleted file mode 100644 index a52bb37..0000000 --- a/cmd/commands/lifecycle/querycommitted_test.go +++ /dev/null @@ -1,218 +0,0 @@ -/* -Copyright SecureKey Technologies Inc. All Rights Reserved. - -SPDX-License-Identifier: Apache-2.0 -*/ - -package lifecycle_test - -import ( - "bytes" - "errors" - "fmt" - "os" - - pb "github.com/hyperledger/fabric-protos-go/peer" - "github.com/hyperledger/fabric-sdk-go/pkg/client/resmgmt" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/spf13/cobra" - - "github.com/hyperledger/fabric-cli/cmd/commands/lifecycle" - "github.com/hyperledger/fabric-cli/pkg/environment" - "github.com/hyperledger/fabric-cli/pkg/fabric/mocks" -) - -const ( - queryCommittedPlainTextResponse = "Name: cc1, Version: v1, Sequence: 1, Validation Plugin: vscc," + - " Endorsement Plugin: escc, Channel Config Policy: ccpolicy, Init Required: true," + - " Approving orgs: [org1], Non-approving orgs: [org2]\n- Collection: coll1," + - " Blocks to Live: 1, Maximum Peer Count: 2, Required Peer Count: 1, MemberOnlyRead: false, cfg.MemberOnlyWrite: false\n" - queryCommittedJSONResponse = `[{"name":"cc1","version":"v1","sequence":1,"endorsement_plugin":"escc","validation_plugin":"vscc"` + - `,"channel_config_policy":"ccpolicy","collection_config":[{"Payload":{"StaticCollectionConfig":{"name":"coll1",` + - `"required_peer_count":1,"maximum_peer_count":2,"block_to_live":1}}}],"init_required":true,"approvals":{"org1":true,"org2":false}}]` -) - -var _ = Describe("LifecycleChaincodeQueryCommittedCommand", func() { - var ( - cmd *cobra.Command - settings *environment.Settings - out *bytes.Buffer - - args []string - ) - - BeforeEach(func() { - out = new(bytes.Buffer) - - settings = &environment.Settings{ - Home: environment.Home(os.TempDir()), - Streams: environment.Streams{ - Out: out, - }, - } - - args = os.Args - }) - - JustBeforeEach(func() { - cmd = lifecycle.NewQueryCommittedCommand(settings) - }) - - AfterEach(func() { - os.Args = args - }) - - It("should create a chaincode 'query committed' command", func() { - Expect(cmd.Name()).To(Equal("querycommitted")) - Expect(cmd.HasSubCommands()).To(BeFalse()) - }) - - It("should provide a help prompt", func() { - os.Args = append(os.Args, "--help") - - Expect(cmd.Execute()).Should(Succeed()) - Expect(fmt.Sprint(out)).To(ContainSubstring("querycommitted")) - }) -}) - -var _ = Describe("LifecycleChaincodeQueryCommittedImplementation", func() { - var ( - impl *lifecycle.QueryCommittedCommand - err error - out *bytes.Buffer - settings *environment.Settings - factory *mocks.Factory - client *mocks.ResourceManagement - ) - - BeforeEach(func() { - out = new(bytes.Buffer) - - settings = &environment.Settings{ - Home: environment.Home(os.TempDir()), - Streams: environment.Streams{ - Out: out, - }, - } - - factory = &mocks.Factory{} - client = &mocks.ResourceManagement{} - - impl = &lifecycle.QueryCommittedCommand{} - impl.Settings = settings - impl.Factory = factory - }) - - It("should not be nil", func() { - Expect(impl).ShouldNot(BeNil()) - }) - - Describe("Validate", func() { - JustBeforeEach(func() { - err = impl.Validate() - }) - - Context("when chaincode is not set", func() { - It("should fail without chaincode", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(Equal("chaincode name not specified")) - }) - }) - - Context("when all arguments are set", func() { - BeforeEach(func() { - impl.ChaincodeName = "cc1" - }) - - It("should succeed with all arguments", func() { - Expect(err).To(BeNil()) - }) - }) - }) - - Describe("Run", func() { - BeforeEach(func() { - impl.ChaincodeName = "cc1" - - result := resmgmt.LifecycleChaincodeDefinition{ - Name: "cc1", - Version: "v1", - Sequence: 1, - EndorsementPlugin: "escc", - ValidationPlugin: "vscc", - ChannelConfigPolicy: "ccpolicy", - CollectionConfig: []*pb.CollectionConfig{ - { - Payload: &pb.CollectionConfig_StaticCollectionConfig{ - StaticCollectionConfig: &pb.StaticCollectionConfig{ - Name: "coll1", - RequiredPeerCount: 1, - MaximumPeerCount: 2, - BlockToLive: 1, - }, - }, - }, - }, - InitRequired: true, - Approvals: map[string]bool{"org1": true, "org2": false}, - } - - client.LifecycleQueryCommittedCCReturns([]resmgmt.LifecycleChaincodeDefinition{result}, nil) - impl.ResourceManagement = client - }) - - JustBeforeEach(func() { - err = impl.Run() - }) - - Context("when resmgmt client succeeds", func() { - BeforeEach(func() { - settings.Config = &environment.Config{ - Contexts: map[string]*environment.Context{ - "foo": { - Peers: []string{"peer1"}, - }, - }, - CurrentContext: "foo", - } - }) - - It("should succeed with plain text response", func() { - Expect(err).To(BeNil()) - Expect(fmt.Sprint(out)).To(Equal(queryCommittedPlainTextResponse)) - }) - - When("the output format is set to json", func() { - BeforeEach(func() { - impl.OutputFormat = "json" - }) - - It("should succeed with JSON response", func() { - Expect(err).To(BeNil()) - Expect(fmt.Sprint(out)).To(Equal(queryCommittedJSONResponse)) - }) - }) - }) - - Context("when resmgmt client fails", func() { - BeforeEach(func() { - settings.Config = &environment.Config{ - Contexts: map[string]*environment.Context{ - "foo": { - Peers: []string{"peer1"}, - }, - }, - CurrentContext: "foo", - } - - client.LifecycleQueryCommittedCCReturns(nil, errors.New("query committed error")) - }) - - It("should fail to query committed chaincodes", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(ContainSubstring("query committed error")) - }) - }) - }) -}) diff --git a/cmd/commands/lifecycle/queryinstalled.go b/cmd/commands/lifecycle/queryinstalled.go index a01b0a4..bfec5cb 100644 --- a/cmd/commands/lifecycle/queryinstalled.go +++ b/cmd/commands/lifecycle/queryinstalled.go @@ -7,8 +7,6 @@ SPDX-License-Identifier: Apache-2.0 package lifecycle import ( - "github.com/hyperledger/fabric-sdk-go/pkg/client/resmgmt" - "github.com/hyperledger/fabric-sdk-go/pkg/common/errors/retry" "github.com/pkg/errors" "github.com/spf13/cobra" @@ -66,7 +64,7 @@ func (c *QueryInstalledCommand) Validate() error { // Run executes the command func (c *QueryInstalledCommand) Run() error { - installedChaincodes, err := c.ResourceManagement.LifecycleQueryInstalledCC( + /*installedChaincodes, err := c.ResourceManagement.LifecycleQueryInstalledCC( resmgmt.WithRetry(retry.DefaultResMgmtOpts), resmgmt.WithTargetEndpoints(c.Peer), ) @@ -79,10 +77,11 @@ func (c *QueryInstalledCommand) Run() error { } c.printResponse(installedChaincodes) - + */ return nil } +/* func (c *QueryInstalledCommand) printResponse(installedChaincodes []resmgmt.LifecycleInstalledCC) { if len(installedChaincodes) == 0 { c.printf("No installed chaincodes on peer %s", c.Peer) @@ -107,4 +106,4 @@ func (c *QueryInstalledCommand) printReferences(refs map[string][]resmgmt.CCRefe c.printf("--- Name: %s, Version: %s\n", ref.Name, ref.Version) } } -} +}*/ diff --git a/cmd/commands/lifecycle/queryinstalled_test.go b/cmd/commands/lifecycle/queryinstalled_test.go deleted file mode 100644 index bd4d23d..0000000 --- a/cmd/commands/lifecycle/queryinstalled_test.go +++ /dev/null @@ -1,236 +0,0 @@ -/* -Copyright SecureKey Technologies Inc. All Rights Reserved. - -SPDX-License-Identifier: Apache-2.0 -*/ - -package lifecycle_test - -import ( - "bytes" - "errors" - "fmt" - "os" - - "github.com/hyperledger/fabric-sdk-go/pkg/client/resmgmt" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/spf13/cobra" - - "github.com/hyperledger/fabric-cli/cmd/commands/lifecycle" - "github.com/hyperledger/fabric-cli/pkg/environment" - "github.com/hyperledger/fabric-cli/pkg/fabric/mocks" -) - -const ( - queryInstalledPlainTextResponse = "Installed chaincodes:\n- Package ID: pkg1, Label: label1\n-- " + - "References for channel [channel1]:\n--- Name: cc1, Version: v1\n" - queryInstalledJSONResponse = `[{"package_id":"pkg1","label":"label1","references":{"channel1":[{"name":"cc1","version":"v1"}]}}]` -) - -var _ = Describe("LifecycleChaincodeQueryInstalledCommand", func() { - var ( - cmd *cobra.Command - settings *environment.Settings - out *bytes.Buffer - - args []string - ) - - BeforeEach(func() { - out = new(bytes.Buffer) - - settings = &environment.Settings{ - Home: environment.Home(os.TempDir()), - Streams: environment.Streams{ - Out: out, - }, - } - - args = os.Args - }) - - JustBeforeEach(func() { - cmd = lifecycle.NewQueryInstalledCommand(settings) - }) - - AfterEach(func() { - os.Args = args - }) - - It("should create a chaincode 'query installed' command", func() { - Expect(cmd.Name()).To(Equal("queryinstalled")) - Expect(cmd.HasSubCommands()).To(BeFalse()) - }) - - It("should provide a help prompt", func() { - os.Args = append(os.Args, "--help") - - Expect(cmd.Execute()).Should(Succeed()) - Expect(fmt.Sprint(out)).To(ContainSubstring("queryinstalled")) - }) -}) - -var _ = Describe("LifecycleChaincodeQueryInstalledImplementation", func() { - var ( - impl *lifecycle.QueryInstalledCommand - err error - out *bytes.Buffer - settings *environment.Settings - factory *mocks.Factory - client *mocks.ResourceManagement - ) - - BeforeEach(func() { - out = new(bytes.Buffer) - - settings = &environment.Settings{ - Home: environment.Home(os.TempDir()), - Streams: environment.Streams{ - Out: out, - }, - } - - factory = &mocks.Factory{} - client = &mocks.ResourceManagement{} - - impl = &lifecycle.QueryInstalledCommand{} - impl.Settings = settings - impl.Factory = factory - }) - - It("should not be nil", func() { - Expect(impl).ShouldNot(BeNil()) - }) - - Describe("Validate", func() { - JustBeforeEach(func() { - err = impl.Validate() - }) - - Context("when peer is not set", func() { - It("should fail without peer", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(Equal("peer not specified")) - }) - }) - - Context("when all arguments are set", func() { - BeforeEach(func() { - impl.Peer = "peer1" - }) - - It("should succeed with all arguments", func() { - Expect(err).To(BeNil()) - }) - }) - }) - - Describe("Run", func() { - BeforeEach(func() { - impl.Peer = "peer1" - - result := []resmgmt.LifecycleInstalledCC{ - { - PackageID: "pkg1", - }, - } - - client.LifecycleQueryInstalledCCReturns(result, nil) - impl.ResourceManagement = client - }) - - JustBeforeEach(func() { - err = impl.Run() - }) - - Context("when resmgmt client succeeds", func() { - BeforeEach(func() { - settings.Config = &environment.Config{ - Contexts: map[string]*environment.Context{ - "foo": {}, - }, - CurrentContext: "foo", - } - - client.LifecycleQueryInstalledCCReturns([]resmgmt.LifecycleInstalledCC{ - { - PackageID: "pkg1", - Label: "label1", - References: map[string][]resmgmt.CCReference{ - "channel1": { - { - Name: "cc1", - Version: "v1", - }, - }, - }, - }, - }, nil) - }) - - It("should succeed with plain text response", func() { - Expect(err).To(BeNil()) - Expect(fmt.Sprint(out)).To(Equal(queryInstalledPlainTextResponse)) - }) - - When("the output format is set to json", func() { - BeforeEach(func() { - impl.OutputFormat = "json" - }) - - It("should succeed with JSON response", func() { - Expect(err).To(BeNil()) - Expect(fmt.Sprint(out)).To(Equal(queryInstalledJSONResponse)) - }) - }) - }) - - Context("when no responses from client", func() { - BeforeEach(func() { - settings.Config = &environment.Config{ - Contexts: map[string]*environment.Context{ - "foo": {}, - }, - CurrentContext: "foo", - } - - client.LifecycleQueryInstalledCCReturns(nil, nil) - }) - - It("should succeed with plain text response", func() { - Expect(err).To(BeNil()) - Expect(fmt.Sprint(out)).To(Equal("No installed chaincodes on peer peer1")) - }) - - When("the output format is set to json", func() { - BeforeEach(func() { - impl.OutputFormat = "json" - }) - - It("should succeed with null JSON response", func() { - Expect(err).To(BeNil()) - Expect(fmt.Sprint(out)).To(Equal("null")) - }) - }) - }) - - Context("when resmgmt client fails", func() { - BeforeEach(func() { - settings.Config = &environment.Config{ - Contexts: map[string]*environment.Context{ - "foo": {}, - }, - CurrentContext: "foo", - } - - client.LifecycleQueryInstalledCCReturns(nil, errors.New("query installed error")) - }) - - It("should fail to query installed chaincodes", func() { - Expect(err).NotTo(BeNil()) - Expect(err.Error()).To(ContainSubstring("query installed error")) - }) - }) - }) -}) diff --git a/go.mod b/go.mod index 4fbbbdb..b8da873 100644 --- a/go.mod +++ b/go.mod @@ -4,18 +4,35 @@ module github.com/hyperledger/fabric-cli -go 1.12 +go 1.20 require ( - github.com/hyperledger/fabric-protos-go v0.0.0-20200707132912-fee30f3ccd23 - github.com/hyperledger/fabric-sdk-go v1.0.0-beta3.0.20201002210629-a64e1ef9f926 + github.com/hyperledger/fabric-protos-go-apiv2 v0.3.0 github.com/maxbrunsfeld/counterfeiter/v6 v6.2.3 github.com/onsi/ginkgo v1.8.0 - github.com/onsi/gomega v1.9.0 + github.com/onsi/gomega v1.10.0 github.com/pkg/errors v0.8.1 github.com/spf13/cobra v0.0.4 github.com/spf13/pflag v1.0.5 - github.com/spf13/viper v1.4.0 // indirect github.com/stretchr/testify v1.5.1 - gopkg.in/yaml.v2 v2.3.0 + gopkg.in/yaml.v2 v2.4.0 +) + +require ( + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/golang/protobuf v1.5.3 // indirect + github.com/hpcloud/tail v1.0.0 // indirect + github.com/inconshreveable/mousetrap v1.0.0 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + golang.org/x/mod v0.8.0 // indirect + golang.org/x/net v0.10.0 // indirect + golang.org/x/sys v0.8.0 // indirect + golang.org/x/text v0.9.0 // indirect + golang.org/x/tools v0.6.0 // indirect + golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect + google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 // indirect + google.golang.org/grpc v1.55.0 // indirect + google.golang.org/protobuf v1.30.0 // indirect + gopkg.in/fsnotify.v1 v1.4.7 // indirect + gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect ) diff --git a/go.sum b/go.sum index fa4a7c2..ff6f31a 100644 --- a/go.sum +++ b/go.sum @@ -1,349 +1,121 @@ -bitbucket.org/liamstask/goose v0.0.0-20150115234039-8488cc47d90c/go.mod h1:hSVuE3qU7grINVSwrmzHfpg9k87ALBk+XaualNyUzI4= -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/GeertJohan/go.incremental v1.0.0/go.mod h1:6fAjUhbVuX1KcMD3c8TEgVUqmo4seqhv0i0kdATSkM0= -github.com/GeertJohan/go.rice v1.0.0/go.mod h1:eH6gbSOAUv07dQuZVnBmoDP8mgsM1rtixis4Tib9if0= -github.com/Knetic/govaluate v3.0.0+incompatible h1:7o6+MAPhYTCF0+fdvoz1xDedhRb4f6s9Tn1Tt7/WTEg= -github.com/Knetic/govaluate v3.0.0+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= -github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= -github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= -github.com/akavel/rsrc v0.8.0/go.mod h1:uLoCtb9J+EyAqh+26kdrTgmzRBFPGOolLWKpdxkKq+c= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 h1:xJ4a3vCFaGF/jqvzLMYoU8P317H5OQ+Via4RmuPwCS0= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/beorn7/perks v1.0.0 h1:HWo1m869IqiPhD389kmkxeTalrjNbbJTC8LXupb+sl0= -github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= -github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= -github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/certifi/gocertifi v0.0.0-20180118203423-deb3ae2ef261/go.mod h1:GJKEexRPVJrBSOjoqN5VNOIKJ5Q3RViH6eu3puDRwx4= -github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cloudflare/backoff v0.0.0-20161212185259-647f3cdfc87a/go.mod h1:rzgs2ZOiguV6/NpiDgADjRLPNyZlApIWxKpkT+X8SdY= -github.com/cloudflare/cfssl v1.4.1 h1:vScfU2DrIUI9VPHBVeeAQ0q5A+9yshO1Gz+3QoUQiKw= -github.com/cloudflare/cfssl v1.4.1/go.mod h1:KManx/OJPb5QY+y0+o/898AMcM128sF0bURvoVUSjTo= -github.com/cloudflare/go-metrics v0.0.0-20151117154305-6a9aea36fb41/go.mod h1:eaZPlJWD+G9wseg1BuRXlHnjntPMrywMsyxf+LTOdP4= -github.com/cloudflare/redoctober v0.0.0-20171127175943-746a508df14c/go.mod h1:6Se34jNoqrd8bTxrmJB2Bg2aoZ2CdSXonils9NsiNgo= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= -github.com/daaku/go.zipexe v1.0.0/go.mod h1:z8IiR6TsVLEYKwXAoE/I+8ys/sDkgTzSL0CLnGVd57E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/getsentry/raven-go v0.0.0-20180121060056-563b81fc02b7/go.mod h1:KungGk8q33+aIAZUIVWZDr2OfAEBsO49PX4NzFV5kcQ= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-kit/kit v0.8.0 h1:Wz+5lgoB0kkuqLEc6NVmwRknTKP6dTGbSqvhZtBI/j0= -github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-logfmt/logfmt v0.4.0 h1:MP4Eh7ZCb31lleYCFuwm0oe4/YGak+5l1vA2NOE80nA= -github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-sql-driver/mysql v1.3.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= -github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/gogo/protobuf v1.3.2 h1:72R+M5VuhED/KujmZVcIquuo8mBgX4oVda//DQb3PXo= -github.com/gogo/protobuf v1.3.2/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.3.2 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= -github.com/gogo/protobuf v1.3.2/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1 h1:G5FRp8JnTd7RQH5kemVNlMeyXQAztQ3mOWV95KxsXH8= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.4.3 h1:GV+pQPG/EUUbkh47niozDcADz6go/dUwhVzdUQHIVRw= -github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.3 h1:gyjaxf+svBWX08ZjK86iN9geUJF0H6gp2IRKX6Nf6/I= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/certificate-transparency-go v1.0.21 h1:Yf1aXowfZ2nuboBsg7iYGLmwsOARdV86pfH3g95wXmE= -github.com/google/certificate-transparency-go v1.0.21/go.mod h1:QeJfpSbVSfYc7RgB3gJFj9cbuQMMchQxrWXz8Ruopmg= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= -github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= -github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= -github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/hyperledger/fabric-config v0.0.5 h1:khRkm8U9Ghdg8VmZfptgzCFlCzrka8bPfUkM+/j6Zlg= -github.com/hyperledger/fabric-config v0.0.5/go.mod h1:YpITBI/+ZayA3XWY5lF302K7PAsFYjEEPM/zr3hegA8= -github.com/hyperledger/fabric-lib-go v1.0.0 h1:UL1w7c9LvHZUSkIvHTDGklxFv2kTeva1QI2emOVc324= -github.com/hyperledger/fabric-lib-go v1.0.0/go.mod h1:H362nMlunurmHwkYqR5uHL2UDWbQdbfz74n8kbCFsqc= -github.com/hyperledger/fabric-protos-go v0.0.0-20200424173316-dd554ba3746e/go.mod h1:xVYTjK4DtZRBxZ2D9aE4y6AbLaPwue2o/criQyQbVD0= -github.com/hyperledger/fabric-protos-go v0.0.0-20200707132912-fee30f3ccd23 h1:SEbB3yH4ISTGRifDamYXAst36gO2kM855ndMJlsv+pc= -github.com/hyperledger/fabric-protos-go v0.0.0-20200707132912-fee30f3ccd23/go.mod h1:xVYTjK4DtZRBxZ2D9aE4y6AbLaPwue2o/criQyQbVD0= -github.com/hyperledger/fabric-sdk-go v1.0.0-beta3.0.20201002210629-a64e1ef9f926 h1:/uDvlJrjQmV5WGxNa5qSc8KiBOZhFkjoeeu+R2YrU5c= -github.com/hyperledger/fabric-sdk-go v1.0.0-beta3.0.20201002210629-a64e1ef9f926/go.mod h1:qWE9Syfg1KbwNjtILk70bJLilnmCvllIYFCSY/pa1RU= +github.com/hyperledger/fabric-protos-go-apiv2 v0.3.0 h1:DOmDMloF3vKKJKXz+CsZhFgkUmnXKzP5ei71yGIbeOw= +github.com/hyperledger/fabric-protos-go-apiv2 v0.3.0/go.mod h1:smwq1q6eKByqQAp0SYdVvE1MvDoneF373j11XwWajgA= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jmhodges/clock v0.0.0-20160418191101-880ee4c33548/go.mod h1:hGT6jSUVzF6no3QaDSMLGLEHtHSBSefs+MgcDWnmhmo= -github.com/jmoiron/sqlx v0.0.0-20180124204410-05cef0741ade/go.mod h1:IiEW3SEiiErVyFdH8NTuWjSifiEQKUoyK3LNqr2kCHU= github.com/joefitzgerald/rainbow-reporter v0.1.0 h1:AuMG652zjdzI0YCCnXAqATtRBpGXMcAnrajcaTrSeuo= github.com/joefitzgerald/rainbow-reporter v0.1.0/go.mod h1:481CNgqmVHQZzdIbN52CupLJyoVwB10FQ/IQlF1pdL8= -github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= -github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kisielk/sqlstruct v0.0.0-20150923205031-648daed35d49/go.mod h1:yyMNCyc/Ib3bDTKd379tNMpB/7/H5TjM2Y9QJ5THLbE= -github.com/kisom/goutils v1.1.0/go.mod h1:+UBTfd78habUYWFbNWTJNG+jNG/i/lGURakr4A/yNRw= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515 h1:T+h1c/A9Gawja4Y9mFVWj2vyii2bbUNDw3kt9VxK2EY= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kylelemons/go-gypsy v0.0.0-20160905020020-08cad365cd28/go.mod h1:T/T7jsxVqf9k/zYOqbgNAsANsjxTd1Yq3htjDhQ1H0c= -github.com/lib/pq v0.0.0-20180201184707-88edab080323/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/magiconair/properties v1.8.0 h1:LLgXmsheXeRoUOBOjtwPQCWIYqM/LU1ayDtDePerRcY= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= -github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/mattn/go-sqlite3 v1.10.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= -github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/maxbrunsfeld/counterfeiter/v6 v6.2.3 h1:z1lXirM9f9WTcdmzSZahKh/t+LCqPiiwK2/DB1kLlI4= github.com/maxbrunsfeld/counterfeiter/v6 v6.2.3/go.mod h1:1ftk08SazyElaaNvmqAfZWGwJzshjCfBXDLoQtPAMNk= -github.com/miekg/pkcs11 v1.0.3/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.3.2 h1:mRS76wmkOn3KkKAyXDu42V+6ebnXWIztFSYGN7GeoRg= -github.com/mitchellh/mapstructure v1.3.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/mreiferson/go-httpclient v0.0.0-20160630210159-31f0106b4474/go.mod h1:OQA4XLvDbMgS8P0CevmM4m9Q3Jq4phKUzcocxuGJ5m8= -github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/nkovacs/streamquote v0.0.0-20170412213628-49af9bddb229/go.mod h1:0aYXnNPJ8l7uZxf45rWW1a/uME32OF0rhiYGNQ2oF2E= -github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.8.0 h1:VkHVNpR4iVnU8XQR6DBm8BqYjN7CRzw+xKUbVVbbW9w= github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.9.0 h1:R1uwffexN6Pr340GtYRIdZmAiN4J+iw6WG4wog1DUXg= github.com/onsi/gomega v1.9.0/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA= -github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= -github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= +github.com/onsi/gomega v1.10.0 h1:Gwkk+PTu/nfOwNMtUB/mRUv0X7ewW5dO4AERT1ThVKo= +github.com/onsi/gomega v1.10.0/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pelletier/go-toml v1.8.0 h1:Keo9qb7iRJs2voHvunFtuuYFsbWeOBh8/P9v/kVMFtw= -github.com/pelletier/go-toml v1.8.0/go.mod h1:D6yutnOGMveHEPV7VQOuvI/gXY61bv+9bAOTRnLElKs= -github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v0.9.3 h1:9iH4JKXLzFbOAdtqv/a+j8aewx2Y8lAjAydhbaScPF8= -github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= -github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.1.0 h1:BQ53HtBmfOitExawJ6LokA4x8ov/z0SYYb0+HxJfRI8= -github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910 h1:idejC8f05m9MGOsuEi1ATq9shN03HrxNkD/luQvxCv8= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90 h1:S/YWwWx/RA8rT8tKFRuGUZhuA90OyIBpPCXkcbwU8DE= -github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4 h1:gQz4mCbXsO+nc9n1hCxHcGA3Zx3Eo+UHZoInFGUIXNM= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.4.1 h1:K0MGApIoQvMw27RTdJkPbr3JZ7DNbtxQNyi5STVM6Kw= -github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.6.0 h1:kRhiuYSXR3+uv2IbVbZhUxK5zVD/2pp3Gd2PpvPkpEo= -github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc= -github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.0.3 h1:CTwfnzjQ+8dS6MhHHu4YswVAD99sL2wjPqP+VkURmKE= -github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= -github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= -github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= -github.com/sclevine/spec v1.2.0 h1:1Jwdf9jSfDl9NVmt8ndHqbTZ7XCCPbh1jI3hkDBHVYA= github.com/sclevine/spec v1.2.0/go.mod h1:W4J29eT/Kzv7/b9IWLB055Z+qvVC9vt0Arko24q7p+U= github.com/sclevine/spec v1.4.0 h1:z/Q9idDcay5m5irkZ28M7PtQM4aOISzOpj4bUPkDee8= github.com/sclevine/spec v1.4.0/go.mod h1:LvpgJaFyvQzRvc1kaDs0bulYwzC70PbiYjC4QnFHkOM= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sirupsen/logrus v1.3.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= -github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/afero v1.3.1 h1:GPTpEAuNr98px18yNQ66JllNil98wfRZ/5Ukny8FeQA= -github.com/spf13/afero v1.3.1/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4= -github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cast v1.3.1 h1:nFm6S0SMdyzrzcmThSipiEubIDy8WEXKNZ0UOgiRpng= -github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cobra v0.0.4 h1:S0tLZ3VOKl2Te0hpq8+ke0eSJPfCnNTPiDlsfwi1/NE= github.com/spf13/cobra v0.0.4/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= -github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= -github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= -github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.1.1/go.mod h1:A8kyI5cUJhb8N+3pkfONlcEcZbueH6nhAm0Fq7SrnBM= github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= -github.com/spf13/viper v1.4.0 h1:yXHLWeravcrgGyFSyCgdYpXQ9dR9c/WED3pg1RhxqEU= -github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= -github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= -github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= -github.com/weppos/publicsuffix-go v0.4.0/go.mod h1:z3LCPQ38eedDQSwmsSRW4Y7t2L8Ln16JPQ02lHAdn5k= -github.com/weppos/publicsuffix-go v0.5.0 h1:rutRtjBJViU/YjcI5d80t4JAVvDltS6bciJg2K1HrLU= -github.com/weppos/publicsuffix-go v0.5.0/go.mod h1:z3LCPQ38eedDQSwmsSRW4Y7t2L8Ln16JPQ02lHAdn5k= -github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= -github.com/ziutek/mymysql v1.5.4/go.mod h1:LMSpPZ6DbqWFxNCHW77HeMg9I646SAhApZ/wKdgO/C0= -github.com/zmap/rc2 v0.0.0-20131011165748-24b9757f5521/go.mod h1:3YZ9o3WnatTIZhuOtot4IcUfzoKVjUHqu6WALIyI0nE= -github.com/zmap/zcertificate v0.0.0-20180516150559-0e3d58b1bac4/go.mod h1:5iU54tB79AMBcySS0R2XIyZBAVmeHranShAFELYx7is= -github.com/zmap/zcrypto v0.0.0-20190729165852-9051775e6a2e h1:mvOa4+/DXStR4ZXOks/UsjeFdn5O5JpLUtzqk9U8xXw= -github.com/zmap/zcrypto v0.0.0-20190729165852-9051775e6a2e/go.mod h1:w7kd3qXHh8FNaczNjslXqvFQiv5mMWRXlL9klTUAHc8= -github.com/zmap/zlint v0.0.0-20190806154020-fd021b4cfbeb h1:vxqkjztXSaPVDc8FQCdHTaejm2x747f6yPbnu1h2xkg= -github.com/zmap/zlint v0.0.0-20190806154020-fd021b4cfbeb/go.mod h1:29UiAJNsiVdvTBFCJW8e3q6dcDbOoPkhMgttOSCIMMY= -go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= -go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d h1:1ZiEyfaQIg3Qh0EoqpwAakHVhecoE5wlSg5GjnafJGw= -golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee h1:WG0RUwxtNT4qqaXX3DPA8zHFNm/D9xaBpxzHt1WcA/E= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190522155817-f3200d17e092 h1:4QSRKanuywn15aTZvI/mIDEgPQpswuFndXpOj3rKEco= -golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190628185345-da137c7871d7 h1:rTIdg5QFRR7XCaK4LCjBiPbx8j4DQRpdYMnGn/bJUEU= golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb h1:fgwFCsaw9buMuxNd6+DQfAuSFqbNiQZpcgJQAgJsK6k= golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3 h1:4y9KwBHBgBNwDbtu44R5o1fdOCQUEXhbk/P4A9WmJq0= -golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= +golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20200301222351-066e0c02454c h1:FD7jysxM+EJqg5UYYy3XYDsAiUickFsn4UiaanJkf8c= golang.org/x/tools v0.0.0-20200301222351-066e0c02454c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7 h1:9zdDQZ7Thm29KFXgAX/+yaf3eVbP7djjWp/dXAppNCc= +golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898 h1:/atklqdjdhuosWIl6AIbOeHJjicWYPqR9bpxqxYG2pA= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/grpc v1.19.0 h1:cfg4PD8YEdSFnm7qLV4++93WcmhH2nIUhMjhdCvl3j8= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.21.0 h1:G+97AoqBnmZIT91cLG/EkCoK9NSelj64P8bOHHNmGn0= -google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.23.0 h1:AzbTB6ux+okLTzP8Ru1Xs41C303zdcfEht7MQnYJt5A= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.29.1 h1:EC2SB8S04d2r73uptxphDSUG+kTKVgjRPF+N3xpxRB4= -google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 h1:DdoeryqhaXp1LtT/emMP1BRJPHHKFi5akj/nbx/zNTA= +google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4/go.mod h1:NWraEVixdDnqcqQ30jipen1STv2r/n24Wb7twVTGR4s= +google.golang.org/grpc v1.55.0 h1:3Oj82/tFSCeUrRTg/5E/7d/W5A1tj6Ky1ABAuZuv5ag= +google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= +google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= -rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= diff --git a/pkg/fabric/fabric.go b/pkg/fabric/fabric.go index 5b8720b..3b90c32 100644 --- a/pkg/fabric/fabric.go +++ b/pkg/fabric/fabric.go @@ -7,16 +7,7 @@ SPDX-License-Identifier: Apache-2.0 package fabric import ( - "os" - "github.com/hyperledger/fabric-cli/pkg/environment" - "github.com/hyperledger/fabric-sdk-go/pkg/client/channel" - "github.com/hyperledger/fabric-sdk-go/pkg/client/event" - "github.com/hyperledger/fabric-sdk-go/pkg/client/ledger" - "github.com/hyperledger/fabric-sdk-go/pkg/client/msp" - "github.com/hyperledger/fabric-sdk-go/pkg/client/resmgmt" - "github.com/hyperledger/fabric-sdk-go/pkg/core/config" - "github.com/hyperledger/fabric-sdk-go/pkg/fabsdk" ) type factory struct { @@ -25,7 +16,7 @@ type factory struct { } // interface implementation check -var _ Factory = &factory{} +/*var _ Factory = &factory{} // NewFactory creates a factory for the given profile/context func NewFactory(config *environment.Config) (Factory, error) { @@ -45,6 +36,7 @@ func NewFactory(config *environment.Config) (Factory, error) { }, nil } +/* func (f *factory) SDK() (SDK, error) { sdk, err := fabsdk.New(config.FromFile(os.ExpandEnv(f.config))) if err != nil { @@ -147,3 +139,4 @@ func (f *factory) MSP() (MSP, error) { return client, nil } +*/ diff --git a/pkg/fabric/fabric_test.go b/pkg/fabric/fabric_test.go index e31f557..79446a1 100644 --- a/pkg/fabric/fabric_test.go +++ b/pkg/fabric/fabric_test.go @@ -9,9 +9,6 @@ package fabric_test import ( "testing" - "github.com/hyperledger/fabric-cli/pkg/environment" - "github.com/hyperledger/fabric-cli/pkg/fabric" - . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) @@ -22,7 +19,6 @@ import ( //go:generate gobin -m -run github.com/maxbrunsfeld/counterfeiter/v6 -o mocks/ledger.go --fake-name Ledger . Ledger //go:generate gobin -m -run github.com/maxbrunsfeld/counterfeiter/v6 -o mocks/resmgmt.go --fake-name ResourceManagement . ResourceManagement //go:generate gobin -m -run github.com/maxbrunsfeld/counterfeiter/v6 -o mocks/msp.go --fake-name MSP . MSP -//go:generate gobin -m -run github.com/maxbrunsfeld/counterfeiter/v6 -o mocks/channelcfg.go --fake-name ChannelCfg github.com/hyperledger/fabric-sdk-go/pkg/common/providers/fab.ChannelCfg func TestFabric(t *testing.T) { RegisterFailHandler(Fail) @@ -30,6 +26,7 @@ func TestFabric(t *testing.T) { RunSpecs(t, "Fabric Suite") } +/* var _ = Describe("Factory", func() { var ( factory fabric.Factory @@ -91,3 +88,4 @@ var _ = Describe("Factory", func() { }) }) +*/ diff --git a/pkg/fabric/interfaces.go b/pkg/fabric/interfaces.go index 795ab24..c7c441e 100644 --- a/pkg/fabric/interfaces.go +++ b/pkg/fabric/interfaces.go @@ -6,22 +6,6 @@ SPDX-License-Identifier: Apache-2.0 package fabric -import ( - "github.com/hyperledger/fabric-protos-go/common" - pb "github.com/hyperledger/fabric-protos-go/peer" - "github.com/hyperledger/fabric-sdk-go/pkg/client/channel" - "github.com/hyperledger/fabric-sdk-go/pkg/client/channel/invoke" - "github.com/hyperledger/fabric-sdk-go/pkg/client/ledger" - "github.com/hyperledger/fabric-sdk-go/pkg/client/msp" - "github.com/hyperledger/fabric-sdk-go/pkg/client/resmgmt" - "github.com/hyperledger/fabric-sdk-go/pkg/common/providers/context" - "github.com/hyperledger/fabric-sdk-go/pkg/common/providers/core" - "github.com/hyperledger/fabric-sdk-go/pkg/common/providers/fab" - mspctx "github.com/hyperledger/fabric-sdk-go/pkg/common/providers/msp" - "github.com/hyperledger/fabric-sdk-go/pkg/fab/resource" - "github.com/hyperledger/fabric-sdk-go/pkg/fabsdk" -) - // Factory provides abstractions for the various SDK clients type Factory interface { SDK() (SDK, error) @@ -34,44 +18,44 @@ type Factory interface { // SDK defines the context methods for the various SDK clients type SDK interface { - ChannelContext(channelID string, options ...fabsdk.ContextOption) context.ChannelProvider + /*ChannelContext(channelID string, options ...fabsdk.ContextOption) context.ChannelProvider Context(options ...fabsdk.ContextOption) context.ClientProvider Config() (core.ConfigBackend, error) CloseContext(ctxt fab.ClientContext) - Close() + Close()*/ } // Channel defines the methods implemented by SDK channel client type Channel interface { - Execute(request channel.Request, options ...channel.RequestOption) (channel.Response, error) + /*Execute(request channel.Request, options ...channel.RequestOption) (channel.Response, error) InvokeHandler(handler invoke.Handler, request channel.Request, options ...channel.RequestOption) (channel.Response, error) Query(request channel.Request, options ...channel.RequestOption) (channel.Response, error) RegisterChaincodeEvent(chainCodeID string, eventFilter string) (fab.Registration, <-chan *fab.CCEvent, error) - UnregisterChaincodeEvent(registration fab.Registration) + UnregisterChaincodeEvent(registration fab.Registration)*/ } // Event defines the methods implemented by SDK event client type Event interface { - RegisterBlockEvent(filter ...fab.BlockFilter) (fab.Registration, <-chan *fab.BlockEvent, error) + /*RegisterBlockEvent(filter ...fab.BlockFilter) (fab.Registration, <-chan *fab.BlockEvent, error) RegisterChaincodeEvent(ccID, eventFilter string) (fab.Registration, <-chan *fab.CCEvent, error) RegisterFilteredBlockEvent() (fab.Registration, <-chan *fab.FilteredBlockEvent, error) RegisterTxStatusEvent(txID string) (fab.Registration, <-chan *fab.TxStatusEvent, error) - Unregister(reg fab.Registration) + Unregister(reg fab.Registration)*/ } // Ledger defines the methods implemented by SDK ledger client type Ledger interface { - QueryBlock(blockNumber uint64, options ...ledger.RequestOption) (*common.Block, error) + /*QueryBlock(blockNumber uint64, options ...ledger.RequestOption) (*common.Block, error) QueryBlockByHash(blockHash []byte, options ...ledger.RequestOption) (*common.Block, error) QueryBlockByTxID(txID fab.TransactionID, options ...ledger.RequestOption) (*common.Block, error) QueryConfig(options ...ledger.RequestOption) (fab.ChannelCfg, error) QueryInfo(options ...ledger.RequestOption) (*fab.BlockchainInfoResponse, error) - QueryTransaction(transactionID fab.TransactionID, options ...ledger.RequestOption) (*pb.ProcessedTransaction, error) + QueryTransaction(transactionID fab.TransactionID, options ...ledger.RequestOption) (*pb.ProcessedTransaction, error)*/ } // ResourceManagement defines the methods implemented by SDK resmgmt client type ResourceManagement interface { - CreateConfigSignature(signer mspctx.SigningIdentity, channelConfigPath string) (*common.ConfigSignature, error) + /*CreateConfigSignature(signer mspctx.SigningIdentity, channelConfigPath string) (*common.ConfigSignature, error) CreateConfigSignatureData(signer mspctx.SigningIdentity, channelConfigPath string) (signatureHeaderData resource.ConfigSignatureData, e error) InstallCC(req resmgmt.InstallCCRequest, options ...resmgmt.RequestOption) ([]resmgmt.InstallCCResponse, error) InstantiateCC(channelID string, req resmgmt.InstantiateCCRequest, options ...resmgmt.RequestOption) (resmgmt.InstantiateCCResponse, error) @@ -93,12 +77,12 @@ type ResourceManagement interface { LifecycleCheckCCCommitReadiness(channelID string, req resmgmt.LifecycleCheckCCCommitReadinessRequest, options ...resmgmt.RequestOption) (resmgmt.LifecycleCheckCCCommitReadinessResponse, error) LifecycleQueryCommittedCC(channelID string, req resmgmt.LifecycleQueryCommittedCCRequest, - options ...resmgmt.RequestOption) ([]resmgmt.LifecycleChaincodeDefinition, error) + options ...resmgmt.RequestOption) ([]resmgmt.LifecycleChaincodeDefinition, error)*/ } // MSP defines the methods implemented by SDK msp client type MSP interface { - AddAffiliation(request *msp.AffiliationRequest) (*msp.AffiliationResponse, error) + /*AddAffiliation(request *msp.AffiliationRequest) (*msp.AffiliationResponse, error) CreateIdentity(request *msp.IdentityRequest) (*msp.IdentityResponse, error) CreateSigningIdentity(opts ...mspctx.SigningIdentityOption) (mspctx.SigningIdentity, error) Enroll(enrollmentID string, opts ...msp.EnrollmentOption) error @@ -114,5 +98,5 @@ type MSP interface { Register(request *msp.RegistrationRequest) (string, error) RemoveAffiliation(request *msp.AffiliationRequest) (*msp.AffiliationResponse, error) RemoveIdentity(request *msp.RemoveIdentityRequest) (*msp.IdentityResponse, error) - Revoke(request *msp.RevocationRequest) (*msp.RevocationResponse, error) + Revoke(request *msp.RevocationRequest) (*msp.RevocationResponse, error)*/ } diff --git a/pkg/fabric/mocks/channel.go b/pkg/fabric/mocks/channel.go deleted file mode 100644 index 0703ad2..0000000 --- a/pkg/fabric/mocks/channel.go +++ /dev/null @@ -1,405 +0,0 @@ -// Code generated by counterfeiter. DO NOT EDIT. -package mocks - -import ( - "sync" - - "github.com/hyperledger/fabric-cli/pkg/fabric" - "github.com/hyperledger/fabric-sdk-go/pkg/client/channel" - "github.com/hyperledger/fabric-sdk-go/pkg/client/channel/invoke" - "github.com/hyperledger/fabric-sdk-go/pkg/common/providers/fab" -) - -type Channel struct { - ExecuteStub func(channel.Request, ...channel.RequestOption) (channel.Response, error) - executeMutex sync.RWMutex - executeArgsForCall []struct { - arg1 channel.Request - arg2 []channel.RequestOption - } - executeReturns struct { - result1 channel.Response - result2 error - } - executeReturnsOnCall map[int]struct { - result1 channel.Response - result2 error - } - InvokeHandlerStub func(invoke.Handler, channel.Request, ...channel.RequestOption) (channel.Response, error) - invokeHandlerMutex sync.RWMutex - invokeHandlerArgsForCall []struct { - arg1 invoke.Handler - arg2 channel.Request - arg3 []channel.RequestOption - } - invokeHandlerReturns struct { - result1 channel.Response - result2 error - } - invokeHandlerReturnsOnCall map[int]struct { - result1 channel.Response - result2 error - } - QueryStub func(channel.Request, ...channel.RequestOption) (channel.Response, error) - queryMutex sync.RWMutex - queryArgsForCall []struct { - arg1 channel.Request - arg2 []channel.RequestOption - } - queryReturns struct { - result1 channel.Response - result2 error - } - queryReturnsOnCall map[int]struct { - result1 channel.Response - result2 error - } - RegisterChaincodeEventStub func(string, string) (fab.Registration, <-chan *fab.CCEvent, error) - registerChaincodeEventMutex sync.RWMutex - registerChaincodeEventArgsForCall []struct { - arg1 string - arg2 string - } - registerChaincodeEventReturns struct { - result1 fab.Registration - result2 <-chan *fab.CCEvent - result3 error - } - registerChaincodeEventReturnsOnCall map[int]struct { - result1 fab.Registration - result2 <-chan *fab.CCEvent - result3 error - } - UnregisterChaincodeEventStub func(fab.Registration) - unregisterChaincodeEventMutex sync.RWMutex - unregisterChaincodeEventArgsForCall []struct { - arg1 fab.Registration - } - invocations map[string][][]interface{} - invocationsMutex sync.RWMutex -} - -func (fake *Channel) Execute(arg1 channel.Request, arg2 ...channel.RequestOption) (channel.Response, error) { - fake.executeMutex.Lock() - ret, specificReturn := fake.executeReturnsOnCall[len(fake.executeArgsForCall)] - fake.executeArgsForCall = append(fake.executeArgsForCall, struct { - arg1 channel.Request - arg2 []channel.RequestOption - }{arg1, arg2}) - fake.recordInvocation("Execute", []interface{}{arg1, arg2}) - fake.executeMutex.Unlock() - if fake.ExecuteStub != nil { - return fake.ExecuteStub(arg1, arg2...) - } - if specificReturn { - return ret.result1, ret.result2 - } - fakeReturns := fake.executeReturns - return fakeReturns.result1, fakeReturns.result2 -} - -func (fake *Channel) ExecuteCallCount() int { - fake.executeMutex.RLock() - defer fake.executeMutex.RUnlock() - return len(fake.executeArgsForCall) -} - -func (fake *Channel) ExecuteCalls(stub func(channel.Request, ...channel.RequestOption) (channel.Response, error)) { - fake.executeMutex.Lock() - defer fake.executeMutex.Unlock() - fake.ExecuteStub = stub -} - -func (fake *Channel) ExecuteArgsForCall(i int) (channel.Request, []channel.RequestOption) { - fake.executeMutex.RLock() - defer fake.executeMutex.RUnlock() - argsForCall := fake.executeArgsForCall[i] - return argsForCall.arg1, argsForCall.arg2 -} - -func (fake *Channel) ExecuteReturns(result1 channel.Response, result2 error) { - fake.executeMutex.Lock() - defer fake.executeMutex.Unlock() - fake.ExecuteStub = nil - fake.executeReturns = struct { - result1 channel.Response - result2 error - }{result1, result2} -} - -func (fake *Channel) ExecuteReturnsOnCall(i int, result1 channel.Response, result2 error) { - fake.executeMutex.Lock() - defer fake.executeMutex.Unlock() - fake.ExecuteStub = nil - if fake.executeReturnsOnCall == nil { - fake.executeReturnsOnCall = make(map[int]struct { - result1 channel.Response - result2 error - }) - } - fake.executeReturnsOnCall[i] = struct { - result1 channel.Response - result2 error - }{result1, result2} -} - -func (fake *Channel) InvokeHandler(arg1 invoke.Handler, arg2 channel.Request, arg3 ...channel.RequestOption) (channel.Response, error) { - fake.invokeHandlerMutex.Lock() - ret, specificReturn := fake.invokeHandlerReturnsOnCall[len(fake.invokeHandlerArgsForCall)] - fake.invokeHandlerArgsForCall = append(fake.invokeHandlerArgsForCall, struct { - arg1 invoke.Handler - arg2 channel.Request - arg3 []channel.RequestOption - }{arg1, arg2, arg3}) - fake.recordInvocation("InvokeHandler", []interface{}{arg1, arg2, arg3}) - fake.invokeHandlerMutex.Unlock() - if fake.InvokeHandlerStub != nil { - return fake.InvokeHandlerStub(arg1, arg2, arg3...) - } - if specificReturn { - return ret.result1, ret.result2 - } - fakeReturns := fake.invokeHandlerReturns - return fakeReturns.result1, fakeReturns.result2 -} - -func (fake *Channel) InvokeHandlerCallCount() int { - fake.invokeHandlerMutex.RLock() - defer fake.invokeHandlerMutex.RUnlock() - return len(fake.invokeHandlerArgsForCall) -} - -func (fake *Channel) InvokeHandlerCalls(stub func(invoke.Handler, channel.Request, ...channel.RequestOption) (channel.Response, error)) { - fake.invokeHandlerMutex.Lock() - defer fake.invokeHandlerMutex.Unlock() - fake.InvokeHandlerStub = stub -} - -func (fake *Channel) InvokeHandlerArgsForCall(i int) (invoke.Handler, channel.Request, []channel.RequestOption) { - fake.invokeHandlerMutex.RLock() - defer fake.invokeHandlerMutex.RUnlock() - argsForCall := fake.invokeHandlerArgsForCall[i] - return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3 -} - -func (fake *Channel) InvokeHandlerReturns(result1 channel.Response, result2 error) { - fake.invokeHandlerMutex.Lock() - defer fake.invokeHandlerMutex.Unlock() - fake.InvokeHandlerStub = nil - fake.invokeHandlerReturns = struct { - result1 channel.Response - result2 error - }{result1, result2} -} - -func (fake *Channel) InvokeHandlerReturnsOnCall(i int, result1 channel.Response, result2 error) { - fake.invokeHandlerMutex.Lock() - defer fake.invokeHandlerMutex.Unlock() - fake.InvokeHandlerStub = nil - if fake.invokeHandlerReturnsOnCall == nil { - fake.invokeHandlerReturnsOnCall = make(map[int]struct { - result1 channel.Response - result2 error - }) - } - fake.invokeHandlerReturnsOnCall[i] = struct { - result1 channel.Response - result2 error - }{result1, result2} -} - -func (fake *Channel) Query(arg1 channel.Request, arg2 ...channel.RequestOption) (channel.Response, error) { - fake.queryMutex.Lock() - ret, specificReturn := fake.queryReturnsOnCall[len(fake.queryArgsForCall)] - fake.queryArgsForCall = append(fake.queryArgsForCall, struct { - arg1 channel.Request - arg2 []channel.RequestOption - }{arg1, arg2}) - fake.recordInvocation("Query", []interface{}{arg1, arg2}) - fake.queryMutex.Unlock() - if fake.QueryStub != nil { - return fake.QueryStub(arg1, arg2...) - } - if specificReturn { - return ret.result1, ret.result2 - } - fakeReturns := fake.queryReturns - return fakeReturns.result1, fakeReturns.result2 -} - -func (fake *Channel) QueryCallCount() int { - fake.queryMutex.RLock() - defer fake.queryMutex.RUnlock() - return len(fake.queryArgsForCall) -} - -func (fake *Channel) QueryCalls(stub func(channel.Request, ...channel.RequestOption) (channel.Response, error)) { - fake.queryMutex.Lock() - defer fake.queryMutex.Unlock() - fake.QueryStub = stub -} - -func (fake *Channel) QueryArgsForCall(i int) (channel.Request, []channel.RequestOption) { - fake.queryMutex.RLock() - defer fake.queryMutex.RUnlock() - argsForCall := fake.queryArgsForCall[i] - return argsForCall.arg1, argsForCall.arg2 -} - -func (fake *Channel) QueryReturns(result1 channel.Response, result2 error) { - fake.queryMutex.Lock() - defer fake.queryMutex.Unlock() - fake.QueryStub = nil - fake.queryReturns = struct { - result1 channel.Response - result2 error - }{result1, result2} -} - -func (fake *Channel) QueryReturnsOnCall(i int, result1 channel.Response, result2 error) { - fake.queryMutex.Lock() - defer fake.queryMutex.Unlock() - fake.QueryStub = nil - if fake.queryReturnsOnCall == nil { - fake.queryReturnsOnCall = make(map[int]struct { - result1 channel.Response - result2 error - }) - } - fake.queryReturnsOnCall[i] = struct { - result1 channel.Response - result2 error - }{result1, result2} -} - -func (fake *Channel) RegisterChaincodeEvent(arg1 string, arg2 string) (fab.Registration, <-chan *fab.CCEvent, error) { - fake.registerChaincodeEventMutex.Lock() - ret, specificReturn := fake.registerChaincodeEventReturnsOnCall[len(fake.registerChaincodeEventArgsForCall)] - fake.registerChaincodeEventArgsForCall = append(fake.registerChaincodeEventArgsForCall, struct { - arg1 string - arg2 string - }{arg1, arg2}) - fake.recordInvocation("RegisterChaincodeEvent", []interface{}{arg1, arg2}) - fake.registerChaincodeEventMutex.Unlock() - if fake.RegisterChaincodeEventStub != nil { - return fake.RegisterChaincodeEventStub(arg1, arg2) - } - if specificReturn { - return ret.result1, ret.result2, ret.result3 - } - fakeReturns := fake.registerChaincodeEventReturns - return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 -} - -func (fake *Channel) RegisterChaincodeEventCallCount() int { - fake.registerChaincodeEventMutex.RLock() - defer fake.registerChaincodeEventMutex.RUnlock() - return len(fake.registerChaincodeEventArgsForCall) -} - -func (fake *Channel) RegisterChaincodeEventCalls(stub func(string, string) (fab.Registration, <-chan *fab.CCEvent, error)) { - fake.registerChaincodeEventMutex.Lock() - defer fake.registerChaincodeEventMutex.Unlock() - fake.RegisterChaincodeEventStub = stub -} - -func (fake *Channel) RegisterChaincodeEventArgsForCall(i int) (string, string) { - fake.registerChaincodeEventMutex.RLock() - defer fake.registerChaincodeEventMutex.RUnlock() - argsForCall := fake.registerChaincodeEventArgsForCall[i] - return argsForCall.arg1, argsForCall.arg2 -} - -func (fake *Channel) RegisterChaincodeEventReturns(result1 fab.Registration, result2 <-chan *fab.CCEvent, result3 error) { - fake.registerChaincodeEventMutex.Lock() - defer fake.registerChaincodeEventMutex.Unlock() - fake.RegisterChaincodeEventStub = nil - fake.registerChaincodeEventReturns = struct { - result1 fab.Registration - result2 <-chan *fab.CCEvent - result3 error - }{result1, result2, result3} -} - -func (fake *Channel) RegisterChaincodeEventReturnsOnCall(i int, result1 fab.Registration, result2 <-chan *fab.CCEvent, result3 error) { - fake.registerChaincodeEventMutex.Lock() - defer fake.registerChaincodeEventMutex.Unlock() - fake.RegisterChaincodeEventStub = nil - if fake.registerChaincodeEventReturnsOnCall == nil { - fake.registerChaincodeEventReturnsOnCall = make(map[int]struct { - result1 fab.Registration - result2 <-chan *fab.CCEvent - result3 error - }) - } - fake.registerChaincodeEventReturnsOnCall[i] = struct { - result1 fab.Registration - result2 <-chan *fab.CCEvent - result3 error - }{result1, result2, result3} -} - -func (fake *Channel) UnregisterChaincodeEvent(arg1 fab.Registration) { - fake.unregisterChaincodeEventMutex.Lock() - fake.unregisterChaincodeEventArgsForCall = append(fake.unregisterChaincodeEventArgsForCall, struct { - arg1 fab.Registration - }{arg1}) - fake.recordInvocation("UnregisterChaincodeEvent", []interface{}{arg1}) - fake.unregisterChaincodeEventMutex.Unlock() - if fake.UnregisterChaincodeEventStub != nil { - fake.UnregisterChaincodeEventStub(arg1) - } -} - -func (fake *Channel) UnregisterChaincodeEventCallCount() int { - fake.unregisterChaincodeEventMutex.RLock() - defer fake.unregisterChaincodeEventMutex.RUnlock() - return len(fake.unregisterChaincodeEventArgsForCall) -} - -func (fake *Channel) UnregisterChaincodeEventCalls(stub func(fab.Registration)) { - fake.unregisterChaincodeEventMutex.Lock() - defer fake.unregisterChaincodeEventMutex.Unlock() - fake.UnregisterChaincodeEventStub = stub -} - -func (fake *Channel) UnregisterChaincodeEventArgsForCall(i int) fab.Registration { - fake.unregisterChaincodeEventMutex.RLock() - defer fake.unregisterChaincodeEventMutex.RUnlock() - argsForCall := fake.unregisterChaincodeEventArgsForCall[i] - return argsForCall.arg1 -} - -func (fake *Channel) Invocations() map[string][][]interface{} { - fake.invocationsMutex.RLock() - defer fake.invocationsMutex.RUnlock() - fake.executeMutex.RLock() - defer fake.executeMutex.RUnlock() - fake.invokeHandlerMutex.RLock() - defer fake.invokeHandlerMutex.RUnlock() - fake.queryMutex.RLock() - defer fake.queryMutex.RUnlock() - fake.registerChaincodeEventMutex.RLock() - defer fake.registerChaincodeEventMutex.RUnlock() - fake.unregisterChaincodeEventMutex.RLock() - defer fake.unregisterChaincodeEventMutex.RUnlock() - copiedInvocations := map[string][][]interface{}{} - for key, value := range fake.invocations { - copiedInvocations[key] = value - } - return copiedInvocations -} - -func (fake *Channel) recordInvocation(key string, args []interface{}) { - fake.invocationsMutex.Lock() - defer fake.invocationsMutex.Unlock() - if fake.invocations == nil { - fake.invocations = map[string][][]interface{}{} - } - if fake.invocations[key] == nil { - fake.invocations[key] = [][]interface{}{} - } - fake.invocations[key] = append(fake.invocations[key], args) -} - -var _ fabric.Channel = new(Channel) diff --git a/pkg/fabric/mocks/channelcfg.go b/pkg/fabric/mocks/channelcfg.go deleted file mode 100644 index fb1815e..0000000 --- a/pkg/fabric/mocks/channelcfg.go +++ /dev/null @@ -1,497 +0,0 @@ -// Code generated by counterfeiter. DO NOT EDIT. -package mocks - -import ( - "sync" - - "github.com/hyperledger/fabric-protos-go/msp" - "github.com/hyperledger/fabric-sdk-go/pkg/common/providers/fab" -) - -type ChannelCfg struct { - AnchorPeersStub func() []*fab.OrgAnchorPeer - anchorPeersMutex sync.RWMutex - anchorPeersArgsForCall []struct { - } - anchorPeersReturns struct { - result1 []*fab.OrgAnchorPeer - } - anchorPeersReturnsOnCall map[int]struct { - result1 []*fab.OrgAnchorPeer - } - BlockNumberStub func() uint64 - blockNumberMutex sync.RWMutex - blockNumberArgsForCall []struct { - } - blockNumberReturns struct { - result1 uint64 - } - blockNumberReturnsOnCall map[int]struct { - result1 uint64 - } - HasCapabilityStub func(fab.ConfigGroupKey, string) bool - hasCapabilityMutex sync.RWMutex - hasCapabilityArgsForCall []struct { - arg1 fab.ConfigGroupKey - arg2 string - } - hasCapabilityReturns struct { - result1 bool - } - hasCapabilityReturnsOnCall map[int]struct { - result1 bool - } - IDStub func() string - iDMutex sync.RWMutex - iDArgsForCall []struct { - } - iDReturns struct { - result1 string - } - iDReturnsOnCall map[int]struct { - result1 string - } - MSPsStub func() []*msp.MSPConfig - mSPsMutex sync.RWMutex - mSPsArgsForCall []struct { - } - mSPsReturns struct { - result1 []*msp.MSPConfig - } - mSPsReturnsOnCall map[int]struct { - result1 []*msp.MSPConfig - } - OrderersStub func() []string - orderersMutex sync.RWMutex - orderersArgsForCall []struct { - } - orderersReturns struct { - result1 []string - } - orderersReturnsOnCall map[int]struct { - result1 []string - } - VersionsStub func() *fab.Versions - versionsMutex sync.RWMutex - versionsArgsForCall []struct { - } - versionsReturns struct { - result1 *fab.Versions - } - versionsReturnsOnCall map[int]struct { - result1 *fab.Versions - } - invocations map[string][][]interface{} - invocationsMutex sync.RWMutex -} - -func (fake *ChannelCfg) AnchorPeers() []*fab.OrgAnchorPeer { - fake.anchorPeersMutex.Lock() - ret, specificReturn := fake.anchorPeersReturnsOnCall[len(fake.anchorPeersArgsForCall)] - fake.anchorPeersArgsForCall = append(fake.anchorPeersArgsForCall, struct { - }{}) - fake.recordInvocation("AnchorPeers", []interface{}{}) - fake.anchorPeersMutex.Unlock() - if fake.AnchorPeersStub != nil { - return fake.AnchorPeersStub() - } - if specificReturn { - return ret.result1 - } - fakeReturns := fake.anchorPeersReturns - return fakeReturns.result1 -} - -func (fake *ChannelCfg) AnchorPeersCallCount() int { - fake.anchorPeersMutex.RLock() - defer fake.anchorPeersMutex.RUnlock() - return len(fake.anchorPeersArgsForCall) -} - -func (fake *ChannelCfg) AnchorPeersCalls(stub func() []*fab.OrgAnchorPeer) { - fake.anchorPeersMutex.Lock() - defer fake.anchorPeersMutex.Unlock() - fake.AnchorPeersStub = stub -} - -func (fake *ChannelCfg) AnchorPeersReturns(result1 []*fab.OrgAnchorPeer) { - fake.anchorPeersMutex.Lock() - defer fake.anchorPeersMutex.Unlock() - fake.AnchorPeersStub = nil - fake.anchorPeersReturns = struct { - result1 []*fab.OrgAnchorPeer - }{result1} -} - -func (fake *ChannelCfg) AnchorPeersReturnsOnCall(i int, result1 []*fab.OrgAnchorPeer) { - fake.anchorPeersMutex.Lock() - defer fake.anchorPeersMutex.Unlock() - fake.AnchorPeersStub = nil - if fake.anchorPeersReturnsOnCall == nil { - fake.anchorPeersReturnsOnCall = make(map[int]struct { - result1 []*fab.OrgAnchorPeer - }) - } - fake.anchorPeersReturnsOnCall[i] = struct { - result1 []*fab.OrgAnchorPeer - }{result1} -} - -func (fake *ChannelCfg) BlockNumber() uint64 { - fake.blockNumberMutex.Lock() - ret, specificReturn := fake.blockNumberReturnsOnCall[len(fake.blockNumberArgsForCall)] - fake.blockNumberArgsForCall = append(fake.blockNumberArgsForCall, struct { - }{}) - fake.recordInvocation("BlockNumber", []interface{}{}) - fake.blockNumberMutex.Unlock() - if fake.BlockNumberStub != nil { - return fake.BlockNumberStub() - } - if specificReturn { - return ret.result1 - } - fakeReturns := fake.blockNumberReturns - return fakeReturns.result1 -} - -func (fake *ChannelCfg) BlockNumberCallCount() int { - fake.blockNumberMutex.RLock() - defer fake.blockNumberMutex.RUnlock() - return len(fake.blockNumberArgsForCall) -} - -func (fake *ChannelCfg) BlockNumberCalls(stub func() uint64) { - fake.blockNumberMutex.Lock() - defer fake.blockNumberMutex.Unlock() - fake.BlockNumberStub = stub -} - -func (fake *ChannelCfg) BlockNumberReturns(result1 uint64) { - fake.blockNumberMutex.Lock() - defer fake.blockNumberMutex.Unlock() - fake.BlockNumberStub = nil - fake.blockNumberReturns = struct { - result1 uint64 - }{result1} -} - -func (fake *ChannelCfg) BlockNumberReturnsOnCall(i int, result1 uint64) { - fake.blockNumberMutex.Lock() - defer fake.blockNumberMutex.Unlock() - fake.BlockNumberStub = nil - if fake.blockNumberReturnsOnCall == nil { - fake.blockNumberReturnsOnCall = make(map[int]struct { - result1 uint64 - }) - } - fake.blockNumberReturnsOnCall[i] = struct { - result1 uint64 - }{result1} -} - -func (fake *ChannelCfg) HasCapability(arg1 fab.ConfigGroupKey, arg2 string) bool { - fake.hasCapabilityMutex.Lock() - ret, specificReturn := fake.hasCapabilityReturnsOnCall[len(fake.hasCapabilityArgsForCall)] - fake.hasCapabilityArgsForCall = append(fake.hasCapabilityArgsForCall, struct { - arg1 fab.ConfigGroupKey - arg2 string - }{arg1, arg2}) - fake.recordInvocation("HasCapability", []interface{}{arg1, arg2}) - fake.hasCapabilityMutex.Unlock() - if fake.HasCapabilityStub != nil { - return fake.HasCapabilityStub(arg1, arg2) - } - if specificReturn { - return ret.result1 - } - fakeReturns := fake.hasCapabilityReturns - return fakeReturns.result1 -} - -func (fake *ChannelCfg) HasCapabilityCallCount() int { - fake.hasCapabilityMutex.RLock() - defer fake.hasCapabilityMutex.RUnlock() - return len(fake.hasCapabilityArgsForCall) -} - -func (fake *ChannelCfg) HasCapabilityCalls(stub func(fab.ConfigGroupKey, string) bool) { - fake.hasCapabilityMutex.Lock() - defer fake.hasCapabilityMutex.Unlock() - fake.HasCapabilityStub = stub -} - -func (fake *ChannelCfg) HasCapabilityArgsForCall(i int) (fab.ConfigGroupKey, string) { - fake.hasCapabilityMutex.RLock() - defer fake.hasCapabilityMutex.RUnlock() - argsForCall := fake.hasCapabilityArgsForCall[i] - return argsForCall.arg1, argsForCall.arg2 -} - -func (fake *ChannelCfg) HasCapabilityReturns(result1 bool) { - fake.hasCapabilityMutex.Lock() - defer fake.hasCapabilityMutex.Unlock() - fake.HasCapabilityStub = nil - fake.hasCapabilityReturns = struct { - result1 bool - }{result1} -} - -func (fake *ChannelCfg) HasCapabilityReturnsOnCall(i int, result1 bool) { - fake.hasCapabilityMutex.Lock() - defer fake.hasCapabilityMutex.Unlock() - fake.HasCapabilityStub = nil - if fake.hasCapabilityReturnsOnCall == nil { - fake.hasCapabilityReturnsOnCall = make(map[int]struct { - result1 bool - }) - } - fake.hasCapabilityReturnsOnCall[i] = struct { - result1 bool - }{result1} -} - -func (fake *ChannelCfg) ID() string { - fake.iDMutex.Lock() - ret, specificReturn := fake.iDReturnsOnCall[len(fake.iDArgsForCall)] - fake.iDArgsForCall = append(fake.iDArgsForCall, struct { - }{}) - fake.recordInvocation("ID", []interface{}{}) - fake.iDMutex.Unlock() - if fake.IDStub != nil { - return fake.IDStub() - } - if specificReturn { - return ret.result1 - } - fakeReturns := fake.iDReturns - return fakeReturns.result1 -} - -func (fake *ChannelCfg) IDCallCount() int { - fake.iDMutex.RLock() - defer fake.iDMutex.RUnlock() - return len(fake.iDArgsForCall) -} - -func (fake *ChannelCfg) IDCalls(stub func() string) { - fake.iDMutex.Lock() - defer fake.iDMutex.Unlock() - fake.IDStub = stub -} - -func (fake *ChannelCfg) IDReturns(result1 string) { - fake.iDMutex.Lock() - defer fake.iDMutex.Unlock() - fake.IDStub = nil - fake.iDReturns = struct { - result1 string - }{result1} -} - -func (fake *ChannelCfg) IDReturnsOnCall(i int, result1 string) { - fake.iDMutex.Lock() - defer fake.iDMutex.Unlock() - fake.IDStub = nil - if fake.iDReturnsOnCall == nil { - fake.iDReturnsOnCall = make(map[int]struct { - result1 string - }) - } - fake.iDReturnsOnCall[i] = struct { - result1 string - }{result1} -} - -func (fake *ChannelCfg) MSPs() []*msp.MSPConfig { - fake.mSPsMutex.Lock() - ret, specificReturn := fake.mSPsReturnsOnCall[len(fake.mSPsArgsForCall)] - fake.mSPsArgsForCall = append(fake.mSPsArgsForCall, struct { - }{}) - fake.recordInvocation("MSPs", []interface{}{}) - fake.mSPsMutex.Unlock() - if fake.MSPsStub != nil { - return fake.MSPsStub() - } - if specificReturn { - return ret.result1 - } - fakeReturns := fake.mSPsReturns - return fakeReturns.result1 -} - -func (fake *ChannelCfg) MSPsCallCount() int { - fake.mSPsMutex.RLock() - defer fake.mSPsMutex.RUnlock() - return len(fake.mSPsArgsForCall) -} - -func (fake *ChannelCfg) MSPsCalls(stub func() []*msp.MSPConfig) { - fake.mSPsMutex.Lock() - defer fake.mSPsMutex.Unlock() - fake.MSPsStub = stub -} - -func (fake *ChannelCfg) MSPsReturns(result1 []*msp.MSPConfig) { - fake.mSPsMutex.Lock() - defer fake.mSPsMutex.Unlock() - fake.MSPsStub = nil - fake.mSPsReturns = struct { - result1 []*msp.MSPConfig - }{result1} -} - -func (fake *ChannelCfg) MSPsReturnsOnCall(i int, result1 []*msp.MSPConfig) { - fake.mSPsMutex.Lock() - defer fake.mSPsMutex.Unlock() - fake.MSPsStub = nil - if fake.mSPsReturnsOnCall == nil { - fake.mSPsReturnsOnCall = make(map[int]struct { - result1 []*msp.MSPConfig - }) - } - fake.mSPsReturnsOnCall[i] = struct { - result1 []*msp.MSPConfig - }{result1} -} - -func (fake *ChannelCfg) Orderers() []string { - fake.orderersMutex.Lock() - ret, specificReturn := fake.orderersReturnsOnCall[len(fake.orderersArgsForCall)] - fake.orderersArgsForCall = append(fake.orderersArgsForCall, struct { - }{}) - fake.recordInvocation("Orderers", []interface{}{}) - fake.orderersMutex.Unlock() - if fake.OrderersStub != nil { - return fake.OrderersStub() - } - if specificReturn { - return ret.result1 - } - fakeReturns := fake.orderersReturns - return fakeReturns.result1 -} - -func (fake *ChannelCfg) OrderersCallCount() int { - fake.orderersMutex.RLock() - defer fake.orderersMutex.RUnlock() - return len(fake.orderersArgsForCall) -} - -func (fake *ChannelCfg) OrderersCalls(stub func() []string) { - fake.orderersMutex.Lock() - defer fake.orderersMutex.Unlock() - fake.OrderersStub = stub -} - -func (fake *ChannelCfg) OrderersReturns(result1 []string) { - fake.orderersMutex.Lock() - defer fake.orderersMutex.Unlock() - fake.OrderersStub = nil - fake.orderersReturns = struct { - result1 []string - }{result1} -} - -func (fake *ChannelCfg) OrderersReturnsOnCall(i int, result1 []string) { - fake.orderersMutex.Lock() - defer fake.orderersMutex.Unlock() - fake.OrderersStub = nil - if fake.orderersReturnsOnCall == nil { - fake.orderersReturnsOnCall = make(map[int]struct { - result1 []string - }) - } - fake.orderersReturnsOnCall[i] = struct { - result1 []string - }{result1} -} - -func (fake *ChannelCfg) Versions() *fab.Versions { - fake.versionsMutex.Lock() - ret, specificReturn := fake.versionsReturnsOnCall[len(fake.versionsArgsForCall)] - fake.versionsArgsForCall = append(fake.versionsArgsForCall, struct { - }{}) - fake.recordInvocation("Versions", []interface{}{}) - fake.versionsMutex.Unlock() - if fake.VersionsStub != nil { - return fake.VersionsStub() - } - if specificReturn { - return ret.result1 - } - fakeReturns := fake.versionsReturns - return fakeReturns.result1 -} - -func (fake *ChannelCfg) VersionsCallCount() int { - fake.versionsMutex.RLock() - defer fake.versionsMutex.RUnlock() - return len(fake.versionsArgsForCall) -} - -func (fake *ChannelCfg) VersionsCalls(stub func() *fab.Versions) { - fake.versionsMutex.Lock() - defer fake.versionsMutex.Unlock() - fake.VersionsStub = stub -} - -func (fake *ChannelCfg) VersionsReturns(result1 *fab.Versions) { - fake.versionsMutex.Lock() - defer fake.versionsMutex.Unlock() - fake.VersionsStub = nil - fake.versionsReturns = struct { - result1 *fab.Versions - }{result1} -} - -func (fake *ChannelCfg) VersionsReturnsOnCall(i int, result1 *fab.Versions) { - fake.versionsMutex.Lock() - defer fake.versionsMutex.Unlock() - fake.VersionsStub = nil - if fake.versionsReturnsOnCall == nil { - fake.versionsReturnsOnCall = make(map[int]struct { - result1 *fab.Versions - }) - } - fake.versionsReturnsOnCall[i] = struct { - result1 *fab.Versions - }{result1} -} - -func (fake *ChannelCfg) Invocations() map[string][][]interface{} { - fake.invocationsMutex.RLock() - defer fake.invocationsMutex.RUnlock() - fake.anchorPeersMutex.RLock() - defer fake.anchorPeersMutex.RUnlock() - fake.blockNumberMutex.RLock() - defer fake.blockNumberMutex.RUnlock() - fake.hasCapabilityMutex.RLock() - defer fake.hasCapabilityMutex.RUnlock() - fake.iDMutex.RLock() - defer fake.iDMutex.RUnlock() - fake.mSPsMutex.RLock() - defer fake.mSPsMutex.RUnlock() - fake.orderersMutex.RLock() - defer fake.orderersMutex.RUnlock() - fake.versionsMutex.RLock() - defer fake.versionsMutex.RUnlock() - copiedInvocations := map[string][][]interface{}{} - for key, value := range fake.invocations { - copiedInvocations[key] = value - } - return copiedInvocations -} - -func (fake *ChannelCfg) recordInvocation(key string, args []interface{}) { - fake.invocationsMutex.Lock() - defer fake.invocationsMutex.Unlock() - if fake.invocations == nil { - fake.invocations = map[string][][]interface{}{} - } - if fake.invocations[key] == nil { - fake.invocations[key] = [][]interface{}{} - } - fake.invocations[key] = append(fake.invocations[key], args) -} - -var _ fab.ChannelCfg = new(ChannelCfg) diff --git a/pkg/fabric/mocks/event.go b/pkg/fabric/mocks/event.go deleted file mode 100644 index 6d211f2..0000000 --- a/pkg/fabric/mocks/event.go +++ /dev/null @@ -1,401 +0,0 @@ -// Code generated by counterfeiter. DO NOT EDIT. -package mocks - -import ( - "sync" - - "github.com/hyperledger/fabric-cli/pkg/fabric" - "github.com/hyperledger/fabric-sdk-go/pkg/common/providers/fab" -) - -type Event struct { - RegisterBlockEventStub func(...fab.BlockFilter) (fab.Registration, <-chan *fab.BlockEvent, error) - registerBlockEventMutex sync.RWMutex - registerBlockEventArgsForCall []struct { - arg1 []fab.BlockFilter - } - registerBlockEventReturns struct { - result1 fab.Registration - result2 <-chan *fab.BlockEvent - result3 error - } - registerBlockEventReturnsOnCall map[int]struct { - result1 fab.Registration - result2 <-chan *fab.BlockEvent - result3 error - } - RegisterChaincodeEventStub func(string, string) (fab.Registration, <-chan *fab.CCEvent, error) - registerChaincodeEventMutex sync.RWMutex - registerChaincodeEventArgsForCall []struct { - arg1 string - arg2 string - } - registerChaincodeEventReturns struct { - result1 fab.Registration - result2 <-chan *fab.CCEvent - result3 error - } - registerChaincodeEventReturnsOnCall map[int]struct { - result1 fab.Registration - result2 <-chan *fab.CCEvent - result3 error - } - RegisterFilteredBlockEventStub func() (fab.Registration, <-chan *fab.FilteredBlockEvent, error) - registerFilteredBlockEventMutex sync.RWMutex - registerFilteredBlockEventArgsForCall []struct { - } - registerFilteredBlockEventReturns struct { - result1 fab.Registration - result2 <-chan *fab.FilteredBlockEvent - result3 error - } - registerFilteredBlockEventReturnsOnCall map[int]struct { - result1 fab.Registration - result2 <-chan *fab.FilteredBlockEvent - result3 error - } - RegisterTxStatusEventStub func(string) (fab.Registration, <-chan *fab.TxStatusEvent, error) - registerTxStatusEventMutex sync.RWMutex - registerTxStatusEventArgsForCall []struct { - arg1 string - } - registerTxStatusEventReturns struct { - result1 fab.Registration - result2 <-chan *fab.TxStatusEvent - result3 error - } - registerTxStatusEventReturnsOnCall map[int]struct { - result1 fab.Registration - result2 <-chan *fab.TxStatusEvent - result3 error - } - UnregisterStub func(fab.Registration) - unregisterMutex sync.RWMutex - unregisterArgsForCall []struct { - arg1 fab.Registration - } - invocations map[string][][]interface{} - invocationsMutex sync.RWMutex -} - -func (fake *Event) RegisterBlockEvent(arg1 ...fab.BlockFilter) (fab.Registration, <-chan *fab.BlockEvent, error) { - fake.registerBlockEventMutex.Lock() - ret, specificReturn := fake.registerBlockEventReturnsOnCall[len(fake.registerBlockEventArgsForCall)] - fake.registerBlockEventArgsForCall = append(fake.registerBlockEventArgsForCall, struct { - arg1 []fab.BlockFilter - }{arg1}) - fake.recordInvocation("RegisterBlockEvent", []interface{}{arg1}) - fake.registerBlockEventMutex.Unlock() - if fake.RegisterBlockEventStub != nil { - return fake.RegisterBlockEventStub(arg1...) - } - if specificReturn { - return ret.result1, ret.result2, ret.result3 - } - fakeReturns := fake.registerBlockEventReturns - return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 -} - -func (fake *Event) RegisterBlockEventCallCount() int { - fake.registerBlockEventMutex.RLock() - defer fake.registerBlockEventMutex.RUnlock() - return len(fake.registerBlockEventArgsForCall) -} - -func (fake *Event) RegisterBlockEventCalls(stub func(...fab.BlockFilter) (fab.Registration, <-chan *fab.BlockEvent, error)) { - fake.registerBlockEventMutex.Lock() - defer fake.registerBlockEventMutex.Unlock() - fake.RegisterBlockEventStub = stub -} - -func (fake *Event) RegisterBlockEventArgsForCall(i int) []fab.BlockFilter { - fake.registerBlockEventMutex.RLock() - defer fake.registerBlockEventMutex.RUnlock() - argsForCall := fake.registerBlockEventArgsForCall[i] - return argsForCall.arg1 -} - -func (fake *Event) RegisterBlockEventReturns(result1 fab.Registration, result2 <-chan *fab.BlockEvent, result3 error) { - fake.registerBlockEventMutex.Lock() - defer fake.registerBlockEventMutex.Unlock() - fake.RegisterBlockEventStub = nil - fake.registerBlockEventReturns = struct { - result1 fab.Registration - result2 <-chan *fab.BlockEvent - result3 error - }{result1, result2, result3} -} - -func (fake *Event) RegisterBlockEventReturnsOnCall(i int, result1 fab.Registration, result2 <-chan *fab.BlockEvent, result3 error) { - fake.registerBlockEventMutex.Lock() - defer fake.registerBlockEventMutex.Unlock() - fake.RegisterBlockEventStub = nil - if fake.registerBlockEventReturnsOnCall == nil { - fake.registerBlockEventReturnsOnCall = make(map[int]struct { - result1 fab.Registration - result2 <-chan *fab.BlockEvent - result3 error - }) - } - fake.registerBlockEventReturnsOnCall[i] = struct { - result1 fab.Registration - result2 <-chan *fab.BlockEvent - result3 error - }{result1, result2, result3} -} - -func (fake *Event) RegisterChaincodeEvent(arg1 string, arg2 string) (fab.Registration, <-chan *fab.CCEvent, error) { - fake.registerChaincodeEventMutex.Lock() - ret, specificReturn := fake.registerChaincodeEventReturnsOnCall[len(fake.registerChaincodeEventArgsForCall)] - fake.registerChaincodeEventArgsForCall = append(fake.registerChaincodeEventArgsForCall, struct { - arg1 string - arg2 string - }{arg1, arg2}) - fake.recordInvocation("RegisterChaincodeEvent", []interface{}{arg1, arg2}) - fake.registerChaincodeEventMutex.Unlock() - if fake.RegisterChaincodeEventStub != nil { - return fake.RegisterChaincodeEventStub(arg1, arg2) - } - if specificReturn { - return ret.result1, ret.result2, ret.result3 - } - fakeReturns := fake.registerChaincodeEventReturns - return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 -} - -func (fake *Event) RegisterChaincodeEventCallCount() int { - fake.registerChaincodeEventMutex.RLock() - defer fake.registerChaincodeEventMutex.RUnlock() - return len(fake.registerChaincodeEventArgsForCall) -} - -func (fake *Event) RegisterChaincodeEventCalls(stub func(string, string) (fab.Registration, <-chan *fab.CCEvent, error)) { - fake.registerChaincodeEventMutex.Lock() - defer fake.registerChaincodeEventMutex.Unlock() - fake.RegisterChaincodeEventStub = stub -} - -func (fake *Event) RegisterChaincodeEventArgsForCall(i int) (string, string) { - fake.registerChaincodeEventMutex.RLock() - defer fake.registerChaincodeEventMutex.RUnlock() - argsForCall := fake.registerChaincodeEventArgsForCall[i] - return argsForCall.arg1, argsForCall.arg2 -} - -func (fake *Event) RegisterChaincodeEventReturns(result1 fab.Registration, result2 <-chan *fab.CCEvent, result3 error) { - fake.registerChaincodeEventMutex.Lock() - defer fake.registerChaincodeEventMutex.Unlock() - fake.RegisterChaincodeEventStub = nil - fake.registerChaincodeEventReturns = struct { - result1 fab.Registration - result2 <-chan *fab.CCEvent - result3 error - }{result1, result2, result3} -} - -func (fake *Event) RegisterChaincodeEventReturnsOnCall(i int, result1 fab.Registration, result2 <-chan *fab.CCEvent, result3 error) { - fake.registerChaincodeEventMutex.Lock() - defer fake.registerChaincodeEventMutex.Unlock() - fake.RegisterChaincodeEventStub = nil - if fake.registerChaincodeEventReturnsOnCall == nil { - fake.registerChaincodeEventReturnsOnCall = make(map[int]struct { - result1 fab.Registration - result2 <-chan *fab.CCEvent - result3 error - }) - } - fake.registerChaincodeEventReturnsOnCall[i] = struct { - result1 fab.Registration - result2 <-chan *fab.CCEvent - result3 error - }{result1, result2, result3} -} - -func (fake *Event) RegisterFilteredBlockEvent() (fab.Registration, <-chan *fab.FilteredBlockEvent, error) { - fake.registerFilteredBlockEventMutex.Lock() - ret, specificReturn := fake.registerFilteredBlockEventReturnsOnCall[len(fake.registerFilteredBlockEventArgsForCall)] - fake.registerFilteredBlockEventArgsForCall = append(fake.registerFilteredBlockEventArgsForCall, struct { - }{}) - fake.recordInvocation("RegisterFilteredBlockEvent", []interface{}{}) - fake.registerFilteredBlockEventMutex.Unlock() - if fake.RegisterFilteredBlockEventStub != nil { - return fake.RegisterFilteredBlockEventStub() - } - if specificReturn { - return ret.result1, ret.result2, ret.result3 - } - fakeReturns := fake.registerFilteredBlockEventReturns - return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 -} - -func (fake *Event) RegisterFilteredBlockEventCallCount() int { - fake.registerFilteredBlockEventMutex.RLock() - defer fake.registerFilteredBlockEventMutex.RUnlock() - return len(fake.registerFilteredBlockEventArgsForCall) -} - -func (fake *Event) RegisterFilteredBlockEventCalls(stub func() (fab.Registration, <-chan *fab.FilteredBlockEvent, error)) { - fake.registerFilteredBlockEventMutex.Lock() - defer fake.registerFilteredBlockEventMutex.Unlock() - fake.RegisterFilteredBlockEventStub = stub -} - -func (fake *Event) RegisterFilteredBlockEventReturns(result1 fab.Registration, result2 <-chan *fab.FilteredBlockEvent, result3 error) { - fake.registerFilteredBlockEventMutex.Lock() - defer fake.registerFilteredBlockEventMutex.Unlock() - fake.RegisterFilteredBlockEventStub = nil - fake.registerFilteredBlockEventReturns = struct { - result1 fab.Registration - result2 <-chan *fab.FilteredBlockEvent - result3 error - }{result1, result2, result3} -} - -func (fake *Event) RegisterFilteredBlockEventReturnsOnCall(i int, result1 fab.Registration, result2 <-chan *fab.FilteredBlockEvent, result3 error) { - fake.registerFilteredBlockEventMutex.Lock() - defer fake.registerFilteredBlockEventMutex.Unlock() - fake.RegisterFilteredBlockEventStub = nil - if fake.registerFilteredBlockEventReturnsOnCall == nil { - fake.registerFilteredBlockEventReturnsOnCall = make(map[int]struct { - result1 fab.Registration - result2 <-chan *fab.FilteredBlockEvent - result3 error - }) - } - fake.registerFilteredBlockEventReturnsOnCall[i] = struct { - result1 fab.Registration - result2 <-chan *fab.FilteredBlockEvent - result3 error - }{result1, result2, result3} -} - -func (fake *Event) RegisterTxStatusEvent(arg1 string) (fab.Registration, <-chan *fab.TxStatusEvent, error) { - fake.registerTxStatusEventMutex.Lock() - ret, specificReturn := fake.registerTxStatusEventReturnsOnCall[len(fake.registerTxStatusEventArgsForCall)] - fake.registerTxStatusEventArgsForCall = append(fake.registerTxStatusEventArgsForCall, struct { - arg1 string - }{arg1}) - fake.recordInvocation("RegisterTxStatusEvent", []interface{}{arg1}) - fake.registerTxStatusEventMutex.Unlock() - if fake.RegisterTxStatusEventStub != nil { - return fake.RegisterTxStatusEventStub(arg1) - } - if specificReturn { - return ret.result1, ret.result2, ret.result3 - } - fakeReturns := fake.registerTxStatusEventReturns - return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 -} - -func (fake *Event) RegisterTxStatusEventCallCount() int { - fake.registerTxStatusEventMutex.RLock() - defer fake.registerTxStatusEventMutex.RUnlock() - return len(fake.registerTxStatusEventArgsForCall) -} - -func (fake *Event) RegisterTxStatusEventCalls(stub func(string) (fab.Registration, <-chan *fab.TxStatusEvent, error)) { - fake.registerTxStatusEventMutex.Lock() - defer fake.registerTxStatusEventMutex.Unlock() - fake.RegisterTxStatusEventStub = stub -} - -func (fake *Event) RegisterTxStatusEventArgsForCall(i int) string { - fake.registerTxStatusEventMutex.RLock() - defer fake.registerTxStatusEventMutex.RUnlock() - argsForCall := fake.registerTxStatusEventArgsForCall[i] - return argsForCall.arg1 -} - -func (fake *Event) RegisterTxStatusEventReturns(result1 fab.Registration, result2 <-chan *fab.TxStatusEvent, result3 error) { - fake.registerTxStatusEventMutex.Lock() - defer fake.registerTxStatusEventMutex.Unlock() - fake.RegisterTxStatusEventStub = nil - fake.registerTxStatusEventReturns = struct { - result1 fab.Registration - result2 <-chan *fab.TxStatusEvent - result3 error - }{result1, result2, result3} -} - -func (fake *Event) RegisterTxStatusEventReturnsOnCall(i int, result1 fab.Registration, result2 <-chan *fab.TxStatusEvent, result3 error) { - fake.registerTxStatusEventMutex.Lock() - defer fake.registerTxStatusEventMutex.Unlock() - fake.RegisterTxStatusEventStub = nil - if fake.registerTxStatusEventReturnsOnCall == nil { - fake.registerTxStatusEventReturnsOnCall = make(map[int]struct { - result1 fab.Registration - result2 <-chan *fab.TxStatusEvent - result3 error - }) - } - fake.registerTxStatusEventReturnsOnCall[i] = struct { - result1 fab.Registration - result2 <-chan *fab.TxStatusEvent - result3 error - }{result1, result2, result3} -} - -func (fake *Event) Unregister(arg1 fab.Registration) { - fake.unregisterMutex.Lock() - fake.unregisterArgsForCall = append(fake.unregisterArgsForCall, struct { - arg1 fab.Registration - }{arg1}) - fake.recordInvocation("Unregister", []interface{}{arg1}) - fake.unregisterMutex.Unlock() - if fake.UnregisterStub != nil { - fake.UnregisterStub(arg1) - } -} - -func (fake *Event) UnregisterCallCount() int { - fake.unregisterMutex.RLock() - defer fake.unregisterMutex.RUnlock() - return len(fake.unregisterArgsForCall) -} - -func (fake *Event) UnregisterCalls(stub func(fab.Registration)) { - fake.unregisterMutex.Lock() - defer fake.unregisterMutex.Unlock() - fake.UnregisterStub = stub -} - -func (fake *Event) UnregisterArgsForCall(i int) fab.Registration { - fake.unregisterMutex.RLock() - defer fake.unregisterMutex.RUnlock() - argsForCall := fake.unregisterArgsForCall[i] - return argsForCall.arg1 -} - -func (fake *Event) Invocations() map[string][][]interface{} { - fake.invocationsMutex.RLock() - defer fake.invocationsMutex.RUnlock() - fake.registerBlockEventMutex.RLock() - defer fake.registerBlockEventMutex.RUnlock() - fake.registerChaincodeEventMutex.RLock() - defer fake.registerChaincodeEventMutex.RUnlock() - fake.registerFilteredBlockEventMutex.RLock() - defer fake.registerFilteredBlockEventMutex.RUnlock() - fake.registerTxStatusEventMutex.RLock() - defer fake.registerTxStatusEventMutex.RUnlock() - fake.unregisterMutex.RLock() - defer fake.unregisterMutex.RUnlock() - copiedInvocations := map[string][][]interface{}{} - for key, value := range fake.invocations { - copiedInvocations[key] = value - } - return copiedInvocations -} - -func (fake *Event) recordInvocation(key string, args []interface{}) { - fake.invocationsMutex.Lock() - defer fake.invocationsMutex.Unlock() - if fake.invocations == nil { - fake.invocations = map[string][][]interface{}{} - } - if fake.invocations[key] == nil { - fake.invocations[key] = [][]interface{}{} - } - fake.invocations[key] = append(fake.invocations[key], args) -} - -var _ fabric.Event = new(Event) diff --git a/pkg/fabric/mocks/factory.go b/pkg/fabric/mocks/factory.go deleted file mode 100644 index 76c39c8..0000000 --- a/pkg/fabric/mocks/factory.go +++ /dev/null @@ -1,451 +0,0 @@ -// Code generated by counterfeiter. DO NOT EDIT. -package mocks - -import ( - "sync" - - "github.com/hyperledger/fabric-cli/pkg/fabric" -) - -type Factory struct { - ChannelStub func() (fabric.Channel, error) - channelMutex sync.RWMutex - channelArgsForCall []struct { - } - channelReturns struct { - result1 fabric.Channel - result2 error - } - channelReturnsOnCall map[int]struct { - result1 fabric.Channel - result2 error - } - EventStub func() (fabric.Event, error) - eventMutex sync.RWMutex - eventArgsForCall []struct { - } - eventReturns struct { - result1 fabric.Event - result2 error - } - eventReturnsOnCall map[int]struct { - result1 fabric.Event - result2 error - } - LedgerStub func() (fabric.Ledger, error) - ledgerMutex sync.RWMutex - ledgerArgsForCall []struct { - } - ledgerReturns struct { - result1 fabric.Ledger - result2 error - } - ledgerReturnsOnCall map[int]struct { - result1 fabric.Ledger - result2 error - } - MSPStub func() (fabric.MSP, error) - mSPMutex sync.RWMutex - mSPArgsForCall []struct { - } - mSPReturns struct { - result1 fabric.MSP - result2 error - } - mSPReturnsOnCall map[int]struct { - result1 fabric.MSP - result2 error - } - ResourceManagementStub func() (fabric.ResourceManagement, error) - resourceManagementMutex sync.RWMutex - resourceManagementArgsForCall []struct { - } - resourceManagementReturns struct { - result1 fabric.ResourceManagement - result2 error - } - resourceManagementReturnsOnCall map[int]struct { - result1 fabric.ResourceManagement - result2 error - } - SDKStub func() (fabric.SDK, error) - sDKMutex sync.RWMutex - sDKArgsForCall []struct { - } - sDKReturns struct { - result1 fabric.SDK - result2 error - } - sDKReturnsOnCall map[int]struct { - result1 fabric.SDK - result2 error - } - invocations map[string][][]interface{} - invocationsMutex sync.RWMutex -} - -func (fake *Factory) Channel() (fabric.Channel, error) { - fake.channelMutex.Lock() - ret, specificReturn := fake.channelReturnsOnCall[len(fake.channelArgsForCall)] - fake.channelArgsForCall = append(fake.channelArgsForCall, struct { - }{}) - fake.recordInvocation("Channel", []interface{}{}) - fake.channelMutex.Unlock() - if fake.ChannelStub != nil { - return fake.ChannelStub() - } - if specificReturn { - return ret.result1, ret.result2 - } - fakeReturns := fake.channelReturns - return fakeReturns.result1, fakeReturns.result2 -} - -func (fake *Factory) ChannelCallCount() int { - fake.channelMutex.RLock() - defer fake.channelMutex.RUnlock() - return len(fake.channelArgsForCall) -} - -func (fake *Factory) ChannelCalls(stub func() (fabric.Channel, error)) { - fake.channelMutex.Lock() - defer fake.channelMutex.Unlock() - fake.ChannelStub = stub -} - -func (fake *Factory) ChannelReturns(result1 fabric.Channel, result2 error) { - fake.channelMutex.Lock() - defer fake.channelMutex.Unlock() - fake.ChannelStub = nil - fake.channelReturns = struct { - result1 fabric.Channel - result2 error - }{result1, result2} -} - -func (fake *Factory) ChannelReturnsOnCall(i int, result1 fabric.Channel, result2 error) { - fake.channelMutex.Lock() - defer fake.channelMutex.Unlock() - fake.ChannelStub = nil - if fake.channelReturnsOnCall == nil { - fake.channelReturnsOnCall = make(map[int]struct { - result1 fabric.Channel - result2 error - }) - } - fake.channelReturnsOnCall[i] = struct { - result1 fabric.Channel - result2 error - }{result1, result2} -} - -func (fake *Factory) Event() (fabric.Event, error) { - fake.eventMutex.Lock() - ret, specificReturn := fake.eventReturnsOnCall[len(fake.eventArgsForCall)] - fake.eventArgsForCall = append(fake.eventArgsForCall, struct { - }{}) - fake.recordInvocation("Event", []interface{}{}) - fake.eventMutex.Unlock() - if fake.EventStub != nil { - return fake.EventStub() - } - if specificReturn { - return ret.result1, ret.result2 - } - fakeReturns := fake.eventReturns - return fakeReturns.result1, fakeReturns.result2 -} - -func (fake *Factory) EventCallCount() int { - fake.eventMutex.RLock() - defer fake.eventMutex.RUnlock() - return len(fake.eventArgsForCall) -} - -func (fake *Factory) EventCalls(stub func() (fabric.Event, error)) { - fake.eventMutex.Lock() - defer fake.eventMutex.Unlock() - fake.EventStub = stub -} - -func (fake *Factory) EventReturns(result1 fabric.Event, result2 error) { - fake.eventMutex.Lock() - defer fake.eventMutex.Unlock() - fake.EventStub = nil - fake.eventReturns = struct { - result1 fabric.Event - result2 error - }{result1, result2} -} - -func (fake *Factory) EventReturnsOnCall(i int, result1 fabric.Event, result2 error) { - fake.eventMutex.Lock() - defer fake.eventMutex.Unlock() - fake.EventStub = nil - if fake.eventReturnsOnCall == nil { - fake.eventReturnsOnCall = make(map[int]struct { - result1 fabric.Event - result2 error - }) - } - fake.eventReturnsOnCall[i] = struct { - result1 fabric.Event - result2 error - }{result1, result2} -} - -func (fake *Factory) Ledger() (fabric.Ledger, error) { - fake.ledgerMutex.Lock() - ret, specificReturn := fake.ledgerReturnsOnCall[len(fake.ledgerArgsForCall)] - fake.ledgerArgsForCall = append(fake.ledgerArgsForCall, struct { - }{}) - fake.recordInvocation("Ledger", []interface{}{}) - fake.ledgerMutex.Unlock() - if fake.LedgerStub != nil { - return fake.LedgerStub() - } - if specificReturn { - return ret.result1, ret.result2 - } - fakeReturns := fake.ledgerReturns - return fakeReturns.result1, fakeReturns.result2 -} - -func (fake *Factory) LedgerCallCount() int { - fake.ledgerMutex.RLock() - defer fake.ledgerMutex.RUnlock() - return len(fake.ledgerArgsForCall) -} - -func (fake *Factory) LedgerCalls(stub func() (fabric.Ledger, error)) { - fake.ledgerMutex.Lock() - defer fake.ledgerMutex.Unlock() - fake.LedgerStub = stub -} - -func (fake *Factory) LedgerReturns(result1 fabric.Ledger, result2 error) { - fake.ledgerMutex.Lock() - defer fake.ledgerMutex.Unlock() - fake.LedgerStub = nil - fake.ledgerReturns = struct { - result1 fabric.Ledger - result2 error - }{result1, result2} -} - -func (fake *Factory) LedgerReturnsOnCall(i int, result1 fabric.Ledger, result2 error) { - fake.ledgerMutex.Lock() - defer fake.ledgerMutex.Unlock() - fake.LedgerStub = nil - if fake.ledgerReturnsOnCall == nil { - fake.ledgerReturnsOnCall = make(map[int]struct { - result1 fabric.Ledger - result2 error - }) - } - fake.ledgerReturnsOnCall[i] = struct { - result1 fabric.Ledger - result2 error - }{result1, result2} -} - -func (fake *Factory) MSP() (fabric.MSP, error) { - fake.mSPMutex.Lock() - ret, specificReturn := fake.mSPReturnsOnCall[len(fake.mSPArgsForCall)] - fake.mSPArgsForCall = append(fake.mSPArgsForCall, struct { - }{}) - fake.recordInvocation("MSP", []interface{}{}) - fake.mSPMutex.Unlock() - if fake.MSPStub != nil { - return fake.MSPStub() - } - if specificReturn { - return ret.result1, ret.result2 - } - fakeReturns := fake.mSPReturns - return fakeReturns.result1, fakeReturns.result2 -} - -func (fake *Factory) MSPCallCount() int { - fake.mSPMutex.RLock() - defer fake.mSPMutex.RUnlock() - return len(fake.mSPArgsForCall) -} - -func (fake *Factory) MSPCalls(stub func() (fabric.MSP, error)) { - fake.mSPMutex.Lock() - defer fake.mSPMutex.Unlock() - fake.MSPStub = stub -} - -func (fake *Factory) MSPReturns(result1 fabric.MSP, result2 error) { - fake.mSPMutex.Lock() - defer fake.mSPMutex.Unlock() - fake.MSPStub = nil - fake.mSPReturns = struct { - result1 fabric.MSP - result2 error - }{result1, result2} -} - -func (fake *Factory) MSPReturnsOnCall(i int, result1 fabric.MSP, result2 error) { - fake.mSPMutex.Lock() - defer fake.mSPMutex.Unlock() - fake.MSPStub = nil - if fake.mSPReturnsOnCall == nil { - fake.mSPReturnsOnCall = make(map[int]struct { - result1 fabric.MSP - result2 error - }) - } - fake.mSPReturnsOnCall[i] = struct { - result1 fabric.MSP - result2 error - }{result1, result2} -} - -func (fake *Factory) ResourceManagement() (fabric.ResourceManagement, error) { - fake.resourceManagementMutex.Lock() - ret, specificReturn := fake.resourceManagementReturnsOnCall[len(fake.resourceManagementArgsForCall)] - fake.resourceManagementArgsForCall = append(fake.resourceManagementArgsForCall, struct { - }{}) - fake.recordInvocation("ResourceManagement", []interface{}{}) - fake.resourceManagementMutex.Unlock() - if fake.ResourceManagementStub != nil { - return fake.ResourceManagementStub() - } - if specificReturn { - return ret.result1, ret.result2 - } - fakeReturns := fake.resourceManagementReturns - return fakeReturns.result1, fakeReturns.result2 -} - -func (fake *Factory) ResourceManagementCallCount() int { - fake.resourceManagementMutex.RLock() - defer fake.resourceManagementMutex.RUnlock() - return len(fake.resourceManagementArgsForCall) -} - -func (fake *Factory) ResourceManagementCalls(stub func() (fabric.ResourceManagement, error)) { - fake.resourceManagementMutex.Lock() - defer fake.resourceManagementMutex.Unlock() - fake.ResourceManagementStub = stub -} - -func (fake *Factory) ResourceManagementReturns(result1 fabric.ResourceManagement, result2 error) { - fake.resourceManagementMutex.Lock() - defer fake.resourceManagementMutex.Unlock() - fake.ResourceManagementStub = nil - fake.resourceManagementReturns = struct { - result1 fabric.ResourceManagement - result2 error - }{result1, result2} -} - -func (fake *Factory) ResourceManagementReturnsOnCall(i int, result1 fabric.ResourceManagement, result2 error) { - fake.resourceManagementMutex.Lock() - defer fake.resourceManagementMutex.Unlock() - fake.ResourceManagementStub = nil - if fake.resourceManagementReturnsOnCall == nil { - fake.resourceManagementReturnsOnCall = make(map[int]struct { - result1 fabric.ResourceManagement - result2 error - }) - } - fake.resourceManagementReturnsOnCall[i] = struct { - result1 fabric.ResourceManagement - result2 error - }{result1, result2} -} - -func (fake *Factory) SDK() (fabric.SDK, error) { - fake.sDKMutex.Lock() - ret, specificReturn := fake.sDKReturnsOnCall[len(fake.sDKArgsForCall)] - fake.sDKArgsForCall = append(fake.sDKArgsForCall, struct { - }{}) - fake.recordInvocation("SDK", []interface{}{}) - fake.sDKMutex.Unlock() - if fake.SDKStub != nil { - return fake.SDKStub() - } - if specificReturn { - return ret.result1, ret.result2 - } - fakeReturns := fake.sDKReturns - return fakeReturns.result1, fakeReturns.result2 -} - -func (fake *Factory) SDKCallCount() int { - fake.sDKMutex.RLock() - defer fake.sDKMutex.RUnlock() - return len(fake.sDKArgsForCall) -} - -func (fake *Factory) SDKCalls(stub func() (fabric.SDK, error)) { - fake.sDKMutex.Lock() - defer fake.sDKMutex.Unlock() - fake.SDKStub = stub -} - -func (fake *Factory) SDKReturns(result1 fabric.SDK, result2 error) { - fake.sDKMutex.Lock() - defer fake.sDKMutex.Unlock() - fake.SDKStub = nil - fake.sDKReturns = struct { - result1 fabric.SDK - result2 error - }{result1, result2} -} - -func (fake *Factory) SDKReturnsOnCall(i int, result1 fabric.SDK, result2 error) { - fake.sDKMutex.Lock() - defer fake.sDKMutex.Unlock() - fake.SDKStub = nil - if fake.sDKReturnsOnCall == nil { - fake.sDKReturnsOnCall = make(map[int]struct { - result1 fabric.SDK - result2 error - }) - } - fake.sDKReturnsOnCall[i] = struct { - result1 fabric.SDK - result2 error - }{result1, result2} -} - -func (fake *Factory) Invocations() map[string][][]interface{} { - fake.invocationsMutex.RLock() - defer fake.invocationsMutex.RUnlock() - fake.channelMutex.RLock() - defer fake.channelMutex.RUnlock() - fake.eventMutex.RLock() - defer fake.eventMutex.RUnlock() - fake.ledgerMutex.RLock() - defer fake.ledgerMutex.RUnlock() - fake.mSPMutex.RLock() - defer fake.mSPMutex.RUnlock() - fake.resourceManagementMutex.RLock() - defer fake.resourceManagementMutex.RUnlock() - fake.sDKMutex.RLock() - defer fake.sDKMutex.RUnlock() - copiedInvocations := map[string][][]interface{}{} - for key, value := range fake.invocations { - copiedInvocations[key] = value - } - return copiedInvocations -} - -func (fake *Factory) recordInvocation(key string, args []interface{}) { - fake.invocationsMutex.Lock() - defer fake.invocationsMutex.Unlock() - if fake.invocations == nil { - fake.invocations = map[string][][]interface{}{} - } - if fake.invocations[key] == nil { - fake.invocations[key] = [][]interface{}{} - } - fake.invocations[key] = append(fake.invocations[key], args) -} - -var _ fabric.Factory = new(Factory) diff --git a/pkg/fabric/mocks/ledger.go b/pkg/fabric/mocks/ledger.go deleted file mode 100644 index 56e3d28..0000000 --- a/pkg/fabric/mocks/ledger.go +++ /dev/null @@ -1,522 +0,0 @@ -// Code generated by counterfeiter. DO NOT EDIT. -package mocks - -import ( - "sync" - - "github.com/hyperledger/fabric-cli/pkg/fabric" - "github.com/hyperledger/fabric-protos-go/common" - "github.com/hyperledger/fabric-protos-go/peer" - "github.com/hyperledger/fabric-sdk-go/pkg/client/ledger" - "github.com/hyperledger/fabric-sdk-go/pkg/common/providers/fab" -) - -type Ledger struct { - QueryBlockStub func(uint64, ...ledger.RequestOption) (*common.Block, error) - queryBlockMutex sync.RWMutex - queryBlockArgsForCall []struct { - arg1 uint64 - arg2 []ledger.RequestOption - } - queryBlockReturns struct { - result1 *common.Block - result2 error - } - queryBlockReturnsOnCall map[int]struct { - result1 *common.Block - result2 error - } - QueryBlockByHashStub func([]byte, ...ledger.RequestOption) (*common.Block, error) - queryBlockByHashMutex sync.RWMutex - queryBlockByHashArgsForCall []struct { - arg1 []byte - arg2 []ledger.RequestOption - } - queryBlockByHashReturns struct { - result1 *common.Block - result2 error - } - queryBlockByHashReturnsOnCall map[int]struct { - result1 *common.Block - result2 error - } - QueryBlockByTxIDStub func(fab.TransactionID, ...ledger.RequestOption) (*common.Block, error) - queryBlockByTxIDMutex sync.RWMutex - queryBlockByTxIDArgsForCall []struct { - arg1 fab.TransactionID - arg2 []ledger.RequestOption - } - queryBlockByTxIDReturns struct { - result1 *common.Block - result2 error - } - queryBlockByTxIDReturnsOnCall map[int]struct { - result1 *common.Block - result2 error - } - QueryConfigStub func(...ledger.RequestOption) (fab.ChannelCfg, error) - queryConfigMutex sync.RWMutex - queryConfigArgsForCall []struct { - arg1 []ledger.RequestOption - } - queryConfigReturns struct { - result1 fab.ChannelCfg - result2 error - } - queryConfigReturnsOnCall map[int]struct { - result1 fab.ChannelCfg - result2 error - } - QueryInfoStub func(...ledger.RequestOption) (*fab.BlockchainInfoResponse, error) - queryInfoMutex sync.RWMutex - queryInfoArgsForCall []struct { - arg1 []ledger.RequestOption - } - queryInfoReturns struct { - result1 *fab.BlockchainInfoResponse - result2 error - } - queryInfoReturnsOnCall map[int]struct { - result1 *fab.BlockchainInfoResponse - result2 error - } - QueryTransactionStub func(fab.TransactionID, ...ledger.RequestOption) (*peer.ProcessedTransaction, error) - queryTransactionMutex sync.RWMutex - queryTransactionArgsForCall []struct { - arg1 fab.TransactionID - arg2 []ledger.RequestOption - } - queryTransactionReturns struct { - result1 *peer.ProcessedTransaction - result2 error - } - queryTransactionReturnsOnCall map[int]struct { - result1 *peer.ProcessedTransaction - result2 error - } - invocations map[string][][]interface{} - invocationsMutex sync.RWMutex -} - -func (fake *Ledger) QueryBlock(arg1 uint64, arg2 ...ledger.RequestOption) (*common.Block, error) { - fake.queryBlockMutex.Lock() - ret, specificReturn := fake.queryBlockReturnsOnCall[len(fake.queryBlockArgsForCall)] - fake.queryBlockArgsForCall = append(fake.queryBlockArgsForCall, struct { - arg1 uint64 - arg2 []ledger.RequestOption - }{arg1, arg2}) - fake.recordInvocation("QueryBlock", []interface{}{arg1, arg2}) - fake.queryBlockMutex.Unlock() - if fake.QueryBlockStub != nil { - return fake.QueryBlockStub(arg1, arg2...) - } - if specificReturn { - return ret.result1, ret.result2 - } - fakeReturns := fake.queryBlockReturns - return fakeReturns.result1, fakeReturns.result2 -} - -func (fake *Ledger) QueryBlockCallCount() int { - fake.queryBlockMutex.RLock() - defer fake.queryBlockMutex.RUnlock() - return len(fake.queryBlockArgsForCall) -} - -func (fake *Ledger) QueryBlockCalls(stub func(uint64, ...ledger.RequestOption) (*common.Block, error)) { - fake.queryBlockMutex.Lock() - defer fake.queryBlockMutex.Unlock() - fake.QueryBlockStub = stub -} - -func (fake *Ledger) QueryBlockArgsForCall(i int) (uint64, []ledger.RequestOption) { - fake.queryBlockMutex.RLock() - defer fake.queryBlockMutex.RUnlock() - argsForCall := fake.queryBlockArgsForCall[i] - return argsForCall.arg1, argsForCall.arg2 -} - -func (fake *Ledger) QueryBlockReturns(result1 *common.Block, result2 error) { - fake.queryBlockMutex.Lock() - defer fake.queryBlockMutex.Unlock() - fake.QueryBlockStub = nil - fake.queryBlockReturns = struct { - result1 *common.Block - result2 error - }{result1, result2} -} - -func (fake *Ledger) QueryBlockReturnsOnCall(i int, result1 *common.Block, result2 error) { - fake.queryBlockMutex.Lock() - defer fake.queryBlockMutex.Unlock() - fake.QueryBlockStub = nil - if fake.queryBlockReturnsOnCall == nil { - fake.queryBlockReturnsOnCall = make(map[int]struct { - result1 *common.Block - result2 error - }) - } - fake.queryBlockReturnsOnCall[i] = struct { - result1 *common.Block - result2 error - }{result1, result2} -} - -func (fake *Ledger) QueryBlockByHash(arg1 []byte, arg2 ...ledger.RequestOption) (*common.Block, error) { - var arg1Copy []byte - if arg1 != nil { - arg1Copy = make([]byte, len(arg1)) - copy(arg1Copy, arg1) - } - fake.queryBlockByHashMutex.Lock() - ret, specificReturn := fake.queryBlockByHashReturnsOnCall[len(fake.queryBlockByHashArgsForCall)] - fake.queryBlockByHashArgsForCall = append(fake.queryBlockByHashArgsForCall, struct { - arg1 []byte - arg2 []ledger.RequestOption - }{arg1Copy, arg2}) - fake.recordInvocation("QueryBlockByHash", []interface{}{arg1Copy, arg2}) - fake.queryBlockByHashMutex.Unlock() - if fake.QueryBlockByHashStub != nil { - return fake.QueryBlockByHashStub(arg1, arg2...) - } - if specificReturn { - return ret.result1, ret.result2 - } - fakeReturns := fake.queryBlockByHashReturns - return fakeReturns.result1, fakeReturns.result2 -} - -func (fake *Ledger) QueryBlockByHashCallCount() int { - fake.queryBlockByHashMutex.RLock() - defer fake.queryBlockByHashMutex.RUnlock() - return len(fake.queryBlockByHashArgsForCall) -} - -func (fake *Ledger) QueryBlockByHashCalls(stub func([]byte, ...ledger.RequestOption) (*common.Block, error)) { - fake.queryBlockByHashMutex.Lock() - defer fake.queryBlockByHashMutex.Unlock() - fake.QueryBlockByHashStub = stub -} - -func (fake *Ledger) QueryBlockByHashArgsForCall(i int) ([]byte, []ledger.RequestOption) { - fake.queryBlockByHashMutex.RLock() - defer fake.queryBlockByHashMutex.RUnlock() - argsForCall := fake.queryBlockByHashArgsForCall[i] - return argsForCall.arg1, argsForCall.arg2 -} - -func (fake *Ledger) QueryBlockByHashReturns(result1 *common.Block, result2 error) { - fake.queryBlockByHashMutex.Lock() - defer fake.queryBlockByHashMutex.Unlock() - fake.QueryBlockByHashStub = nil - fake.queryBlockByHashReturns = struct { - result1 *common.Block - result2 error - }{result1, result2} -} - -func (fake *Ledger) QueryBlockByHashReturnsOnCall(i int, result1 *common.Block, result2 error) { - fake.queryBlockByHashMutex.Lock() - defer fake.queryBlockByHashMutex.Unlock() - fake.QueryBlockByHashStub = nil - if fake.queryBlockByHashReturnsOnCall == nil { - fake.queryBlockByHashReturnsOnCall = make(map[int]struct { - result1 *common.Block - result2 error - }) - } - fake.queryBlockByHashReturnsOnCall[i] = struct { - result1 *common.Block - result2 error - }{result1, result2} -} - -func (fake *Ledger) QueryBlockByTxID(arg1 fab.TransactionID, arg2 ...ledger.RequestOption) (*common.Block, error) { - fake.queryBlockByTxIDMutex.Lock() - ret, specificReturn := fake.queryBlockByTxIDReturnsOnCall[len(fake.queryBlockByTxIDArgsForCall)] - fake.queryBlockByTxIDArgsForCall = append(fake.queryBlockByTxIDArgsForCall, struct { - arg1 fab.TransactionID - arg2 []ledger.RequestOption - }{arg1, arg2}) - fake.recordInvocation("QueryBlockByTxID", []interface{}{arg1, arg2}) - fake.queryBlockByTxIDMutex.Unlock() - if fake.QueryBlockByTxIDStub != nil { - return fake.QueryBlockByTxIDStub(arg1, arg2...) - } - if specificReturn { - return ret.result1, ret.result2 - } - fakeReturns := fake.queryBlockByTxIDReturns - return fakeReturns.result1, fakeReturns.result2 -} - -func (fake *Ledger) QueryBlockByTxIDCallCount() int { - fake.queryBlockByTxIDMutex.RLock() - defer fake.queryBlockByTxIDMutex.RUnlock() - return len(fake.queryBlockByTxIDArgsForCall) -} - -func (fake *Ledger) QueryBlockByTxIDCalls(stub func(fab.TransactionID, ...ledger.RequestOption) (*common.Block, error)) { - fake.queryBlockByTxIDMutex.Lock() - defer fake.queryBlockByTxIDMutex.Unlock() - fake.QueryBlockByTxIDStub = stub -} - -func (fake *Ledger) QueryBlockByTxIDArgsForCall(i int) (fab.TransactionID, []ledger.RequestOption) { - fake.queryBlockByTxIDMutex.RLock() - defer fake.queryBlockByTxIDMutex.RUnlock() - argsForCall := fake.queryBlockByTxIDArgsForCall[i] - return argsForCall.arg1, argsForCall.arg2 -} - -func (fake *Ledger) QueryBlockByTxIDReturns(result1 *common.Block, result2 error) { - fake.queryBlockByTxIDMutex.Lock() - defer fake.queryBlockByTxIDMutex.Unlock() - fake.QueryBlockByTxIDStub = nil - fake.queryBlockByTxIDReturns = struct { - result1 *common.Block - result2 error - }{result1, result2} -} - -func (fake *Ledger) QueryBlockByTxIDReturnsOnCall(i int, result1 *common.Block, result2 error) { - fake.queryBlockByTxIDMutex.Lock() - defer fake.queryBlockByTxIDMutex.Unlock() - fake.QueryBlockByTxIDStub = nil - if fake.queryBlockByTxIDReturnsOnCall == nil { - fake.queryBlockByTxIDReturnsOnCall = make(map[int]struct { - result1 *common.Block - result2 error - }) - } - fake.queryBlockByTxIDReturnsOnCall[i] = struct { - result1 *common.Block - result2 error - }{result1, result2} -} - -func (fake *Ledger) QueryConfig(arg1 ...ledger.RequestOption) (fab.ChannelCfg, error) { - fake.queryConfigMutex.Lock() - ret, specificReturn := fake.queryConfigReturnsOnCall[len(fake.queryConfigArgsForCall)] - fake.queryConfigArgsForCall = append(fake.queryConfigArgsForCall, struct { - arg1 []ledger.RequestOption - }{arg1}) - fake.recordInvocation("QueryConfig", []interface{}{arg1}) - fake.queryConfigMutex.Unlock() - if fake.QueryConfigStub != nil { - return fake.QueryConfigStub(arg1...) - } - if specificReturn { - return ret.result1, ret.result2 - } - fakeReturns := fake.queryConfigReturns - return fakeReturns.result1, fakeReturns.result2 -} - -func (fake *Ledger) QueryConfigCallCount() int { - fake.queryConfigMutex.RLock() - defer fake.queryConfigMutex.RUnlock() - return len(fake.queryConfigArgsForCall) -} - -func (fake *Ledger) QueryConfigCalls(stub func(...ledger.RequestOption) (fab.ChannelCfg, error)) { - fake.queryConfigMutex.Lock() - defer fake.queryConfigMutex.Unlock() - fake.QueryConfigStub = stub -} - -func (fake *Ledger) QueryConfigArgsForCall(i int) []ledger.RequestOption { - fake.queryConfigMutex.RLock() - defer fake.queryConfigMutex.RUnlock() - argsForCall := fake.queryConfigArgsForCall[i] - return argsForCall.arg1 -} - -func (fake *Ledger) QueryConfigReturns(result1 fab.ChannelCfg, result2 error) { - fake.queryConfigMutex.Lock() - defer fake.queryConfigMutex.Unlock() - fake.QueryConfigStub = nil - fake.queryConfigReturns = struct { - result1 fab.ChannelCfg - result2 error - }{result1, result2} -} - -func (fake *Ledger) QueryConfigReturnsOnCall(i int, result1 fab.ChannelCfg, result2 error) { - fake.queryConfigMutex.Lock() - defer fake.queryConfigMutex.Unlock() - fake.QueryConfigStub = nil - if fake.queryConfigReturnsOnCall == nil { - fake.queryConfigReturnsOnCall = make(map[int]struct { - result1 fab.ChannelCfg - result2 error - }) - } - fake.queryConfigReturnsOnCall[i] = struct { - result1 fab.ChannelCfg - result2 error - }{result1, result2} -} - -func (fake *Ledger) QueryInfo(arg1 ...ledger.RequestOption) (*fab.BlockchainInfoResponse, error) { - fake.queryInfoMutex.Lock() - ret, specificReturn := fake.queryInfoReturnsOnCall[len(fake.queryInfoArgsForCall)] - fake.queryInfoArgsForCall = append(fake.queryInfoArgsForCall, struct { - arg1 []ledger.RequestOption - }{arg1}) - fake.recordInvocation("QueryInfo", []interface{}{arg1}) - fake.queryInfoMutex.Unlock() - if fake.QueryInfoStub != nil { - return fake.QueryInfoStub(arg1...) - } - if specificReturn { - return ret.result1, ret.result2 - } - fakeReturns := fake.queryInfoReturns - return fakeReturns.result1, fakeReturns.result2 -} - -func (fake *Ledger) QueryInfoCallCount() int { - fake.queryInfoMutex.RLock() - defer fake.queryInfoMutex.RUnlock() - return len(fake.queryInfoArgsForCall) -} - -func (fake *Ledger) QueryInfoCalls(stub func(...ledger.RequestOption) (*fab.BlockchainInfoResponse, error)) { - fake.queryInfoMutex.Lock() - defer fake.queryInfoMutex.Unlock() - fake.QueryInfoStub = stub -} - -func (fake *Ledger) QueryInfoArgsForCall(i int) []ledger.RequestOption { - fake.queryInfoMutex.RLock() - defer fake.queryInfoMutex.RUnlock() - argsForCall := fake.queryInfoArgsForCall[i] - return argsForCall.arg1 -} - -func (fake *Ledger) QueryInfoReturns(result1 *fab.BlockchainInfoResponse, result2 error) { - fake.queryInfoMutex.Lock() - defer fake.queryInfoMutex.Unlock() - fake.QueryInfoStub = nil - fake.queryInfoReturns = struct { - result1 *fab.BlockchainInfoResponse - result2 error - }{result1, result2} -} - -func (fake *Ledger) QueryInfoReturnsOnCall(i int, result1 *fab.BlockchainInfoResponse, result2 error) { - fake.queryInfoMutex.Lock() - defer fake.queryInfoMutex.Unlock() - fake.QueryInfoStub = nil - if fake.queryInfoReturnsOnCall == nil { - fake.queryInfoReturnsOnCall = make(map[int]struct { - result1 *fab.BlockchainInfoResponse - result2 error - }) - } - fake.queryInfoReturnsOnCall[i] = struct { - result1 *fab.BlockchainInfoResponse - result2 error - }{result1, result2} -} - -func (fake *Ledger) QueryTransaction(arg1 fab.TransactionID, arg2 ...ledger.RequestOption) (*peer.ProcessedTransaction, error) { - fake.queryTransactionMutex.Lock() - ret, specificReturn := fake.queryTransactionReturnsOnCall[len(fake.queryTransactionArgsForCall)] - fake.queryTransactionArgsForCall = append(fake.queryTransactionArgsForCall, struct { - arg1 fab.TransactionID - arg2 []ledger.RequestOption - }{arg1, arg2}) - fake.recordInvocation("QueryTransaction", []interface{}{arg1, arg2}) - fake.queryTransactionMutex.Unlock() - if fake.QueryTransactionStub != nil { - return fake.QueryTransactionStub(arg1, arg2...) - } - if specificReturn { - return ret.result1, ret.result2 - } - fakeReturns := fake.queryTransactionReturns - return fakeReturns.result1, fakeReturns.result2 -} - -func (fake *Ledger) QueryTransactionCallCount() int { - fake.queryTransactionMutex.RLock() - defer fake.queryTransactionMutex.RUnlock() - return len(fake.queryTransactionArgsForCall) -} - -func (fake *Ledger) QueryTransactionCalls(stub func(fab.TransactionID, ...ledger.RequestOption) (*peer.ProcessedTransaction, error)) { - fake.queryTransactionMutex.Lock() - defer fake.queryTransactionMutex.Unlock() - fake.QueryTransactionStub = stub -} - -func (fake *Ledger) QueryTransactionArgsForCall(i int) (fab.TransactionID, []ledger.RequestOption) { - fake.queryTransactionMutex.RLock() - defer fake.queryTransactionMutex.RUnlock() - argsForCall := fake.queryTransactionArgsForCall[i] - return argsForCall.arg1, argsForCall.arg2 -} - -func (fake *Ledger) QueryTransactionReturns(result1 *peer.ProcessedTransaction, result2 error) { - fake.queryTransactionMutex.Lock() - defer fake.queryTransactionMutex.Unlock() - fake.QueryTransactionStub = nil - fake.queryTransactionReturns = struct { - result1 *peer.ProcessedTransaction - result2 error - }{result1, result2} -} - -func (fake *Ledger) QueryTransactionReturnsOnCall(i int, result1 *peer.ProcessedTransaction, result2 error) { - fake.queryTransactionMutex.Lock() - defer fake.queryTransactionMutex.Unlock() - fake.QueryTransactionStub = nil - if fake.queryTransactionReturnsOnCall == nil { - fake.queryTransactionReturnsOnCall = make(map[int]struct { - result1 *peer.ProcessedTransaction - result2 error - }) - } - fake.queryTransactionReturnsOnCall[i] = struct { - result1 *peer.ProcessedTransaction - result2 error - }{result1, result2} -} - -func (fake *Ledger) Invocations() map[string][][]interface{} { - fake.invocationsMutex.RLock() - defer fake.invocationsMutex.RUnlock() - fake.queryBlockMutex.RLock() - defer fake.queryBlockMutex.RUnlock() - fake.queryBlockByHashMutex.RLock() - defer fake.queryBlockByHashMutex.RUnlock() - fake.queryBlockByTxIDMutex.RLock() - defer fake.queryBlockByTxIDMutex.RUnlock() - fake.queryConfigMutex.RLock() - defer fake.queryConfigMutex.RUnlock() - fake.queryInfoMutex.RLock() - defer fake.queryInfoMutex.RUnlock() - fake.queryTransactionMutex.RLock() - defer fake.queryTransactionMutex.RUnlock() - copiedInvocations := map[string][][]interface{}{} - for key, value := range fake.invocations { - copiedInvocations[key] = value - } - return copiedInvocations -} - -func (fake *Ledger) recordInvocation(key string, args []interface{}) { - fake.invocationsMutex.Lock() - defer fake.invocationsMutex.Unlock() - if fake.invocations == nil { - fake.invocations = map[string][][]interface{}{} - } - if fake.invocations[key] == nil { - fake.invocations[key] = [][]interface{}{} - } - fake.invocations[key] = append(fake.invocations[key], args) -} - -var _ fabric.Ledger = new(Ledger) diff --git a/pkg/fabric/mocks/msp.go b/pkg/fabric/mocks/msp.go deleted file mode 100644 index 2fdcbb3..0000000 --- a/pkg/fabric/mocks/msp.go +++ /dev/null @@ -1,1354 +0,0 @@ -// Code generated by counterfeiter. DO NOT EDIT. -package mocks - -import ( - "sync" - - "github.com/hyperledger/fabric-cli/pkg/fabric" - "github.com/hyperledger/fabric-sdk-go/pkg/client/msp" - mspa "github.com/hyperledger/fabric-sdk-go/pkg/common/providers/msp" -) - -type MSP struct { - AddAffiliationStub func(*msp.AffiliationRequest) (*msp.AffiliationResponse, error) - addAffiliationMutex sync.RWMutex - addAffiliationArgsForCall []struct { - arg1 *msp.AffiliationRequest - } - addAffiliationReturns struct { - result1 *msp.AffiliationResponse - result2 error - } - addAffiliationReturnsOnCall map[int]struct { - result1 *msp.AffiliationResponse - result2 error - } - CreateIdentityStub func(*msp.IdentityRequest) (*msp.IdentityResponse, error) - createIdentityMutex sync.RWMutex - createIdentityArgsForCall []struct { - arg1 *msp.IdentityRequest - } - createIdentityReturns struct { - result1 *msp.IdentityResponse - result2 error - } - createIdentityReturnsOnCall map[int]struct { - result1 *msp.IdentityResponse - result2 error - } - CreateSigningIdentityStub func(...mspa.SigningIdentityOption) (mspa.SigningIdentity, error) - createSigningIdentityMutex sync.RWMutex - createSigningIdentityArgsForCall []struct { - arg1 []mspa.SigningIdentityOption - } - createSigningIdentityReturns struct { - result1 mspa.SigningIdentity - result2 error - } - createSigningIdentityReturnsOnCall map[int]struct { - result1 mspa.SigningIdentity - result2 error - } - EnrollStub func(string, ...msp.EnrollmentOption) error - enrollMutex sync.RWMutex - enrollArgsForCall []struct { - arg1 string - arg2 []msp.EnrollmentOption - } - enrollReturns struct { - result1 error - } - enrollReturnsOnCall map[int]struct { - result1 error - } - GetAffiliationStub func(string, ...msp.RequestOption) (*msp.AffiliationResponse, error) - getAffiliationMutex sync.RWMutex - getAffiliationArgsForCall []struct { - arg1 string - arg2 []msp.RequestOption - } - getAffiliationReturns struct { - result1 *msp.AffiliationResponse - result2 error - } - getAffiliationReturnsOnCall map[int]struct { - result1 *msp.AffiliationResponse - result2 error - } - GetAllAffiliationsStub func(...msp.RequestOption) (*msp.AffiliationResponse, error) - getAllAffiliationsMutex sync.RWMutex - getAllAffiliationsArgsForCall []struct { - arg1 []msp.RequestOption - } - getAllAffiliationsReturns struct { - result1 *msp.AffiliationResponse - result2 error - } - getAllAffiliationsReturnsOnCall map[int]struct { - result1 *msp.AffiliationResponse - result2 error - } - GetAllIdentitiesStub func(...msp.RequestOption) ([]*msp.IdentityResponse, error) - getAllIdentitiesMutex sync.RWMutex - getAllIdentitiesArgsForCall []struct { - arg1 []msp.RequestOption - } - getAllIdentitiesReturns struct { - result1 []*msp.IdentityResponse - result2 error - } - getAllIdentitiesReturnsOnCall map[int]struct { - result1 []*msp.IdentityResponse - result2 error - } - GetCAInfoStub func() (*msp.GetCAInfoResponse, error) - getCAInfoMutex sync.RWMutex - getCAInfoArgsForCall []struct { - } - getCAInfoReturns struct { - result1 *msp.GetCAInfoResponse - result2 error - } - getCAInfoReturnsOnCall map[int]struct { - result1 *msp.GetCAInfoResponse - result2 error - } - GetIdentityStub func(string, ...msp.RequestOption) (*msp.IdentityResponse, error) - getIdentityMutex sync.RWMutex - getIdentityArgsForCall []struct { - arg1 string - arg2 []msp.RequestOption - } - getIdentityReturns struct { - result1 *msp.IdentityResponse - result2 error - } - getIdentityReturnsOnCall map[int]struct { - result1 *msp.IdentityResponse - result2 error - } - GetSigningIdentityStub func(string) (mspa.SigningIdentity, error) - getSigningIdentityMutex sync.RWMutex - getSigningIdentityArgsForCall []struct { - arg1 string - } - getSigningIdentityReturns struct { - result1 mspa.SigningIdentity - result2 error - } - getSigningIdentityReturnsOnCall map[int]struct { - result1 mspa.SigningIdentity - result2 error - } - ModifyAffiliationStub func(*msp.ModifyAffiliationRequest) (*msp.AffiliationResponse, error) - modifyAffiliationMutex sync.RWMutex - modifyAffiliationArgsForCall []struct { - arg1 *msp.ModifyAffiliationRequest - } - modifyAffiliationReturns struct { - result1 *msp.AffiliationResponse - result2 error - } - modifyAffiliationReturnsOnCall map[int]struct { - result1 *msp.AffiliationResponse - result2 error - } - ModifyIdentityStub func(*msp.IdentityRequest) (*msp.IdentityResponse, error) - modifyIdentityMutex sync.RWMutex - modifyIdentityArgsForCall []struct { - arg1 *msp.IdentityRequest - } - modifyIdentityReturns struct { - result1 *msp.IdentityResponse - result2 error - } - modifyIdentityReturnsOnCall map[int]struct { - result1 *msp.IdentityResponse - result2 error - } - ReenrollStub func(string, ...msp.EnrollmentOption) error - reenrollMutex sync.RWMutex - reenrollArgsForCall []struct { - arg1 string - arg2 []msp.EnrollmentOption - } - reenrollReturns struct { - result1 error - } - reenrollReturnsOnCall map[int]struct { - result1 error - } - RegisterStub func(*msp.RegistrationRequest) (string, error) - registerMutex sync.RWMutex - registerArgsForCall []struct { - arg1 *msp.RegistrationRequest - } - registerReturns struct { - result1 string - result2 error - } - registerReturnsOnCall map[int]struct { - result1 string - result2 error - } - RemoveAffiliationStub func(*msp.AffiliationRequest) (*msp.AffiliationResponse, error) - removeAffiliationMutex sync.RWMutex - removeAffiliationArgsForCall []struct { - arg1 *msp.AffiliationRequest - } - removeAffiliationReturns struct { - result1 *msp.AffiliationResponse - result2 error - } - removeAffiliationReturnsOnCall map[int]struct { - result1 *msp.AffiliationResponse - result2 error - } - RemoveIdentityStub func(*msp.RemoveIdentityRequest) (*msp.IdentityResponse, error) - removeIdentityMutex sync.RWMutex - removeIdentityArgsForCall []struct { - arg1 *msp.RemoveIdentityRequest - } - removeIdentityReturns struct { - result1 *msp.IdentityResponse - result2 error - } - removeIdentityReturnsOnCall map[int]struct { - result1 *msp.IdentityResponse - result2 error - } - RevokeStub func(*msp.RevocationRequest) (*msp.RevocationResponse, error) - revokeMutex sync.RWMutex - revokeArgsForCall []struct { - arg1 *msp.RevocationRequest - } - revokeReturns struct { - result1 *msp.RevocationResponse - result2 error - } - revokeReturnsOnCall map[int]struct { - result1 *msp.RevocationResponse - result2 error - } - invocations map[string][][]interface{} - invocationsMutex sync.RWMutex -} - -func (fake *MSP) AddAffiliation(arg1 *msp.AffiliationRequest) (*msp.AffiliationResponse, error) { - fake.addAffiliationMutex.Lock() - ret, specificReturn := fake.addAffiliationReturnsOnCall[len(fake.addAffiliationArgsForCall)] - fake.addAffiliationArgsForCall = append(fake.addAffiliationArgsForCall, struct { - arg1 *msp.AffiliationRequest - }{arg1}) - fake.recordInvocation("AddAffiliation", []interface{}{arg1}) - fake.addAffiliationMutex.Unlock() - if fake.AddAffiliationStub != nil { - return fake.AddAffiliationStub(arg1) - } - if specificReturn { - return ret.result1, ret.result2 - } - fakeReturns := fake.addAffiliationReturns - return fakeReturns.result1, fakeReturns.result2 -} - -func (fake *MSP) AddAffiliationCallCount() int { - fake.addAffiliationMutex.RLock() - defer fake.addAffiliationMutex.RUnlock() - return len(fake.addAffiliationArgsForCall) -} - -func (fake *MSP) AddAffiliationCalls(stub func(*msp.AffiliationRequest) (*msp.AffiliationResponse, error)) { - fake.addAffiliationMutex.Lock() - defer fake.addAffiliationMutex.Unlock() - fake.AddAffiliationStub = stub -} - -func (fake *MSP) AddAffiliationArgsForCall(i int) *msp.AffiliationRequest { - fake.addAffiliationMutex.RLock() - defer fake.addAffiliationMutex.RUnlock() - argsForCall := fake.addAffiliationArgsForCall[i] - return argsForCall.arg1 -} - -func (fake *MSP) AddAffiliationReturns(result1 *msp.AffiliationResponse, result2 error) { - fake.addAffiliationMutex.Lock() - defer fake.addAffiliationMutex.Unlock() - fake.AddAffiliationStub = nil - fake.addAffiliationReturns = struct { - result1 *msp.AffiliationResponse - result2 error - }{result1, result2} -} - -func (fake *MSP) AddAffiliationReturnsOnCall(i int, result1 *msp.AffiliationResponse, result2 error) { - fake.addAffiliationMutex.Lock() - defer fake.addAffiliationMutex.Unlock() - fake.AddAffiliationStub = nil - if fake.addAffiliationReturnsOnCall == nil { - fake.addAffiliationReturnsOnCall = make(map[int]struct { - result1 *msp.AffiliationResponse - result2 error - }) - } - fake.addAffiliationReturnsOnCall[i] = struct { - result1 *msp.AffiliationResponse - result2 error - }{result1, result2} -} - -func (fake *MSP) CreateIdentity(arg1 *msp.IdentityRequest) (*msp.IdentityResponse, error) { - fake.createIdentityMutex.Lock() - ret, specificReturn := fake.createIdentityReturnsOnCall[len(fake.createIdentityArgsForCall)] - fake.createIdentityArgsForCall = append(fake.createIdentityArgsForCall, struct { - arg1 *msp.IdentityRequest - }{arg1}) - fake.recordInvocation("CreateIdentity", []interface{}{arg1}) - fake.createIdentityMutex.Unlock() - if fake.CreateIdentityStub != nil { - return fake.CreateIdentityStub(arg1) - } - if specificReturn { - return ret.result1, ret.result2 - } - fakeReturns := fake.createIdentityReturns - return fakeReturns.result1, fakeReturns.result2 -} - -func (fake *MSP) CreateIdentityCallCount() int { - fake.createIdentityMutex.RLock() - defer fake.createIdentityMutex.RUnlock() - return len(fake.createIdentityArgsForCall) -} - -func (fake *MSP) CreateIdentityCalls(stub func(*msp.IdentityRequest) (*msp.IdentityResponse, error)) { - fake.createIdentityMutex.Lock() - defer fake.createIdentityMutex.Unlock() - fake.CreateIdentityStub = stub -} - -func (fake *MSP) CreateIdentityArgsForCall(i int) *msp.IdentityRequest { - fake.createIdentityMutex.RLock() - defer fake.createIdentityMutex.RUnlock() - argsForCall := fake.createIdentityArgsForCall[i] - return argsForCall.arg1 -} - -func (fake *MSP) CreateIdentityReturns(result1 *msp.IdentityResponse, result2 error) { - fake.createIdentityMutex.Lock() - defer fake.createIdentityMutex.Unlock() - fake.CreateIdentityStub = nil - fake.createIdentityReturns = struct { - result1 *msp.IdentityResponse - result2 error - }{result1, result2} -} - -func (fake *MSP) CreateIdentityReturnsOnCall(i int, result1 *msp.IdentityResponse, result2 error) { - fake.createIdentityMutex.Lock() - defer fake.createIdentityMutex.Unlock() - fake.CreateIdentityStub = nil - if fake.createIdentityReturnsOnCall == nil { - fake.createIdentityReturnsOnCall = make(map[int]struct { - result1 *msp.IdentityResponse - result2 error - }) - } - fake.createIdentityReturnsOnCall[i] = struct { - result1 *msp.IdentityResponse - result2 error - }{result1, result2} -} - -func (fake *MSP) CreateSigningIdentity(arg1 ...mspa.SigningIdentityOption) (mspa.SigningIdentity, error) { - fake.createSigningIdentityMutex.Lock() - ret, specificReturn := fake.createSigningIdentityReturnsOnCall[len(fake.createSigningIdentityArgsForCall)] - fake.createSigningIdentityArgsForCall = append(fake.createSigningIdentityArgsForCall, struct { - arg1 []mspa.SigningIdentityOption - }{arg1}) - fake.recordInvocation("CreateSigningIdentity", []interface{}{arg1}) - fake.createSigningIdentityMutex.Unlock() - if fake.CreateSigningIdentityStub != nil { - return fake.CreateSigningIdentityStub(arg1...) - } - if specificReturn { - return ret.result1, ret.result2 - } - fakeReturns := fake.createSigningIdentityReturns - return fakeReturns.result1, fakeReturns.result2 -} - -func (fake *MSP) CreateSigningIdentityCallCount() int { - fake.createSigningIdentityMutex.RLock() - defer fake.createSigningIdentityMutex.RUnlock() - return len(fake.createSigningIdentityArgsForCall) -} - -func (fake *MSP) CreateSigningIdentityCalls(stub func(...mspa.SigningIdentityOption) (mspa.SigningIdentity, error)) { - fake.createSigningIdentityMutex.Lock() - defer fake.createSigningIdentityMutex.Unlock() - fake.CreateSigningIdentityStub = stub -} - -func (fake *MSP) CreateSigningIdentityArgsForCall(i int) []mspa.SigningIdentityOption { - fake.createSigningIdentityMutex.RLock() - defer fake.createSigningIdentityMutex.RUnlock() - argsForCall := fake.createSigningIdentityArgsForCall[i] - return argsForCall.arg1 -} - -func (fake *MSP) CreateSigningIdentityReturns(result1 mspa.SigningIdentity, result2 error) { - fake.createSigningIdentityMutex.Lock() - defer fake.createSigningIdentityMutex.Unlock() - fake.CreateSigningIdentityStub = nil - fake.createSigningIdentityReturns = struct { - result1 mspa.SigningIdentity - result2 error - }{result1, result2} -} - -func (fake *MSP) CreateSigningIdentityReturnsOnCall(i int, result1 mspa.SigningIdentity, result2 error) { - fake.createSigningIdentityMutex.Lock() - defer fake.createSigningIdentityMutex.Unlock() - fake.CreateSigningIdentityStub = nil - if fake.createSigningIdentityReturnsOnCall == nil { - fake.createSigningIdentityReturnsOnCall = make(map[int]struct { - result1 mspa.SigningIdentity - result2 error - }) - } - fake.createSigningIdentityReturnsOnCall[i] = struct { - result1 mspa.SigningIdentity - result2 error - }{result1, result2} -} - -func (fake *MSP) Enroll(arg1 string, arg2 ...msp.EnrollmentOption) error { - fake.enrollMutex.Lock() - ret, specificReturn := fake.enrollReturnsOnCall[len(fake.enrollArgsForCall)] - fake.enrollArgsForCall = append(fake.enrollArgsForCall, struct { - arg1 string - arg2 []msp.EnrollmentOption - }{arg1, arg2}) - fake.recordInvocation("Enroll", []interface{}{arg1, arg2}) - fake.enrollMutex.Unlock() - if fake.EnrollStub != nil { - return fake.EnrollStub(arg1, arg2...) - } - if specificReturn { - return ret.result1 - } - fakeReturns := fake.enrollReturns - return fakeReturns.result1 -} - -func (fake *MSP) EnrollCallCount() int { - fake.enrollMutex.RLock() - defer fake.enrollMutex.RUnlock() - return len(fake.enrollArgsForCall) -} - -func (fake *MSP) EnrollCalls(stub func(string, ...msp.EnrollmentOption) error) { - fake.enrollMutex.Lock() - defer fake.enrollMutex.Unlock() - fake.EnrollStub = stub -} - -func (fake *MSP) EnrollArgsForCall(i int) (string, []msp.EnrollmentOption) { - fake.enrollMutex.RLock() - defer fake.enrollMutex.RUnlock() - argsForCall := fake.enrollArgsForCall[i] - return argsForCall.arg1, argsForCall.arg2 -} - -func (fake *MSP) EnrollReturns(result1 error) { - fake.enrollMutex.Lock() - defer fake.enrollMutex.Unlock() - fake.EnrollStub = nil - fake.enrollReturns = struct { - result1 error - }{result1} -} - -func (fake *MSP) EnrollReturnsOnCall(i int, result1 error) { - fake.enrollMutex.Lock() - defer fake.enrollMutex.Unlock() - fake.EnrollStub = nil - if fake.enrollReturnsOnCall == nil { - fake.enrollReturnsOnCall = make(map[int]struct { - result1 error - }) - } - fake.enrollReturnsOnCall[i] = struct { - result1 error - }{result1} -} - -func (fake *MSP) GetAffiliation(arg1 string, arg2 ...msp.RequestOption) (*msp.AffiliationResponse, error) { - fake.getAffiliationMutex.Lock() - ret, specificReturn := fake.getAffiliationReturnsOnCall[len(fake.getAffiliationArgsForCall)] - fake.getAffiliationArgsForCall = append(fake.getAffiliationArgsForCall, struct { - arg1 string - arg2 []msp.RequestOption - }{arg1, arg2}) - fake.recordInvocation("GetAffiliation", []interface{}{arg1, arg2}) - fake.getAffiliationMutex.Unlock() - if fake.GetAffiliationStub != nil { - return fake.GetAffiliationStub(arg1, arg2...) - } - if specificReturn { - return ret.result1, ret.result2 - } - fakeReturns := fake.getAffiliationReturns - return fakeReturns.result1, fakeReturns.result2 -} - -func (fake *MSP) GetAffiliationCallCount() int { - fake.getAffiliationMutex.RLock() - defer fake.getAffiliationMutex.RUnlock() - return len(fake.getAffiliationArgsForCall) -} - -func (fake *MSP) GetAffiliationCalls(stub func(string, ...msp.RequestOption) (*msp.AffiliationResponse, error)) { - fake.getAffiliationMutex.Lock() - defer fake.getAffiliationMutex.Unlock() - fake.GetAffiliationStub = stub -} - -func (fake *MSP) GetAffiliationArgsForCall(i int) (string, []msp.RequestOption) { - fake.getAffiliationMutex.RLock() - defer fake.getAffiliationMutex.RUnlock() - argsForCall := fake.getAffiliationArgsForCall[i] - return argsForCall.arg1, argsForCall.arg2 -} - -func (fake *MSP) GetAffiliationReturns(result1 *msp.AffiliationResponse, result2 error) { - fake.getAffiliationMutex.Lock() - defer fake.getAffiliationMutex.Unlock() - fake.GetAffiliationStub = nil - fake.getAffiliationReturns = struct { - result1 *msp.AffiliationResponse - result2 error - }{result1, result2} -} - -func (fake *MSP) GetAffiliationReturnsOnCall(i int, result1 *msp.AffiliationResponse, result2 error) { - fake.getAffiliationMutex.Lock() - defer fake.getAffiliationMutex.Unlock() - fake.GetAffiliationStub = nil - if fake.getAffiliationReturnsOnCall == nil { - fake.getAffiliationReturnsOnCall = make(map[int]struct { - result1 *msp.AffiliationResponse - result2 error - }) - } - fake.getAffiliationReturnsOnCall[i] = struct { - result1 *msp.AffiliationResponse - result2 error - }{result1, result2} -} - -func (fake *MSP) GetAllAffiliations(arg1 ...msp.RequestOption) (*msp.AffiliationResponse, error) { - fake.getAllAffiliationsMutex.Lock() - ret, specificReturn := fake.getAllAffiliationsReturnsOnCall[len(fake.getAllAffiliationsArgsForCall)] - fake.getAllAffiliationsArgsForCall = append(fake.getAllAffiliationsArgsForCall, struct { - arg1 []msp.RequestOption - }{arg1}) - fake.recordInvocation("GetAllAffiliations", []interface{}{arg1}) - fake.getAllAffiliationsMutex.Unlock() - if fake.GetAllAffiliationsStub != nil { - return fake.GetAllAffiliationsStub(arg1...) - } - if specificReturn { - return ret.result1, ret.result2 - } - fakeReturns := fake.getAllAffiliationsReturns - return fakeReturns.result1, fakeReturns.result2 -} - -func (fake *MSP) GetAllAffiliationsCallCount() int { - fake.getAllAffiliationsMutex.RLock() - defer fake.getAllAffiliationsMutex.RUnlock() - return len(fake.getAllAffiliationsArgsForCall) -} - -func (fake *MSP) GetAllAffiliationsCalls(stub func(...msp.RequestOption) (*msp.AffiliationResponse, error)) { - fake.getAllAffiliationsMutex.Lock() - defer fake.getAllAffiliationsMutex.Unlock() - fake.GetAllAffiliationsStub = stub -} - -func (fake *MSP) GetAllAffiliationsArgsForCall(i int) []msp.RequestOption { - fake.getAllAffiliationsMutex.RLock() - defer fake.getAllAffiliationsMutex.RUnlock() - argsForCall := fake.getAllAffiliationsArgsForCall[i] - return argsForCall.arg1 -} - -func (fake *MSP) GetAllAffiliationsReturns(result1 *msp.AffiliationResponse, result2 error) { - fake.getAllAffiliationsMutex.Lock() - defer fake.getAllAffiliationsMutex.Unlock() - fake.GetAllAffiliationsStub = nil - fake.getAllAffiliationsReturns = struct { - result1 *msp.AffiliationResponse - result2 error - }{result1, result2} -} - -func (fake *MSP) GetAllAffiliationsReturnsOnCall(i int, result1 *msp.AffiliationResponse, result2 error) { - fake.getAllAffiliationsMutex.Lock() - defer fake.getAllAffiliationsMutex.Unlock() - fake.GetAllAffiliationsStub = nil - if fake.getAllAffiliationsReturnsOnCall == nil { - fake.getAllAffiliationsReturnsOnCall = make(map[int]struct { - result1 *msp.AffiliationResponse - result2 error - }) - } - fake.getAllAffiliationsReturnsOnCall[i] = struct { - result1 *msp.AffiliationResponse - result2 error - }{result1, result2} -} - -func (fake *MSP) GetAllIdentities(arg1 ...msp.RequestOption) ([]*msp.IdentityResponse, error) { - fake.getAllIdentitiesMutex.Lock() - ret, specificReturn := fake.getAllIdentitiesReturnsOnCall[len(fake.getAllIdentitiesArgsForCall)] - fake.getAllIdentitiesArgsForCall = append(fake.getAllIdentitiesArgsForCall, struct { - arg1 []msp.RequestOption - }{arg1}) - fake.recordInvocation("GetAllIdentities", []interface{}{arg1}) - fake.getAllIdentitiesMutex.Unlock() - if fake.GetAllIdentitiesStub != nil { - return fake.GetAllIdentitiesStub(arg1...) - } - if specificReturn { - return ret.result1, ret.result2 - } - fakeReturns := fake.getAllIdentitiesReturns - return fakeReturns.result1, fakeReturns.result2 -} - -func (fake *MSP) GetAllIdentitiesCallCount() int { - fake.getAllIdentitiesMutex.RLock() - defer fake.getAllIdentitiesMutex.RUnlock() - return len(fake.getAllIdentitiesArgsForCall) -} - -func (fake *MSP) GetAllIdentitiesCalls(stub func(...msp.RequestOption) ([]*msp.IdentityResponse, error)) { - fake.getAllIdentitiesMutex.Lock() - defer fake.getAllIdentitiesMutex.Unlock() - fake.GetAllIdentitiesStub = stub -} - -func (fake *MSP) GetAllIdentitiesArgsForCall(i int) []msp.RequestOption { - fake.getAllIdentitiesMutex.RLock() - defer fake.getAllIdentitiesMutex.RUnlock() - argsForCall := fake.getAllIdentitiesArgsForCall[i] - return argsForCall.arg1 -} - -func (fake *MSP) GetAllIdentitiesReturns(result1 []*msp.IdentityResponse, result2 error) { - fake.getAllIdentitiesMutex.Lock() - defer fake.getAllIdentitiesMutex.Unlock() - fake.GetAllIdentitiesStub = nil - fake.getAllIdentitiesReturns = struct { - result1 []*msp.IdentityResponse - result2 error - }{result1, result2} -} - -func (fake *MSP) GetAllIdentitiesReturnsOnCall(i int, result1 []*msp.IdentityResponse, result2 error) { - fake.getAllIdentitiesMutex.Lock() - defer fake.getAllIdentitiesMutex.Unlock() - fake.GetAllIdentitiesStub = nil - if fake.getAllIdentitiesReturnsOnCall == nil { - fake.getAllIdentitiesReturnsOnCall = make(map[int]struct { - result1 []*msp.IdentityResponse - result2 error - }) - } - fake.getAllIdentitiesReturnsOnCall[i] = struct { - result1 []*msp.IdentityResponse - result2 error - }{result1, result2} -} - -func (fake *MSP) GetCAInfo() (*msp.GetCAInfoResponse, error) { - fake.getCAInfoMutex.Lock() - ret, specificReturn := fake.getCAInfoReturnsOnCall[len(fake.getCAInfoArgsForCall)] - fake.getCAInfoArgsForCall = append(fake.getCAInfoArgsForCall, struct { - }{}) - fake.recordInvocation("GetCAInfo", []interface{}{}) - fake.getCAInfoMutex.Unlock() - if fake.GetCAInfoStub != nil { - return fake.GetCAInfoStub() - } - if specificReturn { - return ret.result1, ret.result2 - } - fakeReturns := fake.getCAInfoReturns - return fakeReturns.result1, fakeReturns.result2 -} - -func (fake *MSP) GetCAInfoCallCount() int { - fake.getCAInfoMutex.RLock() - defer fake.getCAInfoMutex.RUnlock() - return len(fake.getCAInfoArgsForCall) -} - -func (fake *MSP) GetCAInfoCalls(stub func() (*msp.GetCAInfoResponse, error)) { - fake.getCAInfoMutex.Lock() - defer fake.getCAInfoMutex.Unlock() - fake.GetCAInfoStub = stub -} - -func (fake *MSP) GetCAInfoReturns(result1 *msp.GetCAInfoResponse, result2 error) { - fake.getCAInfoMutex.Lock() - defer fake.getCAInfoMutex.Unlock() - fake.GetCAInfoStub = nil - fake.getCAInfoReturns = struct { - result1 *msp.GetCAInfoResponse - result2 error - }{result1, result2} -} - -func (fake *MSP) GetCAInfoReturnsOnCall(i int, result1 *msp.GetCAInfoResponse, result2 error) { - fake.getCAInfoMutex.Lock() - defer fake.getCAInfoMutex.Unlock() - fake.GetCAInfoStub = nil - if fake.getCAInfoReturnsOnCall == nil { - fake.getCAInfoReturnsOnCall = make(map[int]struct { - result1 *msp.GetCAInfoResponse - result2 error - }) - } - fake.getCAInfoReturnsOnCall[i] = struct { - result1 *msp.GetCAInfoResponse - result2 error - }{result1, result2} -} - -func (fake *MSP) GetIdentity(arg1 string, arg2 ...msp.RequestOption) (*msp.IdentityResponse, error) { - fake.getIdentityMutex.Lock() - ret, specificReturn := fake.getIdentityReturnsOnCall[len(fake.getIdentityArgsForCall)] - fake.getIdentityArgsForCall = append(fake.getIdentityArgsForCall, struct { - arg1 string - arg2 []msp.RequestOption - }{arg1, arg2}) - fake.recordInvocation("GetIdentity", []interface{}{arg1, arg2}) - fake.getIdentityMutex.Unlock() - if fake.GetIdentityStub != nil { - return fake.GetIdentityStub(arg1, arg2...) - } - if specificReturn { - return ret.result1, ret.result2 - } - fakeReturns := fake.getIdentityReturns - return fakeReturns.result1, fakeReturns.result2 -} - -func (fake *MSP) GetIdentityCallCount() int { - fake.getIdentityMutex.RLock() - defer fake.getIdentityMutex.RUnlock() - return len(fake.getIdentityArgsForCall) -} - -func (fake *MSP) GetIdentityCalls(stub func(string, ...msp.RequestOption) (*msp.IdentityResponse, error)) { - fake.getIdentityMutex.Lock() - defer fake.getIdentityMutex.Unlock() - fake.GetIdentityStub = stub -} - -func (fake *MSP) GetIdentityArgsForCall(i int) (string, []msp.RequestOption) { - fake.getIdentityMutex.RLock() - defer fake.getIdentityMutex.RUnlock() - argsForCall := fake.getIdentityArgsForCall[i] - return argsForCall.arg1, argsForCall.arg2 -} - -func (fake *MSP) GetIdentityReturns(result1 *msp.IdentityResponse, result2 error) { - fake.getIdentityMutex.Lock() - defer fake.getIdentityMutex.Unlock() - fake.GetIdentityStub = nil - fake.getIdentityReturns = struct { - result1 *msp.IdentityResponse - result2 error - }{result1, result2} -} - -func (fake *MSP) GetIdentityReturnsOnCall(i int, result1 *msp.IdentityResponse, result2 error) { - fake.getIdentityMutex.Lock() - defer fake.getIdentityMutex.Unlock() - fake.GetIdentityStub = nil - if fake.getIdentityReturnsOnCall == nil { - fake.getIdentityReturnsOnCall = make(map[int]struct { - result1 *msp.IdentityResponse - result2 error - }) - } - fake.getIdentityReturnsOnCall[i] = struct { - result1 *msp.IdentityResponse - result2 error - }{result1, result2} -} - -func (fake *MSP) GetSigningIdentity(arg1 string) (mspa.SigningIdentity, error) { - fake.getSigningIdentityMutex.Lock() - ret, specificReturn := fake.getSigningIdentityReturnsOnCall[len(fake.getSigningIdentityArgsForCall)] - fake.getSigningIdentityArgsForCall = append(fake.getSigningIdentityArgsForCall, struct { - arg1 string - }{arg1}) - fake.recordInvocation("GetSigningIdentity", []interface{}{arg1}) - fake.getSigningIdentityMutex.Unlock() - if fake.GetSigningIdentityStub != nil { - return fake.GetSigningIdentityStub(arg1) - } - if specificReturn { - return ret.result1, ret.result2 - } - fakeReturns := fake.getSigningIdentityReturns - return fakeReturns.result1, fakeReturns.result2 -} - -func (fake *MSP) GetSigningIdentityCallCount() int { - fake.getSigningIdentityMutex.RLock() - defer fake.getSigningIdentityMutex.RUnlock() - return len(fake.getSigningIdentityArgsForCall) -} - -func (fake *MSP) GetSigningIdentityCalls(stub func(string) (mspa.SigningIdentity, error)) { - fake.getSigningIdentityMutex.Lock() - defer fake.getSigningIdentityMutex.Unlock() - fake.GetSigningIdentityStub = stub -} - -func (fake *MSP) GetSigningIdentityArgsForCall(i int) string { - fake.getSigningIdentityMutex.RLock() - defer fake.getSigningIdentityMutex.RUnlock() - argsForCall := fake.getSigningIdentityArgsForCall[i] - return argsForCall.arg1 -} - -func (fake *MSP) GetSigningIdentityReturns(result1 mspa.SigningIdentity, result2 error) { - fake.getSigningIdentityMutex.Lock() - defer fake.getSigningIdentityMutex.Unlock() - fake.GetSigningIdentityStub = nil - fake.getSigningIdentityReturns = struct { - result1 mspa.SigningIdentity - result2 error - }{result1, result2} -} - -func (fake *MSP) GetSigningIdentityReturnsOnCall(i int, result1 mspa.SigningIdentity, result2 error) { - fake.getSigningIdentityMutex.Lock() - defer fake.getSigningIdentityMutex.Unlock() - fake.GetSigningIdentityStub = nil - if fake.getSigningIdentityReturnsOnCall == nil { - fake.getSigningIdentityReturnsOnCall = make(map[int]struct { - result1 mspa.SigningIdentity - result2 error - }) - } - fake.getSigningIdentityReturnsOnCall[i] = struct { - result1 mspa.SigningIdentity - result2 error - }{result1, result2} -} - -func (fake *MSP) ModifyAffiliation(arg1 *msp.ModifyAffiliationRequest) (*msp.AffiliationResponse, error) { - fake.modifyAffiliationMutex.Lock() - ret, specificReturn := fake.modifyAffiliationReturnsOnCall[len(fake.modifyAffiliationArgsForCall)] - fake.modifyAffiliationArgsForCall = append(fake.modifyAffiliationArgsForCall, struct { - arg1 *msp.ModifyAffiliationRequest - }{arg1}) - fake.recordInvocation("ModifyAffiliation", []interface{}{arg1}) - fake.modifyAffiliationMutex.Unlock() - if fake.ModifyAffiliationStub != nil { - return fake.ModifyAffiliationStub(arg1) - } - if specificReturn { - return ret.result1, ret.result2 - } - fakeReturns := fake.modifyAffiliationReturns - return fakeReturns.result1, fakeReturns.result2 -} - -func (fake *MSP) ModifyAffiliationCallCount() int { - fake.modifyAffiliationMutex.RLock() - defer fake.modifyAffiliationMutex.RUnlock() - return len(fake.modifyAffiliationArgsForCall) -} - -func (fake *MSP) ModifyAffiliationCalls(stub func(*msp.ModifyAffiliationRequest) (*msp.AffiliationResponse, error)) { - fake.modifyAffiliationMutex.Lock() - defer fake.modifyAffiliationMutex.Unlock() - fake.ModifyAffiliationStub = stub -} - -func (fake *MSP) ModifyAffiliationArgsForCall(i int) *msp.ModifyAffiliationRequest { - fake.modifyAffiliationMutex.RLock() - defer fake.modifyAffiliationMutex.RUnlock() - argsForCall := fake.modifyAffiliationArgsForCall[i] - return argsForCall.arg1 -} - -func (fake *MSP) ModifyAffiliationReturns(result1 *msp.AffiliationResponse, result2 error) { - fake.modifyAffiliationMutex.Lock() - defer fake.modifyAffiliationMutex.Unlock() - fake.ModifyAffiliationStub = nil - fake.modifyAffiliationReturns = struct { - result1 *msp.AffiliationResponse - result2 error - }{result1, result2} -} - -func (fake *MSP) ModifyAffiliationReturnsOnCall(i int, result1 *msp.AffiliationResponse, result2 error) { - fake.modifyAffiliationMutex.Lock() - defer fake.modifyAffiliationMutex.Unlock() - fake.ModifyAffiliationStub = nil - if fake.modifyAffiliationReturnsOnCall == nil { - fake.modifyAffiliationReturnsOnCall = make(map[int]struct { - result1 *msp.AffiliationResponse - result2 error - }) - } - fake.modifyAffiliationReturnsOnCall[i] = struct { - result1 *msp.AffiliationResponse - result2 error - }{result1, result2} -} - -func (fake *MSP) ModifyIdentity(arg1 *msp.IdentityRequest) (*msp.IdentityResponse, error) { - fake.modifyIdentityMutex.Lock() - ret, specificReturn := fake.modifyIdentityReturnsOnCall[len(fake.modifyIdentityArgsForCall)] - fake.modifyIdentityArgsForCall = append(fake.modifyIdentityArgsForCall, struct { - arg1 *msp.IdentityRequest - }{arg1}) - fake.recordInvocation("ModifyIdentity", []interface{}{arg1}) - fake.modifyIdentityMutex.Unlock() - if fake.ModifyIdentityStub != nil { - return fake.ModifyIdentityStub(arg1) - } - if specificReturn { - return ret.result1, ret.result2 - } - fakeReturns := fake.modifyIdentityReturns - return fakeReturns.result1, fakeReturns.result2 -} - -func (fake *MSP) ModifyIdentityCallCount() int { - fake.modifyIdentityMutex.RLock() - defer fake.modifyIdentityMutex.RUnlock() - return len(fake.modifyIdentityArgsForCall) -} - -func (fake *MSP) ModifyIdentityCalls(stub func(*msp.IdentityRequest) (*msp.IdentityResponse, error)) { - fake.modifyIdentityMutex.Lock() - defer fake.modifyIdentityMutex.Unlock() - fake.ModifyIdentityStub = stub -} - -func (fake *MSP) ModifyIdentityArgsForCall(i int) *msp.IdentityRequest { - fake.modifyIdentityMutex.RLock() - defer fake.modifyIdentityMutex.RUnlock() - argsForCall := fake.modifyIdentityArgsForCall[i] - return argsForCall.arg1 -} - -func (fake *MSP) ModifyIdentityReturns(result1 *msp.IdentityResponse, result2 error) { - fake.modifyIdentityMutex.Lock() - defer fake.modifyIdentityMutex.Unlock() - fake.ModifyIdentityStub = nil - fake.modifyIdentityReturns = struct { - result1 *msp.IdentityResponse - result2 error - }{result1, result2} -} - -func (fake *MSP) ModifyIdentityReturnsOnCall(i int, result1 *msp.IdentityResponse, result2 error) { - fake.modifyIdentityMutex.Lock() - defer fake.modifyIdentityMutex.Unlock() - fake.ModifyIdentityStub = nil - if fake.modifyIdentityReturnsOnCall == nil { - fake.modifyIdentityReturnsOnCall = make(map[int]struct { - result1 *msp.IdentityResponse - result2 error - }) - } - fake.modifyIdentityReturnsOnCall[i] = struct { - result1 *msp.IdentityResponse - result2 error - }{result1, result2} -} - -func (fake *MSP) Reenroll(arg1 string, arg2 ...msp.EnrollmentOption) error { - fake.reenrollMutex.Lock() - ret, specificReturn := fake.reenrollReturnsOnCall[len(fake.reenrollArgsForCall)] - fake.reenrollArgsForCall = append(fake.reenrollArgsForCall, struct { - arg1 string - arg2 []msp.EnrollmentOption - }{arg1, arg2}) - fake.recordInvocation("Reenroll", []interface{}{arg1, arg2}) - fake.reenrollMutex.Unlock() - if fake.ReenrollStub != nil { - return fake.ReenrollStub(arg1, arg2...) - } - if specificReturn { - return ret.result1 - } - fakeReturns := fake.reenrollReturns - return fakeReturns.result1 -} - -func (fake *MSP) ReenrollCallCount() int { - fake.reenrollMutex.RLock() - defer fake.reenrollMutex.RUnlock() - return len(fake.reenrollArgsForCall) -} - -func (fake *MSP) ReenrollCalls(stub func(string, ...msp.EnrollmentOption) error) { - fake.reenrollMutex.Lock() - defer fake.reenrollMutex.Unlock() - fake.ReenrollStub = stub -} - -func (fake *MSP) ReenrollArgsForCall(i int) (string, []msp.EnrollmentOption) { - fake.reenrollMutex.RLock() - defer fake.reenrollMutex.RUnlock() - argsForCall := fake.reenrollArgsForCall[i] - return argsForCall.arg1, argsForCall.arg2 -} - -func (fake *MSP) ReenrollReturns(result1 error) { - fake.reenrollMutex.Lock() - defer fake.reenrollMutex.Unlock() - fake.ReenrollStub = nil - fake.reenrollReturns = struct { - result1 error - }{result1} -} - -func (fake *MSP) ReenrollReturnsOnCall(i int, result1 error) { - fake.reenrollMutex.Lock() - defer fake.reenrollMutex.Unlock() - fake.ReenrollStub = nil - if fake.reenrollReturnsOnCall == nil { - fake.reenrollReturnsOnCall = make(map[int]struct { - result1 error - }) - } - fake.reenrollReturnsOnCall[i] = struct { - result1 error - }{result1} -} - -func (fake *MSP) Register(arg1 *msp.RegistrationRequest) (string, error) { - fake.registerMutex.Lock() - ret, specificReturn := fake.registerReturnsOnCall[len(fake.registerArgsForCall)] - fake.registerArgsForCall = append(fake.registerArgsForCall, struct { - arg1 *msp.RegistrationRequest - }{arg1}) - fake.recordInvocation("Register", []interface{}{arg1}) - fake.registerMutex.Unlock() - if fake.RegisterStub != nil { - return fake.RegisterStub(arg1) - } - if specificReturn { - return ret.result1, ret.result2 - } - fakeReturns := fake.registerReturns - return fakeReturns.result1, fakeReturns.result2 -} - -func (fake *MSP) RegisterCallCount() int { - fake.registerMutex.RLock() - defer fake.registerMutex.RUnlock() - return len(fake.registerArgsForCall) -} - -func (fake *MSP) RegisterCalls(stub func(*msp.RegistrationRequest) (string, error)) { - fake.registerMutex.Lock() - defer fake.registerMutex.Unlock() - fake.RegisterStub = stub -} - -func (fake *MSP) RegisterArgsForCall(i int) *msp.RegistrationRequest { - fake.registerMutex.RLock() - defer fake.registerMutex.RUnlock() - argsForCall := fake.registerArgsForCall[i] - return argsForCall.arg1 -} - -func (fake *MSP) RegisterReturns(result1 string, result2 error) { - fake.registerMutex.Lock() - defer fake.registerMutex.Unlock() - fake.RegisterStub = nil - fake.registerReturns = struct { - result1 string - result2 error - }{result1, result2} -} - -func (fake *MSP) RegisterReturnsOnCall(i int, result1 string, result2 error) { - fake.registerMutex.Lock() - defer fake.registerMutex.Unlock() - fake.RegisterStub = nil - if fake.registerReturnsOnCall == nil { - fake.registerReturnsOnCall = make(map[int]struct { - result1 string - result2 error - }) - } - fake.registerReturnsOnCall[i] = struct { - result1 string - result2 error - }{result1, result2} -} - -func (fake *MSP) RemoveAffiliation(arg1 *msp.AffiliationRequest) (*msp.AffiliationResponse, error) { - fake.removeAffiliationMutex.Lock() - ret, specificReturn := fake.removeAffiliationReturnsOnCall[len(fake.removeAffiliationArgsForCall)] - fake.removeAffiliationArgsForCall = append(fake.removeAffiliationArgsForCall, struct { - arg1 *msp.AffiliationRequest - }{arg1}) - fake.recordInvocation("RemoveAffiliation", []interface{}{arg1}) - fake.removeAffiliationMutex.Unlock() - if fake.RemoveAffiliationStub != nil { - return fake.RemoveAffiliationStub(arg1) - } - if specificReturn { - return ret.result1, ret.result2 - } - fakeReturns := fake.removeAffiliationReturns - return fakeReturns.result1, fakeReturns.result2 -} - -func (fake *MSP) RemoveAffiliationCallCount() int { - fake.removeAffiliationMutex.RLock() - defer fake.removeAffiliationMutex.RUnlock() - return len(fake.removeAffiliationArgsForCall) -} - -func (fake *MSP) RemoveAffiliationCalls(stub func(*msp.AffiliationRequest) (*msp.AffiliationResponse, error)) { - fake.removeAffiliationMutex.Lock() - defer fake.removeAffiliationMutex.Unlock() - fake.RemoveAffiliationStub = stub -} - -func (fake *MSP) RemoveAffiliationArgsForCall(i int) *msp.AffiliationRequest { - fake.removeAffiliationMutex.RLock() - defer fake.removeAffiliationMutex.RUnlock() - argsForCall := fake.removeAffiliationArgsForCall[i] - return argsForCall.arg1 -} - -func (fake *MSP) RemoveAffiliationReturns(result1 *msp.AffiliationResponse, result2 error) { - fake.removeAffiliationMutex.Lock() - defer fake.removeAffiliationMutex.Unlock() - fake.RemoveAffiliationStub = nil - fake.removeAffiliationReturns = struct { - result1 *msp.AffiliationResponse - result2 error - }{result1, result2} -} - -func (fake *MSP) RemoveAffiliationReturnsOnCall(i int, result1 *msp.AffiliationResponse, result2 error) { - fake.removeAffiliationMutex.Lock() - defer fake.removeAffiliationMutex.Unlock() - fake.RemoveAffiliationStub = nil - if fake.removeAffiliationReturnsOnCall == nil { - fake.removeAffiliationReturnsOnCall = make(map[int]struct { - result1 *msp.AffiliationResponse - result2 error - }) - } - fake.removeAffiliationReturnsOnCall[i] = struct { - result1 *msp.AffiliationResponse - result2 error - }{result1, result2} -} - -func (fake *MSP) RemoveIdentity(arg1 *msp.RemoveIdentityRequest) (*msp.IdentityResponse, error) { - fake.removeIdentityMutex.Lock() - ret, specificReturn := fake.removeIdentityReturnsOnCall[len(fake.removeIdentityArgsForCall)] - fake.removeIdentityArgsForCall = append(fake.removeIdentityArgsForCall, struct { - arg1 *msp.RemoveIdentityRequest - }{arg1}) - fake.recordInvocation("RemoveIdentity", []interface{}{arg1}) - fake.removeIdentityMutex.Unlock() - if fake.RemoveIdentityStub != nil { - return fake.RemoveIdentityStub(arg1) - } - if specificReturn { - return ret.result1, ret.result2 - } - fakeReturns := fake.removeIdentityReturns - return fakeReturns.result1, fakeReturns.result2 -} - -func (fake *MSP) RemoveIdentityCallCount() int { - fake.removeIdentityMutex.RLock() - defer fake.removeIdentityMutex.RUnlock() - return len(fake.removeIdentityArgsForCall) -} - -func (fake *MSP) RemoveIdentityCalls(stub func(*msp.RemoveIdentityRequest) (*msp.IdentityResponse, error)) { - fake.removeIdentityMutex.Lock() - defer fake.removeIdentityMutex.Unlock() - fake.RemoveIdentityStub = stub -} - -func (fake *MSP) RemoveIdentityArgsForCall(i int) *msp.RemoveIdentityRequest { - fake.removeIdentityMutex.RLock() - defer fake.removeIdentityMutex.RUnlock() - argsForCall := fake.removeIdentityArgsForCall[i] - return argsForCall.arg1 -} - -func (fake *MSP) RemoveIdentityReturns(result1 *msp.IdentityResponse, result2 error) { - fake.removeIdentityMutex.Lock() - defer fake.removeIdentityMutex.Unlock() - fake.RemoveIdentityStub = nil - fake.removeIdentityReturns = struct { - result1 *msp.IdentityResponse - result2 error - }{result1, result2} -} - -func (fake *MSP) RemoveIdentityReturnsOnCall(i int, result1 *msp.IdentityResponse, result2 error) { - fake.removeIdentityMutex.Lock() - defer fake.removeIdentityMutex.Unlock() - fake.RemoveIdentityStub = nil - if fake.removeIdentityReturnsOnCall == nil { - fake.removeIdentityReturnsOnCall = make(map[int]struct { - result1 *msp.IdentityResponse - result2 error - }) - } - fake.removeIdentityReturnsOnCall[i] = struct { - result1 *msp.IdentityResponse - result2 error - }{result1, result2} -} - -func (fake *MSP) Revoke(arg1 *msp.RevocationRequest) (*msp.RevocationResponse, error) { - fake.revokeMutex.Lock() - ret, specificReturn := fake.revokeReturnsOnCall[len(fake.revokeArgsForCall)] - fake.revokeArgsForCall = append(fake.revokeArgsForCall, struct { - arg1 *msp.RevocationRequest - }{arg1}) - fake.recordInvocation("Revoke", []interface{}{arg1}) - fake.revokeMutex.Unlock() - if fake.RevokeStub != nil { - return fake.RevokeStub(arg1) - } - if specificReturn { - return ret.result1, ret.result2 - } - fakeReturns := fake.revokeReturns - return fakeReturns.result1, fakeReturns.result2 -} - -func (fake *MSP) RevokeCallCount() int { - fake.revokeMutex.RLock() - defer fake.revokeMutex.RUnlock() - return len(fake.revokeArgsForCall) -} - -func (fake *MSP) RevokeCalls(stub func(*msp.RevocationRequest) (*msp.RevocationResponse, error)) { - fake.revokeMutex.Lock() - defer fake.revokeMutex.Unlock() - fake.RevokeStub = stub -} - -func (fake *MSP) RevokeArgsForCall(i int) *msp.RevocationRequest { - fake.revokeMutex.RLock() - defer fake.revokeMutex.RUnlock() - argsForCall := fake.revokeArgsForCall[i] - return argsForCall.arg1 -} - -func (fake *MSP) RevokeReturns(result1 *msp.RevocationResponse, result2 error) { - fake.revokeMutex.Lock() - defer fake.revokeMutex.Unlock() - fake.RevokeStub = nil - fake.revokeReturns = struct { - result1 *msp.RevocationResponse - result2 error - }{result1, result2} -} - -func (fake *MSP) RevokeReturnsOnCall(i int, result1 *msp.RevocationResponse, result2 error) { - fake.revokeMutex.Lock() - defer fake.revokeMutex.Unlock() - fake.RevokeStub = nil - if fake.revokeReturnsOnCall == nil { - fake.revokeReturnsOnCall = make(map[int]struct { - result1 *msp.RevocationResponse - result2 error - }) - } - fake.revokeReturnsOnCall[i] = struct { - result1 *msp.RevocationResponse - result2 error - }{result1, result2} -} - -func (fake *MSP) Invocations() map[string][][]interface{} { - fake.invocationsMutex.RLock() - defer fake.invocationsMutex.RUnlock() - fake.addAffiliationMutex.RLock() - defer fake.addAffiliationMutex.RUnlock() - fake.createIdentityMutex.RLock() - defer fake.createIdentityMutex.RUnlock() - fake.createSigningIdentityMutex.RLock() - defer fake.createSigningIdentityMutex.RUnlock() - fake.enrollMutex.RLock() - defer fake.enrollMutex.RUnlock() - fake.getAffiliationMutex.RLock() - defer fake.getAffiliationMutex.RUnlock() - fake.getAllAffiliationsMutex.RLock() - defer fake.getAllAffiliationsMutex.RUnlock() - fake.getAllIdentitiesMutex.RLock() - defer fake.getAllIdentitiesMutex.RUnlock() - fake.getCAInfoMutex.RLock() - defer fake.getCAInfoMutex.RUnlock() - fake.getIdentityMutex.RLock() - defer fake.getIdentityMutex.RUnlock() - fake.getSigningIdentityMutex.RLock() - defer fake.getSigningIdentityMutex.RUnlock() - fake.modifyAffiliationMutex.RLock() - defer fake.modifyAffiliationMutex.RUnlock() - fake.modifyIdentityMutex.RLock() - defer fake.modifyIdentityMutex.RUnlock() - fake.reenrollMutex.RLock() - defer fake.reenrollMutex.RUnlock() - fake.registerMutex.RLock() - defer fake.registerMutex.RUnlock() - fake.removeAffiliationMutex.RLock() - defer fake.removeAffiliationMutex.RUnlock() - fake.removeIdentityMutex.RLock() - defer fake.removeIdentityMutex.RUnlock() - fake.revokeMutex.RLock() - defer fake.revokeMutex.RUnlock() - copiedInvocations := map[string][][]interface{}{} - for key, value := range fake.invocations { - copiedInvocations[key] = value - } - return copiedInvocations -} - -func (fake *MSP) recordInvocation(key string, args []interface{}) { - fake.invocationsMutex.Lock() - defer fake.invocationsMutex.Unlock() - if fake.invocations == nil { - fake.invocations = map[string][][]interface{}{} - } - if fake.invocations[key] == nil { - fake.invocations[key] = [][]interface{}{} - } - fake.invocations[key] = append(fake.invocations[key], args) -} - -var _ fabric.MSP = new(MSP) diff --git a/pkg/fabric/mocks/resmgmt.go b/pkg/fabric/mocks/resmgmt.go deleted file mode 100644 index 436cd56..0000000 --- a/pkg/fabric/mocks/resmgmt.go +++ /dev/null @@ -1,1648 +0,0 @@ -// Code generated by counterfeiter. DO NOT EDIT. -package mocks - -import ( - "sync" - - "github.com/hyperledger/fabric-cli/pkg/fabric" - "github.com/hyperledger/fabric-protos-go/common" - "github.com/hyperledger/fabric-protos-go/peer" - "github.com/hyperledger/fabric-sdk-go/pkg/client/resmgmt" - "github.com/hyperledger/fabric-sdk-go/pkg/common/providers/fab" - "github.com/hyperledger/fabric-sdk-go/pkg/common/providers/msp" - "github.com/hyperledger/fabric-sdk-go/pkg/fab/resource" -) - -type ResourceManagement struct { - CreateConfigSignatureStub func(msp.SigningIdentity, string) (*common.ConfigSignature, error) - createConfigSignatureMutex sync.RWMutex - createConfigSignatureArgsForCall []struct { - arg1 msp.SigningIdentity - arg2 string - } - createConfigSignatureReturns struct { - result1 *common.ConfigSignature - result2 error - } - createConfigSignatureReturnsOnCall map[int]struct { - result1 *common.ConfigSignature - result2 error - } - CreateConfigSignatureDataStub func(msp.SigningIdentity, string) (resource.ConfigSignatureData, error) - createConfigSignatureDataMutex sync.RWMutex - createConfigSignatureDataArgsForCall []struct { - arg1 msp.SigningIdentity - arg2 string - } - createConfigSignatureDataReturns struct { - result1 resource.ConfigSignatureData - result2 error - } - createConfigSignatureDataReturnsOnCall map[int]struct { - result1 resource.ConfigSignatureData - result2 error - } - InstallCCStub func(resmgmt.InstallCCRequest, ...resmgmt.RequestOption) ([]resmgmt.InstallCCResponse, error) - installCCMutex sync.RWMutex - installCCArgsForCall []struct { - arg1 resmgmt.InstallCCRequest - arg2 []resmgmt.RequestOption - } - installCCReturns struct { - result1 []resmgmt.InstallCCResponse - result2 error - } - installCCReturnsOnCall map[int]struct { - result1 []resmgmt.InstallCCResponse - result2 error - } - InstantiateCCStub func(string, resmgmt.InstantiateCCRequest, ...resmgmt.RequestOption) (resmgmt.InstantiateCCResponse, error) - instantiateCCMutex sync.RWMutex - instantiateCCArgsForCall []struct { - arg1 string - arg2 resmgmt.InstantiateCCRequest - arg3 []resmgmt.RequestOption - } - instantiateCCReturns struct { - result1 resmgmt.InstantiateCCResponse - result2 error - } - instantiateCCReturnsOnCall map[int]struct { - result1 resmgmt.InstantiateCCResponse - result2 error - } - JoinChannelStub func(string, ...resmgmt.RequestOption) error - joinChannelMutex sync.RWMutex - joinChannelArgsForCall []struct { - arg1 string - arg2 []resmgmt.RequestOption - } - joinChannelReturns struct { - result1 error - } - joinChannelReturnsOnCall map[int]struct { - result1 error - } - LifecycleApproveCCStub func(string, resmgmt.LifecycleApproveCCRequest, ...resmgmt.RequestOption) (fab.TransactionID, error) - lifecycleApproveCCMutex sync.RWMutex - lifecycleApproveCCArgsForCall []struct { - arg1 string - arg2 resmgmt.LifecycleApproveCCRequest - arg3 []resmgmt.RequestOption - } - lifecycleApproveCCReturns struct { - result1 fab.TransactionID - result2 error - } - lifecycleApproveCCReturnsOnCall map[int]struct { - result1 fab.TransactionID - result2 error - } - LifecycleCheckCCCommitReadinessStub func(string, resmgmt.LifecycleCheckCCCommitReadinessRequest, ...resmgmt.RequestOption) (resmgmt.LifecycleCheckCCCommitReadinessResponse, error) - lifecycleCheckCCCommitReadinessMutex sync.RWMutex - lifecycleCheckCCCommitReadinessArgsForCall []struct { - arg1 string - arg2 resmgmt.LifecycleCheckCCCommitReadinessRequest - arg3 []resmgmt.RequestOption - } - lifecycleCheckCCCommitReadinessReturns struct { - result1 resmgmt.LifecycleCheckCCCommitReadinessResponse - result2 error - } - lifecycleCheckCCCommitReadinessReturnsOnCall map[int]struct { - result1 resmgmt.LifecycleCheckCCCommitReadinessResponse - result2 error - } - LifecycleCommitCCStub func(string, resmgmt.LifecycleCommitCCRequest, ...resmgmt.RequestOption) (fab.TransactionID, error) - lifecycleCommitCCMutex sync.RWMutex - lifecycleCommitCCArgsForCall []struct { - arg1 string - arg2 resmgmt.LifecycleCommitCCRequest - arg3 []resmgmt.RequestOption - } - lifecycleCommitCCReturns struct { - result1 fab.TransactionID - result2 error - } - lifecycleCommitCCReturnsOnCall map[int]struct { - result1 fab.TransactionID - result2 error - } - LifecycleGetInstalledCCPackageStub func(string, ...resmgmt.RequestOption) ([]byte, error) - lifecycleGetInstalledCCPackageMutex sync.RWMutex - lifecycleGetInstalledCCPackageArgsForCall []struct { - arg1 string - arg2 []resmgmt.RequestOption - } - lifecycleGetInstalledCCPackageReturns struct { - result1 []byte - result2 error - } - lifecycleGetInstalledCCPackageReturnsOnCall map[int]struct { - result1 []byte - result2 error - } - LifecycleInstallCCStub func(resmgmt.LifecycleInstallCCRequest, ...resmgmt.RequestOption) ([]resmgmt.LifecycleInstallCCResponse, error) - lifecycleInstallCCMutex sync.RWMutex - lifecycleInstallCCArgsForCall []struct { - arg1 resmgmt.LifecycleInstallCCRequest - arg2 []resmgmt.RequestOption - } - lifecycleInstallCCReturns struct { - result1 []resmgmt.LifecycleInstallCCResponse - result2 error - } - lifecycleInstallCCReturnsOnCall map[int]struct { - result1 []resmgmt.LifecycleInstallCCResponse - result2 error - } - LifecycleQueryApprovedCCStub func(string, resmgmt.LifecycleQueryApprovedCCRequest, ...resmgmt.RequestOption) (resmgmt.LifecycleApprovedChaincodeDefinition, error) - lifecycleQueryApprovedCCMutex sync.RWMutex - lifecycleQueryApprovedCCArgsForCall []struct { - arg1 string - arg2 resmgmt.LifecycleQueryApprovedCCRequest - arg3 []resmgmt.RequestOption - } - lifecycleQueryApprovedCCReturns struct { - result1 resmgmt.LifecycleApprovedChaincodeDefinition - result2 error - } - lifecycleQueryApprovedCCReturnsOnCall map[int]struct { - result1 resmgmt.LifecycleApprovedChaincodeDefinition - result2 error - } - LifecycleQueryCommittedCCStub func(string, resmgmt.LifecycleQueryCommittedCCRequest, ...resmgmt.RequestOption) ([]resmgmt.LifecycleChaincodeDefinition, error) - lifecycleQueryCommittedCCMutex sync.RWMutex - lifecycleQueryCommittedCCArgsForCall []struct { - arg1 string - arg2 resmgmt.LifecycleQueryCommittedCCRequest - arg3 []resmgmt.RequestOption - } - lifecycleQueryCommittedCCReturns struct { - result1 []resmgmt.LifecycleChaincodeDefinition - result2 error - } - lifecycleQueryCommittedCCReturnsOnCall map[int]struct { - result1 []resmgmt.LifecycleChaincodeDefinition - result2 error - } - LifecycleQueryInstalledCCStub func(...resmgmt.RequestOption) ([]resmgmt.LifecycleInstalledCC, error) - lifecycleQueryInstalledCCMutex sync.RWMutex - lifecycleQueryInstalledCCArgsForCall []struct { - arg1 []resmgmt.RequestOption - } - lifecycleQueryInstalledCCReturns struct { - result1 []resmgmt.LifecycleInstalledCC - result2 error - } - lifecycleQueryInstalledCCReturnsOnCall map[int]struct { - result1 []resmgmt.LifecycleInstalledCC - result2 error - } - QueryChannelsStub func(...resmgmt.RequestOption) (*peer.ChannelQueryResponse, error) - queryChannelsMutex sync.RWMutex - queryChannelsArgsForCall []struct { - arg1 []resmgmt.RequestOption - } - queryChannelsReturns struct { - result1 *peer.ChannelQueryResponse - result2 error - } - queryChannelsReturnsOnCall map[int]struct { - result1 *peer.ChannelQueryResponse - result2 error - } - QueryCollectionsConfigStub func(string, string, ...resmgmt.RequestOption) (*peer.CollectionConfigPackage, error) - queryCollectionsConfigMutex sync.RWMutex - queryCollectionsConfigArgsForCall []struct { - arg1 string - arg2 string - arg3 []resmgmt.RequestOption - } - queryCollectionsConfigReturns struct { - result1 *peer.CollectionConfigPackage - result2 error - } - queryCollectionsConfigReturnsOnCall map[int]struct { - result1 *peer.CollectionConfigPackage - result2 error - } - QueryConfigFromOrdererStub func(string, ...resmgmt.RequestOption) (fab.ChannelCfg, error) - queryConfigFromOrdererMutex sync.RWMutex - queryConfigFromOrdererArgsForCall []struct { - arg1 string - arg2 []resmgmt.RequestOption - } - queryConfigFromOrdererReturns struct { - result1 fab.ChannelCfg - result2 error - } - queryConfigFromOrdererReturnsOnCall map[int]struct { - result1 fab.ChannelCfg - result2 error - } - QueryInstalledChaincodesStub func(...resmgmt.RequestOption) (*peer.ChaincodeQueryResponse, error) - queryInstalledChaincodesMutex sync.RWMutex - queryInstalledChaincodesArgsForCall []struct { - arg1 []resmgmt.RequestOption - } - queryInstalledChaincodesReturns struct { - result1 *peer.ChaincodeQueryResponse - result2 error - } - queryInstalledChaincodesReturnsOnCall map[int]struct { - result1 *peer.ChaincodeQueryResponse - result2 error - } - QueryInstantiatedChaincodesStub func(string, ...resmgmt.RequestOption) (*peer.ChaincodeQueryResponse, error) - queryInstantiatedChaincodesMutex sync.RWMutex - queryInstantiatedChaincodesArgsForCall []struct { - arg1 string - arg2 []resmgmt.RequestOption - } - queryInstantiatedChaincodesReturns struct { - result1 *peer.ChaincodeQueryResponse - result2 error - } - queryInstantiatedChaincodesReturnsOnCall map[int]struct { - result1 *peer.ChaincodeQueryResponse - result2 error - } - SaveChannelStub func(resmgmt.SaveChannelRequest, ...resmgmt.RequestOption) (resmgmt.SaveChannelResponse, error) - saveChannelMutex sync.RWMutex - saveChannelArgsForCall []struct { - arg1 resmgmt.SaveChannelRequest - arg2 []resmgmt.RequestOption - } - saveChannelReturns struct { - result1 resmgmt.SaveChannelResponse - result2 error - } - saveChannelReturnsOnCall map[int]struct { - result1 resmgmt.SaveChannelResponse - result2 error - } - UpgradeCCStub func(string, resmgmt.UpgradeCCRequest, ...resmgmt.RequestOption) (resmgmt.UpgradeCCResponse, error) - upgradeCCMutex sync.RWMutex - upgradeCCArgsForCall []struct { - arg1 string - arg2 resmgmt.UpgradeCCRequest - arg3 []resmgmt.RequestOption - } - upgradeCCReturns struct { - result1 resmgmt.UpgradeCCResponse - result2 error - } - upgradeCCReturnsOnCall map[int]struct { - result1 resmgmt.UpgradeCCResponse - result2 error - } - invocations map[string][][]interface{} - invocationsMutex sync.RWMutex -} - -func (fake *ResourceManagement) CreateConfigSignature(arg1 msp.SigningIdentity, arg2 string) (*common.ConfigSignature, error) { - fake.createConfigSignatureMutex.Lock() - ret, specificReturn := fake.createConfigSignatureReturnsOnCall[len(fake.createConfigSignatureArgsForCall)] - fake.createConfigSignatureArgsForCall = append(fake.createConfigSignatureArgsForCall, struct { - arg1 msp.SigningIdentity - arg2 string - }{arg1, arg2}) - fake.recordInvocation("CreateConfigSignature", []interface{}{arg1, arg2}) - fake.createConfigSignatureMutex.Unlock() - if fake.CreateConfigSignatureStub != nil { - return fake.CreateConfigSignatureStub(arg1, arg2) - } - if specificReturn { - return ret.result1, ret.result2 - } - fakeReturns := fake.createConfigSignatureReturns - return fakeReturns.result1, fakeReturns.result2 -} - -func (fake *ResourceManagement) CreateConfigSignatureCallCount() int { - fake.createConfigSignatureMutex.RLock() - defer fake.createConfigSignatureMutex.RUnlock() - return len(fake.createConfigSignatureArgsForCall) -} - -func (fake *ResourceManagement) CreateConfigSignatureCalls(stub func(msp.SigningIdentity, string) (*common.ConfigSignature, error)) { - fake.createConfigSignatureMutex.Lock() - defer fake.createConfigSignatureMutex.Unlock() - fake.CreateConfigSignatureStub = stub -} - -func (fake *ResourceManagement) CreateConfigSignatureArgsForCall(i int) (msp.SigningIdentity, string) { - fake.createConfigSignatureMutex.RLock() - defer fake.createConfigSignatureMutex.RUnlock() - argsForCall := fake.createConfigSignatureArgsForCall[i] - return argsForCall.arg1, argsForCall.arg2 -} - -func (fake *ResourceManagement) CreateConfigSignatureReturns(result1 *common.ConfigSignature, result2 error) { - fake.createConfigSignatureMutex.Lock() - defer fake.createConfigSignatureMutex.Unlock() - fake.CreateConfigSignatureStub = nil - fake.createConfigSignatureReturns = struct { - result1 *common.ConfigSignature - result2 error - }{result1, result2} -} - -func (fake *ResourceManagement) CreateConfigSignatureReturnsOnCall(i int, result1 *common.ConfigSignature, result2 error) { - fake.createConfigSignatureMutex.Lock() - defer fake.createConfigSignatureMutex.Unlock() - fake.CreateConfigSignatureStub = nil - if fake.createConfigSignatureReturnsOnCall == nil { - fake.createConfigSignatureReturnsOnCall = make(map[int]struct { - result1 *common.ConfigSignature - result2 error - }) - } - fake.createConfigSignatureReturnsOnCall[i] = struct { - result1 *common.ConfigSignature - result2 error - }{result1, result2} -} - -func (fake *ResourceManagement) CreateConfigSignatureData(arg1 msp.SigningIdentity, arg2 string) (resource.ConfigSignatureData, error) { - fake.createConfigSignatureDataMutex.Lock() - ret, specificReturn := fake.createConfigSignatureDataReturnsOnCall[len(fake.createConfigSignatureDataArgsForCall)] - fake.createConfigSignatureDataArgsForCall = append(fake.createConfigSignatureDataArgsForCall, struct { - arg1 msp.SigningIdentity - arg2 string - }{arg1, arg2}) - fake.recordInvocation("CreateConfigSignatureData", []interface{}{arg1, arg2}) - fake.createConfigSignatureDataMutex.Unlock() - if fake.CreateConfigSignatureDataStub != nil { - return fake.CreateConfigSignatureDataStub(arg1, arg2) - } - if specificReturn { - return ret.result1, ret.result2 - } - fakeReturns := fake.createConfigSignatureDataReturns - return fakeReturns.result1, fakeReturns.result2 -} - -func (fake *ResourceManagement) CreateConfigSignatureDataCallCount() int { - fake.createConfigSignatureDataMutex.RLock() - defer fake.createConfigSignatureDataMutex.RUnlock() - return len(fake.createConfigSignatureDataArgsForCall) -} - -func (fake *ResourceManagement) CreateConfigSignatureDataCalls(stub func(msp.SigningIdentity, string) (resource.ConfigSignatureData, error)) { - fake.createConfigSignatureDataMutex.Lock() - defer fake.createConfigSignatureDataMutex.Unlock() - fake.CreateConfigSignatureDataStub = stub -} - -func (fake *ResourceManagement) CreateConfigSignatureDataArgsForCall(i int) (msp.SigningIdentity, string) { - fake.createConfigSignatureDataMutex.RLock() - defer fake.createConfigSignatureDataMutex.RUnlock() - argsForCall := fake.createConfigSignatureDataArgsForCall[i] - return argsForCall.arg1, argsForCall.arg2 -} - -func (fake *ResourceManagement) CreateConfigSignatureDataReturns(result1 resource.ConfigSignatureData, result2 error) { - fake.createConfigSignatureDataMutex.Lock() - defer fake.createConfigSignatureDataMutex.Unlock() - fake.CreateConfigSignatureDataStub = nil - fake.createConfigSignatureDataReturns = struct { - result1 resource.ConfigSignatureData - result2 error - }{result1, result2} -} - -func (fake *ResourceManagement) CreateConfigSignatureDataReturnsOnCall(i int, result1 resource.ConfigSignatureData, result2 error) { - fake.createConfigSignatureDataMutex.Lock() - defer fake.createConfigSignatureDataMutex.Unlock() - fake.CreateConfigSignatureDataStub = nil - if fake.createConfigSignatureDataReturnsOnCall == nil { - fake.createConfigSignatureDataReturnsOnCall = make(map[int]struct { - result1 resource.ConfigSignatureData - result2 error - }) - } - fake.createConfigSignatureDataReturnsOnCall[i] = struct { - result1 resource.ConfigSignatureData - result2 error - }{result1, result2} -} - -func (fake *ResourceManagement) InstallCC(arg1 resmgmt.InstallCCRequest, arg2 ...resmgmt.RequestOption) ([]resmgmt.InstallCCResponse, error) { - fake.installCCMutex.Lock() - ret, specificReturn := fake.installCCReturnsOnCall[len(fake.installCCArgsForCall)] - fake.installCCArgsForCall = append(fake.installCCArgsForCall, struct { - arg1 resmgmt.InstallCCRequest - arg2 []resmgmt.RequestOption - }{arg1, arg2}) - fake.recordInvocation("InstallCC", []interface{}{arg1, arg2}) - fake.installCCMutex.Unlock() - if fake.InstallCCStub != nil { - return fake.InstallCCStub(arg1, arg2...) - } - if specificReturn { - return ret.result1, ret.result2 - } - fakeReturns := fake.installCCReturns - return fakeReturns.result1, fakeReturns.result2 -} - -func (fake *ResourceManagement) InstallCCCallCount() int { - fake.installCCMutex.RLock() - defer fake.installCCMutex.RUnlock() - return len(fake.installCCArgsForCall) -} - -func (fake *ResourceManagement) InstallCCCalls(stub func(resmgmt.InstallCCRequest, ...resmgmt.RequestOption) ([]resmgmt.InstallCCResponse, error)) { - fake.installCCMutex.Lock() - defer fake.installCCMutex.Unlock() - fake.InstallCCStub = stub -} - -func (fake *ResourceManagement) InstallCCArgsForCall(i int) (resmgmt.InstallCCRequest, []resmgmt.RequestOption) { - fake.installCCMutex.RLock() - defer fake.installCCMutex.RUnlock() - argsForCall := fake.installCCArgsForCall[i] - return argsForCall.arg1, argsForCall.arg2 -} - -func (fake *ResourceManagement) InstallCCReturns(result1 []resmgmt.InstallCCResponse, result2 error) { - fake.installCCMutex.Lock() - defer fake.installCCMutex.Unlock() - fake.InstallCCStub = nil - fake.installCCReturns = struct { - result1 []resmgmt.InstallCCResponse - result2 error - }{result1, result2} -} - -func (fake *ResourceManagement) InstallCCReturnsOnCall(i int, result1 []resmgmt.InstallCCResponse, result2 error) { - fake.installCCMutex.Lock() - defer fake.installCCMutex.Unlock() - fake.InstallCCStub = nil - if fake.installCCReturnsOnCall == nil { - fake.installCCReturnsOnCall = make(map[int]struct { - result1 []resmgmt.InstallCCResponse - result2 error - }) - } - fake.installCCReturnsOnCall[i] = struct { - result1 []resmgmt.InstallCCResponse - result2 error - }{result1, result2} -} - -func (fake *ResourceManagement) InstantiateCC(arg1 string, arg2 resmgmt.InstantiateCCRequest, arg3 ...resmgmt.RequestOption) (resmgmt.InstantiateCCResponse, error) { - fake.instantiateCCMutex.Lock() - ret, specificReturn := fake.instantiateCCReturnsOnCall[len(fake.instantiateCCArgsForCall)] - fake.instantiateCCArgsForCall = append(fake.instantiateCCArgsForCall, struct { - arg1 string - arg2 resmgmt.InstantiateCCRequest - arg3 []resmgmt.RequestOption - }{arg1, arg2, arg3}) - fake.recordInvocation("InstantiateCC", []interface{}{arg1, arg2, arg3}) - fake.instantiateCCMutex.Unlock() - if fake.InstantiateCCStub != nil { - return fake.InstantiateCCStub(arg1, arg2, arg3...) - } - if specificReturn { - return ret.result1, ret.result2 - } - fakeReturns := fake.instantiateCCReturns - return fakeReturns.result1, fakeReturns.result2 -} - -func (fake *ResourceManagement) InstantiateCCCallCount() int { - fake.instantiateCCMutex.RLock() - defer fake.instantiateCCMutex.RUnlock() - return len(fake.instantiateCCArgsForCall) -} - -func (fake *ResourceManagement) InstantiateCCCalls(stub func(string, resmgmt.InstantiateCCRequest, ...resmgmt.RequestOption) (resmgmt.InstantiateCCResponse, error)) { - fake.instantiateCCMutex.Lock() - defer fake.instantiateCCMutex.Unlock() - fake.InstantiateCCStub = stub -} - -func (fake *ResourceManagement) InstantiateCCArgsForCall(i int) (string, resmgmt.InstantiateCCRequest, []resmgmt.RequestOption) { - fake.instantiateCCMutex.RLock() - defer fake.instantiateCCMutex.RUnlock() - argsForCall := fake.instantiateCCArgsForCall[i] - return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3 -} - -func (fake *ResourceManagement) InstantiateCCReturns(result1 resmgmt.InstantiateCCResponse, result2 error) { - fake.instantiateCCMutex.Lock() - defer fake.instantiateCCMutex.Unlock() - fake.InstantiateCCStub = nil - fake.instantiateCCReturns = struct { - result1 resmgmt.InstantiateCCResponse - result2 error - }{result1, result2} -} - -func (fake *ResourceManagement) InstantiateCCReturnsOnCall(i int, result1 resmgmt.InstantiateCCResponse, result2 error) { - fake.instantiateCCMutex.Lock() - defer fake.instantiateCCMutex.Unlock() - fake.InstantiateCCStub = nil - if fake.instantiateCCReturnsOnCall == nil { - fake.instantiateCCReturnsOnCall = make(map[int]struct { - result1 resmgmt.InstantiateCCResponse - result2 error - }) - } - fake.instantiateCCReturnsOnCall[i] = struct { - result1 resmgmt.InstantiateCCResponse - result2 error - }{result1, result2} -} - -func (fake *ResourceManagement) JoinChannel(arg1 string, arg2 ...resmgmt.RequestOption) error { - fake.joinChannelMutex.Lock() - ret, specificReturn := fake.joinChannelReturnsOnCall[len(fake.joinChannelArgsForCall)] - fake.joinChannelArgsForCall = append(fake.joinChannelArgsForCall, struct { - arg1 string - arg2 []resmgmt.RequestOption - }{arg1, arg2}) - fake.recordInvocation("JoinChannel", []interface{}{arg1, arg2}) - fake.joinChannelMutex.Unlock() - if fake.JoinChannelStub != nil { - return fake.JoinChannelStub(arg1, arg2...) - } - if specificReturn { - return ret.result1 - } - fakeReturns := fake.joinChannelReturns - return fakeReturns.result1 -} - -func (fake *ResourceManagement) JoinChannelCallCount() int { - fake.joinChannelMutex.RLock() - defer fake.joinChannelMutex.RUnlock() - return len(fake.joinChannelArgsForCall) -} - -func (fake *ResourceManagement) JoinChannelCalls(stub func(string, ...resmgmt.RequestOption) error) { - fake.joinChannelMutex.Lock() - defer fake.joinChannelMutex.Unlock() - fake.JoinChannelStub = stub -} - -func (fake *ResourceManagement) JoinChannelArgsForCall(i int) (string, []resmgmt.RequestOption) { - fake.joinChannelMutex.RLock() - defer fake.joinChannelMutex.RUnlock() - argsForCall := fake.joinChannelArgsForCall[i] - return argsForCall.arg1, argsForCall.arg2 -} - -func (fake *ResourceManagement) JoinChannelReturns(result1 error) { - fake.joinChannelMutex.Lock() - defer fake.joinChannelMutex.Unlock() - fake.JoinChannelStub = nil - fake.joinChannelReturns = struct { - result1 error - }{result1} -} - -func (fake *ResourceManagement) JoinChannelReturnsOnCall(i int, result1 error) { - fake.joinChannelMutex.Lock() - defer fake.joinChannelMutex.Unlock() - fake.JoinChannelStub = nil - if fake.joinChannelReturnsOnCall == nil { - fake.joinChannelReturnsOnCall = make(map[int]struct { - result1 error - }) - } - fake.joinChannelReturnsOnCall[i] = struct { - result1 error - }{result1} -} - -func (fake *ResourceManagement) LifecycleApproveCC(arg1 string, arg2 resmgmt.LifecycleApproveCCRequest, arg3 ...resmgmt.RequestOption) (fab.TransactionID, error) { - fake.lifecycleApproveCCMutex.Lock() - ret, specificReturn := fake.lifecycleApproveCCReturnsOnCall[len(fake.lifecycleApproveCCArgsForCall)] - fake.lifecycleApproveCCArgsForCall = append(fake.lifecycleApproveCCArgsForCall, struct { - arg1 string - arg2 resmgmt.LifecycleApproveCCRequest - arg3 []resmgmt.RequestOption - }{arg1, arg2, arg3}) - fake.recordInvocation("LifecycleApproveCC", []interface{}{arg1, arg2, arg3}) - fake.lifecycleApproveCCMutex.Unlock() - if fake.LifecycleApproveCCStub != nil { - return fake.LifecycleApproveCCStub(arg1, arg2, arg3...) - } - if specificReturn { - return ret.result1, ret.result2 - } - fakeReturns := fake.lifecycleApproveCCReturns - return fakeReturns.result1, fakeReturns.result2 -} - -func (fake *ResourceManagement) LifecycleApproveCCCallCount() int { - fake.lifecycleApproveCCMutex.RLock() - defer fake.lifecycleApproveCCMutex.RUnlock() - return len(fake.lifecycleApproveCCArgsForCall) -} - -func (fake *ResourceManagement) LifecycleApproveCCCalls(stub func(string, resmgmt.LifecycleApproveCCRequest, ...resmgmt.RequestOption) (fab.TransactionID, error)) { - fake.lifecycleApproveCCMutex.Lock() - defer fake.lifecycleApproveCCMutex.Unlock() - fake.LifecycleApproveCCStub = stub -} - -func (fake *ResourceManagement) LifecycleApproveCCArgsForCall(i int) (string, resmgmt.LifecycleApproveCCRequest, []resmgmt.RequestOption) { - fake.lifecycleApproveCCMutex.RLock() - defer fake.lifecycleApproveCCMutex.RUnlock() - argsForCall := fake.lifecycleApproveCCArgsForCall[i] - return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3 -} - -func (fake *ResourceManagement) LifecycleApproveCCReturns(result1 fab.TransactionID, result2 error) { - fake.lifecycleApproveCCMutex.Lock() - defer fake.lifecycleApproveCCMutex.Unlock() - fake.LifecycleApproveCCStub = nil - fake.lifecycleApproveCCReturns = struct { - result1 fab.TransactionID - result2 error - }{result1, result2} -} - -func (fake *ResourceManagement) LifecycleApproveCCReturnsOnCall(i int, result1 fab.TransactionID, result2 error) { - fake.lifecycleApproveCCMutex.Lock() - defer fake.lifecycleApproveCCMutex.Unlock() - fake.LifecycleApproveCCStub = nil - if fake.lifecycleApproveCCReturnsOnCall == nil { - fake.lifecycleApproveCCReturnsOnCall = make(map[int]struct { - result1 fab.TransactionID - result2 error - }) - } - fake.lifecycleApproveCCReturnsOnCall[i] = struct { - result1 fab.TransactionID - result2 error - }{result1, result2} -} - -func (fake *ResourceManagement) LifecycleCheckCCCommitReadiness(arg1 string, arg2 resmgmt.LifecycleCheckCCCommitReadinessRequest, arg3 ...resmgmt.RequestOption) (resmgmt.LifecycleCheckCCCommitReadinessResponse, error) { - fake.lifecycleCheckCCCommitReadinessMutex.Lock() - ret, specificReturn := fake.lifecycleCheckCCCommitReadinessReturnsOnCall[len(fake.lifecycleCheckCCCommitReadinessArgsForCall)] - fake.lifecycleCheckCCCommitReadinessArgsForCall = append(fake.lifecycleCheckCCCommitReadinessArgsForCall, struct { - arg1 string - arg2 resmgmt.LifecycleCheckCCCommitReadinessRequest - arg3 []resmgmt.RequestOption - }{arg1, arg2, arg3}) - fake.recordInvocation("LifecycleCheckCCCommitReadiness", []interface{}{arg1, arg2, arg3}) - fake.lifecycleCheckCCCommitReadinessMutex.Unlock() - if fake.LifecycleCheckCCCommitReadinessStub != nil { - return fake.LifecycleCheckCCCommitReadinessStub(arg1, arg2, arg3...) - } - if specificReturn { - return ret.result1, ret.result2 - } - fakeReturns := fake.lifecycleCheckCCCommitReadinessReturns - return fakeReturns.result1, fakeReturns.result2 -} - -func (fake *ResourceManagement) LifecycleCheckCCCommitReadinessCallCount() int { - fake.lifecycleCheckCCCommitReadinessMutex.RLock() - defer fake.lifecycleCheckCCCommitReadinessMutex.RUnlock() - return len(fake.lifecycleCheckCCCommitReadinessArgsForCall) -} - -func (fake *ResourceManagement) LifecycleCheckCCCommitReadinessCalls(stub func(string, resmgmt.LifecycleCheckCCCommitReadinessRequest, ...resmgmt.RequestOption) (resmgmt.LifecycleCheckCCCommitReadinessResponse, error)) { - fake.lifecycleCheckCCCommitReadinessMutex.Lock() - defer fake.lifecycleCheckCCCommitReadinessMutex.Unlock() - fake.LifecycleCheckCCCommitReadinessStub = stub -} - -func (fake *ResourceManagement) LifecycleCheckCCCommitReadinessArgsForCall(i int) (string, resmgmt.LifecycleCheckCCCommitReadinessRequest, []resmgmt.RequestOption) { - fake.lifecycleCheckCCCommitReadinessMutex.RLock() - defer fake.lifecycleCheckCCCommitReadinessMutex.RUnlock() - argsForCall := fake.lifecycleCheckCCCommitReadinessArgsForCall[i] - return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3 -} - -func (fake *ResourceManagement) LifecycleCheckCCCommitReadinessReturns(result1 resmgmt.LifecycleCheckCCCommitReadinessResponse, result2 error) { - fake.lifecycleCheckCCCommitReadinessMutex.Lock() - defer fake.lifecycleCheckCCCommitReadinessMutex.Unlock() - fake.LifecycleCheckCCCommitReadinessStub = nil - fake.lifecycleCheckCCCommitReadinessReturns = struct { - result1 resmgmt.LifecycleCheckCCCommitReadinessResponse - result2 error - }{result1, result2} -} - -func (fake *ResourceManagement) LifecycleCheckCCCommitReadinessReturnsOnCall(i int, result1 resmgmt.LifecycleCheckCCCommitReadinessResponse, result2 error) { - fake.lifecycleCheckCCCommitReadinessMutex.Lock() - defer fake.lifecycleCheckCCCommitReadinessMutex.Unlock() - fake.LifecycleCheckCCCommitReadinessStub = nil - if fake.lifecycleCheckCCCommitReadinessReturnsOnCall == nil { - fake.lifecycleCheckCCCommitReadinessReturnsOnCall = make(map[int]struct { - result1 resmgmt.LifecycleCheckCCCommitReadinessResponse - result2 error - }) - } - fake.lifecycleCheckCCCommitReadinessReturnsOnCall[i] = struct { - result1 resmgmt.LifecycleCheckCCCommitReadinessResponse - result2 error - }{result1, result2} -} - -func (fake *ResourceManagement) LifecycleCommitCC(arg1 string, arg2 resmgmt.LifecycleCommitCCRequest, arg3 ...resmgmt.RequestOption) (fab.TransactionID, error) { - fake.lifecycleCommitCCMutex.Lock() - ret, specificReturn := fake.lifecycleCommitCCReturnsOnCall[len(fake.lifecycleCommitCCArgsForCall)] - fake.lifecycleCommitCCArgsForCall = append(fake.lifecycleCommitCCArgsForCall, struct { - arg1 string - arg2 resmgmt.LifecycleCommitCCRequest - arg3 []resmgmt.RequestOption - }{arg1, arg2, arg3}) - fake.recordInvocation("LifecycleCommitCC", []interface{}{arg1, arg2, arg3}) - fake.lifecycleCommitCCMutex.Unlock() - if fake.LifecycleCommitCCStub != nil { - return fake.LifecycleCommitCCStub(arg1, arg2, arg3...) - } - if specificReturn { - return ret.result1, ret.result2 - } - fakeReturns := fake.lifecycleCommitCCReturns - return fakeReturns.result1, fakeReturns.result2 -} - -func (fake *ResourceManagement) LifecycleCommitCCCallCount() int { - fake.lifecycleCommitCCMutex.RLock() - defer fake.lifecycleCommitCCMutex.RUnlock() - return len(fake.lifecycleCommitCCArgsForCall) -} - -func (fake *ResourceManagement) LifecycleCommitCCCalls(stub func(string, resmgmt.LifecycleCommitCCRequest, ...resmgmt.RequestOption) (fab.TransactionID, error)) { - fake.lifecycleCommitCCMutex.Lock() - defer fake.lifecycleCommitCCMutex.Unlock() - fake.LifecycleCommitCCStub = stub -} - -func (fake *ResourceManagement) LifecycleCommitCCArgsForCall(i int) (string, resmgmt.LifecycleCommitCCRequest, []resmgmt.RequestOption) { - fake.lifecycleCommitCCMutex.RLock() - defer fake.lifecycleCommitCCMutex.RUnlock() - argsForCall := fake.lifecycleCommitCCArgsForCall[i] - return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3 -} - -func (fake *ResourceManagement) LifecycleCommitCCReturns(result1 fab.TransactionID, result2 error) { - fake.lifecycleCommitCCMutex.Lock() - defer fake.lifecycleCommitCCMutex.Unlock() - fake.LifecycleCommitCCStub = nil - fake.lifecycleCommitCCReturns = struct { - result1 fab.TransactionID - result2 error - }{result1, result2} -} - -func (fake *ResourceManagement) LifecycleCommitCCReturnsOnCall(i int, result1 fab.TransactionID, result2 error) { - fake.lifecycleCommitCCMutex.Lock() - defer fake.lifecycleCommitCCMutex.Unlock() - fake.LifecycleCommitCCStub = nil - if fake.lifecycleCommitCCReturnsOnCall == nil { - fake.lifecycleCommitCCReturnsOnCall = make(map[int]struct { - result1 fab.TransactionID - result2 error - }) - } - fake.lifecycleCommitCCReturnsOnCall[i] = struct { - result1 fab.TransactionID - result2 error - }{result1, result2} -} - -func (fake *ResourceManagement) LifecycleGetInstalledCCPackage(arg1 string, arg2 ...resmgmt.RequestOption) ([]byte, error) { - fake.lifecycleGetInstalledCCPackageMutex.Lock() - ret, specificReturn := fake.lifecycleGetInstalledCCPackageReturnsOnCall[len(fake.lifecycleGetInstalledCCPackageArgsForCall)] - fake.lifecycleGetInstalledCCPackageArgsForCall = append(fake.lifecycleGetInstalledCCPackageArgsForCall, struct { - arg1 string - arg2 []resmgmt.RequestOption - }{arg1, arg2}) - fake.recordInvocation("LifecycleGetInstalledCCPackage", []interface{}{arg1, arg2}) - fake.lifecycleGetInstalledCCPackageMutex.Unlock() - if fake.LifecycleGetInstalledCCPackageStub != nil { - return fake.LifecycleGetInstalledCCPackageStub(arg1, arg2...) - } - if specificReturn { - return ret.result1, ret.result2 - } - fakeReturns := fake.lifecycleGetInstalledCCPackageReturns - return fakeReturns.result1, fakeReturns.result2 -} - -func (fake *ResourceManagement) LifecycleGetInstalledCCPackageCallCount() int { - fake.lifecycleGetInstalledCCPackageMutex.RLock() - defer fake.lifecycleGetInstalledCCPackageMutex.RUnlock() - return len(fake.lifecycleGetInstalledCCPackageArgsForCall) -} - -func (fake *ResourceManagement) LifecycleGetInstalledCCPackageCalls(stub func(string, ...resmgmt.RequestOption) ([]byte, error)) { - fake.lifecycleGetInstalledCCPackageMutex.Lock() - defer fake.lifecycleGetInstalledCCPackageMutex.Unlock() - fake.LifecycleGetInstalledCCPackageStub = stub -} - -func (fake *ResourceManagement) LifecycleGetInstalledCCPackageArgsForCall(i int) (string, []resmgmt.RequestOption) { - fake.lifecycleGetInstalledCCPackageMutex.RLock() - defer fake.lifecycleGetInstalledCCPackageMutex.RUnlock() - argsForCall := fake.lifecycleGetInstalledCCPackageArgsForCall[i] - return argsForCall.arg1, argsForCall.arg2 -} - -func (fake *ResourceManagement) LifecycleGetInstalledCCPackageReturns(result1 []byte, result2 error) { - fake.lifecycleGetInstalledCCPackageMutex.Lock() - defer fake.lifecycleGetInstalledCCPackageMutex.Unlock() - fake.LifecycleGetInstalledCCPackageStub = nil - fake.lifecycleGetInstalledCCPackageReturns = struct { - result1 []byte - result2 error - }{result1, result2} -} - -func (fake *ResourceManagement) LifecycleGetInstalledCCPackageReturnsOnCall(i int, result1 []byte, result2 error) { - fake.lifecycleGetInstalledCCPackageMutex.Lock() - defer fake.lifecycleGetInstalledCCPackageMutex.Unlock() - fake.LifecycleGetInstalledCCPackageStub = nil - if fake.lifecycleGetInstalledCCPackageReturnsOnCall == nil { - fake.lifecycleGetInstalledCCPackageReturnsOnCall = make(map[int]struct { - result1 []byte - result2 error - }) - } - fake.lifecycleGetInstalledCCPackageReturnsOnCall[i] = struct { - result1 []byte - result2 error - }{result1, result2} -} - -func (fake *ResourceManagement) LifecycleInstallCC(arg1 resmgmt.LifecycleInstallCCRequest, arg2 ...resmgmt.RequestOption) ([]resmgmt.LifecycleInstallCCResponse, error) { - fake.lifecycleInstallCCMutex.Lock() - ret, specificReturn := fake.lifecycleInstallCCReturnsOnCall[len(fake.lifecycleInstallCCArgsForCall)] - fake.lifecycleInstallCCArgsForCall = append(fake.lifecycleInstallCCArgsForCall, struct { - arg1 resmgmt.LifecycleInstallCCRequest - arg2 []resmgmt.RequestOption - }{arg1, arg2}) - fake.recordInvocation("LifecycleInstallCC", []interface{}{arg1, arg2}) - fake.lifecycleInstallCCMutex.Unlock() - if fake.LifecycleInstallCCStub != nil { - return fake.LifecycleInstallCCStub(arg1, arg2...) - } - if specificReturn { - return ret.result1, ret.result2 - } - fakeReturns := fake.lifecycleInstallCCReturns - return fakeReturns.result1, fakeReturns.result2 -} - -func (fake *ResourceManagement) LifecycleInstallCCCallCount() int { - fake.lifecycleInstallCCMutex.RLock() - defer fake.lifecycleInstallCCMutex.RUnlock() - return len(fake.lifecycleInstallCCArgsForCall) -} - -func (fake *ResourceManagement) LifecycleInstallCCCalls(stub func(resmgmt.LifecycleInstallCCRequest, ...resmgmt.RequestOption) ([]resmgmt.LifecycleInstallCCResponse, error)) { - fake.lifecycleInstallCCMutex.Lock() - defer fake.lifecycleInstallCCMutex.Unlock() - fake.LifecycleInstallCCStub = stub -} - -func (fake *ResourceManagement) LifecycleInstallCCArgsForCall(i int) (resmgmt.LifecycleInstallCCRequest, []resmgmt.RequestOption) { - fake.lifecycleInstallCCMutex.RLock() - defer fake.lifecycleInstallCCMutex.RUnlock() - argsForCall := fake.lifecycleInstallCCArgsForCall[i] - return argsForCall.arg1, argsForCall.arg2 -} - -func (fake *ResourceManagement) LifecycleInstallCCReturns(result1 []resmgmt.LifecycleInstallCCResponse, result2 error) { - fake.lifecycleInstallCCMutex.Lock() - defer fake.lifecycleInstallCCMutex.Unlock() - fake.LifecycleInstallCCStub = nil - fake.lifecycleInstallCCReturns = struct { - result1 []resmgmt.LifecycleInstallCCResponse - result2 error - }{result1, result2} -} - -func (fake *ResourceManagement) LifecycleInstallCCReturnsOnCall(i int, result1 []resmgmt.LifecycleInstallCCResponse, result2 error) { - fake.lifecycleInstallCCMutex.Lock() - defer fake.lifecycleInstallCCMutex.Unlock() - fake.LifecycleInstallCCStub = nil - if fake.lifecycleInstallCCReturnsOnCall == nil { - fake.lifecycleInstallCCReturnsOnCall = make(map[int]struct { - result1 []resmgmt.LifecycleInstallCCResponse - result2 error - }) - } - fake.lifecycleInstallCCReturnsOnCall[i] = struct { - result1 []resmgmt.LifecycleInstallCCResponse - result2 error - }{result1, result2} -} - -func (fake *ResourceManagement) LifecycleQueryApprovedCC(arg1 string, arg2 resmgmt.LifecycleQueryApprovedCCRequest, arg3 ...resmgmt.RequestOption) (resmgmt.LifecycleApprovedChaincodeDefinition, error) { - fake.lifecycleQueryApprovedCCMutex.Lock() - ret, specificReturn := fake.lifecycleQueryApprovedCCReturnsOnCall[len(fake.lifecycleQueryApprovedCCArgsForCall)] - fake.lifecycleQueryApprovedCCArgsForCall = append(fake.lifecycleQueryApprovedCCArgsForCall, struct { - arg1 string - arg2 resmgmt.LifecycleQueryApprovedCCRequest - arg3 []resmgmt.RequestOption - }{arg1, arg2, arg3}) - fake.recordInvocation("LifecycleQueryApprovedCC", []interface{}{arg1, arg2, arg3}) - fake.lifecycleQueryApprovedCCMutex.Unlock() - if fake.LifecycleQueryApprovedCCStub != nil { - return fake.LifecycleQueryApprovedCCStub(arg1, arg2, arg3...) - } - if specificReturn { - return ret.result1, ret.result2 - } - fakeReturns := fake.lifecycleQueryApprovedCCReturns - return fakeReturns.result1, fakeReturns.result2 -} - -func (fake *ResourceManagement) LifecycleQueryApprovedCCCallCount() int { - fake.lifecycleQueryApprovedCCMutex.RLock() - defer fake.lifecycleQueryApprovedCCMutex.RUnlock() - return len(fake.lifecycleQueryApprovedCCArgsForCall) -} - -func (fake *ResourceManagement) LifecycleQueryApprovedCCCalls(stub func(string, resmgmt.LifecycleQueryApprovedCCRequest, ...resmgmt.RequestOption) (resmgmt.LifecycleApprovedChaincodeDefinition, error)) { - fake.lifecycleQueryApprovedCCMutex.Lock() - defer fake.lifecycleQueryApprovedCCMutex.Unlock() - fake.LifecycleQueryApprovedCCStub = stub -} - -func (fake *ResourceManagement) LifecycleQueryApprovedCCArgsForCall(i int) (string, resmgmt.LifecycleQueryApprovedCCRequest, []resmgmt.RequestOption) { - fake.lifecycleQueryApprovedCCMutex.RLock() - defer fake.lifecycleQueryApprovedCCMutex.RUnlock() - argsForCall := fake.lifecycleQueryApprovedCCArgsForCall[i] - return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3 -} - -func (fake *ResourceManagement) LifecycleQueryApprovedCCReturns(result1 resmgmt.LifecycleApprovedChaincodeDefinition, result2 error) { - fake.lifecycleQueryApprovedCCMutex.Lock() - defer fake.lifecycleQueryApprovedCCMutex.Unlock() - fake.LifecycleQueryApprovedCCStub = nil - fake.lifecycleQueryApprovedCCReturns = struct { - result1 resmgmt.LifecycleApprovedChaincodeDefinition - result2 error - }{result1, result2} -} - -func (fake *ResourceManagement) LifecycleQueryApprovedCCReturnsOnCall(i int, result1 resmgmt.LifecycleApprovedChaincodeDefinition, result2 error) { - fake.lifecycleQueryApprovedCCMutex.Lock() - defer fake.lifecycleQueryApprovedCCMutex.Unlock() - fake.LifecycleQueryApprovedCCStub = nil - if fake.lifecycleQueryApprovedCCReturnsOnCall == nil { - fake.lifecycleQueryApprovedCCReturnsOnCall = make(map[int]struct { - result1 resmgmt.LifecycleApprovedChaincodeDefinition - result2 error - }) - } - fake.lifecycleQueryApprovedCCReturnsOnCall[i] = struct { - result1 resmgmt.LifecycleApprovedChaincodeDefinition - result2 error - }{result1, result2} -} - -func (fake *ResourceManagement) LifecycleQueryCommittedCC(arg1 string, arg2 resmgmt.LifecycleQueryCommittedCCRequest, arg3 ...resmgmt.RequestOption) ([]resmgmt.LifecycleChaincodeDefinition, error) { - fake.lifecycleQueryCommittedCCMutex.Lock() - ret, specificReturn := fake.lifecycleQueryCommittedCCReturnsOnCall[len(fake.lifecycleQueryCommittedCCArgsForCall)] - fake.lifecycleQueryCommittedCCArgsForCall = append(fake.lifecycleQueryCommittedCCArgsForCall, struct { - arg1 string - arg2 resmgmt.LifecycleQueryCommittedCCRequest - arg3 []resmgmt.RequestOption - }{arg1, arg2, arg3}) - fake.recordInvocation("LifecycleQueryCommittedCC", []interface{}{arg1, arg2, arg3}) - fake.lifecycleQueryCommittedCCMutex.Unlock() - if fake.LifecycleQueryCommittedCCStub != nil { - return fake.LifecycleQueryCommittedCCStub(arg1, arg2, arg3...) - } - if specificReturn { - return ret.result1, ret.result2 - } - fakeReturns := fake.lifecycleQueryCommittedCCReturns - return fakeReturns.result1, fakeReturns.result2 -} - -func (fake *ResourceManagement) LifecycleQueryCommittedCCCallCount() int { - fake.lifecycleQueryCommittedCCMutex.RLock() - defer fake.lifecycleQueryCommittedCCMutex.RUnlock() - return len(fake.lifecycleQueryCommittedCCArgsForCall) -} - -func (fake *ResourceManagement) LifecycleQueryCommittedCCCalls(stub func(string, resmgmt.LifecycleQueryCommittedCCRequest, ...resmgmt.RequestOption) ([]resmgmt.LifecycleChaincodeDefinition, error)) { - fake.lifecycleQueryCommittedCCMutex.Lock() - defer fake.lifecycleQueryCommittedCCMutex.Unlock() - fake.LifecycleQueryCommittedCCStub = stub -} - -func (fake *ResourceManagement) LifecycleQueryCommittedCCArgsForCall(i int) (string, resmgmt.LifecycleQueryCommittedCCRequest, []resmgmt.RequestOption) { - fake.lifecycleQueryCommittedCCMutex.RLock() - defer fake.lifecycleQueryCommittedCCMutex.RUnlock() - argsForCall := fake.lifecycleQueryCommittedCCArgsForCall[i] - return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3 -} - -func (fake *ResourceManagement) LifecycleQueryCommittedCCReturns(result1 []resmgmt.LifecycleChaincodeDefinition, result2 error) { - fake.lifecycleQueryCommittedCCMutex.Lock() - defer fake.lifecycleQueryCommittedCCMutex.Unlock() - fake.LifecycleQueryCommittedCCStub = nil - fake.lifecycleQueryCommittedCCReturns = struct { - result1 []resmgmt.LifecycleChaincodeDefinition - result2 error - }{result1, result2} -} - -func (fake *ResourceManagement) LifecycleQueryCommittedCCReturnsOnCall(i int, result1 []resmgmt.LifecycleChaincodeDefinition, result2 error) { - fake.lifecycleQueryCommittedCCMutex.Lock() - defer fake.lifecycleQueryCommittedCCMutex.Unlock() - fake.LifecycleQueryCommittedCCStub = nil - if fake.lifecycleQueryCommittedCCReturnsOnCall == nil { - fake.lifecycleQueryCommittedCCReturnsOnCall = make(map[int]struct { - result1 []resmgmt.LifecycleChaincodeDefinition - result2 error - }) - } - fake.lifecycleQueryCommittedCCReturnsOnCall[i] = struct { - result1 []resmgmt.LifecycleChaincodeDefinition - result2 error - }{result1, result2} -} - -func (fake *ResourceManagement) LifecycleQueryInstalledCC(arg1 ...resmgmt.RequestOption) ([]resmgmt.LifecycleInstalledCC, error) { - fake.lifecycleQueryInstalledCCMutex.Lock() - ret, specificReturn := fake.lifecycleQueryInstalledCCReturnsOnCall[len(fake.lifecycleQueryInstalledCCArgsForCall)] - fake.lifecycleQueryInstalledCCArgsForCall = append(fake.lifecycleQueryInstalledCCArgsForCall, struct { - arg1 []resmgmt.RequestOption - }{arg1}) - fake.recordInvocation("LifecycleQueryInstalledCC", []interface{}{arg1}) - fake.lifecycleQueryInstalledCCMutex.Unlock() - if fake.LifecycleQueryInstalledCCStub != nil { - return fake.LifecycleQueryInstalledCCStub(arg1...) - } - if specificReturn { - return ret.result1, ret.result2 - } - fakeReturns := fake.lifecycleQueryInstalledCCReturns - return fakeReturns.result1, fakeReturns.result2 -} - -func (fake *ResourceManagement) LifecycleQueryInstalledCCCallCount() int { - fake.lifecycleQueryInstalledCCMutex.RLock() - defer fake.lifecycleQueryInstalledCCMutex.RUnlock() - return len(fake.lifecycleQueryInstalledCCArgsForCall) -} - -func (fake *ResourceManagement) LifecycleQueryInstalledCCCalls(stub func(...resmgmt.RequestOption) ([]resmgmt.LifecycleInstalledCC, error)) { - fake.lifecycleQueryInstalledCCMutex.Lock() - defer fake.lifecycleQueryInstalledCCMutex.Unlock() - fake.LifecycleQueryInstalledCCStub = stub -} - -func (fake *ResourceManagement) LifecycleQueryInstalledCCArgsForCall(i int) []resmgmt.RequestOption { - fake.lifecycleQueryInstalledCCMutex.RLock() - defer fake.lifecycleQueryInstalledCCMutex.RUnlock() - argsForCall := fake.lifecycleQueryInstalledCCArgsForCall[i] - return argsForCall.arg1 -} - -func (fake *ResourceManagement) LifecycleQueryInstalledCCReturns(result1 []resmgmt.LifecycleInstalledCC, result2 error) { - fake.lifecycleQueryInstalledCCMutex.Lock() - defer fake.lifecycleQueryInstalledCCMutex.Unlock() - fake.LifecycleQueryInstalledCCStub = nil - fake.lifecycleQueryInstalledCCReturns = struct { - result1 []resmgmt.LifecycleInstalledCC - result2 error - }{result1, result2} -} - -func (fake *ResourceManagement) LifecycleQueryInstalledCCReturnsOnCall(i int, result1 []resmgmt.LifecycleInstalledCC, result2 error) { - fake.lifecycleQueryInstalledCCMutex.Lock() - defer fake.lifecycleQueryInstalledCCMutex.Unlock() - fake.LifecycleQueryInstalledCCStub = nil - if fake.lifecycleQueryInstalledCCReturnsOnCall == nil { - fake.lifecycleQueryInstalledCCReturnsOnCall = make(map[int]struct { - result1 []resmgmt.LifecycleInstalledCC - result2 error - }) - } - fake.lifecycleQueryInstalledCCReturnsOnCall[i] = struct { - result1 []resmgmt.LifecycleInstalledCC - result2 error - }{result1, result2} -} - -func (fake *ResourceManagement) QueryChannels(arg1 ...resmgmt.RequestOption) (*peer.ChannelQueryResponse, error) { - fake.queryChannelsMutex.Lock() - ret, specificReturn := fake.queryChannelsReturnsOnCall[len(fake.queryChannelsArgsForCall)] - fake.queryChannelsArgsForCall = append(fake.queryChannelsArgsForCall, struct { - arg1 []resmgmt.RequestOption - }{arg1}) - fake.recordInvocation("QueryChannels", []interface{}{arg1}) - fake.queryChannelsMutex.Unlock() - if fake.QueryChannelsStub != nil { - return fake.QueryChannelsStub(arg1...) - } - if specificReturn { - return ret.result1, ret.result2 - } - fakeReturns := fake.queryChannelsReturns - return fakeReturns.result1, fakeReturns.result2 -} - -func (fake *ResourceManagement) QueryChannelsCallCount() int { - fake.queryChannelsMutex.RLock() - defer fake.queryChannelsMutex.RUnlock() - return len(fake.queryChannelsArgsForCall) -} - -func (fake *ResourceManagement) QueryChannelsCalls(stub func(...resmgmt.RequestOption) (*peer.ChannelQueryResponse, error)) { - fake.queryChannelsMutex.Lock() - defer fake.queryChannelsMutex.Unlock() - fake.QueryChannelsStub = stub -} - -func (fake *ResourceManagement) QueryChannelsArgsForCall(i int) []resmgmt.RequestOption { - fake.queryChannelsMutex.RLock() - defer fake.queryChannelsMutex.RUnlock() - argsForCall := fake.queryChannelsArgsForCall[i] - return argsForCall.arg1 -} - -func (fake *ResourceManagement) QueryChannelsReturns(result1 *peer.ChannelQueryResponse, result2 error) { - fake.queryChannelsMutex.Lock() - defer fake.queryChannelsMutex.Unlock() - fake.QueryChannelsStub = nil - fake.queryChannelsReturns = struct { - result1 *peer.ChannelQueryResponse - result2 error - }{result1, result2} -} - -func (fake *ResourceManagement) QueryChannelsReturnsOnCall(i int, result1 *peer.ChannelQueryResponse, result2 error) { - fake.queryChannelsMutex.Lock() - defer fake.queryChannelsMutex.Unlock() - fake.QueryChannelsStub = nil - if fake.queryChannelsReturnsOnCall == nil { - fake.queryChannelsReturnsOnCall = make(map[int]struct { - result1 *peer.ChannelQueryResponse - result2 error - }) - } - fake.queryChannelsReturnsOnCall[i] = struct { - result1 *peer.ChannelQueryResponse - result2 error - }{result1, result2} -} - -func (fake *ResourceManagement) QueryCollectionsConfig(arg1 string, arg2 string, arg3 ...resmgmt.RequestOption) (*peer.CollectionConfigPackage, error) { - fake.queryCollectionsConfigMutex.Lock() - ret, specificReturn := fake.queryCollectionsConfigReturnsOnCall[len(fake.queryCollectionsConfigArgsForCall)] - fake.queryCollectionsConfigArgsForCall = append(fake.queryCollectionsConfigArgsForCall, struct { - arg1 string - arg2 string - arg3 []resmgmt.RequestOption - }{arg1, arg2, arg3}) - fake.recordInvocation("QueryCollectionsConfig", []interface{}{arg1, arg2, arg3}) - fake.queryCollectionsConfigMutex.Unlock() - if fake.QueryCollectionsConfigStub != nil { - return fake.QueryCollectionsConfigStub(arg1, arg2, arg3...) - } - if specificReturn { - return ret.result1, ret.result2 - } - fakeReturns := fake.queryCollectionsConfigReturns - return fakeReturns.result1, fakeReturns.result2 -} - -func (fake *ResourceManagement) QueryCollectionsConfigCallCount() int { - fake.queryCollectionsConfigMutex.RLock() - defer fake.queryCollectionsConfigMutex.RUnlock() - return len(fake.queryCollectionsConfigArgsForCall) -} - -func (fake *ResourceManagement) QueryCollectionsConfigCalls(stub func(string, string, ...resmgmt.RequestOption) (*peer.CollectionConfigPackage, error)) { - fake.queryCollectionsConfigMutex.Lock() - defer fake.queryCollectionsConfigMutex.Unlock() - fake.QueryCollectionsConfigStub = stub -} - -func (fake *ResourceManagement) QueryCollectionsConfigArgsForCall(i int) (string, string, []resmgmt.RequestOption) { - fake.queryCollectionsConfigMutex.RLock() - defer fake.queryCollectionsConfigMutex.RUnlock() - argsForCall := fake.queryCollectionsConfigArgsForCall[i] - return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3 -} - -func (fake *ResourceManagement) QueryCollectionsConfigReturns(result1 *peer.CollectionConfigPackage, result2 error) { - fake.queryCollectionsConfigMutex.Lock() - defer fake.queryCollectionsConfigMutex.Unlock() - fake.QueryCollectionsConfigStub = nil - fake.queryCollectionsConfigReturns = struct { - result1 *peer.CollectionConfigPackage - result2 error - }{result1, result2} -} - -func (fake *ResourceManagement) QueryCollectionsConfigReturnsOnCall(i int, result1 *peer.CollectionConfigPackage, result2 error) { - fake.queryCollectionsConfigMutex.Lock() - defer fake.queryCollectionsConfigMutex.Unlock() - fake.QueryCollectionsConfigStub = nil - if fake.queryCollectionsConfigReturnsOnCall == nil { - fake.queryCollectionsConfigReturnsOnCall = make(map[int]struct { - result1 *peer.CollectionConfigPackage - result2 error - }) - } - fake.queryCollectionsConfigReturnsOnCall[i] = struct { - result1 *peer.CollectionConfigPackage - result2 error - }{result1, result2} -} - -func (fake *ResourceManagement) QueryConfigFromOrderer(arg1 string, arg2 ...resmgmt.RequestOption) (fab.ChannelCfg, error) { - fake.queryConfigFromOrdererMutex.Lock() - ret, specificReturn := fake.queryConfigFromOrdererReturnsOnCall[len(fake.queryConfigFromOrdererArgsForCall)] - fake.queryConfigFromOrdererArgsForCall = append(fake.queryConfigFromOrdererArgsForCall, struct { - arg1 string - arg2 []resmgmt.RequestOption - }{arg1, arg2}) - fake.recordInvocation("QueryConfigFromOrderer", []interface{}{arg1, arg2}) - fake.queryConfigFromOrdererMutex.Unlock() - if fake.QueryConfigFromOrdererStub != nil { - return fake.QueryConfigFromOrdererStub(arg1, arg2...) - } - if specificReturn { - return ret.result1, ret.result2 - } - fakeReturns := fake.queryConfigFromOrdererReturns - return fakeReturns.result1, fakeReturns.result2 -} - -func (fake *ResourceManagement) QueryConfigFromOrdererCallCount() int { - fake.queryConfigFromOrdererMutex.RLock() - defer fake.queryConfigFromOrdererMutex.RUnlock() - return len(fake.queryConfigFromOrdererArgsForCall) -} - -func (fake *ResourceManagement) QueryConfigFromOrdererCalls(stub func(string, ...resmgmt.RequestOption) (fab.ChannelCfg, error)) { - fake.queryConfigFromOrdererMutex.Lock() - defer fake.queryConfigFromOrdererMutex.Unlock() - fake.QueryConfigFromOrdererStub = stub -} - -func (fake *ResourceManagement) QueryConfigFromOrdererArgsForCall(i int) (string, []resmgmt.RequestOption) { - fake.queryConfigFromOrdererMutex.RLock() - defer fake.queryConfigFromOrdererMutex.RUnlock() - argsForCall := fake.queryConfigFromOrdererArgsForCall[i] - return argsForCall.arg1, argsForCall.arg2 -} - -func (fake *ResourceManagement) QueryConfigFromOrdererReturns(result1 fab.ChannelCfg, result2 error) { - fake.queryConfigFromOrdererMutex.Lock() - defer fake.queryConfigFromOrdererMutex.Unlock() - fake.QueryConfigFromOrdererStub = nil - fake.queryConfigFromOrdererReturns = struct { - result1 fab.ChannelCfg - result2 error - }{result1, result2} -} - -func (fake *ResourceManagement) QueryConfigFromOrdererReturnsOnCall(i int, result1 fab.ChannelCfg, result2 error) { - fake.queryConfigFromOrdererMutex.Lock() - defer fake.queryConfigFromOrdererMutex.Unlock() - fake.QueryConfigFromOrdererStub = nil - if fake.queryConfigFromOrdererReturnsOnCall == nil { - fake.queryConfigFromOrdererReturnsOnCall = make(map[int]struct { - result1 fab.ChannelCfg - result2 error - }) - } - fake.queryConfigFromOrdererReturnsOnCall[i] = struct { - result1 fab.ChannelCfg - result2 error - }{result1, result2} -} - -func (fake *ResourceManagement) QueryInstalledChaincodes(arg1 ...resmgmt.RequestOption) (*peer.ChaincodeQueryResponse, error) { - fake.queryInstalledChaincodesMutex.Lock() - ret, specificReturn := fake.queryInstalledChaincodesReturnsOnCall[len(fake.queryInstalledChaincodesArgsForCall)] - fake.queryInstalledChaincodesArgsForCall = append(fake.queryInstalledChaincodesArgsForCall, struct { - arg1 []resmgmt.RequestOption - }{arg1}) - fake.recordInvocation("QueryInstalledChaincodes", []interface{}{arg1}) - fake.queryInstalledChaincodesMutex.Unlock() - if fake.QueryInstalledChaincodesStub != nil { - return fake.QueryInstalledChaincodesStub(arg1...) - } - if specificReturn { - return ret.result1, ret.result2 - } - fakeReturns := fake.queryInstalledChaincodesReturns - return fakeReturns.result1, fakeReturns.result2 -} - -func (fake *ResourceManagement) QueryInstalledChaincodesCallCount() int { - fake.queryInstalledChaincodesMutex.RLock() - defer fake.queryInstalledChaincodesMutex.RUnlock() - return len(fake.queryInstalledChaincodesArgsForCall) -} - -func (fake *ResourceManagement) QueryInstalledChaincodesCalls(stub func(...resmgmt.RequestOption) (*peer.ChaincodeQueryResponse, error)) { - fake.queryInstalledChaincodesMutex.Lock() - defer fake.queryInstalledChaincodesMutex.Unlock() - fake.QueryInstalledChaincodesStub = stub -} - -func (fake *ResourceManagement) QueryInstalledChaincodesArgsForCall(i int) []resmgmt.RequestOption { - fake.queryInstalledChaincodesMutex.RLock() - defer fake.queryInstalledChaincodesMutex.RUnlock() - argsForCall := fake.queryInstalledChaincodesArgsForCall[i] - return argsForCall.arg1 -} - -func (fake *ResourceManagement) QueryInstalledChaincodesReturns(result1 *peer.ChaincodeQueryResponse, result2 error) { - fake.queryInstalledChaincodesMutex.Lock() - defer fake.queryInstalledChaincodesMutex.Unlock() - fake.QueryInstalledChaincodesStub = nil - fake.queryInstalledChaincodesReturns = struct { - result1 *peer.ChaincodeQueryResponse - result2 error - }{result1, result2} -} - -func (fake *ResourceManagement) QueryInstalledChaincodesReturnsOnCall(i int, result1 *peer.ChaincodeQueryResponse, result2 error) { - fake.queryInstalledChaincodesMutex.Lock() - defer fake.queryInstalledChaincodesMutex.Unlock() - fake.QueryInstalledChaincodesStub = nil - if fake.queryInstalledChaincodesReturnsOnCall == nil { - fake.queryInstalledChaincodesReturnsOnCall = make(map[int]struct { - result1 *peer.ChaincodeQueryResponse - result2 error - }) - } - fake.queryInstalledChaincodesReturnsOnCall[i] = struct { - result1 *peer.ChaincodeQueryResponse - result2 error - }{result1, result2} -} - -func (fake *ResourceManagement) QueryInstantiatedChaincodes(arg1 string, arg2 ...resmgmt.RequestOption) (*peer.ChaincodeQueryResponse, error) { - fake.queryInstantiatedChaincodesMutex.Lock() - ret, specificReturn := fake.queryInstantiatedChaincodesReturnsOnCall[len(fake.queryInstantiatedChaincodesArgsForCall)] - fake.queryInstantiatedChaincodesArgsForCall = append(fake.queryInstantiatedChaincodesArgsForCall, struct { - arg1 string - arg2 []resmgmt.RequestOption - }{arg1, arg2}) - fake.recordInvocation("QueryInstantiatedChaincodes", []interface{}{arg1, arg2}) - fake.queryInstantiatedChaincodesMutex.Unlock() - if fake.QueryInstantiatedChaincodesStub != nil { - return fake.QueryInstantiatedChaincodesStub(arg1, arg2...) - } - if specificReturn { - return ret.result1, ret.result2 - } - fakeReturns := fake.queryInstantiatedChaincodesReturns - return fakeReturns.result1, fakeReturns.result2 -} - -func (fake *ResourceManagement) QueryInstantiatedChaincodesCallCount() int { - fake.queryInstantiatedChaincodesMutex.RLock() - defer fake.queryInstantiatedChaincodesMutex.RUnlock() - return len(fake.queryInstantiatedChaincodesArgsForCall) -} - -func (fake *ResourceManagement) QueryInstantiatedChaincodesCalls(stub func(string, ...resmgmt.RequestOption) (*peer.ChaincodeQueryResponse, error)) { - fake.queryInstantiatedChaincodesMutex.Lock() - defer fake.queryInstantiatedChaincodesMutex.Unlock() - fake.QueryInstantiatedChaincodesStub = stub -} - -func (fake *ResourceManagement) QueryInstantiatedChaincodesArgsForCall(i int) (string, []resmgmt.RequestOption) { - fake.queryInstantiatedChaincodesMutex.RLock() - defer fake.queryInstantiatedChaincodesMutex.RUnlock() - argsForCall := fake.queryInstantiatedChaincodesArgsForCall[i] - return argsForCall.arg1, argsForCall.arg2 -} - -func (fake *ResourceManagement) QueryInstantiatedChaincodesReturns(result1 *peer.ChaincodeQueryResponse, result2 error) { - fake.queryInstantiatedChaincodesMutex.Lock() - defer fake.queryInstantiatedChaincodesMutex.Unlock() - fake.QueryInstantiatedChaincodesStub = nil - fake.queryInstantiatedChaincodesReturns = struct { - result1 *peer.ChaincodeQueryResponse - result2 error - }{result1, result2} -} - -func (fake *ResourceManagement) QueryInstantiatedChaincodesReturnsOnCall(i int, result1 *peer.ChaincodeQueryResponse, result2 error) { - fake.queryInstantiatedChaincodesMutex.Lock() - defer fake.queryInstantiatedChaincodesMutex.Unlock() - fake.QueryInstantiatedChaincodesStub = nil - if fake.queryInstantiatedChaincodesReturnsOnCall == nil { - fake.queryInstantiatedChaincodesReturnsOnCall = make(map[int]struct { - result1 *peer.ChaincodeQueryResponse - result2 error - }) - } - fake.queryInstantiatedChaincodesReturnsOnCall[i] = struct { - result1 *peer.ChaincodeQueryResponse - result2 error - }{result1, result2} -} - -func (fake *ResourceManagement) SaveChannel(arg1 resmgmt.SaveChannelRequest, arg2 ...resmgmt.RequestOption) (resmgmt.SaveChannelResponse, error) { - fake.saveChannelMutex.Lock() - ret, specificReturn := fake.saveChannelReturnsOnCall[len(fake.saveChannelArgsForCall)] - fake.saveChannelArgsForCall = append(fake.saveChannelArgsForCall, struct { - arg1 resmgmt.SaveChannelRequest - arg2 []resmgmt.RequestOption - }{arg1, arg2}) - fake.recordInvocation("SaveChannel", []interface{}{arg1, arg2}) - fake.saveChannelMutex.Unlock() - if fake.SaveChannelStub != nil { - return fake.SaveChannelStub(arg1, arg2...) - } - if specificReturn { - return ret.result1, ret.result2 - } - fakeReturns := fake.saveChannelReturns - return fakeReturns.result1, fakeReturns.result2 -} - -func (fake *ResourceManagement) SaveChannelCallCount() int { - fake.saveChannelMutex.RLock() - defer fake.saveChannelMutex.RUnlock() - return len(fake.saveChannelArgsForCall) -} - -func (fake *ResourceManagement) SaveChannelCalls(stub func(resmgmt.SaveChannelRequest, ...resmgmt.RequestOption) (resmgmt.SaveChannelResponse, error)) { - fake.saveChannelMutex.Lock() - defer fake.saveChannelMutex.Unlock() - fake.SaveChannelStub = stub -} - -func (fake *ResourceManagement) SaveChannelArgsForCall(i int) (resmgmt.SaveChannelRequest, []resmgmt.RequestOption) { - fake.saveChannelMutex.RLock() - defer fake.saveChannelMutex.RUnlock() - argsForCall := fake.saveChannelArgsForCall[i] - return argsForCall.arg1, argsForCall.arg2 -} - -func (fake *ResourceManagement) SaveChannelReturns(result1 resmgmt.SaveChannelResponse, result2 error) { - fake.saveChannelMutex.Lock() - defer fake.saveChannelMutex.Unlock() - fake.SaveChannelStub = nil - fake.saveChannelReturns = struct { - result1 resmgmt.SaveChannelResponse - result2 error - }{result1, result2} -} - -func (fake *ResourceManagement) SaveChannelReturnsOnCall(i int, result1 resmgmt.SaveChannelResponse, result2 error) { - fake.saveChannelMutex.Lock() - defer fake.saveChannelMutex.Unlock() - fake.SaveChannelStub = nil - if fake.saveChannelReturnsOnCall == nil { - fake.saveChannelReturnsOnCall = make(map[int]struct { - result1 resmgmt.SaveChannelResponse - result2 error - }) - } - fake.saveChannelReturnsOnCall[i] = struct { - result1 resmgmt.SaveChannelResponse - result2 error - }{result1, result2} -} - -func (fake *ResourceManagement) UpgradeCC(arg1 string, arg2 resmgmt.UpgradeCCRequest, arg3 ...resmgmt.RequestOption) (resmgmt.UpgradeCCResponse, error) { - fake.upgradeCCMutex.Lock() - ret, specificReturn := fake.upgradeCCReturnsOnCall[len(fake.upgradeCCArgsForCall)] - fake.upgradeCCArgsForCall = append(fake.upgradeCCArgsForCall, struct { - arg1 string - arg2 resmgmt.UpgradeCCRequest - arg3 []resmgmt.RequestOption - }{arg1, arg2, arg3}) - fake.recordInvocation("UpgradeCC", []interface{}{arg1, arg2, arg3}) - fake.upgradeCCMutex.Unlock() - if fake.UpgradeCCStub != nil { - return fake.UpgradeCCStub(arg1, arg2, arg3...) - } - if specificReturn { - return ret.result1, ret.result2 - } - fakeReturns := fake.upgradeCCReturns - return fakeReturns.result1, fakeReturns.result2 -} - -func (fake *ResourceManagement) UpgradeCCCallCount() int { - fake.upgradeCCMutex.RLock() - defer fake.upgradeCCMutex.RUnlock() - return len(fake.upgradeCCArgsForCall) -} - -func (fake *ResourceManagement) UpgradeCCCalls(stub func(string, resmgmt.UpgradeCCRequest, ...resmgmt.RequestOption) (resmgmt.UpgradeCCResponse, error)) { - fake.upgradeCCMutex.Lock() - defer fake.upgradeCCMutex.Unlock() - fake.UpgradeCCStub = stub -} - -func (fake *ResourceManagement) UpgradeCCArgsForCall(i int) (string, resmgmt.UpgradeCCRequest, []resmgmt.RequestOption) { - fake.upgradeCCMutex.RLock() - defer fake.upgradeCCMutex.RUnlock() - argsForCall := fake.upgradeCCArgsForCall[i] - return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3 -} - -func (fake *ResourceManagement) UpgradeCCReturns(result1 resmgmt.UpgradeCCResponse, result2 error) { - fake.upgradeCCMutex.Lock() - defer fake.upgradeCCMutex.Unlock() - fake.UpgradeCCStub = nil - fake.upgradeCCReturns = struct { - result1 resmgmt.UpgradeCCResponse - result2 error - }{result1, result2} -} - -func (fake *ResourceManagement) UpgradeCCReturnsOnCall(i int, result1 resmgmt.UpgradeCCResponse, result2 error) { - fake.upgradeCCMutex.Lock() - defer fake.upgradeCCMutex.Unlock() - fake.UpgradeCCStub = nil - if fake.upgradeCCReturnsOnCall == nil { - fake.upgradeCCReturnsOnCall = make(map[int]struct { - result1 resmgmt.UpgradeCCResponse - result2 error - }) - } - fake.upgradeCCReturnsOnCall[i] = struct { - result1 resmgmt.UpgradeCCResponse - result2 error - }{result1, result2} -} - -func (fake *ResourceManagement) Invocations() map[string][][]interface{} { - fake.invocationsMutex.RLock() - defer fake.invocationsMutex.RUnlock() - fake.createConfigSignatureMutex.RLock() - defer fake.createConfigSignatureMutex.RUnlock() - fake.createConfigSignatureDataMutex.RLock() - defer fake.createConfigSignatureDataMutex.RUnlock() - fake.installCCMutex.RLock() - defer fake.installCCMutex.RUnlock() - fake.instantiateCCMutex.RLock() - defer fake.instantiateCCMutex.RUnlock() - fake.joinChannelMutex.RLock() - defer fake.joinChannelMutex.RUnlock() - fake.lifecycleApproveCCMutex.RLock() - defer fake.lifecycleApproveCCMutex.RUnlock() - fake.lifecycleCheckCCCommitReadinessMutex.RLock() - defer fake.lifecycleCheckCCCommitReadinessMutex.RUnlock() - fake.lifecycleCommitCCMutex.RLock() - defer fake.lifecycleCommitCCMutex.RUnlock() - fake.lifecycleGetInstalledCCPackageMutex.RLock() - defer fake.lifecycleGetInstalledCCPackageMutex.RUnlock() - fake.lifecycleInstallCCMutex.RLock() - defer fake.lifecycleInstallCCMutex.RUnlock() - fake.lifecycleQueryApprovedCCMutex.RLock() - defer fake.lifecycleQueryApprovedCCMutex.RUnlock() - fake.lifecycleQueryCommittedCCMutex.RLock() - defer fake.lifecycleQueryCommittedCCMutex.RUnlock() - fake.lifecycleQueryInstalledCCMutex.RLock() - defer fake.lifecycleQueryInstalledCCMutex.RUnlock() - fake.queryChannelsMutex.RLock() - defer fake.queryChannelsMutex.RUnlock() - fake.queryCollectionsConfigMutex.RLock() - defer fake.queryCollectionsConfigMutex.RUnlock() - fake.queryConfigFromOrdererMutex.RLock() - defer fake.queryConfigFromOrdererMutex.RUnlock() - fake.queryInstalledChaincodesMutex.RLock() - defer fake.queryInstalledChaincodesMutex.RUnlock() - fake.queryInstantiatedChaincodesMutex.RLock() - defer fake.queryInstantiatedChaincodesMutex.RUnlock() - fake.saveChannelMutex.RLock() - defer fake.saveChannelMutex.RUnlock() - fake.upgradeCCMutex.RLock() - defer fake.upgradeCCMutex.RUnlock() - copiedInvocations := map[string][][]interface{}{} - for key, value := range fake.invocations { - copiedInvocations[key] = value - } - return copiedInvocations -} - -func (fake *ResourceManagement) recordInvocation(key string, args []interface{}) { - fake.invocationsMutex.Lock() - defer fake.invocationsMutex.Unlock() - if fake.invocations == nil { - fake.invocations = map[string][][]interface{}{} - } - if fake.invocations[key] == nil { - fake.invocations[key] = [][]interface{}{} - } - fake.invocations[key] = append(fake.invocations[key], args) -} - -var _ fabric.ResourceManagement = new(ResourceManagement) From bf1d07a42c5268509f913fcb3dc9566e43670b0e Mon Sep 17 00:00:00 2001 From: Sam Yuan Date: Mon, 2 Oct 2023 22:07:04 +0800 Subject: [PATCH 2/2] try to make the code ready Signed-off-by: Sam Yuan --- .github/workflows/golang.yml | 48 ++++++++++++++++++++++++ .github/workflows/pull_request.yml | 22 +++++++++++ .github/workflows/push.yml | 10 +++++ .github/workflows/schedule.yml | 9 +++++ .github/workflows/vulnerability-scan.yml | 27 +++++++++++++ ci/azure-pipelines.yml | 37 ------------------ ci/install_deps.yml | 18 --------- cmd/commands/chaincode/events.go | 5 +-- cmd/commands/chaincode/package_test.go | 2 +- cmd/commands/channel/channel.go | 22 ++--------- cmd/commands/channel/config.go | 5 +-- cmd/commands/channel/list.go | 26 +++++-------- cmd/commands/commands_test.go | 2 +- cmd/commands/context/context_test.go | 2 +- cmd/commands/context/delete_test.go | 2 +- cmd/commands/context/list_test.go | 2 +- cmd/commands/context/set_test.go | 2 +- cmd/commands/context/use_test.go | 2 +- cmd/commands/context/view_test.go | 2 +- cmd/commands/lifecycle/package_test.go | 2 +- cmd/commands/plugin/install_test.go | 2 +- cmd/commands/plugin/list_test.go | 2 +- cmd/commands/plugin/plugin_test.go | 2 +- cmd/commands/plugin/uninstall_test.go | 2 +- cmd/common/command_test.go | 2 +- cmd/fabric_test.go | 2 +- go.mod | 12 ++++-- go.sum | 19 ++++++++-- hack/ci.sh | 27 +++++++++++++ pkg/environment/actions_test.go | 2 +- pkg/environment/config_test.go | 2 +- pkg/environment/environment_test.go | 2 +- pkg/environment/home_test.go | 2 +- pkg/fabric/fabric_test.go | 2 +- pkg/plugin/plugin_test.go | 2 +- 35 files changed, 206 insertions(+), 123 deletions(-) create mode 100644 .github/workflows/golang.yml create mode 100644 .github/workflows/pull_request.yml create mode 100644 .github/workflows/push.yml create mode 100644 .github/workflows/schedule.yml create mode 100644 .github/workflows/vulnerability-scan.yml delete mode 100644 ci/azure-pipelines.yml delete mode 100644 ci/install_deps.yml create mode 100644 hack/ci.sh diff --git a/.github/workflows/golang.yml b/.github/workflows/golang.yml new file mode 100644 index 0000000..ee63eee --- /dev/null +++ b/.github/workflows/golang.yml @@ -0,0 +1,48 @@ +name: Golang build + +on: + workflow_call: + +jobs: + #unit-test: + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@v3 + # - uses: actions/setup-go@v4 + # with: + # go-version: '1.20' + # - name: Generate test mocks + # run: make generate + # - name: Unit test + # run: make unit-test-go + + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v4 + with: + go-version: '1.20' + - name: Generate test mocks + run: make generate + - name: Staticcheck + run: make staticcheck + - name: golangci-lint + uses: golangci/golangci-lint-action@v3 + with: + version: latest + skip-pkg-cache: true + + end-to-end: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + FABRIC_VERSION: ['2.4.8', '2.5.0'] + CREATE_CHANNEL: [create_channel, existing_channel] + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v4 + with: + go-version: '1.20' + - run: ./hack/ci.sh ${{matrix.FABRIC_VERSION}} ${{matrix.CREATE_CHANNEL}} diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml new file mode 100644 index 0000000..215810e --- /dev/null +++ b/.github/workflows/pull_request.yml @@ -0,0 +1,22 @@ +name: Pull request + +on: + pull_request: + banches: + - main + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + go: + uses: ./.github/workflows/golang.yml + + pull-request: + needs: + - go + name: Pull request success + runs-on: ubuntu-latest + steps: + - run: true diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml new file mode 100644 index 0000000..29c9c76 --- /dev/null +++ b/.github/workflows/push.yml @@ -0,0 +1,10 @@ +name: Push + +on: + push: + branches: + - main + +jobs: + go: + uses: ./.github/workflows/golang.yml diff --git a/.github/workflows/schedule.yml b/.github/workflows/schedule.yml new file mode 100644 index 0000000..77a7b13 --- /dev/null +++ b/.github/workflows/schedule.yml @@ -0,0 +1,9 @@ +name: Scheduled build + +on: + schedule: + - cron: "10 01 * * *" + +jobs: + go: + uses: ./.github/workflows/golang.yml diff --git a/.github/workflows/vulnerability-scan.yml b/.github/workflows/vulnerability-scan.yml new file mode 100644 index 0000000..4cfd4dd --- /dev/null +++ b/.github/workflows/vulnerability-scan.yml @@ -0,0 +1,27 @@ +name: Security vulnerability scan + +on: + schedule: + - cron: '20 02 * * *' + workflow_dispatch: + +permissions: + contents: read + +jobs: + go: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + target: + - govulncheck + steps: + - uses: actions/checkout@v3 + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '1.20' + check-latest: true + - name: Scan + run: make scan-go-${{ matrix.target }} diff --git a/ci/azure-pipelines.yml b/ci/azure-pipelines.yml deleted file mode 100644 index 4adb351..0000000 --- a/ci/azure-pipelines.yml +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright the Hyperledger Fabric contributors. All rights reserved. -# -# SPDX-License-Identifier: Apache-2.0 - -name: $(SourceBranchName)-$(Date:yyyyMMdd)$(Rev:.rrr) -trigger: -- main -pr: -- main - -variables: - GOPATH: $(Agent.BuildDirectory)/go - PATH: $(Agent.BuildDirectory)/go/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin - GOVER: 1.14.4 - -jobs: -- job: Lint - pool: - vmImage: ubuntu-20.04 - dependsOn: [] - timeoutInMinutes: 60 - steps: - - template: install_deps.yml - - checkout: self - - script: make lint - displayName: Run lint - -- job: Test - pool: - vmImage: ubuntu-20.04 - dependsOn: [] - timeoutInMinutes: 60 - steps: - - template: install_deps.yml - - checkout: self - - script: make test - displayName: Run test diff --git a/ci/install_deps.yml b/ci/install_deps.yml deleted file mode 100644 index df673e9..0000000 --- a/ci/install_deps.yml +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright the Hyperledger Fabric contributors. All rights reserved. -# -# SPDX-License-Identifier: Apache-2.0 - -steps: - - script: sudo apt-get clean - displayName: Run apt clean - - script: sudo apt-get update - displayName: Run apt update - - script: sudo apt-get install -y make - displayName: Install dependencies - - task: GoTool@0 - inputs: - version: $(GOVER) - goPath: $(GOPATH) - displayName: Install Go $(GOVER) - - script: GO111MODULE=off go get -u github.com/myitcv/gobin - displayName: Install gobin \ No newline at end of file diff --git a/cmd/commands/chaincode/events.go b/cmd/commands/chaincode/events.go index 3d674f9..b551434 100644 --- a/cmd/commands/chaincode/events.go +++ b/cmd/commands/chaincode/events.go @@ -8,7 +8,6 @@ package chaincode import ( "errors" - "fmt" "github.com/spf13/cobra" @@ -67,7 +66,7 @@ func (c *EventsCommand) Validate() error { // Run executes the command func (c *EventsCommand) Run() error { - registration, eventCh, err := c.Channel.RegisterChaincodeEvent(c.ChaincodeName, "") + /*registration, eventCh, err := c.Channel.RegisterChaincodeEvent(c.ChaincodeName, "") if err != nil { return err } @@ -76,7 +75,7 @@ func (c *EventsCommand) Run() error { for event := range eventCh { fmt.Fprintln(c.Settings.Streams.Out, string(event.Payload)) - } + }*/ return nil } diff --git a/cmd/commands/chaincode/package_test.go b/cmd/commands/chaincode/package_test.go index 62f8ea7..b99a76b 100644 --- a/cmd/commands/chaincode/package_test.go +++ b/cmd/commands/chaincode/package_test.go @@ -11,7 +11,7 @@ import ( "fmt" "os" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/spf13/cobra" diff --git a/cmd/commands/channel/channel.go b/cmd/commands/channel/channel.go index 68c0d23..eee5b32 100644 --- a/cmd/commands/channel/channel.go +++ b/cmd/commands/channel/channel.go @@ -8,10 +8,11 @@ package channel import ( "github.com/spf13/cobra" + "google.golang.org/grpc" + "github.com/hyperledger/fabric-admin-sdk/pkg/identity" "github.com/hyperledger/fabric-cli/cmd/common" "github.com/hyperledger/fabric-cli/pkg/environment" - "github.com/hyperledger/fabric-cli/pkg/fabric" ) // NewChannelCommand creates a new "fabric channel" command @@ -38,26 +39,11 @@ func NewChannelCommand(settings *environment.Settings) *cobra.Command { // BaseCommand implements common channel command functions type BaseCommand struct { common.Command - - Factory fabric.Factory - ResourceManagement fabric.ResourceManagement + OrgMSP identity.SigningIdentity + Connection *grpc.ClientConn } // Complete initializes all clients needed for Run func (c *BaseCommand) Complete() error { - var err error - - /*if c.Factory == nil { - c.Factory, err = fabric.NewFactory(c.Settings.Config) - if err != nil { - return err - } - } - */ - c.ResourceManagement, err = c.Factory.ResourceManagement() - if err != nil { - return err - } - return nil } diff --git a/cmd/commands/channel/config.go b/cmd/commands/channel/config.go index 0512ffc..a2e4ace 100644 --- a/cmd/commands/channel/config.go +++ b/cmd/commands/channel/config.go @@ -8,7 +8,6 @@ package channel import ( "errors" - "fmt" "github.com/spf13/cobra" @@ -67,7 +66,7 @@ func (c *ConfigCommand) Validate() error { // Run executes the command func (c *ConfigCommand) Run() error { - resp, err := c.ResourceManagement.QueryConfigFromOrderer(c.ChannelID) + /*resp, err := c.ResourceManagement.QueryConfigFromOrderer(c.ChannelID) if err != nil { return err } @@ -87,7 +86,7 @@ func (c *ConfigCommand) Run() error { for _, anchor := range resp.AnchorPeers() { fmt.Fprintf(c.Settings.Streams.Out, " - %s:%d (%s)\n", anchor.Host, anchor.Port, anchor.Org) } - } + }*/ return nil } diff --git a/cmd/commands/channel/list.go b/cmd/commands/channel/list.go index 384229a..dfb40b0 100644 --- a/cmd/commands/channel/list.go +++ b/cmd/commands/channel/list.go @@ -7,8 +7,12 @@ SPDX-License-Identifier: Apache-2.0 package channel import ( + "context" + "fmt" + "github.com/spf13/cobra" + "github.com/hyperledger/fabric-admin-sdk/pkg/channel" "github.com/hyperledger/fabric-cli/pkg/environment" ) @@ -16,15 +20,13 @@ import ( func NewChannelListCommand(settings *environment.Settings) *cobra.Command { c := ListCommand{} - c.Settings = settings - cmd := &cobra.Command{ Use: "list", Short: "List all joined channels", Long: "List all joined channels, peer is the current context's peer", - PreRunE: func(_ *cobra.Command, _ []string) error { + /*PreRunE: func(_ *cobra.Command, _ []string) error { return c.Complete() - }, + },*/ RunE: func(_ *cobra.Command, _ []string) error { return c.Run() }, @@ -42,24 +44,16 @@ type ListCommand struct { // Run executes the command func (c *ListCommand) Run() error { - /*context, err := c.Settings.Config.GetCurrentContext() - if err != nil { - return err - } - - options := []resmgmt.RequestOption{ - resmgmt.WithTargetEndpoints(context.Peers...), - } - - resp, err := c.ResourceManagement.QueryChannels(options...) + context := context.Background() + peerChannelInfo, err := channel.ListChannelOnPeer(context, c.Connection, c.OrgMSP) if err != nil { return err } fmt.Fprintln(c.Settings.Streams.Out, "Channels Joined:") - for _, channel := range resp.Channels { + for _, channel := range peerChannelInfo { fmt.Fprintf(c.Settings.Streams.Out, " - %s\n", channel.ChannelId) } - */ + return nil } diff --git a/cmd/commands/commands_test.go b/cmd/commands/commands_test.go index 6e822b1..7e9ae34 100644 --- a/cmd/commands/commands_test.go +++ b/cmd/commands/commands_test.go @@ -13,7 +13,7 @@ import ( "github.com/hyperledger/fabric-cli/cmd/commands" "github.com/hyperledger/fabric-cli/pkg/environment" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/cmd/commands/context/context_test.go b/cmd/commands/context/context_test.go index d316a3c..1f6930c 100644 --- a/cmd/commands/context/context_test.go +++ b/cmd/commands/context/context_test.go @@ -12,7 +12,7 @@ import ( "os" "testing" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/spf13/cobra" diff --git a/cmd/commands/context/delete_test.go b/cmd/commands/context/delete_test.go index bdeb444..c21479a 100644 --- a/cmd/commands/context/delete_test.go +++ b/cmd/commands/context/delete_test.go @@ -12,7 +12,7 @@ import ( "io/ioutil" "os" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/spf13/cobra" "gopkg.in/yaml.v2" diff --git a/cmd/commands/context/list_test.go b/cmd/commands/context/list_test.go index 7be52ca..e858a31 100644 --- a/cmd/commands/context/list_test.go +++ b/cmd/commands/context/list_test.go @@ -11,7 +11,7 @@ import ( "fmt" "os" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/spf13/cobra" diff --git a/cmd/commands/context/set_test.go b/cmd/commands/context/set_test.go index b20d82b..1d08c57 100644 --- a/cmd/commands/context/set_test.go +++ b/cmd/commands/context/set_test.go @@ -12,7 +12,7 @@ import ( "io/ioutil" "os" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/spf13/cobra" "gopkg.in/yaml.v2" diff --git a/cmd/commands/context/use_test.go b/cmd/commands/context/use_test.go index d936865..d3274f1 100644 --- a/cmd/commands/context/use_test.go +++ b/cmd/commands/context/use_test.go @@ -12,7 +12,7 @@ import ( "io/ioutil" "os" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/spf13/cobra" "gopkg.in/yaml.v2" diff --git a/cmd/commands/context/view_test.go b/cmd/commands/context/view_test.go index b36be4e..3167fd7 100644 --- a/cmd/commands/context/view_test.go +++ b/cmd/commands/context/view_test.go @@ -11,7 +11,7 @@ import ( "fmt" "os" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/spf13/cobra" diff --git a/cmd/commands/lifecycle/package_test.go b/cmd/commands/lifecycle/package_test.go index 6e0c233..c770dcc 100644 --- a/cmd/commands/lifecycle/package_test.go +++ b/cmd/commands/lifecycle/package_test.go @@ -11,7 +11,7 @@ import ( "fmt" "os" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/spf13/cobra" diff --git a/cmd/commands/plugin/install_test.go b/cmd/commands/plugin/install_test.go index 31b3fbd..6323d91 100644 --- a/cmd/commands/plugin/install_test.go +++ b/cmd/commands/plugin/install_test.go @@ -12,7 +12,7 @@ import ( "fmt" "os" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/spf13/cobra" diff --git a/cmd/commands/plugin/list_test.go b/cmd/commands/plugin/list_test.go index 08f3acd..18382a8 100644 --- a/cmd/commands/plugin/list_test.go +++ b/cmd/commands/plugin/list_test.go @@ -12,7 +12,7 @@ import ( "fmt" "os" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/spf13/cobra" diff --git a/cmd/commands/plugin/plugin_test.go b/cmd/commands/plugin/plugin_test.go index 0e11cef..5b73439 100644 --- a/cmd/commands/plugin/plugin_test.go +++ b/cmd/commands/plugin/plugin_test.go @@ -12,7 +12,7 @@ import ( "os" "testing" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/spf13/cobra" diff --git a/cmd/commands/plugin/uninstall_test.go b/cmd/commands/plugin/uninstall_test.go index 36bd5d2..22bfb45 100644 --- a/cmd/commands/plugin/uninstall_test.go +++ b/cmd/commands/plugin/uninstall_test.go @@ -12,7 +12,7 @@ import ( "fmt" "os" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/spf13/cobra" diff --git a/cmd/common/command_test.go b/cmd/common/command_test.go index 7f2ac77..ff6574b 100644 --- a/cmd/common/command_test.go +++ b/cmd/common/command_test.go @@ -9,7 +9,7 @@ package common_test import ( "testing" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/spf13/cobra" diff --git a/cmd/fabric_test.go b/cmd/fabric_test.go index c3341ed..544e4ef 100644 --- a/cmd/fabric_test.go +++ b/cmd/fabric_test.go @@ -16,7 +16,7 @@ import ( "github.com/hyperledger/fabric-cli/pkg/environment" "github.com/hyperledger/fabric-cli/pkg/plugin" "github.com/hyperledger/fabric-cli/pkg/plugin/mocks" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/spf13/cobra" ) diff --git a/go.mod b/go.mod index b8da873..508e093 100644 --- a/go.mod +++ b/go.mod @@ -7,20 +7,27 @@ module github.com/hyperledger/fabric-cli go 1.20 require ( + github.com/hyperledger/fabric-admin-sdk v0.0.0 github.com/hyperledger/fabric-protos-go-apiv2 v0.3.0 github.com/maxbrunsfeld/counterfeiter/v6 v6.2.3 github.com/onsi/ginkgo v1.8.0 - github.com/onsi/gomega v1.10.0 + github.com/onsi/ginkgo/v2 v2.8.2 + github.com/onsi/gomega v1.27.0 github.com/pkg/errors v0.8.1 github.com/spf13/cobra v0.0.4 github.com/spf13/pflag v1.0.5 github.com/stretchr/testify v1.5.1 + google.golang.org/grpc v1.55.0 gopkg.in/yaml.v2 v2.4.0 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect + github.com/go-logr/logr v1.2.3 // indirect + github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 // indirect github.com/golang/protobuf v1.5.3 // indirect + github.com/google/go-cmp v0.5.9 // indirect + github.com/google/pprof v0.0.0-20230207041349-798e818bf904 // indirect github.com/hpcloud/tail v1.0.0 // indirect github.com/inconshreveable/mousetrap v1.0.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect @@ -29,10 +36,9 @@ require ( golang.org/x/sys v0.8.0 // indirect golang.org/x/text v0.9.0 // indirect golang.org/x/tools v0.6.0 // indirect - golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 // indirect - google.golang.org/grpc v1.55.0 // indirect google.golang.org/protobuf v1.30.0 // indirect gopkg.in/fsnotify.v1 v1.4.7 // indirect gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index ff6f31a..a3a1487 100644 --- a/go.sum +++ b/go.sum @@ -9,6 +9,10 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 h1:p104kn46Q8WdvHunIJ9dAyjPVtrBPhSr3KT2yUst43I= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= @@ -16,9 +20,14 @@ github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/pprof v0.0.0-20230207041349-798e818bf904 h1:4/hN5RUoecvl+RmJRE2YxKWtnnQls6rQjjW5oV7qg2U= +github.com/google/pprof v0.0.0-20230207041349-798e818bf904/go.mod h1:uglQLonpP8qtYCYyzA+8c/9qtqgA3qsXGYqCPKARAFg= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/hyperledger/fabric-admin-sdk v0.0.0 h1:SS/qekuUUOzvx1+1UzJCEcHD/UcCDpTxqrCjOVoy1Rg= +github.com/hyperledger/fabric-admin-sdk v0.0.0/go.mod h1:AGAr/kVPWagaEh+bJeieTiajC4pbfcYXVySENqwk2Sc= github.com/hyperledger/fabric-protos-go-apiv2 v0.3.0 h1:DOmDMloF3vKKJKXz+CsZhFgkUmnXKzP5ei71yGIbeOw= github.com/hyperledger/fabric-protos-go-apiv2 v0.3.0/go.mod h1:smwq1q6eKByqQAp0SYdVvE1MvDoneF373j11XwWajgA= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= @@ -38,9 +47,11 @@ github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.8.0 h1:VkHVNpR4iVnU8XQR6DBm8BqYjN7CRzw+xKUbVVbbW9w= github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo/v2 v2.8.2 h1:rWe/YULhcr//R7U3kN11ISrlT7aVPW9K/AbXbGakXqY= +github.com/onsi/ginkgo/v2 v2.8.2/go.mod h1:88PAUAEownL21VmApu+QCg9mlPSt7W8fnb6LsLfV9Eg= github.com/onsi/gomega v1.9.0/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA= -github.com/onsi/gomega v1.10.0 h1:Gwkk+PTu/nfOwNMtUB/mRUv0X7ewW5dO4AERT1ThVKo= -github.com/onsi/gomega v1.10.0/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA= +github.com/onsi/gomega v1.27.0 h1:QLidEla4bXUuZVFa4KX6JHCsuGgbi85LC/pCHrt/O08= +github.com/onsi/gomega v1.27.0/go.mod h1:i189pavgK95OSIipFBa74gC2V4qrQuvjuyGEr3GmbXA= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -98,8 +109,6 @@ golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 h1:DdoeryqhaXp1LtT/emMP1BRJPHHKFi5akj/nbx/zNTA= google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4/go.mod h1:NWraEVixdDnqcqQ30jipen1STv2r/n24Wb7twVTGR4s= google.golang.org/grpc v1.55.0 h1:3Oj82/tFSCeUrRTg/5E/7d/W5A1tj6Ky1ABAuZuv5ag= @@ -119,3 +128,5 @@ gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/hack/ci.sh b/hack/ci.sh new file mode 100644 index 0000000..fa46695 --- /dev/null +++ b/hack/ci.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash +# + +DIR=$PWD +curl -sSLO https://raw.githubusercontent.com/hyperledger/fabric/main/scripts/install-fabric.sh && chmod +x install-fabric.sh +./install-fabric.sh --fabric-version $1 +cd fabric-samples/test-network +if [ $2 == "create_channel" ]; then + ./network.sh up +else + ./network.sh up createChannel -c mychannel +fi +cd $DIR/test +mkdir -p ../organizations && cp -r ../fabric-samples/test-network/organizations/* ../organizations/ && ls ../organizations/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt +if [ $2 == "create_channel" ]; then + export createChannel=true +fi +#go test -v ./... +if [[ "$?" -ne 0 ]]; then + exit 1 +fi +docker network ls +docker ps -a +cat PackageID +docker run --rm -d --name peer0org1_basic --network fabric_test -e CHAINCODE_SERVER_ADDRESS=0.0.0.0:9999 -e CORE_CHAINCODE_ID_NAME=$(cat PackageID) ghcr.io/hyperledgendary/fabric-ccaas-asset-transfer-basic:latest +docker run --rm -d --name peer0org2_basic --network fabric_test -e CHAINCODE_SERVER_ADDRESS=0.0.0.0:9999 -e CORE_CHAINCODE_ID_NAME=$(cat PackageID) ghcr.io/hyperledgendary/fabric-ccaas-asset-transfer-basic:latest +cd .. diff --git a/pkg/environment/actions_test.go b/pkg/environment/actions_test.go index b4881d6..767520b 100644 --- a/pkg/environment/actions_test.go +++ b/pkg/environment/actions_test.go @@ -8,7 +8,7 @@ package environment_test import ( "github.com/hyperledger/fabric-cli/pkg/environment" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/pkg/environment/config_test.go b/pkg/environment/config_test.go index 95241d2..995bf86 100644 --- a/pkg/environment/config_test.go +++ b/pkg/environment/config_test.go @@ -12,7 +12,7 @@ import ( "path/filepath" "github.com/hyperledger/fabric-cli/pkg/environment" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/spf13/pflag" "gopkg.in/yaml.v2" diff --git a/pkg/environment/environment_test.go b/pkg/environment/environment_test.go index 2363bf3..39fb22f 100644 --- a/pkg/environment/environment_test.go +++ b/pkg/environment/environment_test.go @@ -13,7 +13,7 @@ import ( "testing" "github.com/hyperledger/fabric-cli/pkg/environment" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/spf13/pflag" "gopkg.in/yaml.v2" diff --git a/pkg/environment/home_test.go b/pkg/environment/home_test.go index 18fead5..87103cd 100644 --- a/pkg/environment/home_test.go +++ b/pkg/environment/home_test.go @@ -11,7 +11,7 @@ import ( "path/filepath" "github.com/hyperledger/fabric-cli/pkg/environment" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/pkg/fabric/fabric_test.go b/pkg/fabric/fabric_test.go index 79446a1..8792b55 100644 --- a/pkg/fabric/fabric_test.go +++ b/pkg/fabric/fabric_test.go @@ -9,7 +9,7 @@ package fabric_test import ( "testing" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/pkg/plugin/plugin_test.go b/pkg/plugin/plugin_test.go index d6e933e..6facb4c 100644 --- a/pkg/plugin/plugin_test.go +++ b/pkg/plugin/plugin_test.go @@ -15,7 +15,7 @@ import ( "github.com/hyperledger/fabric-cli/pkg/environment" "github.com/hyperledger/fabric-cli/pkg/plugin" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" )