diff --git a/dispatchers/attributes_it_test.go b/dispatchers/attributes_it_test.go
index 081e6539a..865dcc6e0 100644
--- a/dispatchers/attributes_it_test.go
+++ b/dispatchers/attributes_it_test.go
@@ -23,7 +23,6 @@ package dispatchers
import (
"reflect"
"testing"
- "time"
"github.com/cgrates/cgrates/config"
"github.com/cgrates/cgrates/engine"
@@ -643,184 +642,3 @@ func testDspAttrPingNoArgDispatcher(t *testing.T) {
t.Errorf("Received: %s", reply)
}
}
-
-func TestDspAttributeSv1PingError(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrEvent := &utils.CGREvent{}
- var reply *string
- err := dspSrv.AttributeSv1Ping(cgrEvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if err == nil || err.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, err)
- }
-}
-
-func TestDspAttributeSv1PingErrorTenant(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrEvent := &utils.CGREvent{
- Tenant: "tenant",
- ID: "",
- Time: nil,
- Event: nil,
- APIOpts: nil,
- }
- var reply *string
- err := dspSrv.AttributeSv1Ping(cgrEvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if err == nil || err.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, err)
- }
-}
-
-func TestDspAttributeSv1PingErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- var reply *string
- err := dspSrv.AttributeSv1Ping(nil, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if err == nil || err.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, err)
- }
-}
-
-func TestDspAttributeSv1PingErrorAttributeSConns(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrEvent := &utils.CGREvent{
- Tenant: "tenant",
- ID: "ID",
- Time: nil,
- Event: nil,
- APIOpts: nil,
- }
- var reply *string
- err := dspSrv.AttributeSv1Ping(cgrEvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if err == nil || err.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, err)
- }
-}
-
-func TestDspAttributeSv1GetAttributeForEventError(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- processEvent := &engine.AttrArgsProcessEvent{
- AttributeIDs: nil,
- Context: nil,
- ProcessRuns: nil,
- CGREvent: &utils.CGREvent{
- Tenant: "",
- ID: "",
- Time: &time.Time{},
- Event: nil,
- APIOpts: nil,
- },
- }
- var reply *engine.AttributeProfile
- err := dspSrv.AttributeSv1GetAttributeForEvent(processEvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if err == nil || err.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, err)
- }
-}
-
-func TestDspAttributeSv1GetAttributeForEventErrorTenant(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- processEvent := &engine.AttrArgsProcessEvent{
- AttributeIDs: nil,
- Context: nil,
- ProcessRuns: nil,
- CGREvent: &utils.CGREvent{
- Tenant: "tenant",
- ID: "",
- Time: &time.Time{},
- Event: nil,
- APIOpts: nil,
- },
- }
- var reply *engine.AttributeProfile
- err := dspSrv.AttributeSv1GetAttributeForEvent(processEvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if err == nil || err.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, err)
- }
-}
-
-func TestDspAttributeSv1GetAttributeForEventErrorAttributeS(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- processEvent := &engine.AttrArgsProcessEvent{
- AttributeIDs: nil,
- Context: nil,
- ProcessRuns: nil,
- CGREvent: &utils.CGREvent{
- Tenant: "tenant",
- ID: "",
- Time: &time.Time{},
- Event: nil,
- APIOpts: nil,
- },
- }
-
- var reply *engine.AttributeProfile
- err := dspSrv.AttributeSv1GetAttributeForEvent(processEvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if err == nil || err.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, err)
- }
-}
-
-func TestDspAttributeSv1ProcessEventError(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- processEvent := &engine.AttrArgsProcessEvent{
- AttributeIDs: nil,
- Context: nil,
- ProcessRuns: nil,
- CGREvent: &utils.CGREvent{
- Tenant: "tenant",
- ID: "",
- Time: &time.Time{},
- Event: nil,
- APIOpts: nil,
- },
- }
-
- var reply *engine.AttrSProcessEventReply
- err := dspSrv.AttributeSv1ProcessEvent(processEvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if err == nil || err.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, err)
- }
-}
-
-func TestDspAttributeSv1ProcessEventErrorAttributeSConns(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- processEvent := &engine.AttrArgsProcessEvent{
- AttributeIDs: nil,
- Context: nil,
- ProcessRuns: nil,
- CGREvent: &utils.CGREvent{
- Tenant: "tenant",
- ID: "",
- Time: &time.Time{},
- Event: nil,
- APIOpts: nil,
- },
- }
-
- var reply *engine.AttrSProcessEventReply
- err := dspSrv.AttributeSv1ProcessEvent(processEvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if err == nil || err.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, err)
- }
-}
diff --git a/dispatchers/attributes_test.go b/dispatchers/attributes_test.go
new file mode 100644
index 000000000..d5f6645fc
--- /dev/null
+++ b/dispatchers/attributes_test.go
@@ -0,0 +1,209 @@
+/*
+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
+*/
+
+package dispatchers
+
+import (
+ "testing"
+ "time"
+
+ "github.com/cgrates/cgrates/config"
+ "github.com/cgrates/cgrates/engine"
+ "github.com/cgrates/cgrates/utils"
+)
+
+func TestDspAttributeSv1PingError(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrEvent := &utils.CGREvent{}
+ var reply *string
+ err := dspSrv.AttributeSv1Ping(cgrEvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if err == nil || err.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, err)
+ }
+}
+
+func TestDspAttributeSv1PingErrorTenant(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrEvent := &utils.CGREvent{
+ Tenant: "tenant",
+ ID: "",
+ Time: nil,
+ Event: nil,
+ APIOpts: nil,
+ }
+ var reply *string
+ err := dspSrv.AttributeSv1Ping(cgrEvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if err == nil || err.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, err)
+ }
+}
+
+func TestDspAttributeSv1PingErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ var reply *string
+ err := dspSrv.AttributeSv1Ping(nil, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if err == nil || err.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, err)
+ }
+}
+
+func TestDspAttributeSv1PingErrorAttributeSConns(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrEvent := &utils.CGREvent{
+ Tenant: "tenant",
+ ID: "ID",
+ Time: nil,
+ Event: nil,
+ APIOpts: nil,
+ }
+ var reply *string
+ err := dspSrv.AttributeSv1Ping(cgrEvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if err == nil || err.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, err)
+ }
+}
+
+func TestDspAttributeSv1GetAttributeForEventError(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ processEvent := &engine.AttrArgsProcessEvent{
+ AttributeIDs: nil,
+ Context: nil,
+ ProcessRuns: nil,
+ CGREvent: &utils.CGREvent{
+ Tenant: "",
+ ID: "",
+ Time: &time.Time{},
+ Event: nil,
+ APIOpts: nil,
+ },
+ }
+ var reply *engine.AttributeProfile
+ err := dspSrv.AttributeSv1GetAttributeForEvent(processEvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if err == nil || err.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, err)
+ }
+}
+
+func TestDspAttributeSv1GetAttributeForEventErrorTenant(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ processEvent := &engine.AttrArgsProcessEvent{
+ AttributeIDs: nil,
+ Context: nil,
+ ProcessRuns: nil,
+ CGREvent: &utils.CGREvent{
+ Tenant: "tenant",
+ ID: "",
+ Time: &time.Time{},
+ Event: nil,
+ APIOpts: nil,
+ },
+ }
+ var reply *engine.AttributeProfile
+ err := dspSrv.AttributeSv1GetAttributeForEvent(processEvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if err == nil || err.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, err)
+ }
+}
+
+func TestDspAttributeSv1GetAttributeForEventErrorAttributeS(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ processEvent := &engine.AttrArgsProcessEvent{
+ AttributeIDs: nil,
+ Context: nil,
+ ProcessRuns: nil,
+ CGREvent: &utils.CGREvent{
+ Tenant: "tenant",
+ ID: "",
+ Time: &time.Time{},
+ Event: nil,
+ APIOpts: nil,
+ },
+ }
+
+ var reply *engine.AttributeProfile
+ err := dspSrv.AttributeSv1GetAttributeForEvent(processEvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if err == nil || err.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, err)
+ }
+}
+
+func TestDspAttributeSv1ProcessEventError(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ processEvent := &engine.AttrArgsProcessEvent{
+ AttributeIDs: nil,
+ Context: nil,
+ ProcessRuns: nil,
+ CGREvent: &utils.CGREvent{
+ Tenant: "tenant",
+ ID: "",
+ Time: &time.Time{},
+ Event: nil,
+ APIOpts: nil,
+ },
+ }
+
+ var reply *engine.AttrSProcessEventReply
+ err := dspSrv.AttributeSv1ProcessEvent(processEvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if err == nil || err.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, err)
+ }
+}
+
+func TestDspAttributeSv1ProcessEventErrorAttributeSConns(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ processEvent := &engine.AttrArgsProcessEvent{
+ AttributeIDs: nil,
+ Context: nil,
+ ProcessRuns: nil,
+ CGREvent: &utils.CGREvent{
+ Tenant: "tenant",
+ ID: "",
+ Time: &time.Time{},
+ Event: nil,
+ APIOpts: nil,
+ },
+ }
+
+ var reply *engine.AttrSProcessEventReply
+ err := dspSrv.AttributeSv1ProcessEvent(processEvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if err == nil || err.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, err)
+ }
+}
diff --git a/dispatchers/caches_it_test.go b/dispatchers/caches_it_test.go
index 46404121b..68abe5607 100644
--- a/dispatchers/caches_it_test.go
+++ b/dispatchers/caches_it_test.go
@@ -26,8 +26,6 @@ import (
"testing"
"time"
- "github.com/cgrates/cgrates/config"
-
"github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
"github.com/cgrates/ltcache"
@@ -385,456 +383,3 @@ func testDspChcClear(t *testing.T) {
t.Errorf("Expecting: %+v, received: %+v", utils.ToJSON(expStats), utils.ToJSON(rcvStats))
}
}
-
-func TestDspCacheSv1PingError(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.CGREvent{
- Tenant: "tenant",
- ID: "",
- Time: &time.Time{},
- Event: nil,
- APIOpts: nil,
- }
- var reply *string
- result := dspSrv.CacheSv1Ping(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCacheSv1PingErrorArgs(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- var reply *string
- result := dspSrv.CacheSv1Ping(nil, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCacheSv1PingErrorAttributeSConns(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.CGREvent{
- Tenant: "tenant",
- ID: "",
- Time: &time.Time{},
- Event: nil,
- APIOpts: nil,
- }
- var reply *string
- result := dspSrv.CacheSv1Ping(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCacheSv1GetItemIDsError(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.ArgsGetCacheItemIDsWithAPIOpts{}
- var reply *[]string
- result := dspSrv.CacheSv1GetItemIDs(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCacheSv1GetItemIDsErrorArgsNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.ArgsGetCacheItemIDsWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *[]string
- result := dspSrv.CacheSv1GetItemIDs(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCacheSv1HasItemError(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.ArgsGetCacheItemWithAPIOpts{}
- var reply *bool
- result := dspSrv.CacheSv1HasItem(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCacheSv1HasItemErrorArgsNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.ArgsGetCacheItemWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *bool
- result := dspSrv.CacheSv1HasItem(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCacheSv1GetItemExpiryTimeCacheSv1GetItemExpiryTimeError(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.ArgsGetCacheItemWithAPIOpts{}
- var reply *time.Time
- result := dspSrv.CacheSv1GetItemExpiryTime(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCacheSv1GetItemExpiryTimeCacheSv1GetItemExpiryTimeErrorArgsNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.ArgsGetCacheItemWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *time.Time
- result := dspSrv.CacheSv1GetItemExpiryTime(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCacheSv1RemoveItemError(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.ArgsGetCacheItemWithAPIOpts{}
- var reply *string
- result := dspSrv.CacheSv1RemoveItem(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCacheSv1RemoveItemArgsNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.ArgsGetCacheItemWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.CacheSv1RemoveItem(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCacheSv1RemoveItemsError(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := utils.AttrReloadCacheWithAPIOpts{}
- var reply *string
- result := dspSrv.CacheSv1RemoveItems(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCacheSv1RemoveItemsArgsNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := utils.AttrReloadCacheWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.CacheSv1RemoveItems(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCacheSv1ClearError(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.AttrCacheIDsWithAPIOpts{}
- var reply *string
- result := dspSrv.CacheSv1Clear(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCacheSv1ClearArgsNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.AttrCacheIDsWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.CacheSv1Clear(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCacheSv1GetCacheStatsError(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.AttrCacheIDsWithAPIOpts{}
- var reply *map[string]*ltcache.CacheStats
- result := dspSrv.CacheSv1GetCacheStats(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCacheSv1GetCacheStatsArgsNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.AttrCacheIDsWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *map[string]*ltcache.CacheStats
- result := dspSrv.CacheSv1GetCacheStats(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCacheSv1PrecacheStatusError(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.AttrCacheIDsWithAPIOpts{}
- var reply *map[string]string
- result := dspSrv.CacheSv1PrecacheStatus(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCacheSv1PrecacheStatusArgsNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.AttrCacheIDsWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *map[string]string
- result := dspSrv.CacheSv1PrecacheStatus(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCacheSv1HasGroupError(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.ArgsGetGroupWithAPIOpts{}
- var reply *bool
- result := dspSrv.CacheSv1HasGroup(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCacheSv1HasGroupArgsNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.ArgsGetGroupWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *bool
- result := dspSrv.CacheSv1HasGroup(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCacheSv1GetGroupItemIDsError(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.ArgsGetGroupWithAPIOpts{}
- var reply *[]string
- result := dspSrv.CacheSv1GetGroupItemIDs(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCacheSv1GetGroupItemIDsArgsNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.ArgsGetGroupWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *[]string
- result := dspSrv.CacheSv1GetGroupItemIDs(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCacheSv1RemoveGroupError(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.ArgsGetGroupWithAPIOpts{}
- var reply *string
- result := dspSrv.CacheSv1RemoveGroup(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCacheSv1RemoveGroupArgsNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.ArgsGetGroupWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.CacheSv1RemoveGroup(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCacheSv1ReloadCacheError(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := utils.AttrReloadCacheWithAPIOpts{}
- var reply *string
- result := dspSrv.CacheSv1ReloadCache(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCacheSv1ReloadCacheNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := utils.AttrReloadCacheWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.CacheSv1ReloadCache(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCacheSv1LoadCacheError(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := utils.AttrReloadCacheWithAPIOpts{}
- var reply *string
- result := dspSrv.CacheSv1LoadCache(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCacheSv1LoadCacheNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := utils.AttrReloadCacheWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.CacheSv1LoadCache(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCacheSv1ReplicateRemoveError(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.ArgCacheReplicateRemove{}
- var reply *string
- result := dspSrv.CacheSv1ReplicateRemove(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCacheSv1ReplicateRemoveNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.ArgCacheReplicateRemove{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.CacheSv1ReplicateRemove(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCacheSv1ReplicateSetError(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.ArgCacheReplicateSet{}
- var reply *string
- result := dspSrv.CacheSv1ReplicateSet(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCacheSv1ReplicateSetNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.ArgCacheReplicateSet{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.CacheSv1ReplicateSet(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
diff --git a/dispatchers/caches_test.go b/dispatchers/caches_test.go
new file mode 100644
index 000000000..1b648f948
--- /dev/null
+++ b/dispatchers/caches_test.go
@@ -0,0 +1,481 @@
+/*
+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
+*/
+
+package dispatchers
+
+import (
+ "testing"
+ "time"
+
+ "github.com/cgrates/cgrates/config"
+ "github.com/cgrates/cgrates/utils"
+ "github.com/cgrates/ltcache"
+)
+
+func TestDspCacheSv1PingError(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.CGREvent{
+ Tenant: "tenant",
+ ID: "",
+ Time: &time.Time{},
+ Event: nil,
+ APIOpts: nil,
+ }
+ var reply *string
+ result := dspSrv.CacheSv1Ping(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCacheSv1PingErrorArgs(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ var reply *string
+ result := dspSrv.CacheSv1Ping(nil, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCacheSv1PingErrorAttributeSConns(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.CGREvent{
+ Tenant: "tenant",
+ ID: "",
+ Time: &time.Time{},
+ Event: nil,
+ APIOpts: nil,
+ }
+ var reply *string
+ result := dspSrv.CacheSv1Ping(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCacheSv1GetItemIDsError(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.ArgsGetCacheItemIDsWithAPIOpts{}
+ var reply *[]string
+ result := dspSrv.CacheSv1GetItemIDs(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCacheSv1GetItemIDsErrorArgsNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.ArgsGetCacheItemIDsWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *[]string
+ result := dspSrv.CacheSv1GetItemIDs(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCacheSv1HasItemError(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.ArgsGetCacheItemWithAPIOpts{}
+ var reply *bool
+ result := dspSrv.CacheSv1HasItem(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCacheSv1HasItemErrorArgsNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.ArgsGetCacheItemWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *bool
+ result := dspSrv.CacheSv1HasItem(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCacheSv1GetItemExpiryTimeCacheSv1GetItemExpiryTimeError(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.ArgsGetCacheItemWithAPIOpts{}
+ var reply *time.Time
+ result := dspSrv.CacheSv1GetItemExpiryTime(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCacheSv1GetItemExpiryTimeCacheSv1GetItemExpiryTimeErrorArgsNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.ArgsGetCacheItemWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *time.Time
+ result := dspSrv.CacheSv1GetItemExpiryTime(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCacheSv1RemoveItemError(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.ArgsGetCacheItemWithAPIOpts{}
+ var reply *string
+ result := dspSrv.CacheSv1RemoveItem(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCacheSv1RemoveItemArgsNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.ArgsGetCacheItemWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.CacheSv1RemoveItem(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCacheSv1RemoveItemsError(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := utils.AttrReloadCacheWithAPIOpts{}
+ var reply *string
+ result := dspSrv.CacheSv1RemoveItems(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCacheSv1RemoveItemsArgsNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := utils.AttrReloadCacheWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.CacheSv1RemoveItems(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCacheSv1ClearError(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.AttrCacheIDsWithAPIOpts{}
+ var reply *string
+ result := dspSrv.CacheSv1Clear(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCacheSv1ClearArgsNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.AttrCacheIDsWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.CacheSv1Clear(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCacheSv1GetCacheStatsError(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.AttrCacheIDsWithAPIOpts{}
+ var reply *map[string]*ltcache.CacheStats
+ result := dspSrv.CacheSv1GetCacheStats(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCacheSv1GetCacheStatsArgsNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.AttrCacheIDsWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *map[string]*ltcache.CacheStats
+ result := dspSrv.CacheSv1GetCacheStats(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCacheSv1PrecacheStatusError(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.AttrCacheIDsWithAPIOpts{}
+ var reply *map[string]string
+ result := dspSrv.CacheSv1PrecacheStatus(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCacheSv1PrecacheStatusArgsNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.AttrCacheIDsWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *map[string]string
+ result := dspSrv.CacheSv1PrecacheStatus(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCacheSv1HasGroupError(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.ArgsGetGroupWithAPIOpts{}
+ var reply *bool
+ result := dspSrv.CacheSv1HasGroup(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCacheSv1HasGroupArgsNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.ArgsGetGroupWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *bool
+ result := dspSrv.CacheSv1HasGroup(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCacheSv1GetGroupItemIDsError(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.ArgsGetGroupWithAPIOpts{}
+ var reply *[]string
+ result := dspSrv.CacheSv1GetGroupItemIDs(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCacheSv1GetGroupItemIDsArgsNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.ArgsGetGroupWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *[]string
+ result := dspSrv.CacheSv1GetGroupItemIDs(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCacheSv1RemoveGroupError(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.ArgsGetGroupWithAPIOpts{}
+ var reply *string
+ result := dspSrv.CacheSv1RemoveGroup(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCacheSv1RemoveGroupArgsNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.ArgsGetGroupWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.CacheSv1RemoveGroup(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCacheSv1ReloadCacheError(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := utils.AttrReloadCacheWithAPIOpts{}
+ var reply *string
+ result := dspSrv.CacheSv1ReloadCache(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCacheSv1ReloadCacheNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := utils.AttrReloadCacheWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.CacheSv1ReloadCache(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCacheSv1LoadCacheError(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := utils.AttrReloadCacheWithAPIOpts{}
+ var reply *string
+ result := dspSrv.CacheSv1LoadCache(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCacheSv1LoadCacheNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := utils.AttrReloadCacheWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.CacheSv1LoadCache(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCacheSv1ReplicateRemoveError(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.ArgCacheReplicateRemove{}
+ var reply *string
+ result := dspSrv.CacheSv1ReplicateRemove(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCacheSv1ReplicateRemoveNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.ArgCacheReplicateRemove{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.CacheSv1ReplicateRemove(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCacheSv1ReplicateSetError(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.ArgCacheReplicateSet{}
+ var reply *string
+ result := dspSrv.CacheSv1ReplicateSet(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCacheSv1ReplicateSetNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.ArgCacheReplicateSet{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.CacheSv1ReplicateSet(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
diff --git a/dispatchers/cdrs_it_test.go b/dispatchers/cdrs_it_test.go
index 7bf272f05..30a70d070 100644
--- a/dispatchers/cdrs_it_test.go
+++ b/dispatchers/cdrs_it_test.go
@@ -24,7 +24,6 @@ import (
"testing"
"time"
- "github.com/cgrates/cgrates/config"
"github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
@@ -639,327 +638,3 @@ func testDspCDRsV2StoreSessionCostNoAuth(t *testing.T) {
t.Error("Unexpected error: ", err)
}
}
-
-func TestDspCDRsV1PingError(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.CGREvent{}
- var reply *string
- result := dspSrv.CDRsV1Ping(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCDRsV1PingNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.CGREvent{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.CDRsV1Ping(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCDRsV1PingNilError(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- var reply *string
- result := dspSrv.CDRsV1Ping(nil, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCDRsV1GetCDRsError(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.RPCCDRsFilterWithAPIOpts{}
- var reply *[]*engine.CDR
- result := dspSrv.CDRsV1GetCDRs(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCDRsV1GetCDRsNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.RPCCDRsFilterWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *[]*engine.CDR
- result := dspSrv.CDRsV1GetCDRs(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCDRsV1GetCDRsCountError(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.RPCCDRsFilterWithAPIOpts{}
- var reply *int64
- result := dspSrv.CDRsV1GetCDRsCount(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCDRsV1GetCDRsCountNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.RPCCDRsFilterWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *int64
- result := dspSrv.CDRsV1GetCDRsCount(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCDRsV1RateCDRsError(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &engine.ArgRateCDRs{}
- var reply *string
- result := dspSrv.CDRsV1RateCDRs(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCDRsV1RateCDRsNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &engine.ArgRateCDRs{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.CDRsV1RateCDRs(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCDRsV1ProcessExternalCDRError(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &engine.ExternalCDRWithAPIOpts{
- ExternalCDR: &engine.ExternalCDR{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.CDRsV1ProcessExternalCDR(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCDRsV1ProcessExternalCDRNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &engine.ExternalCDRWithAPIOpts{
- ExternalCDR: &engine.ExternalCDR{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.CDRsV1ProcessExternalCDR(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCDRsV1ProcessEventError(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &engine.ArgV1ProcessEvent{
- CGREvent: utils.CGREvent{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.CDRsV1ProcessEvent(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCDRsV1ProcessEventNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &engine.ArgV1ProcessEvent{
- CGREvent: utils.CGREvent{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.CDRsV1ProcessEvent(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCDRsV1ProcessCDRError(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &engine.CDRWithAPIOpts{
- CDR: &engine.CDR{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.CDRsV1ProcessCDR(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCDRsV1ProcessCDRNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &engine.CDRWithAPIOpts{
- CDR: &engine.CDR{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.CDRsV1ProcessCDR(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCDRsV2ProcessEventError(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &engine.ArgV1ProcessEvent{
- Flags: nil,
- CGREvent: utils.CGREvent{
- Tenant: "tenant",
- },
- }
- var reply *[]*utils.EventWithFlags
- result := dspSrv.CDRsV2ProcessEvent(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCDRsV2ProcessEventNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &engine.ArgV1ProcessEvent{
- Flags: nil,
- CGREvent: utils.CGREvent{
- Tenant: "tenant",
- },
- }
- var reply *[]*utils.EventWithFlags
- result := dspSrv.CDRsV2ProcessEvent(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCDRsV2ProcessEventErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &engine.ArgV1ProcessEvent{
- Flags: nil,
- CGREvent: utils.CGREvent{},
- }
- var reply *[]*utils.EventWithFlags
- result := dspSrv.CDRsV2ProcessEvent(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCDRsV1StoreSessionCostNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &engine.AttrCDRSStoreSMCost{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.CDRsV1StoreSessionCost(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCDRsV1StoreSessionCostErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &engine.AttrCDRSStoreSMCost{}
- var reply *string
- result := dspSrv.CDRsV1StoreSessionCost(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCDRsV2StoreSessionCostNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &engine.ArgsV2CDRSStoreSMCost{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.CDRsV2StoreSessionCost(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCDRsV2StoreSessionCostErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &engine.ArgsV2CDRSStoreSMCost{}
- var reply *string
- result := dspSrv.CDRsV2StoreSessionCost(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
diff --git a/dispatchers/cdrs_test.go b/dispatchers/cdrs_test.go
new file mode 100644
index 000000000..b45fac502
--- /dev/null
+++ b/dispatchers/cdrs_test.go
@@ -0,0 +1,351 @@
+/*
+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
+*/
+
+package dispatchers
+
+import (
+ "testing"
+
+ "github.com/cgrates/cgrates/config"
+ "github.com/cgrates/cgrates/engine"
+ "github.com/cgrates/cgrates/utils"
+)
+
+func TestDspCDRsV1PingError(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.CGREvent{}
+ var reply *string
+ result := dspSrv.CDRsV1Ping(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCDRsV1PingNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.CGREvent{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.CDRsV1Ping(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCDRsV1PingNilError(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ var reply *string
+ result := dspSrv.CDRsV1Ping(nil, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCDRsV1GetCDRsError(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.RPCCDRsFilterWithAPIOpts{}
+ var reply *[]*engine.CDR
+ result := dspSrv.CDRsV1GetCDRs(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCDRsV1GetCDRsNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.RPCCDRsFilterWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *[]*engine.CDR
+ result := dspSrv.CDRsV1GetCDRs(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCDRsV1GetCDRsCountError(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.RPCCDRsFilterWithAPIOpts{}
+ var reply *int64
+ result := dspSrv.CDRsV1GetCDRsCount(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCDRsV1GetCDRsCountNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.RPCCDRsFilterWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *int64
+ result := dspSrv.CDRsV1GetCDRsCount(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCDRsV1RateCDRsError(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &engine.ArgRateCDRs{}
+ var reply *string
+ result := dspSrv.CDRsV1RateCDRs(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCDRsV1RateCDRsNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &engine.ArgRateCDRs{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.CDRsV1RateCDRs(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCDRsV1ProcessExternalCDRError(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &engine.ExternalCDRWithAPIOpts{
+ ExternalCDR: &engine.ExternalCDR{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.CDRsV1ProcessExternalCDR(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCDRsV1ProcessExternalCDRNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &engine.ExternalCDRWithAPIOpts{
+ ExternalCDR: &engine.ExternalCDR{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.CDRsV1ProcessExternalCDR(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCDRsV1ProcessEventError(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &engine.ArgV1ProcessEvent{
+ CGREvent: utils.CGREvent{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.CDRsV1ProcessEvent(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCDRsV1ProcessEventNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &engine.ArgV1ProcessEvent{
+ CGREvent: utils.CGREvent{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.CDRsV1ProcessEvent(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCDRsV1ProcessCDRError(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &engine.CDRWithAPIOpts{
+ CDR: &engine.CDR{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.CDRsV1ProcessCDR(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCDRsV1ProcessCDRNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &engine.CDRWithAPIOpts{
+ CDR: &engine.CDR{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.CDRsV1ProcessCDR(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCDRsV2ProcessEventError(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &engine.ArgV1ProcessEvent{
+ Flags: nil,
+ CGREvent: utils.CGREvent{
+ Tenant: "tenant",
+ },
+ }
+ var reply *[]*utils.EventWithFlags
+ result := dspSrv.CDRsV2ProcessEvent(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCDRsV2ProcessEventNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &engine.ArgV1ProcessEvent{
+ Flags: nil,
+ CGREvent: utils.CGREvent{
+ Tenant: "tenant",
+ },
+ }
+ var reply *[]*utils.EventWithFlags
+ result := dspSrv.CDRsV2ProcessEvent(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCDRsV2ProcessEventErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &engine.ArgV1ProcessEvent{
+ Flags: nil,
+ CGREvent: utils.CGREvent{},
+ }
+ var reply *[]*utils.EventWithFlags
+ result := dspSrv.CDRsV2ProcessEvent(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCDRsV1StoreSessionCostNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &engine.AttrCDRSStoreSMCost{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.CDRsV1StoreSessionCost(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCDRsV1StoreSessionCostErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &engine.AttrCDRSStoreSMCost{}
+ var reply *string
+ result := dspSrv.CDRsV1StoreSessionCost(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCDRsV2StoreSessionCostNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &engine.ArgsV2CDRSStoreSMCost{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.CDRsV2StoreSessionCost(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCDRsV2StoreSessionCostErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &engine.ArgsV2CDRSStoreSMCost{}
+ var reply *string
+ result := dspSrv.CDRsV2StoreSessionCost(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
diff --git a/dispatchers/chargers_it_test.go b/dispatchers/chargers_it_test.go
index ee00740f6..ce43d3be7 100644
--- a/dispatchers/chargers_it_test.go
+++ b/dispatchers/chargers_it_test.go
@@ -26,8 +26,6 @@ import (
"strings"
"testing"
- "github.com/cgrates/cgrates/config"
-
"github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
@@ -307,95 +305,3 @@ func testDspCppGetChtgRoundRobin(t *testing.T) {
}
}
-
-func TestDspChargerSv1PingNilStruct(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- var reply *string
- result := dspSrv.ChargerSv1Ping(nil, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspChargerSv1PingNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.CGREvent{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ChargerSv1Ping(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspChargerSv1PingErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.CGREvent{}
- var reply *string
- result := dspSrv.ChargerSv1Ping(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspChargerSv1GetChargersForEventNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.CGREvent{
- Tenant: "tenant",
- }
- var reply *engine.ChargerProfiles
- result := dspSrv.ChargerSv1GetChargersForEvent(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspChargerSv1GetChargersForEventErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.CGREvent{}
- var reply *engine.ChargerProfiles
- result := dspSrv.ChargerSv1GetChargersForEvent(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspChargerSv1ProcessEventNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.CGREvent{
- Tenant: "tenant",
- }
- var reply *[]*engine.ChrgSProcessEventReply
- result := dspSrv.ChargerSv1ProcessEvent(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspChargerSv1ProcessEventErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.CGREvent{}
- var reply *[]*engine.ChrgSProcessEventReply
- result := dspSrv.ChargerSv1ProcessEvent(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
diff --git a/dispatchers/chargers_test.go b/dispatchers/chargers_test.go
new file mode 100644
index 000000000..ae4638da1
--- /dev/null
+++ b/dispatchers/chargers_test.go
@@ -0,0 +1,119 @@
+/*
+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
+*/
+
+package dispatchers
+
+import (
+ "testing"
+
+ "github.com/cgrates/cgrates/config"
+ "github.com/cgrates/cgrates/engine"
+ "github.com/cgrates/cgrates/utils"
+)
+
+func TestDspChargerSv1PingNilStruct(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ var reply *string
+ result := dspSrv.ChargerSv1Ping(nil, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspChargerSv1PingNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.CGREvent{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ChargerSv1Ping(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspChargerSv1PingErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.CGREvent{}
+ var reply *string
+ result := dspSrv.ChargerSv1Ping(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspChargerSv1GetChargersForEventNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.CGREvent{
+ Tenant: "tenant",
+ }
+ var reply *engine.ChargerProfiles
+ result := dspSrv.ChargerSv1GetChargersForEvent(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspChargerSv1GetChargersForEventErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.CGREvent{}
+ var reply *engine.ChargerProfiles
+ result := dspSrv.ChargerSv1GetChargersForEvent(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspChargerSv1ProcessEventNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.CGREvent{
+ Tenant: "tenant",
+ }
+ var reply *[]*engine.ChrgSProcessEventReply
+ result := dspSrv.ChargerSv1ProcessEvent(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspChargerSv1ProcessEventErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.CGREvent{}
+ var reply *[]*engine.ChrgSProcessEventReply
+ result := dspSrv.ChargerSv1ProcessEvent(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
diff --git a/dispatchers/config_it_test.go b/dispatchers/config_it_test.go
index c2d94aaff..3151f3fc0 100644
--- a/dispatchers/config_it_test.go
+++ b/dispatchers/config_it_test.go
@@ -84,138 +84,3 @@ func testDspConfigSv1GetJSONSection(t *testing.T) {
t.Errorf("Expected: %+v, received: %+v", utils.ToJSON(expected), utils.ToJSON(reply))
}
}
-
-func TestDspConfigSv1GetConfigNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &config.SectionWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *map[string]interface{}
- result := dspSrv.ConfigSv1GetConfig(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspConfigSv1GetConfigErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &config.SectionWithAPIOpts{}
- var reply *map[string]interface{}
- result := dspSrv.ConfigSv1GetConfig(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspConfigSv1ReloadConfigNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &config.ReloadArgs{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ConfigSv1ReloadConfig(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspConfigSv1ReloadConfigErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &config.ReloadArgs{}
- var reply *string
- result := dspSrv.ConfigSv1ReloadConfig(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspConfigSv1SetConfigNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &config.SetConfigArgs{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ConfigSv1SetConfig(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspConfigSv1SetConfigErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &config.SetConfigArgs{}
- var reply *string
- result := dspSrv.ConfigSv1SetConfig(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspConfigSv1SetConfigFromJSONNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &config.SetConfigFromJSONArgs{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ConfigSv1SetConfigFromJSON(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspConfigSv1SetConfigFromJSONErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &config.SetConfigFromJSONArgs{}
- var reply *string
- result := dspSrv.ConfigSv1SetConfigFromJSON(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspConfigSv1GetConfigAsJSONNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &config.SectionWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ConfigSv1GetConfigAsJSON(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspConfigSv1GetConfigAsJSONErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &config.SectionWithAPIOpts{}
- var reply *string
- result := dspSrv.ConfigSv1GetConfigAsJSON(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
diff --git a/dispatchers/config_test.go b/dispatchers/config_test.go
new file mode 100644
index 000000000..e4db6ac29
--- /dev/null
+++ b/dispatchers/config_test.go
@@ -0,0 +1,160 @@
+/*
+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
+*/
+
+package dispatchers
+
+import (
+ "testing"
+
+ "github.com/cgrates/cgrates/config"
+)
+
+func TestDspConfigSv1GetConfigNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &config.SectionWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *map[string]interface{}
+ result := dspSrv.ConfigSv1GetConfig(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspConfigSv1GetConfigErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &config.SectionWithAPIOpts{}
+ var reply *map[string]interface{}
+ result := dspSrv.ConfigSv1GetConfig(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspConfigSv1ReloadConfigNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &config.ReloadArgs{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ConfigSv1ReloadConfig(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspConfigSv1ReloadConfigErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &config.ReloadArgs{}
+ var reply *string
+ result := dspSrv.ConfigSv1ReloadConfig(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspConfigSv1SetConfigNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &config.SetConfigArgs{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ConfigSv1SetConfig(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspConfigSv1SetConfigErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &config.SetConfigArgs{}
+ var reply *string
+ result := dspSrv.ConfigSv1SetConfig(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspConfigSv1SetConfigFromJSONNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &config.SetConfigFromJSONArgs{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ConfigSv1SetConfigFromJSON(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspConfigSv1SetConfigFromJSONErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &config.SetConfigFromJSONArgs{}
+ var reply *string
+ result := dspSrv.ConfigSv1SetConfigFromJSON(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspConfigSv1GetConfigAsJSONNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &config.SectionWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ConfigSv1GetConfigAsJSON(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspConfigSv1GetConfigAsJSONErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &config.SectionWithAPIOpts{}
+ var reply *string
+ result := dspSrv.ConfigSv1GetConfigAsJSON(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
diff --git a/dispatchers/core_it_test.go b/dispatchers/core_it_test.go
index be6032e3c..a99c283bc 100644
--- a/dispatchers/core_it_test.go
+++ b/dispatchers/core_it_test.go
@@ -25,7 +25,6 @@ import (
"testing"
"time"
- "github.com/cgrates/cgrates/config"
"github.com/cgrates/cgrates/utils"
)
@@ -106,84 +105,3 @@ func testDspCoreLoad(t *testing.T) {
}
}
-
-func TestDspCoreSv1StatusNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.TenantWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *map[string]interface{}
- result := dspSrv.CoreSv1Status(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCoreSv1StatusErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.TenantWithAPIOpts{}
- var reply *map[string]interface{}
- result := dspSrv.CoreSv1Status(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCoreSv1PingNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.CGREvent{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.CoreSv1Ping(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCoreSv1PingErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.CGREvent{}
- var reply *string
- result := dspSrv.CoreSv1Ping(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCoreSv1SleepNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.DurationArgs{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.CoreSv1Sleep(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspCoreSv1SleepErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.DurationArgs{}
- var reply *string
- result := dspSrv.CoreSv1Sleep(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
diff --git a/dispatchers/core_test.go b/dispatchers/core_test.go
new file mode 100644
index 000000000..de75f0c89
--- /dev/null
+++ b/dispatchers/core_test.go
@@ -0,0 +1,107 @@
+/*
+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
+*/
+
+package dispatchers
+
+import (
+ "testing"
+
+ "github.com/cgrates/cgrates/config"
+ "github.com/cgrates/cgrates/utils"
+)
+
+func TestDspCoreSv1StatusNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.TenantWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *map[string]interface{}
+ result := dspSrv.CoreSv1Status(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCoreSv1StatusErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.TenantWithAPIOpts{}
+ var reply *map[string]interface{}
+ result := dspSrv.CoreSv1Status(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCoreSv1PingNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.CGREvent{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.CoreSv1Ping(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCoreSv1PingErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.CGREvent{}
+ var reply *string
+ result := dspSrv.CoreSv1Ping(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCoreSv1SleepNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.DurationArgs{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.CoreSv1Sleep(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspCoreSv1SleepErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.DurationArgs{}
+ var reply *string
+ result := dspSrv.CoreSv1Sleep(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
diff --git a/dispatchers/replicator_it_test.go b/dispatchers/replicator_it_test.go
index 8d9f37b6b..452ece0e0 100644
--- a/dispatchers/replicator_it_test.go
+++ b/dispatchers/replicator_it_test.go
@@ -1466,3046 +1466,3 @@ func testDspRplLoadIDs(t *testing.T) {
// Start engine 1
allEngine.startEngine(t)
}
-
-func TestDspReplicatorSv1PingNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- var reply *string
- result := dspSrv.ReplicatorSv1Ping(nil, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1PingNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.CGREvent{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ReplicatorSv1Ping(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1PingErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.CGREvent{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ReplicatorSv1Ping(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetAccountNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- var reply *engine.Account
- result := dspSrv.ReplicatorSv1GetAccount(nil, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetAccountNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.StringWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *engine.Account
- result := dspSrv.ReplicatorSv1GetAccount(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetAccountErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.StringWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *engine.Account
- result := dspSrv.ReplicatorSv1GetAccount(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetDestinationNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
-
- var reply *engine.Destination
- result := dspSrv.ReplicatorSv1GetDestination(nil, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetDestinationNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.StringWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *engine.Destination
- result := dspSrv.ReplicatorSv1GetDestination(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetDestinationErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.StringWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *engine.Destination
- result := dspSrv.ReplicatorSv1GetDestination(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetReverseDestinationNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- var reply *[]string
- result := dspSrv.ReplicatorSv1GetReverseDestination(nil, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetReverseDestinationNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.StringWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *[]string
- result := dspSrv.ReplicatorSv1GetReverseDestination(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetReverseDestinationErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.StringWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *[]string
- result := dspSrv.ReplicatorSv1GetReverseDestination(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetStatQueueNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *engine.StatQueue
- result := dspSrv.ReplicatorSv1GetStatQueue(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetStatQueueErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *engine.StatQueue
- result := dspSrv.ReplicatorSv1GetStatQueue(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetFilterNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *engine.Filter
- result := dspSrv.ReplicatorSv1GetFilter(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetFilterErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *engine.Filter
- result := dspSrv.ReplicatorSv1GetFilter(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetThresholdNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *engine.Threshold
- result := dspSrv.ReplicatorSv1GetThreshold(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetThresholdErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *engine.Threshold
- result := dspSrv.ReplicatorSv1GetThreshold(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetThresholdProfileNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *engine.ThresholdProfile
- result := dspSrv.ReplicatorSv1GetThresholdProfile(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetThresholdProfileErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *engine.ThresholdProfile
- result := dspSrv.ReplicatorSv1GetThresholdProfile(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetStatQueueProfileNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *engine.StatQueueProfile
- result := dspSrv.ReplicatorSv1GetStatQueueProfile(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetStatQueueProfileErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *engine.StatQueueProfile
- result := dspSrv.ReplicatorSv1GetStatQueueProfile(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetTimingNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- var reply *utils.TPTiming
- result := dspSrv.ReplicatorSv1GetTiming(nil, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetTimingNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.StringWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *utils.TPTiming
- result := dspSrv.ReplicatorSv1GetTiming(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetTimingErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.StringWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *utils.TPTiming
- result := dspSrv.ReplicatorSv1GetTiming(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetResourceNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *engine.Resource
- result := dspSrv.ReplicatorSv1GetResource(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetResourceErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *engine.Resource
- result := dspSrv.ReplicatorSv1GetResource(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetResourceProfileReplicatorSv1GetResourceProfileNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *engine.ResourceProfile
- result := dspSrv.ReplicatorSv1GetResourceProfile(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetResourceProfileErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *engine.ResourceProfile
- result := dspSrv.ReplicatorSv1GetResourceProfile(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetActionTriggersNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- var reply *engine.ActionTriggers
- result := dspSrv.ReplicatorSv1GetActionTriggers(nil, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetActionTriggersNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.StringWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *engine.ActionTriggers
- result := dspSrv.ReplicatorSv1GetActionTriggers(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetActionTriggersErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.StringWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *engine.ActionTriggers
- result := dspSrv.ReplicatorSv1GetActionTriggers(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetSharedGroupNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- var reply *engine.SharedGroup
- result := dspSrv.ReplicatorSv1GetSharedGroup(nil, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetSharedGroupNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.StringWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *engine.SharedGroup
- result := dspSrv.ReplicatorSv1GetSharedGroup(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetSharedGroupErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.StringWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *engine.SharedGroup
- result := dspSrv.ReplicatorSv1GetSharedGroup(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetActionsNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- var reply *engine.Actions
- result := dspSrv.ReplicatorSv1GetActions(nil, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetActionsNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.StringWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *engine.Actions
- result := dspSrv.ReplicatorSv1GetActions(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetActionsErrorNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- var reply *engine.Actions
- result := dspSrv.ReplicatorSv1GetActions(nil, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetActionsErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.StringWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *engine.Actions
- result := dspSrv.ReplicatorSv1GetActions(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetActionPlanNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.StringWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *engine.ActionPlan
- result := dspSrv.ReplicatorSv1GetActionPlan(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetActionPlanErrorNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- var reply *engine.ActionPlan
- result := dspSrv.ReplicatorSv1GetActionPlan(nil, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetActionPlanErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.StringWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *engine.ActionPlan
- result := dspSrv.ReplicatorSv1GetActionPlan(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetAllActionPlansNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- var reply *map[string]*engine.ActionPlan
- result := dspSrv.ReplicatorSv1GetAllActionPlans(nil, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetAllActionPlansNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.StringWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *map[string]*engine.ActionPlan
- result := dspSrv.ReplicatorSv1GetAllActionPlans(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetAllActionPlansErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.StringWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *map[string]*engine.ActionPlan
- result := dspSrv.ReplicatorSv1GetAllActionPlans(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetAccountActionPlansNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- var reply *[]string
- result := dspSrv.ReplicatorSv1GetAccountActionPlans(nil, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetAccountActionPlansNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.StringWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *[]string
- result := dspSrv.ReplicatorSv1GetAccountActionPlans(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetAccountActionPlansErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.StringWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *[]string
- result := dspSrv.ReplicatorSv1GetAccountActionPlans(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetRatingPlanNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
-
- var reply *engine.RatingPlan
- result := dspSrv.ReplicatorSv1GetRatingPlan(nil, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetRatingPlanNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.StringWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *engine.RatingPlan
- result := dspSrv.ReplicatorSv1GetRatingPlan(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetRatingPlanErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.StringWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *engine.RatingPlan
- result := dspSrv.ReplicatorSv1GetRatingPlan(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetRatingProfileNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- var reply *engine.RatingProfile
- result := dspSrv.ReplicatorSv1GetRatingProfile(nil, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetRatingProfileNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.StringWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *engine.RatingProfile
- result := dspSrv.ReplicatorSv1GetRatingProfile(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetRatingProfileErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.StringWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *engine.RatingProfile
- result := dspSrv.ReplicatorSv1GetRatingProfile(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetRouteProfileNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *engine.RouteProfile
- result := dspSrv.ReplicatorSv1GetRouteProfile(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetRouteProfileErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *engine.RouteProfile
- result := dspSrv.ReplicatorSv1GetRouteProfile(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetAttributeProfileNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *engine.AttributeProfile
- result := dspSrv.ReplicatorSv1GetAttributeProfile(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetAttributeProfileErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *engine.AttributeProfile
- result := dspSrv.ReplicatorSv1GetAttributeProfile(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetChargerProfileNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *engine.ChargerProfile
- result := dspSrv.ReplicatorSv1GetChargerProfile(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetChargerProfileErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *engine.ChargerProfile
- result := dspSrv.ReplicatorSv1GetChargerProfile(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetDispatcherProfileNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *engine.DispatcherProfile
- result := dspSrv.ReplicatorSv1GetDispatcherProfile(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetDispatcherProfileErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *engine.DispatcherProfile
- result := dspSrv.ReplicatorSv1GetDispatcherProfile(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetDispatcherHostNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *engine.DispatcherHost
- result := dspSrv.ReplicatorSv1GetDispatcherHost(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetDispatcherHostErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *engine.DispatcherHost
- result := dspSrv.ReplicatorSv1GetDispatcherHost(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetItemLoadIDsNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- var reply *map[string]int64
- result := dspSrv.ReplicatorSv1GetItemLoadIDs(nil, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetItemLoadIDsNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.StringWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *map[string]int64
- result := dspSrv.ReplicatorSv1GetItemLoadIDs(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetItemLoadIDsErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.StringWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *map[string]int64
- result := dspSrv.ReplicatorSv1GetItemLoadIDs(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetThresholdProfileNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &engine.ThresholdProfileWithAPIOpts{
- ThresholdProfile: &engine.ThresholdProfile{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.ReplicatorSv1SetThresholdProfile(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetThresholdProfileErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &engine.ThresholdProfileWithAPIOpts{
- ThresholdProfile: &engine.ThresholdProfile{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.ReplicatorSv1SetThresholdProfile(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetThresholdProfileNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- var reply *string
- result := dspSrv.ReplicatorSv1SetThresholdProfile(nil, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetThresholdNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &engine.ThresholdWithAPIOpts{
- Threshold: &engine.Threshold{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.ReplicatorSv1SetThreshold(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetThresholdErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &engine.ThresholdWithAPIOpts{
- Threshold: &engine.Threshold{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.ReplicatorSv1SetThreshold(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetThresholdNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- var reply *string
- result := dspSrv.ReplicatorSv1SetThreshold(nil, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetDestinationNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &engine.DestinationWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ReplicatorSv1SetDestination(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetDestinationErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &engine.DestinationWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ReplicatorSv1SetDestination(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetDestinationNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- var reply *string
- result := dspSrv.ReplicatorSv1SetDestination(nil, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetAccountNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &engine.AccountWithAPIOpts{
- Account: &engine.Account{},
- }
- var reply *string
- result := dspSrv.ReplicatorSv1SetAccount(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetAccountErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &engine.AccountWithAPIOpts{
- Account: &engine.Account{
- ID: "testID",
- },
- }
- var reply *string
- result := dspSrv.ReplicatorSv1SetAccount(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetAccountNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- var reply *string
- result := dspSrv.ReplicatorSv1SetAccount(nil, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetReverseDestinationNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &engine.DestinationWithAPIOpts{
- Destination: &engine.Destination{
- Id: "testID",
- },
- }
- var reply *string
- result := dspSrv.ReplicatorSv1SetReverseDestination(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetReverseDestinationErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &engine.DestinationWithAPIOpts{
- Destination: &engine.Destination{
- Id: "testID",
- },
- }
- var reply *string
- result := dspSrv.ReplicatorSv1SetReverseDestination(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetReverseDestinationNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- var reply *string
- result := dspSrv.ReplicatorSv1SetReverseDestination(nil, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetStatQueueNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &engine.StatQueueWithAPIOpts{
- StatQueue: &engine.StatQueue{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.ReplicatorSv1SetStatQueue(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetStatQueueErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &engine.StatQueueWithAPIOpts{
- StatQueue: &engine.StatQueue{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.ReplicatorSv1SetStatQueue(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetStatQueueNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- var reply *string
- result := dspSrv.ReplicatorSv1SetStatQueue(nil, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetFilterNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &engine.FilterWithAPIOpts{
- Filter: &engine.Filter{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.ReplicatorSv1SetFilter(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetFilterErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &engine.FilterWithAPIOpts{
- Filter: &engine.Filter{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.ReplicatorSv1SetFilter(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetFilterNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- var reply *string
- result := dspSrv.ReplicatorSv1SetFilter(nil, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetStatQueueProfileNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &engine.StatQueueProfileWithAPIOpts{
- StatQueueProfile: &engine.StatQueueProfile{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.ReplicatorSv1SetStatQueueProfile(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetStatQueueProfileErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &engine.StatQueueProfileWithAPIOpts{
- StatQueueProfile: &engine.StatQueueProfile{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.ReplicatorSv1SetStatQueueProfile(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetStatQueueProfileNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- var reply *string
- result := dspSrv.ReplicatorSv1SetStatQueueProfile(nil, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetTimingNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.TPTimingWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ReplicatorSv1SetTiming(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetTimingErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.TPTimingWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ReplicatorSv1SetTiming(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetTimingNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- var reply *string
- result := dspSrv.ReplicatorSv1SetTiming(nil, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetResourceNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &engine.ResourceWithAPIOpts{
- Resource: &engine.Resource{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.ReplicatorSv1SetResource(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetResourceErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &engine.ResourceWithAPIOpts{
- Resource: &engine.Resource{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.ReplicatorSv1SetResource(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetResourceNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- var reply *string
- result := dspSrv.ReplicatorSv1SetResource(nil, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetResourceProfileNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &engine.ResourceProfileWithAPIOpts{
- ResourceProfile: &engine.ResourceProfile{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.ReplicatorSv1SetResourceProfile(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestReplicatorSv1SetResourceProfileErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &engine.ResourceProfileWithAPIOpts{
- ResourceProfile: &engine.ResourceProfile{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.ReplicatorSv1SetResourceProfile(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetResourceProfileNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- var reply *string
- result := dspSrv.ReplicatorSv1SetResourceProfile(nil, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetSharedGroupNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &engine.SharedGroupWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ReplicatorSv1SetSharedGroup(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestReplicatorSv1SetSharedGroupErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &engine.SharedGroupWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ReplicatorSv1SetSharedGroup(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetSharedGroupNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- var reply *string
- result := dspSrv.ReplicatorSv1SetSharedGroup(nil, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetActionsNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &engine.SetActionsArgsWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ReplicatorSv1SetActions(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestReplicatorSv1SetActionsErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &engine.SetActionsArgsWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ReplicatorSv1SetActions(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetActionsNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- var reply *string
- result := dspSrv.ReplicatorSv1SetActions(nil, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetRatingProfileNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &engine.RatingProfileWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ReplicatorSv1SetRatingProfile(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestReplicatorSv1SetRatingProfileErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &engine.RatingProfileWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ReplicatorSv1SetRatingProfile(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetRatingProfileNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- var reply *string
- result := dspSrv.ReplicatorSv1SetRatingProfile(nil, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetRatingPlanNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &engine.RatingPlanWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ReplicatorSv1SetRatingPlan(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetRatingPlanErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &engine.RatingPlanWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ReplicatorSv1SetRatingPlan(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetRatingPlanNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- var reply *string
- result := dspSrv.ReplicatorSv1SetRatingPlan(nil, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetActionTriggersNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &engine.SetActionTriggersArgWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ReplicatorSv1SetActionTriggers(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetActionTriggersErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &engine.SetActionTriggersArgWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ReplicatorSv1SetActionTriggers(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetActionTriggersNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- var reply *string
- result := dspSrv.ReplicatorSv1SetActionTriggers(nil, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetRouteProfileNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &engine.RouteProfileWithAPIOpts{
- RouteProfile: &engine.RouteProfile{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.ReplicatorSv1SetRouteProfile(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetRouteProfileErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &engine.RouteProfileWithAPIOpts{
- RouteProfile: &engine.RouteProfile{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.ReplicatorSv1SetRouteProfile(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetRouteProfileNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- var reply *string
- result := dspSrv.ReplicatorSv1SetRouteProfile(nil, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetAttributeProfileNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &engine.AttributeProfileWithAPIOpts{
- AttributeProfile: &engine.AttributeProfile{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.ReplicatorSv1SetAttributeProfile(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetAttributeProfileErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &engine.AttributeProfileWithAPIOpts{
- AttributeProfile: &engine.AttributeProfile{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.ReplicatorSv1SetAttributeProfile(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetAttributeProfileNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- var reply *string
- result := dspSrv.ReplicatorSv1SetAttributeProfile(nil, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetChargerProfileNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &engine.ChargerProfileWithAPIOpts{
- ChargerProfile: &engine.ChargerProfile{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.ReplicatorSv1SetChargerProfile(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetChargerProfileErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &engine.ChargerProfileWithAPIOpts{
- ChargerProfile: &engine.ChargerProfile{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.ReplicatorSv1SetChargerProfile(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetChargerProfileNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- var reply *string
- result := dspSrv.ReplicatorSv1SetChargerProfile(nil, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetDispatcherProfileNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &engine.DispatcherProfileWithAPIOpts{
- DispatcherProfile: &engine.DispatcherProfile{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.ReplicatorSv1SetDispatcherProfile(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetDispatcherProfileErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &engine.DispatcherProfileWithAPIOpts{
- DispatcherProfile: &engine.DispatcherProfile{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.ReplicatorSv1SetDispatcherProfile(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetDispatcherProfileNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- var reply *string
- result := dspSrv.ReplicatorSv1SetDispatcherProfile(nil, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetActionPlanNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &engine.SetActionPlanArgWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ReplicatorSv1SetActionPlan(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetActionPlanErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &engine.SetActionPlanArgWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ReplicatorSv1SetActionPlan(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetActionPlanNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- var reply *string
- result := dspSrv.ReplicatorSv1SetActionPlan(nil, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetAccountActionPlansNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &engine.SetAccountActionPlansArgWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ReplicatorSv1SetAccountActionPlans(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetAccountActionPlansErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &engine.SetAccountActionPlansArgWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ReplicatorSv1SetAccountActionPlans(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetAccountActionPlansNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- var reply *string
- result := dspSrv.ReplicatorSv1SetAccountActionPlans(nil, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetDispatcherHostNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &engine.DispatcherHostWithAPIOpts{
- DispatcherHost: &engine.DispatcherHost{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.ReplicatorSv1SetDispatcherHost(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestReplicatorSv1SetDispatcherHostErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &engine.DispatcherHostWithAPIOpts{
- DispatcherHost: &engine.DispatcherHost{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.ReplicatorSv1SetDispatcherHost(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetDispatcherHostNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- var reply *string
- result := dspSrv.ReplicatorSv1SetDispatcherHost(nil, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveThresholdNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveThreshold(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestReplicatorSv1RemoveThresholdErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveThreshold(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveDestinationNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveDestination(nil, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveDestinationNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.StringWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveDestination(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestReplicatorSv1RemoveDestinationErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.StringWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveDestination(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetLoadIDsNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.LoadIDsWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ReplicatorSv1SetLoadIDs(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetLoadIDsErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.LoadIDsWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ReplicatorSv1SetLoadIDs(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetLoadIDsNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- var reply *string
- result := dspSrv.ReplicatorSv1SetLoadIDs(nil, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveAccountNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.StringWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveAccount(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveAccountErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.StringWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveAccount(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveAccountNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveAccount(nil, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveStatQueueNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveStatQueue(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveStatQueueErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveStatQueue(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveStatQueueNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveStatQueue(nil, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveThresholdNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveThreshold(nil, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveFilterNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveFilter(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveFilterErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveFilter(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveFilterNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveFilter(nil, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveThresholdProfileNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveThresholdProfile(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveThresholdProfileErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveThresholdProfile(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveThresholdProfileNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveThresholdProfile(nil, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveStatQueueProfileNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveStatQueueProfile(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveStatQueueProfileErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveStatQueueProfile(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveStatQueueProfileNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveStatQueueProfile(nil, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveResourceNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveResource(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveResourceErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveResource(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveResourceNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveResource(nil, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveResourceProfileNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveResourceProfile(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveResourceProfileErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveResourceProfile(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveResourceProfileNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveResourceProfile(nil, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveTimingNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.StringWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveTiming(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveTimingErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.StringWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveTiming(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveTimingNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveTiming(nil, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveActionTriggersNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.StringWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveActionTriggers(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveActionTriggersErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.StringWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveActionTriggers(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveActionTriggersNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveActionTriggers(nil, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveSharedGroupNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.StringWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveSharedGroup(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveSharedGroupErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.StringWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveSharedGroup(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveSharedGroupNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveSharedGroup(nil, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveActionsNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.StringWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveActions(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveActionsErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.StringWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveActions(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveActionsEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveActions(nil, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveActionPlanNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.StringWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveActionPlan(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveActionPlanErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.StringWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveActionPlan(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveActionPlanNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveActionPlan(nil, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-func TestDspReplicatorSv1RemAccountActionPlansNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &engine.RemAccountActionPlansArgsWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ReplicatorSv1RemAccountActionPlans(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemAccountActionPlansErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &engine.RemAccountActionPlansArgsWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ReplicatorSv1RemAccountActionPlans(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemAccountActionPlansNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- var reply *string
- result := dspSrv.ReplicatorSv1RemAccountActionPlans(nil, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveRatingPlanNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.StringWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveRatingPlan(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveRatingPlanErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.StringWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveRatingPlan(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveRatingPlanNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveRatingPlan(nil, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveRatingProfileNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.StringWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveRatingProfile(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveRatingProfileErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.StringWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveRatingProfile(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveRatingProfileNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveRatingProfile(nil, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveRouteProfileNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveRouteProfile(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveRouteProfileErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveRouteProfile(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveRouteProfileNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveRouteProfile(nil, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveAttributeProfileNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveAttributeProfile(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveAttributeProfileErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveAttributeProfile(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveAttributeProfileNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveAttributeProfile(nil, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveChargerProfileNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveChargerProfile(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveChargerProfileErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveChargerProfile(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveChargerProfileNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveChargerProfile(nil, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveDispatcherHostNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveDispatcherHost(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveDispatcherHostErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveDispatcherHost(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveDispatcherHostNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveDispatcherHost(nil, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveDispatcherProfileNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveDispatcherProfile(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveDispatcherProfileErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveDispatcherProfile(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveDispatcherProfileNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveDispatcherProfile(nil, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetIndexesNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.GetIndexesArg{
- Tenant: "tenant",
- }
- var reply *map[string]utils.StringSet
- result := dspSrv.ReplicatorSv1GetIndexes(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetIndexesErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.GetIndexesArg{
- Tenant: "tenant",
- }
- var reply *map[string]utils.StringSet
- result := dspSrv.ReplicatorSv1GetIndexes(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1GetIndexesNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- var reply *map[string]utils.StringSet
- result := dspSrv.ReplicatorSv1GetIndexes(nil, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetIndexesNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.SetIndexesArg{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ReplicatorSv1SetIndexes(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetIndexesErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.SetIndexesArg{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ReplicatorSv1SetIndexes(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1SetIndexesNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- var reply *string
- result := dspSrv.ReplicatorSv1SetIndexes(nil, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveIndexesNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.GetIndexesArg{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveIndexes(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveIndexesErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.GetIndexesArg{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveIndexes(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspReplicatorSv1RemoveIndexesNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- var reply *string
- result := dspSrv.ReplicatorSv1RemoveIndexes(nil, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
diff --git a/dispatchers/replicator_test.go b/dispatchers/replicator_test.go
new file mode 100644
index 000000000..dbf2b85a3
--- /dev/null
+++ b/dispatchers/replicator_test.go
@@ -0,0 +1,3070 @@
+/*
+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
+*/
+
+package dispatchers
+
+import (
+ "testing"
+
+ "github.com/cgrates/cgrates/config"
+ "github.com/cgrates/cgrates/engine"
+ "github.com/cgrates/cgrates/utils"
+)
+
+func TestDspReplicatorSv1PingNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ var reply *string
+ result := dspSrv.ReplicatorSv1Ping(nil, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1PingNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.CGREvent{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1Ping(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1PingErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.CGREvent{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1Ping(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetAccountNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ var reply *engine.Account
+ result := dspSrv.ReplicatorSv1GetAccount(nil, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetAccountNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.StringWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *engine.Account
+ result := dspSrv.ReplicatorSv1GetAccount(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetAccountErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.StringWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *engine.Account
+ result := dspSrv.ReplicatorSv1GetAccount(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetDestinationNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+
+ var reply *engine.Destination
+ result := dspSrv.ReplicatorSv1GetDestination(nil, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetDestinationNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.StringWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *engine.Destination
+ result := dspSrv.ReplicatorSv1GetDestination(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetDestinationErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.StringWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *engine.Destination
+ result := dspSrv.ReplicatorSv1GetDestination(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetReverseDestinationNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ var reply *[]string
+ result := dspSrv.ReplicatorSv1GetReverseDestination(nil, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetReverseDestinationNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.StringWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *[]string
+ result := dspSrv.ReplicatorSv1GetReverseDestination(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetReverseDestinationErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.StringWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *[]string
+ result := dspSrv.ReplicatorSv1GetReverseDestination(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetStatQueueNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *engine.StatQueue
+ result := dspSrv.ReplicatorSv1GetStatQueue(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetStatQueueErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *engine.StatQueue
+ result := dspSrv.ReplicatorSv1GetStatQueue(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetFilterNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *engine.Filter
+ result := dspSrv.ReplicatorSv1GetFilter(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetFilterErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *engine.Filter
+ result := dspSrv.ReplicatorSv1GetFilter(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetThresholdNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *engine.Threshold
+ result := dspSrv.ReplicatorSv1GetThreshold(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetThresholdErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *engine.Threshold
+ result := dspSrv.ReplicatorSv1GetThreshold(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetThresholdProfileNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *engine.ThresholdProfile
+ result := dspSrv.ReplicatorSv1GetThresholdProfile(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetThresholdProfileErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *engine.ThresholdProfile
+ result := dspSrv.ReplicatorSv1GetThresholdProfile(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetStatQueueProfileNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *engine.StatQueueProfile
+ result := dspSrv.ReplicatorSv1GetStatQueueProfile(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetStatQueueProfileErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *engine.StatQueueProfile
+ result := dspSrv.ReplicatorSv1GetStatQueueProfile(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetTimingNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ var reply *utils.TPTiming
+ result := dspSrv.ReplicatorSv1GetTiming(nil, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetTimingNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.StringWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *utils.TPTiming
+ result := dspSrv.ReplicatorSv1GetTiming(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetTimingErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.StringWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *utils.TPTiming
+ result := dspSrv.ReplicatorSv1GetTiming(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetResourceNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *engine.Resource
+ result := dspSrv.ReplicatorSv1GetResource(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetResourceErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *engine.Resource
+ result := dspSrv.ReplicatorSv1GetResource(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetResourceProfileReplicatorSv1GetResourceProfileNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *engine.ResourceProfile
+ result := dspSrv.ReplicatorSv1GetResourceProfile(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetResourceProfileErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *engine.ResourceProfile
+ result := dspSrv.ReplicatorSv1GetResourceProfile(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetActionTriggersNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ var reply *engine.ActionTriggers
+ result := dspSrv.ReplicatorSv1GetActionTriggers(nil, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetActionTriggersNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.StringWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *engine.ActionTriggers
+ result := dspSrv.ReplicatorSv1GetActionTriggers(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetActionTriggersErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.StringWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *engine.ActionTriggers
+ result := dspSrv.ReplicatorSv1GetActionTriggers(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetSharedGroupNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ var reply *engine.SharedGroup
+ result := dspSrv.ReplicatorSv1GetSharedGroup(nil, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetSharedGroupNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.StringWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *engine.SharedGroup
+ result := dspSrv.ReplicatorSv1GetSharedGroup(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetSharedGroupErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.StringWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *engine.SharedGroup
+ result := dspSrv.ReplicatorSv1GetSharedGroup(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetActionsNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ var reply *engine.Actions
+ result := dspSrv.ReplicatorSv1GetActions(nil, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetActionsNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.StringWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *engine.Actions
+ result := dspSrv.ReplicatorSv1GetActions(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetActionsErrorNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ var reply *engine.Actions
+ result := dspSrv.ReplicatorSv1GetActions(nil, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetActionsErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.StringWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *engine.Actions
+ result := dspSrv.ReplicatorSv1GetActions(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetActionPlanNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.StringWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *engine.ActionPlan
+ result := dspSrv.ReplicatorSv1GetActionPlan(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetActionPlanErrorNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ var reply *engine.ActionPlan
+ result := dspSrv.ReplicatorSv1GetActionPlan(nil, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetActionPlanErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.StringWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *engine.ActionPlan
+ result := dspSrv.ReplicatorSv1GetActionPlan(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetAllActionPlansNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ var reply *map[string]*engine.ActionPlan
+ result := dspSrv.ReplicatorSv1GetAllActionPlans(nil, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetAllActionPlansNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.StringWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *map[string]*engine.ActionPlan
+ result := dspSrv.ReplicatorSv1GetAllActionPlans(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetAllActionPlansErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.StringWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *map[string]*engine.ActionPlan
+ result := dspSrv.ReplicatorSv1GetAllActionPlans(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetAccountActionPlansNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ var reply *[]string
+ result := dspSrv.ReplicatorSv1GetAccountActionPlans(nil, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetAccountActionPlansNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.StringWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *[]string
+ result := dspSrv.ReplicatorSv1GetAccountActionPlans(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetAccountActionPlansErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.StringWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *[]string
+ result := dspSrv.ReplicatorSv1GetAccountActionPlans(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetRatingPlanNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+
+ var reply *engine.RatingPlan
+ result := dspSrv.ReplicatorSv1GetRatingPlan(nil, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetRatingPlanNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.StringWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *engine.RatingPlan
+ result := dspSrv.ReplicatorSv1GetRatingPlan(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetRatingPlanErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.StringWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *engine.RatingPlan
+ result := dspSrv.ReplicatorSv1GetRatingPlan(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetRatingProfileNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ var reply *engine.RatingProfile
+ result := dspSrv.ReplicatorSv1GetRatingProfile(nil, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetRatingProfileNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.StringWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *engine.RatingProfile
+ result := dspSrv.ReplicatorSv1GetRatingProfile(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetRatingProfileErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.StringWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *engine.RatingProfile
+ result := dspSrv.ReplicatorSv1GetRatingProfile(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetRouteProfileNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *engine.RouteProfile
+ result := dspSrv.ReplicatorSv1GetRouteProfile(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetRouteProfileErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *engine.RouteProfile
+ result := dspSrv.ReplicatorSv1GetRouteProfile(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetAttributeProfileNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *engine.AttributeProfile
+ result := dspSrv.ReplicatorSv1GetAttributeProfile(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetAttributeProfileErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *engine.AttributeProfile
+ result := dspSrv.ReplicatorSv1GetAttributeProfile(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetChargerProfileNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *engine.ChargerProfile
+ result := dspSrv.ReplicatorSv1GetChargerProfile(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetChargerProfileErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *engine.ChargerProfile
+ result := dspSrv.ReplicatorSv1GetChargerProfile(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetDispatcherProfileNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *engine.DispatcherProfile
+ result := dspSrv.ReplicatorSv1GetDispatcherProfile(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetDispatcherProfileErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *engine.DispatcherProfile
+ result := dspSrv.ReplicatorSv1GetDispatcherProfile(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetDispatcherHostNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *engine.DispatcherHost
+ result := dspSrv.ReplicatorSv1GetDispatcherHost(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetDispatcherHostErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *engine.DispatcherHost
+ result := dspSrv.ReplicatorSv1GetDispatcherHost(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetItemLoadIDsNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ var reply *map[string]int64
+ result := dspSrv.ReplicatorSv1GetItemLoadIDs(nil, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetItemLoadIDsNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.StringWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *map[string]int64
+ result := dspSrv.ReplicatorSv1GetItemLoadIDs(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetItemLoadIDsErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.StringWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *map[string]int64
+ result := dspSrv.ReplicatorSv1GetItemLoadIDs(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetThresholdProfileNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &engine.ThresholdProfileWithAPIOpts{
+ ThresholdProfile: &engine.ThresholdProfile{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetThresholdProfile(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetThresholdProfileErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &engine.ThresholdProfileWithAPIOpts{
+ ThresholdProfile: &engine.ThresholdProfile{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetThresholdProfile(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetThresholdProfileNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetThresholdProfile(nil, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetThresholdNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &engine.ThresholdWithAPIOpts{
+ Threshold: &engine.Threshold{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetThreshold(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetThresholdErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &engine.ThresholdWithAPIOpts{
+ Threshold: &engine.Threshold{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetThreshold(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetThresholdNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetThreshold(nil, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetDestinationNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &engine.DestinationWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetDestination(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetDestinationErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &engine.DestinationWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetDestination(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetDestinationNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetDestination(nil, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetAccountNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &engine.AccountWithAPIOpts{
+ Account: &engine.Account{},
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetAccount(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetAccountErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &engine.AccountWithAPIOpts{
+ Account: &engine.Account{
+ ID: "testID",
+ },
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetAccount(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetAccountNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetAccount(nil, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetReverseDestinationNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &engine.DestinationWithAPIOpts{
+ Destination: &engine.Destination{
+ Id: "testID",
+ },
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetReverseDestination(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetReverseDestinationErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &engine.DestinationWithAPIOpts{
+ Destination: &engine.Destination{
+ Id: "testID",
+ },
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetReverseDestination(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetReverseDestinationNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetReverseDestination(nil, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetStatQueueNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &engine.StatQueueWithAPIOpts{
+ StatQueue: &engine.StatQueue{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetStatQueue(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetStatQueueErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &engine.StatQueueWithAPIOpts{
+ StatQueue: &engine.StatQueue{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetStatQueue(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetStatQueueNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetStatQueue(nil, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetFilterNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &engine.FilterWithAPIOpts{
+ Filter: &engine.Filter{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetFilter(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetFilterErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &engine.FilterWithAPIOpts{
+ Filter: &engine.Filter{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetFilter(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetFilterNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetFilter(nil, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetStatQueueProfileNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &engine.StatQueueProfileWithAPIOpts{
+ StatQueueProfile: &engine.StatQueueProfile{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetStatQueueProfile(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetStatQueueProfileErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &engine.StatQueueProfileWithAPIOpts{
+ StatQueueProfile: &engine.StatQueueProfile{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetStatQueueProfile(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetStatQueueProfileNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetStatQueueProfile(nil, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetTimingNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.TPTimingWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetTiming(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetTimingErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.TPTimingWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetTiming(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetTimingNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetTiming(nil, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetResourceNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &engine.ResourceWithAPIOpts{
+ Resource: &engine.Resource{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetResource(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetResourceErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &engine.ResourceWithAPIOpts{
+ Resource: &engine.Resource{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetResource(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetResourceNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetResource(nil, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetResourceProfileNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &engine.ResourceProfileWithAPIOpts{
+ ResourceProfile: &engine.ResourceProfile{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetResourceProfile(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestReplicatorSv1SetResourceProfileErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &engine.ResourceProfileWithAPIOpts{
+ ResourceProfile: &engine.ResourceProfile{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetResourceProfile(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetResourceProfileNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetResourceProfile(nil, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetSharedGroupNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &engine.SharedGroupWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetSharedGroup(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestReplicatorSv1SetSharedGroupErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &engine.SharedGroupWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetSharedGroup(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetSharedGroupNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetSharedGroup(nil, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetActionsNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &engine.SetActionsArgsWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetActions(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestReplicatorSv1SetActionsErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &engine.SetActionsArgsWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetActions(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetActionsNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetActions(nil, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetRatingProfileNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &engine.RatingProfileWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetRatingProfile(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestReplicatorSv1SetRatingProfileErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &engine.RatingProfileWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetRatingProfile(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetRatingProfileNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetRatingProfile(nil, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetRatingPlanNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &engine.RatingPlanWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetRatingPlan(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetRatingPlanErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &engine.RatingPlanWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetRatingPlan(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetRatingPlanNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetRatingPlan(nil, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetActionTriggersNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &engine.SetActionTriggersArgWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetActionTriggers(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetActionTriggersErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &engine.SetActionTriggersArgWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetActionTriggers(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetActionTriggersNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetActionTriggers(nil, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetRouteProfileNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &engine.RouteProfileWithAPIOpts{
+ RouteProfile: &engine.RouteProfile{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetRouteProfile(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetRouteProfileErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &engine.RouteProfileWithAPIOpts{
+ RouteProfile: &engine.RouteProfile{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetRouteProfile(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetRouteProfileNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetRouteProfile(nil, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetAttributeProfileNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &engine.AttributeProfileWithAPIOpts{
+ AttributeProfile: &engine.AttributeProfile{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetAttributeProfile(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetAttributeProfileErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &engine.AttributeProfileWithAPIOpts{
+ AttributeProfile: &engine.AttributeProfile{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetAttributeProfile(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetAttributeProfileNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetAttributeProfile(nil, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetChargerProfileNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &engine.ChargerProfileWithAPIOpts{
+ ChargerProfile: &engine.ChargerProfile{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetChargerProfile(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetChargerProfileErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &engine.ChargerProfileWithAPIOpts{
+ ChargerProfile: &engine.ChargerProfile{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetChargerProfile(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetChargerProfileNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetChargerProfile(nil, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetDispatcherProfileNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &engine.DispatcherProfileWithAPIOpts{
+ DispatcherProfile: &engine.DispatcherProfile{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetDispatcherProfile(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetDispatcherProfileErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &engine.DispatcherProfileWithAPIOpts{
+ DispatcherProfile: &engine.DispatcherProfile{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetDispatcherProfile(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetDispatcherProfileNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetDispatcherProfile(nil, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetActionPlanNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &engine.SetActionPlanArgWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetActionPlan(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetActionPlanErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &engine.SetActionPlanArgWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetActionPlan(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetActionPlanNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetActionPlan(nil, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetAccountActionPlansNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &engine.SetAccountActionPlansArgWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetAccountActionPlans(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetAccountActionPlansErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &engine.SetAccountActionPlansArgWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetAccountActionPlans(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetAccountActionPlansNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetAccountActionPlans(nil, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetDispatcherHostNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &engine.DispatcherHostWithAPIOpts{
+ DispatcherHost: &engine.DispatcherHost{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetDispatcherHost(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestReplicatorSv1SetDispatcherHostErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &engine.DispatcherHostWithAPIOpts{
+ DispatcherHost: &engine.DispatcherHost{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetDispatcherHost(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetDispatcherHostNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetDispatcherHost(nil, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveThresholdNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveThreshold(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestReplicatorSv1RemoveThresholdErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveThreshold(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveDestinationNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveDestination(nil, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveDestinationNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.StringWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveDestination(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestReplicatorSv1RemoveDestinationErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.StringWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveDestination(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetLoadIDsNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.LoadIDsWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetLoadIDs(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetLoadIDsErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.LoadIDsWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetLoadIDs(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetLoadIDsNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetLoadIDs(nil, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveAccountNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.StringWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveAccount(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveAccountErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.StringWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveAccount(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveAccountNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveAccount(nil, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveStatQueueNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveStatQueue(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveStatQueueErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveStatQueue(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveStatQueueNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveStatQueue(nil, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveThresholdNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveThreshold(nil, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveFilterNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveFilter(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveFilterErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveFilter(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveFilterNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveFilter(nil, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveThresholdProfileNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveThresholdProfile(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveThresholdProfileErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveThresholdProfile(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveThresholdProfileNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveThresholdProfile(nil, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveStatQueueProfileNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveStatQueueProfile(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveStatQueueProfileErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveStatQueueProfile(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveStatQueueProfileNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveStatQueueProfile(nil, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveResourceNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveResource(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveResourceErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveResource(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveResourceNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveResource(nil, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveResourceProfileNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveResourceProfile(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveResourceProfileErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveResourceProfile(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveResourceProfileNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveResourceProfile(nil, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveTimingNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.StringWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveTiming(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveTimingErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.StringWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveTiming(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveTimingNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveTiming(nil, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveActionTriggersNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.StringWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveActionTriggers(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveActionTriggersErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.StringWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveActionTriggers(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveActionTriggersNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveActionTriggers(nil, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveSharedGroupNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.StringWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveSharedGroup(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveSharedGroupErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.StringWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveSharedGroup(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveSharedGroupNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveSharedGroup(nil, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveActionsNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.StringWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveActions(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveActionsErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.StringWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveActions(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveActionsEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveActions(nil, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveActionPlanNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.StringWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveActionPlan(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveActionPlanErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.StringWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveActionPlan(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveActionPlanNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveActionPlan(nil, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+func TestDspReplicatorSv1RemAccountActionPlansNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &engine.RemAccountActionPlansArgsWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemAccountActionPlans(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemAccountActionPlansErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &engine.RemAccountActionPlansArgsWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemAccountActionPlans(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemAccountActionPlansNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemAccountActionPlans(nil, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveRatingPlanNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.StringWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveRatingPlan(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveRatingPlanErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.StringWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveRatingPlan(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveRatingPlanNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveRatingPlan(nil, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveRatingProfileNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.StringWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveRatingProfile(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveRatingProfileErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.StringWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveRatingProfile(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveRatingProfileNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveRatingProfile(nil, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveRouteProfileNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveRouteProfile(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveRouteProfileErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveRouteProfile(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveRouteProfileNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveRouteProfile(nil, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveAttributeProfileNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveAttributeProfile(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveAttributeProfileErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveAttributeProfile(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveAttributeProfileNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveAttributeProfile(nil, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveChargerProfileNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveChargerProfile(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveChargerProfileErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveChargerProfile(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveChargerProfileNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveChargerProfile(nil, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveDispatcherHostNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveDispatcherHost(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveDispatcherHostErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveDispatcherHost(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveDispatcherHostNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveDispatcherHost(nil, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveDispatcherProfileNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveDispatcherProfile(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveDispatcherProfileErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveDispatcherProfile(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveDispatcherProfileNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveDispatcherProfile(nil, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetIndexesNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.GetIndexesArg{
+ Tenant: "tenant",
+ }
+ var reply *map[string]utils.StringSet
+ result := dspSrv.ReplicatorSv1GetIndexes(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetIndexesErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.GetIndexesArg{
+ Tenant: "tenant",
+ }
+ var reply *map[string]utils.StringSet
+ result := dspSrv.ReplicatorSv1GetIndexes(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1GetIndexesNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ var reply *map[string]utils.StringSet
+ result := dspSrv.ReplicatorSv1GetIndexes(nil, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetIndexesNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.SetIndexesArg{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetIndexes(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetIndexesErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.SetIndexesArg{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetIndexes(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1SetIndexesNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ var reply *string
+ result := dspSrv.ReplicatorSv1SetIndexes(nil, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveIndexesNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.GetIndexesArg{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveIndexes(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveIndexesErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.GetIndexesArg{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveIndexes(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspReplicatorSv1RemoveIndexesNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ var reply *string
+ result := dspSrv.ReplicatorSv1RemoveIndexes(nil, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
diff --git a/dispatchers/resources_it_test.go b/dispatchers/resources_it_test.go
index 69bf56a1e..e5fe1dbbe 100644
--- a/dispatchers/resources_it_test.go
+++ b/dispatchers/resources_it_test.go
@@ -24,8 +24,6 @@ import (
"reflect"
"testing"
- "github.com/cgrates/cgrates/config"
-
"github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
@@ -319,242 +317,3 @@ func testDspResTestAuthKey3(t *testing.T) {
}
}
-
-func TestDspResourceSv1PingNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- var reply *string
- result := dspSrv.ResourceSv1Ping(nil, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspResourceSv1PingNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.CGREvent{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ResourceSv1Ping(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspResourceSv1PingErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.CGREvent{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ResourceSv1Ping(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspResourceSv1GetResourcesForEventNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := utils.ArgRSv1ResourceUsage{
- CGREvent: &utils.CGREvent{
- Tenant: "tenant",
- },
- }
- var reply *engine.Resources
- result := dspSrv.ResourceSv1GetResourcesForEvent(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspResourceSv1GetResourcesForEventErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := utils.ArgRSv1ResourceUsage{
- CGREvent: &utils.CGREvent{
- Tenant: "tenant",
- },
- }
- var reply *engine.Resources
- result := dspSrv.ResourceSv1GetResourcesForEvent(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspResourceSv1AuthorizeResourcesNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := utils.ArgRSv1ResourceUsage{
- CGREvent: &utils.CGREvent{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.ResourceSv1AuthorizeResources(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspResourceSv1AuthorizeResourcesErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := utils.ArgRSv1ResourceUsage{
- CGREvent: &utils.CGREvent{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.ResourceSv1AuthorizeResources(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspResourceSv1ReleaseResourcesNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := utils.ArgRSv1ResourceUsage{
- CGREvent: &utils.CGREvent{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.ResourceSv1ReleaseResources(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspResourceSv1ReleaseResourcesErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := utils.ArgRSv1ResourceUsage{
- CGREvent: &utils.CGREvent{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.ResourceSv1ReleaseResources(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspResourceSv1GetResourceNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *engine.Resource
- result := dspSrv.ResourceSv1GetResource(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspResourceSv1GetResourceErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *engine.Resource
- result := dspSrv.ResourceSv1GetResource(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspResourceSv1AllocateResourcesNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := utils.ArgRSv1ResourceUsage{
- CGREvent: &utils.CGREvent{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.ResourceSv1AllocateResources(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspResourceSv1AllocateResourcesErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := utils.ArgRSv1ResourceUsage{
- CGREvent: &utils.CGREvent{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.ResourceSv1AllocateResources(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspResourceSv1GetResourceWithConfigNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *engine.ResourceWithConfig
- result := dspSrv.ResourceSv1GetResourceWithConfig(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspResourceSv1GetResourceWithConfigErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *engine.ResourceWithConfig
- result := dspSrv.ResourceSv1GetResourceWithConfig(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
diff --git a/dispatchers/resources_test.go b/dispatchers/resources_test.go
new file mode 100644
index 000000000..e73a719fc
--- /dev/null
+++ b/dispatchers/resources_test.go
@@ -0,0 +1,266 @@
+/*
+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
+*/
+
+package dispatchers
+
+import (
+ "testing"
+
+ "github.com/cgrates/cgrates/config"
+ "github.com/cgrates/cgrates/engine"
+ "github.com/cgrates/cgrates/utils"
+)
+
+func TestDspResourceSv1PingNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ var reply *string
+ result := dspSrv.ResourceSv1Ping(nil, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspResourceSv1PingNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.CGREvent{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ResourceSv1Ping(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspResourceSv1PingErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.CGREvent{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ResourceSv1Ping(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspResourceSv1GetResourcesForEventNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := utils.ArgRSv1ResourceUsage{
+ CGREvent: &utils.CGREvent{
+ Tenant: "tenant",
+ },
+ }
+ var reply *engine.Resources
+ result := dspSrv.ResourceSv1GetResourcesForEvent(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspResourceSv1GetResourcesForEventErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := utils.ArgRSv1ResourceUsage{
+ CGREvent: &utils.CGREvent{
+ Tenant: "tenant",
+ },
+ }
+ var reply *engine.Resources
+ result := dspSrv.ResourceSv1GetResourcesForEvent(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspResourceSv1AuthorizeResourcesNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := utils.ArgRSv1ResourceUsage{
+ CGREvent: &utils.CGREvent{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.ResourceSv1AuthorizeResources(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspResourceSv1AuthorizeResourcesErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := utils.ArgRSv1ResourceUsage{
+ CGREvent: &utils.CGREvent{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.ResourceSv1AuthorizeResources(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspResourceSv1ReleaseResourcesNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := utils.ArgRSv1ResourceUsage{
+ CGREvent: &utils.CGREvent{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.ResourceSv1ReleaseResources(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspResourceSv1ReleaseResourcesErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := utils.ArgRSv1ResourceUsage{
+ CGREvent: &utils.CGREvent{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.ResourceSv1ReleaseResources(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspResourceSv1GetResourceNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *engine.Resource
+ result := dspSrv.ResourceSv1GetResource(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspResourceSv1GetResourceErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *engine.Resource
+ result := dspSrv.ResourceSv1GetResource(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspResourceSv1AllocateResourcesNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := utils.ArgRSv1ResourceUsage{
+ CGREvent: &utils.CGREvent{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.ResourceSv1AllocateResources(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspResourceSv1AllocateResourcesErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := utils.ArgRSv1ResourceUsage{
+ CGREvent: &utils.CGREvent{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.ResourceSv1AllocateResources(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspResourceSv1GetResourceWithConfigNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *engine.ResourceWithConfig
+ result := dspSrv.ResourceSv1GetResourceWithConfig(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspResourceSv1GetResourceWithConfigErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *engine.ResourceWithConfig
+ result := dspSrv.ResourceSv1GetResourceWithConfig(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
diff --git a/dispatchers/responder_it_test.go b/dispatchers/responder_it_test.go
index a1ec4608c..7aa6d6948 100644
--- a/dispatchers/responder_it_test.go
+++ b/dispatchers/responder_it_test.go
@@ -25,10 +25,6 @@ import (
"testing"
"time"
- "github.com/cgrates/cgrates/engine"
-
- "github.com/cgrates/cgrates/config"
-
"github.com/cgrates/cgrates/utils"
"github.com/cgrates/rpcclient"
)
@@ -242,271 +238,3 @@ func testDspResponderInternal(t *testing.T) {
t.Errorf("Expected: DispatcherS1 , received: %s", strRply)
}
}
-
-func TestDspResponderPingEventNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- var reply *string
- result := dspSrv.ResponderPing(nil, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspResponderPingEventNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.CGREvent{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ResponderPing(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspResponderPingErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.CGREvent{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ResponderPing(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspResponderDebitNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &engine.CallDescriptorWithAPIOpts{
- CallDescriptor: &engine.CallDescriptor{
- Tenant: "tenant",
- },
- }
- var reply *engine.CallCost
- result := dspSrv.ResponderDebit(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspResponderDebitErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &engine.CallDescriptorWithAPIOpts{
- CallDescriptor: &engine.CallDescriptor{
- Tenant: "tenant",
- },
- }
- var reply *engine.CallCost
- result := dspSrv.ResponderDebit(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspResponderGetCostNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &engine.CallDescriptorWithAPIOpts{
- CallDescriptor: &engine.CallDescriptor{
- Tenant: "tenant",
- },
- }
- var reply *engine.CallCost
- result := dspSrv.ResponderGetCost(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspResponderGetCostErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &engine.CallDescriptorWithAPIOpts{
- CallDescriptor: &engine.CallDescriptor{
- Tenant: "tenant",
- },
- }
- var reply *engine.CallCost
- result := dspSrv.ResponderGetCost(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspResponderMaxDebitNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &engine.CallDescriptorWithAPIOpts{
- CallDescriptor: &engine.CallDescriptor{
- Tenant: "tenant",
- },
- }
- var reply *engine.CallCost
- result := dspSrv.ResponderMaxDebit(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspResponderMaxDebitErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &engine.CallDescriptorWithAPIOpts{
- CallDescriptor: &engine.CallDescriptor{
- Tenant: "tenant",
- },
- }
- var reply *engine.CallCost
- result := dspSrv.ResponderMaxDebit(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspResponderRefundIncrementsNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &engine.CallDescriptorWithAPIOpts{
- CallDescriptor: &engine.CallDescriptor{
- Tenant: "tenant",
- },
- }
- var reply *engine.Account
- result := dspSrv.ResponderRefundIncrements(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspResponderRefundIncrementsErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &engine.CallDescriptorWithAPIOpts{
- CallDescriptor: &engine.CallDescriptor{
- Tenant: "tenant",
- },
- }
- var reply *engine.Account
- result := dspSrv.ResponderRefundIncrements(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspResponderRefundRoundingNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &engine.CallDescriptorWithAPIOpts{
- CallDescriptor: &engine.CallDescriptor{
- Tenant: "tenant",
- },
- }
- var reply *float64
- result := dspSrv.ResponderRefundRounding(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspResponderRefundRoundingErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &engine.CallDescriptorWithAPIOpts{
- CallDescriptor: &engine.CallDescriptor{
- Tenant: "tenant",
- },
- }
- var reply *float64
- result := dspSrv.ResponderRefundRounding(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspResponderGetMaxSessionTimeNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &engine.CallDescriptorWithAPIOpts{
- CallDescriptor: &engine.CallDescriptor{
- Tenant: "tenant",
- },
- }
- var reply *time.Duration
- result := dspSrv.ResponderGetMaxSessionTime(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspResponderGetMaxSessionTimeErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &engine.CallDescriptorWithAPIOpts{
- CallDescriptor: &engine.CallDescriptor{
- Tenant: "tenant",
- },
- }
- var reply *time.Duration
- result := dspSrv.ResponderGetMaxSessionTime(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspResponderShutdownNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.TenantWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ResponderShutdown(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspResponderShutdownErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.TenantWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ResponderShutdown(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
diff --git a/dispatchers/responder_test.go b/dispatchers/responder_test.go
new file mode 100644
index 000000000..f4baa4218
--- /dev/null
+++ b/dispatchers/responder_test.go
@@ -0,0 +1,296 @@
+/*
+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
+*/
+
+package dispatchers
+
+import (
+ "testing"
+ "time"
+
+ "github.com/cgrates/cgrates/config"
+ "github.com/cgrates/cgrates/engine"
+ "github.com/cgrates/cgrates/utils"
+)
+
+func TestDspResponderPingEventNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ var reply *string
+ result := dspSrv.ResponderPing(nil, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspResponderPingEventNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.CGREvent{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ResponderPing(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspResponderPingErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.CGREvent{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ResponderPing(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspResponderDebitNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &engine.CallDescriptorWithAPIOpts{
+ CallDescriptor: &engine.CallDescriptor{
+ Tenant: "tenant",
+ },
+ }
+ var reply *engine.CallCost
+ result := dspSrv.ResponderDebit(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspResponderDebitErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &engine.CallDescriptorWithAPIOpts{
+ CallDescriptor: &engine.CallDescriptor{
+ Tenant: "tenant",
+ },
+ }
+ var reply *engine.CallCost
+ result := dspSrv.ResponderDebit(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspResponderGetCostNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &engine.CallDescriptorWithAPIOpts{
+ CallDescriptor: &engine.CallDescriptor{
+ Tenant: "tenant",
+ },
+ }
+ var reply *engine.CallCost
+ result := dspSrv.ResponderGetCost(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspResponderGetCostErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &engine.CallDescriptorWithAPIOpts{
+ CallDescriptor: &engine.CallDescriptor{
+ Tenant: "tenant",
+ },
+ }
+ var reply *engine.CallCost
+ result := dspSrv.ResponderGetCost(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspResponderMaxDebitNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &engine.CallDescriptorWithAPIOpts{
+ CallDescriptor: &engine.CallDescriptor{
+ Tenant: "tenant",
+ },
+ }
+ var reply *engine.CallCost
+ result := dspSrv.ResponderMaxDebit(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspResponderMaxDebitErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &engine.CallDescriptorWithAPIOpts{
+ CallDescriptor: &engine.CallDescriptor{
+ Tenant: "tenant",
+ },
+ }
+ var reply *engine.CallCost
+ result := dspSrv.ResponderMaxDebit(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspResponderRefundIncrementsNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &engine.CallDescriptorWithAPIOpts{
+ CallDescriptor: &engine.CallDescriptor{
+ Tenant: "tenant",
+ },
+ }
+ var reply *engine.Account
+ result := dspSrv.ResponderRefundIncrements(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspResponderRefundIncrementsErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &engine.CallDescriptorWithAPIOpts{
+ CallDescriptor: &engine.CallDescriptor{
+ Tenant: "tenant",
+ },
+ }
+ var reply *engine.Account
+ result := dspSrv.ResponderRefundIncrements(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspResponderRefundRoundingNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &engine.CallDescriptorWithAPIOpts{
+ CallDescriptor: &engine.CallDescriptor{
+ Tenant: "tenant",
+ },
+ }
+ var reply *float64
+ result := dspSrv.ResponderRefundRounding(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspResponderRefundRoundingErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &engine.CallDescriptorWithAPIOpts{
+ CallDescriptor: &engine.CallDescriptor{
+ Tenant: "tenant",
+ },
+ }
+ var reply *float64
+ result := dspSrv.ResponderRefundRounding(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspResponderGetMaxSessionTimeNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &engine.CallDescriptorWithAPIOpts{
+ CallDescriptor: &engine.CallDescriptor{
+ Tenant: "tenant",
+ },
+ }
+ var reply *time.Duration
+ result := dspSrv.ResponderGetMaxSessionTime(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspResponderGetMaxSessionTimeErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &engine.CallDescriptorWithAPIOpts{
+ CallDescriptor: &engine.CallDescriptor{
+ Tenant: "tenant",
+ },
+ }
+ var reply *time.Duration
+ result := dspSrv.ResponderGetMaxSessionTime(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspResponderShutdownNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.TenantWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ResponderShutdown(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspResponderShutdownErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.TenantWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ResponderShutdown(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
diff --git a/dispatchers/routes_it_test.go b/dispatchers/routes_it_test.go
index 71167e738..06214dc6f 100644
--- a/dispatchers/routes_it_test.go
+++ b/dispatchers/routes_it_test.go
@@ -26,8 +26,6 @@ import (
"testing"
"time"
- "github.com/cgrates/cgrates/config"
-
"github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
@@ -417,139 +415,3 @@ func testDspSupGetSupplierForEvent(t *testing.T) {
t.Errorf("Expected: %s ,received: %s", utils.ToJSON(expected), utils.ToJSON(supProf))
}
}
-
-func TestDspRouteSv1PingNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- var reply *string
- result := dspSrv.RouteSv1Ping(nil, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspRouteSv1PingNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.CGREvent{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.RouteSv1Ping(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspRouteSv1PingErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.CGREvent{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.RouteSv1Ping(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspRouteSv1GetRoutesNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &engine.ArgsGetRoutes{
- CGREvent: &utils.CGREvent{
- Tenant: "tenant",
- },
- }
- var reply *engine.SortedRoutesList
- result := dspSrv.RouteSv1GetRoutes(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspRouteSv1GetRoutesErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &engine.ArgsGetRoutes{
- CGREvent: &utils.CGREvent{
- Tenant: "tenant",
- },
- }
- var reply *engine.SortedRoutesList
- result := dspSrv.RouteSv1GetRoutes(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspRouteSv1GetRoutesListNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &engine.ArgsGetRoutes{
- CGREvent: &utils.CGREvent{
- Tenant: "tenant",
- },
- }
- var reply *[]string
- result := dspSrv.RouteSv1GetRoutesList(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspRouteSv1GetRoutesListErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &engine.ArgsGetRoutes{
- CGREvent: &utils.CGREvent{
- Tenant: "tenant",
- },
- }
- var reply *[]string
- result := dspSrv.RouteSv1GetRoutesList(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspRouteSv1GetRouteProfilesForEventNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.CGREvent{
- Tenant: "tenant",
- }
- var reply *[]*engine.RouteProfile
- result := dspSrv.RouteSv1GetRouteProfilesForEvent(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspRouteSv1GetRouteProfilesForEventErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.CGREvent{
- Tenant: "tenant",
- }
- var reply *[]*engine.RouteProfile
- result := dspSrv.RouteSv1GetRouteProfilesForEvent(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
diff --git a/dispatchers/routes_test.go b/dispatchers/routes_test.go
new file mode 100644
index 000000000..79423cf0e
--- /dev/null
+++ b/dispatchers/routes_test.go
@@ -0,0 +1,163 @@
+/*
+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
+*/
+
+package dispatchers
+
+import (
+ "testing"
+
+ "github.com/cgrates/cgrates/config"
+ "github.com/cgrates/cgrates/engine"
+ "github.com/cgrates/cgrates/utils"
+)
+
+func TestDspRouteSv1PingNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ var reply *string
+ result := dspSrv.RouteSv1Ping(nil, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspRouteSv1PingNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.CGREvent{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.RouteSv1Ping(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspRouteSv1PingErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.CGREvent{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.RouteSv1Ping(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspRouteSv1GetRoutesNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &engine.ArgsGetRoutes{
+ CGREvent: &utils.CGREvent{
+ Tenant: "tenant",
+ },
+ }
+ var reply *engine.SortedRoutesList
+ result := dspSrv.RouteSv1GetRoutes(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspRouteSv1GetRoutesErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &engine.ArgsGetRoutes{
+ CGREvent: &utils.CGREvent{
+ Tenant: "tenant",
+ },
+ }
+ var reply *engine.SortedRoutesList
+ result := dspSrv.RouteSv1GetRoutes(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspRouteSv1GetRoutesListNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &engine.ArgsGetRoutes{
+ CGREvent: &utils.CGREvent{
+ Tenant: "tenant",
+ },
+ }
+ var reply *[]string
+ result := dspSrv.RouteSv1GetRoutesList(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspRouteSv1GetRoutesListErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &engine.ArgsGetRoutes{
+ CGREvent: &utils.CGREvent{
+ Tenant: "tenant",
+ },
+ }
+ var reply *[]string
+ result := dspSrv.RouteSv1GetRoutesList(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspRouteSv1GetRouteProfilesForEventNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.CGREvent{
+ Tenant: "tenant",
+ }
+ var reply *[]*engine.RouteProfile
+ result := dspSrv.RouteSv1GetRouteProfilesForEvent(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspRouteSv1GetRouteProfilesForEventErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.CGREvent{
+ Tenant: "tenant",
+ }
+ var reply *[]*engine.RouteProfile
+ result := dspSrv.RouteSv1GetRouteProfilesForEvent(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
diff --git a/dispatchers/scheduler_it_test.go b/dispatchers/scheduler_it_test.go
index 215d48a20..85b6f47e5 100644
--- a/dispatchers/scheduler_it_test.go
+++ b/dispatchers/scheduler_it_test.go
@@ -23,8 +23,6 @@ package dispatchers
import (
"testing"
- "github.com/cgrates/cgrates/config"
-
"github.com/cgrates/cgrates/utils"
)
@@ -79,131 +77,3 @@ func testDspSchedPing(t *testing.T) {
t.Errorf("Received: %s", reply)
}
}
-
-func TestDspSchedulerSv1PingErrorNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- var reply *string
- result := dspSrv.SchedulerSv1Ping(nil, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspSchedulerSv1PingErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.CGREvent{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.SchedulerSv1Ping(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspSchedulerSv1PingNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.CGREvent{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.SchedulerSv1Ping(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspSchedulerSv1ReloadErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.CGREvent{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.SchedulerSv1Reload(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspSchedulerSv1ReloadPingNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.CGREvent{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.SchedulerSv1Reload(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspSchedulerSv1ExecuteActionsErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.AttrsExecuteActions{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.SchedulerSv1ExecuteActions(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspSchedulerSv1ExecuteActionsNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.AttrsExecuteActions{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.SchedulerSv1ExecuteActions(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspSchedulerSv1ExecuteActionPlansErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.AttrsExecuteActionPlans{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.SchedulerSv1ExecuteActionPlans(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspSchedulerSv1ExecuteActionPlansNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.AttrsExecuteActionPlans{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.SchedulerSv1ExecuteActionPlans(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
diff --git a/dispatchers/scheduler_test.go b/dispatchers/scheduler_test.go
new file mode 100644
index 000000000..6fbd7a253
--- /dev/null
+++ b/dispatchers/scheduler_test.go
@@ -0,0 +1,154 @@
+/*
+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
+*/
+
+package dispatchers
+
+import (
+ "testing"
+
+ "github.com/cgrates/cgrates/config"
+ "github.com/cgrates/cgrates/utils"
+)
+
+func TestDspSchedulerSv1PingErrorNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ var reply *string
+ result := dspSrv.SchedulerSv1Ping(nil, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspSchedulerSv1PingErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.CGREvent{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.SchedulerSv1Ping(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspSchedulerSv1PingNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.CGREvent{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.SchedulerSv1Ping(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspSchedulerSv1ReloadErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.CGREvent{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.SchedulerSv1Reload(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspSchedulerSv1ReloadPingNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.CGREvent{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.SchedulerSv1Reload(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspSchedulerSv1ExecuteActionsErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.AttrsExecuteActions{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.SchedulerSv1ExecuteActions(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspSchedulerSv1ExecuteActionsNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.AttrsExecuteActions{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.SchedulerSv1ExecuteActions(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspSchedulerSv1ExecuteActionPlansErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.AttrsExecuteActionPlans{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.SchedulerSv1ExecuteActionPlans(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspSchedulerSv1ExecuteActionPlansNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.AttrsExecuteActionPlans{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.SchedulerSv1ExecuteActionPlans(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
diff --git a/dispatchers/servicemanager_it_test.go b/dispatchers/servicemanager_test.go
similarity index 99%
rename from dispatchers/servicemanager_it_test.go
rename to dispatchers/servicemanager_test.go
index c477e9811..4e1828ad4 100644
--- a/dispatchers/servicemanager_it_test.go
+++ b/dispatchers/servicemanager_test.go
@@ -1,5 +1,3 @@
-// +build integration
-
/*
Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
Copyright (C) ITsysCOM GmbH
diff --git a/dispatchers/sessions_it_test.go b/dispatchers/sessions_it_test.go
index 466130c1c..f56f610e0 100644
--- a/dispatchers/sessions_it_test.go
+++ b/dispatchers/sessions_it_test.go
@@ -28,7 +28,6 @@ import (
"testing"
"time"
- "github.com/cgrates/cgrates/config"
"github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/sessions"
"github.com/cgrates/cgrates/utils"
@@ -1054,698 +1053,3 @@ func testDspSessionSTIRIdentity(t *testing.T) {
t.Fatal(err)
}
}
-
-func TestDspSessionSv1PingNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.CGREvent{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.SessionSv1Ping(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspSessionSv1PingErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.CGREvent{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.SessionSv1Ping(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspSessionSv1AuthorizeEventNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &sessions.V1AuthorizeArgs{
- CGREvent: &utils.CGREvent{
- Tenant: "tenant",
- },
- }
- var reply *sessions.V1AuthorizeReply
- result := dspSrv.SessionSv1AuthorizeEvent(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspSessionSv1AuthorizeEventErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &sessions.V1AuthorizeArgs{
- CGREvent: &utils.CGREvent{
- Tenant: "tenant",
- },
- }
- var reply *sessions.V1AuthorizeReply
- result := dspSrv.SessionSv1AuthorizeEvent(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspSessionSv1AuthorizeEventWithDigestNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &sessions.V1AuthorizeArgs{
- CGREvent: &utils.CGREvent{
- Tenant: "tenant",
- },
- }
- var reply *sessions.V1AuthorizeReplyWithDigest
- result := dspSrv.SessionSv1AuthorizeEventWithDigest(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspSessionSv1AuthorizeEventWithDigestErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &sessions.V1AuthorizeArgs{
- CGREvent: &utils.CGREvent{
- Tenant: "tenant",
- },
- }
- var reply *sessions.V1AuthorizeReplyWithDigest
- result := dspSrv.SessionSv1AuthorizeEventWithDigest(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspSessionSv1InitiateSessionNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &sessions.V1InitSessionArgs{
- CGREvent: &utils.CGREvent{
- Tenant: "tenant",
- },
- }
- var reply *sessions.V1InitSessionReply
- result := dspSrv.SessionSv1InitiateSession(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspSessionSv1InitiateSessionErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &sessions.V1InitSessionArgs{
- CGREvent: &utils.CGREvent{
- Tenant: "tenant",
- },
- }
- var reply *sessions.V1InitSessionReply
- result := dspSrv.SessionSv1InitiateSession(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspSessionSv1InitiateSessionWithDigestNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &sessions.V1InitSessionArgs{
- CGREvent: &utils.CGREvent{
- Tenant: "tenant",
- },
- }
- var reply *sessions.V1InitReplyWithDigest
- result := dspSrv.SessionSv1InitiateSessionWithDigest(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspSessionSv1InitiateSessionWithDigestErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &sessions.V1InitSessionArgs{
- CGREvent: &utils.CGREvent{
- Tenant: "tenant",
- },
- }
- var reply *sessions.V1InitReplyWithDigest
- result := dspSrv.SessionSv1InitiateSessionWithDigest(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspSessionSv1UpdateSessionNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &sessions.V1UpdateSessionArgs{
- CGREvent: &utils.CGREvent{
- Tenant: "tenant",
- },
- }
- var reply *sessions.V1UpdateSessionReply
- result := dspSrv.SessionSv1UpdateSession(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspSessionSv1UpdateSessionErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &sessions.V1UpdateSessionArgs{
- CGREvent: &utils.CGREvent{
- Tenant: "tenant",
- },
- }
- var reply *sessions.V1UpdateSessionReply
- result := dspSrv.SessionSv1UpdateSession(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspSessionSv1SyncSessionsNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.TenantWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.SessionSv1SyncSessions(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspSessionSv1SyncSessionsErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.TenantWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.SessionSv1SyncSessions(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspSessionSv1TerminateSessionNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &sessions.V1TerminateSessionArgs{
- CGREvent: &utils.CGREvent{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.SessionSv1TerminateSession(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspSessionSv1TerminateSessionErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &sessions.V1TerminateSessionArgs{
- CGREvent: &utils.CGREvent{
- Tenant: "tenant",
- },
- }
- var reply *string
- result := dspSrv.SessionSv1TerminateSession(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspSessionSv1ProcessCDRNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.CGREvent{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.SessionSv1ProcessCDR(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspSessionSv1ProcessCDRErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.CGREvent{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.SessionSv1ProcessCDR(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspSessionSv1ProcessMessageNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &sessions.V1ProcessMessageArgs{
- CGREvent: &utils.CGREvent{
- Tenant: "tenant",
- },
- }
- var reply *sessions.V1ProcessMessageReply
- result := dspSrv.SessionSv1ProcessMessage(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspSessionSv1ProcessMessageErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &sessions.V1ProcessMessageArgs{
- CGREvent: &utils.CGREvent{
- Tenant: "tenant",
- },
- }
- var reply *sessions.V1ProcessMessageReply
- result := dspSrv.SessionSv1ProcessMessage(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspSessionSv1ProcessEventNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &sessions.V1ProcessEventArgs{
- CGREvent: &utils.CGREvent{
- Tenant: "tenant",
- },
- }
- var reply *sessions.V1ProcessEventReply
- result := dspSrv.SessionSv1ProcessEvent(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspSessionSv1ProcessEventErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &sessions.V1ProcessEventArgs{
- CGREvent: &utils.CGREvent{
- Tenant: "tenant",
- },
- }
- var reply *sessions.V1ProcessEventReply
- result := dspSrv.SessionSv1ProcessEvent(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspSessionSv1GetCostNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &sessions.V1ProcessEventArgs{
- CGREvent: &utils.CGREvent{
- Tenant: "tenant",
- },
- }
- var reply *sessions.V1GetCostReply
- result := dspSrv.SessionSv1GetCost(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspSessionSv1GetCostErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &sessions.V1ProcessEventArgs{
- CGREvent: &utils.CGREvent{
- Tenant: "tenant",
- },
- }
- var reply *sessions.V1GetCostReply
- result := dspSrv.SessionSv1GetCost(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspSessionSv1GetActiveSessionsNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.SessionFilter{
- Tenant: "tenant",
- }
- var reply *[]*sessions.ExternalSession
- result := dspSrv.SessionSv1GetActiveSessions(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspSessionSv1GetActiveSessionsErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.SessionFilter{
- Tenant: "tenant",
- }
- var reply *[]*sessions.ExternalSession
- result := dspSrv.SessionSv1GetActiveSessions(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspSessionSv1GetActiveSessionsCountNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.SessionFilter{
- Tenant: "tenant",
- }
- var reply *int
- result := dspSrv.SessionSv1GetActiveSessionsCount(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspSessionSv1GetActiveSessionsCountErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.SessionFilter{
- Tenant: "tenant",
- }
- var reply *int
- result := dspSrv.SessionSv1GetActiveSessionsCount(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspSessionSv1ForceDisconnectNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.SessionFilter{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.SessionSv1ForceDisconnect(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspSessionSv1ForceDisconnectErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.SessionFilter{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.SessionSv1ForceDisconnect(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspSessionSv1GetPassiveSessionsNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.SessionFilter{
- Tenant: "tenant",
- }
- var reply *[]*sessions.ExternalSession
- result := dspSrv.SessionSv1GetPassiveSessions(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspSessionSv1GetPassiveSessionsErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.SessionFilter{
- Tenant: "tenant",
- }
- var reply *[]*sessions.ExternalSession
- result := dspSrv.SessionSv1GetPassiveSessions(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspSessionSv1ReplicateSessionsNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := ArgsReplicateSessionsWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.SessionSv1ReplicateSessions(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspSessionSv1ReplicateSessionsErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := ArgsReplicateSessionsWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.SessionSv1ReplicateSessions(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspSessionSv1GetPassiveSessionsCountNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.SessionFilter{
- Tenant: "tenant",
- }
- var reply *int
- result := dspSrv.SessionSv1GetPassiveSessionsCount(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspSessionSv1GetPassiveSessionsCountErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.SessionFilter{
- Tenant: "tenant",
- }
- var reply *int
- result := dspSrv.SessionSv1GetPassiveSessionsCount(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspSessionSv1SetPassiveSessionNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &sessions.Session{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.SessionSv1SetPassiveSession(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspSessionSv1SetPassiveSessionErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &sessions.Session{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.SessionSv1SetPassiveSession(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspSessionSv1ActivateSessionsNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.SessionIDsWithArgsDispatcher{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.SessionSv1ActivateSessions(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspSessionSv1ActivateSessionsErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.SessionIDsWithArgsDispatcher{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.SessionSv1ActivateSessions(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspSessionSv1DeactivateSessionsNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.SessionIDsWithArgsDispatcher{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.SessionSv1DeactivateSessions(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspSessionSv1DeactivateSessionsErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.SessionIDsWithArgsDispatcher{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.SessionSv1DeactivateSessions(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspSessionSv1STIRAuthenticateNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &sessions.V1STIRAuthenticateArgs{}
- var reply *string
- result := dspSrv.SessionSv1STIRAuthenticate(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspSessionSv1STIRAuthenticateErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &sessions.V1STIRAuthenticateArgs{}
- var reply *string
- result := dspSrv.SessionSv1STIRAuthenticate(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspSessionSv1STIRIdentityNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &sessions.V1STIRIdentityArgs{}
- var reply *string
- result := dspSrv.SessionSv1STIRIdentity(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspSessionSv1STIRIdentityErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &sessions.V1STIRIdentityArgs{}
- var reply *string
- result := dspSrv.SessionSv1STIRIdentity(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
diff --git a/dispatchers/sessions_test.go b/dispatchers/sessions_test.go
new file mode 100644
index 000000000..50610eb8d
--- /dev/null
+++ b/dispatchers/sessions_test.go
@@ -0,0 +1,722 @@
+/*
+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
+*/
+
+package dispatchers
+
+import (
+ "testing"
+
+ "github.com/cgrates/cgrates/config"
+ "github.com/cgrates/cgrates/sessions"
+ "github.com/cgrates/cgrates/utils"
+)
+
+func TestDspSessionSv1PingNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.CGREvent{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.SessionSv1Ping(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspSessionSv1PingErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.CGREvent{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.SessionSv1Ping(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspSessionSv1AuthorizeEventNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &sessions.V1AuthorizeArgs{
+ CGREvent: &utils.CGREvent{
+ Tenant: "tenant",
+ },
+ }
+ var reply *sessions.V1AuthorizeReply
+ result := dspSrv.SessionSv1AuthorizeEvent(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspSessionSv1AuthorizeEventErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &sessions.V1AuthorizeArgs{
+ CGREvent: &utils.CGREvent{
+ Tenant: "tenant",
+ },
+ }
+ var reply *sessions.V1AuthorizeReply
+ result := dspSrv.SessionSv1AuthorizeEvent(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspSessionSv1AuthorizeEventWithDigestNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &sessions.V1AuthorizeArgs{
+ CGREvent: &utils.CGREvent{
+ Tenant: "tenant",
+ },
+ }
+ var reply *sessions.V1AuthorizeReplyWithDigest
+ result := dspSrv.SessionSv1AuthorizeEventWithDigest(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspSessionSv1AuthorizeEventWithDigestErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &sessions.V1AuthorizeArgs{
+ CGREvent: &utils.CGREvent{
+ Tenant: "tenant",
+ },
+ }
+ var reply *sessions.V1AuthorizeReplyWithDigest
+ result := dspSrv.SessionSv1AuthorizeEventWithDigest(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspSessionSv1InitiateSessionNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &sessions.V1InitSessionArgs{
+ CGREvent: &utils.CGREvent{
+ Tenant: "tenant",
+ },
+ }
+ var reply *sessions.V1InitSessionReply
+ result := dspSrv.SessionSv1InitiateSession(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspSessionSv1InitiateSessionErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &sessions.V1InitSessionArgs{
+ CGREvent: &utils.CGREvent{
+ Tenant: "tenant",
+ },
+ }
+ var reply *sessions.V1InitSessionReply
+ result := dspSrv.SessionSv1InitiateSession(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspSessionSv1InitiateSessionWithDigestNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &sessions.V1InitSessionArgs{
+ CGREvent: &utils.CGREvent{
+ Tenant: "tenant",
+ },
+ }
+ var reply *sessions.V1InitReplyWithDigest
+ result := dspSrv.SessionSv1InitiateSessionWithDigest(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspSessionSv1InitiateSessionWithDigestErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &sessions.V1InitSessionArgs{
+ CGREvent: &utils.CGREvent{
+ Tenant: "tenant",
+ },
+ }
+ var reply *sessions.V1InitReplyWithDigest
+ result := dspSrv.SessionSv1InitiateSessionWithDigest(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspSessionSv1UpdateSessionNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &sessions.V1UpdateSessionArgs{
+ CGREvent: &utils.CGREvent{
+ Tenant: "tenant",
+ },
+ }
+ var reply *sessions.V1UpdateSessionReply
+ result := dspSrv.SessionSv1UpdateSession(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspSessionSv1UpdateSessionErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &sessions.V1UpdateSessionArgs{
+ CGREvent: &utils.CGREvent{
+ Tenant: "tenant",
+ },
+ }
+ var reply *sessions.V1UpdateSessionReply
+ result := dspSrv.SessionSv1UpdateSession(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspSessionSv1SyncSessionsNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.TenantWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.SessionSv1SyncSessions(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspSessionSv1SyncSessionsErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.TenantWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.SessionSv1SyncSessions(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspSessionSv1TerminateSessionNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &sessions.V1TerminateSessionArgs{
+ CGREvent: &utils.CGREvent{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.SessionSv1TerminateSession(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspSessionSv1TerminateSessionErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &sessions.V1TerminateSessionArgs{
+ CGREvent: &utils.CGREvent{
+ Tenant: "tenant",
+ },
+ }
+ var reply *string
+ result := dspSrv.SessionSv1TerminateSession(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspSessionSv1ProcessCDRNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.CGREvent{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.SessionSv1ProcessCDR(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspSessionSv1ProcessCDRErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.CGREvent{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.SessionSv1ProcessCDR(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspSessionSv1ProcessMessageNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &sessions.V1ProcessMessageArgs{
+ CGREvent: &utils.CGREvent{
+ Tenant: "tenant",
+ },
+ }
+ var reply *sessions.V1ProcessMessageReply
+ result := dspSrv.SessionSv1ProcessMessage(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspSessionSv1ProcessMessageErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &sessions.V1ProcessMessageArgs{
+ CGREvent: &utils.CGREvent{
+ Tenant: "tenant",
+ },
+ }
+ var reply *sessions.V1ProcessMessageReply
+ result := dspSrv.SessionSv1ProcessMessage(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspSessionSv1ProcessEventNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &sessions.V1ProcessEventArgs{
+ CGREvent: &utils.CGREvent{
+ Tenant: "tenant",
+ },
+ }
+ var reply *sessions.V1ProcessEventReply
+ result := dspSrv.SessionSv1ProcessEvent(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspSessionSv1ProcessEventErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &sessions.V1ProcessEventArgs{
+ CGREvent: &utils.CGREvent{
+ Tenant: "tenant",
+ },
+ }
+ var reply *sessions.V1ProcessEventReply
+ result := dspSrv.SessionSv1ProcessEvent(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspSessionSv1GetCostNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &sessions.V1ProcessEventArgs{
+ CGREvent: &utils.CGREvent{
+ Tenant: "tenant",
+ },
+ }
+ var reply *sessions.V1GetCostReply
+ result := dspSrv.SessionSv1GetCost(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspSessionSv1GetCostErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &sessions.V1ProcessEventArgs{
+ CGREvent: &utils.CGREvent{
+ Tenant: "tenant",
+ },
+ }
+ var reply *sessions.V1GetCostReply
+ result := dspSrv.SessionSv1GetCost(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspSessionSv1GetActiveSessionsNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.SessionFilter{
+ Tenant: "tenant",
+ }
+ var reply *[]*sessions.ExternalSession
+ result := dspSrv.SessionSv1GetActiveSessions(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspSessionSv1GetActiveSessionsErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.SessionFilter{
+ Tenant: "tenant",
+ }
+ var reply *[]*sessions.ExternalSession
+ result := dspSrv.SessionSv1GetActiveSessions(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspSessionSv1GetActiveSessionsCountNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.SessionFilter{
+ Tenant: "tenant",
+ }
+ var reply *int
+ result := dspSrv.SessionSv1GetActiveSessionsCount(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspSessionSv1GetActiveSessionsCountErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.SessionFilter{
+ Tenant: "tenant",
+ }
+ var reply *int
+ result := dspSrv.SessionSv1GetActiveSessionsCount(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspSessionSv1ForceDisconnectNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.SessionFilter{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.SessionSv1ForceDisconnect(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspSessionSv1ForceDisconnectErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.SessionFilter{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.SessionSv1ForceDisconnect(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspSessionSv1GetPassiveSessionsNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.SessionFilter{
+ Tenant: "tenant",
+ }
+ var reply *[]*sessions.ExternalSession
+ result := dspSrv.SessionSv1GetPassiveSessions(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspSessionSv1GetPassiveSessionsErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.SessionFilter{
+ Tenant: "tenant",
+ }
+ var reply *[]*sessions.ExternalSession
+ result := dspSrv.SessionSv1GetPassiveSessions(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspSessionSv1ReplicateSessionsNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := ArgsReplicateSessionsWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.SessionSv1ReplicateSessions(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspSessionSv1ReplicateSessionsErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := ArgsReplicateSessionsWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.SessionSv1ReplicateSessions(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspSessionSv1GetPassiveSessionsCountNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.SessionFilter{
+ Tenant: "tenant",
+ }
+ var reply *int
+ result := dspSrv.SessionSv1GetPassiveSessionsCount(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspSessionSv1GetPassiveSessionsCountErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.SessionFilter{
+ Tenant: "tenant",
+ }
+ var reply *int
+ result := dspSrv.SessionSv1GetPassiveSessionsCount(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspSessionSv1SetPassiveSessionNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &sessions.Session{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.SessionSv1SetPassiveSession(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspSessionSv1SetPassiveSessionErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &sessions.Session{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.SessionSv1SetPassiveSession(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspSessionSv1ActivateSessionsNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.SessionIDsWithArgsDispatcher{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.SessionSv1ActivateSessions(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspSessionSv1ActivateSessionsErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.SessionIDsWithArgsDispatcher{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.SessionSv1ActivateSessions(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspSessionSv1DeactivateSessionsNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.SessionIDsWithArgsDispatcher{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.SessionSv1DeactivateSessions(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspSessionSv1DeactivateSessionsErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.SessionIDsWithArgsDispatcher{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.SessionSv1DeactivateSessions(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspSessionSv1STIRAuthenticateNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &sessions.V1STIRAuthenticateArgs{}
+ var reply *string
+ result := dspSrv.SessionSv1STIRAuthenticate(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspSessionSv1STIRAuthenticateErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &sessions.V1STIRAuthenticateArgs{}
+ var reply *string
+ result := dspSrv.SessionSv1STIRAuthenticate(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspSessionSv1STIRIdentityNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &sessions.V1STIRIdentityArgs{}
+ var reply *string
+ result := dspSrv.SessionSv1STIRIdentity(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspSessionSv1STIRIdentityErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &sessions.V1STIRIdentityArgs{}
+ var reply *string
+ result := dspSrv.SessionSv1STIRIdentity(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
diff --git a/dispatchers/stats_it_test.go b/dispatchers/stats_it_test.go
index 6832b76da..233d0d46b 100644
--- a/dispatchers/stats_it_test.go
+++ b/dispatchers/stats_it_test.go
@@ -26,8 +26,6 @@ import (
"testing"
"time"
- "github.com/cgrates/cgrates/config"
-
"github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
@@ -362,205 +360,3 @@ func testDspStsTestAuthKey3(t *testing.T) {
t.Errorf("expecting: %+v, received reply: %v", estats, reply)
}
}
-
-func TestDspStatSv1PingNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.CGREvent{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.StatSv1Ping(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspStatSv1PingNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- var reply *string
- result := dspSrv.StatSv1Ping(nil, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspStatSv1PingErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.CGREvent{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.StatSv1Ping(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspStatSv1GetStatQueuesForEventNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &engine.StatsArgsProcessEvent{
- CGREvent: &utils.CGREvent{
- Tenant: "tenant",
- },
- }
- var reply *[]string
- result := dspSrv.StatSv1GetStatQueuesForEvent(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspStatSv1GetStatQueuesForEventErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &engine.StatsArgsProcessEvent{
- CGREvent: &utils.CGREvent{
- Tenant: "tenant",
- },
- }
- var reply *[]string
- result := dspSrv.StatSv1GetStatQueuesForEvent(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspStatSv1GetQueueStringMetricsNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *map[string]string
- result := dspSrv.StatSv1GetQueueStringMetrics(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspStatSv1GetQueueStringMetricsErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *map[string]string
- result := dspSrv.StatSv1GetQueueStringMetrics(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspStatSv1ProcessEventNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &engine.StatsArgsProcessEvent{
- CGREvent: &utils.CGREvent{
- Tenant: "tenant",
- },
- }
- var reply *[]string
- result := dspSrv.StatSv1ProcessEvent(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspStatSv1ProcessEventErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &engine.StatsArgsProcessEvent{
- CGREvent: &utils.CGREvent{
- Tenant: "tenant",
- },
- }
- var reply *[]string
- result := dspSrv.StatSv1ProcessEvent(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspStatSv1GetQueueFloatMetricsNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *map[string]float64
- result := dspSrv.StatSv1GetQueueFloatMetrics(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspStatSv1GetQueueFloatMetricsErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *map[string]float64
- result := dspSrv.StatSv1GetQueueFloatMetrics(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspStatSv1GetQueueIDsNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.TenantWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *[]string
- result := dspSrv.StatSv1GetQueueIDs(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspStatSv1GetQueueIDsErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.TenantWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *[]string
- result := dspSrv.StatSv1GetQueueIDs(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
diff --git a/dispatchers/stats_test.go b/dispatchers/stats_test.go
new file mode 100644
index 000000000..ff0fb2990
--- /dev/null
+++ b/dispatchers/stats_test.go
@@ -0,0 +1,229 @@
+/*
+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
+*/
+
+package dispatchers
+
+import (
+ "testing"
+
+ "github.com/cgrates/cgrates/config"
+ "github.com/cgrates/cgrates/engine"
+ "github.com/cgrates/cgrates/utils"
+)
+
+func TestDspStatSv1PingNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.CGREvent{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.StatSv1Ping(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspStatSv1PingNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ var reply *string
+ result := dspSrv.StatSv1Ping(nil, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspStatSv1PingErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.CGREvent{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.StatSv1Ping(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspStatSv1GetStatQueuesForEventNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &engine.StatsArgsProcessEvent{
+ CGREvent: &utils.CGREvent{
+ Tenant: "tenant",
+ },
+ }
+ var reply *[]string
+ result := dspSrv.StatSv1GetStatQueuesForEvent(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspStatSv1GetStatQueuesForEventErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &engine.StatsArgsProcessEvent{
+ CGREvent: &utils.CGREvent{
+ Tenant: "tenant",
+ },
+ }
+ var reply *[]string
+ result := dspSrv.StatSv1GetStatQueuesForEvent(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspStatSv1GetQueueStringMetricsNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *map[string]string
+ result := dspSrv.StatSv1GetQueueStringMetrics(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspStatSv1GetQueueStringMetricsErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *map[string]string
+ result := dspSrv.StatSv1GetQueueStringMetrics(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspStatSv1ProcessEventNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &engine.StatsArgsProcessEvent{
+ CGREvent: &utils.CGREvent{
+ Tenant: "tenant",
+ },
+ }
+ var reply *[]string
+ result := dspSrv.StatSv1ProcessEvent(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspStatSv1ProcessEventErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &engine.StatsArgsProcessEvent{
+ CGREvent: &utils.CGREvent{
+ Tenant: "tenant",
+ },
+ }
+ var reply *[]string
+ result := dspSrv.StatSv1ProcessEvent(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspStatSv1GetQueueFloatMetricsNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *map[string]float64
+ result := dspSrv.StatSv1GetQueueFloatMetrics(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspStatSv1GetQueueFloatMetricsErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *map[string]float64
+ result := dspSrv.StatSv1GetQueueFloatMetrics(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspStatSv1GetQueueIDsNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.TenantWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *[]string
+ result := dspSrv.StatSv1GetQueueIDs(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspStatSv1GetQueueIDsErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.TenantWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *[]string
+ result := dspSrv.StatSv1GetQueueIDs(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
diff --git a/dispatchers/thresholds_it_test.go b/dispatchers/thresholds_it_test.go
index 334c3dc26..f5839c816 100644
--- a/dispatchers/thresholds_it_test.go
+++ b/dispatchers/thresholds_it_test.go
@@ -26,8 +26,6 @@ import (
"testing"
"time"
- "github.com/cgrates/cgrates/config"
-
"github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
@@ -265,169 +263,3 @@ func testDspThTestAuthKey3(t *testing.T) {
t.Errorf("expecting: %+v, received: %+v", eIDs, ids)
}
}
-
-func TestDspThresholdSv1PingNilEvent(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- var reply *string
- result := dspSrv.ThresholdSv1Ping(nil, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspThresholdSv1PingNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.CGREvent{
- Tenant: "tenant",
- }
- var reply *string
- result := dspSrv.ThresholdSv1Ping(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspThresholdSv1PingErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.CGREvent{}
- var reply *string
- result := dspSrv.ThresholdSv1Ping(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspThresholdSv1GetThresholdsForEventNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &engine.ThresholdsArgsProcessEvent{
- CGREvent: &utils.CGREvent{
- Tenant: "tenant",
- },
- }
- var reply *engine.Thresholds
- result := dspSrv.ThresholdSv1GetThresholdsForEvent(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspThresholdSv1GetThresholdsEvnil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &engine.ThresholdsArgsProcessEvent{
- CGREvent: &utils.CGREvent{
- Tenant: "tenant",
- },
- }
- var reply *engine.Thresholds
- result := dspSrv.ThresholdSv1GetThresholdsForEvent(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspThresholdSv1ProcessEventNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &engine.ThresholdsArgsProcessEvent{
- CGREvent: &utils.CGREvent{
- Tenant: "tenant",
- },
- }
- var reply *[]string
- result := dspSrv.ThresholdSv1ProcessEvent(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspThresholdSv1ProcessEventnNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &engine.ThresholdsArgsProcessEvent{
- CGREvent: &utils.CGREvent{
- Tenant: "tenant",
- },
- }
- var reply *[]string
- result := dspSrv.ThresholdSv1ProcessEvent(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspThresholdSv1GetThresholdIDsNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.TenantWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *[]string
- result := dspSrv.ThresholdSv1GetThresholdIDs(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspThresholdSv1GetThresholdIDErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.TenantWithAPIOpts{
- Tenant: "tenant",
- }
- var reply *[]string
- result := dspSrv.ThresholdSv1GetThresholdIDs(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspThresholdSv1GetThresholdNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *engine.Threshold
- result := dspSrv.ThresholdSv1GetThreshold(CGREvent, reply)
- expected := "DISPATCHER_ERROR:NOT_FOUND"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
-
-func TestDspThresholdSv1GetThresholdErrorNil(t *testing.T) {
- cgrCfg := config.NewDefaultCGRConfig()
- dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{
- Tenant: "tenant",
- },
- }
- var reply *engine.Threshold
- result := dspSrv.ThresholdSv1GetThreshold(CGREvent, reply)
- expected := "MANDATORY_IE_MISSING: [ApiKey]"
- if result == nil || result.Error() != expected {
- t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
- }
-}
diff --git a/dispatchers/thresholds_test.go b/dispatchers/thresholds_test.go
new file mode 100644
index 000000000..e6f51207b
--- /dev/null
+++ b/dispatchers/thresholds_test.go
@@ -0,0 +1,193 @@
+/*
+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
+*/
+
+package dispatchers
+
+import (
+ "testing"
+
+ "github.com/cgrates/cgrates/config"
+ "github.com/cgrates/cgrates/engine"
+ "github.com/cgrates/cgrates/utils"
+)
+
+func TestDspThresholdSv1PingNilEvent(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ var reply *string
+ result := dspSrv.ThresholdSv1Ping(nil, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspThresholdSv1PingNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.CGREvent{
+ Tenant: "tenant",
+ }
+ var reply *string
+ result := dspSrv.ThresholdSv1Ping(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspThresholdSv1PingErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.CGREvent{}
+ var reply *string
+ result := dspSrv.ThresholdSv1Ping(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspThresholdSv1GetThresholdsForEventNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &engine.ThresholdsArgsProcessEvent{
+ CGREvent: &utils.CGREvent{
+ Tenant: "tenant",
+ },
+ }
+ var reply *engine.Thresholds
+ result := dspSrv.ThresholdSv1GetThresholdsForEvent(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspThresholdSv1GetThresholdsEvnil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &engine.ThresholdsArgsProcessEvent{
+ CGREvent: &utils.CGREvent{
+ Tenant: "tenant",
+ },
+ }
+ var reply *engine.Thresholds
+ result := dspSrv.ThresholdSv1GetThresholdsForEvent(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspThresholdSv1ProcessEventNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &engine.ThresholdsArgsProcessEvent{
+ CGREvent: &utils.CGREvent{
+ Tenant: "tenant",
+ },
+ }
+ var reply *[]string
+ result := dspSrv.ThresholdSv1ProcessEvent(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspThresholdSv1ProcessEventnNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &engine.ThresholdsArgsProcessEvent{
+ CGREvent: &utils.CGREvent{
+ Tenant: "tenant",
+ },
+ }
+ var reply *[]string
+ result := dspSrv.ThresholdSv1ProcessEvent(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspThresholdSv1GetThresholdIDsNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.TenantWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *[]string
+ result := dspSrv.ThresholdSv1GetThresholdIDs(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspThresholdSv1GetThresholdIDErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.TenantWithAPIOpts{
+ Tenant: "tenant",
+ }
+ var reply *[]string
+ result := dspSrv.ThresholdSv1GetThresholdIDs(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspThresholdSv1GetThresholdNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *engine.Threshold
+ result := dspSrv.ThresholdSv1GetThreshold(CGREvent, reply)
+ expected := "DISPATCHER_ERROR:NOT_FOUND"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}
+
+func TestDspThresholdSv1GetThresholdErrorNil(t *testing.T) {
+ cgrCfg := config.NewDefaultCGRConfig()
+ dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
+ cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
+ CGREvent := &utils.TenantIDWithAPIOpts{
+ TenantID: &utils.TenantID{
+ Tenant: "tenant",
+ },
+ }
+ var reply *engine.Threshold
+ result := dspSrv.ThresholdSv1GetThreshold(CGREvent, reply)
+ expected := "MANDATORY_IE_MISSING: [ApiKey]"
+ if result == nil || result.Error() != expected {
+ t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
+ }
+}