Skip to content

Commit

Permalink
[FAB-5118] Split fabric-txn into pkg and default impl
Browse files Browse the repository at this point in the history
Change-Id: Ifb1dee8c55868e75da9230a4582a503ef77974e4
Signed-off-by: Troy Ronda <[email protected]>
  • Loading branch information
troyronda committed Jun 30, 2017
1 parent 07c42f0 commit 13a35d0
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Copyright SecureKey Technologies Inc. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/

package defaultimpl
package fabapi

import (
"fmt"
Expand Down
12 changes: 0 additions & 12 deletions pkg/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ package config
import (
"fmt"
"os"
"path/filepath"
"strings"
"testing"

Expand Down Expand Up @@ -425,17 +424,6 @@ func TestNetworkConfig(t *testing.T) {
}
}

func TestOrdererConfig(t *testing.T) {
orderers, err := configImpl.OrderersConfig()
if err != nil {
t.Fatal(err)
}

if !filepath.IsAbs(orderers[0].TLS.Certificate) {
t.Fatal("Expected GOPATH relative path to be replaced")
}
}

func TestMain(m *testing.M) {
var err error
configImpl, err = InitConfig("../../test/fixtures/config/config_test.yaml")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"time"

api "github.com/hyperledger/fabric-sdk-go/api"
internal "github.com/hyperledger/fabric-sdk-go/fabric-txn/internal"
internal "github.com/hyperledger/fabric-sdk-go/pkg/fabric-txn/internal"
"github.com/hyperledger/fabric/protos/common"
"github.com/op/go-logging"
)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"time"

api "github.com/hyperledger/fabric-sdk-go/api"
internal "github.com/hyperledger/fabric-sdk-go/fabric-txn/internal"
internal "github.com/hyperledger/fabric-sdk-go/pkg/fabric-txn/internal"

"github.com/op/go-logging"
)
Expand Down
12 changes: 6 additions & 6 deletions test/integration/base_test_setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import (
"github.com/hyperledger/fabric-sdk-go/pkg/fabric-client/orderer"

api "github.com/hyperledger/fabric-sdk-go/api"
fabricTxn "github.com/hyperledger/fabric-sdk-go/fabric-txn"
admin "github.com/hyperledger/fabric-sdk-go/fabric-txn/admin"
defaultImpl "github.com/hyperledger/fabric-sdk-go/fabric-txn/defaultImpl"
"github.com/hyperledger/fabric-sdk-go/def/fabapi"
fabricTxn "github.com/hyperledger/fabric-sdk-go/pkg/fabric-txn"
admin "github.com/hyperledger/fabric-sdk-go/pkg/fabric-txn/admin"
bccspFactory "github.com/hyperledger/fabric/bccsp/factory"
pb "github.com/hyperledger/fabric/protos/peer"
)
Expand Down Expand Up @@ -53,12 +53,12 @@ func (setup *BaseSetupImpl) Initialize() error {
return fmt.Errorf("Failed getting ephemeral software-based BCCSP [%s]", err)
}

mspClient, err := defaultImpl.NewCAClient(configImpl, setup.OrgID)
mspClient, err := fabapi.NewCAClient(configImpl, setup.OrgID)
if err != nil {
return fmt.Errorf("Failed to get default msp client: %v", err)
}

client, err := defaultImpl.NewClientWithUser("admin", "adminpw", setup.OrgID, "/tmp/enroll_user", configImpl, mspClient)
client, err := fabapi.NewClientWithUser("admin", "adminpw", setup.OrgID, "/tmp/enroll_user", configImpl, mspClient)
if err != nil {
return fmt.Errorf("Create client failed: %v", err)
}
Expand Down Expand Up @@ -253,7 +253,7 @@ func (setup *BaseSetupImpl) GetChannel(client api.FabricClient, channelID string
return nil, fmt.Errorf("Error reading peer config: %v", err)
}
for _, p := range peerConfig {
endorser, err := defaultImpl.NewPeer(fmt.Sprintf("%s:%d", p.Host, p.Port),
endorser, err := fabapi.NewPeer(fmt.Sprintf("%s:%d", p.Host, p.Port),
p.TLS.Certificate, p.TLS.ServerHostOverride, client.GetConfig())
if err != nil {
return nil, fmt.Errorf("NewPeer return error: %v", err)
Expand Down
2 changes: 1 addition & 1 deletion test/integration/end_to_end_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"time"

"github.com/hyperledger/fabric-sdk-go/api"
fabricTxn "github.com/hyperledger/fabric-sdk-go/fabric-txn"
fabricTxn "github.com/hyperledger/fabric-sdk-go/pkg/fabric-txn"
)

func TestChainCodeInvoke(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion test/integration/orgs/multiple_orgs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"testing"

"github.com/hyperledger/fabric-sdk-go/api"
fabrictxn "github.com/hyperledger/fabric-sdk-go/fabric-txn"
fabrictxn "github.com/hyperledger/fabric-sdk-go/pkg/fabric-txn"
)

// TestOrgsEndToEnd creates a channel with two organisations, installs chaincode
Expand Down
2 changes: 1 addition & 1 deletion test/integration/orgs/test_setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ import (
"time"

"github.com/hyperledger/fabric-sdk-go/api"
"github.com/hyperledger/fabric-sdk-go/fabric-txn/admin"
"github.com/hyperledger/fabric-sdk-go/pkg/config"
client "github.com/hyperledger/fabric-sdk-go/pkg/fabric-client"
"github.com/hyperledger/fabric-sdk-go/pkg/fabric-client/channel"
"github.com/hyperledger/fabric-sdk-go/pkg/fabric-client/events"
"github.com/hyperledger/fabric-sdk-go/pkg/fabric-client/orderer"
"github.com/hyperledger/fabric-sdk-go/pkg/fabric-client/peer"
"github.com/hyperledger/fabric-sdk-go/pkg/fabric-txn/admin"
"github.com/hyperledger/fabric-sdk-go/test/integration"
"github.com/hyperledger/fabric/bccsp/factory"
)
Expand Down
4 changes: 2 additions & 2 deletions test/integration/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"time"

api "github.com/hyperledger/fabric-sdk-go/api"
defaultImpl "github.com/hyperledger/fabric-sdk-go/fabric-txn/defaultImpl"
"github.com/hyperledger/fabric-sdk-go/def/fabapi"
)

// GetOrdererAdmin returns a pre-enrolled orderer admin user
Expand Down Expand Up @@ -70,7 +70,7 @@ func getDefaultImplPreEnrolledUser(client api.FabricClient, keyDir string, certD
return nil, fmt.Errorf("Error finding the enrollment cert path: %v", err)
}

return defaultImpl.NewPreEnrolledUser(client, privateKeyPath, enrollmentCertPath, username, orgName)
return fabapi.NewPreEnrolledUser(client, privateKeyPath, enrollmentCertPath, username, orgName)
}

// Gets the first path from the dir directory
Expand Down

0 comments on commit 13a35d0

Please sign in to comment.