mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
fix Rename ResourceConfig -> Resource Profile after merge
This commit is contained in:
@@ -1,17 +1,14 @@
|
||||
/*
|
||||
Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
|
||||
Copyright (C) ITsysCOM GmbH
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
@@ -1707,7 +1704,6 @@ func (self *ApierV1) RemoveActions(attr AttrRemoveActions, reply *string) error
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
for _, aID := range attr.ActionIDs {
|
||||
|
||||
@@ -265,11 +265,7 @@ cgrates.org,mas,true,another,value,10
|
||||
*out,cgrates.org,call,remo,remo,*any,*rating,Subject,remo,minu,10
|
||||
*out,cgrates.org,call,remo,remo,*any,*rating,Account,remo,minu,10
|
||||
`
|
||||
<<<<<<< HEAD
|
||||
resProfiles = `
|
||||
=======
|
||||
resCfgs = `
|
||||
>>>>>>> dd8afa24867e3d532c7a2b81fc8070aceec07dad
|
||||
#Id[0],FilterType[1],FilterFieldName[2],FilterFieldValues[3],ActivationInterval[4],TTL[5],Limit[6],AllocationMessage[7],Weight[8],Thresholds[9]
|
||||
ResGroup21,*string,HdrAccount,1001;1002,2014-07-29T15:00:00Z,1s,2,call,true,true,10,
|
||||
ResGroup21,*string_prefix,HdrDestination,10;20,,,,,,,,
|
||||
@@ -290,11 +286,8 @@ var csvr *TpReader
|
||||
|
||||
func init() {
|
||||
csvr = NewTpReader(dataStorage, NewStringCSVStorage(',', destinations, timings, rates, destinationRates, ratingPlans, ratingProfiles,
|
||||
<<<<<<< HEAD
|
||||
sharedGroups, lcrs, actions, actionPlans, actionTriggers, accountActions, derivedCharges, cdrStats, users, aliases, resProfiles, stats, thresholds), testTPID, "")
|
||||
=======
|
||||
sharedGroups, lcrs, actions, actionPlans, actionTriggers, accountActions, derivedCharges, cdrStats, users, aliases, resCfgs, stats, thresholds), testTPID, "")
|
||||
>>>>>>> dd8afa24867e3d532c7a2b81fc8070aceec07dad
|
||||
|
||||
if err := csvr.LoadDestinations(); err != nil {
|
||||
log.Print("error in LoadDestinations:", err)
|
||||
}
|
||||
@@ -1396,13 +1389,8 @@ func TestLoadReverseAliases(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
func TestLoadResourceProfiles(t *testing.T) {
|
||||
eResProfiles := map[string]*utils.TPResource{
|
||||
=======
|
||||
func TestLoadResources(t *testing.T) {
|
||||
eResCfgs := map[string]*utils.TPResource{
|
||||
>>>>>>> dd8afa24867e3d532c7a2b81fc8070aceec07dad
|
||||
"ResGroup21": &utils.TPResource{
|
||||
TPid: testTPID,
|
||||
ID: "ResGroup21",
|
||||
@@ -1436,17 +1424,11 @@ func TestLoadResources(t *testing.T) {
|
||||
Limit: "2",
|
||||
},
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
if len(csvr.resProfiles) != len(eResProfiles) {
|
||||
t.Error("Failed to load resourceProfiles: ", len(csvr.resProfiles))
|
||||
} else if !reflect.DeepEqual(eResProfiles["ResGroup22"], csvr.resProfiles["ResGroup22"]) {
|
||||
t.Errorf("Expecting: %+v, received: %+v", eResProfiles["ResGroup22"], csvr.resProfiles["ResGroup22"])
|
||||
=======
|
||||
if len(csvr.resCfgs) != len(eResCfgs) {
|
||||
t.Error("Failed to load resourcelimits: ", len(csvr.resCfgs))
|
||||
} else if !reflect.DeepEqual(eResCfgs["ResGroup22"], csvr.resCfgs["ResGroup22"]) {
|
||||
t.Errorf("Expecting: %+v, received: %+v", eResCfgs["ResGroup22"], csvr.resCfgs["ResGroup22"])
|
||||
>>>>>>> dd8afa24867e3d532c7a2b81fc8070aceec07dad
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -309,13 +309,8 @@ func TestLoaderITWriteToDatabase(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
for k, rl := range loader.resProfiles {
|
||||
rcv, err := loader.dataStorage.GetResourceProfile(k, true, utils.NonTransactional)
|
||||
=======
|
||||
for k, rl := range loader.resCfgs {
|
||||
rcv, err := loader.dataStorage.GetResourceCfg(k, true, utils.NonTransactional)
|
||||
>>>>>>> dd8afa24867e3d532c7a2b81fc8070aceec07dad
|
||||
if err != nil {
|
||||
t.Error("Failed GetResourceProfile: ", err.Error())
|
||||
}
|
||||
|
||||
@@ -1,17 +1,14 @@
|
||||
/*
|
||||
Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
|
||||
Copyright (C) ITsysCOM GmbH
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
@@ -52,12 +49,7 @@ type TpReader struct {
|
||||
cdrStats map[string]*CdrStats
|
||||
users map[string]*UserProfile
|
||||
aliases map[string]*Alias
|
||||
<<<<<<< HEAD
|
||||
resProfiles map[string]*utils.TPResource
|
||||
=======
|
||||
resCfgs map[string]*utils.TPResource
|
||||
res []string // IDs of resources which need creation based on resourceConfigs
|
||||
>>>>>>> dd8afa24867e3d532c7a2b81fc8070aceec07dad
|
||||
stats map[string]*utils.TPStats
|
||||
thresholds map[string]*utils.TPThreshold
|
||||
|
||||
@@ -131,11 +123,7 @@ func (tpr *TpReader) Init() {
|
||||
tpr.users = make(map[string]*UserProfile)
|
||||
tpr.aliases = make(map[string]*Alias)
|
||||
tpr.derivedChargers = make(map[string]*utils.DerivedChargers)
|
||||
<<<<<<< HEAD
|
||||
tpr.resProfiles = make(map[string]*utils.TPResource)
|
||||
=======
|
||||
tpr.resCfgs = make(map[string]*utils.TPResource)
|
||||
>>>>>>> dd8afa24867e3d532c7a2b81fc8070aceec07dad
|
||||
tpr.stats = make(map[string]*utils.TPStats)
|
||||
tpr.thresholds = make(map[string]*utils.TPThreshold)
|
||||
tpr.revDests = make(map[string][]string)
|
||||
@@ -1609,18 +1597,7 @@ func (tpr *TpReader) LoadResourceProfilesFiltered(tag string) error {
|
||||
for _, rl := range rls {
|
||||
mapRsPs[rl.ID] = rl
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
tpr.resProfiles = mapRsPs
|
||||
=======
|
||||
tpr.resCfgs = mapRLs
|
||||
for rID := range mapRLs {
|
||||
if has, err := tpr.dataStorage.HasData(utils.ResourcesPrefix, rID); err != nil {
|
||||
return err
|
||||
} else if !has {
|
||||
tpr.res = append(tpr.res, rID)
|
||||
}
|
||||
}
|
||||
>>>>>>> dd8afa24867e3d532c7a2b81fc8070aceec07dad
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -1953,37 +1930,10 @@ func (tpr *TpReader) WriteToDatabase(flush, verbose, disable_reverse bool) (err
|
||||
}
|
||||
}
|
||||
if verbose {
|
||||
<<<<<<< HEAD
|
||||
log.Print("ResourceProfiles:")
|
||||
}
|
||||
for _, tpRsp := range tpr.resProfiles {
|
||||
rsp, err := APItoResource(tpRsp, tpr.timezone)
|
||||
=======
|
||||
log.Print("ResourceConfigs:")
|
||||
}
|
||||
for _, tpRL := range tpr.resCfgs {
|
||||
rl, err := APItoResource(tpRL, tpr.timezone)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err = tpr.dataStorage.SetResourceCfg(rl, utils.NonTransactional); err != nil {
|
||||
return err
|
||||
}
|
||||
if verbose {
|
||||
log.Print("\t", rl.ID)
|
||||
}
|
||||
}
|
||||
if verbose {
|
||||
log.Print("Resources:")
|
||||
}
|
||||
for _, rID := range tpr.res {
|
||||
if err = tpr.dataStorage.SetResource(&Resource{ID: rID, Usages: make(map[string]*ResourceUsage)}); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
for _, tpRL := range tpr.resCfgs {
|
||||
rl, err := APItoResource(tpRL, tpr.timezone)
|
||||
>>>>>>> dd8afa24867e3d532c7a2b81fc8070aceec07dad
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -2060,11 +2010,7 @@ func (tpr *TpReader) WriteToDatabase(flush, verbose, disable_reverse bool) (err
|
||||
return err
|
||||
}
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
if len(tpr.resProfiles) > 0 {
|
||||
=======
|
||||
if len(tpr.resCfgs) > 0 {
|
||||
>>>>>>> dd8afa24867e3d532c7a2b81fc8070aceec07dad
|
||||
if verbose {
|
||||
log.Print("Indexing resource profiles")
|
||||
}
|
||||
@@ -2072,11 +2018,7 @@ func (tpr *TpReader) WriteToDatabase(flush, verbose, disable_reverse bool) (err
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
for _, tpRL := range tpr.resProfiles {
|
||||
=======
|
||||
for _, tpRL := range tpr.resCfgs {
|
||||
>>>>>>> dd8afa24867e3d532c7a2b81fc8070aceec07dad
|
||||
if rl, err := APItoResource(tpRL, tpr.timezone); err != nil {
|
||||
return err
|
||||
} else {
|
||||
@@ -2196,11 +2138,7 @@ func (tpr *TpReader) ShowStatistics() {
|
||||
// cdr stats
|
||||
log.Print("CDR stats: ", len(tpr.cdrStats))
|
||||
// resource limits
|
||||
<<<<<<< HEAD
|
||||
log.Print("ResourceProfiles: ", len(tpr.resProfiles))
|
||||
=======
|
||||
log.Print("ResourceLimits: ", len(tpr.resCfgs))
|
||||
>>>>>>> dd8afa24867e3d532c7a2b81fc8070aceec07dad
|
||||
// stats
|
||||
log.Print("Stats: ", len(tpr.stats))
|
||||
}
|
||||
@@ -2312,17 +2250,10 @@ func (tpr *TpReader) GetLoadedIds(categ string) ([]string, error) {
|
||||
i++
|
||||
}
|
||||
return keys, nil
|
||||
<<<<<<< HEAD
|
||||
case utils.ResourceProfilesPrefix:
|
||||
keys := make([]string, len(tpr.resProfiles))
|
||||
i := 0
|
||||
for k := range tpr.resProfiles {
|
||||
=======
|
||||
case utils.ResourceConfigsPrefix:
|
||||
keys := make([]string, len(tpr.resCfgs))
|
||||
i := 0
|
||||
for k := range tpr.resCfgs {
|
||||
>>>>>>> dd8afa24867e3d532c7a2b81fc8070aceec07dad
|
||||
keys[i] = k
|
||||
i++
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user