mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-24 16:48:45 +05:00
Add Charger in migrator and add API for TPCharger
This commit is contained in:
committed by
Dan Christian Bogos
parent
38c087d626
commit
5ddbfbfc51
@@ -304,7 +304,8 @@ cgrates.org,ALS1,con1,FLTR_1,2014-07-29T15:00:00Z,Field1,Initial1,Sub1,true,20
|
||||
cgrates.org,ALS1,con2;con3,,,Field2,Initial2,Sub2,false,
|
||||
`
|
||||
chargerProfiles = `
|
||||
|
||||
#Tenant,ID,FilterIDs,ActivationInterval,RunID,AttributeIDs,Weight
|
||||
cgrates.org,Charger1,*string:Account:1001,2014-07-29T15:00:00Z,*rated,ATTR_1001_SIMPLEAUTH,20
|
||||
`
|
||||
)
|
||||
|
||||
@@ -381,6 +382,9 @@ func init() {
|
||||
if err := csvr.LoadAttributeProfiles(); err != nil {
|
||||
log.Print("error in LoadAttributeProfiles:", err)
|
||||
}
|
||||
if err := csvr.LoadChargerProfiles(); err != nil {
|
||||
log.Print("error in LoadChargerProfiles:", err)
|
||||
}
|
||||
csvr.WriteToDatabase(false, false, false)
|
||||
Cache.Clear(nil)
|
||||
//dm.LoadDataDBCache(nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil)
|
||||
@@ -1768,6 +1772,29 @@ func TestLoadAttributeProfiles(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestLoadChargerProfiles(t *testing.T) {
|
||||
eChargerProfiles := map[utils.TenantID]*utils.TPChargerProfile{
|
||||
utils.TenantID{Tenant: "cgrates.org", ID: "Charger1"}: &utils.TPChargerProfile{
|
||||
TPid: testTPID,
|
||||
Tenant: "cgrates.org",
|
||||
ID: "Charger1",
|
||||
FilterIDs: []string{"*string:Account:1001"},
|
||||
ActivationInterval: &utils.TPActivationInterval{
|
||||
ActivationTime: "2014-07-29T15:00:00Z",
|
||||
},
|
||||
RunID: "*rated",
|
||||
AttributeIDs: []string{"ATTR_1001_SIMPLEAUTH"},
|
||||
Weight: 20,
|
||||
},
|
||||
}
|
||||
cppKey := utils.TenantID{Tenant: "cgrates.org", ID: "Charger1"}
|
||||
if len(csvr.chargerProfiles) != len(eChargerProfiles) {
|
||||
t.Errorf("Failed to load chargerProfiles: %s", utils.ToIJSON(csvr.chargerProfiles))
|
||||
} else if !reflect.DeepEqual(eChargerProfiles[cppKey], csvr.chargerProfiles[cppKey]) {
|
||||
t.Errorf("Expecting: %+v, received: %+v", eChargerProfiles[cppKey], csvr.chargerProfiles[cppKey])
|
||||
}
|
||||
}
|
||||
|
||||
func TestLoadResource(t *testing.T) {
|
||||
eResources := []*utils.TenantID{
|
||||
&utils.TenantID{
|
||||
|
||||
Reference in New Issue
Block a user