mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-20 22:58:44 +05:00
Rename attributeIDs opt to just IDs to avoid redundancy
This commit is contained in:
committed by
Dan Christian Bogos
parent
cbc314e059
commit
74db72a64c
@@ -133,8 +133,8 @@ func (attrReply *AttrSProcessEventReply) Digest() (rplyDigest string) {
|
||||
func (alS *AttributeService) processEvent(ctx *context.Context, tnt string, args *utils.CGREvent, evNm utils.MapStorage, dynDP utils.DataProvider,
|
||||
lastID string, processedPrfNo map[string]int, profileRuns int) (rply *AttrSProcessEventReply, err error) {
|
||||
var attrIDs []string
|
||||
if attrIDs, err = GetStringSliceOpts(ctx, args.Tenant, args, alS.filterS, alS.cgrcfg.AttributeSCfg().Opts.AttributeIDs,
|
||||
config.AttributesAttributeIDsDftOpt, utils.OptsAttributesAttributeIDs); err != nil {
|
||||
if attrIDs, err = GetStringSliceOpts(ctx, args.Tenant, args, alS.filterS, alS.cgrcfg.AttributeSCfg().Opts.IDs,
|
||||
config.AttributesIDsDftOpt, utils.OptsAttributesIDs); err != nil {
|
||||
return
|
||||
}
|
||||
var ignFilters bool
|
||||
@@ -213,8 +213,8 @@ func (alS *AttributeService) V1GetAttributeForEvent(ctx *context.Context, args *
|
||||
tnt = alS.cgrcfg.GeneralCfg().DefaultTenant
|
||||
}
|
||||
var attrIDs []string
|
||||
if attrIDs, err = GetStringSliceOpts(ctx, args.Tenant, args, alS.filterS, alS.cgrcfg.AttributeSCfg().Opts.AttributeIDs,
|
||||
config.AttributesAttributeIDsDftOpt, utils.OptsAttributesAttributeIDs); err != nil {
|
||||
if attrIDs, err = GetStringSliceOpts(ctx, args.Tenant, args, alS.filterS, alS.cgrcfg.AttributeSCfg().Opts.IDs,
|
||||
config.AttributesIDsDftOpt, utils.OptsAttributesIDs); err != nil {
|
||||
return
|
||||
}
|
||||
var ignFilters bool
|
||||
|
||||
@@ -715,8 +715,8 @@ func TestAttributesV1ProcessEventMultipleRuns1(t *testing.T) {
|
||||
"Password": "passwd",
|
||||
},
|
||||
APIOpts: map[string]interface{}{
|
||||
utils.OptsAttributesProcessRuns: 4,
|
||||
utils.OptsAttributesAttributeIDs: []string{"ATTR1", "ATTR2"},
|
||||
utils.OptsAttributesProcessRuns: 4,
|
||||
utils.OptsAttributesIDs: []string{"ATTR1", "ATTR2"},
|
||||
},
|
||||
}
|
||||
reply := &AttrSProcessEventReply{}
|
||||
@@ -731,8 +731,8 @@ func TestAttributesV1ProcessEventMultipleRuns1(t *testing.T) {
|
||||
utils.RequestType: utils.MetaPostpaid,
|
||||
},
|
||||
APIOpts: map[string]interface{}{
|
||||
utils.OptsAttributesAttributeIDs: []string{"ATTR1", "ATTR2"},
|
||||
utils.OptsAttributesProcessRuns: 4,
|
||||
utils.OptsAttributesIDs: []string{"ATTR1", "ATTR2"},
|
||||
utils.OptsAttributesProcessRuns: 4,
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -1245,8 +1245,8 @@ func TestAttributesV1GetAttributeForEventErrOptsI(t *testing.T) {
|
||||
utils.AccountField: "adrian@itsyscom.com",
|
||||
},
|
||||
APIOpts: map[string]interface{}{
|
||||
utils.OptsAttributesProcessRuns: 2,
|
||||
utils.OptsAttributesAttributeIDs: time.Second,
|
||||
utils.OptsAttributesProcessRuns: 2,
|
||||
utils.OptsAttributesIDs: time.Second,
|
||||
},
|
||||
}
|
||||
rply := &APIAttributeProfile{}
|
||||
|
||||
@@ -123,7 +123,7 @@ func (cS *ChargerService) processEvent(ctx *context.Context, tnt string, cgrEv *
|
||||
clonedEv.APIOpts[utils.OptsContext] = utils.FirstNonEmpty(
|
||||
utils.IfaceAsString(clonedEv.APIOpts[utils.OptsContext]),
|
||||
utils.MetaChargers)
|
||||
clonedEv.APIOpts[utils.OptsAttributesAttributeIDs] = cP.AttributeIDs
|
||||
clonedEv.APIOpts[utils.OptsAttributesIDs] = cP.AttributeIDs
|
||||
var evReply AttrSProcessEventReply
|
||||
if err = cS.connMgr.Call(ctx, cS.cfg.ChargerSCfg().AttributeSConns,
|
||||
utils.AttributeSv1ProcessEvent, clonedEv, &evReply); err != nil {
|
||||
|
||||
@@ -218,7 +218,7 @@ func TestAttributeCache(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAttributeProfileForEvent(t *testing.T) {
|
||||
attrIDs, err := utils.OptAsStringSlice(attrEvs[0].APIOpts, utils.OptsAttributesAttributeIDs)
|
||||
attrIDs, err := utils.OptAsStringSlice(attrEvs[0].APIOpts, utils.OptsAttributesIDs)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -237,7 +237,7 @@ func TestAttributeProfileForEvent(t *testing.T) {
|
||||
t.Errorf("Expecting: %+v, received: %+v", utils.ToJSON(atrPs[0]), utils.ToJSON(atrp))
|
||||
}
|
||||
|
||||
attrIDs, err = utils.OptAsStringSlice(attrEvs[1].APIOpts, utils.OptsAttributesAttributeIDs)
|
||||
attrIDs, err = utils.OptAsStringSlice(attrEvs[1].APIOpts, utils.OptsAttributesIDs)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -256,7 +256,7 @@ func TestAttributeProfileForEvent(t *testing.T) {
|
||||
t.Errorf("Expecting: %+v, received: %+v", utils.ToJSON(atrPs[1]), utils.ToJSON(atrp))
|
||||
}
|
||||
|
||||
attrIDs, err = utils.OptAsStringSlice(attrEvs[2].APIOpts, utils.OptsAttributesAttributeIDs)
|
||||
attrIDs, err = utils.OptAsStringSlice(attrEvs[2].APIOpts, utils.OptsAttributesIDs)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -316,7 +316,7 @@ func TestAttributeProcessEventWithNotFound(t *testing.T) {
|
||||
|
||||
func TestAttributeProcessEventWithIDs(t *testing.T) {
|
||||
attrEvs[3].Event["Account"] = "1010" //Field added in event after process
|
||||
attrEvs[3].APIOpts[utils.OptsAttributesAttributeIDs] = []string{"AttributeIDMatch"}
|
||||
attrEvs[3].APIOpts[utils.OptsAttributesIDs] = []string{"AttributeIDMatch"}
|
||||
eRply := &AttrSProcessEventReply{
|
||||
MatchedProfiles: []string{"cgrates.org:AttributeIDMatch"},
|
||||
AlteredFields: []string{utils.MetaReq + utils.NestingSep + "Account"},
|
||||
|
||||
@@ -230,9 +230,9 @@ func TestChargersprocessEventCallErr(t *testing.T) {
|
||||
"RunID": utils.MetaDefault,
|
||||
},
|
||||
APIOpts: map[string]interface{}{
|
||||
utils.OptsAttributesAttributeIDs: []string(nil),
|
||||
utils.Subsys: utils.MetaChargers,
|
||||
utils.OptsContext: utils.MetaChargers,
|
||||
utils.OptsAttributesIDs: []string(nil),
|
||||
utils.Subsys: utils.MetaChargers,
|
||||
utils.OptsContext: utils.MetaChargers,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user