mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Make APIAttributeProfile Weights field of type DynamicWeights
This commit is contained in:
committed by
Dan Christian Bogos
parent
0f414405b4
commit
52a1902c65
@@ -178,7 +178,11 @@ func testAttributeSetAttributeProfile(t *testing.T) {
|
||||
Value: "cgrates.itsyscom",
|
||||
},
|
||||
},
|
||||
Weights: ";20",
|
||||
Weights: utils.DynamicWeights{
|
||||
{
|
||||
Weight: 20,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
var reply string
|
||||
@@ -205,7 +209,11 @@ func testAttributeSetAttributeProfile(t *testing.T) {
|
||||
Value: "cgrates.itsyscom",
|
||||
},
|
||||
},
|
||||
Weights: ";20",
|
||||
Weights: utils.DynamicWeights{
|
||||
{
|
||||
Weight: 20,
|
||||
},
|
||||
},
|
||||
}
|
||||
var result engine.APIAttributeProfile
|
||||
if err := attrSRPC.Call(context.Background(), utils.AdminSv1GetAttributeProfile,
|
||||
@@ -255,7 +263,11 @@ func testAttributeGetAttributes(t *testing.T) {
|
||||
Value: "cgrates.itsyscom",
|
||||
},
|
||||
},
|
||||
Weights: ";20",
|
||||
Weights: utils.DynamicWeights{
|
||||
{
|
||||
Weight: 20,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
if err := attrSRPC.Call(context.Background(), utils.AdminSv1GetAttributeProfiles,
|
||||
@@ -363,7 +375,11 @@ func testAttributeGetAttributes2(t *testing.T) {
|
||||
Value: "cgrates.itsyscom",
|
||||
},
|
||||
},
|
||||
Weights: ";20",
|
||||
Weights: utils.DynamicWeights{
|
||||
{
|
||||
Weight: 20,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Tenant: utils.CGRateSorg,
|
||||
@@ -467,7 +483,11 @@ func testAttributeGetAttributesAfterRemove(t *testing.T) {
|
||||
Value: "cgrates.itsyscom",
|
||||
},
|
||||
},
|
||||
Weights: ";20",
|
||||
Weights: utils.DynamicWeights{
|
||||
{
|
||||
Weight: 20,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
if err := attrSRPC.Call(context.Background(), utils.AdminSv1GetAttributeProfiles,
|
||||
@@ -542,7 +562,11 @@ func testAttributeSGetAttributesWithPrefix(t *testing.T) {
|
||||
Value: "cgrates.itsyscom",
|
||||
},
|
||||
},
|
||||
Weights: ";20",
|
||||
Weights: utils.DynamicWeights{
|
||||
{
|
||||
Weight: 20,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
if err := attrSRPC.Call(context.Background(), utils.AdminSv1GetAttributeProfiles,
|
||||
@@ -615,7 +639,11 @@ func testAttributeSGetAttributeForEventAnyContext(t *testing.T) {
|
||||
Value: "1001",
|
||||
},
|
||||
},
|
||||
Weights: ";20",
|
||||
Weights: utils.DynamicWeights{
|
||||
{
|
||||
Weight: 20,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
var result string
|
||||
@@ -650,7 +678,11 @@ func testAttributeSGetAttributeForEventAnyContext(t *testing.T) {
|
||||
Value: "1001",
|
||||
},
|
||||
},
|
||||
Weights: ";20",
|
||||
Weights: utils.DynamicWeights{
|
||||
{
|
||||
Weight: 20,
|
||||
},
|
||||
},
|
||||
}
|
||||
if !reflect.DeepEqual(expAttrFromEv, attrReply) {
|
||||
t.Errorf("Expecting: %s, received: %s", utils.ToJSON(expAttrFromEv), utils.ToJSON(attrReply))
|
||||
@@ -686,7 +718,11 @@ func testAttributeSGetAttributeForEventSameAnyContext(t *testing.T) {
|
||||
Value: "1001",
|
||||
},
|
||||
},
|
||||
Weights: ";20",
|
||||
Weights: utils.DynamicWeights{
|
||||
{
|
||||
Weight: 20,
|
||||
},
|
||||
},
|
||||
}
|
||||
if !reflect.DeepEqual(expAttrFromEv, attrReply) {
|
||||
t.Errorf("Expecting: %s, received: %s", utils.ToJSON(expAttrFromEv), utils.ToJSON(attrReply))
|
||||
@@ -744,7 +780,11 @@ func testAttributeSGetAttributeForEvent(t *testing.T) {
|
||||
FilterIDs: []string{},
|
||||
},
|
||||
},
|
||||
Weights: ";20",
|
||||
Weights: utils.DynamicWeights{
|
||||
{
|
||||
Weight: 20,
|
||||
},
|
||||
},
|
||||
}
|
||||
if *encoding == utils.MetaGOB {
|
||||
eAttrPrf.Attributes[0].FilterIDs = nil
|
||||
@@ -770,7 +810,11 @@ func testAttributeSGetAttributeForEvent(t *testing.T) {
|
||||
FilterIDs: []string{},
|
||||
},
|
||||
},
|
||||
Weights: ";20",
|
||||
Weights: utils.DynamicWeights{
|
||||
{
|
||||
Weight: 20,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
if err := attrSRPC.Call(context.Background(), utils.AdminSv1SetAttributeProfile,
|
||||
@@ -860,7 +904,11 @@ func testAttributeProcessEventWithSearchAndReplace(t *testing.T) {
|
||||
},
|
||||
},
|
||||
Blocker: true,
|
||||
Weights: ";20",
|
||||
Weights: utils.DynamicWeights{
|
||||
{
|
||||
Weight: 20,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
var result string
|
||||
@@ -918,7 +966,11 @@ func testAttributeSProcessWithMultipleRuns(t *testing.T) {
|
||||
Value: "Value1",
|
||||
},
|
||||
},
|
||||
Weights: ";20",
|
||||
Weights: utils.DynamicWeights{
|
||||
{
|
||||
Weight: 20,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
attrPrf2 := &engine.APIAttributeProfileWithAPIOpts{
|
||||
@@ -932,7 +984,11 @@ func testAttributeSProcessWithMultipleRuns(t *testing.T) {
|
||||
Value: "Value2",
|
||||
},
|
||||
},
|
||||
Weights: ";20",
|
||||
Weights: utils.DynamicWeights{
|
||||
{
|
||||
Weight: 20,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
attrPrf3 := &engine.APIAttributeProfileWithAPIOpts{
|
||||
@@ -946,7 +1002,11 @@ func testAttributeSProcessWithMultipleRuns(t *testing.T) {
|
||||
Value: "Value3",
|
||||
},
|
||||
},
|
||||
Weights: ";20",
|
||||
Weights: utils.DynamicWeights{
|
||||
{
|
||||
Weight: 20,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
// Add attribute in DM
|
||||
@@ -1022,7 +1082,11 @@ func testAttributeSProcessWithMultipleRuns2(t *testing.T) {
|
||||
Value: "Value1",
|
||||
},
|
||||
},
|
||||
Weights: ";20",
|
||||
Weights: utils.DynamicWeights{
|
||||
{
|
||||
Weight: 20,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
attrPrf2 := &engine.APIAttributeProfileWithAPIOpts{
|
||||
@@ -1036,7 +1100,11 @@ func testAttributeSProcessWithMultipleRuns2(t *testing.T) {
|
||||
Value: "Value2",
|
||||
},
|
||||
},
|
||||
Weights: ";20",
|
||||
Weights: utils.DynamicWeights{
|
||||
{
|
||||
Weight: 20,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
attrPrf3 := &engine.APIAttributeProfileWithAPIOpts{
|
||||
@@ -1050,7 +1118,11 @@ func testAttributeSProcessWithMultipleRuns2(t *testing.T) {
|
||||
Value: "Value3",
|
||||
},
|
||||
},
|
||||
Weights: ";20",
|
||||
Weights: utils.DynamicWeights{
|
||||
{
|
||||
Weight: 20,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
// Add attributeProfiles
|
||||
|
||||
@@ -449,7 +449,11 @@ func testCacheSSetMoreAttributeProfiles(t *testing.T) {
|
||||
Value: "Value1",
|
||||
},
|
||||
},
|
||||
Weights: ";10",
|
||||
Weights: utils.DynamicWeights{
|
||||
{
|
||||
Weight: 10,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
attrPrf2 := &engine.APIAttributeProfileWithAPIOpts{
|
||||
@@ -463,7 +467,11 @@ func testCacheSSetMoreAttributeProfiles(t *testing.T) {
|
||||
Value: "Value2",
|
||||
},
|
||||
},
|
||||
Weights: ";20",
|
||||
Weights: utils.DynamicWeights{
|
||||
{
|
||||
Weight: 20,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
attrPrf3 := &engine.APIAttributeProfileWithAPIOpts{
|
||||
@@ -477,7 +485,11 @@ func testCacheSSetMoreAttributeProfiles(t *testing.T) {
|
||||
Value: "Value3",
|
||||
},
|
||||
},
|
||||
Weights: ";30",
|
||||
Weights: utils.DynamicWeights{
|
||||
{
|
||||
Weight: 30,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
// Add attributeProfiles
|
||||
|
||||
@@ -811,7 +811,11 @@ func TestFiltersSetFilterReloadCache(t *testing.T) {
|
||||
APIAttributeProfile: &engine.APIAttributeProfile{
|
||||
FilterIDs: []string{"FLTR_ID"},
|
||||
ID: "ATTR_ID",
|
||||
Weights: ";10",
|
||||
Weights: utils.DynamicWeights{
|
||||
{
|
||||
Weight: 10,
|
||||
},
|
||||
},
|
||||
Attributes: []*engine.ExternalAttribute{
|
||||
{
|
||||
Path: "*req.Account",
|
||||
@@ -979,7 +983,11 @@ func TestFiltersSetFilterClearCache(t *testing.T) {
|
||||
APIAttributeProfile: &engine.APIAttributeProfile{
|
||||
FilterIDs: []string{"FLTR_ID"},
|
||||
ID: "ATTR_ID",
|
||||
Weights: ";10",
|
||||
Weights: utils.DynamicWeights{
|
||||
{
|
||||
Weight: 10,
|
||||
},
|
||||
},
|
||||
Attributes: []*engine.ExternalAttribute{
|
||||
{
|
||||
Path: "*req.Account",
|
||||
|
||||
@@ -614,7 +614,11 @@ func testLoadersGetAttributeProfiles(t *testing.T) {
|
||||
},
|
||||
},
|
||||
Blocker: true,
|
||||
Weights: ";20",
|
||||
Weights: utils.DynamicWeights{
|
||||
{
|
||||
Weight: 20,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Tenant: "cgrates.org",
|
||||
@@ -634,7 +638,11 @@ func testLoadersGetAttributeProfiles(t *testing.T) {
|
||||
},
|
||||
},
|
||||
Blocker: true,
|
||||
Weights: ";20",
|
||||
Weights: utils.DynamicWeights{
|
||||
{
|
||||
Weight: 20,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
var attrs []*engine.APIAttributeProfile
|
||||
|
||||
@@ -401,7 +401,11 @@ func testCgrLdrGetAttributeProfileAfterLoad(t *testing.T) {
|
||||
Tenant: utils.CGRateSorg,
|
||||
ID: "ATTR_ACNT_1001",
|
||||
FilterIDs: []string{"*string:~*opts.*context:*sessions", "FLTR_ACCOUNT_1001"},
|
||||
Weights: ";10",
|
||||
Weights: utils.DynamicWeights{
|
||||
{
|
||||
Weight: 10,
|
||||
},
|
||||
},
|
||||
Attributes: []*engine.ExternalAttribute{
|
||||
{
|
||||
FilterIDs: []string{},
|
||||
|
||||
@@ -233,7 +233,11 @@ func testDspAttrGetAttrFailover(t *testing.T) {
|
||||
Type: utils.MetaConstant,
|
||||
Value: "CGRateS.org",
|
||||
}},
|
||||
Weights: ";20",
|
||||
Weights: utils.DynamicWeights{
|
||||
{
|
||||
Weight: 20,
|
||||
},
|
||||
},
|
||||
}
|
||||
if *encoding == utils.MetaGOB {
|
||||
eAttrPrf.Attributes[0].FilterIDs = nil // empty slice are nil in gob
|
||||
@@ -412,7 +416,11 @@ func testDspAttrTestAuthKey2(t *testing.T) {
|
||||
Type: utils.MetaConstant,
|
||||
Value: "CGRateS.org",
|
||||
}},
|
||||
Weights: ";20",
|
||||
Weights: utils.DynamicWeights{
|
||||
{
|
||||
Weight: 20,
|
||||
},
|
||||
},
|
||||
}
|
||||
if *encoding == utils.MetaGOB {
|
||||
eAttrPrf.Attributes[0].FilterIDs = nil // empty slice are nil in gob
|
||||
@@ -499,7 +507,11 @@ func testDspAttrGetAttrRoundRobin(t *testing.T) {
|
||||
Type: utils.MetaConstant,
|
||||
Value: "CGRateS.org",
|
||||
}},
|
||||
Weights: ";20",
|
||||
Weights: utils.DynamicWeights{
|
||||
{
|
||||
Weight: 20,
|
||||
},
|
||||
},
|
||||
}
|
||||
if *encoding == utils.MetaGOB {
|
||||
eAttrPrf.Attributes[0].FilterIDs = nil // empty slice are nil in gob
|
||||
|
||||
@@ -100,7 +100,7 @@ type APIAttributeProfile struct {
|
||||
FilterIDs []string
|
||||
Attributes []*ExternalAttribute
|
||||
Blocker bool // blocker flag to stop processing on multiple runs
|
||||
Weights string
|
||||
Weights utils.DynamicWeights
|
||||
}
|
||||
|
||||
type APIAttributeProfileWithAPIOpts struct {
|
||||
@@ -115,7 +115,7 @@ func NewAPIAttributeProfile(attr *AttributeProfile) (ext *APIAttributeProfile) {
|
||||
FilterIDs: attr.FilterIDs,
|
||||
Attributes: make([]*ExternalAttribute, len(attr.Attributes)),
|
||||
Blocker: attr.Blocker,
|
||||
Weights: attr.Weights.String(utils.InfieldSep, utils.ANDSep),
|
||||
Weights: attr.Weights,
|
||||
}
|
||||
for i, at := range attr.Attributes {
|
||||
ext.Attributes[i] = &ExternalAttribute{
|
||||
@@ -134,11 +134,6 @@ func (ext *APIAttributeProfile) AsAttributeProfile() (attr *AttributeProfile, er
|
||||
if len(ext.Attributes) == 0 {
|
||||
return nil, utils.NewErrMandatoryIeMissing("Attributes")
|
||||
}
|
||||
if ext.Weights != utils.EmptyString {
|
||||
if attr.Weights, err = utils.NewDynamicWeightsFromString(ext.Weights, utils.InfieldSep, utils.ANDSep); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
attr.Attributes = make([]*Attribute, len(ext.Attributes))
|
||||
for i, extAttr := range ext.Attributes {
|
||||
if extAttr.Path == utils.EmptyString {
|
||||
@@ -158,6 +153,7 @@ func (ext *APIAttributeProfile) AsAttributeProfile() (attr *AttributeProfile, er
|
||||
attr.Tenant = ext.Tenant
|
||||
attr.ID = ext.ID
|
||||
attr.FilterIDs = ext.FilterIDs
|
||||
attr.Weights = ext.Weights
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,11 @@ func TestConvertExternalToProfile(t *testing.T) {
|
||||
Value: "1001",
|
||||
},
|
||||
},
|
||||
Weights: ";20",
|
||||
Weights: utils.DynamicWeights{
|
||||
{
|
||||
Weight: 20,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
expAttr := &AttributeProfile{
|
||||
@@ -73,7 +77,11 @@ func TestConvertExternalToProfileMissing(t *testing.T) {
|
||||
ID: "ATTR_ID",
|
||||
FilterIDs: []string{"FLTR_ACNT_dan", "FLTR_DST_DE", "*ai:~*req.AnswerTime:2014-07-14T14:35:00Z|2014-07-14T14:36:00Z", "*string:~*opts.*context:*sessions|*cdrs"},
|
||||
Attributes: []*ExternalAttribute{},
|
||||
Weights: ";20",
|
||||
Weights: utils.DynamicWeights{
|
||||
{
|
||||
Weight: 20,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
_, err := external.AsAttributeProfile()
|
||||
@@ -93,7 +101,11 @@ func TestConvertExternalToProfileMissing2(t *testing.T) {
|
||||
Path: utils.MetaReq + utils.NestingSep + "Account",
|
||||
},
|
||||
},
|
||||
Weights: ";20",
|
||||
Weights: utils.DynamicWeights{
|
||||
{
|
||||
Weight: 20,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
_, err := external.AsAttributeProfile()
|
||||
|
||||
@@ -186,10 +186,14 @@ func TestAttributesV1GetAttributeForEventProfileIgnoreOpts(t *testing.T) {
|
||||
}
|
||||
rply := &APIAttributeProfile{}
|
||||
expected := &APIAttributeProfile{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "AC1",
|
||||
FilterIDs: []string{"*string:~*req.Attribute:testAttrValue"},
|
||||
Weights: ";20",
|
||||
Tenant: "cgrates.org",
|
||||
ID: "AC1",
|
||||
FilterIDs: []string{"*string:~*req.Attribute:testAttrValue"},
|
||||
Weights: utils.DynamicWeights{
|
||||
{
|
||||
Weight: 20,
|
||||
},
|
||||
},
|
||||
Attributes: []*ExternalAttribute{},
|
||||
}
|
||||
|
||||
@@ -219,7 +223,11 @@ func TestAttributesV1GetAttributeForEventProfileIgnoreOpts(t *testing.T) {
|
||||
ID: "AC1",
|
||||
FilterIDs: []string{"*string:~*req.Attribute:testAttrValue"},
|
||||
Attributes: []*ExternalAttribute{},
|
||||
Weights: ";20",
|
||||
Weights: utils.DynamicWeights{
|
||||
{
|
||||
Weight: 20,
|
||||
},
|
||||
},
|
||||
}
|
||||
// with ignore filters on true and with bad filter
|
||||
err = aA.V1GetAttributeForEvent(context.Background(), ev2, rply2)
|
||||
@@ -4414,7 +4422,11 @@ func TestAttributesV1GetAttributeForEvent(t *testing.T) {
|
||||
Value: ".co.uk",
|
||||
},
|
||||
},
|
||||
Weights: ";20",
|
||||
Weights: utils.DynamicWeights{
|
||||
{
|
||||
Weight: 20,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
err = alS.V1GetAttributeForEvent(context.Background(), ev, rply)
|
||||
|
||||
@@ -148,7 +148,11 @@ func testAttributeSetProfile(t *testing.T) {
|
||||
Path: "*req.FL1",
|
||||
Value: "Al1",
|
||||
}},
|
||||
Weights: ";20",
|
||||
Weights: utils.DynamicWeights{
|
||||
{
|
||||
Weight: 20,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
if err := attrFltrRPC.Call(context.Background(), utils.AdminSv1SetAttributeProfile, alsPrf, &result); err != nil {
|
||||
|
||||
@@ -196,7 +196,11 @@ func testAttributeSProcessEventWithAccount(t *testing.T) {
|
||||
},
|
||||
},
|
||||
Blocker: false,
|
||||
Weights: ";10",
|
||||
Weights: utils.DynamicWeights{
|
||||
{
|
||||
Weight: 10,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
if err := attrRPC.Call(context.Background(), utils.AdminSv1SetAttributeProfile, alsPrf, &result); err != nil {
|
||||
@@ -263,7 +267,11 @@ func testAttributeSProcessEventWithAccountFull(t *testing.T) {
|
||||
},
|
||||
},
|
||||
Blocker: false,
|
||||
Weights: ";10",
|
||||
Weights: utils.DynamicWeights{
|
||||
{
|
||||
Weight: 10,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
if err := attrRPC.Call(context.Background(), utils.AdminSv1SetAttributeProfile, alsPrf, &result); err != nil {
|
||||
@@ -370,7 +378,11 @@ func testAttributeSProcessEventWithStat(t *testing.T) {
|
||||
},
|
||||
},
|
||||
Blocker: false,
|
||||
Weights: ";10",
|
||||
Weights: utils.DynamicWeights{
|
||||
{
|
||||
Weight: 10,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
var result string
|
||||
@@ -438,7 +450,11 @@ func testAttributeSProcessEventWithStatFull(t *testing.T) {
|
||||
},
|
||||
},
|
||||
Blocker: false,
|
||||
Weights: ";10",
|
||||
Weights: utils.DynamicWeights{
|
||||
{
|
||||
Weight: 10,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
var result string
|
||||
@@ -573,7 +589,11 @@ func testAttributeSProcessEventWithResource(t *testing.T) {
|
||||
},
|
||||
},
|
||||
Blocker: false,
|
||||
Weights: ";10",
|
||||
Weights: utils.DynamicWeights{
|
||||
{
|
||||
Weight: 10,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
if err := attrRPC.Call(context.Background(), utils.AdminSv1SetAttributeProfile, alsPrf, &result); err != nil {
|
||||
@@ -645,7 +665,11 @@ func testAttributeSProcessEventWithResourceFull(t *testing.T) {
|
||||
},
|
||||
},
|
||||
Blocker: false,
|
||||
Weights: ";10",
|
||||
Weights: utils.DynamicWeights{
|
||||
{
|
||||
Weight: 10,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
if err := attrRPC.Call(context.Background(), utils.AdminSv1SetAttributeProfile, alsPrf, &result); err != nil {
|
||||
@@ -725,7 +749,11 @@ func testAttributeSProcessEventWithLibPhoneNumber(t *testing.T) {
|
||||
},
|
||||
},
|
||||
Blocker: false,
|
||||
Weights: ";10",
|
||||
Weights: utils.DynamicWeights{
|
||||
{
|
||||
Weight: 10,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
if err := attrRPC.Call(context.Background(), utils.AdminSv1SetAttributeProfile, alsPrf, &result); err != nil {
|
||||
@@ -809,7 +837,11 @@ func testAttributeSProcessEventWithLibPhoneNumberComposed(t *testing.T) {
|
||||
},
|
||||
},
|
||||
Blocker: false,
|
||||
Weights: ";10",
|
||||
Weights: utils.DynamicWeights{
|
||||
{
|
||||
Weight: 10,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
if err := attrRPC.Call(context.Background(), utils.AdminSv1SetAttributeProfile, alsPrf, &result); err != nil {
|
||||
@@ -883,7 +915,11 @@ func testAttributeSProcessEventWithLibPhoneNumberFull(t *testing.T) {
|
||||
},
|
||||
},
|
||||
Blocker: false,
|
||||
Weights: ";10",
|
||||
Weights: utils.DynamicWeights{
|
||||
{
|
||||
Weight: 10,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
if err := attrRPC.Call(context.Background(), utils.AdminSv1SetAttributeProfile, alsPrf, &result); err != nil {
|
||||
|
||||
@@ -169,7 +169,11 @@ func testFltrRplAttributeProfile(t *testing.T) {
|
||||
Value: utils.InfieldSep,
|
||||
},
|
||||
},
|
||||
Weights: ";10",
|
||||
Weights: utils.DynamicWeights{
|
||||
{
|
||||
Weight: 10,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
var result string
|
||||
@@ -218,7 +222,11 @@ func testFltrRplAttributeProfile(t *testing.T) {
|
||||
t.Errorf("Expecting : %s, received: %s", utils.ToJSON(attrPrf.APIAttributeProfile), utils.ToJSON(replyPrfl))
|
||||
}
|
||||
replyPrfl = nil
|
||||
attrPrf.Weights = ";15"
|
||||
attrPrf.Weights = utils.DynamicWeights{
|
||||
{
|
||||
Weight: 10,
|
||||
},
|
||||
}
|
||||
if err := fltrRplInternalRPC.Call(context.Background(), utils.AdminSv1SetAttributeProfile, attrPrf, &result); err != nil {
|
||||
t.Fatal(err)
|
||||
} else if result != utils.OK {
|
||||
|
||||
@@ -137,7 +137,11 @@ func testLoadersIDBIdxCheckAttributes(t *testing.T) {
|
||||
Type: utils.MetaConstant,
|
||||
Value: "CGRateS.org",
|
||||
}},
|
||||
Weights: ";20",
|
||||
Weights: utils.DynamicWeights{
|
||||
{
|
||||
Weight: 20,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
var reply *engine.APIAttributeProfile
|
||||
|
||||
@@ -243,7 +243,11 @@ func testLoaderCheckAttributes(t *testing.T) {
|
||||
Value: "Sub2",
|
||||
}},
|
||||
Blocker: true,
|
||||
Weights: ";20",
|
||||
Weights: utils.DynamicWeights{
|
||||
{
|
||||
Weight: 20,
|
||||
},
|
||||
},
|
||||
}
|
||||
if *encoding == utils.MetaGOB { // gob threats empty slices as nil values
|
||||
eAttrPrf.Attributes[1].FilterIDs = nil
|
||||
|
||||
Reference in New Issue
Block a user