mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Update ActionS loding from CSV
This commit is contained in:
committed by
Dan Christian Bogos
parent
a82c3c5f83
commit
fd658aeb01
@@ -1491,44 +1491,39 @@ func TestLoadActionProfiles(t *testing.T) {
|
||||
},
|
||||
Actions: []*utils.TPAPAction{
|
||||
{
|
||||
ID: "TOPUP",
|
||||
FilterIDs: []string{},
|
||||
TTL: "0s",
|
||||
Type: "*topup",
|
||||
Path: "~*balance.TestBalance.Value",
|
||||
Value: "10",
|
||||
ID: "TOPUP",
|
||||
TTL: "0s",
|
||||
Type: "*topup",
|
||||
Path: "~*balance.TestBalance.Value",
|
||||
Value: "10",
|
||||
},
|
||||
{
|
||||
ID: "SET_BALANCE_TEST_DATA",
|
||||
FilterIDs: []string{},
|
||||
TTL: "0s",
|
||||
Type: "*set_balance",
|
||||
Path: "~*balance.TestDataBalance.Type",
|
||||
Value: "*data",
|
||||
ID: "SET_BALANCE_TEST_DATA",
|
||||
TTL: "0s",
|
||||
Type: "*set_balance",
|
||||
Path: "~*balance.TestDataBalance.Type",
|
||||
Value: "*data",
|
||||
},
|
||||
{
|
||||
ID: "TOPUP_TEST_DATA",
|
||||
FilterIDs: []string{},
|
||||
TTL: "0s",
|
||||
Type: "*topup",
|
||||
Path: "~*balance.TestDataBalance.Value",
|
||||
Value: "1024",
|
||||
ID: "TOPUP_TEST_DATA",
|
||||
TTL: "0s",
|
||||
Type: "*topup",
|
||||
Path: "~*balance.TestDataBalance.Value",
|
||||
Value: "1024",
|
||||
},
|
||||
{
|
||||
ID: "SET_BALANCE_TEST_VOICE",
|
||||
FilterIDs: []string{},
|
||||
TTL: "0s",
|
||||
Type: "*set_balance",
|
||||
Path: "~*balance.TestVoiceBalance.Type",
|
||||
Value: "*voice",
|
||||
ID: "SET_BALANCE_TEST_VOICE",
|
||||
TTL: "0s",
|
||||
Type: "*set_balance",
|
||||
Path: "~*balance.TestVoiceBalance.Type",
|
||||
Value: "*voice",
|
||||
},
|
||||
{
|
||||
ID: "TOPUP_TEST_VOICE",
|
||||
FilterIDs: []string{},
|
||||
TTL: "0s",
|
||||
Type: "*topup",
|
||||
Path: "~*balance.TestVoiceBalance.Value",
|
||||
Value: "15m15s",
|
||||
ID: "TOPUP_TEST_VOICE",
|
||||
TTL: "0s",
|
||||
Type: "*topup",
|
||||
Path: "~*balance.TestVoiceBalance.Value",
|
||||
Value: "15m15s",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -3221,23 +3221,21 @@ func (tps ActionProfileMdls) AsTPActionProfile() (result []*utils.TPActionProfil
|
||||
}
|
||||
|
||||
if tp.ActionID != utils.EmptyString {
|
||||
filterIDs := make([]string, 0)
|
||||
if tp.ActionFilterIDs != utils.EmptyString {
|
||||
filterAttrSplit := strings.Split(tp.ActionFilterIDs, utils.InfieldSep)
|
||||
for _, filterAttr := range filterAttrSplit {
|
||||
filterIDs = append(filterIDs, filterAttr)
|
||||
}
|
||||
tpAAction := &utils.TPAPAction{
|
||||
ID: tp.ActionID,
|
||||
Blocker: tp.ActionBlocker,
|
||||
TTL: tp.ActionTTL,
|
||||
Type: tp.ActionType,
|
||||
Opts: tp.ActionOpts,
|
||||
Path: tp.ActionPath,
|
||||
Value: tp.ActionValue,
|
||||
}
|
||||
aPrf.Actions = append(aPrf.Actions, &utils.TPAPAction{
|
||||
ID: tp.ActionID,
|
||||
FilterIDs: filterIDs,
|
||||
Blocker: tp.ActionBlocker,
|
||||
TTL: tp.ActionTTL,
|
||||
Type: tp.ActionType,
|
||||
Opts: tp.ActionOpts,
|
||||
Path: tp.ActionPath,
|
||||
Value: tp.ActionValue,
|
||||
})
|
||||
if tp.ActionFilterIDs != utils.EmptyString {
|
||||
filterIDs := make(utils.StringSet)
|
||||
filterIDs.AddSlice(strings.Split(tp.ActionFilterIDs, utils.InfieldSep))
|
||||
tpAAction.FilterIDs = filterIDs.AsSlice()
|
||||
}
|
||||
aPrf.Actions = append(aPrf.Actions, tpAAction)
|
||||
}
|
||||
actPrfMap[tenID] = aPrf
|
||||
}
|
||||
|
||||
@@ -2447,39 +2447,34 @@ func TestLoaderActionProfile(t *testing.T) {
|
||||
},
|
||||
Actions: []*engine.APAction{
|
||||
&engine.APAction{
|
||||
ID: "TOPUP",
|
||||
FilterIDs: []string{},
|
||||
Type: "*topup",
|
||||
Path: "~*balance.TestBalance.Value",
|
||||
Value: config.NewRSRParsersMustCompile("10", utils.InfieldSep),
|
||||
ID: "TOPUP",
|
||||
Type: "*topup",
|
||||
Path: "~*balance.TestBalance.Value",
|
||||
Value: config.NewRSRParsersMustCompile("10", utils.InfieldSep),
|
||||
},
|
||||
&engine.APAction{
|
||||
ID: "SET_BALANCE_TEST_DATA",
|
||||
FilterIDs: []string{},
|
||||
Type: "*set_balance",
|
||||
Path: "~*balance.TestDataBalance.Type",
|
||||
Value: config.NewRSRParsersMustCompile("*data", utils.InfieldSep),
|
||||
ID: "SET_BALANCE_TEST_DATA",
|
||||
Type: "*set_balance",
|
||||
Path: "~*balance.TestDataBalance.Type",
|
||||
Value: config.NewRSRParsersMustCompile("*data", utils.InfieldSep),
|
||||
},
|
||||
&engine.APAction{
|
||||
ID: "TOPUP_TEST_DATA",
|
||||
FilterIDs: []string{},
|
||||
Type: "*topup",
|
||||
Path: "~*balance.TestDataBalance.Value",
|
||||
Value: config.NewRSRParsersMustCompile("1024", utils.InfieldSep),
|
||||
ID: "TOPUP_TEST_DATA",
|
||||
Type: "*topup",
|
||||
Path: "~*balance.TestDataBalance.Value",
|
||||
Value: config.NewRSRParsersMustCompile("1024", utils.InfieldSep),
|
||||
},
|
||||
&engine.APAction{
|
||||
ID: "SET_BALANCE_TEST_VOICE",
|
||||
FilterIDs: []string{},
|
||||
Type: "*set_balance",
|
||||
Path: "~*balance.TestVoiceBalance.Type",
|
||||
Value: config.NewRSRParsersMustCompile("*voice", utils.InfieldSep),
|
||||
ID: "SET_BALANCE_TEST_VOICE",
|
||||
Type: "*set_balance",
|
||||
Path: "~*balance.TestVoiceBalance.Type",
|
||||
Value: config.NewRSRParsersMustCompile("*voice", utils.InfieldSep),
|
||||
},
|
||||
&engine.APAction{
|
||||
ID: "TOPUP_TEST_VOICE",
|
||||
FilterIDs: []string{},
|
||||
Type: "*topup",
|
||||
Path: "~*balance.TestVoiceBalance.Value",
|
||||
Value: config.NewRSRParsersMustCompile("15m15s", utils.InfieldSep),
|
||||
ID: "TOPUP_TEST_VOICE",
|
||||
Type: "*topup",
|
||||
Path: "~*balance.TestVoiceBalance.Value",
|
||||
Value: config.NewRSRParsersMustCompile("15m15s", utils.InfieldSep),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user