-
Notifications
You must be signed in to change notification settings - Fork 8.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FAB-7721] Move AutoVendor to golang platform
The AutoVendor code is used by the golang chaincode platform test. This is the last remaining user of apps in the top level test directory. Change-Id: Idac7218d94bfc5a4032ae39b76884efa336eb2f2 Signed-off-by: Matthew Sykes <[email protected]>
- Loading branch information
Showing
4 changed files
with
96 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
core/chaincode/platforms/golang/testdata/src/chaincodes/AutoVendor/chaincode/main.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright Greg Haskins All Rights Reserved | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The purpose of this test code is to prove that the system properly packages | ||
* up dependencies. We therefore synthesize the scenario where a chaincode | ||
* imports non-standard dependencies both directly and indirectly and then | ||
* expect a unit-test to verify that the package includes everything needed | ||
* and ultimately builds properly. | ||
* | ||
*/ | ||
|
||
package main | ||
|
||
import ( | ||
"fmt" | ||
|
||
"chaincodes/AutoVendor/directdep" | ||
|
||
"github.com/hyperledger/fabric/core/chaincode/shim" | ||
pb "github.com/hyperledger/fabric/protos/peer" | ||
) | ||
|
||
// SimpleChaincode example simple Chaincode implementation | ||
type SimpleChaincode struct { | ||
} | ||
|
||
func (t *SimpleChaincode) Init(stub shim.ChaincodeStubInterface) pb.Response { | ||
return shim.Error("NOT IMPL") | ||
} | ||
|
||
func (t *SimpleChaincode) Invoke(stub shim.ChaincodeStubInterface) pb.Response { | ||
return shim.Error("NOT IMPL") | ||
} | ||
|
||
func main() { | ||
directdep.PointlessFunction() | ||
|
||
err := shim.Start(new(SimpleChaincode)) | ||
if err != nil { | ||
fmt.Printf("Error starting Simple chaincode: %s", err) | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
core/chaincode/platforms/golang/testdata/src/chaincodes/AutoVendor/directdep/core.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
* Copyright Greg Haskins All Rights Reserved | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* See github.com/hyperledger/fabric/test/chaincodes/AutoVendor/chaincode/main.go for details | ||
*/ | ||
package directdep | ||
|
||
import ( | ||
"chaincodes/AutoVendor/indirectdep" | ||
) | ||
|
||
func PointlessFunction() { | ||
// delegate to our indirect dependency | ||
indirectdep.PointlessFunction() | ||
} |
14 changes: 14 additions & 0 deletions
14
core/chaincode/platforms/golang/testdata/src/chaincodes/AutoVendor/indirectdep/core.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
* Copyright Greg Haskins All Rights Reserved | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* See github.com/hyperledger/fabric/test/chaincodes/AutoVendor/chaincode/main.go for details | ||
*/ | ||
package indirectdep | ||
|
||
import "fmt" | ||
|
||
func PointlessFunction() { | ||
fmt.Printf("Successfully invoked pointless function\n") | ||
} |