From 309878d41830a1685bd94f50a9a9024daaa8e882 Mon Sep 17 00:00:00 2001 From: DanB Date: Fri, 25 Nov 2016 19:43:39 +0100 Subject: [PATCH] Fix Actions.Clone(), activate test --- engine/action.go | 35 ++++++++++++++++------------------- engine/action_plan.go | 2 +- engine/actions_test.go | 3 --- 3 files changed, 17 insertions(+), 23 deletions(-) diff --git a/engine/action.go b/engine/action.go index d2f4cf85a..ab4de4bb7 100644 --- a/engine/action.go +++ b/engine/action.go @@ -89,23 +89,21 @@ type actionTypeFunc func(*Account, *StatsQueueTriggered, *Action, Actions) error func getActionFunc(typ string) (actionTypeFunc, bool) { actionFuncMap := map[string]actionTypeFunc{ - LOG: logAction, - CDRLOG: cdrLogAction, - RESET_TRIGGERS: resetTriggersAction, - SET_RECURRENT: setRecurrentAction, - UNSET_RECURRENT: unsetRecurrentAction, - ALLOW_NEGATIVE: allowNegativeAction, - DENY_NEGATIVE: denyNegativeAction, - RESET_ACCOUNT: resetAccountAction, - TOPUP_RESET: topupResetAction, - TOPUP: topupAction, - DEBIT_RESET: debitResetAction, - DEBIT: debitAction, - RESET_COUNTERS: resetCountersAction, - ENABLE_ACCOUNT: enableAccountAction, - DISABLE_ACCOUNT: disableAccountAction, - //case ENABLE_DISABLE_BALANCE: - // return enableDisableBalanceAction, true + LOG: logAction, + CDRLOG: cdrLogAction, + RESET_TRIGGERS: resetTriggersAction, + SET_RECURRENT: setRecurrentAction, + UNSET_RECURRENT: unsetRecurrentAction, + ALLOW_NEGATIVE: allowNegativeAction, + DENY_NEGATIVE: denyNegativeAction, + RESET_ACCOUNT: resetAccountAction, + TOPUP_RESET: topupResetAction, + TOPUP: topupAction, + DEBIT_RESET: debitResetAction, + DEBIT: debitAction, + RESET_COUNTERS: resetCountersAction, + ENABLE_ACCOUNT: enableAccountAction, + DISABLE_ACCOUNT: disableAccountAction, CALL_URL: callUrl, CALL_URL_ASYNC: callUrlAsync, MAIL_ASYNC: mailAsync, @@ -748,8 +746,7 @@ func (apl Actions) Sort() { sort.Sort(apl) } -func (apl *Actions) Clone() (interface{}, error) { - +func (apl Actions) Clone() (interface{}, error) { var cln Actions if err := utils.Clone(apl, &cln); err != nil { return nil, err diff --git a/engine/action_plan.go b/engine/action_plan.go index 5c9964e10..3696cf69f 100644 --- a/engine/action_plan.go +++ b/engine/action_plan.go @@ -65,7 +65,7 @@ func (apl *ActionPlan) Clone() (interface{}, error) { if err := utils.Clone(*apl, cln); err != nil { return nil, err } - return interface{}(cln), nil + return cln, nil } func (t *Task) Execute() error { diff --git a/engine/actions_test.go b/engine/actions_test.go index 4503a97f0..b708d4e73 100644 --- a/engine/actions_test.go +++ b/engine/actions_test.go @@ -2373,7 +2373,6 @@ func TestClonedActions(t *testing.T) { } -/** func TestCacheGetClonedActions(t *testing.T) { actions := Actions{ &Action{ @@ -2408,8 +2407,6 @@ func TestCacheGetClonedActions(t *testing.T) { } } -*/ - /**************** Benchmarks ********************************/ func BenchmarkUUID(b *testing.B) {