mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Small fix
This commit is contained in:
@@ -73,7 +73,7 @@ func (b *v1Balance) IsDefault() bool {
|
||||
b.Disabled == false
|
||||
}
|
||||
|
||||
func (v1Acc v1Account) AsAccount() (ac engine.Account, err error) {
|
||||
func (v1Acc v1Account) AsAccount() (ac engine.Account) {
|
||||
// transfer data into new structurse
|
||||
ac = engine.Account{
|
||||
ID: v1Acc.Id,
|
||||
|
||||
@@ -34,9 +34,8 @@ func TestV1AccountAsAccount(t *testing.T) {
|
||||
if def := v1b.IsDefault(); def != false {
|
||||
t.Errorf("Expecting: false, received: true")
|
||||
}
|
||||
if newAcc, err := v1Acc.AsAccount(); err != nil {
|
||||
t.Error(err)
|
||||
} else if !reflect.DeepEqual(*testAccount, newAcc) {
|
||||
newAcc := v1Acc.AsAccount()
|
||||
if !reflect.DeepEqual(*testAccount, newAcc) {
|
||||
t.Errorf("Expecting: %+v, received: %+v", *testAccount, newAcc)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ type v1Action struct {
|
||||
|
||||
type v1Actions []*v1Action
|
||||
|
||||
func (v1Act v1Action) AsAction() (act engine.Action, err error) {
|
||||
func (v1Act v1Action) AsAction() (act engine.Action) {
|
||||
act = engine.Action{
|
||||
Id: v1Act.Id,
|
||||
ActionType: v1Act.ActionType,
|
||||
|
||||
@@ -46,7 +46,7 @@ func (at *v1ActionPlan) IsASAP() bool {
|
||||
return at.Timing.Timing.StartTime == utils.ASAP
|
||||
}
|
||||
|
||||
func (v1AP v1ActionPlan) AsActionPlan() (ap engine.ActionPlan, err error) {
|
||||
func (v1AP v1ActionPlan) AsActionPlan() (ap engine.ActionPlan) {
|
||||
for idx, actionId := range v1AP.AccountIds {
|
||||
idElements := strings.Split(actionId, utils.CONCATENATED_KEY_SEP)
|
||||
if len(idElements) != 3 {
|
||||
|
||||
@@ -28,9 +28,8 @@ import (
|
||||
func TestV1ActionPlanAsActionPlan(t *testing.T) {
|
||||
v1ap := &v1ActionPlan{Id: "test", AccountIds: []string{"one"}, Timing: &engine.RateInterval{Timing: new(engine.RITiming)}}
|
||||
ap := &engine.ActionPlan{Id: "test", AccountIDs: utils.StringMap{"one": true}, ActionTimings: []*engine.ActionTiming{&engine.ActionTiming{Timing: &engine.RateInterval{Timing: new(engine.RITiming)}}}}
|
||||
if newap, err := v1ap.AsActionPlan(); err != nil {
|
||||
t.Error(err)
|
||||
} else if ap.Id != newap.Id || !reflect.DeepEqual(ap.AccountIDs, newap.AccountIDs) {
|
||||
newap := v1ap.AsActionPlan()
|
||||
if ap.Id != newap.Id || !reflect.DeepEqual(ap.AccountIDs, newap.AccountIDs) {
|
||||
t.Errorf("Expecting: %+v, received: %+v", *ap, newap)
|
||||
} else if !reflect.DeepEqual(ap.ActionTimings[0].Timing, newap.ActionTimings[0].Timing) {
|
||||
t.Errorf("Expecting: %+v, received: %+v", ap.ActionTimings[0].Timing, newap.ActionTimings[0].Timing)
|
||||
|
||||
@@ -27,9 +27,8 @@ import (
|
||||
func TestV1ActionsAsActions(t *testing.T) {
|
||||
v1act := &v1Action{Id: "", ActionType: "", BalanceType: "", Direction: "INBOUND", ExtraParameters: "", ExpirationString: "", Balance: &v1Balance{}}
|
||||
act := &engine.Action{Id: "", ActionType: "", ExtraParameters: "", ExpirationString: "", Weight: 0.00, Balance: &engine.BalanceFilter{}}
|
||||
if newact, err := v1act.AsAction(); err != nil {
|
||||
t.Error(err)
|
||||
} else if !reflect.DeepEqual(*act, newact) {
|
||||
newact := v1act.AsAction()
|
||||
if !reflect.DeepEqual(*act, newact) {
|
||||
t.Errorf("Expecting: %+v, received: %+v", *act, newact)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,8 @@ type v1ActionTrigger struct {
|
||||
|
||||
type v1ActionTriggers []*v1ActionTrigger
|
||||
|
||||
func (v1Act v1ActionTrigger) AsActionTrigger() (at engine.ActionTrigger, err error) {
|
||||
func (v1Act v1ActionTrigger) AsActionTrigger() (at engine.ActionTrigger) {
|
||||
|
||||
at = engine.ActionTrigger{
|
||||
UniqueID: v1Act.Id,
|
||||
ThresholdType: v1Act.ThresholdType,
|
||||
|
||||
@@ -43,9 +43,8 @@ func TestV1ActionTriggersAsActionTriggers(t *testing.T) {
|
||||
if err := json.Unmarshal([]byte(v1ActionTriggers1), &v1actstrgrs); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if newatrs, err := v1actstrgrs.AsActionTrigger(); err != nil {
|
||||
t.Error(err)
|
||||
} else if !reflect.DeepEqual(*atrs, newatrs) {
|
||||
newatrs := v1actstrgrs.AsActionTrigger()
|
||||
if !reflect.DeepEqual(*atrs, newatrs) {
|
||||
t.Errorf("Expecting: %+v, received: %+v", *atrs, newatrs)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,8 +89,8 @@ func (m *Migrator) migrateCostDetails() (err error) {
|
||||
v1CC := &v1CallCost{Direction: ccDirection.String, Category: ccCategory.String, Tenant: ccTenant.String,
|
||||
Subject: ccSubject.String, Account: ccAccount.String, Destination: ccDestination.String, TOR: ccTor.String,
|
||||
Cost: ccCost.Float64, Timespans: v1tmsps}
|
||||
cc, err := v1CC.AsCallCost()
|
||||
if err != nil {
|
||||
cc := v1CC.AsCallCost()
|
||||
if cc == nil {
|
||||
utils.Logger.Warning(
|
||||
fmt.Sprintf("<Migrator> Error: <%s> when converting into CallCost CDR with id: <%d>", err.Error(), id))
|
||||
continue
|
||||
@@ -152,7 +152,7 @@ type v1UnitInfo struct {
|
||||
TOR string
|
||||
}
|
||||
|
||||
func (v1cc *v1CallCost) AsCallCost() (cc *engine.CallCost, err error) {
|
||||
func (v1cc *v1CallCost) AsCallCost() (cc *engine.CallCost) {
|
||||
cc = new(engine.CallCost)
|
||||
cc.Direction = v1cc.Direction
|
||||
cc.Category = v1cc.Category
|
||||
|
||||
@@ -31,9 +31,7 @@ func TestV1CostDetailsAsCostDetails1(t *testing.T) {
|
||||
t.Error(err)
|
||||
}
|
||||
v1CC := &v1CallCost{Timespans: v1tmsps}
|
||||
if _, err := v1CC.AsCallCost(); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
_ = v1CC.AsCallCost()
|
||||
// ToDo: Test here the content
|
||||
|
||||
}
|
||||
@@ -44,7 +42,6 @@ func TestV1CostDetailsAsCostDetails2(t *testing.T) {
|
||||
t.Error(err)
|
||||
}
|
||||
v1CC := &v1CallCost{Timespans: v1tmsps}
|
||||
if _, err := v1CC.AsCallCost(); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
_ = v1CC.AsCallCost()
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user