本文整理匯總了Golang中github.com/cgrates/cgrates/utils.ToIJSON函數的典型用法代碼示例。如果您正苦於以下問題:Golang ToIJSON函數的具體用法?Golang ToIJSON怎麽用?Golang ToIJSON使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了ToIJSON函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: TestGetCostMaxDebitRoundingIssue
func TestGetCostMaxDebitRoundingIssue(t *testing.T) {
ap, _ := ratingStorage.GetActionPlans("TOPUP10_AT", false)
for _, at := range ap {
at.Execute()
}
cd := &CallDescriptor{
Direction: "*out",
Category: "call",
Tenant: "cgrates.org",
Subject: "dy",
Account: "dy",
Destination: "0723123113",
TimeStart: time.Date(2015, 10, 26, 13, 29, 27, 0, time.UTC),
TimeEnd: time.Date(2015, 10, 26, 13, 29, 51, 0, time.UTC),
MaxCostSoFar: 0,
}
acc, err := accountingStorage.GetAccount("cgrates.org:dy")
if err != nil || acc.BalanceMap[utils.MONETARY][0].Value != 1 {
t.Errorf("Error getting account: %+v (%v)", utils.ToIJSON(acc), err)
}
cc, err := cd.MaxDebit()
expected := 0.39
if cc.Cost != expected || err != nil {
t.Log(utils.ToIJSON(cc))
t.Errorf("Expected %v was %+v", expected, cc)
}
acc, err = accountingStorage.GetAccount("cgrates.org:dy")
if err != nil || acc.BalanceMap[utils.MONETARY][0].Value != 1-expected {
t.Errorf("Error getting account: %+v (%v)", utils.ToIJSON(acc), err)
}
}
示例2: TestTpZeroNegativeCost
func TestTpZeroNegativeCost(t *testing.T) {
if !*testIntegration {
return
}
tStart := time.Date(2016, 3, 31, 0, 0, 0, 0, time.UTC)
cd := engine.CallDescriptor{
Direction: "*out",
Category: "call",
Tenant: "cgrates.org",
Subject: "free",
Account: "1013",
Destination: "+4915",
DurationIndex: 0,
TimeStart: tStart,
TimeEnd: tStart.Add(time.Duration(20) * time.Second),
}
var cc engine.CallCost
if err := tpRPC.Call("Responder.Debit", cd, &cc); err != nil {
t.Error("Got error on Responder.GetCost: ", err.Error())
} else if cc.GetDuration() != 20*time.Second {
t.Errorf("Calling Responder.MaxDebit got callcost: %v", utils.ToIJSON(cc))
}
var acnt engine.Account
attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1013"}
if err := tpRPC.Call("ApierV2.GetAccount", attrs, &acnt); err != nil {
t.Error("Got error on ApierV2.GetAccount: ", err.Error())
} else if acnt.BalanceMap[utils.VOICE][0].Value != 100.0 {
t.Errorf("Calling ApierV2.GetAccount received: %s", utils.ToIJSON(acnt))
}
}
示例3: TestApierResetAccountActionTriggers
func TestApierResetAccountActionTriggers(t *testing.T) {
if !*testIntegration {
return
}
var acnt engine.Account
attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1005"}
if err := tpRPC.Call("ApierV2.GetAccount", attrs, &acnt); err != nil {
t.Error(err)
} else if acnt.ActionTriggers[0].Executed == true {
t.Errorf("wrong action trigger executed flag: %s", utils.ToIJSON(acnt.ActionTriggers))
}
var reply string
if err := tpRPC.Call("ApierV2.ResetAccountActionTriggers", v1.AttrResetAccountActionTriggers{
Tenant: "cgrates.org",
Account: "1005",
GroupID: "STANDARD_TRIGGERS",
Executed: true,
}, &reply); err != nil {
t.Error("Error on ApierV2.ResetAccountActionTriggers: ", err.Error())
} else if reply != utils.OK {
t.Errorf("Calling ApierV2.ResetAccountActionTriggers got reply: %s", reply)
}
if err := tpRPC.Call("ApierV2.GetAccount", attrs, &acnt); err != nil {
t.Error(err)
} else if acnt.ActionTriggers[0].Executed == false {
t.Errorf("wrong action trigger executed flag: %s", utils.ToIJSON(acnt.ActionTriggers))
}
}
示例4: TestDestManagCacheWithGetCache
func TestDestManagCacheWithGetCache(t *testing.T) {
if !*testIntegration {
return
}
if err := engine.InitDataDb(destCfg); err != nil {
t.Fatal(err)
}
var reply string
if err := destRPC.Call("ApierV1.ReloadCache", utils.AttrReloadCache{}, &reply); err != nil {
t.Error("Got error on ApierV1.ReloadCache: ", err.Error())
} else if reply != utils.OK {
t.Errorf("Calling ApierV1.ReloadCache received: %+v", reply)
}
attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "test", "destinations", "cacheall"), FlushDb: true}
if err := destRPC.Call("ApierV2.LoadTariffPlanFromFolder", attrs, &destLoadInst); err != nil {
t.Error(err)
} else if destLoadInst.RatingLoadID == "" || destLoadInst.AccountingLoadID == "" {
t.Error("Empty loadId received, loadInstance: ", destLoadInst)
}
time.Sleep(time.Duration(*waitRater) * time.Millisecond) // Give time for scheduler to execute topups
dests := make([]*engine.Destination, 0)
if err := destRPC.Call("ApierV2.GetDestinations", v2.AttrGetDestinations{DestinationIDs: []string{}}, &dests); err != nil {
t.Error("Got error on ApierV2.GetDestinations: ", err.Error())
} else if len(dests) != 1 {
t.Errorf("Calling ApierV2.GetDestinations got reply: %v", utils.ToIJSON(dests))
}
var rcvStats utils.CacheStats
if err := destRPC.Call("ApierV1.GetCacheStats", utils.AttrCacheStats{}, &rcvStats); err != nil {
t.Error("Got error on ApierV1.GetCacheStats: ", err.Error())
} else if rcvStats.Destinations != 2 {
t.Errorf("Calling ApierV1.GetCacheStats received: %+v", rcvStats)
}
attrs = &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "test", "destinations", "cacheone"), FlushDb: true}
if err := destRPC.Call("ApierV2.LoadTariffPlanFromFolder", attrs, &destLoadInst); err != nil {
t.Error(err)
} else if destLoadInst.RatingLoadID == "" || destLoadInst.AccountingLoadID == "" {
t.Error("Empty loadId received, loadInstance: ", destLoadInst)
}
time.Sleep(time.Duration(*waitRater) * time.Millisecond) // Give time for scheduler to execute topups
dests = make([]*engine.Destination, 0)
if err := destRPC.Call("ApierV2.GetDestinations", v2.AttrGetDestinations{DestinationIDs: []string{}}, &dests); err != nil {
t.Error("Got error on ApierV2.GetDestinations: ", err.Error())
} else if len(dests) != 1 {
t.Errorf("Calling ApierV2.GetDestinations got reply: %v", utils.ToIJSON(dests))
}
if err := destRPC.Call("ApierV1.GetCacheStats", utils.AttrCacheStats{}, &rcvStats); err != nil {
t.Error("Got error on ApierV1.GetCacheStats: ", err.Error())
} else if rcvStats.Destinations != 1 {
t.Errorf("Calling ApierV1.GetCacheStats received: %+v", rcvStats)
}
}
示例5: TestRatingProfileYearMonthDay
func TestRatingProfileYearMonthDay(t *testing.T) {
ri := &RatingInfo{
RateIntervals: RateIntervalList{
&RateInterval{
Timing: &RITiming{
StartTime: "09:00:00",
},
},
&RateInterval{
Timing: &RITiming{
StartTime: "00:00:00",
},
},
&RateInterval{
Timing: &RITiming{
Years: utils.Years{2016},
Months: utils.Months{1},
MonthDays: utils.MonthDays{6, 7},
WeekDays: utils.WeekDays{},
StartTime: "19:00:00",
},
},
},
}
ts := &TimeSpan{
TimeStart: time.Date(2016, 1, 6, 23, 40, 0, 0, time.UTC),
TimeEnd: time.Date(2016, 1, 7, 1, 1, 30, 0, time.UTC),
}
rIntervals := ri.SelectRatingIntevalsForTimespan(ts)
if len(rIntervals) != 1 ||
rIntervals[0].Timing.StartTime != "19:00:00" {
t.Error("Wrong interval list: ", utils.ToIJSON(rIntervals))
}
}
示例6: TestRatingProfileRIforTSMidnight
func TestRatingProfileRIforTSMidnight(t *testing.T) {
ri := &RatingInfo{
RateIntervals: RateIntervalList{
&RateInterval{
Timing: &RITiming{
StartTime: "09:00:00",
},
},
&RateInterval{
Timing: &RITiming{
StartTime: "00:00:00",
},
},
&RateInterval{
Timing: &RITiming{
StartTime: "19:00:00",
},
},
},
}
ts := &TimeSpan{
TimeStart: time.Date(2016, 1, 6, 23, 40, 0, 0, time.UTC),
TimeEnd: time.Date(2016, 1, 7, 1, 1, 30, 0, time.UTC),
}
rIntervals := ri.SelectRatingIntevalsForTimespan(ts)
if len(rIntervals) != 1 ||
rIntervals[0].Timing.StartTime != "19:00:00" {
t.Error("Wrong interval list: ", utils.ToIJSON(rIntervals))
}
}
示例7: TestTpActionTriggers
func TestTpActionTriggers(t *testing.T) {
var atrs engine.ActionTriggers
if err := tpRPC.Call("ApierV1.GetActionTriggers", v1.AttrGetActionTriggers{GroupIDs: []string{}}, &atrs); err != nil {
t.Error("Got error on ApierV1.GetActionTriggers: ", err.Error())
} else if len(atrs) != 9 {
t.Errorf("Calling v1.GetActionTriggers got: %v", atrs)
}
var reply string
if err := tpRPC.Call("ApierV1.SetActionTrigger", v1.AttrSetActionTrigger{
GroupID: "TestATR",
UniqueID: "Unique atr id",
BalanceID: utils.StringPointer("BID1"),
}, &reply); err != nil {
t.Error("Got error on ApierV1.SetActionTrigger: ", err.Error())
} else if reply != utils.OK {
t.Errorf("Calling v1.SetActionTrigger got: %v", reply)
}
if err := tpRPC.Call("ApierV1.GetActionTriggers", v1.AttrGetActionTriggers{GroupIDs: []string{}}, &atrs); err != nil {
t.Error("Got error on ApierV1.GetActionTriggers: ", err.Error())
} else if len(atrs) != 10 {
t.Errorf("Calling v1.GetActionTriggers got: %v", atrs)
}
if err := tpRPC.Call("ApierV1.GetActionTriggers", v1.AttrGetActionTriggers{GroupIDs: []string{"TestATR"}}, &atrs); err != nil {
t.Error("Got error on ApierV1.GetActionTriggers: ", err.Error())
} else if len(atrs) != 1 {
t.Errorf("Calling v1.GetActionTriggers got: %v", atrs)
}
if atrs[0].ID != "TestATR" ||
atrs[0].UniqueID != "Unique atr id" ||
*atrs[0].Balance.ID != "BID1" {
t.Error("Wrong action trigger set: ", utils.ToIJSON(atrs[0]))
}
}
示例8: TestDfGeneralJsonCfg
func TestDfGeneralJsonCfg(t *testing.T) {
eCfg := &GeneralJsonCfg{
Instance_id: utils.StringPointer(""),
Log_level: utils.IntPointer(utils.LOGLEVEL_INFO),
Http_skip_tls_verify: utils.BoolPointer(false),
Rounding_decimals: utils.IntPointer(5),
Dbdata_encoding: utils.StringPointer("msgpack"),
Tpexport_dir: utils.StringPointer("/var/spool/cgrates/tpe"),
Httpposter_attempts: utils.IntPointer(3),
Http_failed_dir: utils.StringPointer("/var/spool/cgrates/http_failed"),
Default_request_type: utils.StringPointer(utils.META_RATED),
Default_category: utils.StringPointer("call"),
Default_tenant: utils.StringPointer("cgrates.org"),
Default_timezone: utils.StringPointer("Local"),
Connect_attempts: utils.IntPointer(3),
Reconnects: utils.IntPointer(-1),
Connect_timeout: utils.StringPointer("1s"),
Reply_timeout: utils.StringPointer("2s"),
Response_cache_ttl: utils.StringPointer("0s"),
Internal_ttl: utils.StringPointer("2m"),
Locking_timeout: utils.StringPointer("5s"),
}
if gCfg, err := dfCgrJsonCfg.GeneralJsonCfg(); err != nil {
t.Error(err)
} else if !reflect.DeepEqual(eCfg, gCfg) {
t.Error("Received: ", utils.ToIJSON(gCfg))
}
}
示例9: TestCacheJsonCfg
func TestCacheJsonCfg(t *testing.T) {
eCfg := &CacheJsonCfg{
Destinations: &CacheParamJsonCfg{Limit: utils.IntPointer(10000),
Ttl: utils.StringPointer("0s"), Precache: utils.BoolPointer(false)},
Reverse_destinations: &CacheParamJsonCfg{Limit: utils.IntPointer(10000),
Ttl: utils.StringPointer("0s"), Precache: utils.BoolPointer(false)},
Rating_plans: &CacheParamJsonCfg{Limit: utils.IntPointer(10000),
Ttl: utils.StringPointer("0s"), Precache: utils.BoolPointer(true)},
Rating_profiles: &CacheParamJsonCfg{Limit: utils.IntPointer(10000),
Ttl: utils.StringPointer("0s"), Precache: utils.BoolPointer(false)},
Lcr: &CacheParamJsonCfg{Limit: utils.IntPointer(10000),
Ttl: utils.StringPointer("0s"), Precache: utils.BoolPointer(false)},
Cdr_stats: &CacheParamJsonCfg{Limit: utils.IntPointer(10000),
Ttl: utils.StringPointer("0s"), Precache: utils.BoolPointer(false)},
Actions: &CacheParamJsonCfg{Limit: utils.IntPointer(10000),
Ttl: utils.StringPointer("0s"), Precache: utils.BoolPointer(false)},
Action_plans: &CacheParamJsonCfg{Limit: utils.IntPointer(10000),
Ttl: utils.StringPointer("0s"), Precache: utils.BoolPointer(false)},
Action_triggers: &CacheParamJsonCfg{Limit: utils.IntPointer(10000),
Ttl: utils.StringPointer("0s"), Precache: utils.BoolPointer(false)},
Shared_groups: &CacheParamJsonCfg{Limit: utils.IntPointer(10000),
Ttl: utils.StringPointer("0s"), Precache: utils.BoolPointer(false)},
Aliases: &CacheParamJsonCfg{Limit: utils.IntPointer(10000),
Ttl: utils.StringPointer("0s"), Precache: utils.BoolPointer(false)},
Reverse_aliases: &CacheParamJsonCfg{Limit: utils.IntPointer(10000),
Ttl: utils.StringPointer("0s"), Precache: utils.BoolPointer(false)},
}
if gCfg, err := dfCgrJsonCfg.CacheJsonCfg(); err != nil {
t.Error(err)
} else if !reflect.DeepEqual(eCfg, gCfg) {
t.Error("Received: ", utils.ToIJSON(gCfg))
}
}
示例10: TestRatingProfileRISorter
func TestRatingProfileRISorter(t *testing.T) {
ris := RateIntervalList{
&RateInterval{
Timing: &RITiming{
StartTime: "09:00:00",
},
},
&RateInterval{
Timing: &RITiming{
StartTime: "00:00:00",
},
},
&RateInterval{
Timing: &RITiming{
StartTime: "19:00:00",
},
},
}
sorter := &RateIntervalTimeSorter{referenceTime: time.Date(2016, 1, 6, 19, 0, 0, 0, time.UTC), ris: ris}
rIntervals := sorter.Sort()
if len(rIntervals) != 3 ||
rIntervals[0].Timing.StartTime != "00:00:00" ||
rIntervals[1].Timing.StartTime != "09:00:00" ||
rIntervals[2].Timing.StartTime != "19:00:00" {
t.Error("Wrong interval list: ", utils.ToIJSON(rIntervals))
}
}
示例11: TestTpRemoveActionsRefenced
func TestTpRemoveActionsRefenced(t *testing.T) {
if !*testIntegration {
return
}
// no more reference check for sake of speed!
actionsMap := make(map[string]engine.Actions)
if err := tpRPC.Call("ApierV2.GetActions", v2.AttrGetActions{
ActionIDs: []string{"TOPUP_VOICE"},
}, &actionsMap); err != nil {
t.Error("Got error on ApierV2.GetActions: ", err.Error())
} else if len(actionsMap) != 1 {
t.Errorf("Calling ApierV2.GetActions got reply: %s", utils.ToIJSON(actionsMap))
}
var reply string
if err := tpRPC.Call("ApierV2.RemoveActions", v1.AttrRemoveActions{
ActionIDs: []string{"TOPUP_VOICE"},
}, &reply); err != nil {
t.Error("Error on ApierV2.RemoveActions: ", err.Error())
} else if reply != utils.OK {
t.Errorf("Calling ApierV2.RemoveActions got reply: %s", reply)
}
if err := tpRPC.Call("ApierV2.GetActions", v2.AttrGetActions{
ActionIDs: []string{"PAYMENT_2056bd2fe137082970f97102b64e42fd"},
}, &actionsMap); err == nil {
t.Error("no error on ApierV2.GetActions: ", err)
}
}
示例12: TestTpBalanceCounter
func TestTpBalanceCounter(t *testing.T) {
tStart := time.Date(2016, 3, 31, 0, 0, 0, 0, time.UTC)
cd := engine.CallDescriptor{
Direction: "*out",
Category: "call",
Tenant: "cgrates.org",
Subject: "1001",
Destination: "+49",
DurationIndex: 0,
TimeStart: tStart,
TimeEnd: tStart.Add(time.Duration(20) * time.Second),
}
var cc engine.CallCost
if err := tpRPC.Call("Responder.Debit", cd, &cc); err != nil {
t.Error("Got error on Responder.GetCost: ", err.Error())
} else if cc.GetDuration() != 20*time.Second {
t.Errorf("Calling Responder.MaxDebit got callcost: %v", cc.GetDuration())
}
var acnt *engine.Account
attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1001"}
if err := tpRPC.Call("ApierV2.GetAccount", attrs, &acnt); err != nil {
t.Error("Got error on ApierV2.GetAccount: ", err.Error())
} else if acnt.UnitCounters[utils.MONETARY][1].Counters[0].Value != 20.0 {
t.Errorf("Calling ApierV2.GetBalance received: %s", utils.ToIJSON(acnt))
}
}
示例13: TestMaxDebitRatingInfoOnZeroTime
func TestMaxDebitRatingInfoOnZeroTime(t *testing.T) {
ap, _ := ratingStorage.GetActionPlans("TOPUP10_AT", false)
for _, at := range ap {
at.Execute()
}
cd := &CallDescriptor{
Direction: "*out",
Category: "call",
Tenant: "cgrates.org",
Subject: "dy",
Account: "dy",
Destination: "0723123113",
TimeStart: time.Date(2015, 10, 26, 13, 29, 27, 0, time.UTC),
TimeEnd: time.Date(2015, 10, 26, 13, 29, 27, 0, time.UTC),
MaxCostSoFar: 0,
}
cc, err := cd.MaxDebit()
if err != nil ||
len(cc.Timespans) != 1 ||
cc.Timespans[0].MatchedDestId != "RET" ||
cc.Timespans[0].MatchedSubject != "*out:cgrates.org:call:dy" ||
cc.Timespans[0].MatchedPrefix != "0723" ||
cc.Timespans[0].RatingPlanId != "DY_PLAN" {
t.Error("MatchedInfo not added:", utils.ToIJSON(cc))
}
}
示例14: TestNewCgrJsonCfgFromFile
func TestNewCgrJsonCfgFromFile(t *testing.T) {
cgrJsonCfg, err := NewCgrJsonCfgFromFile("cfg_data.json")
if err != nil {
t.Error(err)
}
eCfg := &GeneralJsonCfg{Default_reqtype: utils.StringPointer(utils.META_PSEUDOPREPAID)}
if gCfg, err := cgrJsonCfg.GeneralJsonCfg(); err != nil {
t.Error(err)
} else if !reflect.DeepEqual(eCfg, gCfg) {
t.Error("Received: ", gCfg)
}
cdrFields := []*CdrFieldJsonCfg{
&CdrFieldJsonCfg{Field_id: utils.StringPointer(utils.TOR), Value: utils.StringPointer("~7:s/^(voice|data|sms|mms|generic)$/*$1/")},
&CdrFieldJsonCfg{Field_id: utils.StringPointer(utils.ANSWER_TIME), Value: utils.StringPointer("1")},
&CdrFieldJsonCfg{Field_id: utils.StringPointer(utils.USAGE), Value: utils.StringPointer(`~9:s/^(\d+)$/${1}s/`)},
}
eCfgCdrc := map[string]*CdrcJsonCfg{
"CDRC-CSV1": &CdrcJsonCfg{
Enabled: utils.BoolPointer(true),
Cdr_in_dir: utils.StringPointer("/tmp/cgrates/cdrc1/in"),
Cdr_out_dir: utils.StringPointer("/tmp/cgrates/cdrc1/out"),
Cdr_source_id: utils.StringPointer("csv1"),
},
"CDRC-CSV2": &CdrcJsonCfg{
Enabled: utils.BoolPointer(true),
Data_usage_multiply_factor: utils.Float64Pointer(0.000976563),
Run_delay: utils.IntPointer(1),
Cdr_in_dir: utils.StringPointer("/tmp/cgrates/cdrc2/in"),
Cdr_out_dir: utils.StringPointer("/tmp/cgrates/cdrc2/out"),
Cdr_source_id: utils.StringPointer("csv2"),
Content_fields: &cdrFields,
},
}
if cfg, err := cgrJsonCfg.CdrcJsonCfg(); err != nil {
t.Error(err)
} else if !reflect.DeepEqual(eCfgCdrc, cfg) {
t.Error("Received: ", utils.ToIJSON(cfg["CDRC-CSV2"]))
}
eCfgSmFs := &SmFsJsonCfg{
Enabled: utils.BoolPointer(true),
Connections: &[]*FsConnJsonCfg{
&FsConnJsonCfg{
Server: utils.StringPointer("1.2.3.4:8021"),
Password: utils.StringPointer("ClueCon"),
Reconnects: utils.IntPointer(5),
},
&FsConnJsonCfg{
Server: utils.StringPointer("2.3.4.5:8021"),
Password: utils.StringPointer("ClueCon"),
Reconnects: utils.IntPointer(5),
},
},
}
if smFsCfg, err := cgrJsonCfg.SmFsJsonCfg(); err != nil {
t.Error(err)
} else if !reflect.DeepEqual(eCfgSmFs, smFsCfg) {
t.Error("Received: ", smFsCfg)
}
}
示例15: TestLoadAccountActions
func TestLoadAccountActions(t *testing.T) {
if len(csvr.accountActions) != 17 {
t.Error("Failed to load account actions: ", len(csvr.accountActions))
}
aa := csvr.accountActions["vdf:minitsboy"]
expected := &Account{
ID: "vdf:minitsboy",
UnitCounters: UnitCounters{
utils.VOICE: []*UnitCounter{
&UnitCounter{
CounterType: "*event",
Counters: CounterFilters{
&CounterFilter{
Value: 0,
Filter: &BalanceFilter{
ID: utils.StringPointer("st0"),
Type: utils.StringPointer(utils.VOICE),
Directions: utils.StringMapPointer(utils.NewStringMap("*out")),
DestinationIDs: utils.StringMapPointer(utils.NewStringMap("GERMANY_O2")),
SharedGroups: nil,
Categories: nil,
TimingIDs: nil,
},
},
},
},
},
},
ActionTriggers: csvr.actionsTriggers["STANDARD_TRIGGER"],
}
// set propper uuid
for i, atr := range aa.ActionTriggers {
csvr.actionsTriggers["STANDARD_TRIGGER"][i].ID = atr.ID
}
for i, b := range aa.UnitCounters[utils.VOICE][0].Counters {
expected.UnitCounters[utils.VOICE][0].Counters[i].Filter.ID = b.Filter.ID
}
if !reflect.DeepEqual(aa.UnitCounters[utils.VOICE][0].Counters[0], expected.UnitCounters[utils.VOICE][0].Counters[0]) {
t.Errorf("Error loading account action: %+v", utils.ToIJSON(aa.UnitCounters[utils.VOICE][0].Counters[0].Filter))
}
// test that it does not overwrite balances
existing, err := accountingStorage.GetAccount(aa.ID)
if err != nil || len(existing.BalanceMap) != 2 {
t.Errorf("The account was not set before load: %+v", existing)
}
accountingStorage.SetAccount(aa)
existing, err = accountingStorage.GetAccount(aa.ID)
if err != nil || len(existing.BalanceMap) != 2 {
t.Errorf("The set account altered the balances: %+v", existing)
}
}