[SEBA-627]Importer testing demo test code
Change-Id: I28048ad021f0df8b112c2c6f52f6d3602741bf61
diff --git a/demo_test/proto/importer.pb.go b/demo_test/proto/importer.pb.go
new file mode 100644
index 0000000..0e2fe6a
--- /dev/null
+++ b/demo_test/proto/importer.pb.go
@@ -0,0 +1,432 @@
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// source: importer.proto
+
+package importer
+
+import (
+ context "context"
+ fmt "fmt"
+ proto "github.com/golang/protobuf/proto"
+ empty "github.com/golang/protobuf/ptypes/empty"
+ grpc "google.golang.org/grpc"
+ codes "google.golang.org/grpc/codes"
+ status "google.golang.org/grpc/status"
+ math "math"
+)
+
+// Reference imports to suppress errors if they are not otherwise used.
+var _ = proto.Marshal
+var _ = fmt.Errorf
+var _ = math.Inf
+
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the proto package it is being compiled against.
+// A compilation error at this line likely means your copy of the
+// proto package needs to be updated.
+const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
+
+type DeviceInfo struct {
+ IpAddress string `protobuf:"bytes,1,opt,name=ip_address,json=ipAddress,proto3" json:"ip_address,omitempty"`
+ Frequency uint32 `protobuf:"varint,2,opt,name=frequency,proto3" json:"frequency,omitempty"`
+ Vendor string `protobuf:"bytes,3,opt,name=vendor,proto3" json:"vendor,omitempty"`
+ Protocol string `protobuf:"bytes,4,opt,name=protocol,proto3" json:"protocol,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *DeviceInfo) Reset() { *m = DeviceInfo{} }
+func (m *DeviceInfo) String() string { return proto.CompactTextString(m) }
+func (*DeviceInfo) ProtoMessage() {}
+func (*DeviceInfo) Descriptor() ([]byte, []int) {
+ return fileDescriptor_394990ff89e0d02b, []int{0}
+}
+
+func (m *DeviceInfo) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_DeviceInfo.Unmarshal(m, b)
+}
+func (m *DeviceInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_DeviceInfo.Marshal(b, m, deterministic)
+}
+func (m *DeviceInfo) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_DeviceInfo.Merge(m, src)
+}
+func (m *DeviceInfo) XXX_Size() int {
+ return xxx_messageInfo_DeviceInfo.Size(m)
+}
+func (m *DeviceInfo) XXX_DiscardUnknown() {
+ xxx_messageInfo_DeviceInfo.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_DeviceInfo proto.InternalMessageInfo
+
+func (m *DeviceInfo) GetIpAddress() string {
+ if m != nil {
+ return m.IpAddress
+ }
+ return ""
+}
+
+func (m *DeviceInfo) GetFrequency() uint32 {
+ if m != nil {
+ return m.Frequency
+ }
+ return 0
+}
+
+func (m *DeviceInfo) GetVendor() string {
+ if m != nil {
+ return m.Vendor
+ }
+ return ""
+}
+
+func (m *DeviceInfo) GetProtocol() string {
+ if m != nil {
+ return m.Protocol
+ }
+ return ""
+}
+
+type EventList struct {
+ EventIpAddress string `protobuf:"bytes,1,opt,name=event_ip_address,json=eventIpAddress,proto3" json:"event_ip_address,omitempty"`
+ Events []string `protobuf:"bytes,2,rep,name=events,proto3" json:"events,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *EventList) Reset() { *m = EventList{} }
+func (m *EventList) String() string { return proto.CompactTextString(m) }
+func (*EventList) ProtoMessage() {}
+func (*EventList) Descriptor() ([]byte, []int) {
+ return fileDescriptor_394990ff89e0d02b, []int{1}
+}
+
+func (m *EventList) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_EventList.Unmarshal(m, b)
+}
+func (m *EventList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_EventList.Marshal(b, m, deterministic)
+}
+func (m *EventList) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_EventList.Merge(m, src)
+}
+func (m *EventList) XXX_Size() int {
+ return xxx_messageInfo_EventList.Size(m)
+}
+func (m *EventList) XXX_DiscardUnknown() {
+ xxx_messageInfo_EventList.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_EventList proto.InternalMessageInfo
+
+func (m *EventList) GetEventIpAddress() string {
+ if m != nil {
+ return m.EventIpAddress
+ }
+ return ""
+}
+
+func (m *EventList) GetEvents() []string {
+ if m != nil {
+ return m.Events
+ }
+ return nil
+}
+
+type SupportedEventList struct {
+ Events []string `protobuf:"bytes,1,rep,name=events,proto3" json:"events,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *SupportedEventList) Reset() { *m = SupportedEventList{} }
+func (m *SupportedEventList) String() string { return proto.CompactTextString(m) }
+func (*SupportedEventList) ProtoMessage() {}
+func (*SupportedEventList) Descriptor() ([]byte, []int) {
+ return fileDescriptor_394990ff89e0d02b, []int{2}
+}
+
+func (m *SupportedEventList) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_SupportedEventList.Unmarshal(m, b)
+}
+func (m *SupportedEventList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_SupportedEventList.Marshal(b, m, deterministic)
+}
+func (m *SupportedEventList) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_SupportedEventList.Merge(m, src)
+}
+func (m *SupportedEventList) XXX_Size() int {
+ return xxx_messageInfo_SupportedEventList.Size(m)
+}
+func (m *SupportedEventList) XXX_DiscardUnknown() {
+ xxx_messageInfo_SupportedEventList.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_SupportedEventList proto.InternalMessageInfo
+
+func (m *SupportedEventList) GetEvents() []string {
+ if m != nil {
+ return m.Events
+ }
+ return nil
+}
+
+func init() {
+ proto.RegisterType((*DeviceInfo)(nil), "importer.DeviceInfo")
+ proto.RegisterType((*EventList)(nil), "importer.EventList")
+ proto.RegisterType((*SupportedEventList)(nil), "importer.SupportedEventList")
+}
+
+func init() { proto.RegisterFile("importer.proto", fileDescriptor_394990ff89e0d02b) }
+
+var fileDescriptor_394990ff89e0d02b = []byte{
+ // 329 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x90, 0xcf, 0x4a, 0xf3, 0x40,
+ 0x14, 0xc5, 0x9b, 0xf6, 0xa3, 0x34, 0x97, 0x7e, 0x45, 0x47, 0xad, 0xa1, 0x56, 0x28, 0x59, 0x75,
+ 0x21, 0x29, 0xe8, 0x5e, 0x14, 0xfa, 0xc7, 0x82, 0x6e, 0x1a, 0x5c, 0x97, 0x26, 0xb9, 0x2d, 0x03,
+ 0xcd, 0xcc, 0x38, 0x33, 0x09, 0x74, 0xe1, 0x23, 0xfb, 0x0e, 0x92, 0x89, 0xcd, 0x14, 0x2a, 0x82,
+ 0xe0, 0xf2, 0xfc, 0xe6, 0x9e, 0xb9, 0xe7, 0x1e, 0xe8, 0xd0, 0x54, 0x70, 0xa9, 0x51, 0x06, 0x42,
+ 0x72, 0xcd, 0x49, 0x6b, 0xaf, 0x7b, 0x57, 0x1b, 0xce, 0x37, 0x5b, 0x1c, 0x19, 0x1e, 0x65, 0xeb,
+ 0x11, 0xa6, 0x42, 0xef, 0xca, 0x31, 0xff, 0x1d, 0x60, 0x8c, 0x39, 0x8d, 0x71, 0xce, 0xd6, 0x9c,
+ 0x5c, 0x03, 0x50, 0xb1, 0x5c, 0x25, 0x89, 0x44, 0xa5, 0x3c, 0x67, 0xe0, 0x0c, 0xdd, 0x85, 0x4b,
+ 0xc5, 0x63, 0x09, 0x48, 0x1f, 0xdc, 0xb5, 0xc4, 0xb7, 0x0c, 0x59, 0xbc, 0xf3, 0xea, 0x03, 0x67,
+ 0xf8, 0x7f, 0x61, 0x01, 0xe9, 0x42, 0x33, 0x47, 0x96, 0x70, 0xe9, 0x35, 0x8c, 0xf1, 0x4b, 0x91,
+ 0x1e, 0xb4, 0xcc, 0xae, 0x98, 0x6f, 0xbd, 0x7f, 0xe6, 0xa5, 0xd2, 0xfe, 0x0b, 0xb8, 0x93, 0x1c,
+ 0x99, 0x7e, 0xa6, 0x4a, 0x93, 0x21, 0x9c, 0x60, 0x21, 0x96, 0x47, 0x19, 0x3a, 0x86, 0xcf, 0xab,
+ 0x20, 0x5d, 0x68, 0x1a, 0xa2, 0xbc, 0xfa, 0xa0, 0x51, 0xac, 0x2a, 0x95, 0x7f, 0x03, 0x24, 0xcc,
+ 0x84, 0xb9, 0x3b, 0xb1, 0xff, 0xda, 0x69, 0xe7, 0x70, 0xfa, 0xf6, 0xa3, 0x0e, 0xa7, 0x89, 0x39,
+ 0x7e, 0x99, 0xae, 0xd8, 0x6a, 0x83, 0x29, 0x32, 0x4d, 0x1e, 0xa0, 0x13, 0x22, 0x4b, 0x0e, 0x5a,
+ 0x39, 0x0f, 0xaa, 0x6e, 0x2d, 0xed, 0x75, 0x83, 0xb2, 0xd7, 0x60, 0xdf, 0x6b, 0x30, 0x29, 0x7a,
+ 0xf5, 0x6b, 0xe4, 0x1e, 0xda, 0x21, 0xea, 0x69, 0x55, 0xcc, 0x6f, 0xfd, 0x63, 0x68, 0xcf, 0x50,
+ 0xdb, 0xfc, 0xdf, 0xfb, 0xfb, 0x96, 0x1e, 0xdf, 0xec, 0xd7, 0xc8, 0x14, 0x2e, 0xc2, 0x2c, 0x52,
+ 0x32, 0x96, 0x34, 0xc2, 0x19, 0xcd, 0x91, 0x99, 0x57, 0x45, 0xce, 0xac, 0xb1, 0x9a, 0xff, 0x21,
+ 0xcd, 0x13, 0x5c, 0xbe, 0xb2, 0xbf, 0xf8, 0x29, 0x6a, 0x1a, 0x72, 0xf7, 0x19, 0x00, 0x00, 0xff,
+ 0xff, 0x79, 0x23, 0x4a, 0xc2, 0xab, 0x02, 0x00, 0x00,
+}
+
+// Reference imports to suppress errors if they are not otherwise used.
+var _ context.Context
+var _ grpc.ClientConn
+
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the grpc package it is being compiled against.
+const _ = grpc.SupportPackageIsVersion4
+
+// DeviceManagementClient is the client API for DeviceManagement service.
+//
+// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
+type DeviceManagementClient interface {
+ SendDeviceInfo(ctx context.Context, in *DeviceInfo, opts ...grpc.CallOption) (*empty.Empty, error)
+ SetFrequency(ctx context.Context, in *DeviceInfo, opts ...grpc.CallOption) (*empty.Empty, error)
+ GetEventList(ctx context.Context, in *DeviceInfo, opts ...grpc.CallOption) (*SupportedEventList, error)
+ SubsrcribeGivenEvents(ctx context.Context, in *EventList, opts ...grpc.CallOption) (*empty.Empty, error)
+ UnSubsrcribeGivenEvents(ctx context.Context, in *EventList, opts ...grpc.CallOption) (*empty.Empty, error)
+}
+
+type deviceManagementClient struct {
+ cc *grpc.ClientConn
+}
+
+func NewDeviceManagementClient(cc *grpc.ClientConn) DeviceManagementClient {
+ return &deviceManagementClient{cc}
+}
+
+func (c *deviceManagementClient) SendDeviceInfo(ctx context.Context, in *DeviceInfo, opts ...grpc.CallOption) (*empty.Empty, error) {
+ out := new(empty.Empty)
+ err := c.cc.Invoke(ctx, "/importer.device_management/SendDeviceInfo", in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *deviceManagementClient) SetFrequency(ctx context.Context, in *DeviceInfo, opts ...grpc.CallOption) (*empty.Empty, error) {
+ out := new(empty.Empty)
+ err := c.cc.Invoke(ctx, "/importer.device_management/SetFrequency", in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *deviceManagementClient) GetEventList(ctx context.Context, in *DeviceInfo, opts ...grpc.CallOption) (*SupportedEventList, error) {
+ out := new(SupportedEventList)
+ err := c.cc.Invoke(ctx, "/importer.device_management/GetEventList", in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *deviceManagementClient) SubsrcribeGivenEvents(ctx context.Context, in *EventList, opts ...grpc.CallOption) (*empty.Empty, error) {
+ out := new(empty.Empty)
+ err := c.cc.Invoke(ctx, "/importer.device_management/SubsrcribeGivenEvents", in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *deviceManagementClient) UnSubsrcribeGivenEvents(ctx context.Context, in *EventList, opts ...grpc.CallOption) (*empty.Empty, error) {
+ out := new(empty.Empty)
+ err := c.cc.Invoke(ctx, "/importer.device_management/UnSubsrcribeGivenEvents", in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+// DeviceManagementServer is the server API for DeviceManagement service.
+type DeviceManagementServer interface {
+ SendDeviceInfo(context.Context, *DeviceInfo) (*empty.Empty, error)
+ SetFrequency(context.Context, *DeviceInfo) (*empty.Empty, error)
+ GetEventList(context.Context, *DeviceInfo) (*SupportedEventList, error)
+ SubsrcribeGivenEvents(context.Context, *EventList) (*empty.Empty, error)
+ UnSubsrcribeGivenEvents(context.Context, *EventList) (*empty.Empty, error)
+}
+
+// UnimplementedDeviceManagementServer can be embedded to have forward compatible implementations.
+type UnimplementedDeviceManagementServer struct {
+}
+
+func (*UnimplementedDeviceManagementServer) SendDeviceInfo(ctx context.Context, req *DeviceInfo) (*empty.Empty, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method SendDeviceInfo not implemented")
+}
+func (*UnimplementedDeviceManagementServer) SetFrequency(ctx context.Context, req *DeviceInfo) (*empty.Empty, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method SetFrequency not implemented")
+}
+func (*UnimplementedDeviceManagementServer) GetEventList(ctx context.Context, req *DeviceInfo) (*SupportedEventList, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method GetEventList not implemented")
+}
+func (*UnimplementedDeviceManagementServer) SubsrcribeGivenEvents(ctx context.Context, req *EventList) (*empty.Empty, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method SubsrcribeGivenEvents not implemented")
+}
+func (*UnimplementedDeviceManagementServer) UnSubsrcribeGivenEvents(ctx context.Context, req *EventList) (*empty.Empty, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method UnSubsrcribeGivenEvents not implemented")
+}
+
+func RegisterDeviceManagementServer(s *grpc.Server, srv DeviceManagementServer) {
+ s.RegisterService(&_DeviceManagement_serviceDesc, srv)
+}
+
+func _DeviceManagement_SendDeviceInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(DeviceInfo)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(DeviceManagementServer).SendDeviceInfo(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: "/importer.device_management/SendDeviceInfo",
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(DeviceManagementServer).SendDeviceInfo(ctx, req.(*DeviceInfo))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _DeviceManagement_SetFrequency_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(DeviceInfo)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(DeviceManagementServer).SetFrequency(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: "/importer.device_management/SetFrequency",
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(DeviceManagementServer).SetFrequency(ctx, req.(*DeviceInfo))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _DeviceManagement_GetEventList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(DeviceInfo)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(DeviceManagementServer).GetEventList(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: "/importer.device_management/GetEventList",
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(DeviceManagementServer).GetEventList(ctx, req.(*DeviceInfo))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _DeviceManagement_SubsrcribeGivenEvents_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(EventList)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(DeviceManagementServer).SubsrcribeGivenEvents(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: "/importer.device_management/SubsrcribeGivenEvents",
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(DeviceManagementServer).SubsrcribeGivenEvents(ctx, req.(*EventList))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _DeviceManagement_UnSubsrcribeGivenEvents_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(EventList)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(DeviceManagementServer).UnSubsrcribeGivenEvents(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: "/importer.device_management/UnSubsrcribeGivenEvents",
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(DeviceManagementServer).UnSubsrcribeGivenEvents(ctx, req.(*EventList))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+var _DeviceManagement_serviceDesc = grpc.ServiceDesc{
+ ServiceName: "importer.device_management",
+ HandlerType: (*DeviceManagementServer)(nil),
+ Methods: []grpc.MethodDesc{
+ {
+ MethodName: "SendDeviceInfo",
+ Handler: _DeviceManagement_SendDeviceInfo_Handler,
+ },
+ {
+ MethodName: "SetFrequency",
+ Handler: _DeviceManagement_SetFrequency_Handler,
+ },
+ {
+ MethodName: "GetEventList",
+ Handler: _DeviceManagement_GetEventList_Handler,
+ },
+ {
+ MethodName: "SubsrcribeGivenEvents",
+ Handler: _DeviceManagement_SubsrcribeGivenEvents_Handler,
+ },
+ {
+ MethodName: "UnSubsrcribeGivenEvents",
+ Handler: _DeviceManagement_UnSubsrcribeGivenEvents_Handler,
+ },
+ },
+ Streams: []grpc.StreamDesc{},
+ Metadata: "importer.proto",
+}