@@ -39,17 +39,29 @@ func TestError(t *testing.T) {
39
39
func TestRegisterSuccess (t * testing.T ) {
40
40
r := NewRegistry ()
41
41
shim := MockShim {}
42
- err := r .Register ("path" , shim )
42
+ err := r .Register (& ccintf.CCID {
43
+ ChaincodeSpec : & pb.ChaincodeSpec {
44
+ ChaincodeId : & pb.ChaincodeID {
45
+ Name : "name" ,
46
+ },
47
+ },
48
+ }, shim )
43
49
44
50
assert .Nil (t , err , "err should be nil" )
45
- assert .Equal (t , r .typeRegistry ["path " ].chaincode , shim , "shim should be correct" )
51
+ assert .Equal (t , r .typeRegistry ["name " ].chaincode , shim , "shim should be correct" )
46
52
}
47
53
48
54
func TestRegisterError (t * testing.T ) {
49
55
r := NewRegistry ()
50
- r .typeRegistry ["path " ] = & inprocContainer {}
56
+ r .typeRegistry ["name " ] = & inprocContainer {}
51
57
shim := MockShim {}
52
- err := r .Register ("path" , shim )
58
+ err := r .Register (& ccintf.CCID {
59
+ ChaincodeSpec : & pb.ChaincodeSpec {
60
+ ChaincodeId : & pb.ChaincodeID {
61
+ Name : "name" ,
62
+ },
63
+ },
64
+ }, shim )
53
65
54
66
assert .NotNil (t , err , "err should not be nil" )
55
67
}
@@ -139,7 +151,7 @@ func TestDeployNotRegistered(t *testing.T) {
139
151
ccid := ccintf.CCID {
140
152
ChaincodeSpec : & pb.ChaincodeSpec {
141
153
ChaincodeId : & pb.ChaincodeID {
142
- Path : "path " ,
154
+ Name : "name " ,
143
155
},
144
156
},
145
157
}
@@ -157,7 +169,7 @@ func TestDeployNotRegistered(t *testing.T) {
157
169
err := vm .Deploy (mockContext , ccid , args , env , mockReader )
158
170
159
171
assert .NotNil (t , err , "err should not be nil" )
160
- assert .Equal (t , err .Error (), "path not registered. Please register the system chaincode in inprocinstances.go" , "error message should be correct" )
172
+ assert .Equal (t , err .Error (), "name not registered. Please register the system chaincode in inprocinstances.go" , "error message should be correct" )
161
173
}
162
174
163
175
func TestDeployNoChaincodeInstance (t * testing.T ) {
@@ -168,7 +180,7 @@ func TestDeployNoChaincodeInstance(t *testing.T) {
168
180
ccid := ccintf.CCID {
169
181
ChaincodeSpec : & pb.ChaincodeSpec {
170
182
ChaincodeId : & pb.ChaincodeID {
171
- Path : "path " ,
183
+ Name : "name " ,
172
184
},
173
185
},
174
186
}
@@ -181,11 +193,11 @@ func TestDeployNoChaincodeInstance(t *testing.T) {
181
193
182
194
ipc := & inprocContainer {args : args , env : env , chaincode : mockInprocContainer .chaincode , stopChan : make (chan struct {})}
183
195
184
- r .typeRegistry ["path " ] = ipc
196
+ r .typeRegistry ["name " ] = ipc
185
197
186
198
err := vm .Deploy (mockContext , ccid , args , env , mockReader )
187
199
assert .NotNil (t , err , "err should not be nil" )
188
- assert .Equal (t , err .Error (), "path system chaincode does not contain chaincode instance" )
200
+ assert .Equal (t , err .Error (), "name system chaincode does not contain chaincode instance" )
189
201
}
190
202
191
203
func TestDeployChaincode (t * testing.T ) {
@@ -196,7 +208,7 @@ func TestDeployChaincode(t *testing.T) {
196
208
ccid := ccintf.CCID {
197
209
ChaincodeSpec : & pb.ChaincodeSpec {
198
210
ChaincodeId : & pb.ChaincodeID {
199
- Path : "path " ,
211
+ Name : "name " ,
200
212
},
201
213
},
202
214
}
@@ -211,7 +223,7 @@ func TestDeployChaincode(t *testing.T) {
211
223
212
224
ipc := & inprocContainer {args : args , env : env , chaincode : mockInprocContainer .chaincode , stopChan : make (chan struct {})}
213
225
214
- r .typeRegistry ["path " ] = ipc
226
+ r .typeRegistry ["name " ] = ipc
215
227
216
228
err := vm .Deploy (mockContext , ccid , args , env , mockReader )
217
229
assert .Nil (t , err , "err should be nil" )
@@ -399,7 +411,7 @@ func TestStart(t *testing.T) {
399
411
ccid := ccintf.CCID {
400
412
ChaincodeSpec : & pb.ChaincodeSpec {
401
413
ChaincodeId : & pb.ChaincodeID {
402
- Path : "path " ,
414
+ Name : "name " ,
403
415
},
404
416
},
405
417
}
@@ -414,7 +426,7 @@ func TestStart(t *testing.T) {
414
426
415
427
ipc := & inprocContainer {args : args , env : env , chaincode : mockInprocContainer .chaincode , stopChan : make (chan struct {})}
416
428
417
- r .typeRegistry ["path " ] = ipc
429
+ r .typeRegistry ["name " ] = ipc
418
430
419
431
err := vm .Start (mockContext , ccid , args , env , files , nil )
420
432
assert .Nil (t , err , "err should be nil" )
@@ -428,7 +440,6 @@ func TestStop(t *testing.T) {
428
440
ccid := ccintf.CCID {
429
441
ChaincodeSpec : & pb.ChaincodeSpec {
430
442
ChaincodeId : & pb.ChaincodeID {
431
- Path : "path" ,
432
443
Name : "name" ,
433
444
},
434
445
},
@@ -446,7 +457,7 @@ func TestStop(t *testing.T) {
446
457
ipc := & inprocContainer {args : args , env : env , chaincode : mockInprocContainer .chaincode , stopChan : stopChan }
447
458
ipc .running = true
448
459
449
- r .typeRegistry ["path " ] = ipc
460
+ r .typeRegistry ["name-1 " ] = ipc
450
461
r .instRegistry ["name-1" ] = ipc
451
462
452
463
go func () {
@@ -466,7 +477,6 @@ func TestStopNoIPCTemplate(t *testing.T) {
466
477
ccid := ccintf.CCID {
467
478
ChaincodeSpec : & pb.ChaincodeSpec {
468
479
ChaincodeId : & pb.ChaincodeID {
469
- Path : "path" ,
470
480
Name : "name" ,
471
481
},
472
482
},
@@ -475,7 +485,7 @@ func TestStopNoIPCTemplate(t *testing.T) {
475
485
476
486
err := vm .Stop (mockContext , ccid , 1000 , true , true )
477
487
assert .NotNil (t , err , "err should not be nil" )
478
- assert .Equal (t , err .Error (), "path not registered" , "error should be correct" )
488
+ assert .Equal (t , err .Error (), "name-1 not registered" , "error should be correct" )
479
489
}
480
490
481
491
func TestStopNoIPC (t * testing.T ) {
@@ -486,7 +496,6 @@ func TestStopNoIPC(t *testing.T) {
486
496
ccid := ccintf.CCID {
487
497
ChaincodeSpec : & pb.ChaincodeSpec {
488
498
ChaincodeId : & pb.ChaincodeID {
489
- Path : "path" ,
490
499
Name : "name" ,
491
500
},
492
501
},
@@ -503,7 +512,7 @@ func TestStopNoIPC(t *testing.T) {
503
512
stopChan := make (chan struct {})
504
513
ipc := & inprocContainer {args : args , env : env , chaincode : mockInprocContainer .chaincode , stopChan : stopChan }
505
514
506
- r .typeRegistry ["path " ] = ipc
515
+ r .typeRegistry ["name-1 " ] = ipc
507
516
508
517
err := vm .Stop (mockContext , ccid , 1000 , true , true )
509
518
assert .NotNil (t , err , "err should not be nil" )
@@ -518,7 +527,6 @@ func TestStopIPCNotRunning(t *testing.T) {
518
527
ccid := ccintf.CCID {
519
528
ChaincodeSpec : & pb.ChaincodeSpec {
520
529
ChaincodeId : & pb.ChaincodeID {
521
- Path : "path" ,
522
530
Name : "name" ,
523
531
},
524
532
},
@@ -535,7 +543,7 @@ func TestStopIPCNotRunning(t *testing.T) {
535
543
stopChan := make (chan struct {})
536
544
ipc := & inprocContainer {args : args , env : env , chaincode : mockInprocContainer .chaincode , stopChan : stopChan }
537
545
538
- r .typeRegistry ["path " ] = ipc
546
+ r .typeRegistry ["name-1 " ] = ipc
539
547
r .instRegistry ["name-1" ] = ipc
540
548
541
549
err := vm .Stop (mockContext , ccid , 1000 , true , true )
@@ -549,7 +557,6 @@ func TestDestroy(t *testing.T) {
549
557
ccid := ccintf.CCID {
550
558
ChaincodeSpec : & pb.ChaincodeSpec {
551
559
ChaincodeId : & pb.ChaincodeID {
552
- Path : "path" ,
553
560
Name : "name" ,
554
561
},
555
562
},
0 commit comments