Skip to content

Commit

Permalink
[FAB-8866] Rename MspID to MSPID
Browse files Browse the repository at this point in the history
Change-Id: I09f9f88d0a79250eaafe8346f47689fc00c948b7
Signed-off-by: Troy Ronda <troy@troyronda.com>
  • Loading branch information
troyronda committed Mar 14, 2018
1 parent a854819 commit f662850
Show file tree
Hide file tree
Showing 44 changed files with 143 additions and 143 deletions.
6 changes: 3 additions & 3 deletions pkg/client/channel/api_test.go
Expand Up @@ -44,7 +44,7 @@ func TestWithTargetURLsValid(t *testing.T) {

npConfig1 := core.NetworkPeer{
PeerConfig: pConfig1,
MspID: "MYMSP",
MSPID: "MYMSP",
}

pConfig2 := core.PeerConfig{
Expand All @@ -53,7 +53,7 @@ func TestWithTargetURLsValid(t *testing.T) {

npConfig2 := core.NetworkPeer{
PeerConfig: pConfig2,
MspID: "OTHERMSP",
MSPID: "OTHERMSP",
}

mockConfig.SetCustomPeerCfg(&pConfig1)
Expand All @@ -66,7 +66,7 @@ func TestWithTargetURLsValid(t *testing.T) {

assert.Equal(t, 1, len(opts.Targets), "should have one peer")
assert.Equal(t, pConfig1.URL, opts.Targets[0].URL(), "", "Wrong URL")
assert.Equal(t, npConfig1.MspID, opts.Targets[0].MSPID(), "", "Wrong MSP")
assert.Equal(t, npConfig1.MSPID, opts.Targets[0].MSPID(), "", "Wrong MSP")
}

func setupMockTestContext(userName string, mspID string) *fcmocks.MockContext {
Expand Down
4 changes: 2 additions & 2 deletions pkg/client/ledger/ledger.go
Expand Up @@ -81,10 +81,10 @@ func New(channelProvider context.ChannelProvider, opts ...ClientOption) (*Client
// check if target filter was set - if not set the default
if ledgerClient.filter == nil {
// Default target filter is based on user msp
if channelContext.MspID() == "" {
if channelContext.MSPID() == "" {
return nil, errors.New("mspID not available in user context")
}
filter := &mspFilter{mspID: channelContext.MspID()}
filter := &mspFilter{mspID: channelContext.MSPID()}
ledgerClient.filter = filter
}

Expand Down
6 changes: 3 additions & 3 deletions pkg/client/ledger/opts_test.go
Expand Up @@ -44,7 +44,7 @@ func TestWithTargetURLsValid(t *testing.T) {

npConfig1 := core.NetworkPeer{
PeerConfig: pConfig1,
MspID: "MYMSP",
MSPID: "MYMSP",
}

pConfig2 := core.PeerConfig{
Expand All @@ -53,7 +53,7 @@ func TestWithTargetURLsValid(t *testing.T) {

npConfig2 := core.NetworkPeer{
PeerConfig: pConfig2,
MspID: "OTHERMSP",
MSPID: "OTHERMSP",
}

mockConfig.SetCustomPeerCfg(&pConfig1)
Expand All @@ -66,7 +66,7 @@ func TestWithTargetURLsValid(t *testing.T) {

assert.Equal(t, 1, len(opts.Targets), "should have one peer")
assert.Equal(t, pConfig1.URL, opts.Targets[0].URL(), "", "Wrong URL")
assert.Equal(t, npConfig1.MspID, opts.Targets[0].MSPID(), "", "Wrong MSP")
assert.Equal(t, npConfig1.MSPID, opts.Targets[0].MSPID(), "", "Wrong MSP")
}

func setupTestContext(userName string, mspID string) *fcmocks.MockContext {
Expand Down
2 changes: 1 addition & 1 deletion pkg/client/msp/msp.go
Expand Up @@ -189,7 +189,7 @@ func (c *Client) GetSigningIdentity(userName string) (*SigningIdentity, error) {
}
return nil, err
}
signingIdentity := &SigningIdentity{MspID: user.MspID(), PrivateKey: user.PrivateKey(), EnrollmentCert: user.EnrollmentCertificate()}
signingIdentity := &SigningIdentity{MSPID: user.MSPID(), PrivateKey: user.PrivateKey(), EnrollmentCert: user.EnrollmentCertificate()}
return signingIdentity, nil
}

Expand Down
6 changes: 3 additions & 3 deletions pkg/client/msp/msp_test.go
Expand Up @@ -82,7 +82,7 @@ func TestMSP(t *testing.T) {
t.Fatalf("Enrolled user name doesn't match")
}

if enrolledUser.MspID() != "Org1MSP" {
if enrolledUser.MSPID() != "Org1MSP" {
t.Fatalf("Enrolled user mspID doesn't match")
}

Expand Down Expand Up @@ -123,7 +123,7 @@ func TestMSP(t *testing.T) {
t.Fatalf("Enrolled user name doesn't match")
}

if org2EnrolledUser.MspID() != "Org2MSP" {
if org2EnrolledUser.MSPID() != "Org2MSP" {
t.Fatalf("Enrolled user mspID doesn't match")
}

Expand Down Expand Up @@ -194,7 +194,7 @@ func myMSPID(t *testing.T, c core.Config) string {
if !ok {
t.Fatalf("org config retrieval failed: %v", err)
}
return orgConfig.MspID
return orgConfig.MSPID
}

func randomUserName() string {
Expand Down
14 changes: 7 additions & 7 deletions pkg/client/msp/user.go
Expand Up @@ -18,15 +18,15 @@ var (

// Identity supplies the serialized identity and key reference.
type Identity interface {
MspID() string
MSPID() string
SerializedIdentity() ([]byte, error)
PrivateKey() core.Key
}

// SigningIdentity is the identity object that encapsulates the user's private key for signing
// and the user's enrollment certificate (identity)
type SigningIdentity struct {
MspID string
MSPID string
EnrollmentCert []byte
PrivateKey core.Key
}
Expand All @@ -52,7 +52,7 @@ type IdentityManager interface {
// An application cannot use the Peer identity to sign things because the application doesn’t
// have access to the Peer identity’s private key.
type User interface {
MspID() string
MSPID() string
Name() string
SerializedIdentity() ([]byte, error)
PrivateKey() core.Key
Expand All @@ -63,7 +63,7 @@ type User interface {
// PrivateKey is stored separately, in the crypto store
type UserData struct {
Name string
MspID string
MSPID string
EnrollmentCertificate []byte
}

Expand All @@ -75,19 +75,19 @@ type UserStore interface {

// UserIdentifier is the User's unique identifier
type UserIdentifier struct {
MspID string
MSPID string
Name string
}

// PrivKeyKey is a composite key for accessing a private key in the key store
type PrivKeyKey struct {
MspID string
MSPID string
UserName string
SKI []byte
}

// CertKey is a composite key for accessing a cert in the cert store
type CertKey struct {
MspID string
MSPID string
UserName string
}
6 changes: 3 additions & 3 deletions pkg/client/resmgmt/opts_test.go
Expand Up @@ -44,7 +44,7 @@ func TestWithTargetURLsValid(t *testing.T) {

npConfig1 := core.NetworkPeer{
PeerConfig: pConfig1,
MspID: "MYMSP",
MSPID: "MYMSP",
}

pConfig2 := core.PeerConfig{
Expand All @@ -53,7 +53,7 @@ func TestWithTargetURLsValid(t *testing.T) {

npConfig2 := core.NetworkPeer{
PeerConfig: pConfig2,
MspID: "OTHERMSP",
MSPID: "OTHERMSP",
}

mockConfig.SetCustomPeerCfg(&pConfig1)
Expand All @@ -66,5 +66,5 @@ func TestWithTargetURLsValid(t *testing.T) {

assert.Equal(t, 1, len(opts.Targets), "should have one peer")
assert.Equal(t, pConfig1.URL, opts.Targets[0].URL(), "", "Wrong URL")
assert.Equal(t, npConfig1.MspID, opts.Targets[0].MSPID(), "", "Wrong MSP")
assert.Equal(t, npConfig1.MSPID, opts.Targets[0].MSPID(), "", "Wrong MSP")
}
4 changes: 2 additions & 2 deletions pkg/client/resmgmt/resmgmt.go
Expand Up @@ -154,10 +154,10 @@ func New(clientProvider context.ClientProvider, opts ...ClientOption) (*Client,
//check if target filter was set - if not set the default
if resourceClient.filter == nil {
// Default target filter is based on user msp
if ctx.MspID() == "" {
if ctx.MSPID() == "" {
return nil, errors.New("mspID not available in user context")
}
rcFilter := &mspFilter{mspID: ctx.MspID()}
rcFilter := &mspFilter{mspID: ctx.MSPID()}
resourceClient.filter = rcFilter
}
return resourceClient, nil
Expand Down
4 changes: 2 additions & 2 deletions pkg/client/resmgmt/resmgmt_test.go
Expand Up @@ -212,7 +212,7 @@ func TestJoinChannelWithOptsRequiredParameters(t *testing.T) {
peers = append(peers, peer1)

// Test both targets and filter provided (error condition)
err = rc.JoinChannel("mychannel", WithTargets(peers...), WithTargetFilter(&mspFilter{mspID: "MspID"}))
err = rc.JoinChannel("mychannel", WithTargets(peers...), WithTargetFilter(&mspFilter{mspID: "MSPID"}))
if err == nil || !strings.Contains(err.Error(), "If targets are provided, filter cannot be provided") {
t.Fatalf("Should have failed if both target and filter provided")
}
Expand All @@ -224,7 +224,7 @@ func TestJoinChannelWithOptsRequiredParameters(t *testing.T) {
}

// Test filter only (filter has no match)
err = rc.JoinChannel("mychannel", WithTargetFilter(&mspFilter{mspID: "MspID"}))
err = rc.JoinChannel("mychannel", WithTargetFilter(&mspFilter{mspID: "MSPID"}))
if err == nil || !strings.Contains(err.Error(), "No targets available") {
t.Fatalf("InstallCC should have failed with no targets error")
}
Expand Down
12 changes: 6 additions & 6 deletions pkg/common/context/mocks/mockcontext.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 12 additions & 12 deletions pkg/context/api/core/mocks/mockcoreapi.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pkg/context/api/core/network.go
Expand Up @@ -87,12 +87,12 @@ type ChannelPeer struct {
// NetworkPeer combines peer info with MSP info
type NetworkPeer struct {
PeerConfig
MspID string
MSPID string
}

// OrganizationConfig provides the definition of an organization in the network
type OrganizationConfig struct {
MspID string
MSPID string
CryptoPath string
Users map[string]TLSKeyPair
Peers []string
Expand Down
4 changes: 2 additions & 2 deletions pkg/context/api/core/provider.go
Expand Up @@ -24,8 +24,8 @@ type Config interface {
CAClientCertPath(org string) (string, error)
TimeoutOrDefault(TimeoutType) time.Duration
Timeout(TimeoutType) time.Duration
MspID(org string) (string, error)
PeerMspID(name string) (string, error)
MSPID(org string) (string, error)
PeerMSPID(name string) (string, error)
OrderersConfig() ([]OrdererConfig, error)
RandomOrdererConfig() (*OrdererConfig, error)
OrdererConfig(name string) (*OrdererConfig, error)
Expand Down
2 changes: 1 addition & 1 deletion pkg/context/api/fab/provider.go
Expand Up @@ -21,7 +21,7 @@ type ClientContext interface {
core.Providers
msp.Providers
Providers
MspID() string
MSPID() string
SerializedIdentity() ([]byte, error)
PrivateKey() core.Key
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/context/api/msp/identitymgr.go
Expand Up @@ -12,15 +12,15 @@ import (

// Identity supplies the serialized identity and key reference.
type Identity interface {
MspID() string
MSPID() string
SerializedIdentity() ([]byte, error)
PrivateKey() core.Key
}

// SigningIdentity is the identity object that encapsulates the user's private key for signing
// and the user's enrollment certificate (identity)
type SigningIdentity struct {
MspID string
MSPID string
EnrollmentCert []byte
PrivateKey core.Key
}
Expand Down
10 changes: 5 additions & 5 deletions pkg/context/api/msp/user.go
Expand Up @@ -31,7 +31,7 @@ var (
// An application cannot use the Peer identity to sign things because the application doesn’t
// have access to the Peer identity’s private key.
type User interface {
MspID() string
MSPID() string
Name() string
SerializedIdentity() ([]byte, error)
PrivateKey() core.Key
Expand All @@ -42,7 +42,7 @@ type User interface {
// PrivateKey is stored separately, in the crypto store
type UserData struct {
Name string
MspID string
MSPID string
EnrollmentCertificate []byte
}

Expand All @@ -54,19 +54,19 @@ type UserStore interface {

// UserIdentifier is the User's unique identifier
type UserIdentifier struct {
MspID string
MSPID string
Name string
}

// PrivKeyKey is a composite key for accessing a private key in the key store
type PrivKeyKey struct {
MspID string
MSPID string
UserName string
SKI []byte
}

// CertKey is a composite key for accessing a cert in the cert store
type CertKey struct {
MspID string
MSPID string
UserName string
}

0 comments on commit f662850

Please sign in to comment.