Skip to content

Commit

Permalink
fix proto fields and events test
Browse files Browse the repository at this point in the history
  • Loading branch information
Srinivasan Muralidharan authored and Patrick Mullaney committed Jun 7, 2016
1 parent acfba26 commit 732214b
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions events/events_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ var obcEHClient *consumer.EventsClient

func (a *Adapter) GetInterestedEvents() ([]*ehpb.Interest, error) {
//return []*ehpb.Interest{&ehpb.Interest{EventType: ehpb.EventType_BLOCK, ResponseType: ehpb.Interest_PROTOBUF}, &ehpb.Interest{EventType: "generic", ResponseType: ehpb.Interest_PROTOBUF}}, nil
return []*ehpb.Interest{&ehpb.Interest{EventType: ehpb.EventType_CHAINCODE, ChainEvent: &ehpb.Chaincode{Uuid: "0xffffffff", Eventname: "event1"}}}, nil
return []*ehpb.Interest{&ehpb.Interest{EventType: ehpb.EventType_CHAINCODE, ChainEvent: &ehpb.ChaincodeReg{Uuid: "0xffffffff", EventName: "event1"}}}, nil
//return []*ehpb.Interest{&ehpb.Interest{EventType: ehpb.EventType_BLOCK}}, nil
}

Expand All @@ -54,7 +54,7 @@ func (a *Adapter) Recv(msg *ehpb.Event) (bool, error) {
switch x := msg.Event.(type) {
case *ehpb.Event_Block:
case *ehpb.Event_Generic:
case *ehpb.Event_Chaincode:
case *ehpb.Event_ChaincodeEvent:
case nil:
// The field is not set.
fmt.Printf("event not set\n")
Expand Down Expand Up @@ -84,7 +84,7 @@ func createTestBlock() *ehpb.Event {
}

func createTestChaincodeEvent() *ehpb.Event {
emsg := producer.CreateChaincodeEvent(&ehpb.Chaincode{Uuid: "0xffffffff", Eventname: "event1"})
emsg := producer.CreateChaincodeEvent(&ehpb.ChaincodeEvent{Uuid: "0xffffffff", EventName: "event1"})
return emsg
}

Expand Down
4 changes: 2 additions & 2 deletions events/producer/eventhelper.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ func CreateGenericEvent(te *ehpb.Generic) *ehpb.Event {
return &ehpb.Event{&ehpb.Event_Generic{Generic: te}}
}

func CreateChaincodeEvent(te *ehpb.Chaincode) *ehpb.Event {
return &ehpb.Event{&ehpb.Event_Chaincode{Chaincode: te}}
func CreateChaincodeEvent(te *ehpb.ChaincodeEvent) *ehpb.Event {
return &ehpb.Event{&ehpb.Event_ChaincodeEvent{ChaincodeEvent: te}}
}
6 changes: 3 additions & 3 deletions events/producer/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (hl *chaincodeHandlerList) add(ie *pb.Interest, h *handler) bool {
emap = make(map[string]*handler)
hl.handlers[ie.GetChainEvent().Uuid] = emap
}
emap[ie.GetChainEvent().Eventname] = h
emap[ie.GetChainEvent().EventName] = h
hl.Unlock()
return true
}
Expand All @@ -71,14 +71,14 @@ func (hl *chaincodeHandlerList) del(ie *pb.Interest, h *handler) bool {
hl.Unlock()
return false
}
delete(emap, ie.GetChainEvent().Eventname)
delete(emap, ie.GetChainEvent().EventName)
hl.Unlock()
return true
}

func (hl *chaincodeHandlerList) foreach(e *pb.Event, action func(h *handler)) {
hl.Lock()
for _, h := range hl.handlers[e.GetChaincode().Uuid] {
for _, h := range hl.handlers[e.GetChaincodeEvent().Uuid] {
action(h)
}
hl.Unlock()
Expand Down
2 changes: 1 addition & 1 deletion events/producer/register_internal_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func getMessageType(e *pb.Event) pb.EventType {
return pb.EventType_BLOCK
case *pb.Event_Generic:
return pb.EventType_GENERIC
case *pb.Event_Chaincode:
case *pb.Event_ChaincodeEvent:
return pb.EventType_CHAINCODE
default:
return -1
Expand Down
2 changes: 1 addition & 1 deletion protos/events.pb.go

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

2 changes: 1 addition & 1 deletion protos/events.proto
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ enum EventType {
//when EventType is CHAINCODE
message ChaincodeReg {
string uuid = 1;
string eventname = 2;
string eventName = 2;
bool anyTransaction = 3;
}

Expand Down

0 comments on commit 732214b

Please sign in to comment.