本文整理汇总了Golang中github.com/openblockchain/obc-peer/openchain/crypto/utils.NodeConfiguration.GetEnrollmentPWD方法的典型用法代码示例。如果您正苦于以下问题:Golang NodeConfiguration.GetEnrollmentPWD方法的具体用法?Golang NodeConfiguration.GetEnrollmentPWD怎么用?Golang NodeConfiguration.GetEnrollmentPWD使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/openblockchain/obc-peer/openchain/crypto/utils.NodeConfiguration
的用法示例。
在下文中一共展示了NodeConfiguration.GetEnrollmentPWD方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: TestParallelInitClose
func TestParallelInitClose(t *testing.T) {
// TODO: complete this
conf := utils.NodeConfiguration{Type: "client", Name: "userthread"}
RegisterClient(conf.Name, nil, conf.GetEnrollmentID(), conf.GetEnrollmentPWD())
done := make(chan bool)
go func() {
for i := 0; i < 5; i++ {
client, err := InitClient(conf.Name, nil)
if err != nil {
t.Log("Init failed")
}
time.Sleep(1 * time.Second)
err = CloseClient(client)
if err != nil {
t.Log("Close failed")
}
}
done <- true
}()
go func() {
for i := 0; i < 5; i++ {
client, err := InitClient(conf.Name, nil)
if err != nil {
t.Log("Init failed")
}
time.Sleep(2 * time.Second)
err = CloseClient(client)
if err != nil {
t.Log("Close failed")
}
}
done <- true
}()
go func() {
for i := 0; i < 5; i++ {
client, err := InitClient(conf.Name, nil)
if err != nil {
t.Log("Init failed")
}
time.Sleep(1 * time.Second)
err = CloseClient(client)
if err != nil {
t.Log("Close failed")
}
}
done <- true
}()
for i := 0; i < 3; i++ {
t.Log("Waiting")
<-done
t.Log("+1")
}
//
}
示例2: TestParallelInitClose
func TestParallelInitClose(t *testing.T) {
// TODO: complete this
conf := utils.NodeConfiguration{Type: "client", Name: "userthread"}
RegisterClient(conf.Name, nil, conf.GetEnrollmentID(), conf.GetEnrollmentPWD())
done := make(chan bool)
n := 10
for i := 0; i < n; i++ {
go func() {
for i := 0; i < 5; i++ {
client, err := InitClient(conf.Name, nil)
if err != nil {
t.Log("Init failed")
}
cis := &obc.ChaincodeInvocationSpec{
ChaincodeSpec: &obc.ChaincodeSpec{
Type: obc.ChaincodeSpec_GOLANG,
ChaincodeID: &obc.ChaincodeID{Path: "Contract001"},
CtorMsg: nil,
ConfidentialityLevel: obc.ConfidentialityLevel_CONFIDENTIAL,
},
}
for i := 0; i < 20; i++ {
uuid := util.GenerateUUID()
client.NewChaincodeExecute(cis, uuid)
}
err = CloseClient(client)
if err != nil {
t.Log("Close failed")
}
}
done <- true
}()
}
for i := 0; i < n; i++ {
log.Info("Waiting")
<-done
log.Info("+1")
}
log.Info("Test Finished!")
//
}
示例3: initValidators
func initValidators() error {
// Register
conf := utils.NodeConfiguration{Type: "validator", Name: "validator"}
err := RegisterValidator(conf.Name, ksPwd, conf.GetEnrollmentID(), conf.GetEnrollmentPWD())
if err != nil {
return err
}
// Verify that a second call to Register fails
err = RegisterValidator(conf.Name, ksPwd, conf.GetEnrollmentID(), conf.GetEnrollmentPWD())
if err != nil {
return err
}
// Init
validator, err = InitValidator(conf.Name, ksPwd)
if err != nil {
return err
}
err = RegisterValidator(conf.Name, ksPwd, conf.GetEnrollmentID(), conf.GetEnrollmentPWD())
if err != nil {
return err
}
return err
}
示例4: initPeers
func initPeers() error {
// Register
conf := utils.NodeConfiguration{Type: "peer", Name: "peer"}
err := RegisterPeer(conf.Name, nil, conf.GetEnrollmentID(), conf.GetEnrollmentPWD())
if err != nil {
return err
}
// Verify that a second call to Register fails
err = RegisterPeer(conf.Name, nil, conf.GetEnrollmentID(), conf.GetEnrollmentPWD())
if err != nil {
return err
}
// Init
peer, err = InitPeer(conf.Name, nil)
if err != nil {
return err
}
err = RegisterPeer(conf.Name, nil, conf.GetEnrollmentID(), conf.GetEnrollmentPWD())
if err != nil {
return err
}
return err
}
示例5: initClients
func initClients() error {
// Deployer
deployerConf := utils.NodeConfiguration{Type: "client", Name: "user1"}
if err := RegisterClient(deployerConf.Name, ksPwd, deployerConf.GetEnrollmentID(), deployerConf.GetEnrollmentPWD()); err != nil {
return err
}
var err error
deployer, err = InitClient(deployerConf.Name, ksPwd)
if err != nil {
return err
}
// Invoker
invokerConf := utils.NodeConfiguration{Type: "client", Name: "user2"}
if err := RegisterClient(invokerConf.Name, ksPwd, invokerConf.GetEnrollmentID(), invokerConf.GetEnrollmentPWD()); err != nil {
return err
}
invoker, err = InitClient(invokerConf.Name, ksPwd)
if err != nil {
return err
}
return nil
}
示例6: TestRegistrationSameEnrollIDDifferentRole
func TestRegistrationSameEnrollIDDifferentRole(t *testing.T) {
conf := utils.NodeConfiguration{Type: "client", Name: "TestRegistrationSameEnrollIDDifferentRole"}
if err := RegisterClient(conf.Name, nil, conf.GetEnrollmentID(), conf.GetEnrollmentPWD()); err != nil {
t.Fatalf("Failed client registration [%s]", err)
}
if err := RegisterValidator(conf.Name, nil, conf.GetEnrollmentID(), conf.GetEnrollmentPWD()); err == nil {
t.Fatalf("Reusing the same enrollment id must be forbidden", err)
}
if err := RegisterPeer(conf.Name, nil, conf.GetEnrollmentID(), conf.GetEnrollmentPWD()); err == nil {
t.Fatalf("Reusing the same enrollment id must be forbidden", err)
}
}