Skip to content

Commit

Permalink
FAB-1128 finalize protos - remove discovery and devops
Browse files Browse the repository at this point in the history
https://jira.hyperledger.org/browse/FAB-1128

This change set is a follow up of the previous one to cleanup
protos and addresses Gari's comments
   . removes core/discovery (not used)
   . removes devops.proto. The only function used from devops.go
     has been copied into bddtests/endorser_test.go.

Change-Id: I096a45a8eb898e07c02a840839754f5c8af7cfcf
Signed-off-by: Srinivasan Muralidharan <muralisr@us.ibm.com>
  • Loading branch information
Srinivasan Muralidharan committed Nov 22, 2016
1 parent 77c7323 commit 21a4c6a
Show file tree
Hide file tree
Showing 19 changed files with 156 additions and 627 deletions.
43 changes: 43 additions & 0 deletions bddtests/endorser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package bddtests

import (
"errors"
"fmt"
"strconv"
"time"
Expand All @@ -25,13 +26,49 @@ import (

"github.com/DATA-DOG/godog"
"github.com/DATA-DOG/godog/gherkin"
"github.com/hyperledger/fabric/core/chaincode/platforms"
"github.com/hyperledger/fabric/core/container"
"github.com/hyperledger/fabric/core/util"
pb "github.com/hyperledger/fabric/protos/peer"
"github.com/hyperledger/fabric/protos/utils"
"golang.org/x/net/context"
"google.golang.org/grpc"
)

// checkSpec to see if chaincode resides within current package capture for language.
func (*BDDContext) checkSpec(spec *pb.ChaincodeSpec) error {
// Don't allow nil value
if spec == nil {
return errors.New("Expected chaincode specification, nil received")
}

platform, err := platforms.Find(spec.Type)
if err != nil {
return fmt.Errorf("Failed to determine platform type: %s", err)
}

return platform.ValidateSpec(spec)
}

// Build builds the supplied chaincode image
func (b *BDDContext) build(spec *pb.ChaincodeSpec) (*pb.ChaincodeDeploymentSpec, error) {
var codePackageBytes []byte
if err := b.checkSpec(spec); err != nil {
return nil, err
}

vm, err := container.NewVM()
if err != nil {
return nil, fmt.Errorf("Error getting vm")
}

codePackageBytes, err = vm.BuildChaincodeContainer(spec)
if err != nil {
return nil, err
}
chaincodeDeploymentSpec := &pb.ChaincodeDeploymentSpec{ChaincodeSpec: spec, CodePackage: codePackageBytes}
return chaincodeDeploymentSpec, nil
}
func (b *BDDContext) weCompose(composeFiles string) error {
if b.composition != nil {
return fmt.Errorf("Already have composition in BDD context (%s)", b.composition.projectName)
Expand Down Expand Up @@ -118,6 +155,7 @@ func (b *BDDContext) userCreatesADeploymentSpecUsingChaincodeSpecAndDevopsOnPeer
return errRetFunc()
}

/****** Let us get the deployment spec directly from this machine like SDK would
// Now use the devops client to create the deployment spec
var grpcClient *grpc.ClientConn
if grpcClient, err = b.getGrpcClientForComposeService(devopsPeerComposeService); err != nil {
Expand All @@ -129,6 +167,11 @@ func (b *BDDContext) userCreatesADeploymentSpecUsingChaincodeSpecAndDevopsOnPeer
if ccDeploymentSpec, err = devopsClient.Build(context.Background(), ccSpec); err != nil {
return errRetFunc()
}
********/
var ccDeploymentSpec *pb.ChaincodeDeploymentSpec
if ccDeploymentSpec, err = b.build(ccSpec); err != nil {
return errRetFunc()
}
// Now store the chaincode deployment spec
if _, err = userRegistration.SetTagValue(ccDeploymentSpecAlias, ccDeploymentSpec); err != nil {
return errRetFunc()
Expand Down
83 changes: 0 additions & 83 deletions core/devops.go

This file was deleted.

57 changes: 0 additions & 57 deletions core/devops_test.go

This file was deleted.

119 changes: 0 additions & 119 deletions core/discovery/discovery.go

This file was deleted.

Loading

0 comments on commit 21a4c6a

Please sign in to comment.