mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 10:06:24 +05:00
Renaming analyzers NewServerCodec to NewAnalyzerServerCodec
This commit is contained in:
@@ -24,7 +24,7 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
func NewServerCodec(sc rpc.ServerCodec, aS *AnalyzerService, enc, from, to string) rpc.ServerCodec {
|
||||
func NewAnalyzerServerCodec(sc rpc.ServerCodec, aS *AnalyzerService, enc, from, to string) rpc.ServerCodec {
|
||||
return &AnalyzerServerCodec{
|
||||
sc: sc,
|
||||
reqs: make(map[uint64]*rpcAPI),
|
||||
@@ -68,6 +68,7 @@ func (c *AnalyzerServerCodec) ReadRequestBody(x interface{}) (err error) {
|
||||
c.reqsLk.Unlock()
|
||||
return
|
||||
}
|
||||
|
||||
func (c *AnalyzerServerCodec) WriteResponse(r *rpc.Response, x interface{}) error {
|
||||
c.reqsLk.Lock()
|
||||
api := c.reqs[c.reqIdx]
|
||||
@@ -76,4 +77,5 @@ func (c *AnalyzerServerCodec) WriteResponse(r *rpc.Response, x interface{}) erro
|
||||
go c.aS.logTrafic(api.ID, api.Method, api.Params, x, r.Error, c.enc, c.from, c.to, api.StartTime, time.Now())
|
||||
return c.sc.WriteResponse(r, x)
|
||||
}
|
||||
|
||||
func (c *AnalyzerServerCodec) Close() error { return c.sc.Close() }
|
||||
|
||||
@@ -61,7 +61,7 @@ func TestNewServerCodec(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
codec := NewServerCodec(new(mockServerCodec), anz, utils.MetaJSON, "127.0.0.1:5565", "127.0.0.1:2012")
|
||||
codec := NewAnalyzerServerCodec(new(mockServerCodec), anz, utils.MetaJSON, "127.0.0.1:5565", "127.0.0.1:2012")
|
||||
r := new(rpc.Request)
|
||||
expR := &rpc.Request{
|
||||
Seq: 0,
|
||||
|
||||
@@ -49,7 +49,7 @@ func newCapsGOBCodec(conn conn, caps *engine.Caps, anz *analyzers.AnalyzerServic
|
||||
if to != nil {
|
||||
tostr = to.String()
|
||||
}
|
||||
return analyzers.NewServerCodec(r, anz, utils.MetaGOB, fromstr, tostr)
|
||||
return analyzers.NewAnalyzerServerCodec(r, anz, utils.MetaGOB, fromstr, tostr)
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -67,7 +67,7 @@ func newCapsJSONCodec(conn conn, caps *engine.Caps, anz *analyzers.AnalyzerServi
|
||||
if to != nil {
|
||||
tostr = to.String()
|
||||
}
|
||||
return analyzers.NewServerCodec(r, anz, utils.MetaJSON, fromstr, tostr)
|
||||
return analyzers.NewAnalyzerServerCodec(r, anz, utils.MetaJSON, fromstr, tostr)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ func TestNewCapsGOBCodec(t *testing.T) {
|
||||
if r := newCapsGOBCodec(conn, cr, nil); !reflect.DeepEqual(r, exp) {
|
||||
t.Errorf("Expected: %v ,received:%v", exp, r)
|
||||
}
|
||||
exp = analyzers.NewServerCodec(newGobServerCodec(conn), anz, utils.MetaGOB, utils.Local, utils.Local)
|
||||
exp = analyzers.NewAnalyzerServerCodec(newGobServerCodec(conn), anz, utils.MetaGOB, utils.Local, utils.Local)
|
||||
if r := newCapsGOBCodec(conn, cr, anz); !reflect.DeepEqual(r, exp) {
|
||||
t.Errorf("Expected: %v ,received:%v", exp, r)
|
||||
}
|
||||
@@ -130,7 +130,7 @@ func TestNewCapsJSONCodec(t *testing.T) {
|
||||
if r := newCapsJSONCodec(conn, cr, nil); !reflect.DeepEqual(r, exp) {
|
||||
t.Errorf("Expected: %v ,received:%v", exp, r)
|
||||
}
|
||||
exp = analyzers.NewServerCodec(jsonrpc.NewServerCodec(conn), anz, utils.MetaJSON, utils.Local, utils.Local)
|
||||
exp = analyzers.NewAnalyzerServerCodec(jsonrpc.NewServerCodec(conn), anz, utils.MetaJSON, utils.Local, utils.Local)
|
||||
if r := newCapsJSONCodec(conn, cr, anz); !reflect.DeepEqual(r, exp) {
|
||||
t.Errorf("Expected: %v ,received:%v", exp, r)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user