mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-15 21:29:52 +05:00
Add Connection from AttributeS to SupplierS
This commit is contained in:
committed by
Dan Christian Bogos
parent
1a94f4fe38
commit
a6cac1de00
@@ -20,17 +20,23 @@ package engine
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
"github.com/cgrates/rpcclient"
|
||||
)
|
||||
|
||||
func NewAttributeService(dm *DataManager, filterS *FilterS,
|
||||
stringIndexedFields, prefixIndexedFields *[]string,
|
||||
processRuns int) (*AttributeService, error) {
|
||||
processRuns int, sppS rpcclient.RpcClientConnection) (*AttributeService, error) {
|
||||
if sppS != nil && reflect.ValueOf(sppS).IsNil() { // fix nil value in interface
|
||||
sppS = nil
|
||||
}
|
||||
return &AttributeService{dm: dm, filterS: filterS,
|
||||
stringIndexedFields: stringIndexedFields,
|
||||
prefixIndexedFields: prefixIndexedFields,
|
||||
processRuns: processRuns}, nil
|
||||
processRuns: processRuns,
|
||||
sppS: sppS}, nil
|
||||
}
|
||||
|
||||
type AttributeService struct {
|
||||
@@ -39,6 +45,7 @@ type AttributeService struct {
|
||||
stringIndexedFields *[]string
|
||||
prefixIndexedFields *[]string
|
||||
processRuns int
|
||||
sppS rpcclient.RpcClientConnection // rpc connection towards SupplierS
|
||||
}
|
||||
|
||||
// ListenAndServe will initialize the service
|
||||
|
||||
@@ -181,7 +181,7 @@ func TestAttributePopulateAttrService(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Errorf("Error: %+v", err)
|
||||
}
|
||||
attrService, err = NewAttributeService(dmAtr, &FilterS{dm: dmAtr, cfg: defaultCfg}, nil, nil, 1)
|
||||
attrService, err = NewAttributeService(dmAtr, &FilterS{dm: dmAtr, cfg: defaultCfg}, nil, nil, 1, nil)
|
||||
if err != nil {
|
||||
t.Errorf("Error: %+v", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user