Add Connection from AttributeS to SupplierS

This commit is contained in:
TeoV
2018-07-24 05:03:34 -04:00
committed by Dan Christian Bogos
parent 1a94f4fe38
commit a6cac1de00
9 changed files with 38 additions and 7 deletions

View File

@@ -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

View File

@@ -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)
}