diff --git a/agents/astagent.go b/agents/astagent.go
index 6f1126cda..3391e4735 100644
--- a/agents/astagent.go
+++ b/agents/astagent.go
@@ -62,7 +62,7 @@ func NewAsteriskAgent(cgrCfg *config.CGRConfig, astConnIdx int,
cgrCfg: cgrCfg,
astConnIdx: astConnIdx,
connMgr: connMgr,
- eventsCache: make(map[string]*utils.CGREvent),
+ eventsCache: make(map[string]*engine.CGREvent),
}
srv, err := birpc.NewServiceWithMethodsRename(sma, utils.AgentV1, true, func(oldFn string) (newFn string) {
return strings.TrimPrefix(oldFn, "V1")
@@ -82,8 +82,8 @@ type AsteriskAgent struct {
astConn *aringo.ARInGO
astEvChan chan map[string]any
astErrChan chan error
- eventsCache map[string]*utils.CGREvent // used to gather information about events during various phases
- evCacheMux sync.RWMutex // Protect eventsCache
+ eventsCache map[string]*engine.CGREvent // used to gather information about events during various phases
+ evCacheMux sync.RWMutex // Protect eventsCache
ctx *context.Context
}
@@ -374,7 +374,7 @@ func (sma *AsteriskAgent) V1GetActiveSessionIDs(ctx *context.Context, ignParam s
}
// V1AlterSessions is used to implement the sessions.BiRPClient interface
-func (*AsteriskAgent) V1AlterSessions(*context.Context, utils.CGREvent, *string) error {
+func (*AsteriskAgent) V1AlterSessions(*context.Context, engine.CGREvent, *string) error {
return utils.ErrNotImplemented
}
diff --git a/agents/asterisk_event.go b/agents/asterisk_event.go
index d43b53ae5..a6576ee4f 100644
--- a/agents/asterisk_event.go
+++ b/agents/asterisk_event.go
@@ -24,6 +24,7 @@ import (
"time"
"github.com/cgrates/cgrates/config"
+ "github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/sessions"
"github.com/cgrates/cgrates/utils"
)
@@ -201,7 +202,7 @@ func (smaEv *SMAsteriskEvent) ExtraParameters() (extraParams map[string]string)
return
}
-func (smaEv *SMAsteriskEvent) UpdateCGREvent(cgrEv *utils.CGREvent) error {
+func (smaEv *SMAsteriskEvent) UpdateCGREvent(cgrEv *engine.CGREvent) error {
resCGREv := *cgrEv
switch smaEv.EventType() {
case ARIChannelStateChange:
@@ -270,13 +271,13 @@ func (smaEv *SMAsteriskEvent) AsMapStringInterface() (mp map[string]any) {
}
// AsCGREvent converts AsteriskEvent into CGREvent
-func (smaEv *SMAsteriskEvent) AsCGREvent(timezone string) (cgrEv *utils.CGREvent, err error) {
+func (smaEv *SMAsteriskEvent) AsCGREvent(timezone string) (cgrEv *engine.CGREvent, err error) {
var setupTime time.Time
if setupTime, err = utils.ParseTimeDetectLayout(
smaEv.Timestamp(), timezone); err != nil {
return
}
- cgrEv = &utils.CGREvent{
+ cgrEv = &engine.CGREvent{
Tenant: utils.FirstNonEmpty(smaEv.Tenant(),
config.CgrConfig().GeneralCfg().DefaultTenant),
ID: utils.UUIDSha1Prefix(),
@@ -305,7 +306,7 @@ func (smaEv *SMAsteriskEvent) V1AuthorizeArgs() (args *sessions.V1AuthorizeArgs)
return
}
-func (smaEv *SMAsteriskEvent) V1InitSessionArgs(cgrEvDisp utils.CGREvent) (args *sessions.V1InitSessionArgs) {
+func (smaEv *SMAsteriskEvent) V1InitSessionArgs(cgrEvDisp engine.CGREvent) (args *sessions.V1InitSessionArgs) {
args = &sessions.V1InitSessionArgs{ // defaults
CGREvent: &cgrEvDisp,
}
@@ -320,7 +321,7 @@ func (smaEv *SMAsteriskEvent) V1InitSessionArgs(cgrEvDisp utils.CGREvent) (args
return
}
-func (smaEv *SMAsteriskEvent) V1TerminateSessionArgs(cgrEvDisp utils.CGREvent) (args *sessions.V1TerminateSessionArgs) {
+func (smaEv *SMAsteriskEvent) V1TerminateSessionArgs(cgrEvDisp engine.CGREvent) (args *sessions.V1TerminateSessionArgs) {
args = &sessions.V1TerminateSessionArgs{ // defaults
CGREvent: &cgrEvDisp,
}
diff --git a/agents/asterisk_event_test.go b/agents/asterisk_event_test.go
index 94a917684..26752ecf2 100644
--- a/agents/asterisk_event_test.go
+++ b/agents/asterisk_event_test.go
@@ -23,6 +23,7 @@ import (
"testing"
"github.com/cgrates/cgrates/config"
+ "github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/sessions"
"github.com/cgrates/cgrates/utils"
)
@@ -395,7 +396,7 @@ func TestSMAEventV1AuthorizeArgs(t *testing.T) {
}
func TestSMAEventV1InitSessionArgs(t *testing.T) {
- cgrEv := &utils.CGREvent{
+ cgrEv := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "AsteriskEvent",
Event: map[string]any{
@@ -428,7 +429,7 @@ func TestSMAEventV1InitSessionArgs(t *testing.T) {
}
func TestSMAEventV1TerminateSessionArgs(t *testing.T) {
- cgrEv := &utils.CGREvent{
+ cgrEv := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "AsteriskEvent",
Event: map[string]any{
@@ -477,7 +478,7 @@ func TestRequestType(t *testing.T) {
}
func TestSMAsteriskEventUpdateCGREvent(t *testing.T) {
- cgrEv := &utils.CGREvent{
+ cgrEv := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: make(map[string]any),
diff --git a/agents/diamagent.go b/agents/diamagent.go
index 5104a32f7..f71524ee7 100644
--- a/agents/diamagent.go
+++ b/agents/diamagent.go
@@ -347,7 +347,7 @@ func (da *DiameterAgent) V1DisconnectSession(ctx *context.Context, args utils.At
case utils.MetaASR:
return da.sendASR(originID, reply)
case utils.MetaRAR:
- return da.V1AlterSessions(ctx, utils.CGREvent{Event: args.EventStart}, reply)
+ return da.V1AlterSessions(ctx, engine.CGREvent{Event: args.EventStart}, reply)
default:
return fmt.Errorf("Unsupported request type <%s>", da.cgrCfg.DiameterAgentCfg().ForcedDisconnect)
}
@@ -390,7 +390,7 @@ func (da *DiameterAgent) sendASR(originID string, reply *string) (err error) {
}
// V1AlterSessions sends a rar message to diameter client
-func (da *DiameterAgent) V1AlterSessions(ctx *context.Context, cgrEv utils.CGREvent, reply *string) (err error) {
+func (da *DiameterAgent) V1AlterSessions(ctx *context.Context, cgrEv engine.CGREvent, reply *string) (err error) {
originID, err := cgrEv.FieldAsString(utils.OriginID)
if err != nil {
return fmt.Errorf("could not retrieve OriginID: %w", err)
diff --git a/agents/diamagent_test.go b/agents/diamagent_test.go
index cb5082567..ff215e650 100644
--- a/agents/diamagent_test.go
+++ b/agents/diamagent_test.go
@@ -129,7 +129,7 @@ func TestProcessRequest(t *testing.T) {
}
expargs := &sessions.V1AuthorizeArgs{
GetMaxUsage: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: id,
Time: tm,
@@ -172,7 +172,7 @@ func TestProcessRequest(t *testing.T) {
expargs := &sessions.V1InitSessionArgs{
GetAttributes: true,
InitSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: id,
Time: tm,
@@ -200,7 +200,7 @@ func TestProcessRequest(t *testing.T) {
Attributes: &engine.AttrSProcessEventReply{
MatchedProfiles: []string{"ATTR_1001_SESSIONAUTH"},
AlteredFields: []string{"*req.Password", "*req.PaypalAccount", "*req.RequestType", "*req.LCRProfile"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "e7d35bf",
Event: map[string]any{
@@ -237,7 +237,7 @@ func TestProcessRequest(t *testing.T) {
expargs := &sessions.V1UpdateSessionArgs{
GetAttributes: true,
UpdateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: id,
Time: tm,
@@ -265,7 +265,7 @@ func TestProcessRequest(t *testing.T) {
Attributes: &engine.AttrSProcessEventReply{
MatchedProfiles: []string{"ATTR_1001_SESSIONAUTH"},
AlteredFields: []string{"*req.Password", "*req.PaypalAccount", "*req.RequestType", "*req.LCRProfile"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "e7d35bf",
Event: map[string]any{
@@ -293,13 +293,13 @@ func TestProcessRequest(t *testing.T) {
var id string
if arg == nil {
t.Errorf("args is nil")
- } else if rargs, can := arg.(*utils.CGREvent); !can {
- t.Errorf("args is not of utils.CGREventWithOpts type")
+ } else if rargs, can := arg.(*engine.CGREvent); !can {
+ t.Errorf("args is not of engine.CGREventWithOpts type")
} else {
tm = rargs.Time // need time
id = rargs.ID
}
- expargs := &utils.CGREvent{
+ expargs := &engine.CGREvent{
Tenant: "cgrates.org",
ID: id,
Time: tm,
@@ -339,7 +339,7 @@ func TestProcessRequest(t *testing.T) {
expargs := &sessions.V1TerminateSessionArgs{
TerminateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: id,
Time: tm,
@@ -380,7 +380,7 @@ func TestProcessRequest(t *testing.T) {
expargs := &sessions.V1ProcessMessageArgs{
GetAttributes: true,
Debit: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: id,
Time: tm,
@@ -408,7 +408,7 @@ func TestProcessRequest(t *testing.T) {
Attributes: &engine.AttrSProcessEventReply{
MatchedProfiles: []string{"ATTR_1001_SESSIONAUTH"},
AlteredFields: []string{"*req.Password", "*req.PaypalAccount", "*req.RequestType", "*req.LCRProfile"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "e7d35bf",
Event: map[string]any{
diff --git a/agents/fsagent.go b/agents/fsagent.go
index 27565fe0d..bb8850cdc 100644
--- a/agents/fsagent.go
+++ b/agents/fsagent.go
@@ -487,7 +487,7 @@ func (fsa *FSsessions) V1WarnDisconnect(ctx *context.Context, args map[string]an
}
// V1AlterSessions is used to implement the sessions.BiRPClient interface
-func (*FSsessions) V1AlterSessions(*context.Context, utils.CGREvent, *string) error {
+func (*FSsessions) V1AlterSessions(*context.Context, engine.CGREvent, *string) error {
return utils.ErrNotImplemented
}
diff --git a/agents/fsevent.go b/agents/fsevent.go
index c6b6cdbd3..0d5f86352 100644
--- a/agents/fsevent.go
+++ b/agents/fsevent.go
@@ -26,6 +26,7 @@ import (
"time"
"github.com/cgrates/cgrates/config"
+ "github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/sessions"
"github.com/cgrates/cgrates/utils"
"github.com/cgrates/fsock"
@@ -356,12 +357,12 @@ func (fsev FSEvent) ParseEventValue(attrName string, rsrFld *config.RSRParser, t
}
// AsCGREvent converts FSEvent into CGREvent
-func (fsev FSEvent) AsCGREvent(timezone string) (cgrEv *utils.CGREvent, err error) {
+func (fsev FSEvent) AsCGREvent(timezone string) (cgrEv *engine.CGREvent, err error) {
sTime, err := fsev.GetSetupTime(utils.MetaDefault, timezone)
if err != nil {
return nil, err
}
- cgrEv = &utils.CGREvent{
+ cgrEv = &engine.CGREvent{
Tenant: fsev.GetTenant(utils.MetaDefault),
ID: utils.UUIDSha1Prefix(),
Time: &sTime,
diff --git a/agents/fsevent_test.go b/agents/fsevent_test.go
index 0f5d8b600..dfcb812f2 100644
--- a/agents/fsevent_test.go
+++ b/agents/fsevent_test.go
@@ -557,7 +557,7 @@ func TestFsEvAsCGREvent(t *testing.T) {
if err != nil {
t.Error(err)
}
- expected := &utils.CGREvent{
+ expected := &engine.CGREvent{
Tenant: ev.GetTenant(utils.MetaDefault),
ID: utils.UUIDSha1Prefix(),
Time: &sTime,
@@ -1023,7 +1023,7 @@ func TestFsEvV1AuthorizeArgs(t *testing.T) {
}
expected := &sessions.V1AuthorizeArgs{
GetMaxUsage: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: ev.GetTenant(utils.MetaDefault),
ID: utils.UUIDSha1Prefix(),
Time: &sTime,
@@ -1066,7 +1066,7 @@ func TestFsEvV1InitSessionArgs(t *testing.T) {
}
expected := &sessions.V1InitSessionArgs{
InitSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: ev.GetTenant(utils.MetaDefault),
ID: utils.UUIDSha1Prefix(),
Time: &sTime,
@@ -1096,7 +1096,7 @@ func TestFsEvV1TerminateSessionArgs(t *testing.T) {
}
expected := &sessions.V1TerminateSessionArgs{
TerminateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: ev.GetTenant(utils.MetaDefault),
ID: utils.UUIDSha1Prefix(),
Time: &sTime,
diff --git a/agents/kamagent.go b/agents/kamagent.go
index f73c0d303..eac10e47a 100644
--- a/agents/kamagent.go
+++ b/agents/kamagent.go
@@ -462,7 +462,7 @@ func (ka *KamailioAgent) Reload() {
}
// V1AlterSessions is used to implement the sessions.BiRPClient interface
-func (*KamailioAgent) V1AlterSessions(*context.Context, utils.CGREvent, *string) error {
+func (*KamailioAgent) V1AlterSessions(*context.Context, engine.CGREvent, *string) error {
return utils.ErrNotImplemented
}
diff --git a/agents/kamevent.go b/agents/kamevent.go
index edc37b86c..a85e8c7a4 100644
--- a/agents/kamevent.go
+++ b/agents/kamevent.go
@@ -26,6 +26,7 @@ import (
"time"
"github.com/cgrates/cgrates/config"
+ "github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/sessions"
"github.com/cgrates/cgrates/utils"
)
@@ -156,7 +157,7 @@ func (kev KamEvent) AsMapStringInterface() (mp map[string]any) {
}
// AsCGREvent converts KamEvent into CGREvent
-func (kev KamEvent) AsCGREvent(timezone string) (cgrEv *utils.CGREvent, err error) {
+func (kev KamEvent) AsCGREvent(timezone string) (cgrEv *engine.CGREvent, err error) {
var sTime time.Time
switch kev[EVENT] {
case CGR_AUTH_REQUEST:
@@ -188,7 +189,7 @@ func (kev KamEvent) AsCGREvent(timezone string) (cgrEv *utils.CGREvent, err erro
default: // no/unsupported event
return
}
- cgrEv = &utils.CGREvent{
+ cgrEv = &engine.CGREvent{
Tenant: utils.FirstNonEmpty(kev[utils.Tenant],
config.CgrConfig().GeneralCfg().DefaultTenant),
ID: utils.UUIDSha1Prefix(),
@@ -307,7 +308,7 @@ func (kev KamEvent) V1ProcessMessageArgs() (args *sessions.V1ProcessMessageArgs)
}
// V1ProcessCDRArgs returns the arguments used in SessionSv1.ProcessCDR
-func (kev KamEvent) V1ProcessCDRArgs() (args *utils.CGREvent) {
+func (kev KamEvent) V1ProcessCDRArgs() (args *engine.CGREvent) {
var err error
if args, err = kev.AsCGREvent(config.CgrConfig().GeneralCfg().DefaultTimezone); err != nil {
return
@@ -353,7 +354,7 @@ func (kev KamEvent) AsKamProcessMessageReply(procEvArgs *sessions.V1ProcessMessa
}
// AsKamProcessCDRReply builds up a Kamailio ProcessEvent based on arguments and reply from SessionS
-func (kev KamEvent) AsKamProcessCDRReply(cgrEvWithArgDisp *utils.CGREvent,
+func (kev KamEvent) AsKamProcessCDRReply(cgrEvWithArgDisp *engine.CGREvent,
rply *string, rplyErr error) (kar *KamReply, err error) {
evName := CGR_PROCESS_CDR
if kamRouReply, has := kev[KamReplyRoute]; has {
diff --git a/agents/kamevent_test.go b/agents/kamevent_test.go
index 27dbdfc48..ddc1d0dd1 100644
--- a/agents/kamevent_test.go
+++ b/agents/kamevent_test.go
@@ -124,7 +124,7 @@ func TestKamEvAsCGREvent(t *testing.T) {
if err != nil {
return
}
- expected := &utils.CGREvent{
+ expected := &engine.CGREvent{
Tenant: utils.FirstNonEmpty(kamEv[utils.Tenant],
config.CgrConfig().GeneralCfg().DefaultTenant),
ID: utils.UUIDSha1Prefix(),
@@ -159,7 +159,7 @@ func TestKamEvV1AuthorizeArgs(t *testing.T) {
}
expected := &sessions.V1AuthorizeArgs{
GetMaxUsage: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: utils.FirstNonEmpty(kamEv[utils.Tenant],
config.CgrConfig().GeneralCfg().DefaultTenant),
ID: utils.UUIDSha1Prefix(),
@@ -209,7 +209,7 @@ func TestKamEvV1AuthorizeArgs2(t *testing.T) {
}
expected := &sessions.V1AuthorizeArgs{
GetMaxUsage: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: utils.FirstNonEmpty(kamEv[utils.Tenant],
config.CgrConfig().GeneralCfg().DefaultTenant),
ID: utils.UUIDSha1Prefix(),
@@ -258,7 +258,7 @@ func TestKamEvAsKamAuthReply(t *testing.T) {
}
authArgs := &sessions.V1AuthorizeArgs{
GetMaxUsage: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: utils.FirstNonEmpty(kamEv[utils.Tenant],
config.CgrConfig().GeneralCfg().DefaultTenant),
ID: utils.UUIDSha1Prefix(),
@@ -283,7 +283,7 @@ func TestKamEvAsKamAuthReply(t *testing.T) {
KamReplyRoute: "CGR_PROFILE_REPLY"}
authArgs = &sessions.V1AuthorizeArgs{
GetAttributes: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: utils.FirstNonEmpty(kamEv[utils.Tenant],
config.CgrConfig().GeneralCfg().DefaultTenant),
ID: utils.UUIDSha1Prefix(),
@@ -295,7 +295,7 @@ func TestKamEvAsKamAuthReply(t *testing.T) {
Attributes: &engine.AttrSProcessEventReply{
MatchedProfiles: []string{"ATTR_1001_ACCOUNT_PROFILE"},
AlteredFields: []string{"*req.Password", utils.MetaReq + utils.NestingSep + utils.RequestType},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestKamEvAsKamAuthReply",
Event: map[string]any{
@@ -334,7 +334,7 @@ func TestKamEvV1InitSessionArgs(t *testing.T) {
}
expected := &sessions.V1InitSessionArgs{
InitSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: utils.FirstNonEmpty(kamEv[utils.Tenant],
config.CgrConfig().GeneralCfg().DefaultTenant),
ID: utils.UUIDSha1Prefix(),
@@ -372,7 +372,7 @@ func TestKamEvV1TerminateSessionArgs(t *testing.T) {
}
expected := &sessions.V1TerminateSessionArgs{
TerminateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: utils.FirstNonEmpty(kamEv[utils.Tenant],
config.CgrConfig().GeneralCfg().DefaultTenant),
ID: utils.UUIDSha1Prefix(),
@@ -409,7 +409,7 @@ func TestKamEvV1ProcessMessageArgs(t *testing.T) {
return
}
expected := &sessions.V1ProcessMessageArgs{
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: utils.FirstNonEmpty(kamEv[utils.Tenant],
config.CgrConfig().GeneralCfg().DefaultTenant),
ID: utils.UUIDSha1Prefix(),
@@ -445,7 +445,7 @@ func TestKamEvAsKamProcessEventReply(t *testing.T) {
}
procEvArgs := &sessions.V1ProcessMessageArgs{
Debit: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: utils.FirstNonEmpty(kamEv[utils.Tenant],
config.CgrConfig().GeneralCfg().DefaultTenant),
ID: utils.UUIDSha1Prefix(),
@@ -470,7 +470,7 @@ func TestKamEvAsKamProcessEventReply(t *testing.T) {
KamReplyRoute: "CGR_PROFILE_REPLY"}
procEvArgs = &sessions.V1ProcessMessageArgs{
GetAttributes: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: utils.FirstNonEmpty(kamEv[utils.Tenant],
config.CgrConfig().GeneralCfg().DefaultTenant),
ID: utils.UUIDSha1Prefix(),
@@ -482,7 +482,7 @@ func TestKamEvAsKamProcessEventReply(t *testing.T) {
Attributes: &engine.AttrSProcessEventReply{
MatchedProfiles: []string{"ATTR_1001_ACCOUNT_PROFILE"},
AlteredFields: []string{"*req.Password", utils.MetaReq + utils.NestingSep + utils.RequestType},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestKamEvAsKamAuthReply",
Event: map[string]any{
diff --git a/agents/libagents.go b/agents/libagents.go
index a34e55c23..686bb4b79 100644
--- a/agents/libagents.go
+++ b/agents/libagents.go
@@ -39,7 +39,7 @@ func processRequest(ctx *context.Context, reqProcessor *config.RequestProcessor,
if err = agReq.SetFields(reqProcessor.RequestFields); err != nil {
return
}
- cgrEv := utils.NMAsCGREvent(agReq.CGRRequest, agReq.Tenant, utils.NestingSep, agReq.Opts)
+ cgrEv := engine.NMAsCGREvent(agReq.CGRRequest, agReq.Tenant, utils.NestingSep, agReq.Opts)
var reqType string
for _, typ := range []string{
utils.MetaDryRun, utils.MetaAuthorize,
@@ -53,7 +53,7 @@ func processRequest(ctx *context.Context, reqProcessor *config.RequestProcessor,
}
var cgrArgs utils.Paginator
if reqType == utils.MetaAuthorize || reqType == utils.MetaMessage || reqType == utils.MetaEvent {
- if cgrArgs, err = utils.GetRoutePaginatorFromOpts(cgrEv.APIOpts); err != nil {
+ if cgrArgs, err = engine.GetRoutePaginatorFromOpts(cgrEv.APIOpts); err != nil {
utils.Logger.Warning(fmt.Sprintf("<%s> args extraction failed because <%s>",
agentName, err.Error()))
err = nil // reset the error and continue the processing
diff --git a/agents/radagent.go b/agents/radagent.go
index 88b22f6b2..4bd6b7df6 100644
--- a/agents/radagent.go
+++ b/agents/radagent.go
@@ -273,7 +273,7 @@ func (ra *RadiusAgent) processRequest(req *radigo.Packet, reqProcessor *config.R
if err = agReq.SetFields(reqProcessor.RequestFields); err != nil {
return
}
- cgrEv := utils.NMAsCGREvent(agReq.CGRRequest, agReq.Tenant, utils.NestingSep, agReq.Opts)
+ cgrEv := engine.NMAsCGREvent(agReq.CGRRequest, agReq.Tenant, utils.NestingSep, agReq.Opts)
var reqType string
for _, typ := range []string{
utils.MetaDryRun, utils.MetaAuthorize,
@@ -289,7 +289,7 @@ func (ra *RadiusAgent) processRequest(req *radigo.Packet, reqProcessor *config.R
if reqType == utils.MetaAuthorize ||
reqType == utils.MetaMessage ||
reqType == utils.MetaEvent {
- if cgrArgs, err = utils.GetRoutePaginatorFromOpts(cgrEv.APIOpts); err != nil {
+ if cgrArgs, err = engine.GetRoutePaginatorFromOpts(cgrEv.APIOpts); err != nil {
utils.Logger.Warning(fmt.Sprintf("<%s> args extraction failed because <%s>",
utils.RadiusAgent, err.Error()))
err = nil // reset the error and continue the processing
@@ -522,7 +522,7 @@ func (ra *RadiusAgent) V1DisconnectSession(_ *context.Context, attr utils.AttrDi
}
// V1AlterSessions updates session authorization using RADIUS CoA functionality.
-func (ra *RadiusAgent) V1AlterSessions(_ *context.Context, cgrEv utils.CGREvent, reply *string) error {
+func (ra *RadiusAgent) V1AlterSessions(_ *context.Context, cgrEv engine.CGREvent, reply *string) error {
originID, err := cgrEv.FieldAsString(utils.OriginID)
if err != nil {
return fmt.Errorf("could not retrieve OriginID: %w", err)
diff --git a/agents/sipagent.go b/agents/sipagent.go
index 61c64fb5c..031f26f23 100644
--- a/agents/sipagent.go
+++ b/agents/sipagent.go
@@ -384,7 +384,7 @@ func (sa *SIPAgent) processRequest(reqProcessor *config.RequestProcessor,
if err = agReq.SetFields(reqProcessor.RequestFields); err != nil {
return
}
- cgrEv := utils.NMAsCGREvent(agReq.CGRRequest, agReq.Tenant, utils.NestingSep, agReq.Opts)
+ cgrEv := engine.NMAsCGREvent(agReq.CGRRequest, agReq.Tenant, utils.NestingSep, agReq.Opts)
var reqType string
for _, typ := range []string{
utils.MetaDryRun, utils.MetaAuthorize, /*
@@ -400,7 +400,7 @@ func (sa *SIPAgent) processRequest(reqProcessor *config.RequestProcessor,
if reqType == utils.MetaAuthorize ||
reqType == utils.MetaMessage ||
reqType == utils.MetaEvent {
- if cgrArgs, err = utils.GetRoutePaginatorFromOpts(cgrEv.APIOpts); err != nil {
+ if cgrArgs, err = engine.GetRoutePaginatorFromOpts(cgrEv.APIOpts); err != nil {
utils.Logger.Warning(fmt.Sprintf("<%s> args extraction failed because <%s>",
utils.SIPAgent, err.Error()))
err = nil // reset the error and continue the processing
diff --git a/analyzers/analyzers_it_test.go b/analyzers/analyzers_it_test.go
index bde2a1714..2ddfde18e 100644
--- a/analyzers/analyzers_it_test.go
+++ b/analyzers/analyzers_it_test.go
@@ -149,7 +149,7 @@ func testAnalyzerSLoadTarrifPlans(t *testing.T) {
}
func testAnalyzerSChargerSv1ProcessEvent(t *testing.T) {
- cgrEv := &utils.CGREvent{
+ cgrEv := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -164,7 +164,7 @@ func testAnalyzerSChargerSv1ProcessEvent(t *testing.T) {
{
ChargerSProfile: "DEFAULT",
AlteredFields: []string{"*req.RunID"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -180,7 +180,7 @@ func testAnalyzerSChargerSv1ProcessEvent(t *testing.T) {
ChargerSProfile: "Raw",
AttributeSProfiles: []string{"*constant:*req.RequestType:*none"},
AlteredFields: []string{"*req.RunID", "*req.RequestType"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
diff --git a/analyzers/analyzers_test.go b/analyzers/analyzers_test.go
index 463ef4bc0..c9a66247d 100644
--- a/analyzers/analyzers_test.go
+++ b/analyzers/analyzers_test.go
@@ -200,7 +200,7 @@ func TestAnalyzersV1Search(t *testing.T) {
// generate trafic
t1 := time.Now()
if err = anz.logTrafic(0, utils.CoreSv1Ping,
- &utils.CGREvent{
+ &engine.CGREvent{
APIOpts: map[string]any{
utils.EventSource: utils.MetaCDRs,
},
@@ -210,7 +210,7 @@ func TestAnalyzersV1Search(t *testing.T) {
}
if err = anz.logTrafic(1, utils.CoreSv1Ping,
- &utils.CGREvent{
+ &engine.CGREvent{
APIOpts: map[string]any{
utils.EventSource: utils.MetaAttributes,
},
@@ -222,7 +222,7 @@ func TestAnalyzersV1Search(t *testing.T) {
}
if err = anz.logTrafic(2, utils.CoreSv1Ping,
- &utils.CGREvent{
+ &engine.CGREvent{
APIOpts: map[string]any{
utils.EventSource: utils.MetaAttributes,
},
@@ -234,7 +234,7 @@ func TestAnalyzersV1Search(t *testing.T) {
}
if err = anz.logTrafic(3, utils.CoreSv1Ping,
- &utils.CGREvent{
+ &engine.CGREvent{
APIOpts: map[string]any{
utils.EventSource: utils.MetaAttributes,
},
@@ -245,7 +245,7 @@ func TestAnalyzersV1Search(t *testing.T) {
t.Fatal(err)
}
if err = anz.logTrafic(3, utils.CoreSv1Status,
- &utils.CGREvent{
+ &engine.CGREvent{
APIOpts: map[string]any{
utils.EventSource: utils.MetaEEs,
},
diff --git a/apier/v1/analyzer.go b/apier/v1/analyzer.go
index 7b4ab17d5..10f4d11db 100644
--- a/apier/v1/analyzer.go
+++ b/apier/v1/analyzer.go
@@ -21,6 +21,7 @@ package v1
import (
"github.com/cgrates/birpc/context"
"github.com/cgrates/cgrates/analyzers"
+ "github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
@@ -41,7 +42,7 @@ func (aSv1 *AnalyzerSv1) Call(ctx *context.Context, serviceMethod string,
}
// Ping return pong if the service is active
-func (aSv1 *AnalyzerSv1) Ping(ctx *context.Context, ign *utils.CGREvent, reply *string) error {
+func (aSv1 *AnalyzerSv1) Ping(ctx *context.Context, ign *engine.CGREvent, reply *string) error {
*reply = utils.Pong
return nil
}
diff --git a/apier/v1/api_interfaces.go b/apier/v1/api_interfaces.go
index de4d3e720..a3158753a 100644
--- a/apier/v1/api_interfaces.go
+++ b/apier/v1/api_interfaces.go
@@ -32,48 +32,48 @@ import (
type ThresholdSv1Interface interface {
GetThresholdIDs(ctx *context.Context, tenant *utils.TenantWithAPIOpts, tIDs *[]string) error
- GetThresholdsForEvent(ctx *context.Context, args *utils.CGREvent, reply *engine.Thresholds) error
+ GetThresholdsForEvent(ctx *context.Context, args *engine.CGREvent, reply *engine.Thresholds) error
GetThreshold(ctx *context.Context, tntID *utils.TenantIDWithAPIOpts, t *engine.Threshold) error
- ProcessEvent(ctx *context.Context, args *utils.CGREvent, tIDs *[]string) error
- Ping(ctx *context.Context, ign *utils.CGREvent, reply *string) error
+ ProcessEvent(ctx *context.Context, args *engine.CGREvent, tIDs *[]string) error
+ Ping(ctx *context.Context, ign *engine.CGREvent, reply *string) error
}
type StatSv1Interface interface {
GetQueueIDs(ctx *context.Context, tenant *utils.TenantWithAPIOpts, qIDs *[]string) error
- ProcessEvent(ctx *context.Context, args *utils.CGREvent, reply *[]string) error
- GetStatQueuesForEvent(ctx *context.Context, args *utils.CGREvent, reply *[]string) (err error)
+ ProcessEvent(ctx *context.Context, args *engine.CGREvent, reply *[]string) error
+ GetStatQueuesForEvent(ctx *context.Context, args *engine.CGREvent, reply *[]string) (err error)
GetQueueStringMetrics(ctx *context.Context, args *utils.TenantIDWithAPIOpts, reply *map[string]string) (err error)
GetQueueFloatMetrics(ctx *context.Context, args *utils.TenantIDWithAPIOpts, reply *map[string]float64) (err error)
- Ping(ctx *context.Context, ign *utils.CGREvent, reply *string) error
+ Ping(ctx *context.Context, ign *engine.CGREvent, reply *string) error
}
type ResourceSv1Interface interface {
- GetResourcesForEvent(ctx *context.Context, args *utils.CGREvent, reply *engine.Resources) error
- AuthorizeResources(ctx *context.Context, args *utils.CGREvent, reply *string) error
- AllocateResources(ctx *context.Context, args *utils.CGREvent, reply *string) error
- ReleaseResources(ctx *context.Context, args *utils.CGREvent, reply *string) error
+ GetResourcesForEvent(ctx *context.Context, args *engine.CGREvent, reply *engine.Resources) error
+ AuthorizeResources(ctx *context.Context, args *engine.CGREvent, reply *string) error
+ AllocateResources(ctx *context.Context, args *engine.CGREvent, reply *string) error
+ ReleaseResources(ctx *context.Context, args *engine.CGREvent, reply *string) error
GetResource(ctx *context.Context, args *utils.TenantIDWithAPIOpts, reply *engine.Resource) error
GetResourceWithConfig(ctx *context.Context, args *utils.TenantIDWithAPIOpts, reply *engine.ResourceWithConfig) error
- Ping(ctx *context.Context, ign *utils.CGREvent, reply *string) error
+ Ping(ctx *context.Context, ign *engine.CGREvent, reply *string) error
}
type RouteSv1Interface interface {
- GetRoutes(ctx *context.Context, args *utils.CGREvent, reply *engine.SortedRoutesList) error
- GetRouteProfilesForEvent(ctx *context.Context, args *utils.CGREvent, reply *[]*engine.RouteProfile) error
- GetRoutesList(ctx *context.Context, args *utils.CGREvent, reply *[]string) error
- Ping(ctx *context.Context, ign *utils.CGREvent, reply *string) error
+ GetRoutes(ctx *context.Context, args *engine.CGREvent, reply *engine.SortedRoutesList) error
+ GetRouteProfilesForEvent(ctx *context.Context, args *engine.CGREvent, reply *[]*engine.RouteProfile) error
+ GetRoutesList(ctx *context.Context, args *engine.CGREvent, reply *[]string) error
+ Ping(ctx *context.Context, ign *engine.CGREvent, reply *string) error
}
type AttributeSv1Interface interface {
- GetAttributeForEvent(ctx *context.Context, args *utils.CGREvent, reply *engine.AttributeProfile) (err error)
- ProcessEvent(ctx *context.Context, args *utils.CGREvent, reply *engine.AttrSProcessEventReply) error
- Ping(ctx *context.Context, ign *utils.CGREvent, reply *string) error
+ GetAttributeForEvent(ctx *context.Context, args *engine.CGREvent, reply *engine.AttributeProfile) (err error)
+ ProcessEvent(ctx *context.Context, args *engine.CGREvent, reply *engine.AttrSProcessEventReply) error
+ Ping(ctx *context.Context, ign *engine.CGREvent, reply *string) error
}
type ChargerSv1Interface interface {
- Ping(ctx *context.Context, ign *utils.CGREvent, reply *string) error
- GetChargersForEvent(ctx *context.Context, cgrEv *utils.CGREvent, reply *engine.ChargerProfiles) error
- ProcessEvent(ctx *context.Context, args *utils.CGREvent, reply *[]*engine.ChrgSProcessEventReply) error
+ Ping(ctx *context.Context, ign *engine.CGREvent, reply *string) error
+ GetChargersForEvent(ctx *context.Context, cgrEv *engine.CGREvent, reply *engine.ChargerProfiles) error
+ ProcessEvent(ctx *context.Context, args *engine.CGREvent, reply *[]*engine.ChrgSProcessEventReply) error
}
type SessionSv1Interface interface {
@@ -84,7 +84,7 @@ type SessionSv1Interface interface {
UpdateSession(ctx *context.Context, args *sessions.V1UpdateSessionArgs, rply *sessions.V1UpdateSessionReply) error
SyncSessions(ctx *context.Context, args *utils.TenantWithAPIOpts, rply *string) error
TerminateSession(ctx *context.Context, args *sessions.V1TerminateSessionArgs, rply *string) error
- ProcessCDR(ctx *context.Context, cgrEv *utils.CGREvent, rply *string) error
+ ProcessCDR(ctx *context.Context, cgrEv *engine.CGREvent, rply *string) error
ProcessMessage(ctx *context.Context, args *sessions.V1ProcessMessageArgs, rply *sessions.V1ProcessMessageReply) error
ProcessEvent(ctx *context.Context, args *sessions.V1ProcessEventArgs, rply *sessions.V1ProcessEventReply) error
GetCost(ctx *context.Context, args *sessions.V1ProcessEventArgs, rply *sessions.V1GetCostReply) error
@@ -93,7 +93,7 @@ type SessionSv1Interface interface {
ForceDisconnect(ctx *context.Context, args *utils.SessionFilter, rply *string) error
GetPassiveSessions(ctx *context.Context, args *utils.SessionFilter, rply *[]*sessions.ExternalSession) error
GetPassiveSessionsCount(ctx *context.Context, args *utils.SessionFilter, rply *int) error
- Ping(ctx *context.Context, ign *utils.CGREvent, reply *string) error
+ Ping(ctx *context.Context, ign *engine.CGREvent, reply *string) error
ReplicateSessions(ctx *context.Context, args *dispatchers.ArgsReplicateSessionsWithAPIOpts, rply *string) error
SetPassiveSession(ctx *context.Context, args *sessions.Session, reply *string) error
ActivateSessions(ctx *context.Context, args *utils.SessionIDsWithArgsDispatcher, reply *string) error
@@ -113,7 +113,7 @@ type ResponderInterface interface {
GetCostOnRatingPlans(ctx *context.Context, arg *utils.GetCostOnRatingPlansArgs, reply *map[string]any) (err error)
GetMaxSessionTimeOnAccounts(ctx *context.Context, arg *utils.GetMaxSessionTimeOnAccountsArgs, reply *map[string]any) (err error)
Shutdown(ctx *context.Context, arg *utils.TenantWithAPIOpts, reply *string) (err error)
- Ping(ctx *context.Context, ign *utils.CGREvent, reply *string) error
+ Ping(ctx *context.Context, ign *engine.CGREvent, reply *string) error
}
type CacheSv1Interface interface {
@@ -132,18 +132,18 @@ type CacheSv1Interface interface {
LoadCache(ctx *context.Context, args *utils.AttrReloadCacheWithAPIOpts, reply *string) error
ReplicateSet(ctx *context.Context, args *utils.ArgCacheReplicateSet, reply *string) (err error)
ReplicateRemove(ctx *context.Context, args *utils.ArgCacheReplicateRemove, reply *string) (err error)
- Ping(ctx *context.Context, ign *utils.CGREvent, reply *string) error
+ Ping(ctx *context.Context, ign *engine.CGREvent, reply *string) error
}
type GuardianSv1Interface interface {
RemoteLock(ctx *context.Context, attr *dispatchers.AttrRemoteLockWithAPIOpts, reply *string) (err error)
RemoteUnlock(ctx *context.Context, refID *dispatchers.AttrRemoteUnlockWithAPIOpts, reply *[]string) (err error)
- Ping(ctx *context.Context, ign *utils.CGREvent, reply *string) error
+ Ping(ctx *context.Context, ign *engine.CGREvent, reply *string) error
}
type SchedulerSv1Interface interface {
- Reload(ctx *context.Context, arg *utils.CGREvent, reply *string) error
- Ping(ctx *context.Context, ign *utils.CGREvent, reply *string) error
+ Reload(ctx *context.Context, arg *engine.CGREvent, reply *string) error
+ Ping(ctx *context.Context, ign *engine.CGREvent, reply *string) error
ExecuteActions(ctx *context.Context, attr *utils.AttrsExecuteActions, reply *string) error
ExecuteActionPlans(ctx *context.Context, attr *utils.AttrsExecuteActionPlans, reply *string) error
}
@@ -156,19 +156,19 @@ type CDRsV1Interface interface {
StoreSessionCost(ctx *context.Context, attr *engine.AttrCDRSStoreSMCost, reply *string) error
GetCDRsCount(ctx *context.Context, args *utils.RPCCDRsFilterWithAPIOpts, reply *int64) error
GetCDRs(ctx *context.Context, args *utils.RPCCDRsFilterWithAPIOpts, reply *[]*engine.CDR) error
- Ping(ctx *context.Context, ign *utils.CGREvent, reply *string) error
+ Ping(ctx *context.Context, ign *engine.CGREvent, reply *string) error
}
type ServiceManagerV1Interface interface {
StartService(ctx *context.Context, args *dispatchers.ArgStartServiceWithAPIOpts, reply *string) error
StopService(ctx *context.Context, args *dispatchers.ArgStartServiceWithAPIOpts, reply *string) error
ServiceStatus(ctx *context.Context, args *dispatchers.ArgStartServiceWithAPIOpts, reply *string) error
- Ping(ctx *context.Context, ign *utils.CGREvent, reply *string) error
+ Ping(ctx *context.Context, ign *engine.CGREvent, reply *string) error
}
type RALsV1Interface interface {
GetRatingPlansCost(ctx *context.Context, arg *utils.RatingPlanCostArg, reply *dispatchers.RatingPlanCost) error
- Ping(ctx *context.Context, ign *utils.CGREvent, reply *string) error
+ Ping(ctx *context.Context, ign *engine.CGREvent, reply *string) error
}
type ConfigSv1Interface interface {
@@ -181,12 +181,12 @@ type ConfigSv1Interface interface {
type CoreSv1Interface interface {
Status(ctx *context.Context, arg *utils.TenantWithAPIOpts, reply *map[string]any) error
- Ping(ctx *context.Context, ign *utils.CGREvent, reply *string) error
+ Ping(ctx *context.Context, ign *engine.CGREvent, reply *string) error
Sleep(ctx *context.Context, arg *utils.DurationArgs, reply *string) error
}
type ReplicatorSv1Interface interface {
- Ping(ctx *context.Context, ign *utils.CGREvent, reply *string) error
+ Ping(ctx *context.Context, ign *engine.CGREvent, reply *string) error
GetAccount(ctx *context.Context, args *utils.StringWithAPIOpts, reply *engine.Account) error
GetDestination(ctx *context.Context, key *utils.StringWithAPIOpts, reply *engine.Destination) error
GetReverseDestination(ctx *context.Context, key *utils.StringWithAPIOpts, reply *[]string) error
diff --git a/apier/v1/apier.go b/apier/v1/apier.go
index 6941ed54b..5d3282dd0 100644
--- a/apier/v1/apier.go
+++ b/apier/v1/apier.go
@@ -1566,7 +1566,7 @@ func (apierSv1 *APIerSv1) ListenAndServe(stopChan chan struct{}) {
}
// Ping return pong if the service is active
-func (apierSv1 *APIerSv1) Ping(ctx *context.Context, ign *utils.CGREvent, reply *string) error {
+func (apierSv1 *APIerSv1) Ping(ctx *context.Context, ign *engine.CGREvent, reply *string) error {
*reply = utils.Pong
return nil
}
diff --git a/apier/v1/apier2_it_test.go b/apier/v1/apier2_it_test.go
index 1ea57ec0e..dea929150 100644
--- a/apier/v1/apier2_it_test.go
+++ b/apier/v1/apier2_it_test.go
@@ -155,7 +155,7 @@ func testAPIerLoadFromFolder(t *testing.T) {
}
func testAPIerVerifyAttributesAfterLoad(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAPIerAfterDelete",
Event: map[string]any{
@@ -231,7 +231,7 @@ func testAPIerAfterDelete(t *testing.T) {
}
func testAPIerVerifyAttributesAfterDelete(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAPIerAfterDelete",
Event: map[string]any{
diff --git a/apier/v1/apier_it_test.go b/apier/v1/apier_it_test.go
index db8c7a36a..e31e4e9fb 100644
--- a/apier/v1/apier_it_test.go
+++ b/apier/v1/apier_it_test.go
@@ -2289,7 +2289,7 @@ func testApierGetStorDBVesions(t *testing.T) {
func testApierBackwardsCompatible(t *testing.T) {
var reply string
- if err := rater.Call(context.Background(), "ApierV1.Ping", new(utils.CGREvent), &reply); err != nil {
+ if err := rater.Call(context.Background(), "ApierV1.Ping", new(engine.CGREvent), &reply); err != nil {
t.Error(err)
} else if reply != utils.Pong {
t.Errorf("Expecting : %+v, received: %+v", utils.Pong, reply)
diff --git a/apier/v1/attributes.go b/apier/v1/attributes.go
index e047a7372..59a79baa2 100644
--- a/apier/v1/attributes.go
+++ b/apier/v1/attributes.go
@@ -175,19 +175,19 @@ func (alSv1 *AttributeSv1) Call(ctx *context.Context, serviceMethod string,
}
// GetAttributeForEvent returns matching AttributeProfile for Event
-func (alSv1 *AttributeSv1) GetAttributeForEvent(ctx *context.Context, args *utils.CGREvent,
+func (alSv1 *AttributeSv1) GetAttributeForEvent(ctx *context.Context, args *engine.CGREvent,
reply *engine.AttributeProfile) (err error) {
return alSv1.attrS.V1GetAttributeForEvent(ctx, args, reply)
}
// ProcessEvent will replace event fields with the ones in matching AttributeProfile
-func (alSv1 *AttributeSv1) ProcessEvent(ctx *context.Context, args *utils.CGREvent,
+func (alSv1 *AttributeSv1) ProcessEvent(ctx *context.Context, args *engine.CGREvent,
reply *engine.AttrSProcessEventReply) error {
return alSv1.attrS.V1ProcessEvent(ctx, args, reply)
}
// Ping return pong if the service is active
-func (alSv1 *AttributeSv1) Ping(ctx *context.Context, ign *utils.CGREvent, reply *string) error {
+func (alSv1 *AttributeSv1) Ping(ctx *context.Context, ign *engine.CGREvent, reply *string) error {
*reply = utils.Pong
return nil
}
diff --git a/apier/v1/attributes_it_test.go b/apier/v1/attributes_it_test.go
index 4f842c6dc..060dcbb9c 100644
--- a/apier/v1/attributes_it_test.go
+++ b/apier/v1/attributes_it_test.go
@@ -184,7 +184,7 @@ func testAttributeSLoadFromFolder(t *testing.T) {
}
func testAttributeSGetAttributeForEvent(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSGetAttributeForEvent",
Event: map[string]any{
@@ -249,7 +249,7 @@ func testAttributeSGetAttributeForEvent(t *testing.T) {
}
func testAttributeSGetAttributeForEventNotFound(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSGetAttributeForEventWihMetaAnyContext",
Event: map[string]any{
@@ -301,7 +301,7 @@ func testAttributeSGetAttributeForEventNotFound(t *testing.T) {
}
func testAttributeSGetAttributeForEventWithMetaAnyContext(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSGetAttributeForEventWihMetaAnyContext",
Event: map[string]any{
@@ -357,7 +357,7 @@ func testAttributeSGetAttributeForEventWithMetaAnyContext(t *testing.T) {
}
func testAttributeSProcessEvent(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEvent",
Event: map[string]any{
@@ -372,7 +372,7 @@ func testAttributeSProcessEvent(t *testing.T) {
MatchedProfiles: []string{"cgrates.org:ATTR_1"},
AlteredFields: []string{utils.MetaReq + utils.NestingSep + utils.AccountField,
utils.MetaReq + utils.NestingSep + utils.Subject},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEvent",
Event: map[string]any{
@@ -415,7 +415,7 @@ func testAttributeSProcessEvent(t *testing.T) {
}
func testAttributeSProcessEventNotFound(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEventNotFound",
Event: map[string]any{
@@ -435,7 +435,7 @@ func testAttributeSProcessEventNotFound(t *testing.T) {
}
func testAttributeSProcessEventMissing(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEvent",
Event: map[string]any{
@@ -456,7 +456,7 @@ func testAttributeSProcessEventMissing(t *testing.T) {
}
func testAttributeSProcessEventWithNoneSubstitute(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSWithNoneSubstitute",
Event: map[string]any{
@@ -502,7 +502,7 @@ func testAttributeSProcessEventWithNoneSubstitute(t *testing.T) {
MatchedProfiles: []string{"cgrates.org:AttributeWithNonSubstitute"},
AlteredFields: []string{utils.MetaReq + utils.NestingSep + utils.AccountField,
utils.MetaReq + utils.NestingSep + utils.Subject},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSWithNoneSubstitute",
Event: map[string]any{
@@ -528,7 +528,7 @@ func testAttributeSProcessEventWithNoneSubstitute(t *testing.T) {
}
func testAttributeSProcessEventWithNoneSubstitute2(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSWithNoneSubstitute",
Event: map[string]any{
@@ -573,7 +573,7 @@ func testAttributeSProcessEventWithNoneSubstitute2(t *testing.T) {
eRply := &engine.AttrSProcessEventReply{
MatchedProfiles: []string{"cgrates.org:AttributeWithNonSubstitute"},
AlteredFields: []string{"*req.Account", "*req.Subject"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSWithNoneSubstitute",
Event: map[string]any{
@@ -589,7 +589,7 @@ func testAttributeSProcessEventWithNoneSubstitute2(t *testing.T) {
MatchedProfiles: []string{"cgrates.org:AttributeWithNonSubstitute"},
AlteredFields: []string{utils.MetaReq + utils.NestingSep + utils.Subject,
utils.MetaReq + utils.NestingSep + utils.AccountField},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSWithNoneSubstitute",
Event: map[string]any{
@@ -613,7 +613,7 @@ func testAttributeSProcessEventWithNoneSubstitute2(t *testing.T) {
}
func testAttributeSProcessEventWithNoneSubstitute3(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSWithNoneSubstitute",
Event: map[string]any{
@@ -659,7 +659,7 @@ func testAttributeSProcessEventWithNoneSubstitute3(t *testing.T) {
eRply := &engine.AttrSProcessEventReply{
MatchedProfiles: []string{"cgrates.org:AttributeWithNonSubstitute"},
AlteredFields: []string{"*req.Account"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSWithNoneSubstitute",
Event: map[string]any{
@@ -708,7 +708,7 @@ func testAttributeSProcessEventWithHeader(t *testing.T) {
} else if result != utils.OK {
t.Error("Unexpected reply returned", result)
}
- attrArgs := &utils.CGREvent{
+ attrArgs := &engine.CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: "HeaderEventForAttribute",
Event: map[string]any{
@@ -722,7 +722,7 @@ func testAttributeSProcessEventWithHeader(t *testing.T) {
eRply := &engine.AttrSProcessEventReply{
MatchedProfiles: []string{"cgrates.org:ATTR_Header"},
AlteredFields: []string{"*req.Field2"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: "HeaderEventForAttribute",
Event: map[string]any{
@@ -817,7 +817,7 @@ func testAttributeSProcessEventWithHeader(t *testing.T) {
// t.Errorf("Expecting : %+v, received: %+v", alsPrf.AttributeProfile, reply)
// }
-// attrArgs := &utils.CGREvent{
+// attrArgs := &engine.CGREvent{
// Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
// ID: "HAttribute",
// Event: map[string]any{
@@ -832,7 +832,7 @@ func testAttributeSProcessEventWithHeader(t *testing.T) {
// eRply := &engine.AttrSProcessEventReply{
// MatchedProfiles: []string{"cgrates.org:ATTR_SENTRY_IP"},
// AlteredFields: []string{"*req.IP"},
-// CGREvent: &utils.CGREvent{
+// CGREvent: &engine.CGREvent{
// Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
// ID: "HAttribute",
// Event: map[string]any{
@@ -1112,7 +1112,7 @@ func testAttributeSSetAlsPrf4(t *testing.T) {
func testAttributeSPing(t *testing.T) {
var resp string
- if err := attrSRPC.Call(context.Background(), utils.AttributeSv1Ping, new(utils.CGREvent), &resp); err != nil {
+ if err := attrSRPC.Call(context.Background(), utils.AttributeSv1Ping, new(engine.CGREvent), &resp); err != nil {
t.Error(err)
} else if resp != utils.Pong {
t.Error("Unexpected reply returned", resp)
@@ -1145,7 +1145,7 @@ func testAttributeSProcessEventWithSearchAndReplace(t *testing.T) {
} else if result != utils.OK {
t.Error("Unexpected reply returned", result)
}
- attrArgs := &utils.CGREvent{
+ attrArgs := &engine.CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: "HeaderEventForAttribute",
Event: map[string]any{
@@ -1159,7 +1159,7 @@ func testAttributeSProcessEventWithSearchAndReplace(t *testing.T) {
eRply := &engine.AttrSProcessEventReply{
MatchedProfiles: []string{"cgrates.org:ATTR_Search_and_replace"},
AlteredFields: []string{"*req.Category"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: "HeaderEventForAttribute",
Event: map[string]any{
@@ -1253,7 +1253,7 @@ func testAttributeSProcessWithMultipleRuns(t *testing.T) {
} else if result != utils.OK {
t.Error("Unexpected reply returned", result)
}
- attrArgs := &utils.CGREvent{
+ attrArgs := &engine.CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]any{
@@ -1267,7 +1267,7 @@ func testAttributeSProcessWithMultipleRuns(t *testing.T) {
eRply := &engine.AttrSProcessEventReply{
MatchedProfiles: []string{"cgrates.org:ATTR_1", "cgrates.org:ATTR_2", "cgrates.org:ATTR_1", "cgrates.org:ATTR_2"},
AlteredFields: []string{"*req.Field1", "*req.Field2"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]any{
@@ -1368,7 +1368,7 @@ func testAttributeSProcessWithMultipleRuns2(t *testing.T) {
} else if result != utils.OK {
t.Error("Unexpected reply returned", result)
}
- attrArgs := &utils.CGREvent{
+ attrArgs := &engine.CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]any{
@@ -1382,7 +1382,7 @@ func testAttributeSProcessWithMultipleRuns2(t *testing.T) {
eRply := &engine.AttrSProcessEventReply{
MatchedProfiles: []string{"cgrates.org:ATTR_1", "cgrates.org:ATTR_2", "cgrates.org:ATTR_3", "cgrates.org:ATTR_2"},
AlteredFields: []string{"*req.Field1", "*req.Field2", "*req.Field3"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]any{
@@ -2108,7 +2108,7 @@ func testAttributeSRmvAlsPrfWithoutTenant(t *testing.T) {
}
func testAttributeSCacheTestProcessEventNotFound(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.AccountField: "1007",
@@ -2127,7 +2127,7 @@ func testAttributeSCacheTestProcessEventNotFound(t *testing.T) {
}
func testAttributeSCacheTestProcessEventFound(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.AccountField: "1007",
diff --git a/apier/v1/cache_replication_it_test.go b/apier/v1/cache_replication_it_test.go
index 2069a0be0..d65bdf168 100644
--- a/apier/v1/cache_replication_it_test.go
+++ b/apier/v1/cache_replication_it_test.go
@@ -125,7 +125,7 @@ func testCacheSReplicateLoadTariffPlanFromFolder(t *testing.T) {
}
func testCacheSReplicateProcessAttributes(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testCacheSReplicateProcessAttributes",
Event: map[string]any{
@@ -138,7 +138,7 @@ func testCacheSReplicateProcessAttributes(t *testing.T) {
eRply := &engine.AttrSProcessEventReply{
MatchedProfiles: []string{"cgrates.org:ATTR_ACNT_1001"},
AlteredFields: []string{utils.MetaReq + utils.NestingSep + "OfficeGroup"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testCacheSReplicateProcessAttributes",
Event: map[string]any{
diff --git a/apier/v1/caches.go b/apier/v1/caches.go
index 5cab6d0c7..c8bd1c18b 100644
--- a/apier/v1/caches.go
+++ b/apier/v1/caches.go
@@ -124,7 +124,7 @@ func (chSv1 *CacheSv1) LoadCache(ctx *context.Context, args *utils.AttrReloadCac
}
// Ping used to determinate if component is active
-func (chSv1 *CacheSv1) Ping(ctx *context.Context, ign *utils.CGREvent, reply *string) error {
+func (chSv1 *CacheSv1) Ping(ctx *context.Context, ign *engine.CGREvent, reply *string) error {
*reply = utils.Pong
return nil
}
diff --git a/apier/v1/caches_it_test.go b/apier/v1/caches_it_test.go
index 5cdb00ae5..e8a7615fd 100644
--- a/apier/v1/caches_it_test.go
+++ b/apier/v1/caches_it_test.go
@@ -455,7 +455,7 @@ func testCacheSPrecacheStatus(t *testing.T) {
func testCacheSPing(t *testing.T) {
var reply string
expected := utils.Pong
- if err := chcRPC.Call(context.Background(), utils.CacheSv1Ping, &utils.CGREvent{}, &reply); err != nil {
+ if err := chcRPC.Call(context.Background(), utils.CacheSv1Ping, &engine.CGREvent{}, &reply); err != nil {
t.Error(err)
} else if !reflect.DeepEqual(expected, reply) {
t.Errorf("Expected: %v , received:%v", utils.ToJSON(expected), utils.ToJSON(reply))
diff --git a/apier/v1/cdrs.go b/apier/v1/cdrs.go
index 2756e7a99..9e3b5f049 100644
--- a/apier/v1/cdrs.go
+++ b/apier/v1/cdrs.go
@@ -128,7 +128,7 @@ func (cdrSv1 *CDRsV1) GetCDRs(ctx *context.Context, args *utils.RPCCDRsFilterWit
return cdrSv1.CDRs.V1GetCDRs(ctx, *args, reply)
}
-func (cdrSv1 *CDRsV1) Ping(ctx *context.Context, ign *utils.CGREvent, reply *string) error {
+func (cdrSv1 *CDRsV1) Ping(ctx *context.Context, ign *engine.CGREvent, reply *string) error {
*reply = utils.Pong
return nil
}
diff --git a/apier/v1/cdrs_it_test.go b/apier/v1/cdrs_it_test.go
index 60b5a836b..fbfb2b900 100644
--- a/apier/v1/cdrs_it_test.go
+++ b/apier/v1/cdrs_it_test.go
@@ -170,7 +170,7 @@ func testV1CDRsProcessEventWithRefund(t *testing.T) {
}
argsEv := &engine.ArgV1ProcessEvent{
Flags: []string{utils.MetaRALs},
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.RunID: "testv1",
@@ -218,7 +218,7 @@ func testV1CDRsProcessEventWithRefund(t *testing.T) {
}
argsEv = &engine.ArgV1ProcessEvent{
Flags: []string{utils.MetaRALs, utils.MetaRerate},
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.RunID: "testv1",
@@ -364,7 +364,7 @@ func testV1CDRsRefundOutOfSessionCost(t *testing.T) {
argsEv := &engine.ArgV1ProcessEvent{
Flags: []string{utils.MetaRALs},
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.CGRID: "test1",
@@ -428,7 +428,7 @@ func testV1CDRsRefundCDR(t *testing.T) {
argsEv := &engine.ArgV1ProcessEvent{
Flags: []string{utils.MetaRefund},
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.RunID: utils.MetaDefault,
@@ -583,7 +583,7 @@ func testV1CDRsAddBalanceForSMS(t *testing.T) {
argsEv := &engine.ArgV1ProcessEvent{
Flags: []string{utils.MetaRALs},
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.CGRID: "asdfas",
diff --git a/apier/v1/chargers.go b/apier/v1/chargers.go
index e7ff5af91..8780d7ffd 100644
--- a/apier/v1/chargers.go
+++ b/apier/v1/chargers.go
@@ -146,19 +146,19 @@ func (cSv1 *ChargerSv1) Call(ctx *context.Context, serviceMethod string,
return utils.APIerRPCCall(cSv1, serviceMethod, args, reply)
}
-func (cSv1 *ChargerSv1) Ping(ctx *context.Context, ign *utils.CGREvent, reply *string) error {
+func (cSv1 *ChargerSv1) Ping(ctx *context.Context, ign *engine.CGREvent, reply *string) error {
*reply = utils.Pong
return nil
}
// GetChargerForEvent returns matching ChargerProfile for Event
-func (cSv1 *ChargerSv1) GetChargersForEvent(ctx *context.Context, cgrEv *utils.CGREvent,
+func (cSv1 *ChargerSv1) GetChargersForEvent(ctx *context.Context, cgrEv *engine.CGREvent,
reply *engine.ChargerProfiles) error {
return cSv1.cS.V1GetChargersForEvent(ctx, cgrEv, reply)
}
// ProcessEvent
-func (cSv1 *ChargerSv1) ProcessEvent(ctx *context.Context, args *utils.CGREvent,
+func (cSv1 *ChargerSv1) ProcessEvent(ctx *context.Context, args *engine.CGREvent,
reply *[]*engine.ChrgSProcessEventReply) error {
return cSv1.cS.V1ProcessEvent(ctx, args, reply)
}
diff --git a/apier/v1/chargers_it_test.go b/apier/v1/chargers_it_test.go
index bd75cb7b8..a4ccad273 100644
--- a/apier/v1/chargers_it_test.go
+++ b/apier/v1/chargers_it_test.go
@@ -42,7 +42,7 @@ var (
chargerProfile *ChargerWithAPIOpts
chargerConfigDIR string //run tests for specific configuration
- chargerEvent = []*utils.CGREvent{
+ chargerEvent = []*engine.CGREvent{
{
Tenant: "cgrates.org",
ID: "event1",
@@ -303,7 +303,7 @@ func testChargerSGetChargersForEvent(t *testing.T) {
func testChargerSGetChargersForEvent2(t *testing.T) {
var result *engine.ChargerProfiles
if err := chargerRPC.Call(context.Background(), utils.ChargerSv1GetChargersForEvent,
- &utils.CGREvent{ // matching Charger1
+ &engine.CGREvent{ // matching Charger1
Tenant: utils.EmptyString,
ID: "event1",
Event: map[string]any{
@@ -323,7 +323,7 @@ func testChargerSProcessEvent(t *testing.T) {
ChargerSProfile: "Charger1",
AttributeSProfiles: []string{"cgrates.org:ATTR_1001_SIMPLEAUTH"},
AlteredFields: []string{utils.MetaReqRunID, "*req.Password"},
- CGREvent: &utils.CGREvent{ // matching Charger1
+ CGREvent: &engine.CGREvent{ // matching Charger1
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -355,7 +355,7 @@ func testChargerSProcessEvent(t *testing.T) {
ChargerSProfile: "Charger2",
AttributeSProfiles: []string{"*constant:*req.RequestType:*rated;*constant:*req.Category:call"},
AlteredFields: []string{"*req.Category", "*req.RequestType", utils.MetaReqRunID},
- CGREvent: &utils.CGREvent{ // matching Charger1
+ CGREvent: &engine.CGREvent{ // matching Charger1
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -493,7 +493,7 @@ func testChargerSRemChargerProfile(t *testing.T) {
func testChargerSPing(t *testing.T) {
var resp string
- if err := chargerRPC.Call(context.Background(), utils.ChargerSv1Ping, new(utils.CGREvent), &resp); err != nil {
+ if err := chargerRPC.Call(context.Background(), utils.ChargerSv1Ping, new(engine.CGREvent), &resp); err != nil {
t.Error(err)
} else if resp != utils.Pong {
t.Error("Unexpected reply returned", resp)
@@ -521,7 +521,7 @@ func testChargerSProcessWithNotFoundAttribute(t *testing.T) {
t.Error("Unexpected reply returned", result)
}
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "CustomEvent",
Event: map[string]any{
@@ -534,7 +534,7 @@ func testChargerSProcessWithNotFoundAttribute(t *testing.T) {
ChargerSProfile: "ChargerWithoutAttribute",
AttributeSProfiles: []string{},
AlteredFields: []string{utils.MetaReqRunID},
- CGREvent: &utils.CGREvent{ // matching ChargerWithoutAttribute
+ CGREvent: &engine.CGREvent{ // matching ChargerWithoutAttribute
Tenant: "cgrates.org",
ID: "CustomEvent",
Event: map[string]any{
@@ -600,7 +600,7 @@ func testChargerSProccessEventWithProcceSRunS(t *testing.T) {
ChargerSProfile: "ApierTest",
AttributeSProfiles: []string{"*constant:*req.Account:1002"},
AlteredFields: []string{utils.MetaReqRunID, "*req.Account"},
- CGREvent: &utils.CGREvent{ // matching Charger1
+ CGREvent: &engine.CGREvent{ // matching Charger1
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -615,7 +615,7 @@ func testChargerSProccessEventWithProcceSRunS(t *testing.T) {
},
},
}
- cgrEv := &utils.CGREvent{ // matching Charger1
+ cgrEv := &engine.CGREvent{ // matching Charger1
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
diff --git a/apier/v1/core.go b/apier/v1/core.go
index 70d5ded8a..cd8737021 100644
--- a/apier/v1/core.go
+++ b/apier/v1/core.go
@@ -21,6 +21,7 @@ package v1
import (
"github.com/cgrates/birpc/context"
"github.com/cgrates/cgrates/cores"
+ "github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
@@ -44,7 +45,7 @@ func (cS *CoreSv1) Status(ctx *context.Context, arg *utils.TenantWithAPIOpts, re
}
// Ping used to determinate if component is active
-func (cS *CoreSv1) Ping(ctx *context.Context, ign *utils.CGREvent, reply *string) error {
+func (cS *CoreSv1) Ping(ctx *context.Context, ign *engine.CGREvent, reply *string) error {
*reply = utils.Pong
return nil
}
diff --git a/apier/v1/costs.go b/apier/v1/costs.go
index 04128c443..8fd6c3964 100644
--- a/apier/v1/costs.go
+++ b/apier/v1/costs.go
@@ -117,7 +117,7 @@ func (apierSv1 *APIerSv1) GetDataCost(ctx *context.Context, attrs *AttrGetDataCo
}
// GetAccountCost returns a simulated cost of an account without debiting from it (dryrun)
-func (apierSv1 *APIerSv1) GetAccountCost(ctx *context.Context, args *utils.CGREvent, ec *engine.EventCost) (err error) {
+func (apierSv1 *APIerSv1) GetAccountCost(ctx *context.Context, args *engine.CGREvent, ec *engine.EventCost) (err error) {
cd, err := engine.NewCallDescriptorFromCGREvent(args, apierSv1.Config.GeneralCfg().DefaultTimezone)
if err != nil {
return
diff --git a/apier/v1/dispatcher.go b/apier/v1/dispatcher.go
index eb880f621..a906f4321 100644
--- a/apier/v1/dispatcher.go
+++ b/apier/v1/dispatcher.go
@@ -246,18 +246,18 @@ type DispatcherThresholdSv1 struct {
}
// Ping implements ThresholdSv1Ping
-func (dT *DispatcherThresholdSv1) Ping(ctx *context.Context, args *utils.CGREvent, reply *string) error {
+func (dT *DispatcherThresholdSv1) Ping(ctx *context.Context, args *engine.CGREvent, reply *string) error {
return dT.dS.ThresholdSv1Ping(ctx, args, reply)
}
// GetThresholdsForEvent implements ThresholdSv1GetThresholdsForEvent
-func (dT *DispatcherThresholdSv1) GetThresholdsForEvent(ctx *context.Context, tntID *utils.CGREvent,
+func (dT *DispatcherThresholdSv1) GetThresholdsForEvent(ctx *context.Context, tntID *engine.CGREvent,
t *engine.Thresholds) error {
return dT.dS.ThresholdSv1GetThresholdsForEvent(ctx, tntID, t)
}
// ProcessEvent implements ThresholdSv1ProcessEvent
-func (dT *DispatcherThresholdSv1) ProcessEvent(ctx *context.Context, args *utils.CGREvent,
+func (dT *DispatcherThresholdSv1) ProcessEvent(ctx *context.Context, args *engine.CGREvent,
tIDs *[]string) error {
return dT.dS.ThresholdSv1ProcessEvent(ctx, args, tIDs)
}
@@ -282,12 +282,12 @@ type DispatcherStatSv1 struct {
}
// Ping implements StatSv1Ping
-func (dSts *DispatcherStatSv1) Ping(ctx *context.Context, args *utils.CGREvent, reply *string) error {
+func (dSts *DispatcherStatSv1) Ping(ctx *context.Context, args *engine.CGREvent, reply *string) error {
return dSts.dS.StatSv1Ping(ctx, args, reply)
}
// GetStatQueuesForEvent implements StatSv1GetStatQueuesForEvent
-func (dSts *DispatcherStatSv1) GetStatQueuesForEvent(ctx *context.Context, args *utils.CGREvent, reply *[]string) error {
+func (dSts *DispatcherStatSv1) GetStatQueuesForEvent(ctx *context.Context, args *engine.CGREvent, reply *[]string) error {
return dSts.dS.StatSv1GetStatQueuesForEvent(ctx, args, reply)
}
@@ -308,7 +308,7 @@ func (dSts *DispatcherStatSv1) GetQueueIDs(ctx *context.Context, args *utils.Ten
}
// GetQueueStringMetrics implements StatSv1ProcessEvent
-func (dSts *DispatcherStatSv1) ProcessEvent(ctx *context.Context, args *utils.CGREvent, reply *[]string) error {
+func (dSts *DispatcherStatSv1) ProcessEvent(ctx *context.Context, args *engine.CGREvent, reply *[]string) error {
return dSts.dS.StatSv1ProcessEvent(ctx, args, reply)
}
@@ -322,12 +322,12 @@ type DispatcherResourceSv1 struct {
}
// Ping implements ResourceSv1Ping
-func (dRs *DispatcherResourceSv1) Ping(ctx *context.Context, args *utils.CGREvent, reply *string) error {
+func (dRs *DispatcherResourceSv1) Ping(ctx *context.Context, args *engine.CGREvent, reply *string) error {
return dRs.dRs.ResourceSv1Ping(ctx, args, reply)
}
// GetResourcesForEvent implements ResourceSv1GetResourcesForEvent
-func (dRs *DispatcherResourceSv1) GetResourcesForEvent(ctx *context.Context, args *utils.CGREvent,
+func (dRs *DispatcherResourceSv1) GetResourcesForEvent(ctx *context.Context, args *engine.CGREvent,
reply *engine.Resources) error {
return dRs.dRs.ResourceSv1GetResourcesForEvent(ctx, args, reply)
}
@@ -340,17 +340,17 @@ func (dRs *DispatcherResourceSv1) GetResourceWithConfig(ctx *context.Context, ar
return dRs.dRs.ResourceSv1GetResourceWithConfig(ctx, args, reply)
}
-func (dRs *DispatcherResourceSv1) AuthorizeResources(ctx *context.Context, args *utils.CGREvent,
+func (dRs *DispatcherResourceSv1) AuthorizeResources(ctx *context.Context, args *engine.CGREvent,
reply *string) error {
return dRs.dRs.ResourceSv1AuthorizeResources(ctx, args, reply)
}
-func (dRs *DispatcherResourceSv1) AllocateResources(ctx *context.Context, args *utils.CGREvent,
+func (dRs *DispatcherResourceSv1) AllocateResources(ctx *context.Context, args *engine.CGREvent,
reply *string) error {
return dRs.dRs.ResourceSv1AllocateResources(ctx, args, reply)
}
-func (dRs *DispatcherResourceSv1) ReleaseResources(ctx *context.Context, args *utils.CGREvent,
+func (dRs *DispatcherResourceSv1) ReleaseResources(ctx *context.Context, args *engine.CGREvent,
reply *string) error {
return dRs.dRs.ResourceSv1ReleaseResources(ctx, args, reply)
}
@@ -365,22 +365,22 @@ type DispatcherRouteSv1 struct {
}
// Ping implements RouteSv1Ping
-func (dRoute *DispatcherRouteSv1) Ping(ctx *context.Context, args *utils.CGREvent, reply *string) error {
+func (dRoute *DispatcherRouteSv1) Ping(ctx *context.Context, args *engine.CGREvent, reply *string) error {
return dRoute.dRoute.RouteSv1Ping(ctx, args, reply)
}
// GetRoutes implements RouteSv1GetRoutes
-func (dRoute *DispatcherRouteSv1) GetRoutes(ctx *context.Context, args *utils.CGREvent, reply *engine.SortedRoutesList) error {
+func (dRoute *DispatcherRouteSv1) GetRoutes(ctx *context.Context, args *engine.CGREvent, reply *engine.SortedRoutesList) error {
return dRoute.dRoute.RouteSv1GetRoutes(ctx, args, reply)
}
// GetRouteProfilesForEvent returns a list of route profiles that match for Event
-func (dRoute *DispatcherRouteSv1) GetRouteProfilesForEvent(ctx *context.Context, args *utils.CGREvent, reply *[]*engine.RouteProfile) error {
+func (dRoute *DispatcherRouteSv1) GetRouteProfilesForEvent(ctx *context.Context, args *engine.CGREvent, reply *[]*engine.RouteProfile) error {
return dRoute.dRoute.RouteSv1GetRouteProfilesForEvent(ctx, args, reply)
}
// GetRoutesList returns sorted list of routes for Event as a string slice
-func (dRoute *DispatcherRouteSv1) GetRoutesList(ctx *context.Context, args *utils.CGREvent, reply *[]string) error {
+func (dRoute *DispatcherRouteSv1) GetRoutesList(ctx *context.Context, args *engine.CGREvent, reply *[]string) error {
return dRoute.dRoute.RouteSv1GetRoutesList(ctx, args, reply)
}
@@ -394,18 +394,18 @@ type DispatcherAttributeSv1 struct {
}
// Ping implements AttributeSv1Ping
-func (dA *DispatcherAttributeSv1) Ping(ctx *context.Context, args *utils.CGREvent, reply *string) error {
+func (dA *DispatcherAttributeSv1) Ping(ctx *context.Context, args *engine.CGREvent, reply *string) error {
return dA.dA.AttributeSv1Ping(ctx, args, reply)
}
// GetAttributeForEvent implements AttributeSv1GetAttributeForEvent
-func (dA *DispatcherAttributeSv1) GetAttributeForEvent(ctx *context.Context, args *utils.CGREvent,
+func (dA *DispatcherAttributeSv1) GetAttributeForEvent(ctx *context.Context, args *engine.CGREvent,
reply *engine.AttributeProfile) error {
return dA.dA.AttributeSv1GetAttributeForEvent(ctx, args, reply)
}
// ProcessEvent implements AttributeSv1ProcessEvent
-func (dA *DispatcherAttributeSv1) ProcessEvent(ctx *context.Context, args *utils.CGREvent,
+func (dA *DispatcherAttributeSv1) ProcessEvent(ctx *context.Context, args *engine.CGREvent,
reply *engine.AttrSProcessEventReply) error {
return dA.dA.AttributeSv1ProcessEvent(ctx, args, reply)
}
@@ -420,18 +420,18 @@ type DispatcherChargerSv1 struct {
}
// Ping implements ChargerSv1Ping
-func (dC *DispatcherChargerSv1) Ping(ctx *context.Context, args *utils.CGREvent, reply *string) error {
+func (dC *DispatcherChargerSv1) Ping(ctx *context.Context, args *engine.CGREvent, reply *string) error {
return dC.dC.ChargerSv1Ping(ctx, args, reply)
}
// GetChargersForEvent implements ChargerSv1GetChargersForEvent
-func (dC *DispatcherChargerSv1) GetChargersForEvent(ctx *context.Context, args *utils.CGREvent,
+func (dC *DispatcherChargerSv1) GetChargersForEvent(ctx *context.Context, args *engine.CGREvent,
reply *engine.ChargerProfiles) (err error) {
return dC.dC.ChargerSv1GetChargersForEvent(ctx, args, reply)
}
// ProcessEvent implements ChargerSv1ProcessEvent
-func (dC *DispatcherChargerSv1) ProcessEvent(ctx *context.Context, args *utils.CGREvent,
+func (dC *DispatcherChargerSv1) ProcessEvent(ctx *context.Context, args *engine.CGREvent,
reply *[]*engine.ChrgSProcessEventReply) (err error) {
return dC.dC.ChargerSv1ProcessEvent(ctx, args, reply)
}
@@ -446,7 +446,7 @@ type DispatcherSessionSv1 struct {
}
// Ping implements SessionSv1Ping
-func (dS *DispatcherSessionSv1) Ping(ctx *context.Context, args *utils.CGREvent, reply *string) error {
+func (dS *DispatcherSessionSv1) Ping(ctx *context.Context, args *engine.CGREvent, reply *string) error {
return dS.dS.SessionSv1Ping(ctx, args, reply)
}
@@ -474,7 +474,7 @@ func (dS *DispatcherSessionSv1) InitiateSession(ctx *context.Context, args *sess
}
// ProcessCDR implements SessionSv1ProcessCDR
-func (dS *DispatcherSessionSv1) ProcessCDR(ctx *context.Context, args *utils.CGREvent,
+func (dS *DispatcherSessionSv1) ProcessCDR(ctx *context.Context, args *engine.CGREvent,
reply *string) (err error) {
return dS.dS.SessionSv1ProcessCDR(ctx, args, reply)
}
@@ -608,7 +608,7 @@ func (dS *DispatcherResponder) GetMaxSessionTimeOnAccounts(ctx *context.Context,
}
// Ping used to detreminate if component is active
-func (dS *DispatcherResponder) Ping(ctx *context.Context, args *utils.CGREvent, reply *string) error {
+func (dS *DispatcherResponder) Ping(ctx *context.Context, args *engine.CGREvent, reply *string) error {
return dS.dS.ResponderPing(ctx, args, reply)
}
@@ -719,7 +719,7 @@ func (dS *DispatcherCacheSv1) ReplicateRemove(ctx *context.Context, args *utils.
}
// Ping used to determinate if component is active
-func (dS *DispatcherCacheSv1) Ping(ctx *context.Context, args *utils.CGREvent, reply *string) error {
+func (dS *DispatcherCacheSv1) Ping(ctx *context.Context, args *engine.CGREvent, reply *string) error {
return dS.dS.CacheSv1Ping(ctx, args, reply)
}
@@ -743,7 +743,7 @@ func (dS *DispatcherGuardianSv1) RemoteUnlock(ctx *context.Context, attr *dispat
}
// Ping used to detreminate if component is active
-func (dS *DispatcherGuardianSv1) Ping(ctx *context.Context, args *utils.CGREvent, reply *string) error {
+func (dS *DispatcherGuardianSv1) Ping(ctx *context.Context, args *engine.CGREvent, reply *string) error {
return dS.dS.GuardianSv1Ping(ctx, args, reply)
}
@@ -757,12 +757,12 @@ type DispatcherSchedulerSv1 struct {
}
// Reload reloads scheduler instructions
-func (dS *DispatcherSchedulerSv1) Reload(ctx *context.Context, attr *utils.CGREvent, reply *string) (err error) {
+func (dS *DispatcherSchedulerSv1) Reload(ctx *context.Context, attr *engine.CGREvent, reply *string) (err error) {
return dS.dS.SchedulerSv1Reload(ctx, attr, reply)
}
// Ping used to detreminate if component is active
-func (dS *DispatcherSchedulerSv1) Ping(ctx *context.Context, args *utils.CGREvent, reply *string) error {
+func (dS *DispatcherSchedulerSv1) Ping(ctx *context.Context, args *engine.CGREvent, reply *string) error {
return dS.dS.SchedulerSv1Ping(ctx, args, reply)
}
@@ -785,7 +785,7 @@ type DispatcherSv1 struct {
}
// GetProfileForEvent returns the matching dispatcher profile for the provided event
-func (dSv1 DispatcherSv1) GetProfilesForEvent(ctx *context.Context, ev *utils.CGREvent,
+func (dSv1 DispatcherSv1) GetProfilesForEvent(ctx *context.Context, ev *engine.CGREvent,
dPrfl *engine.DispatcherProfiles) error {
return dSv1.dS.DispatcherSv1GetProfilesForEvent(ctx, ev, dPrfl)
}
@@ -794,7 +794,7 @@ func (dS *DispatcherSv1) RemoteStatus(ctx *context.Context, args *utils.TenantWi
return dS.dS.DispatcherSv1RemoteStatus(ctx, args, reply)
}
-func (dS *DispatcherSv1) RemotePing(ctx *context.Context, args *utils.CGREvent, reply *string) (err error) {
+func (dS *DispatcherSv1) RemotePing(ctx *context.Context, args *engine.CGREvent, reply *string) (err error) {
return dS.dS.DispatcherSv1RemotePing(ctx, args, reply)
}
@@ -808,7 +808,7 @@ func (dSv1 DispatcherSv1) Apier(ctx *context.Context,args *utils.MethodParameter
}
*/
-func (rS *DispatcherSv1) Ping(ctx *context.Context, ign *utils.CGREvent, reply *string) error {
+func (rS *DispatcherSv1) Ping(ctx *context.Context, ign *engine.CGREvent, reply *string) error {
*reply = utils.Pong
return nil
}
@@ -823,7 +823,7 @@ type DispatcherSCDRsV1 struct {
}
// Ping used to detreminate if component is active
-func (dS *DispatcherSCDRsV1) Ping(ctx *context.Context, args *utils.CGREvent, reply *string) error {
+func (dS *DispatcherSCDRsV1) Ping(ctx *context.Context, args *engine.CGREvent, reply *string) error {
return dS.dS.CDRsV1Ping(ctx, args, reply)
}
@@ -865,7 +865,7 @@ type DispatcherSServiceManagerV1 struct {
}
// Ping used to detreminate if component is active
-func (dS *DispatcherSServiceManagerV1) Ping(ctx *context.Context, args *utils.CGREvent, reply *string) error {
+func (dS *DispatcherSServiceManagerV1) Ping(ctx *context.Context, args *engine.CGREvent, reply *string) error {
return dS.dS.ServiceManagerV1Ping(ctx, args, reply)
}
func (dS *DispatcherSServiceManagerV1) StartService(ctx *context.Context, args *dispatchers.ArgStartServiceWithAPIOpts, reply *string) error {
@@ -920,7 +920,7 @@ func (dS *DispatcherRALsV1) GetRatingPlansCost(ctx *context.Context, args *utils
}
// Ping used to detreminate if component is active
-func (dS *DispatcherRALsV1) Ping(ctx *context.Context, args *utils.CGREvent, reply *string) error {
+func (dS *DispatcherRALsV1) Ping(ctx *context.Context, args *engine.CGREvent, reply *string) error {
return dS.dS.RALsV1Ping(ctx, args, reply)
}
@@ -937,7 +937,7 @@ func (dS *DispatcherCoreSv1) Status(ctx *context.Context, args *utils.TenantWith
return dS.dS.CoreSv1Status(ctx, args, reply)
}
-func (dS *DispatcherCoreSv1) Ping(ctx *context.Context, args *utils.CGREvent, reply *string) error {
+func (dS *DispatcherCoreSv1) Ping(ctx *context.Context, args *engine.CGREvent, reply *string) error {
return dS.dS.CoreSv1Ping(ctx, args, reply)
}
@@ -974,7 +974,7 @@ func NewDispatcherEeSv1(dps *dispatchers.DispatcherService) *DispatcherEeSv1 {
return &DispatcherEeSv1{dS: dps}
}
-func (dS *DispatcherEeSv1) Ping(ctx *context.Context, args *utils.CGREvent, reply *string) error {
+func (dS *DispatcherEeSv1) Ping(ctx *context.Context, args *engine.CGREvent, reply *string) error {
return dS.dS.EeSv1Ping(ctx, args, reply)
}
@@ -991,7 +991,7 @@ func NewDispatcherReplicatorSv1(dps *dispatchers.DispatcherService) *DispatcherR
}
// Ping used to detreminate if component is active
-func (dS *DispatcherReplicatorSv1) Ping(ctx *context.Context, args *utils.CGREvent, reply *string) error {
+func (dS *DispatcherReplicatorSv1) Ping(ctx *context.Context, args *engine.CGREvent, reply *string) error {
return dS.dS.ReplicatorSv1Ping(ctx, args, reply)
}
diff --git a/apier/v1/dispatchersv1_it_test.go b/apier/v1/dispatchersv1_it_test.go
index 3f9608d23..c44ddc1b9 100644
--- a/apier/v1/dispatchersv1_it_test.go
+++ b/apier/v1/dispatchersv1_it_test.go
@@ -134,7 +134,7 @@ func testDspITLoadData(t *testing.T) {
}
func testDspDspv1GetProfileForEvent(t *testing.T) {
- arg := &utils.CGREvent{
+ arg := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testDspv1",
Event: map[string]any{
@@ -184,7 +184,7 @@ func testDspDspv1GetProfileForEvent(t *testing.T) {
t.Errorf("expected: %s ,\n received: %s", utils.ToJSON(expected), utils.ToJSON(reply[0]))
}
- arg2 := &utils.CGREvent{
+ arg2 := &engine.CGREvent{
ID: "testDspvWithoutTenant",
Event: map[string]any{
utils.EventName: "Event1",
@@ -207,7 +207,7 @@ func testDspDspv1GetProfileForEvent(t *testing.T) {
}
func testDspDspv1GetProfileForEventWithMethod(t *testing.T) {
- arg := &utils.CGREvent{
+ arg := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testDspv2",
Event: map[string]any{},
diff --git a/apier/v1/ees.go b/apier/v1/ees.go
index 91a44d0c1..16e664765 100644
--- a/apier/v1/ees.go
+++ b/apier/v1/ees.go
@@ -33,7 +33,7 @@ type EeSv1 struct {
eeS *ees.EventExporterS
}
-func (eeSv1 *EeSv1) Ping(ctx *context.Context, ign *utils.CGREvent, reply *string) error {
+func (eeSv1 *EeSv1) Ping(ctx *context.Context, ign *engine.CGREvent, reply *string) error {
*reply = utils.Pong
return nil
}
diff --git a/apier/v1/filterindexecache_it_test.go b/apier/v1/filterindexecache_it_test.go
index 28180ae94..a6bb5f4fa 100644
--- a/apier/v1/filterindexecache_it_test.go
+++ b/apier/v1/filterindexecache_it_test.go
@@ -145,7 +145,7 @@ func testV1FIdxCaFromFolder(t *testing.T) {
// ThresholdProfile
func testV1FIdxCaProcessEventWithNotFound(t *testing.T) {
- tEv := &utils.CGREvent{
+ tEv := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -213,7 +213,7 @@ func testV1FIdxCaSetThresholdProfile(t *testing.T) {
t.Error("Unexpected reply returned", result)
}
//matches TEST_PROFILE1
- tEv := &utils.CGREvent{
+ tEv := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -238,7 +238,7 @@ func testV1FIdxCaSetThresholdProfile(t *testing.T) {
func testV1FIdxCaGetThresholdFromTP(t *testing.T) {
//matches THD_ACNT_BALANCE_1
- tEv := &utils.CGREvent{
+ tEv := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -312,7 +312,7 @@ func testV1FIdxCaUpdateThresholdProfile(t *testing.T) {
t.Error("Unexpected reply returned", result)
}
//make sure doesn't match the thresholdprofile after update
- tEv := &utils.CGREvent{
+ tEv := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -331,7 +331,7 @@ func testV1FIdxCaUpdateThresholdProfile(t *testing.T) {
t.Error(err)
}
//matches thresholdprofile after update
- tEv2 := &utils.CGREvent{
+ tEv2 := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -399,7 +399,7 @@ func testV1FIdxCaUpdateThresholdProfileFromTP(t *testing.T) {
} else if result != utils.OK {
t.Error("Unexpected reply returned", result)
}
- tEv := &utils.CGREvent{
+ tEv := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -416,7 +416,7 @@ func testV1FIdxCaUpdateThresholdProfileFromTP(t *testing.T) {
err.Error() != utils.ErrNotFound.Error() {
t.Error(err)
}
- tEv2 := &utils.CGREvent{
+ tEv2 := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event3",
Event: map[string]any{
@@ -438,7 +438,7 @@ func testV1FIdxCaUpdateThresholdProfileFromTP(t *testing.T) {
func testV1FIdxCaRemoveThresholdProfile(t *testing.T) {
var resp string
- tEv := &utils.CGREvent{
+ tEv := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event8",
Event: map[string]any{
@@ -457,7 +457,7 @@ func testV1FIdxCaRemoveThresholdProfile(t *testing.T) {
t.Errorf("Expecting : %s, received: %s", eIDs, thIDs)
}
- tEv2 := &utils.CGREvent{
+ tEv2 := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event9",
Event: map[string]any{
@@ -514,7 +514,7 @@ func testV1FIdxCaRemoveThresholdProfile(t *testing.T) {
// StatQueue
func testV1FIdxCaGetStatQueuesWithNotFound(t *testing.T) {
var reply *[]string
- tEv := &utils.CGREvent{
+ tEv := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -595,7 +595,7 @@ func testV1FIdxCaSetStatQueueProfile(t *testing.T) {
t.Error("Unexpected reply returned", result)
}
- tEv := &utils.CGREvent{
+ tEv := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -620,7 +620,7 @@ func testV1FIdxCaSetStatQueueProfile(t *testing.T) {
func testV1FIdxCaGetStatQueuesFromTP(t *testing.T) {
var reply []string
expected := []string{"Stats1"}
- ev2 := &utils.CGREvent{
+ ev2 := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event2",
Event: map[string]any{
@@ -635,7 +635,7 @@ func testV1FIdxCaGetStatQueuesFromTP(t *testing.T) {
} else if !reflect.DeepEqual(reply, expected) {
t.Errorf("Expecting: %+v, received: %+v", expected, reply)
}
- ev3 := &utils.CGREvent{
+ ev3 := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event3",
Event: map[string]any{
@@ -651,7 +651,7 @@ func testV1FIdxCaGetStatQueuesFromTP(t *testing.T) {
t.Errorf("Expecting: %+v, received: %+v", expected, reply)
}
- tEv := &utils.CGREvent{
+ tEv := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -670,7 +670,7 @@ func testV1FIdxCaGetStatQueuesFromTP(t *testing.T) {
} else if !reflect.DeepEqual(reply, expected) {
t.Errorf("Expecting: %+v, received: %+v", expected, reply)
}
- tEv2 := &utils.CGREvent{
+ tEv2 := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -748,7 +748,7 @@ func testV1FIdxCaUpdateStatQueueProfile(t *testing.T) {
}
var reply []string
expected := []string{"TEST_PROFILE1"}
- tEv := &utils.CGREvent{
+ tEv := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -808,7 +808,7 @@ func testV1FIdxCaUpdateStatQueueProfileFromTP(t *testing.T) {
} else if result != utils.OK {
t.Error("Unexpected reply returned", result)
}
- tEv := &utils.CGREvent{
+ tEv := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -835,7 +835,7 @@ func testV1FIdxCaUpdateStatQueueProfileFromTP(t *testing.T) {
func testV1FIdxCaRemoveStatQueueProfile(t *testing.T) {
var reply []string
expected := []string{"TEST_PROFILE1"}
- tEv := &utils.CGREvent{
+ tEv := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -853,7 +853,7 @@ func testV1FIdxCaRemoveStatQueueProfile(t *testing.T) {
t.Errorf("Expecting: %+v, received: %+v", expected, reply)
}
expected = []string{"Stats1"}
- tEv2 := &utils.CGREvent{
+ tEv2 := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -913,7 +913,7 @@ func testV1FIdxCaRemoveStatQueueProfile(t *testing.T) {
// AttributeProfile
func testV1FIdxCaProcessAttributeProfileEventWithNotFound(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEvent",
Event: map[string]any{
@@ -987,7 +987,7 @@ func testV1FIdxCaSetAttributeProfile(t *testing.T) {
t.Error("Unexpected reply returned", result)
}
//matches TEST_PROFILE1
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEvent",
Event: map[string]any{
@@ -1007,7 +1007,7 @@ func testV1FIdxCaSetAttributeProfile(t *testing.T) {
func testV1FIdxCaGetAttributeProfileFromTP(t *testing.T) {
//matches ATTR_1
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEvent",
Event: map[string]any{
@@ -1080,7 +1080,7 @@ func testV1FIdxCaUpdateAttributeProfile(t *testing.T) {
t.Error("Unexpected reply returned", result)
}
//matches TEST_PROFILE1
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEvent",
Event: map[string]any{
@@ -1138,7 +1138,7 @@ func testV1FIdxCaUpdateAttributeProfileFromTP(t *testing.T) {
t.Error("Unexpected reply returned", result)
}
//matches TEST_PROFILE1
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEvent",
Event: map[string]any{
@@ -1157,7 +1157,7 @@ func testV1FIdxCaUpdateAttributeProfileFromTP(t *testing.T) {
func testV1FIdxCaRemoveAttributeProfile(t *testing.T) {
var resp string
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEvent",
Event: map[string]any{
@@ -1173,7 +1173,7 @@ func testV1FIdxCaRemoveAttributeProfile(t *testing.T) {
t.Error(err)
}
- ev2 := &utils.CGREvent{
+ ev2 := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEvent",
Event: map[string]any{
@@ -1229,7 +1229,7 @@ func testV1FIdxCaRemoveAttributeProfile(t *testing.T) {
// ResourceProfile
func testV1FIdxCaGetResourceProfileWithNotFound(t *testing.T) {
var reply string
- cgrEv := &utils.CGREvent{
+ cgrEv := &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Event: map[string]any{
@@ -1317,7 +1317,7 @@ func testV1FIdxCaSetResourceProfile(t *testing.T) {
} else if result != utils.OK {
t.Error("Unexpected reply returned", result)
}
- cgrEv := &utils.CGREvent{
+ cgrEv := &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Event: map[string]any{
@@ -1347,7 +1347,7 @@ func testV1FIdxCaSetResourceProfile(t *testing.T) {
func testV1FIdxCaGetResourceProfileFromTP(t *testing.T) {
var reply string
- cgrEv := &utils.CGREvent{
+ cgrEv := &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Event: map[string]any{
@@ -1373,7 +1373,7 @@ func testV1FIdxCaGetResourceProfileFromTP(t *testing.T) {
t.Error("Unexpected reply returned", reply)
}
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Event: map[string]any{
@@ -1450,7 +1450,7 @@ func testV1FIdxCaUpdateResourceProfile(t *testing.T) {
} else if result != utils.OK {
t.Error("Unexpected reply returned", result)
}
- cgrEv := &utils.CGREvent{
+ cgrEv := &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Event: map[string]any{
@@ -1517,7 +1517,7 @@ func testV1FIdxCaUpdateResourceProfileFromTP(t *testing.T) {
} else if result != utils.OK {
t.Error("Unexpected reply returned", result)
}
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Event: map[string]any{
@@ -1539,7 +1539,7 @@ func testV1FIdxCaUpdateResourceProfileFromTP(t *testing.T) {
func testV1FIdxCaRemoveResourceProfile(t *testing.T) {
var resp string
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Event: map[string]any{
@@ -1562,7 +1562,7 @@ func testV1FIdxCaRemoveResourceProfile(t *testing.T) {
} else if resp != "MessageAllocation" {
t.Error("Unexpected reply returned", resp)
}
- ev2 := &utils.CGREvent{
+ ev2 := &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Event: map[string]any{
diff --git a/apier/v1/guardian.go b/apier/v1/guardian.go
index 15a0064ca..f380e2d9c 100644
--- a/apier/v1/guardian.go
+++ b/apier/v1/guardian.go
@@ -21,6 +21,7 @@ package v1
import (
"github.com/cgrates/birpc/context"
"github.com/cgrates/cgrates/dispatchers"
+ "github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/guardian"
"github.com/cgrates/cgrates/utils"
)
@@ -44,7 +45,7 @@ func (self *GuardianSv1) RemoteUnlock(ctx *context.Context, refID *dispatchers.A
}
// Ping return pong if the service is active
-func (self *GuardianSv1) Ping(ctx *context.Context, ign *utils.CGREvent, reply *string) error {
+func (self *GuardianSv1) Ping(ctx *context.Context, ign *engine.CGREvent, reply *string) error {
*reply = utils.Pong
return nil
}
diff --git a/apier/v1/guardian_it_test.go b/apier/v1/guardian_it_test.go
index 6f24f8d50..e9a355305 100644
--- a/apier/v1/guardian_it_test.go
+++ b/apier/v1/guardian_it_test.go
@@ -94,7 +94,7 @@ func TestGuardianSIT(t *testing.T) {
// ping
var resp string
- if err = guardianRPC.Call(context.Background(), utils.GuardianSv1Ping, new(utils.CGREvent), &resp); err != nil {
+ if err = guardianRPC.Call(context.Background(), utils.GuardianSv1Ping, new(engine.CGREvent), &resp); err != nil {
t.Error(err)
} else if resp != utils.Pong {
t.Error("Unexpected reply returned", resp)
diff --git a/apier/v1/loaders.go b/apier/v1/loaders.go
index 5d09ab219..eba12eb6e 100644
--- a/apier/v1/loaders.go
+++ b/apier/v1/loaders.go
@@ -20,6 +20,7 @@ package v1
import (
"github.com/cgrates/birpc/context"
+ "github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/loaders"
"github.com/cgrates/cgrates/utils"
)
@@ -49,7 +50,7 @@ func (ldrSv1 *LoaderSv1) Remove(ctx *context.Context, args *loaders.ArgsProcessF
return ldrSv1.ldrS.V1Remove(ctx, args, rply)
}
-func (rsv1 *LoaderSv1) Ping(ctx *context.Context, ign *utils.CGREvent, reply *string) error {
+func (rsv1 *LoaderSv1) Ping(ctx *context.Context, ign *engine.CGREvent, reply *string) error {
*reply = utils.Pong
return nil
}
diff --git a/apier/v1/rals.go b/apier/v1/rals.go
index 68f85f765..9a57ae16f 100644
--- a/apier/v1/rals.go
+++ b/apier/v1/rals.go
@@ -108,7 +108,7 @@ func (rsv1 *RALsV1) GetRatingPlansCost(ctx *context.Context, arg *utils.RatingPl
return nil
}
-func (rsv1 *RALsV1) Ping(ctx *context.Context, ign *utils.CGREvent, reply *string) error {
+func (rsv1 *RALsV1) Ping(ctx *context.Context, ign *engine.CGREvent, reply *string) error {
*reply = utils.Pong
return nil
}
diff --git a/apier/v1/remote_it_test.go b/apier/v1/remote_it_test.go
index b5d4e08e3..0cfd13ce6 100644
--- a/apier/v1/remote_it_test.go
+++ b/apier/v1/remote_it_test.go
@@ -803,7 +803,7 @@ func testInternalReplicationSetThreshold(t *testing.T) {
}
func testInternalMatchThreshold(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event2",
Event: map[string]any{
@@ -817,7 +817,7 @@ func testInternalMatchThreshold(t *testing.T) {
} else if !reflect.DeepEqual(ids, eIDs) {
t.Errorf("Expecting ids: %s, received: %s", eIDs, ids)
}
- ev = &utils.CGREvent{
+ ev = &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event2",
Event: map[string]any{
@@ -830,7 +830,7 @@ func testInternalMatchThreshold(t *testing.T) {
} else if !reflect.DeepEqual(ids, eIDs) {
t.Errorf("Expecting ids: %s, received: %s", eIDs, ids)
}
- ev2 := &utils.CGREvent{
+ ev2 := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event3",
Event: map[string]any{
diff --git a/apier/v1/replicate_it_test.go b/apier/v1/replicate_it_test.go
index 394bb5ee8..30d42911a 100644
--- a/apier/v1/replicate_it_test.go
+++ b/apier/v1/replicate_it_test.go
@@ -1208,7 +1208,7 @@ func testInternalReplicateITThreshold(t *testing.T) {
err.Error() != utils.ErrNotFound.Error() {
t.Error(err)
}
- tEvs := &utils.CGREvent{
+ tEvs := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
diff --git a/apier/v1/replicator.go b/apier/v1/replicator.go
index 55e7be64f..74a391b25 100644
--- a/apier/v1/replicator.go
+++ b/apier/v1/replicator.go
@@ -1028,7 +1028,7 @@ func (rplSv1 *ReplicatorSv1) RemoveIndexes(ctx *context.Context, args *utils.Get
}
// Ping used to determine if the RPC is active
-func (rplSv1 *ReplicatorSv1) Ping(ctx *context.Context, ign *utils.CGREvent, reply *string) error {
+func (rplSv1 *ReplicatorSv1) Ping(ctx *context.Context, ign *engine.CGREvent, reply *string) error {
*reply = utils.Pong
return nil
}
diff --git a/apier/v1/resourcesv1.go b/apier/v1/resourcesv1.go
index 9c52e84c4..0070282c0 100644
--- a/apier/v1/resourcesv1.go
+++ b/apier/v1/resourcesv1.go
@@ -42,22 +42,22 @@ func (rsv1 *ResourceSv1) Call(ctx *context.Context, serviceMethod string, args a
}
// GetResourcesForEvent returns Resources matching a specific event
-func (rsv1 *ResourceSv1) GetResourcesForEvent(ctx *context.Context, args *utils.CGREvent, reply *engine.Resources) error {
+func (rsv1 *ResourceSv1) GetResourcesForEvent(ctx *context.Context, args *engine.CGREvent, reply *engine.Resources) error {
return rsv1.rls.V1GetResourcesForEvent(ctx, args, reply)
}
// AuthorizeResources checks if there are limits imposed for event
-func (rsv1 *ResourceSv1) AuthorizeResources(ctx *context.Context, args *utils.CGREvent, reply *string) error {
+func (rsv1 *ResourceSv1) AuthorizeResources(ctx *context.Context, args *engine.CGREvent, reply *string) error {
return rsv1.rls.V1AuthorizeResources(ctx, args, reply)
}
// V1InitiateResourceUsage records usage for an event
-func (rsv1 *ResourceSv1) AllocateResources(ctx *context.Context, args *utils.CGREvent, reply *string) error {
+func (rsv1 *ResourceSv1) AllocateResources(ctx *context.Context, args *engine.CGREvent, reply *string) error {
return rsv1.rls.V1AllocateResources(ctx, args, reply)
}
// V1TerminateResourceUsage releases usage for an event
-func (rsv1 *ResourceSv1) ReleaseResources(ctx *context.Context, args *utils.CGREvent, reply *string) error {
+func (rsv1 *ResourceSv1) ReleaseResources(ctx *context.Context, args *engine.CGREvent, reply *string) error {
return rsv1.rls.V1ReleaseResources(ctx, args, reply)
}
@@ -174,7 +174,7 @@ func (apierSv1 *APIerSv1) RemoveResourceProfile(ctx *context.Context, arg *utils
return nil
}
-func (rsv1 *ResourceSv1) Ping(ctx *context.Context, ign *utils.CGREvent, reply *string) error {
+func (rsv1 *ResourceSv1) Ping(ctx *context.Context, ign *engine.CGREvent, reply *string) error {
*reply = utils.Pong
return nil
}
diff --git a/apier/v1/resourcesv1_it_test.go b/apier/v1/resourcesv1_it_test.go
index b5d47c864..bb7a11904 100644
--- a/apier/v1/resourcesv1_it_test.go
+++ b/apier/v1/resourcesv1_it_test.go
@@ -245,7 +245,7 @@ func testV1RsFromFolder(t *testing.T) {
func testV1RsGetResourcesForEvent(t *testing.T) {
var reply *engine.Resources
- args := &utils.CGREvent{
+ args := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "Event1",
Event: map[string]any{"Unknown": "unknown"},
@@ -320,7 +320,7 @@ func testV1RsGetResourcesForEvent(t *testing.T) {
func testV1RsTTL0(t *testing.T) {
// only matching Resource3
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Event: map[string]any{
@@ -338,7 +338,7 @@ func testV1RsTTL0(t *testing.T) {
t.Error(err)
}
// overwrite the first allocation
- ev = &utils.CGREvent{
+ ev = &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Event: map[string]any{
@@ -354,7 +354,7 @@ func testV1RsTTL0(t *testing.T) {
t.Error(err)
}
// too many units should be rejected
- ev = &utils.CGREvent{
+ ev = &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Event: map[string]any{
@@ -372,7 +372,7 @@ func testV1RsTTL0(t *testing.T) {
}
// check the record
var rs *engine.Resources
- args := &utils.CGREvent{
+ args := &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Event: map[string]any{
@@ -416,7 +416,7 @@ func testV1RsTTL0(t *testing.T) {
}
// release should not give out errors
var releaseReply string
- ev = &utils.CGREvent{
+ ev = &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Event: map[string]any{
@@ -442,7 +442,7 @@ func testV1RsTTL0(t *testing.T) {
func testV1RsAllocateResource(t *testing.T) {
// first event matching Resource1
var reply string
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Event: map[string]any{
@@ -464,7 +464,7 @@ func testV1RsAllocateResource(t *testing.T) {
t.Errorf("Expecting: %+v, received: %+v", eAllocationMsg, reply)
}
// Second event to test matching of exact limit of first resource
- ev = &utils.CGREvent{
+ ev = &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Event: map[string]any{
@@ -486,7 +486,7 @@ func testV1RsAllocateResource(t *testing.T) {
t.Errorf("Expecting: %+v, received: %+v", eAllocationMsg, reply)
}
// Third event testing overflow to second resource which still has one resource available
- ev = &utils.CGREvent{
+ ev = &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Event: map[string]any{
@@ -508,7 +508,7 @@ func testV1RsAllocateResource(t *testing.T) {
t.Errorf("Expecting: %+v, received: %+v", eAllocationMsg, reply)
}
// Test resource unavailable
- ev = &utils.CGREvent{
+ ev = &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Event: map[string]any{
@@ -528,7 +528,7 @@ func testV1RsAllocateResource(t *testing.T) {
eAllocationMsg = "ResGroup1"
time.Sleep(time.Second) // Give time for allocations on first resource to expire
- ev = &utils.CGREvent{
+ ev = &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Event: map[string]any{
@@ -553,7 +553,7 @@ func testV1RsAllocateResource(t *testing.T) {
func testV1RsAuthorizeResources(t *testing.T) {
var reply string
- argsRU := &utils.CGREvent{
+ argsRU := &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Event: map[string]any{
@@ -571,7 +571,7 @@ func testV1RsAuthorizeResources(t *testing.T) {
} else if reply != "ResGroup1" { // already 3 usages active before allow call, we should have now more than allowed
t.Error("Unexpected reply returned", reply)
}
- argsRU = &utils.CGREvent{
+ argsRU = &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Event: map[string]any{
@@ -593,7 +593,7 @@ func testV1RsAuthorizeResources(t *testing.T) {
func testV1RsReleaseResource(t *testing.T) {
// release the only resource active for Resource1
var reply string
- argsRU := &utils.CGREvent{
+ argsRU := &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Event: map[string]any{
@@ -611,7 +611,7 @@ func testV1RsReleaseResource(t *testing.T) {
}
// try reserving with full units for Resource1, case which did not work in previous test
// only match Resource1 since we don't want for storing of the resource2 bellow
- argsRU = &utils.CGREvent{
+ argsRU = &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Event: map[string]any{
@@ -630,7 +630,7 @@ func testV1RsReleaseResource(t *testing.T) {
t.Error("Unexpected reply returned", reply)
}
var rs *engine.Resources
- args := &utils.CGREvent{
+ args := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "Event5",
Event: map[string]any{
@@ -658,7 +658,7 @@ func testV1RsReleaseResource(t *testing.T) {
}
}
// release an empty resource should return error
- argsRU = &utils.CGREvent{
+ argsRU = &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Event: map[string]any{
@@ -680,7 +680,7 @@ func testV1RsDBStore(t *testing.T) {
if rlsV1ConfDIR == "tutinternal" {
t.SkipNow()
}
- argsRU := &utils.CGREvent{
+ argsRU := &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Event: map[string]any{
@@ -701,7 +701,7 @@ func testV1RsDBStore(t *testing.T) {
t.Errorf("Expecting: %+v, received: %+v", eAllocationMsg, reply)
}
var rs *engine.Resources
- args := &utils.CGREvent{
+ args := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "Event3",
Event: map[string]any{
@@ -743,7 +743,7 @@ func testV1RsDBStore(t *testing.T) {
t.Fatal("Could not connect to rater: ", err.Error())
}
rs = new(engine.Resources)
- args = &utils.CGREvent{
+ args = &engine.CGREvent{
Tenant: "cgrates.org",
ID: "Event4",
Event: map[string]any{
@@ -893,7 +893,7 @@ func testV1RsGetResourceProfileAfterDelete(t *testing.T) {
func testV1RsResourcePing(t *testing.T) {
var resp string
- if err := rlsV1Rpc.Call(context.Background(), utils.ResourceSv1Ping, new(utils.CGREvent), &resp); err != nil {
+ if err := rlsV1Rpc.Call(context.Background(), utils.ResourceSv1Ping, new(engine.CGREvent), &resp); err != nil {
t.Error(err)
} else if resp != utils.Pong {
t.Error("Unexpected reply returned", resp)
@@ -923,7 +923,7 @@ func testV1RsMatchNotFound(t *testing.T) {
t.Error("Unexpected reply returned", result)
}
- argsRU := &utils.CGREvent{
+ argsRU := &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Event: map[string]any{
@@ -967,7 +967,7 @@ func testV1RsAllocateUnlimited(t *testing.T) {
t.Error("Unexpected reply returned", result)
}
var reply string
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Event: map[string]any{
@@ -1096,7 +1096,7 @@ func testV1RsSetResourceProfileWithOpts(t *testing.T) {
func testV1RsAuthorizeResourcesWithOpts(t *testing.T) {
var reply string
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TEST_WITH_OPTS",
Event: map[string]any{
@@ -1294,7 +1294,7 @@ func testResourceSSetResourceProfile(t *testing.T) {
func testResourceSCheckThresholdAfterResourceAllocate(t *testing.T) {
var reply string
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "EV_1",
Event: map[string]any{
@@ -1326,7 +1326,7 @@ func testResourceSCheckThresholdAfterResourceAllocate(t *testing.T) {
}
func testResourceSCheckThresholdAfterResourceRelease(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "EV_1",
Event: map[string]any{
diff --git a/apier/v1/routes.go b/apier/v1/routes.go
index 37b1f4d38..29dff0370 100644
--- a/apier/v1/routes.go
+++ b/apier/v1/routes.go
@@ -145,21 +145,21 @@ func (rS *RouteSv1) Call(ctx *context.Context, serviceMethod string, args any, r
}
// GetRoutes returns sorted list of routes for Event
-func (rS *RouteSv1) GetRoutes(ctx *context.Context, args *utils.CGREvent, reply *engine.SortedRoutesList) error {
+func (rS *RouteSv1) GetRoutes(ctx *context.Context, args *engine.CGREvent, reply *engine.SortedRoutesList) error {
return rS.rS.V1GetRoutes(ctx, args, reply)
}
// GetRouteProfilesForEvent returns a list of route profiles that match for Event
-func (rS *RouteSv1) GetRouteProfilesForEvent(ctx *context.Context, args *utils.CGREvent, reply *[]*engine.RouteProfile) error {
+func (rS *RouteSv1) GetRouteProfilesForEvent(ctx *context.Context, args *engine.CGREvent, reply *[]*engine.RouteProfile) error {
return rS.rS.V1GetRouteProfilesForEvent(ctx, args, reply)
}
-func (rS *RouteSv1) Ping(ctx *context.Context, ign *utils.CGREvent, reply *string) error {
+func (rS *RouteSv1) Ping(ctx *context.Context, ign *engine.CGREvent, reply *string) error {
*reply = utils.Pong
return nil
}
// GetRoutesList returns sorted list of routes for Event as a string slice
-func (rS *RouteSv1) GetRoutesList(ctx *context.Context, args *utils.CGREvent, reply *[]string) error {
+func (rS *RouteSv1) GetRoutesList(ctx *context.Context, args *engine.CGREvent, reply *[]string) error {
return rS.rS.V1GetRoutesList(ctx, args, reply)
}
diff --git a/apier/v1/routes_it_test.go b/apier/v1/routes_it_test.go
index 99ccc3ee2..e31550a22 100644
--- a/apier/v1/routes_it_test.go
+++ b/apier/v1/routes_it_test.go
@@ -179,7 +179,7 @@ func testV1RouteFromFolder(t *testing.T) {
}
func testV1RouteGetWeightRoutes(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testV1RouteGetWeightRoutes",
Event: map[string]any{
@@ -226,7 +226,7 @@ func testV1RouteGetWeightRoutes(t *testing.T) {
}
func testV1RouteGetLeastCostRoutes(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testV1RouteGetLeastCostRoutes",
Event: map[string]any{
@@ -279,7 +279,7 @@ func testV1RouteGetLeastCostRoutes(t *testing.T) {
}
func testV1RouteGetLeastCostRoutesWithoutUsage(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testV1RouteGetLeastCostRoutes",
Event: map[string]any{
@@ -331,7 +331,7 @@ func testV1RouteGetLeastCostRoutesWithoutUsage(t *testing.T) {
}
func testV1RouteGetLeastCostRoutesWithMaxCost(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testV1RouteGetLeastCostRoutes",
Event: map[string]any{
@@ -379,7 +379,7 @@ func testV1RouteGetLeastCostRoutesWithMaxCost(t *testing.T) {
}
func testV1RouteGetLeastCostRoutesWithMaxCostNotFound(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testV1RouteGetLeastCostRoutes",
Event: map[string]any{
@@ -401,7 +401,7 @@ func testV1RouteGetLeastCostRoutesWithMaxCostNotFound(t *testing.T) {
}
func testV1RouteGetLeastCostRoutesWithMaxCost2(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testV1RouteGetLeastCostRoutes",
Event: map[string]any{
@@ -450,7 +450,7 @@ func testV1RouteGetLeastCostRoutesWithMaxCost2(t *testing.T) {
}
func testV1RouteGetHighestCostRoutes(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testV1RouteGetHighestCostRoutes",
Event: map[string]any{
@@ -503,7 +503,7 @@ func testV1RouteGetHighestCostRoutes(t *testing.T) {
}
func testV1RouteGetLeastCostRoutesErr(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testV1RouteGetHighestCostRoutes",
Event: map[string]any{
@@ -541,7 +541,7 @@ func testV1RouteGetLeastCostRoutesErr(t *testing.T) {
func testV1RoutePolulateStatsForQOS(t *testing.T) {
var reply []string
expected := []string{"Stat_1"}
- ev1 := &utils.CGREvent{
+ ev1 := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -558,7 +558,7 @@ func testV1RoutePolulateStatsForQOS(t *testing.T) {
}
expected = []string{"Stat_1"}
- ev1 = &utils.CGREvent{
+ ev1 = &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event2",
Event: map[string]any{
@@ -575,7 +575,7 @@ func testV1RoutePolulateStatsForQOS(t *testing.T) {
}
expected = []string{"Stat_2"}
- ev1 = &utils.CGREvent{
+ ev1 = &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event2",
Event: map[string]any{
@@ -592,7 +592,7 @@ func testV1RoutePolulateStatsForQOS(t *testing.T) {
}
expected = []string{"Stat_2"}
- ev1 = &utils.CGREvent{
+ ev1 = &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event2",
Event: map[string]any{
@@ -609,7 +609,7 @@ func testV1RoutePolulateStatsForQOS(t *testing.T) {
}
expected = []string{"Stat_3"}
- ev1 = &utils.CGREvent{
+ ev1 = &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event3",
Event: map[string]any{
@@ -626,7 +626,7 @@ func testV1RoutePolulateStatsForQOS(t *testing.T) {
}
expected = []string{"Stat_1_1"}
- ev1 = &utils.CGREvent{
+ ev1 = &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event3",
Event: map[string]any{
@@ -644,7 +644,7 @@ func testV1RoutePolulateStatsForQOS(t *testing.T) {
}
expected = []string{"Stat_1_1"}
- ev1 = &utils.CGREvent{
+ ev1 = &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event3",
Event: map[string]any{
@@ -663,7 +663,7 @@ func testV1RoutePolulateStatsForQOS(t *testing.T) {
}
func testV1RouteGetQOSRoutes(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testV1RouteGetQOSRoutes",
Event: map[string]any{
@@ -692,7 +692,7 @@ func testV1RouteGetQOSRoutes(t *testing.T) {
}
func testV1RouteGetQOSRoutes2(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testV1RouteGetQOSRoutes",
Event: map[string]any{
@@ -721,7 +721,7 @@ func testV1RouteGetQOSRoutes2(t *testing.T) {
}
func testV1RouteGetQOSRoutes3(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testV1RouteGetQOSRoutes",
Event: map[string]any{
@@ -750,7 +750,7 @@ func testV1RouteGetQOSRoutes3(t *testing.T) {
}
func testV1RouteGetQOSRoutesFiltred(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testV1RouteGetQOSRoutes",
Event: map[string]any{
@@ -779,7 +779,7 @@ func testV1RouteGetQOSRoutesFiltred(t *testing.T) {
}
func testV1RouteGetQOSRoutesFiltred2(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testV1RouteGetQOSRoutes",
Event: map[string]any{
@@ -812,7 +812,7 @@ func testV1RouteGetQOSRoutesFiltred2(t *testing.T) {
}
func testV1RouteGetRouteWithoutFilter(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testV1RouteGetRouteWithoutFilter",
Event: map[string]any{
@@ -999,7 +999,7 @@ func testV1RouteRemRouteProfiles(t *testing.T) {
func testV1RouteRoutePing(t *testing.T) {
var resp string
- if err := routeSv1Rpc.Call(context.Background(), utils.RouteSv1Ping, new(utils.CGREvent), &resp); err != nil {
+ if err := routeSv1Rpc.Call(context.Background(), utils.RouteSv1Ping, new(engine.CGREvent), &resp); err != nil {
t.Error(err)
} else if resp != utils.Pong {
t.Error("Unexpected reply returned", resp)
@@ -1007,7 +1007,7 @@ func testV1RouteRoutePing(t *testing.T) {
}
func testV1RouteGetRouteForEvent(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testV1RouteGetHighestCostRoutes",
Event: map[string]any{
@@ -1135,7 +1135,7 @@ func testV1RoutesOneRouteWithoutDestination(t *testing.T) {
t.Error("Unexpected reply returned", result)
}
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testV1RoutesOneRouteWithoutDestination",
Event: map[string]any{
@@ -1208,7 +1208,7 @@ func testV1RouteMultipleRouteSameID(t *testing.T) {
t.Error("Unexpected reply returned", result)
}
tNow := time.Now()
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
Time: &tNow,
ID: "testV1RouteMultipleRouteSameID",
@@ -1244,7 +1244,7 @@ func testV1RouteMultipleRouteSameID(t *testing.T) {
utils.ToJSON(eSpls), utils.ToJSON(suplsReply))
}
- ev = &utils.CGREvent{
+ ev = &engine.CGREvent{
Tenant: "cgrates.org",
Time: &tNow,
ID: "testV1RouteMultipleRouteSameID",
@@ -1340,7 +1340,7 @@ func testV1RouteAccountWithRatingPlan(t *testing.T) {
// test for 30 seconds usage
// we expect that the route with account to have cost 0
tNow := time.Now()
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
Time: &tNow,
ID: "testV1RouteAccountWithRatingPlan",
@@ -1408,7 +1408,7 @@ func testV1RouteAccountWithRatingPlan(t *testing.T) {
// test for 60 seconds usage
// 30 seconds are covered by account and the remaining will be calculated
- ev = &utils.CGREvent{
+ ev = &engine.CGREvent{
Tenant: "cgrates.org",
Time: &tNow,
ID: "testV1RouteAccountWithRatingPlan",
@@ -1478,7 +1478,7 @@ func testV1RouteAccountWithRatingPlan(t *testing.T) {
// test for 61 seconds usage
// 30 seconds are covered by account and the remaining will be calculated
- ev = &utils.CGREvent{
+ ev = &engine.CGREvent{
Tenant: "cgrates.org",
Time: &tNow,
ID: "testV1RouteAccountWithRatingPlan",
diff --git a/apier/v1/schedulers.go b/apier/v1/schedulers.go
index a633e8f28..425f79cc9 100644
--- a/apier/v1/schedulers.go
+++ b/apier/v1/schedulers.go
@@ -41,7 +41,7 @@ type SchedulerSv1 struct {
}
// Reload reloads scheduler instructions
-func (schdSv1 *SchedulerSv1) Reload(ctx *context.Context, arg *utils.CGREvent, reply *string) error {
+func (schdSv1 *SchedulerSv1) Reload(ctx *context.Context, arg *engine.CGREvent, reply *string) error {
schdSv1.cgrcfg.GetReloadChan(config.SCHEDULER_JSN) <- struct{}{}
*reply = utils.OK
return nil
@@ -174,7 +174,7 @@ func (schdSv1 *SchedulerSv1) ExecuteActionPlans(ctx *context.Context, attr *util
}
// Ping returns Pong
-func (schdSv1 *SchedulerSv1) Ping(ctx *context.Context, ign *utils.CGREvent, reply *string) error {
+func (schdSv1 *SchedulerSv1) Ping(ctx *context.Context, ign *engine.CGREvent, reply *string) error {
*reply = utils.Pong
return nil
}
diff --git a/apier/v1/servicemanager.go b/apier/v1/servicemanager.go
index 53aa9cf50..5c0cd9140 100644
--- a/apier/v1/servicemanager.go
+++ b/apier/v1/servicemanager.go
@@ -21,6 +21,7 @@ package v1
import (
"github.com/cgrates/birpc/context"
"github.com/cgrates/cgrates/dispatchers"
+ "github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/servmanager"
"github.com/cgrates/cgrates/utils"
)
@@ -46,7 +47,7 @@ func (servManager *ServiceManagerV1) ServiceStatus(ctx *context.Context, args *d
}
// Ping return pong if the service is active
-func (servManager *ServiceManagerV1) Ping(ctx *context.Context, ign *utils.CGREvent, reply *string) error {
+func (servManager *ServiceManagerV1) Ping(ctx *context.Context, ign *engine.CGREvent, reply *string) error {
*reply = utils.Pong
return nil
}
diff --git a/apier/v1/sessions.go b/apier/v1/sessions.go
index 290342e4f..21159ebd6 100644
--- a/apier/v1/sessions.go
+++ b/apier/v1/sessions.go
@@ -21,6 +21,7 @@ package v1
import (
"github.com/cgrates/birpc/context"
"github.com/cgrates/cgrates/dispatchers"
+ "github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/sessions"
"github.com/cgrates/cgrates/utils"
)
@@ -71,7 +72,7 @@ func (ssv1 *SessionSv1) TerminateSession(ctx *context.Context, args *sessions.V1
return ssv1.sS.BiRPCv1TerminateSession(ctx, args, rply)
}
-func (ssv1 *SessionSv1) ProcessCDR(ctx *context.Context, cgrEv *utils.CGREvent, rply *string) error {
+func (ssv1 *SessionSv1) ProcessCDR(ctx *context.Context, cgrEv *engine.CGREvent, rply *string) error {
return ssv1.sS.BiRPCv1ProcessCDR(ctx, cgrEv, rply)
}
@@ -115,7 +116,7 @@ func (ssv1 *SessionSv1) GetPassiveSessionsCount(ctx *context.Context, args *util
return ssv1.sS.BiRPCv1GetPassiveSessionsCount(ctx, args, rply)
}
-func (ssv1 *SessionSv1) Ping(ctx *context.Context, ign *utils.CGREvent, reply *string) error {
+func (ssv1 *SessionSv1) Ping(ctx *context.Context, ign *engine.CGREvent, reply *string) error {
*reply = utils.Pong
return nil
}
diff --git a/apier/v1/sessions_process_event_it_test.go b/apier/v1/sessions_process_event_it_test.go
index 4a354469f..2baf29afa 100644
--- a/apier/v1/sessions_process_event_it_test.go
+++ b/apier/v1/sessions_process_event_it_test.go
@@ -165,7 +165,7 @@ func testSSv1ItProcessEventAuth(t *testing.T) {
utils.ConcatenatedKey(utils.MetaRALs, utils.MetaAuthorize),
utils.ConcatenatedKey(utils.MetaRALs, utils.MetaDerivedReply),
utils.MetaRoutes, utils.MetaAttributes, utils.MetaChargers},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testSSv1ItProcessEventAuth",
Event: map[string]any{
@@ -231,7 +231,7 @@ func testSSv1ItProcessEventAuth(t *testing.T) {
MatchedProfiles: []string{"cgrates.org:ATTR_ACNT_1001"},
AlteredFields: []string{"*req.OfficeGroup"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testSSv1ItProcessEventAuth",
Event: map[string]any{
@@ -269,7 +269,7 @@ func testSSv1ItProcessEventInitiateSession(t *testing.T) {
utils.ConcatenatedKey(utils.MetaResources, utils.MetaAllocate),
utils.ConcatenatedKey(utils.MetaResources, utils.MetaDerivedReply),
utils.MetaAttributes, utils.MetaChargers},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testSSv1ItProcessEventInitiateSession",
Event: map[string]any{
@@ -309,7 +309,7 @@ func testSSv1ItProcessEventInitiateSession(t *testing.T) {
eAttrs := &engine.AttrSProcessEventReply{
MatchedProfiles: []string{"cgrates.org:ATTR_ACNT_1001"},
AlteredFields: []string{"*req.OfficeGroup"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testSSv1ItProcessEventInitiateSession",
Event: map[string]any{
@@ -352,7 +352,7 @@ func testSSv1ItProcessEventUpdateSession(t *testing.T) {
Flags: []string{utils.ConcatenatedKey(utils.MetaRALs, utils.MetaUpdate),
utils.ConcatenatedKey(utils.MetaRALs, utils.MetaDerivedReply),
utils.MetaAttributes},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testSSv1ItProcessEventUpdateSession",
Event: map[string]any{
@@ -377,7 +377,7 @@ func testSSv1ItProcessEventUpdateSession(t *testing.T) {
eAttrs := &engine.AttrSProcessEventReply{
MatchedProfiles: []string{"cgrates.org:ATTR_ACNT_1001"},
AlteredFields: []string{"*req.OfficeGroup"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testSSv1ItProcessEventUpdateSession",
Event: map[string]any{
@@ -428,7 +428,7 @@ func testSSv1ItProcessEventTerminateSession(t *testing.T) {
args := &sessions.V1ProcessEventArgs{
Flags: []string{utils.ConcatenatedKey(utils.MetaRALs, utils.MetaTerminate),
utils.ConcatenatedKey(utils.MetaResources, utils.MetaRelease)},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testSSv1ItProcessEventTerminateSession",
Event: map[string]any{
@@ -458,7 +458,7 @@ func testSSv1ItProcessEventTerminateSession(t *testing.T) {
}
func testSSv1ItProcessCDRForSessionFromProcessEvent(t *testing.T) {
- args := utils.CGREvent{
+ args := engine.CGREvent{
Tenant: "cgrates.org",
ID: "testSSv1ItProcessCDRForSessionFromProcessEvent",
Event: map[string]any{
@@ -532,7 +532,7 @@ func testSSv1ItProcessEventWithGetCost(t *testing.T) {
// GetCost for ANY2CNT Subject
args := &sessions.V1ProcessEventArgs{
Flags: []string{utils.MetaAttributes, utils.ConcatenatedKey(utils.MetaRALs, utils.MetaCost)},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testSSv1ItProcessEventWithGetCost",
Event: map[string]any{
@@ -571,7 +571,7 @@ func testSSv1ItProcessEventWithGetCost2(t *testing.T) {
// GetCost for SPECIAL_1002 Subject
args := &sessions.V1ProcessEventArgs{
Flags: []string{utils.MetaAttributes, utils.ConcatenatedKey(utils.MetaRALs, utils.MetaCost)},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testSSv1ItProcessEventWithGetCost2",
Event: map[string]any{
@@ -612,7 +612,7 @@ func testSSv1ItProcessEventWithGetCost3(t *testing.T) {
// for the 9 minutes remaining apply
args := &sessions.V1ProcessEventArgs{
Flags: []string{utils.MetaAttributes, utils.ConcatenatedKey(utils.MetaRALs, utils.MetaCost)},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testSSv1ItProcessEventWithGetCost3",
Event: map[string]any{
@@ -650,7 +650,7 @@ func testSSv1ItProcessEventWithGetCost3(t *testing.T) {
func testSSv1ItProcessEventWithGetCost4(t *testing.T) {
args := &sessions.V1ProcessEventArgs{
Flags: []string{utils.MetaAttributes, utils.ConcatenatedKey(utils.MetaRALs, utils.MetaCost)},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testSSv1ItProcessEventWithGetCost4",
Event: map[string]any{
@@ -678,7 +678,7 @@ func testSSv1ItGetCost(t *testing.T) {
// GetCost for ANY2CNT Subject
args := &sessions.V1ProcessEventArgs{
Flags: []string{utils.MetaAttributes},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testSSv1ItGetCost",
Event: map[string]any{
@@ -718,7 +718,7 @@ func testSSv1ItGetCost(t *testing.T) {
func testSSv1ItProcessEventWithCDR(t *testing.T) {
args := &sessions.V1ProcessEventArgs{
Flags: []string{utils.MetaCDRs + utils.InInFieldSep + utils.MetaRALs}, // *cdrs:*rals
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testSSv1ItProcessEventWithCDR",
Event: map[string]any{
@@ -795,7 +795,7 @@ func testSSv1ItProcessEventWithCDRResourceError(t *testing.T) {
args := &sessions.V1ProcessEventArgs{
Flags: []string{utils.MetaCDRs + utils.InInFieldSep + utils.MetaRALs,
utils.ConcatenatedKey(utils.MetaResources, utils.MetaRelease)}, // force a resource error and expect that the cdr to be written
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testSSv1ItProcessEventWithCDRResourceError",
Event: map[string]any{
@@ -873,7 +873,7 @@ func testSSv1ItProcessEventWithCDRResourceErrorBlockError(t *testing.T) {
Flags: []string{utils.MetaCDRs + utils.InInFieldSep + utils.MetaRALs,
utils.ConcatenatedKey(utils.MetaResources, utils.MetaRelease),
utils.MetaBlockerError}, // expended to stop the processing because we have error at resource
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testSSv1ItProcessEventWithCDRResourceErrorBlockError",
Event: map[string]any{
diff --git a/apier/v1/sessions_thresholds_it_test.go b/apier/v1/sessions_thresholds_it_test.go
index 6d8e093b8..5b7e39984 100644
--- a/apier/v1/sessions_thresholds_it_test.go
+++ b/apier/v1/sessions_thresholds_it_test.go
@@ -210,7 +210,7 @@ func testSessionSv1ItAuth(t *testing.T) {
args := &sessions.V1AuthorizeArgs{
AuthorizeResources: true,
ProcessThresholds: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSSv1ItAuth",
Event: map[string]any{
@@ -271,7 +271,7 @@ func testSessionSv1ItInitiateSession(t *testing.T) {
InitSession: true,
AllocateResources: true,
ProcessThresholds: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSSv1ItInitiateSession",
Event: map[string]any{
@@ -333,7 +333,7 @@ func testSessionSv1ItTerminateSession(t *testing.T) {
TerminateSession: true,
ReleaseResources: true,
ProcessThresholds: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSSv1ItTerminateSession",
Event: map[string]any{
@@ -390,7 +390,7 @@ func testSessionSv1ItAuthNotFoundThreshold(t *testing.T) {
ProcessStats: true,
GetMaxUsage: true,
ProcessThresholds: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSesssonSv1ItNotFoundThreshold",
Event: map[string]any{
@@ -423,7 +423,7 @@ func testSessionSv1ItInitNotFoundThreshold(t *testing.T) {
ProcessStats: true,
InitSession: true,
ProcessThresholds: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionSv1ItInitNotFoundThreshold",
Event: map[string]any{
@@ -474,7 +474,7 @@ func testSessionSv1ItTerminateNotFoundThreshold(t *testing.T) {
ProcessStats: true,
TerminateSession: true,
ProcessThresholds: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionSv1ItTerminateNotFoundThreshold",
Event: map[string]any{
@@ -522,7 +522,7 @@ func testSessionSv1ItAuthNotFoundThresholdAndStats(t *testing.T) {
ProcessStats: true,
GetMaxUsage: true,
ProcessThresholds: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSesssonSv1ItNotFoundThreshold",
Event: map[string]any{
@@ -556,7 +556,7 @@ func testSessionSv1ItInitNotFoundThresholdAndStats(t *testing.T) {
ProcessStats: true,
InitSession: true,
ProcessThresholds: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionSv1ItInitNotFoundThreshold",
Event: map[string]any{
@@ -608,7 +608,7 @@ func testSessionSv1ItTerminateNotFoundThresholdAndStats(t *testing.T) {
ProcessStats: true,
TerminateSession: true,
ProcessThresholds: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionSv1ItTerminateNotFoundThreshold",
Event: map[string]any{
diff --git a/apier/v1/sessionsv1_it_test.go b/apier/v1/sessionsv1_it_test.go
index e18f1af22..a01ced3ed 100644
--- a/apier/v1/sessionsv1_it_test.go
+++ b/apier/v1/sessionsv1_it_test.go
@@ -183,7 +183,7 @@ func testSSv1ItRpcConn(t *testing.T) {
func testSSv1ItPing(t *testing.T) {
var resp string
- if err := sSv1BiRpc.Call(context.Background(), utils.SessionSv1Ping, new(utils.CGREvent), &resp); err != nil {
+ if err := sSv1BiRpc.Call(context.Background(), utils.SessionSv1Ping, new(engine.CGREvent), &resp); err != nil {
t.Error(err)
} else if resp != utils.Pong {
t.Error("Unexpected reply returned", resp)
@@ -209,7 +209,7 @@ func testSSv1ItAuth(t *testing.T) {
AuthorizeResources: true,
GetRoutes: true,
GetAttributes: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSSv1ItAuth",
Event: map[string]any{
@@ -268,7 +268,7 @@ func testSSv1ItAuth(t *testing.T) {
eAttrs := &engine.AttrSProcessEventReply{
MatchedProfiles: []string{"cgrates.org:ATTR_ACNT_1001"},
AlteredFields: []string{"*req.OfficeGroup"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSSv1ItAuth",
Event: map[string]any{
@@ -305,7 +305,7 @@ func testSSv1ItAuthWithDigest(t *testing.T) {
AuthorizeResources: true,
GetRoutes: true,
GetAttributes: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSSv1ItAuth",
Event: map[string]any{
@@ -350,7 +350,7 @@ func testSSv1ItInitiateSession(t *testing.T) {
InitSession: true,
AllocateResources: true,
GetAttributes: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSSv1ItInitiateSession",
Event: map[string]any{
@@ -384,7 +384,7 @@ func testSSv1ItInitiateSession(t *testing.T) {
eAttrs := &engine.AttrSProcessEventReply{
MatchedProfiles: []string{"cgrates.org:ATTR_ACNT_1001"},
AlteredFields: []string{"*req.OfficeGroup"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSSv1ItInitiateSession",
Event: map[string]any{
@@ -427,7 +427,7 @@ func testSSv1ItInitiateSessionWithDigest(t *testing.T) {
InitSession: true,
AllocateResources: true,
GetAttributes: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSSv1ItInitiateSession",
Event: map[string]any{
@@ -476,7 +476,7 @@ func testSSv1ItUpdateSession(t *testing.T) {
args := &sessions.V1UpdateSessionArgs{
GetAttributes: true,
UpdateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSSv1ItUpdateSession",
Event: map[string]any{
@@ -501,7 +501,7 @@ func testSSv1ItUpdateSession(t *testing.T) {
eAttrs := &engine.AttrSProcessEventReply{
MatchedProfiles: []string{"cgrates.org:ATTR_ACNT_1001"},
AlteredFields: []string{"*req.OfficeGroup"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSSv1ItUpdateSession",
Event: map[string]any{
@@ -546,7 +546,7 @@ func testSSv1ItTerminateSession(t *testing.T) {
args := &sessions.V1TerminateSessionArgs{
TerminateSession: true,
ReleaseResources: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSSv1ItUpdateSession",
Event: map[string]any{
@@ -579,7 +579,7 @@ func testSSv1ItTerminateSession(t *testing.T) {
}
func testSSv1ItProcessCDR(t *testing.T) {
- args := &utils.CGREvent{
+ args := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSSv1ItProcessCDR",
Event: map[string]any{
@@ -612,7 +612,7 @@ func testSSv1ItProcessEvent(t *testing.T) {
AllocateResources: true,
Debit: true,
GetAttributes: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSSv1ItProcessEvent",
Event: map[string]any{
@@ -647,7 +647,7 @@ func testSSv1ItProcessEvent(t *testing.T) {
eAttrs := &engine.AttrSProcessEventReply{
MatchedProfiles: []string{"cgrates.org:ATTR_ACNT_1001"},
AlteredFields: []string{"*req.OfficeGroup"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSSv1ItProcessEvent",
Event: map[string]any{
@@ -805,7 +805,7 @@ func testSSv1ItForceUpdateSession(t *testing.T) {
args := &sessions.V1UpdateSessionArgs{
GetAttributes: true,
UpdateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSSv1ItUpdateSession",
Event: map[string]any{
@@ -831,7 +831,7 @@ func testSSv1ItForceUpdateSession(t *testing.T) {
eAttrs := &engine.AttrSProcessEventReply{
MatchedProfiles: []string{"cgrates.org:ATTR_ACNT_1001"},
AlteredFields: []string{"*req.OfficeGroup"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSSv1ItUpdateSession",
Event: map[string]any{
@@ -962,7 +962,7 @@ func testSSv1ItDynamicDebit(t *testing.T) {
args1 := &sessions.V1InitSessionArgs{
InitSession: true,
GetAttributes: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSSv1ItInitiateSession2",
Event: map[string]any{
@@ -1059,7 +1059,7 @@ func testSSv1ItDeactivateSessions(t *testing.T) {
args := &sessions.V1InitSessionArgs{
InitSession: true,
GetAttributes: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSSv1ItInitiateSession",
Event: map[string]any{
@@ -1109,7 +1109,7 @@ func testSSv1ItAuthNotFoundCharger(t *testing.T) {
authUsage := 5 * time.Minute
args := &sessions.V1AuthorizeArgs{
GetMaxUsage: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "Unexist",
ID: "testSSv1ItAuthNotFoundCharger",
Event: map[string]any{
@@ -1136,7 +1136,7 @@ func testSSv1ItInitiateSessionNotFoundCharger(t *testing.T) {
initUsage := 5 * time.Minute
args := &sessions.V1InitSessionArgs{
InitSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "Unexist",
ID: "testSSv1ItInitiateSessionNotFoundCharger",
Event: map[string]any{
diff --git a/apier/v1/stats.go b/apier/v1/stats.go
index 291c1e5b4..1e5770fca 100644
--- a/apier/v1/stats.go
+++ b/apier/v1/stats.go
@@ -151,12 +151,12 @@ func (stsv1 *StatSv1) GetQueueIDs(ctx *context.Context, tenant *utils.TenantWith
}
// ProcessEvent returns processes a new Event
-func (stsv1 *StatSv1) ProcessEvent(ctx *context.Context, args *utils.CGREvent, reply *[]string) error {
+func (stsv1 *StatSv1) ProcessEvent(ctx *context.Context, args *engine.CGREvent, reply *[]string) error {
return stsv1.sS.V1ProcessEvent(ctx, args, reply)
}
// GetStatQueuesForEvent returns the list of queues IDs in the system
-func (stsv1 *StatSv1) GetStatQueuesForEvent(ctx *context.Context, args *utils.CGREvent, reply *[]string) (err error) {
+func (stsv1 *StatSv1) GetStatQueuesForEvent(ctx *context.Context, args *engine.CGREvent, reply *[]string) (err error) {
return stsv1.sS.V1GetStatQueuesForEvent(ctx, args, reply)
}
@@ -181,7 +181,7 @@ func (stsv1 *StatSv1) ResetStatQueue(ctx *context.Context, args *utils.TenantIDW
}
// Ping .
-func (stsv1 *StatSv1) Ping(ctx *context.Context, ign *utils.CGREvent, reply *string) error {
+func (stsv1 *StatSv1) Ping(ctx *context.Context, ign *engine.CGREvent, reply *string) error {
*reply = utils.Pong
return nil
}
diff --git a/apier/v1/stats_it_test.go b/apier/v1/stats_it_test.go
index 056ea7e14..ec5aba060 100644
--- a/apier/v1/stats_it_test.go
+++ b/apier/v1/stats_it_test.go
@@ -42,7 +42,7 @@ var (
statConfig *engine.StatQueueProfileWithAPIOpts
stsV1ConfDIR string //run tests for specific configuration
- evs = []*utils.CGREvent{
+ evs = []*engine.CGREvent{
{
Tenant: "cgrates.org",
ID: "event1",
@@ -290,7 +290,7 @@ func testV1STSV1StatSv1ResetAction(t *testing.T) {
func testV1STSProcessEvent(t *testing.T) {
var reply []string
expected := []string{"Stats1"}
- args := &utils.CGREvent{
+ args := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -344,7 +344,7 @@ func testV1STSProcessEvent(t *testing.T) {
t.Errorf("expecting: %+v, received reply: %+v", expectedFloatMetrics, floatMetrics)
}
- args2 := &utils.CGREvent{
+ args2 := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event2",
Event: map[string]any{
@@ -359,7 +359,7 @@ func testV1STSProcessEvent(t *testing.T) {
} else if !reflect.DeepEqual(reply, expected) {
t.Errorf("Expecting: %+v, received: %+v", expected, reply)
}
- args3 := &utils.CGREvent{
+ args3 := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event3",
Event: map[string]any{
@@ -672,7 +672,7 @@ func testV1STSProcessMetricsWithFilter(t *testing.T) {
//process event
var reply2 []string
expected := []string{"CustomStatProfile"}
- args := &utils.CGREvent{
+ args := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -700,7 +700,7 @@ func testV1STSProcessMetricsWithFilter(t *testing.T) {
t.Errorf("expecting: %+v, received reply: %s", expectedMetrics, metrics)
}
//second process
- args = &utils.CGREvent{
+ args = &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event2",
Event: map[string]any{
@@ -779,7 +779,7 @@ func testV1STSProcessStaticMetrics(t *testing.T) {
//process event
var reply2 []string
expected := []string{"StaticStatQueue"}
- args := &utils.CGREvent{
+ args := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -904,7 +904,7 @@ func testV1STSProcessStatsOneEvent(t *testing.T) {
var reply2 []string
expected := []string{"StatQueueOne"}
- args := &utils.CGREvent{
+ args := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -934,7 +934,7 @@ func testV1STSProcessStatsOneEvent(t *testing.T) {
t.Errorf("expecting: %+v, received reply: %s", expectedMetrics, metrics)
}
- args = &utils.CGREvent{
+ args = &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -974,7 +974,7 @@ func testV1STSProcessStatsOneEvent(t *testing.T) {
func testV1STSStatsPing(t *testing.T) {
var resp string
- if err := stsV1Rpc.Call(context.Background(), utils.StatSv1Ping, new(utils.CGREvent), &resp); err != nil {
+ if err := stsV1Rpc.Call(context.Background(), utils.StatSv1Ping, new(engine.CGREvent), &resp); err != nil {
t.Error(err)
} else if resp != utils.Pong {
t.Error("Unexpected reply returned", resp)
@@ -1035,7 +1035,7 @@ func testV1STSProcessStatWithThreshold(t *testing.T) {
//process event
var reply2 []string
expected := []string{"StatWithThreshold"}
- args := &utils.CGREvent{
+ args := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -1338,7 +1338,7 @@ func testV1STSProcessStatWithThreshold2(t *testing.T) {
//process event
var reply2 []string
expected := []string{"StatWithThreshold2"}
- args := &utils.CGREvent{
+ args := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -1493,7 +1493,7 @@ func testV1STSV1GetQueueIDs(t *testing.T) {
func testV1STSV1GetStatQueuesForEventWithoutTenant(t *testing.T) {
var reply []string
estats := []string{"Stats1"}
- if err := stsV1Rpc.Call(context.Background(), utils.StatSv1GetStatQueuesForEvent, &utils.CGREvent{
+ if err := stsV1Rpc.Call(context.Background(), utils.StatSv1GetStatQueuesForEvent, &engine.CGREvent{
ID: "GetStats",
Event: map[string]any{
utils.AccountField: "1002",
@@ -1587,7 +1587,7 @@ func testV1STSSimulateAccountUpdate(t *testing.T) {
t.Error(err)
}
- acntUpdateEv := &utils.CGREvent{ // hitting TH_ACNT_UPDATE_EV
+ acntUpdateEv := &engine.CGREvent{ // hitting TH_ACNT_UPDATE_EV
Tenant: "cgrates.org",
ID: "SIMULATE_ACNT_UPDATE_EV",
Event: acnt.AsAccountSummary().AsMapInterface(),
@@ -1668,7 +1668,7 @@ func testV1STSGetStatQueueWithoutExpired(t *testing.T) {
//process event
var reply2 []string
expected := []string{"Sq1Nanao"}
- args := &utils.CGREvent{
+ args := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1012",
Event: map[string]any{
@@ -1731,7 +1731,7 @@ func testV1STSGetStatQueueWithoutStored(t *testing.T) {
//process event
var reply2 []string
expected := []string{"Sq1NotStored"}
- args := &utils.CGREvent{
+ args := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "Sq1NotStored",
Event: map[string]any{
@@ -1800,7 +1800,7 @@ func testV1STSCheckMetricsAfterRestart(t *testing.T) {
func testStatSCacheProcessEventNotFound(t *testing.T) {
var reply []string
- args := &utils.CGREvent{
+ args := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "STAT_CACHE",
Event: map[string]any{
@@ -1820,7 +1820,7 @@ func testStatSCacheProcessEventNotFound(t *testing.T) {
}
func testStatSCacheProcessEventFound(t *testing.T) {
var reply []string
- args := &utils.CGREvent{
+ args := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "STAT_CACHE",
Event: map[string]any{
diff --git a/apier/v1/thresholds.go b/apier/v1/thresholds.go
index ecb678448..5473fa448 100644
--- a/apier/v1/thresholds.go
+++ b/apier/v1/thresholds.go
@@ -48,7 +48,7 @@ func (tSv1 *ThresholdSv1) GetThresholdIDs(ctx *context.Context, tenant *utils.Te
}
// GetThresholdsForEvent returns a list of thresholds matching an event
-func (tSv1 *ThresholdSv1) GetThresholdsForEvent(ctx *context.Context, args *utils.CGREvent, reply *engine.Thresholds) error {
+func (tSv1 *ThresholdSv1) GetThresholdsForEvent(ctx *context.Context, args *engine.CGREvent, reply *engine.Thresholds) error {
return tSv1.tS.V1GetThresholdsForEvent(ctx, args, reply)
}
@@ -58,7 +58,7 @@ func (tSv1 *ThresholdSv1) GetThreshold(ctx *context.Context, tntID *utils.Tenant
}
// ProcessEvent will process an Event
-func (tSv1 *ThresholdSv1) ProcessEvent(ctx *context.Context, args *utils.CGREvent, tIDs *[]string) error {
+func (tSv1 *ThresholdSv1) ProcessEvent(ctx *context.Context, args *engine.CGREvent, tIDs *[]string) error {
return tSv1.tS.V1ProcessEvent(ctx, args, tIDs)
}
@@ -189,7 +189,7 @@ func (apierSv1 *APIerSv1) RemoveThresholdProfile(ctx *context.Context, args *uti
}
// Ping .
-func (tSv1 *ThresholdSv1) Ping(ctx *context.Context, ign *utils.CGREvent, reply *string) error {
+func (tSv1 *ThresholdSv1) Ping(ctx *context.Context, ign *engine.CGREvent, reply *string) error {
*reply = utils.Pong
return nil
}
diff --git a/apier/v1/thresholds_it_test.go b/apier/v1/thresholds_it_test.go
index b0a99bad2..6e431eb62 100644
--- a/apier/v1/thresholds_it_test.go
+++ b/apier/v1/thresholds_it_test.go
@@ -42,7 +42,7 @@ var (
tPrfl *engine.ThresholdProfileWithAPIOpts
tSv1ConfDIR string //run tests for specific configuration
- tEvs = []*utils.CGREvent{
+ tEvs = []*engine.CGREvent{
{ // hitting THD_ACNT_BALANCE_1
Tenant: "cgrates.org",
ID: "event1",
@@ -600,7 +600,7 @@ func testV1TSMaxHits(t *testing.T) {
var ids []string
eIDs := []string{"TH3"}
- thEvent := &utils.CGREvent{ // hitting TH3
+ thEvent := &engine.CGREvent{ // hitting TH3
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -705,7 +705,7 @@ func testV1TSUpdateSnooze(t *testing.T) {
var ids []string
eIDs := []string{"TH4"}
- thEvent := &utils.CGREvent{ // hitting TH4
+ thEvent := &engine.CGREvent{ // hitting TH4
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -838,7 +838,7 @@ func testv1TSGetThresholdProfileIDsCount(t *testing.T) {
func testV1TSProcessEventWithoutTenant(t *testing.T) {
var ids []string
eIDs := []string{"TH4"}
- thEvent := &utils.CGREvent{ // hitting TH4
+ thEvent := &engine.CGREvent{ // hitting TH4
ID: "event1",
Event: map[string]any{
"CustomEv": "SnoozeEv",
@@ -929,7 +929,7 @@ func testV1TSProcessAccountUpdateEvent(t *testing.T) {
t.Error(err)
}
- acntUpdateEv := &utils.CGREvent{ // hitting TH_ACNT_UPDATE_EV
+ acntUpdateEv := &engine.CGREvent{ // hitting TH_ACNT_UPDATE_EV
Tenant: "cgrates.org",
ID: "SIMULATE_ACNT_UPDATE_EV",
Event: acnt.AsAccountSummary().AsMapInterface(),
@@ -1013,7 +1013,7 @@ func testV1ThresholdStopCPUProfiling(t *testing.T) {
func testThresholdSCacheProcessEventNotFound(t *testing.T) {
var ids []string
- thEvent := &utils.CGREvent{
+ thEvent := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "THRESHOLD_CACHE",
Event: map[string]any{
@@ -1030,7 +1030,7 @@ func testThresholdSCacheProcessEventNotFound(t *testing.T) {
func testThresholdSCacheProcessEventFound(t *testing.T) {
var ids []string
- thEvent := &utils.CGREvent{
+ thEvent := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "THRESHOLD_CACHE",
Event: map[string]any{
diff --git a/apier/v2/apier.go b/apier/v2/apier.go
index ada2d9568..9b328bb80 100644
--- a/apier/v2/apier.go
+++ b/apier/v2/apier.go
@@ -389,7 +389,7 @@ func (apiv2 *APIerSv2) SetActions(ctx *context.Context, attrs *utils.AttrSetActi
}
// Ping return pong if the service is active
-func (apiv2 *APIerSv2) Ping(ctx *context.Context, ign *utils.CGREvent, reply *string) error {
+func (apiv2 *APIerSv2) Ping(ctx *context.Context, ign *engine.CGREvent, reply *string) error {
*reply = utils.Pong
return nil
}
diff --git a/apier/v2/apierv2_it_test.go b/apier/v2/apierv2_it_test.go
index 8b322d447..d9a467fe0 100644
--- a/apier/v2/apierv2_it_test.go
+++ b/apier/v2/apierv2_it_test.go
@@ -437,7 +437,7 @@ func testAPIerSv2itSetActionPlanWithWrongTiming2(t *testing.T) {
func testAPIerSv2itBackwardsCompatible(t *testing.T) {
var reply string
- if err := apierRPC.Call(context.Background(), "ApierV2.Ping", new(utils.CGREvent), &reply); err != nil {
+ if err := apierRPC.Call(context.Background(), "ApierV2.Ping", new(engine.CGREvent), &reply); err != nil {
t.Error(err)
} else if reply != utils.Pong {
t.Errorf("Expecting : %+v, received: %+v", utils.Pong, reply)
diff --git a/apier/v2/cdrs.go b/apier/v2/cdrs.go
index cc3a4c594..75e914c34 100644
--- a/apier/v2/cdrs.go
+++ b/apier/v2/cdrs.go
@@ -74,6 +74,6 @@ func (cdrSv2 *CDRsV2) StoreSessionCost(ctx *context.Context, args *engine.ArgsV2
}
// ProcessEvent will process an Event based on the flags attached
-func (cdrSv2 *CDRsV2) ProcessEvent(ctx *context.Context, arg *engine.ArgV1ProcessEvent, evs *[]*utils.EventWithFlags) error {
+func (cdrSv2 *CDRsV2) ProcessEvent(ctx *context.Context, arg *engine.ArgV1ProcessEvent, evs *[]*engine.EventWithFlags) error {
return cdrSv2.CDRs.V2ProcessEvent(ctx, arg, evs)
}
diff --git a/apier/v2/cdrs_it_test.go b/apier/v2/cdrs_it_test.go
index 67f522a63..e451b4d68 100644
--- a/apier/v2/cdrs_it_test.go
+++ b/apier/v2/cdrs_it_test.go
@@ -151,7 +151,7 @@ func testV2CDRsLoadTariffPlanFromFolder(t *testing.T) {
func testV2CDRsProcessCDR(t *testing.T) {
args := &engine.ArgV1ProcessEvent{
Flags: []string{utils.MetaRALs},
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.OriginID: "testV2CDRsProcessCDR1",
@@ -341,7 +341,7 @@ func testV2CDRsGetCdrs2(t *testing.T) {
func testV2CDRsUsageNegative(t *testing.T) {
argsCdr := &engine.ArgV1ProcessEvent{
Flags: []string{utils.MetaRALs},
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.OriginID: "testV2CDRsUsageNegative",
@@ -496,7 +496,7 @@ func testV2CDRsDifferentTenants(t *testing.T) {
argsCdr := &engine.ArgV1ProcessEvent{
Flags: []string{utils.MetaAttributes, utils.MetaChargers, "*stats:false", "*thresholds:false", utils.MetaStore},
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.com",
Event: map[string]any{
utils.OriginID: "testV2CDRsDifferentTenants",
@@ -555,7 +555,7 @@ func testV2CDRsRemoveRatingProfiles(t *testing.T) {
func testV2CDRsProcessCDRNoRattingPlan(t *testing.T) {
args := &engine.ArgV1ProcessEvent{
Flags: []string{utils.MetaRALs},
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.OriginID: "testV2CDRsProcessCDR4",
@@ -778,7 +778,7 @@ func testV2CDRsSetThreshold(t *testing.T) {
func testV2CDRsProcessCDRWithThreshold(t *testing.T) {
args := &engine.ArgV1ProcessEvent{
Flags: []string{utils.MetaThresholds, utils.MetaRALs, utils.ConcatenatedKey(utils.MetaChargers, "false")},
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.OriginID: "testV2CDRsProcessCDRWithThreshold",
@@ -817,7 +817,7 @@ func testV2CDRsGetThreshold(t *testing.T) {
func testv2CDRsGetCDRsDest(t *testing.T) {
args := &engine.ArgV1ProcessEvent{
Flags: []string{utils.MetaStore},
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.CGRID: "9b3cd5e698af94f8916220866c831a982ed16318",
@@ -915,7 +915,7 @@ func testV2CDRsRerate(t *testing.T) {
args := &engine.ArgV1ProcessEvent{
Flags: []string{utils.MetaRALs},
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.OriginID: "testV2CDRsRerate",
@@ -933,7 +933,7 @@ func testV2CDRsRerate(t *testing.T) {
},
}
- var rplProcEv []*utils.EventWithFlags
+ var rplProcEv []*engine.EventWithFlags
if err := cdrsRpc.Call(context.Background(), utils.CDRsV2ProcessEvent, args, &rplProcEv); err != nil {
t.Error("Unexpected error: ", err.Error())
}
@@ -947,7 +947,7 @@ func testV2CDRsRerate(t *testing.T) {
args2 := &engine.ArgV1ProcessEvent{
Flags: []string{utils.MetaRerate},
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.OriginID: "testV2CDRsRerate",
@@ -987,7 +987,7 @@ func testv2CDRsDynaPrepaid(t *testing.T) {
args := &engine.ArgV1ProcessEvent{
Flags: []string{utils.MetaRALs},
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.OriginID: "testv2CDRsDynaPrepaid",
@@ -1081,7 +1081,7 @@ func testV2CDRsDuplicateCDRs(t *testing.T) {
args := &engine.ArgV1ProcessEvent{
Flags: []string{utils.MetaRerate},
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.OriginID: "testV2CDRsDuplicateCDRs",
@@ -1099,7 +1099,7 @@ func testV2CDRsDuplicateCDRs(t *testing.T) {
},
}
- var rplProcEv []*utils.EventWithFlags
+ var rplProcEv []*engine.EventWithFlags
if err := cdrsRpc.Call(context.Background(), utils.CDRsV2ProcessEvent, args, &rplProcEv); err != nil {
t.Error("Unexpected error: ", err.Error())
}
@@ -1115,10 +1115,10 @@ func testV2CDRsDuplicateCDRs(t *testing.T) {
for i := 0; i < 10; i++ {
wg.Add(1)
go func() {
- var rplProcEv []*utils.EventWithFlags
+ var rplProcEv []*engine.EventWithFlags
args2 := &engine.ArgV1ProcessEvent{
Flags: []string{utils.MetaRerate},
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.OriginID: "testV2CDRsDuplicateCDRs",
diff --git a/apier/v2/cdrs_offline_it_test.go b/apier/v2/cdrs_offline_it_test.go
index c1e39f302..770558092 100644
--- a/apier/v2/cdrs_offline_it_test.go
+++ b/apier/v2/cdrs_offline_it_test.go
@@ -188,7 +188,7 @@ func testV2CDRsOfflineBalanceUpdate(t *testing.T) {
t.Errorf("Expecting: %+v, received: %+v", tPrfl, thReply)
}
- cgrEv := &utils.CGREvent{
+ cgrEv := &engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.OriginID: "testV2CDRsOfflineProcessCDR2",
@@ -307,7 +307,7 @@ func testV2CDRsOfflineExpiryBalance(t *testing.T) {
}
args := &engine.ArgV1ProcessEvent{
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.OriginID: "testV2CDRsOfflineProcessCDR1",
@@ -359,7 +359,7 @@ func testV2CDRsBalancesWithSameWeight(t *testing.T) {
t.Errorf("Unexpected balance received: %+v", acnt.BalanceMap[utils.MetaMonetary])
}
- cgrEv := &utils.CGREvent{
+ cgrEv := &engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.OriginID: "testV2CDRsBalancesWithSameWeight",
diff --git a/apier/v2/dispatcher.go b/apier/v2/dispatcher.go
index 1c9402701..c6c97621d 100644
--- a/apier/v2/dispatcher.go
+++ b/apier/v2/dispatcher.go
@@ -22,7 +22,6 @@ import (
"github.com/cgrates/birpc/context"
"github.com/cgrates/cgrates/dispatchers"
"github.com/cgrates/cgrates/engine"
- "github.com/cgrates/cgrates/utils"
)
func NewDispatcherSCDRsV2(dps *dispatchers.DispatcherService) *DispatcherSCDRsV2 {
@@ -38,6 +37,6 @@ func (dS *DispatcherSCDRsV2) StoreSessionCost(ctx *context.Context, args *engine
return dS.dS.CDRsV2StoreSessionCost(ctx, args, reply)
}
-func (dS *DispatcherSCDRsV2) ProcessEvent(ctx *context.Context, args *engine.ArgV1ProcessEvent, reply *[]*utils.EventWithFlags) error {
+func (dS *DispatcherSCDRsV2) ProcessEvent(ctx *context.Context, args *engine.ArgV1ProcessEvent, reply *[]*engine.EventWithFlags) error {
return dS.dS.CDRsV2ProcessEvent(ctx, args, reply)
}
diff --git a/cmd/cgr-tester/sessions.go b/cmd/cgr-tester/sessions.go
index 2a319d541..95bd0c7aa 100644
--- a/cmd/cgr-tester/sessions.go
+++ b/cmd/cgr-tester/sessions.go
@@ -28,6 +28,7 @@ import (
"github.com/cgrates/birpc"
"github.com/cgrates/birpc/context"
+ "github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/sessions"
"github.com/cgrates/cgrates/utils"
)
@@ -59,7 +60,7 @@ func callSessions(ctx *context.Context, authDur, initDur, updateDur, terminateDu
acc := utils.RandomInteger(digitMin, digitMax)
dest := utils.RandomInteger(digitMin, digitMax)
- event := &utils.CGREvent{
+ event := &engine.CGREvent{
Tenant: *tenant,
ID: "EventID1",
Time: utils.TimePointer(time.Now()),
diff --git a/console/attributes_for_event.go b/console/attributes_for_event.go
index b25f8abdb..bae8cce53 100644
--- a/console/attributes_for_event.go
+++ b/console/attributes_for_event.go
@@ -27,7 +27,7 @@ func init() {
c := &CmdGetAttributeForEvent{
name: "attributes_for_event",
rpcMethod: utils.AttributeSv1GetAttributeForEvent,
- rpcParams: &utils.CGREvent{},
+ rpcParams: &engine.CGREvent{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
@@ -36,7 +36,7 @@ func init() {
type CmdGetAttributeForEvent struct {
name string
rpcMethod string
- rpcParams *utils.CGREvent
+ rpcParams *engine.CGREvent
*CommandExecuter
}
@@ -50,7 +50,7 @@ func (self *CmdGetAttributeForEvent) RpcMethod() string {
func (self *CmdGetAttributeForEvent) RpcParams(reset bool) any {
if reset || self.rpcParams == nil {
- self.rpcParams = new(utils.CGREvent)
+ self.rpcParams = new(engine.CGREvent)
}
return self.rpcParams
}
diff --git a/console/attributes_process_event.go b/console/attributes_process_event.go
index a97894ee6..21df300ef 100644
--- a/console/attributes_process_event.go
+++ b/console/attributes_process_event.go
@@ -29,7 +29,7 @@ func init() {
c := &CmdAttributesProcessEvent{
name: "attributes_process_event",
rpcMethod: utils.AttributeSv1ProcessEvent,
- rpcParams: &utils.CGREvent{},
+ rpcParams: &engine.CGREvent{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
@@ -38,7 +38,7 @@ func init() {
type CmdAttributesProcessEvent struct {
name string
rpcMethod string
- rpcParams *utils.CGREvent
+ rpcParams *engine.CGREvent
*CommandExecuter
}
@@ -52,7 +52,7 @@ func (self *CmdAttributesProcessEvent) RpcMethod() string {
func (self *CmdAttributesProcessEvent) RpcParams(reset bool) any {
if reset || self.rpcParams == nil {
- self.rpcParams = new(utils.CGREvent)
+ self.rpcParams = new(engine.CGREvent)
}
return self.rpcParams
}
diff --git a/console/chargers_for_event.go b/console/chargers_for_event.go
index 376174247..c8bea0c63 100644
--- a/console/chargers_for_event.go
+++ b/console/chargers_for_event.go
@@ -27,7 +27,7 @@ func init() {
c := &CmdGetChargersForEvent{
name: "chargers_for_event",
rpcMethod: utils.ChargerSv1GetChargersForEvent,
- rpcParams: &utils.CGREvent{},
+ rpcParams: &engine.CGREvent{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
@@ -36,7 +36,7 @@ func init() {
type CmdGetChargersForEvent struct {
name string
rpcMethod string
- rpcParams *utils.CGREvent
+ rpcParams *engine.CGREvent
*CommandExecuter
}
@@ -50,7 +50,7 @@ func (self *CmdGetChargersForEvent) RpcMethod() string {
func (self *CmdGetChargersForEvent) RpcParams(reset bool) any {
if reset || self.rpcParams == nil {
- self.rpcParams = new(utils.CGREvent)
+ self.rpcParams = new(engine.CGREvent)
}
return self.rpcParams
}
diff --git a/console/chargers_process_event.go b/console/chargers_process_event.go
index 43105c5ea..baa02ad74 100644
--- a/console/chargers_process_event.go
+++ b/console/chargers_process_event.go
@@ -29,7 +29,7 @@ func init() {
c := &CmdChargersProcessEvent{
name: "chargers_process_event",
rpcMethod: utils.ChargerSv1ProcessEvent,
- rpcParams: &utils.CGREvent{},
+ rpcParams: &engine.CGREvent{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
@@ -38,7 +38,7 @@ func init() {
type CmdChargersProcessEvent struct {
name string
rpcMethod string
- rpcParams *utils.CGREvent
+ rpcParams *engine.CGREvent
*CommandExecuter
}
@@ -52,7 +52,7 @@ func (self *CmdChargersProcessEvent) RpcMethod() string {
func (self *CmdChargersProcessEvent) RpcParams(reset bool) any {
if reset || self.rpcParams == nil {
- self.rpcParams = new(utils.CGREvent)
+ self.rpcParams = new(engine.CGREvent)
}
return self.rpcParams
}
diff --git a/console/command_test.go b/console/command_test.go
index 5350963cf..e0adc2ed4 100644
--- a/console/command_test.go
+++ b/console/command_test.go
@@ -22,6 +22,7 @@ import (
"reflect"
"testing"
+ "github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
@@ -44,7 +45,7 @@ func TestGetCommandValueCase1(t *testing.T) {
expected := &CmdGetChargersForEvent{
name: "chargers_for_event",
rpcMethod: utils.ChargerSv1GetChargersForEvent,
- rpcParams: &utils.CGREvent{},
+ rpcParams: &engine.CGREvent{},
}
result, err := GetCommandValue("chargers_for_event", false)
if err != nil {
diff --git a/console/dispatchers_for_event.go b/console/dispatchers_for_event.go
index efddc8f27..02e727551 100644
--- a/console/dispatchers_for_event.go
+++ b/console/dispatchers_for_event.go
@@ -36,7 +36,7 @@ func init() {
type CmdDispatcherProfile struct {
name string
rpcMethod string
- rpcParams *utils.CGREvent
+ rpcParams *engine.CGREvent
*CommandExecuter
}
@@ -50,7 +50,7 @@ func (self *CmdDispatcherProfile) RpcMethod() string {
func (self *CmdDispatcherProfile) RpcParams(reset bool) any {
if reset || self.rpcParams == nil {
- self.rpcParams = new(utils.CGREvent)
+ self.rpcParams = new(engine.CGREvent)
}
return self.rpcParams
}
diff --git a/console/ping.go b/console/ping.go
index 3c9e9af48..af937aaa0 100644
--- a/console/ping.go
+++ b/console/ping.go
@@ -21,6 +21,7 @@ package console
import (
"strings"
+ "github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
@@ -97,7 +98,7 @@ func (self *CmdApierPing) PostprocessRpcParams() error {
if val, can := self.rpcParams.(*StringWrapper); can {
self.item = val.Item
}
- self.rpcParams = &utils.CGREvent{}
+ self.rpcParams = &engine.CGREvent{}
return nil
}
diff --git a/console/resources_allocate.go b/console/resources_allocate.go
index 3b25b3e9f..d605e6ec9 100644
--- a/console/resources_allocate.go
+++ b/console/resources_allocate.go
@@ -21,6 +21,7 @@ package console
import (
"time"
+ "github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
@@ -28,7 +29,7 @@ func init() {
c := &CmdResourceAllocate{
name: "resources_allocate",
rpcMethod: utils.ResourceSv1AllocateResources,
- rpcParams: &utils.CGREvent{},
+ rpcParams: &engine.CGREvent{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
@@ -38,7 +39,7 @@ func init() {
type CmdResourceAllocate struct {
name string
rpcMethod string
- rpcParams *utils.CGREvent
+ rpcParams *engine.CGREvent
*CommandExecuter
}
@@ -52,7 +53,7 @@ func (self *CmdResourceAllocate) RpcMethod() string {
func (self *CmdResourceAllocate) RpcParams(reset bool) any {
if reset || self.rpcParams == nil {
- self.rpcParams = new(utils.CGREvent)
+ self.rpcParams = new(engine.CGREvent)
}
return self.rpcParams
}
diff --git a/console/resources_authorize.go b/console/resources_authorize.go
index 2a08c70a2..147642db5 100644
--- a/console/resources_authorize.go
+++ b/console/resources_authorize.go
@@ -21,6 +21,7 @@ package console
import (
"time"
+ "github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
@@ -28,7 +29,7 @@ func init() {
c := &CmdResourceAuthorize{
name: "resources_authorize",
rpcMethod: utils.ResourceSv1AuthorizeResources,
- rpcParams: &utils.CGREvent{},
+ rpcParams: &engine.CGREvent{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
@@ -38,7 +39,7 @@ func init() {
type CmdResourceAuthorize struct {
name string
rpcMethod string
- rpcParams *utils.CGREvent
+ rpcParams *engine.CGREvent
*CommandExecuter
}
@@ -52,7 +53,7 @@ func (self *CmdResourceAuthorize) RpcMethod() string {
func (self *CmdResourceAuthorize) RpcParams(reset bool) any {
if reset || self.rpcParams == nil {
- self.rpcParams = new(utils.CGREvent)
+ self.rpcParams = new(engine.CGREvent)
}
return self.rpcParams
}
diff --git a/console/resources_for_event.go b/console/resources_for_event.go
index d4965bbea..10d10f97c 100644
--- a/console/resources_for_event.go
+++ b/console/resources_for_event.go
@@ -29,7 +29,7 @@ func init() {
c := &CmdGetResourceForEvent{
name: "resources_for_event",
rpcMethod: utils.ResourceSv1GetResourcesForEvent,
- rpcParams: &utils.CGREvent{},
+ rpcParams: &engine.CGREvent{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
@@ -39,7 +39,7 @@ func init() {
type CmdGetResourceForEvent struct {
name string
rpcMethod string
- rpcParams *utils.CGREvent
+ rpcParams *engine.CGREvent
*CommandExecuter
}
@@ -53,7 +53,7 @@ func (self *CmdGetResourceForEvent) RpcMethod() string {
func (self *CmdGetResourceForEvent) RpcParams(reset bool) any {
if reset || self.rpcParams == nil {
- self.rpcParams = new(utils.CGREvent)
+ self.rpcParams = new(engine.CGREvent)
}
return self.rpcParams
}
diff --git a/console/resources_release.go b/console/resources_release.go
index 9585db8b2..a22c390a2 100644
--- a/console/resources_release.go
+++ b/console/resources_release.go
@@ -21,6 +21,7 @@ package console
import (
"time"
+ "github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
@@ -28,7 +29,7 @@ func init() {
c := &CmdResourceRelease{
name: "resources_release",
rpcMethod: utils.ResourceSv1ReleaseResources,
- rpcParams: &utils.CGREvent{},
+ rpcParams: &engine.CGREvent{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
@@ -38,7 +39,7 @@ func init() {
type CmdResourceRelease struct {
name string
rpcMethod string
- rpcParams *utils.CGREvent
+ rpcParams *engine.CGREvent
*CommandExecuter
}
@@ -52,7 +53,7 @@ func (self *CmdResourceRelease) RpcMethod() string {
func (self *CmdResourceRelease) RpcParams(reset bool) any {
if reset || self.rpcParams == nil {
- self.rpcParams = new(utils.CGREvent)
+ self.rpcParams = new(engine.CGREvent)
}
return self.rpcParams
}
diff --git a/console/routes.go b/console/routes.go
index d47da7f38..aa5636279 100644
--- a/console/routes.go
+++ b/console/routes.go
@@ -29,7 +29,7 @@ func init() {
c := &CmdRoutesSort{
name: "routes",
rpcMethod: utils.RouteSv1GetRoutes,
- rpcParams: &utils.CGREvent{},
+ rpcParams: &engine.CGREvent{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
@@ -38,7 +38,7 @@ func init() {
type CmdRoutesSort struct {
name string
rpcMethod string
- rpcParams *utils.CGREvent
+ rpcParams *engine.CGREvent
*CommandExecuter
}
@@ -52,7 +52,7 @@ func (self *CmdRoutesSort) RpcMethod() string {
func (self *CmdRoutesSort) RpcParams(reset bool) any {
if reset || self.rpcParams == nil {
- self.rpcParams = new(utils.CGREvent)
+ self.rpcParams = new(engine.CGREvent)
}
return self.rpcParams
}
diff --git a/console/routes_profiles_for_event.go b/console/routes_profiles_for_event.go
index e279df47a..61514f1bc 100644
--- a/console/routes_profiles_for_event.go
+++ b/console/routes_profiles_for_event.go
@@ -27,7 +27,7 @@ func init() {
c := &CmdGetRouteForEvent{
name: "routes_profiles_for_event",
rpcMethod: utils.RouteSv1GetRouteProfilesForEvent,
- rpcParams: &utils.CGREvent{},
+ rpcParams: &engine.CGREvent{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
@@ -36,7 +36,7 @@ func init() {
type CmdGetRouteForEvent struct {
name string
rpcMethod string
- rpcParams *utils.CGREvent
+ rpcParams *engine.CGREvent
*CommandExecuter
}
@@ -50,7 +50,7 @@ func (self *CmdGetRouteForEvent) RpcMethod() string {
func (self *CmdGetRouteForEvent) RpcParams(reset bool) any {
if reset || self.rpcParams == nil {
- self.rpcParams = new(utils.CGREvent)
+ self.rpcParams = new(engine.CGREvent)
}
return self.rpcParams
}
diff --git a/console/scheduler_reload.go b/console/scheduler_reload.go
index 228902c4c..2ca5cbb3a 100644
--- a/console/scheduler_reload.go
+++ b/console/scheduler_reload.go
@@ -18,7 +18,10 @@ along with this program. If not, see
package console
-import "github.com/cgrates/cgrates/utils"
+import (
+ "github.com/cgrates/cgrates/engine"
+ "github.com/cgrates/cgrates/utils"
+)
func init() {
c := &CmdReloadScheduler{
@@ -33,7 +36,7 @@ func init() {
type CmdReloadScheduler struct {
name string
rpcMethod string
- rpcParams *utils.CGREvent
+ rpcParams *engine.CGREvent
*CommandExecuter
}
@@ -47,7 +50,7 @@ func (self *CmdReloadScheduler) RpcMethod() string {
func (self *CmdReloadScheduler) RpcParams(reset bool) any {
if reset || self.rpcParams == nil {
- self.rpcParams = &utils.CGREvent{}
+ self.rpcParams = &engine.CGREvent{}
}
return self.rpcParams
}
diff --git a/console/session_authorize_event.go b/console/session_authorize_event.go
index 83ab7d8df..b08733395 100644
--- a/console/session_authorize_event.go
+++ b/console/session_authorize_event.go
@@ -21,6 +21,7 @@ package console
import (
"time"
+ "github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/sessions"
"github.com/cgrates/cgrates/utils"
)
@@ -53,7 +54,7 @@ func (self *CmdSessionsAuthorize) RpcMethod() string {
func (self *CmdSessionsAuthorize) RpcParams(reset bool) any {
if reset || self.rpcParams == nil {
self.rpcParams = &sessions.V1AuthorizeArgs{
- CGREvent: new(utils.CGREvent),
+ CGREvent: new(engine.CGREvent),
}
}
return self.rpcParams
diff --git a/console/session_initiate.go b/console/session_initiate.go
index 752c806c0..33bfb0d61 100644
--- a/console/session_initiate.go
+++ b/console/session_initiate.go
@@ -21,6 +21,7 @@ package console
import (
"time"
+ "github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/sessions"
"github.com/cgrates/cgrates/utils"
)
@@ -53,7 +54,7 @@ func (self *CmdSessionsInitiate) RpcMethod() string {
func (self *CmdSessionsInitiate) RpcParams(reset bool) any {
if reset || self.rpcParams == nil {
self.rpcParams = &sessions.V1InitSessionArgs{
- CGREvent: new(utils.CGREvent),
+ CGREvent: new(engine.CGREvent),
}
}
return self.rpcParams
diff --git a/console/session_process_cdr.go b/console/session_process_cdr.go
index eaa0edbd6..2f01c68bb 100644
--- a/console/session_process_cdr.go
+++ b/console/session_process_cdr.go
@@ -21,6 +21,7 @@ package console
import (
"time"
+ "github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
@@ -28,7 +29,7 @@ func init() {
c := &CmdSessionsProcessCDR{
name: "session_process_cdr",
rpcMethod: utils.SessionSv1ProcessCDR,
- rpcParams: &utils.CGREvent{},
+ rpcParams: &engine.CGREvent{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
@@ -37,7 +38,7 @@ func init() {
type CmdSessionsProcessCDR struct {
name string
rpcMethod string
- rpcParams *utils.CGREvent
+ rpcParams *engine.CGREvent
*CommandExecuter
}
@@ -51,7 +52,7 @@ func (self *CmdSessionsProcessCDR) RpcMethod() string {
func (self *CmdSessionsProcessCDR) RpcParams(reset bool) any {
if reset || self.rpcParams == nil {
- self.rpcParams = new(utils.CGREvent)
+ self.rpcParams = new(engine.CGREvent)
}
return self.rpcParams
}
diff --git a/console/session_process_message.go b/console/session_process_message.go
index 4067d858e..63178e7b5 100644
--- a/console/session_process_message.go
+++ b/console/session_process_message.go
@@ -21,6 +21,7 @@ package console
import (
"time"
+ "github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/sessions"
"github.com/cgrates/cgrates/utils"
)
@@ -53,7 +54,7 @@ func (self *CmdSessionsProcessEvent) RpcMethod() string {
func (self *CmdSessionsProcessEvent) RpcParams(reset bool) any {
if reset || self.rpcParams == nil {
self.rpcParams = &sessions.V1ProcessMessageArgs{
- CGREvent: new(utils.CGREvent),
+ CGREvent: new(engine.CGREvent),
}
}
return self.rpcParams
diff --git a/console/session_terminate.go b/console/session_terminate.go
index 37a262ace..abc79b291 100644
--- a/console/session_terminate.go
+++ b/console/session_terminate.go
@@ -21,6 +21,7 @@ package console
import (
"time"
+ "github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/sessions"
"github.com/cgrates/cgrates/utils"
)
@@ -53,7 +54,7 @@ func (self *CmdSessionsTerminate) RpcMethod() string {
func (self *CmdSessionsTerminate) RpcParams(reset bool) any {
if reset || self.rpcParams == nil {
self.rpcParams = &sessions.V1TerminateSessionArgs{
- CGREvent: new(utils.CGREvent),
+ CGREvent: new(engine.CGREvent),
}
}
return self.rpcParams
diff --git a/console/session_update.go b/console/session_update.go
index ca1d7c4ba..0b03096f1 100644
--- a/console/session_update.go
+++ b/console/session_update.go
@@ -21,6 +21,7 @@ package console
import (
"time"
+ "github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/sessions"
"github.com/cgrates/cgrates/utils"
)
@@ -53,7 +54,7 @@ func (self *CmdSessionsUpdate) RpcMethod() string {
func (self *CmdSessionsUpdate) RpcParams(reset bool) any {
if reset || self.rpcParams == nil {
self.rpcParams = &sessions.V1UpdateSessionArgs{
- CGREvent: new(utils.CGREvent),
+ CGREvent: new(engine.CGREvent),
}
}
return self.rpcParams
diff --git a/console/stats_for_event.go b/console/stats_for_event.go
index 0ca73c959..e370a8d29 100644
--- a/console/stats_for_event.go
+++ b/console/stats_for_event.go
@@ -21,6 +21,7 @@ package console
import (
"time"
+ "github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
@@ -28,7 +29,7 @@ func init() {
c := &CmdStatsQueueForEvent{
name: "stats_for_event",
rpcMethod: utils.StatSv1GetStatQueuesForEvent,
- rpcParams: &utils.CGREvent{},
+ rpcParams: &engine.CGREvent{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
@@ -38,7 +39,7 @@ func init() {
type CmdStatsQueueForEvent struct {
name string
rpcMethod string
- rpcParams *utils.CGREvent
+ rpcParams *engine.CGREvent
*CommandExecuter
}
@@ -52,7 +53,7 @@ func (self *CmdStatsQueueForEvent) RpcMethod() string {
func (self *CmdStatsQueueForEvent) RpcParams(reset bool) any {
if reset || self.rpcParams == nil {
- self.rpcParams = new(utils.CGREvent)
+ self.rpcParams = new(engine.CGREvent)
}
return self.rpcParams
}
diff --git a/console/stats_process_event.go b/console/stats_process_event.go
index 5ad5591df..130b2aa61 100644
--- a/console/stats_process_event.go
+++ b/console/stats_process_event.go
@@ -21,6 +21,7 @@ package console
import (
"time"
+ "github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
@@ -28,7 +29,7 @@ func init() {
c := &CmdStatQueueProcessEvent{
name: "stats_process_event",
rpcMethod: utils.StatSv1ProcessEvent,
- rpcParams: &utils.CGREvent{},
+ rpcParams: &engine.CGREvent{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
@@ -38,7 +39,7 @@ func init() {
type CmdStatQueueProcessEvent struct {
name string
rpcMethod string
- rpcParams *utils.CGREvent
+ rpcParams *engine.CGREvent
*CommandExecuter
}
@@ -52,7 +53,7 @@ func (self *CmdStatQueueProcessEvent) RpcMethod() string {
func (self *CmdStatQueueProcessEvent) RpcParams(reset bool) any {
if reset || self.rpcParams == nil {
- self.rpcParams = new(utils.CGREvent)
+ self.rpcParams = new(engine.CGREvent)
}
return self.rpcParams
}
diff --git a/console/thresholds_for_event.go b/console/thresholds_for_event.go
index 120e92a9c..8d5083544 100644
--- a/console/thresholds_for_event.go
+++ b/console/thresholds_for_event.go
@@ -29,7 +29,7 @@ func init() {
c := &CmdThresholdsForEvent{
name: "thresholds_for_event",
rpcMethod: utils.ThresholdSv1GetThresholdsForEvent,
- rpcParams: &utils.CGREvent{},
+ rpcParams: &engine.CGREvent{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
@@ -38,7 +38,7 @@ func init() {
type CmdThresholdsForEvent struct {
name string
rpcMethod string
- rpcParams *utils.CGREvent
+ rpcParams *engine.CGREvent
*CommandExecuter
}
@@ -52,7 +52,7 @@ func (self *CmdThresholdsForEvent) RpcMethod() string {
func (self *CmdThresholdsForEvent) RpcParams(reset bool) any {
if reset || self.rpcParams == nil {
- self.rpcParams = new(utils.CGREvent)
+ self.rpcParams = new(engine.CGREvent)
}
return self.rpcParams
}
diff --git a/console/thresholds_process_event.go b/console/thresholds_process_event.go
index 231b0214a..67a5c72e0 100644
--- a/console/thresholds_process_event.go
+++ b/console/thresholds_process_event.go
@@ -21,6 +21,7 @@ package console
import (
"time"
+ "github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
@@ -28,7 +29,7 @@ func init() {
c := &CmdThresholdProcessEvent{
name: "thresholds_process_event",
rpcMethod: utils.ThresholdSv1ProcessEvent,
- rpcParams: &utils.CGREvent{},
+ rpcParams: &engine.CGREvent{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
@@ -37,7 +38,7 @@ func init() {
type CmdThresholdProcessEvent struct {
name string
rpcMethod string
- rpcParams *utils.CGREvent
+ rpcParams *engine.CGREvent
*CommandExecuter
}
@@ -51,7 +52,7 @@ func (self *CmdThresholdProcessEvent) RpcMethod() string {
func (self *CmdThresholdProcessEvent) RpcParams(reset bool) any {
if reset || self.rpcParams == nil {
- self.rpcParams = new(utils.CGREvent)
+ self.rpcParams = new(engine.CGREvent)
}
return self.rpcParams
}
diff --git a/cores/server_it_test.go b/cores/server_it_test.go
index 62bf61e14..0ccb7b7a5 100644
--- a/cores/server_it_test.go
+++ b/cores/server_it_test.go
@@ -699,7 +699,7 @@ func testAcceptBiRPC(t *testing.T) {
rpc := jsonrpc.NewClient(p2)
var reply string
expected := "birpc: can't find method AttributeSv1.Ping"
- if err := rpc.Call(context.Background(), utils.AttributeSv1Ping, utils.CGREvent{}, &reply); err == nil || err.Error() != expected {
+ if err := rpc.Call(context.Background(), utils.AttributeSv1Ping, engine.CGREvent{}, &reply); err == nil || err.Error() != expected {
t.Errorf("Expected %+v, received %+v", expected, err)
}
diff --git a/dispatchers/attributes.go b/dispatchers/attributes.go
index 1fb0b5e38..7eebff29f 100644
--- a/dispatchers/attributes.go
+++ b/dispatchers/attributes.go
@@ -25,10 +25,10 @@ import (
)
// AttributeSv1Ping interrogates AttributeS server responsible to process the event
-func (dS *DispatcherService) AttributeSv1Ping(ctx *context.Context, args *utils.CGREvent,
+func (dS *DispatcherService) AttributeSv1Ping(ctx *context.Context, args *engine.CGREvent,
reply *string) (err error) {
if args == nil {
- args = new(utils.CGREvent)
+ args = new(engine.CGREvent)
}
tnt := dS.cfg.GeneralCfg().DefaultTenant
if args.Tenant != utils.EmptyString {
@@ -44,7 +44,7 @@ func (dS *DispatcherService) AttributeSv1Ping(ctx *context.Context, args *utils.
}
// AttributeSv1GetAttributeForEvent is the dispatcher method for AttributeSv1.GetAttributeForEvent
-func (dS *DispatcherService) AttributeSv1GetAttributeForEvent(ctx *context.Context, args *utils.CGREvent,
+func (dS *DispatcherService) AttributeSv1GetAttributeForEvent(ctx *context.Context, args *engine.CGREvent,
reply *engine.AttributeProfile) (err error) {
tnt := dS.cfg.GeneralCfg().DefaultTenant
if args != nil && args.Tenant != utils.EmptyString {
@@ -60,7 +60,7 @@ func (dS *DispatcherService) AttributeSv1GetAttributeForEvent(ctx *context.Conte
}
// AttributeSv1ProcessEvent .
-func (dS *DispatcherService) AttributeSv1ProcessEvent(ctx *context.Context, args *utils.CGREvent,
+func (dS *DispatcherService) AttributeSv1ProcessEvent(ctx *context.Context, args *engine.CGREvent,
reply *engine.AttrSProcessEventReply) (err error) {
tnt := dS.cfg.GeneralCfg().DefaultTenant
if args != nil && args.Tenant != utils.EmptyString {
diff --git a/dispatchers/attributes_it_test.go b/dispatchers/attributes_it_test.go
index 29499d95e..da1869d8a 100644
--- a/dispatchers/attributes_it_test.go
+++ b/dispatchers/attributes_it_test.go
@@ -89,19 +89,19 @@ func TestDspAttributeSNoConn(t *testing.T) {
func testDspAttrPingFailover(t *testing.T) {
var reply string
- if err := allEngine.RPC.Call(context.Background(), utils.AttributeSv1Ping, new(utils.CGREvent), &reply); err != nil {
+ if err := allEngine.RPC.Call(context.Background(), utils.AttributeSv1Ping, new(engine.CGREvent), &reply); err != nil {
t.Error(err)
} else if reply != utils.Pong {
t.Errorf("Received: %s", reply)
}
reply = ""
- if err := allEngine2.RPC.Call(context.Background(), utils.AttributeSv1Ping, new(utils.CGREvent), &reply); err != nil {
+ if err := allEngine2.RPC.Call(context.Background(), utils.AttributeSv1Ping, new(engine.CGREvent), &reply); err != nil {
t.Error(err)
} else if reply != utils.Pong {
t.Errorf("Received: %s", reply)
}
reply = ""
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
APIOpts: map[string]any{
utils.OptsAPIKey: "attr12345",
@@ -136,12 +136,12 @@ func testDspAttrPingFailover(t *testing.T) {
func testDspAttrPingFailoverNotFoundHost(t *testing.T) {
var reply string
- if err := allEngine2.RPC.Call(context.Background(), utils.AttributeSv1Ping, new(utils.CGREvent), &reply); err != nil {
+ if err := allEngine2.RPC.Call(context.Background(), utils.AttributeSv1Ping, new(engine.CGREvent), &reply); err != nil {
t.Error(err)
} else if reply != utils.Pong {
t.Errorf("Received: %s", reply)
}
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
"EventName": "NonexistingHost",
@@ -172,19 +172,19 @@ func testDspAttrPingFailoverNotFoundHost(t *testing.T) {
func testDspAttrPingFailover2(t *testing.T) {
var reply string
- if err := allEngine.RPC.Call(context.Background(), utils.AttributeSv1Ping, new(utils.CGREvent), &reply); err != nil {
+ if err := allEngine.RPC.Call(context.Background(), utils.AttributeSv1Ping, new(engine.CGREvent), &reply); err != nil {
t.Error(err)
} else if reply != utils.Pong {
t.Errorf("Received: %s", reply)
}
reply = ""
- if err := allEngine2.RPC.Call(context.Background(), utils.AttributeSv1Ping, new(utils.CGREvent), &reply); err != nil {
+ if err := allEngine2.RPC.Call(context.Background(), utils.AttributeSv1Ping, new(engine.CGREvent), &reply); err != nil {
t.Error(err)
} else if reply != utils.Pong {
t.Errorf("Received: %s", reply)
}
reply = ""
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
APIOpts: map[string]any{
utils.OptsAPIKey: "attr12345",
@@ -212,7 +212,7 @@ func testDspAttrPingFailover2(t *testing.T) {
}
func testDspAttrGetAttrFailover(t *testing.T) {
- args := &utils.CGREvent{
+ args := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSGetAttributeForEvent",
Event: map[string]any{
@@ -247,7 +247,7 @@ func testDspAttrGetAttrFailover(t *testing.T) {
eRply := &engine.AttrSProcessEventReply{
MatchedProfiles: []string{"cgrates.org:ATTR_1002_SIMPLEAUTH"},
AlteredFields: []string{"*req.Password"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSGetAttributeForEvent",
Event: map[string]any{
@@ -305,7 +305,7 @@ func testDspAttrGetAttrFailover(t *testing.T) {
func testDspAttrPing(t *testing.T) {
var reply string
- if err := allEngine.RPC.Call(context.Background(), utils.AttributeSv1Ping, new(utils.CGREvent), &reply); err != nil {
+ if err := allEngine.RPC.Call(context.Background(), utils.AttributeSv1Ping, new(engine.CGREvent), &reply); err != nil {
t.Error(err)
} else if reply != utils.Pong {
t.Errorf("Received: %s", reply)
@@ -313,7 +313,7 @@ func testDspAttrPing(t *testing.T) {
if dispEngine.RPC == nil {
t.Fatal(dispEngine.RPC)
}
- if err := dispEngine.RPC.Call(context.Background(), utils.AttributeSv1Ping, &utils.CGREvent{
+ if err := dispEngine.RPC.Call(context.Background(), utils.AttributeSv1Ping, &engine.CGREvent{
Tenant: "cgrates.org",
APIOpts: map[string]any{
utils.OptsAPIKey: "attr12345",
@@ -326,7 +326,7 @@ func testDspAttrPing(t *testing.T) {
}
func testDspAttrTestMissingArgDispatcher(t *testing.T) {
- args := &utils.CGREvent{
+ args := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSGetAttributeForEvent",
Event: map[string]any{
@@ -344,7 +344,7 @@ func testDspAttrTestMissingArgDispatcher(t *testing.T) {
}
func testDspAttrTestMissingApiKey(t *testing.T) {
- args := &utils.CGREvent{
+ args := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSGetAttributeForEvent",
Event: map[string]any{
@@ -362,7 +362,7 @@ func testDspAttrTestMissingApiKey(t *testing.T) {
}
func testDspAttrTestUnknownApiKey(t *testing.T) {
- args := &utils.CGREvent{
+ args := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSGetAttributeForEvent",
Event: map[string]any{
@@ -380,7 +380,7 @@ func testDspAttrTestUnknownApiKey(t *testing.T) {
}
func testDspAttrTestAuthKey(t *testing.T) {
- args := &utils.CGREvent{
+ args := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSGetAttributeForEvent",
Event: map[string]any{
@@ -399,7 +399,7 @@ func testDspAttrTestAuthKey(t *testing.T) {
}
func testDspAttrTestAuthKey2(t *testing.T) {
- args := &utils.CGREvent{
+ args := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSGetAttributeForEvent",
Event: map[string]any{
@@ -445,7 +445,7 @@ func testDspAttrTestAuthKey2(t *testing.T) {
MatchedProfiles: []string{"cgrates.org:ATTR_1001_SIMPLEAUTH"},
AlteredFields: []string{"*req.Password"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSGetAttributeForEvent",
Event: map[string]any{
@@ -472,7 +472,7 @@ func testDspAttrTestAuthKey2(t *testing.T) {
}
func testDspAttrTestAuthKey3(t *testing.T) {
- args := &utils.CGREvent{
+ args := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSGetAttributeForEvent",
Event: map[string]any{
@@ -492,7 +492,7 @@ func testDspAttrTestAuthKey3(t *testing.T) {
}
func testDspAttrGetAttrRoundRobin(t *testing.T) {
- args := &utils.CGREvent{
+ args := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSGetAttributeForEvent",
Event: map[string]any{
@@ -527,7 +527,7 @@ func testDspAttrGetAttrRoundRobin(t *testing.T) {
eRply := &engine.AttrSProcessEventReply{
MatchedProfiles: []string{"cgrates.org:ATTR_1002_SIMPLEAUTH"},
AlteredFields: []string{"*req.Password"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSGetAttributeForEvent",
Event: map[string]any{
@@ -583,7 +583,7 @@ func testDspAttrGetAttrRoundRobin(t *testing.T) {
}
func testDspAttrGetAttrInternal(t *testing.T) {
- args := &utils.CGREvent{
+ args := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSGetAttributeForEvent",
Event: map[string]any{
@@ -599,7 +599,7 @@ func testDspAttrGetAttrInternal(t *testing.T) {
eRply := &engine.AttrSProcessEventReply{
MatchedProfiles: []string{"cgrates.org:ATTR_1003_SIMPLEAUTH"},
AlteredFields: []string{"*req.Password"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSGetAttributeForEvent",
Event: map[string]any{
@@ -628,7 +628,7 @@ func testDspAttrGetAttrInternal(t *testing.T) {
func testDspAttrPingNoArgDispatcher(t *testing.T) {
var reply string
- if err := allEngine.RPC.Call(context.Background(), utils.AttributeSv1Ping, new(utils.CGREvent), &reply); err != nil {
+ if err := allEngine.RPC.Call(context.Background(), utils.AttributeSv1Ping, new(engine.CGREvent), &reply); err != nil {
t.Error(err)
} else if reply != utils.Pong {
t.Errorf("Received: %s", reply)
@@ -636,7 +636,7 @@ func testDspAttrPingNoArgDispatcher(t *testing.T) {
if dispEngine.RPC == nil {
t.Fatal(dispEngine.RPC)
}
- if err := dispEngine.RPC.Call(context.Background(), utils.AttributeSv1Ping, &utils.CGREvent{Tenant: "cgrates.org"}, &reply); err != nil {
+ if err := dispEngine.RPC.Call(context.Background(), utils.AttributeSv1Ping, &engine.CGREvent{Tenant: "cgrates.org"}, &reply); err != nil {
t.Error(err)
} else if reply != utils.Pong {
t.Errorf("Received: %s", reply)
diff --git a/dispatchers/attributes_test.go b/dispatchers/attributes_test.go
index fa621b74e..ed0c66dd9 100644
--- a/dispatchers/attributes_test.go
+++ b/dispatchers/attributes_test.go
@@ -25,13 +25,12 @@ import (
"github.com/cgrates/birpc/context"
"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{}
+ cgrEvent := &engine.CGREvent{}
var reply *string
err := dspSrv.AttributeSv1Ping(context.Background(), cgrEvent, reply)
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
@@ -43,7 +42,7 @@ func TestDspAttributeSv1PingError(t *testing.T) {
func TestDspAttributeSv1PingErrorTenant(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrEvent := &utils.CGREvent{
+ cgrEvent := &engine.CGREvent{
Tenant: "tenant",
ID: "",
Time: nil,
@@ -73,7 +72,7 @@ func TestDspAttributeSv1PingErrorAttributeSConns(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- cgrEvent := &utils.CGREvent{
+ cgrEvent := &engine.CGREvent{
Tenant: "tenant",
ID: "ID",
Time: nil,
@@ -92,7 +91,7 @@ func TestDspAttributeSv1GetAttributeForEventError(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- processEvent := &utils.CGREvent{
+ processEvent := &engine.CGREvent{
Time: &time.Time{},
}
var reply *engine.AttributeProfile
@@ -107,7 +106,7 @@ func TestDspAttributeSv1GetAttributeForEventErrorTenant(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- processEvent := &utils.CGREvent{
+ processEvent := &engine.CGREvent{
Tenant: "tenant",
Time: &time.Time{},
}
@@ -122,7 +121,7 @@ func TestDspAttributeSv1GetAttributeForEventErrorTenant(t *testing.T) {
func TestDspAttributeSv1GetAttributeForEventErrorAttributeS(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- processEvent := &utils.CGREvent{
+ processEvent := &engine.CGREvent{
Tenant: "tenant",
Time: &time.Time{},
}
@@ -138,7 +137,7 @@ func TestDspAttributeSv1GetAttributeForEventErrorAttributeS(t *testing.T) {
func TestDspAttributeSv1ProcessEventError(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- processEvent := &utils.CGREvent{
+ processEvent := &engine.CGREvent{
Tenant: "tenant",
Time: &time.Time{},
}
@@ -155,7 +154,7 @@ func TestDspAttributeSv1ProcessEventErrorAttributeSConns(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- processEvent := &utils.CGREvent{
+ processEvent := &engine.CGREvent{
Tenant: "tenant",
Time: &time.Time{},
}
diff --git a/dispatchers/caches.go b/dispatchers/caches.go
index 5eed6fbad..14daa0fc1 100644
--- a/dispatchers/caches.go
+++ b/dispatchers/caches.go
@@ -22,15 +22,16 @@ import (
"time"
"github.com/cgrates/birpc/context"
+ "github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
"github.com/cgrates/ltcache"
)
// CacheSv1Ping interogates CacheSv1 server responsible to process the event
-func (dS *DispatcherService) CacheSv1Ping(ctx *context.Context, args *utils.CGREvent,
+func (dS *DispatcherService) CacheSv1Ping(ctx *context.Context, args *engine.CGREvent,
reply *string) (err error) {
if args == nil {
- args = new(utils.CGREvent)
+ args = new(engine.CGREvent)
}
tnt := dS.cfg.GeneralCfg().DefaultTenant
if args.Tenant != utils.EmptyString {
@@ -58,7 +59,7 @@ func (dS *DispatcherService) CacheSv1GetItemIDs(ctx *context.Context, args *util
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
APIOpts: args.APIOpts,
}, utils.MetaCaches, utils.CacheSv1GetItemIDs, args, reply)
@@ -78,7 +79,7 @@ func (dS *DispatcherService) CacheSv1HasItem(ctx *context.Context, args *utils.A
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
APIOpts: args.APIOpts,
},
@@ -101,7 +102,7 @@ func (dS *DispatcherService) CacheSv1GetItem(ctx *context.Context, args *utils.A
return
}
}
- return dS.Dispatch(&utils.CGREvent{Tenant: tnt, Event: ev, APIOpts: opts}, utils.MetaCaches, utils.CacheSv1GetItem, args, reply)
+ return dS.Dispatch(&engine.CGREvent{Tenant: tnt, Event: ev, APIOpts: opts}, utils.MetaCaches, utils.CacheSv1GetItem, args, reply)
}
// CacheSv1GetItemExpiryTime returns the expiryTime for an item
@@ -118,7 +119,7 @@ func (dS *DispatcherService) CacheSv1GetItemExpiryTime(ctx *context.Context, arg
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
APIOpts: args.APIOpts,
}, utils.MetaCaches, utils.CacheSv1GetItemExpiryTime, args, reply)
@@ -137,7 +138,7 @@ func (dS *DispatcherService) CacheSv1RemoveItem(ctx *context.Context, args *util
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
APIOpts: args.APIOpts,
}, utils.MetaCaches, utils.CacheSv1RemoveItem, args, reply)
@@ -156,7 +157,7 @@ func (dS *DispatcherService) CacheSv1RemoveItems(ctx *context.Context, args *uti
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
APIOpts: args.APIOpts,
}, utils.MetaCaches, utils.CacheSv1RemoveItems, args, reply)
@@ -175,7 +176,7 @@ func (dS *DispatcherService) CacheSv1Clear(ctx *context.Context, args *utils.Att
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
APIOpts: args.APIOpts,
}, utils.MetaCaches, utils.CacheSv1Clear, args, reply)
@@ -194,7 +195,7 @@ func (dS *DispatcherService) CacheSv1GetCacheStats(ctx *context.Context, args *u
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
APIOpts: args.APIOpts,
}, utils.MetaCaches, utils.CacheSv1GetCacheStats, args, reply)
@@ -212,7 +213,7 @@ func (dS *DispatcherService) CacheSv1PrecacheStatus(ctx *context.Context, args *
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
APIOpts: args.APIOpts,
}, utils.MetaCaches, utils.CacheSv1PrecacheStatus, args, reply)
@@ -234,7 +235,7 @@ func (dS *DispatcherService) CacheSv1GetItemWithRemote(ctx *context.Context, arg
return
}
}
- return dS.Dispatch(&utils.CGREvent{Tenant: tnt, Event: ev, APIOpts: opts}, utils.MetaCaches, utils.CacheSv1GetItemWithRemote, args, reply)
+ return dS.Dispatch(&engine.CGREvent{Tenant: tnt, Event: ev, APIOpts: opts}, utils.MetaCaches, utils.CacheSv1GetItemWithRemote, args, reply)
}
// CacheSv1HasGroup checks existence of a group in cache
@@ -250,7 +251,7 @@ func (dS *DispatcherService) CacheSv1HasGroup(ctx *context.Context, args *utils.
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
APIOpts: args.APIOpts,
}, utils.MetaCaches, utils.CacheSv1HasGroup, args, reply)
@@ -269,7 +270,7 @@ func (dS *DispatcherService) CacheSv1GetGroupItemIDs(ctx *context.Context, args
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
APIOpts: args.APIOpts,
}, utils.MetaCaches, utils.CacheSv1GetGroupItemIDs, args, reply)
@@ -287,7 +288,7 @@ func (dS *DispatcherService) CacheSv1RemoveGroup(ctx *context.Context, args *uti
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
APIOpts: args.APIOpts,
}, utils.MetaCaches, utils.CacheSv1RemoveGroup, args, reply)
@@ -305,7 +306,7 @@ func (dS *DispatcherService) CacheSv1ReloadCache(ctx *context.Context, args *uti
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
APIOpts: args.APIOpts,
}, utils.MetaCaches, utils.CacheSv1ReloadCache, args, reply)
@@ -323,7 +324,7 @@ func (dS *DispatcherService) CacheSv1LoadCache(ctx *context.Context, args *utils
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
APIOpts: args.APIOpts,
}, utils.MetaCaches, utils.CacheSv1LoadCache, args, reply)
@@ -341,7 +342,7 @@ func (dS *DispatcherService) CacheSv1ReplicateRemove(ctx *context.Context, args
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
APIOpts: args.APIOpts,
}, utils.MetaCaches, utils.CacheSv1ReplicateRemove, args, reply)
@@ -359,7 +360,7 @@ func (dS *DispatcherService) CacheSv1ReplicateSet(ctx *context.Context, args *ut
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
APIOpts: args.APIOpts,
}, utils.MetaCaches, utils.CacheSv1ReplicateSet, args, reply)
diff --git a/dispatchers/caches_it_test.go b/dispatchers/caches_it_test.go
index 35b352b2b..128da1526 100644
--- a/dispatchers/caches_it_test.go
+++ b/dispatchers/caches_it_test.go
@@ -74,7 +74,7 @@ func TestDspCacheSv1(t *testing.T) {
func testDspChcPing(t *testing.T) {
var reply string
- if err := allEngine.RPC.Call(context.Background(), utils.CacheSv1Ping, new(utils.CGREvent), &reply); err != nil {
+ if err := allEngine.RPC.Call(context.Background(), utils.CacheSv1Ping, new(engine.CGREvent), &reply); err != nil {
t.Error(err)
} else if reply != utils.Pong {
t.Errorf("Received: %s", reply)
@@ -82,7 +82,7 @@ func testDspChcPing(t *testing.T) {
if dispEngine.RPC == nil {
t.Fatal(dispEngine.RPC)
}
- if err := dispEngine.RPC.Call(context.Background(), utils.CacheSv1Ping, &utils.CGREvent{
+ if err := dispEngine.RPC.Call(context.Background(), utils.CacheSv1Ping, &engine.CGREvent{
Tenant: "cgrates.org",
diff --git a/dispatchers/caches_test.go b/dispatchers/caches_test.go
index a236ebd65..c838e9233 100644
--- a/dispatchers/caches_test.go
+++ b/dispatchers/caches_test.go
@@ -32,7 +32,7 @@ import (
func TestDspCacheSv1PingError(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.CGREvent{
+ CGREvent := &engine.CGREvent{
Tenant: "tenant",
ID: "",
Time: &time.Time{},
@@ -62,7 +62,7 @@ func TestDspCacheSv1PingErrorAttributeSConns(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.CGREvent{
+ CGREvent := &engine.CGREvent{
Tenant: "tenant",
ID: "",
Time: &time.Time{},
diff --git a/dispatchers/cdrs.go b/dispatchers/cdrs.go
index e3826dfd9..64f944cdd 100644
--- a/dispatchers/cdrs.go
+++ b/dispatchers/cdrs.go
@@ -27,10 +27,10 @@ import (
)
// CDRsV1Ping interogates CDRsV1 server responsible to process the event
-func (dS *DispatcherService) CDRsV1Ping(ctx *context.Context, args *utils.CGREvent,
+func (dS *DispatcherService) CDRsV1Ping(ctx *context.Context, args *engine.CGREvent,
reply *string) (err error) {
if args == nil {
- args = new(utils.CGREvent)
+ args = new(engine.CGREvent)
}
tnt := dS.cfg.GeneralCfg().DefaultTenant
if args.Tenant != utils.EmptyString {
@@ -58,7 +58,7 @@ func (dS *DispatcherService) CDRsV1GetCDRs(ctx *context.Context, args *utils.RPC
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
APIOpts: args.APIOpts,
}, utils.MetaCDRs, utils.CDRsV1GetCDRs, args, reply)
@@ -76,7 +76,7 @@ func (dS *DispatcherService) CDRsV1GetCDRsCount(ctx *context.Context, args *util
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
APIOpts: args.APIOpts,
}, utils.MetaCDRs, utils.CDRsV1GetCDRsCount, args, reply)
@@ -93,7 +93,7 @@ func (dS *DispatcherService) CDRsV1StoreSessionCost(ctx *context.Context, args *
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
APIOpts: args.APIOpts,
}, utils.MetaCDRs, utils.CDRsV1StoreSessionCost, args, reply)
@@ -110,7 +110,7 @@ func (dS *DispatcherService) CDRsV1RateCDRs(ctx *context.Context, args *engine.A
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
APIOpts: args.APIOpts,
}, utils.MetaCDRs, utils.CDRsV1RateCDRs, args, reply)
@@ -127,7 +127,7 @@ func (dS *DispatcherService) CDRsV1ProcessExternalCDR(ctx *context.Context, args
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
APIOpts: args.APIOpts,
}, utils.MetaCDRs, utils.CDRsV1ProcessExternalCDR, args, reply)
@@ -159,13 +159,13 @@ func (dS *DispatcherService) CDRsV1ProcessCDR(ctx *context.Context, args *engine
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
APIOpts: args.APIOpts,
}, utils.MetaCDRs, utils.CDRsV1ProcessCDR, args, reply)
}
-func (dS *DispatcherService) CDRsV2ProcessEvent(ctx *context.Context, args *engine.ArgV1ProcessEvent, reply *[]*utils.EventWithFlags) (err error) {
+func (dS *DispatcherService) CDRsV2ProcessEvent(ctx *context.Context, args *engine.ArgV1ProcessEvent, reply *[]*engine.EventWithFlags) (err error) {
tnt := args.Tenant
if tnt == utils.EmptyString {
tnt = dS.cfg.GeneralCfg().DefaultTenant
@@ -191,7 +191,7 @@ func (dS *DispatcherService) CDRsV2StoreSessionCost(ctx *context.Context, args *
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
APIOpts: args.APIOpts,
}, utils.MetaCDRs, utils.CDRsV2StoreSessionCost, args, reply)
diff --git a/dispatchers/cdrs_it_test.go b/dispatchers/cdrs_it_test.go
index f6ec363b2..b4ab621fb 100644
--- a/dispatchers/cdrs_it_test.go
+++ b/dispatchers/cdrs_it_test.go
@@ -100,12 +100,12 @@ func TestDspCDRsITMySQLWithoutAuth(t *testing.T) {
func testDspCDRsPing(t *testing.T) {
var reply string
- if err := allEngine.RPC.Call(context.Background(), utils.CDRsV1Ping, new(utils.CGREvent), &reply); err != nil {
+ if err := allEngine.RPC.Call(context.Background(), utils.CDRsV1Ping, new(engine.CGREvent), &reply); err != nil {
t.Error(err)
} else if reply != utils.Pong {
t.Errorf("Received: %s", reply)
}
- if err := dispEngine.RPC.Call(context.Background(), utils.CDRsV1Ping, &utils.CGREvent{
+ if err := dispEngine.RPC.Call(context.Background(), utils.CDRsV1Ping, &engine.CGREvent{
Tenant: "cgrates.org",
APIOpts: map[string]any{
utils.OptsAPIKey: "cdrs12345",
@@ -120,7 +120,7 @@ func testDspCDRsPing(t *testing.T) {
func testDspCDRsProcessEvent(t *testing.T) {
var reply string
args := &engine.ArgV1ProcessEvent{
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.OriginID: "testDspCDRsProcessEvent",
@@ -315,10 +315,10 @@ func testDspCDRsGetCDR3(t *testing.T) {
}
func testDspCDRsV2ProcessEvent(t *testing.T) {
- var reply []*utils.EventWithFlags
+ var reply []*engine.EventWithFlags
args := &engine.ArgV1ProcessEvent{
Flags: []string{utils.MetaRALs},
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.OriginID: "testDspCDRsV2ProcessEvent",
@@ -389,12 +389,12 @@ func testDspCDRsV2StoreSessionCost(t *testing.T) {
func testDspCDRsPingNoAuth(t *testing.T) {
var reply string
- if err := allEngine.RPC.Call(context.Background(), utils.CDRsV1Ping, new(utils.CGREvent), &reply); err != nil {
+ if err := allEngine.RPC.Call(context.Background(), utils.CDRsV1Ping, new(engine.CGREvent), &reply); err != nil {
t.Error(err)
} else if reply != utils.Pong {
t.Errorf("Received: %s", reply)
}
- if err := dispEngine.RPC.Call(context.Background(), utils.CDRsV1Ping, &utils.CGREvent{
+ if err := dispEngine.RPC.Call(context.Background(), utils.CDRsV1Ping, &engine.CGREvent{
Tenant: "cgrates.org",
}, &reply); err != nil {
t.Error(err)
@@ -406,7 +406,7 @@ func testDspCDRsPingNoAuth(t *testing.T) {
func testDspCDRsProcessEventNoAuth(t *testing.T) {
var reply string
args := &engine.ArgV1ProcessEvent{
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.OriginID: "testDspCDRsProcessEvent",
@@ -576,10 +576,10 @@ func testDspCDRsGetCDR3NoAuth(t *testing.T) {
}
func testDspCDRsV2ProcessEventNoAuth(t *testing.T) {
- var reply []*utils.EventWithFlags
+ var reply []*engine.EventWithFlags
args := &engine.ArgV1ProcessEvent{
Flags: []string{utils.MetaRALs},
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.OriginID: "testDspCDRsV2ProcessEventNoAuth",
diff --git a/dispatchers/cdrs_test.go b/dispatchers/cdrs_test.go
index 04a0f9184..a39fc17c3 100644
--- a/dispatchers/cdrs_test.go
+++ b/dispatchers/cdrs_test.go
@@ -31,7 +31,7 @@ func TestDspCDRsV1PingError(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.CGREvent{}
+ CGREvent := &engine.CGREvent{}
var reply *string
result := dspSrv.CDRsV1Ping(context.Background(), CGREvent, reply)
expected := "MANDATORY_IE_MISSING: [ApiKey]"
@@ -43,7 +43,7 @@ func TestDspCDRsV1PingError(t *testing.T) {
func TestDspCDRsV1PingNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.CGREvent{
+ CGREvent := &engine.CGREvent{
Tenant: "tenant",
}
var reply *string
@@ -185,7 +185,7 @@ func TestDspCDRsV1ProcessEventError(t *testing.T) {
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
CGREvent := &engine.ArgV1ProcessEvent{
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "tenant",
},
}
@@ -201,7 +201,7 @@ func TestDspCDRsV1ProcessEventNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
CGREvent := &engine.ArgV1ProcessEvent{
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "tenant",
},
}
@@ -252,11 +252,11 @@ func TestDspCDRsV2ProcessEventError(t *testing.T) {
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
CGREvent := &engine.ArgV1ProcessEvent{
Flags: nil,
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "tenant",
},
}
- var reply *[]*utils.EventWithFlags
+ var reply *[]*engine.EventWithFlags
result := dspSrv.CDRsV2ProcessEvent(context.Background(), CGREvent, reply)
expected := "MANDATORY_IE_MISSING: [ApiKey]"
if result == nil || result.Error() != expected {
@@ -269,11 +269,11 @@ func TestDspCDRsV2ProcessEventNil(t *testing.T) {
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
CGREvent := &engine.ArgV1ProcessEvent{
Flags: nil,
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "tenant",
},
}
- var reply *[]*utils.EventWithFlags
+ var reply *[]*engine.EventWithFlags
result := dspSrv.CDRsV2ProcessEvent(context.Background(), CGREvent, reply)
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
@@ -287,9 +287,9 @@ func TestDspCDRsV2ProcessEventErrorNil(t *testing.T) {
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
CGREvent := &engine.ArgV1ProcessEvent{
Flags: nil,
- CGREvent: utils.CGREvent{},
+ CGREvent: engine.CGREvent{},
}
- var reply *[]*utils.EventWithFlags
+ var reply *[]*engine.EventWithFlags
result := dspSrv.CDRsV2ProcessEvent(context.Background(), CGREvent, reply)
expected := "MANDATORY_IE_MISSING: [ApiKey]"
if result == nil || result.Error() != expected {
diff --git a/dispatchers/chargers.go b/dispatchers/chargers.go
index 188161798..5fde456c6 100644
--- a/dispatchers/chargers.go
+++ b/dispatchers/chargers.go
@@ -24,9 +24,9 @@ import (
"github.com/cgrates/cgrates/utils"
)
-func (dS *DispatcherService) ChargerSv1Ping(ctx *context.Context, args *utils.CGREvent, reply *string) (err error) {
+func (dS *DispatcherService) ChargerSv1Ping(ctx *context.Context, args *engine.CGREvent, reply *string) (err error) {
if args == nil {
- args = new(utils.CGREvent)
+ args = new(engine.CGREvent)
}
tnt := dS.cfg.GeneralCfg().DefaultTenant
if args.Tenant != utils.EmptyString {
@@ -41,7 +41,7 @@ func (dS *DispatcherService) ChargerSv1Ping(ctx *context.Context, args *utils.CG
return dS.Dispatch(args, utils.MetaChargers, utils.ChargerSv1Ping, args, reply)
}
-func (dS *DispatcherService) ChargerSv1GetChargersForEvent(ctx *context.Context, args *utils.CGREvent,
+func (dS *DispatcherService) ChargerSv1GetChargersForEvent(ctx *context.Context, args *engine.CGREvent,
reply *engine.ChargerProfiles) (err error) {
tnt := dS.cfg.GeneralCfg().DefaultTenant
if args != nil && args.Tenant != utils.EmptyString {
@@ -56,7 +56,7 @@ func (dS *DispatcherService) ChargerSv1GetChargersForEvent(ctx *context.Context,
return dS.Dispatch(args, utils.MetaChargers, utils.ChargerSv1GetChargersForEvent, args, reply)
}
-func (dS *DispatcherService) ChargerSv1ProcessEvent(ctx *context.Context, args *utils.CGREvent,
+func (dS *DispatcherService) ChargerSv1ProcessEvent(ctx *context.Context, args *engine.CGREvent,
reply *[]*engine.ChrgSProcessEventReply) (err error) {
tnt := dS.cfg.GeneralCfg().DefaultTenant
if args != nil && args.Tenant != utils.EmptyString {
diff --git a/dispatchers/chargers_it_test.go b/dispatchers/chargers_it_test.go
index f104347d4..c8a7b7f88 100644
--- a/dispatchers/chargers_it_test.go
+++ b/dispatchers/chargers_it_test.go
@@ -71,12 +71,12 @@ func TestDspChargerST(t *testing.T) {
func testDspCppPingFailover(t *testing.T) {
var reply string
- if err := allEngine.RPC.Call(context.Background(), utils.ChargerSv1Ping, new(utils.CGREvent), &reply); err != nil {
+ if err := allEngine.RPC.Call(context.Background(), utils.ChargerSv1Ping, new(engine.CGREvent), &reply); err != nil {
t.Error(err)
} else if reply != utils.Pong {
t.Errorf("Received: %s", reply)
}
- ev := utils.CGREvent{
+ ev := engine.CGREvent{
Tenant: "cgrates.org",
APIOpts: map[string]any{
@@ -103,7 +103,7 @@ func testDspCppPingFailover(t *testing.T) {
}
func testDspCppGetChtgFailover(t *testing.T) {
- args := utils.CGREvent{
+ args := engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -166,12 +166,12 @@ func testDspCppGetChtgFailover(t *testing.T) {
func testDspCppPing(t *testing.T) {
var reply string
- if err := allEngine.RPC.Call(context.Background(), utils.ChargerSv1Ping, new(utils.CGREvent), &reply); err != nil {
+ if err := allEngine.RPC.Call(context.Background(), utils.ChargerSv1Ping, new(engine.CGREvent), &reply); err != nil {
t.Error(err)
} else if reply != utils.Pong {
t.Errorf("Received: %s", reply)
}
- if err := dispEngine.RPC.Call(context.Background(), utils.ChargerSv1Ping, &utils.CGREvent{
+ if err := dispEngine.RPC.Call(context.Background(), utils.ChargerSv1Ping, &engine.CGREvent{
Tenant: "cgrates.org",
APIOpts: map[string]any{
utils.OptsAPIKey: "chrg12345",
@@ -184,7 +184,7 @@ func testDspCppPing(t *testing.T) {
}
func testDspCppTestAuthKey(t *testing.T) {
- args := utils.CGREvent{
+ args := engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -202,7 +202,7 @@ func testDspCppTestAuthKey(t *testing.T) {
}
func testDspCppTestAuthKey2(t *testing.T) {
- args := utils.CGREvent{
+ args := engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -249,7 +249,7 @@ func testDspCppTestAuthKey2(t *testing.T) {
}
func testDspCppGetChtgRoundRobin(t *testing.T) {
- args := utils.CGREvent{
+ args := engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
diff --git a/dispatchers/chargers_test.go b/dispatchers/chargers_test.go
index a554adadc..847df9cd9 100644
--- a/dispatchers/chargers_test.go
+++ b/dispatchers/chargers_test.go
@@ -24,7 +24,6 @@ import (
"github.com/cgrates/birpc/context"
"github.com/cgrates/cgrates/config"
"github.com/cgrates/cgrates/engine"
- "github.com/cgrates/cgrates/utils"
)
func TestDspChargerSv1PingNilStruct(t *testing.T) {
@@ -41,7 +40,7 @@ func TestDspChargerSv1PingNilStruct(t *testing.T) {
func TestDspChargerSv1PingNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.CGREvent{
+ CGREvent := &engine.CGREvent{
Tenant: "tenant",
}
var reply *string
@@ -56,7 +55,7 @@ func TestDspChargerSv1PingErrorNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.CGREvent{}
+ CGREvent := &engine.CGREvent{}
var reply *string
result := dspSrv.ChargerSv1Ping(context.Background(), CGREvent, reply)
expected := "MANDATORY_IE_MISSING: [ApiKey]"
@@ -68,7 +67,7 @@ func TestDspChargerSv1PingErrorNil(t *testing.T) {
func TestDspChargerSv1GetChargersForEventNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.CGREvent{
+ CGREvent := &engine.CGREvent{
Tenant: "tenant",
}
var reply *engine.ChargerProfiles
@@ -83,7 +82,7 @@ func TestDspChargerSv1GetChargersForEventErrorNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.CGREvent{}
+ CGREvent := &engine.CGREvent{}
var reply *engine.ChargerProfiles
result := dspSrv.ChargerSv1GetChargersForEvent(context.Background(), CGREvent, reply)
expected := "MANDATORY_IE_MISSING: [ApiKey]"
@@ -95,7 +94,7 @@ func TestDspChargerSv1GetChargersForEventErrorNil(t *testing.T) {
func TestDspChargerSv1ProcessEventNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.CGREvent{
+ CGREvent := &engine.CGREvent{
Tenant: "tenant",
}
var reply *[]*engine.ChrgSProcessEventReply
@@ -110,7 +109,7 @@ func TestDspChargerSv1ProcessEventErrorNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.CGREvent{}
+ CGREvent := &engine.CGREvent{}
var reply *[]*engine.ChrgSProcessEventReply
result := dspSrv.ChargerSv1ProcessEvent(context.Background(), CGREvent, reply)
expected := "MANDATORY_IE_MISSING: [ApiKey]"
diff --git a/dispatchers/config.go b/dispatchers/config.go
index 0c8f0346f..dc2db325f 100644
--- a/dispatchers/config.go
+++ b/dispatchers/config.go
@@ -23,6 +23,7 @@ import (
"github.com/cgrates/birpc/context"
"github.com/cgrates/cgrates/config"
+ "github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
@@ -37,7 +38,7 @@ func (dS *DispatcherService) ConfigSv1GetConfig(ctx *context.Context, args *conf
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
APIOpts: args.APIOpts,
}, utils.MetaConfig, utils.ConfigSv1GetConfig, args, reply)
@@ -54,7 +55,7 @@ func (dS *DispatcherService) ConfigSv1ReloadConfig(ctx *context.Context, args *c
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
APIOpts: args.APIOpts,
}, utils.MetaConfig, utils.ConfigSv1ReloadConfig, args, reply)
@@ -71,7 +72,7 @@ func (dS *DispatcherService) ConfigSv1SetConfig(ctx *context.Context, args *conf
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
APIOpts: args.APIOpts,
}, utils.MetaConfig, utils.ConfigSv1SetConfig, args, reply)
@@ -88,7 +89,7 @@ func (dS *DispatcherService) ConfigSv1SetConfigFromJSON(ctx *context.Context, ar
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
APIOpts: args.APIOpts,
}, utils.MetaConfig, utils.ConfigSv1SetConfigFromJSON, args, reply)
@@ -105,7 +106,7 @@ func (dS *DispatcherService) ConfigSv1GetConfigAsJSON(ctx *context.Context, args
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
APIOpts: args.APIOpts,
}, utils.MetaConfig, utils.ConfigSv1GetConfigAsJSON, args, reply)
diff --git a/dispatchers/cores.go b/dispatchers/cores.go
index e38cf0c9b..111589a23 100644
--- a/dispatchers/cores.go
+++ b/dispatchers/cores.go
@@ -22,6 +22,7 @@ import (
"time"
"github.com/cgrates/birpc/context"
+ "github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
@@ -41,9 +42,9 @@ func (dS *DispatcherService) CoreSv1Panic(ctx *context.Context, args *utils.Pani
return
}
}
- return dS.Dispatch(&utils.CGREvent{Tenant: tnt, Event: ev, APIOpts: opts}, utils.MetaCore, utils.CoreSv1Panic, args, reply)
+ return dS.Dispatch(&engine.CGREvent{Tenant: tnt, Event: ev, APIOpts: opts}, utils.MetaCore, utils.CoreSv1Panic, args, reply)
}
-func (dS *DispatcherService) CoreSv1Ping(ctx *context.Context, args *utils.CGREvent, reply *string) (err error) {
+func (dS *DispatcherService) CoreSv1Ping(ctx *context.Context, args *engine.CGREvent, reply *string) (err error) {
tnt := dS.cfg.GeneralCfg().DefaultTenant
if args != nil && len(args.Tenant) != 0 {
tnt = args.Tenant
@@ -62,7 +63,7 @@ func (dS *DispatcherService) CoreSv1Ping(ctx *context.Context, args *utils.CGREv
return
}
}
- return dS.Dispatch(&utils.CGREvent{Tenant: tnt, Event: ev, APIOpts: opts}, utils.MetaCore, utils.CoreSv1Ping, args, reply)
+ return dS.Dispatch(&engine.CGREvent{Tenant: tnt, Event: ev, APIOpts: opts}, utils.MetaCore, utils.CoreSv1Ping, args, reply)
}
func (dS *DispatcherService) CoreSv1Sleep(ctx *context.Context, args *utils.DurationArgs, reply *string) (err error) {
@@ -81,7 +82,7 @@ func (dS *DispatcherService) CoreSv1Sleep(ctx *context.Context, args *utils.Dura
return
}
}
- return dS.Dispatch(&utils.CGREvent{Tenant: tnt, Event: ev, APIOpts: opts}, utils.MetaCore, utils.CoreSv1Sleep, args, reply)
+ return dS.Dispatch(&engine.CGREvent{Tenant: tnt, Event: ev, APIOpts: opts}, utils.MetaCore, utils.CoreSv1Sleep, args, reply)
}
func (dS *DispatcherService) CoreSv1StartCPUProfiling(ctx *context.Context, args *utils.DirectoryArgs, reply *string) (err error) {
@@ -100,7 +101,7 @@ func (dS *DispatcherService) CoreSv1StartCPUProfiling(ctx *context.Context, args
return
}
}
- return dS.Dispatch(&utils.CGREvent{Tenant: tnt, Event: ev, APIOpts: opts}, utils.MetaCore, utils.CoreSv1StartCPUProfiling, args, reply)
+ return dS.Dispatch(&engine.CGREvent{Tenant: tnt, Event: ev, APIOpts: opts}, utils.MetaCore, utils.CoreSv1StartCPUProfiling, args, reply)
}
func (dS *DispatcherService) CoreSv1StartMemoryProfiling(ctx *context.Context, args *utils.MemoryPrf, reply *string) (err error) {
tnt := dS.cfg.GeneralCfg().DefaultTenant
@@ -118,7 +119,7 @@ func (dS *DispatcherService) CoreSv1StartMemoryProfiling(ctx *context.Context, a
return
}
}
- return dS.Dispatch(&utils.CGREvent{Tenant: tnt, Event: ev, APIOpts: opts}, utils.MetaCore, utils.CoreSv1StartMemoryProfiling, args, reply)
+ return dS.Dispatch(&engine.CGREvent{Tenant: tnt, Event: ev, APIOpts: opts}, utils.MetaCore, utils.CoreSv1StartMemoryProfiling, args, reply)
}
func (dS *DispatcherService) CoreSv1Status(ctx *context.Context, args *utils.TenantWithAPIOpts, reply *map[string]any) (err error) {
tnt := dS.cfg.GeneralCfg().DefaultTenant
@@ -136,7 +137,7 @@ func (dS *DispatcherService) CoreSv1Status(ctx *context.Context, args *utils.Ten
return
}
}
- return dS.Dispatch(&utils.CGREvent{Tenant: tnt, Event: ev, APIOpts: opts}, utils.MetaCore, utils.CoreSv1Status, args, reply)
+ return dS.Dispatch(&engine.CGREvent{Tenant: tnt, Event: ev, APIOpts: opts}, utils.MetaCore, utils.CoreSv1Status, args, reply)
}
func (dS *DispatcherService) CoreSv1StopCPUProfiling(ctx *context.Context, args *utils.TenantWithAPIOpts, reply *string) (err error) {
tnt := dS.cfg.GeneralCfg().DefaultTenant
@@ -154,7 +155,7 @@ func (dS *DispatcherService) CoreSv1StopCPUProfiling(ctx *context.Context, args
return
}
}
- return dS.Dispatch(&utils.CGREvent{Tenant: tnt, Event: ev, APIOpts: opts}, utils.MetaCore, utils.CoreSv1StopCPUProfiling, args, reply)
+ return dS.Dispatch(&engine.CGREvent{Tenant: tnt, Event: ev, APIOpts: opts}, utils.MetaCore, utils.CoreSv1StopCPUProfiling, args, reply)
}
func (dS *DispatcherService) CoreSv1StopMemoryProfiling(ctx *context.Context, args *utils.TenantWithAPIOpts, reply *string) (err error) {
tnt := dS.cfg.GeneralCfg().DefaultTenant
@@ -172,5 +173,5 @@ func (dS *DispatcherService) CoreSv1StopMemoryProfiling(ctx *context.Context, ar
return
}
}
- return dS.Dispatch(&utils.CGREvent{Tenant: tnt, Event: ev, APIOpts: opts}, utils.MetaCore, utils.CoreSv1StopMemoryProfiling, args, reply)
+ return dS.Dispatch(&engine.CGREvent{Tenant: tnt, Event: ev, APIOpts: opts}, utils.MetaCore, utils.CoreSv1StopMemoryProfiling, args, reply)
}
diff --git a/dispatchers/dispatchers.go b/dispatchers/dispatchers.go
index 619bf8f93..81b531684 100644
--- a/dispatchers/dispatchers.go
+++ b/dispatchers/dispatchers.go
@@ -60,7 +60,7 @@ func (dS *DispatcherService) Shutdown() {
utils.Logger.Info(fmt.Sprintf("<%s> service shutdown complete", utils.DispatcherS))
}
-func (dS *DispatcherService) authorizeEvent(ev *utils.CGREvent,
+func (dS *DispatcherService) authorizeEvent(ev *engine.CGREvent,
reply *engine.AttrSProcessEventReply) (err error) {
ev.APIOpts[utils.OptsContext] = utils.MetaAuth
if err = dS.connMgr.Call(context.TODO(), dS.cfg.DispatcherSCfg().AttributeSConns,
@@ -77,7 +77,7 @@ func (dS *DispatcherService) authorize(method, tenant string, apiKey string, evT
if apiKey == "" {
return utils.NewErrMandatoryIeMissing(utils.APIKey)
}
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: tenant,
ID: utils.UUIDSha1Prefix(),
Time: evTime,
@@ -102,11 +102,11 @@ func (dS *DispatcherService) authorize(method, tenant string, apiKey string, evT
// dispatcherForEvent returns a dispatcher instance configured for specific event
// or utils.ErrNotFound if none present
-func (dS *DispatcherService) dispatcherProfilesForEvent(tnt string, ev *utils.CGREvent,
+func (dS *DispatcherService) dispatcherProfilesForEvent(tnt string, ev *engine.CGREvent,
evNm utils.MapStorage, subsys string) (dPrlfs engine.DispatcherProfiles, err error) {
// make sure dispatching is allowed
var shouldDispatch bool
- if shouldDispatch, err = utils.GetBoolOpts(ev, true, utils.MetaDispatchers); err != nil {
+ if shouldDispatch, err = engine.GetBoolOpts(ev, true, utils.MetaDispatchers); err != nil {
return
} else {
var subsys string
@@ -200,7 +200,7 @@ func (dS *DispatcherService) dispatcherProfilesForEvent(tnt string, ev *utils.CG
}
// Dispatch is the method forwarding the request towards the right connection
-func (dS *DispatcherService) Dispatch(ev *utils.CGREvent, subsys string,
+func (dS *DispatcherService) Dispatch(ev *engine.CGREvent, subsys string,
serviceMethod string, args any, reply any) (err error) {
tnt := ev.Tenant
if tnt == utils.EmptyString {
@@ -223,7 +223,7 @@ func (dS *DispatcherService) Dispatch(ev *utils.CGREvent, subsys string,
}
// avoid further processing if the request is internal
var shouldDispatch bool
- if shouldDispatch, err = utils.GetBoolOpts(ev, true, utils.MetaDispatchers); err != nil {
+ if shouldDispatch, err = engine.GetBoolOpts(ev, true, utils.MetaDispatchers); err != nil {
return utils.NewErrDispatcherS(err)
} else {
var subsys string
@@ -313,7 +313,7 @@ func (dS *DispatcherService) Dispatch(ev *utils.CGREvent, subsys string,
return // return the last error
}
-func (dS *DispatcherService) DispatcherSv1GetProfilesForEvent(ctx *context.Context, ev *utils.CGREvent,
+func (dS *DispatcherService) DispatcherSv1GetProfilesForEvent(ctx *context.Context, ev *engine.CGREvent,
dPfl *engine.DispatcherProfiles) (err error) {
tnt := ev.Tenant
if tnt == utils.EmptyString {
@@ -418,7 +418,7 @@ func (dS *DispatcherService) V1Apier(ctx *context.Context,apier any, args *utils
if argD != nil {
routeID = argD.RouteID
}
- if err := dS.Dispatch(&utils.CGREvent{Tenant: tenant, Event: parameters}, utils.MetaApier, routeID,
+ if err := dS.Dispatch(&engine.CGREvent{Tenant: tenant, Event: parameters}, utils.MetaApier, routeID,
args.Method, realArgs, realReply); err != nil {
return err
}
@@ -466,7 +466,7 @@ func (dS *DispatcherService) DispatcherSv1RemoteStatus(ctx *context.Context, arg
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
APIOpts: args.APIOpts,
}, utils.MetaCore, utils.CoreSv1Status, args, reply)
@@ -483,13 +483,13 @@ func (dS *DispatcherService) DispatcherSv1RemoteSleep(ctx *context.Context, args
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
APIOpts: args.APIOpts,
}, utils.MetaCore, utils.CoreSv1Sleep, args, reply)
}
-func (dS *DispatcherService) DispatcherSv1RemotePing(ctx *context.Context, args *utils.CGREvent, reply *string) (err error) {
+func (dS *DispatcherService) DispatcherSv1RemotePing(ctx *context.Context, args *engine.CGREvent, reply *string) (err error) {
tnt := dS.cfg.GeneralCfg().DefaultTenant
if args != nil && args.Tenant != utils.EmptyString {
tnt = args.Tenant
diff --git a/dispatchers/dispatchers_it_test.go b/dispatchers/dispatchers_it_test.go
index c96a5a15e..735ef5c88 100644
--- a/dispatchers/dispatchers_it_test.go
+++ b/dispatchers/dispatchers_it_test.go
@@ -179,7 +179,7 @@ func TestDispatcherServiceDispatcherProfileForEventGetDispatchertWithoutAuthenti
}
fltrs := engine.NewFilterS(cfg, connMng, dm)
dss := NewDispatcherService(dm, cfg, fltrs, connMng)
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
ID: "321",
Event: map[string]any{
utils.AccountField: "1001",
diff --git a/dispatchers/dispatchers_test.go b/dispatchers/dispatchers_test.go
index bb9062b15..8dff58ae2 100644
--- a/dispatchers/dispatchers_test.go
+++ b/dispatchers/dispatchers_test.go
@@ -72,7 +72,7 @@ func TestDispatcherServiceDispatcherProfileForEventGetDispatcherProfileNF(t *tes
}
fltrs := engine.NewFilterS(cfg, connMng, dm)
dss := NewDispatcherService(dm, cfg, fltrs, connMng)
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "321",
Event: map[string]any{
@@ -104,7 +104,7 @@ func TestDispatcherServiceDispatcherProfileForEventMIIDENotFound(t *testing.T) {
dataDB := engine.NewInternalDB(nil, nil, true, cfg.DataDbCfg().Items)
dm := engine.NewDataManager(dataDB, nil, connMng)
dss := NewDispatcherService(dm, cfg, nil, connMng)
- ev := &utils.CGREvent{}
+ ev := &engine.CGREvent{}
tnt := ""
subsys := utils.IfaceAsString(ev.APIOpts[utils.MetaSubsys])
_, err := dss.dispatcherProfilesForEvent(tnt, ev, utils.MapStorage{
@@ -116,7 +116,7 @@ func TestDispatcherServiceDispatcherProfileForEventMIIDENotFound(t *testing.T) {
}
}
-func (dS *DispatcherService) DispatcherServicePing(ev *utils.CGREvent, reply *string) error {
+func (dS *DispatcherService) DispatcherServicePing(ev *engine.CGREvent, reply *string) error {
*reply = utils.Pong
return nil
}
@@ -124,7 +124,7 @@ func (dS *DispatcherService) DispatcherServicePing(ev *utils.CGREvent, reply *st
func TestDispatcherCall1(t *testing.T) {
dS := &DispatcherService{}
var reply string
- if err := dS.Call(context.Background(), utils.DispatcherServicePing, &utils.CGREvent{}, &reply); err != nil {
+ if err := dS.Call(context.Background(), utils.DispatcherServicePing, &engine.CGREvent{}, &reply); err != nil {
t.Error(err)
} else if reply != utils.Pong {
t.Errorf("Expected: %s , received: %s", utils.Pong, reply)
@@ -134,10 +134,10 @@ func TestDispatcherCall1(t *testing.T) {
func TestDispatcherCall2(t *testing.T) {
dS := &DispatcherService{}
var reply string
- if err := dS.Call(context.Background(), "DispatcherServicePing", &utils.CGREvent{}, &reply); err == nil || err.Error() != rpcclient.ErrUnsupporteServiceMethod.Error() {
+ if err := dS.Call(context.Background(), "DispatcherServicePing", &engine.CGREvent{}, &reply); err == nil || err.Error() != rpcclient.ErrUnsupporteServiceMethod.Error() {
t.Error(err)
}
- if err := dS.Call(context.Background(), "DispatcherService.Pong", &utils.CGREvent{}, &reply); err == nil || err.Error() != rpcclient.ErrUnsupporteServiceMethod.Error() {
+ if err := dS.Call(context.Background(), "DispatcherService.Pong", &engine.CGREvent{}, &reply); err == nil || err.Error() != rpcclient.ErrUnsupporteServiceMethod.Error() {
t.Error(err)
}
dS.Shutdown()
@@ -149,7 +149,7 @@ func TestDispatcherauthorizeEvent(t *testing.T) {
fltr := &engine.FilterS{}
connMgr := &engine.ConnManager{}
dsp := NewDispatcherService(dm, cfg, fltr, connMgr)
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
APIOpts: make(map[string]any),
}
reply := &engine.AttrSProcessEventReply{}
@@ -166,7 +166,7 @@ func TestDispatcherAuthorizeEventErr(t *testing.T) {
fltr := &engine.FilterS{}
connMgr := &engine.ConnManager{}
dsp := NewDispatcherService(dm, cfg, fltr, connMgr)
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
APIOpts: make(map[string]any),
}
reply := &engine.AttrSProcessEventReply{}
@@ -181,7 +181,7 @@ func TestDispatcherV1GetProfileForEventErr(t *testing.T) {
cfg := config.NewDefaultCGRConfig()
cfg.GeneralCfg().DefaultTenant = utils.EmptyString
dsp := NewDispatcherService(nil, cfg, nil, nil)
- ev := &utils.CGREvent{}
+ ev := &engine.CGREvent{}
dPfl := &engine.DispatcherProfiles{}
err := dsp.DispatcherSv1GetProfilesForEvent(context.Background(), ev, dPfl)
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
@@ -194,7 +194,7 @@ func TestDispatcherV1GetProfileForEvent(t *testing.T) {
cfg := config.NewDefaultCGRConfig()
cfg.GeneralCfg().DefaultTenant = utils.EmptyString
dsp := NewDispatcherService(nil, cfg, nil, nil)
- ev := &utils.CGREvent{}
+ ev := &engine.CGREvent{}
dPfl := &engine.DispatcherProfiles{}
err := dsp.DispatcherSv1GetProfilesForEvent(context.Background(), ev, dPfl)
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
@@ -207,7 +207,7 @@ func TestDispatcherDispatch(t *testing.T) {
cfg := config.NewDefaultCGRConfig()
cfg.GeneralCfg().DefaultTenant = utils.EmptyString
dsp := NewDispatcherService(nil, cfg, nil, nil)
- ev := &utils.CGREvent{}
+ ev := &engine.CGREvent{}
err := dsp.Dispatch(ev, "", "", "", "")
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if err == nil || err.Error() != expected {
@@ -273,7 +273,7 @@ func TestDispatcherServiceAuthorizeEvenError1(t *testing.T) {
connMgr := &engine.ConnManager{}
dsp := NewDispatcherService(dm, cfg, fltr, connMgr)
cfg.DispatcherSCfg().AttributeSConns = []string{"connID"}
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
APIOpts: make(map[string]any),
}
reply := &engine.AttrSProcessEventReply{}
@@ -297,7 +297,7 @@ func TestDispatcherServiceAuthorizeEventError2(t *testing.T) {
connMgr := &engine.ConnManager{}
dsp := NewDispatcherService(dm, cfg, fltr, connMgr)
cfg.DispatcherSCfg().AttributeSConns = []string{"connID"}
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
APIOpts: make(map[string]any),
}
reply := &engine.AttrSProcessEventReply{}
@@ -339,7 +339,7 @@ func TestDispatcherServiceAuthorizeEventError3(t *testing.T) {
connMgr := engine.NewConnManager(cfg, rpcInt)
dsp := NewDispatcherService(dm, cfg, nil, connMgr)
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "testTenant",
ID: "testID",
Time: nil,
@@ -371,7 +371,7 @@ type mockTypeCon3 struct{}
func (*mockTypeCon3) Call(_ *context.Context, serviceMethod string, args, reply any) error {
eVreply := &engine.AttrSProcessEventReply{
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "testTenant",
ID: "testID",
Time: nil,
@@ -423,7 +423,7 @@ type mockTypeCon4 struct{}
func (*mockTypeCon4) Call(ctx *context.Context, serviceMethod string, args, reply any) error {
eVreply := &engine.AttrSProcessEventReply{
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "testTenant",
ID: "testID",
Time: nil,
@@ -473,7 +473,7 @@ type mockTypeCon5 struct{}
func (*mockTypeCon5) Call(ctx *context.Context, serviceMethod string, args, reply any) error {
eVreply := &engine.AttrSProcessEventReply{
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "testTenant",
ID: "testID",
Time: nil,
@@ -527,7 +527,7 @@ func TestDispatcherServiceCall1(t *testing.T) {
dm := engine.NewDataManager(nil, nil, nil)
dsp := NewDispatcherService(dm, cfg, nil, connMng)
reply := "reply"
- args := &utils.CGREvent{
+ args := &engine.CGREvent{
Tenant: "tenantTest",
ID: "tenantID",
Time: nil,
@@ -565,7 +565,7 @@ func TestDispatcherServiceDispatcherProfileForEventErrNil(t *testing.T) {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", nil, err)
}
dss := NewDispatcherService(dm, cfg, nil, connMng)
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "123",
Time: nil,
@@ -612,7 +612,7 @@ func TestDispatcherV1GetProfileForEventReturn(t *testing.T) {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", nil, err)
}
dss := NewDispatcherService(dm, cfg, nil, connMng)
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "123",
Time: nil,
@@ -665,7 +665,7 @@ func TestDispatcherServiceDispatcherProfileForEventErrNotFound(t *testing.T) {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", nil, err)
}
dss := NewDispatcherService(dm, cfg, nil, connMng)
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "123",
Time: nil,
@@ -712,7 +712,7 @@ func TestDispatcherServiceDispatcherProfileForEventErrNotFound2(t *testing.T) {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", nil, err)
}
dss := NewDispatcherService(dm, cfg, nil, connMng)
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "123",
Time: nil,
@@ -764,7 +764,7 @@ func TestDispatcherServiceDispatcherProfileForEventErrNotFoundTime(t *testing.T)
}
fltrs := engine.NewFilterS(cfg, connMng, dm)
dss := NewDispatcherService(dm, cfg, fltrs, connMng)
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "123",
Time: utils.TimePointer(time.Now()),
@@ -813,7 +813,7 @@ func TestDispatcherServiceDispatcherProfileForEventErrNotFoundFilter(t *testing.
}
fltrs := engine.NewFilterS(cfg, connMng, dm)
dss := NewDispatcherService(dm, cfg, fltrs, connMng)
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "123",
Event: map[string]any{
@@ -860,7 +860,7 @@ func TestDispatcherServiceDispatchDspErr(t *testing.T) {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", nil, err)
}
dss := NewDispatcherService(dm, cfg, nil, connMng)
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "123",
Time: nil,
@@ -913,7 +913,7 @@ func TestDispatcherServiceDispatchDspErrHostNotFound(t *testing.T) {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", nil, err)
}
dss := NewDispatcherService(dm, cfg, nil, connMng)
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "123",
Time: nil,
@@ -973,7 +973,7 @@ func TestDispatcherServiceDispatcherProfileForEventFoundFilter(t *testing.T) {
}
fltrs := engine.NewFilterS(cfg, connMng, dm)
dss := NewDispatcherService(dm, cfg, fltrs, connMng)
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "123",
Event: map[string]any{
@@ -1016,7 +1016,7 @@ func TestDispatcherServiceDispatcherProfileForEventNotNotFound(t *testing.T) {
}, nil, connMng)
fltrs := engine.NewFilterS(cfg, connMng, dm)
dss := NewDispatcherService(dm, cfg, fltrs, connMng)
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "123",
Event: map[string]any{
@@ -1078,7 +1078,7 @@ func TestDispatcherServiceDispatcherProfileForEventGetDispatcherError(t *testing
}
fltrs := engine.NewFilterS(cfg, connMng, dm)
dss := NewDispatcherService(dm, cfg, fltrs, connMng)
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "123",
Event: map[string]any{
@@ -1133,7 +1133,7 @@ func TestDispatcherServiceDispatchDspErrHostNotFound2(t *testing.T) {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", nil, err)
}
dss := NewDispatcherService(dm, cfg, nil, connMng)
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "123",
Time: nil,
@@ -1196,7 +1196,7 @@ func TestDispatcherServiceDispatchDspErrHostNotFound3(t *testing.T) {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", nil, err)
}
dss := NewDispatcherService(dm, cfg, nil, connMgr)
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "123",
Time: nil,
@@ -1218,7 +1218,7 @@ func TestDispatcherServiceDispatchDspErrHostNotFound3(t *testing.T) {
engine.Cache = cacheInit
}
-func (dS *DispatcherService) DispatcherServiceTest(ev *utils.CGREvent, reply *string) (any, error) {
+func (dS *DispatcherService) DispatcherServiceTest(ev *engine.CGREvent, reply *string) (any, error) {
*reply = utils.Pong
return nil, nil
}
@@ -1230,7 +1230,7 @@ func TestDispatcherServiceCall2(t *testing.T) {
dm := engine.NewDataManager(nil, nil, nil)
dsp := NewDispatcherService(dm, cfg, nil, connMng)
reply := "reply"
- args := &utils.CGREvent{
+ args := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "123",
Time: nil,
@@ -1250,7 +1250,7 @@ func TestDispatcherServiceCall2(t *testing.T) {
}
}
-func (dS *DispatcherService) DispatcherServiceTest2(ev *utils.CGREvent, reply *string) any {
+func (dS *DispatcherService) DispatcherServiceTest2(ev *engine.CGREvent, reply *string) any {
*reply = utils.Pong
return utils.ErrNotImplemented
}
@@ -1262,7 +1262,7 @@ func TestDispatcherServiceCall3(t *testing.T) {
dm := engine.NewDataManager(nil, nil, nil)
dsp := NewDispatcherService(dm, cfg, nil, connMng)
reply := "reply"
- args := &utils.CGREvent{
+ args := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "123",
Time: nil,
@@ -1282,7 +1282,7 @@ func TestDispatcherServiceCall3(t *testing.T) {
}
}
-func (dS *DispatcherService) DispatcherServiceTest3(ev *utils.CGREvent, reply *string) int {
+func (dS *DispatcherService) DispatcherServiceTest3(ev *engine.CGREvent, reply *string) int {
*reply = utils.Pong
return 1
}
@@ -1294,7 +1294,7 @@ func TestDispatcherServiceCall4(t *testing.T) {
dm := engine.NewDataManager(nil, nil, nil)
dsp := NewDispatcherService(dm, cfg, nil, connMng)
reply := "reply"
- args := &utils.CGREvent{
+ args := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "123",
Time: nil,
@@ -1359,7 +1359,7 @@ func TestDispatchersdispatcherProfileForEventAnySSfalses(t *testing.T) {
}
tnt := "cgrates.org"
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: tnt,
Event: map[string]any{
utils.AccountField: "1001",
@@ -1450,7 +1450,7 @@ func TestDispatchersdispatcherProfileForEventAnySSfalseFirstNotFound(t *testing.
}
tnt := "cgrates.org"
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: tnt,
Event: map[string]any{
utils.AccountField: "1001",
@@ -1518,7 +1518,7 @@ func TestDispatchersdispatcherProfileForEventAnySSfalseFound(t *testing.T) {
}
tnt := "cgrates.org"
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: tnt,
Event: map[string]any{
utils.AccountField: "1001",
@@ -1586,7 +1586,7 @@ func TestDispatchersdispatcherProfileForEventAnySSfalseNotFound(t *testing.T) {
}
tnt := "cgrates.org"
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: tnt,
Event: map[string]any{
utils.AccountField: "1001",
@@ -1651,7 +1651,7 @@ func TestDispatchersdispatcherProfileForEventAnySStrueNotFound(t *testing.T) {
}
tnt := "cgrates.org"
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: tnt,
Event: map[string]any{
utils.AccountField: "1001",
@@ -1716,7 +1716,7 @@ func TestDispatchersdispatcherProfileForEventAnySStrueBothFound(t *testing.T) {
}
tnt := "cgrates.org"
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: tnt,
Event: map[string]any{
utils.AccountField: "1001",
diff --git a/dispatchers/ees.go b/dispatchers/ees.go
index fd81ecf33..d3702efcf 100644
--- a/dispatchers/ees.go
+++ b/dispatchers/ees.go
@@ -26,7 +26,7 @@ import (
"github.com/cgrates/cgrates/utils"
)
-func (dS *DispatcherService) EeSv1Ping(ctx *context.Context, args *utils.CGREvent, reply *string) (err error) {
+func (dS *DispatcherService) EeSv1Ping(ctx *context.Context, args *engine.CGREvent, reply *string) (err error) {
tnt := dS.cfg.GeneralCfg().DefaultTenant
if args != nil && len(args.Tenant) != 0 {
tnt = args.Tenant
@@ -45,7 +45,7 @@ func (dS *DispatcherService) EeSv1Ping(ctx *context.Context, args *utils.CGREven
return
}
}
- return dS.Dispatch(&utils.CGREvent{Tenant: tnt, Event: ev, APIOpts: opts}, utils.MetaCore, utils.EeSv1Ping, args, reply)
+ return dS.Dispatch(&engine.CGREvent{Tenant: tnt, Event: ev, APIOpts: opts}, utils.MetaCore, utils.EeSv1Ping, args, reply)
}
func (dS *DispatcherService) EeSv1ProcessEvent(ctx *context.Context, args *engine.CGREventWithEeIDs, reply *map[string]map[string]any) (err error) {
@@ -67,5 +67,5 @@ func (dS *DispatcherService) EeSv1ProcessEvent(ctx *context.Context, args *engin
return
}
}
- return dS.Dispatch(&utils.CGREvent{Tenant: tnt, Event: ev, APIOpts: opts}, utils.MetaCore, utils.EeSv1ProcessEvent, args, reply)
+ return dS.Dispatch(&engine.CGREvent{Tenant: tnt, Event: ev, APIOpts: opts}, utils.MetaCore, utils.EeSv1ProcessEvent, args, reply)
}
diff --git a/dispatchers/ees_it_test.go b/dispatchers/ees_it_test.go
index 527f257d5..5d7d215ff 100644
--- a/dispatchers/ees_it_test.go
+++ b/dispatchers/ees_it_test.go
@@ -67,12 +67,12 @@ func TestDspEEsIT(t *testing.T) {
func testDspEEsPingFailover(t *testing.T) {
var reply string
- if err := allEngine.RPC.Call(context.Background(), utils.EeSv1Ping, new(utils.CGREvent), &reply); err != nil {
+ if err := allEngine.RPC.Call(context.Background(), utils.EeSv1Ping, new(engine.CGREvent), &reply); err != nil {
t.Error(err)
} else if reply != utils.Pong {
t.Errorf("Unexpected reply: %s", reply)
}
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
APIOpts: map[string]any{
utils.OptsAPIKey: "ees12345",
@@ -99,7 +99,7 @@ func testDspEEsPingFailover(t *testing.T) {
func testDspEEsProcessEventFailover(t *testing.T) {
args := &engine.CGREventWithEeIDs{
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -128,12 +128,12 @@ func testDspEEsProcessEventFailover(t *testing.T) {
func testDspEEsPing(t *testing.T) {
var reply string
- if err := allEngine.RPC.Call(context.Background(), utils.EeSv1Ping, new(utils.CGREvent), &reply); err != nil {
+ if err := allEngine.RPC.Call(context.Background(), utils.EeSv1Ping, new(engine.CGREvent), &reply); err != nil {
t.Error(err)
} else if reply != utils.Pong {
t.Errorf("Received: %s", reply)
}
- if err := dispEngine.RPC.Call(context.Background(), utils.EeSv1Ping, &utils.CGREvent{
+ if err := dispEngine.RPC.Call(context.Background(), utils.EeSv1Ping, &engine.CGREvent{
Tenant: "cgrates.org",
APIOpts: map[string]any{
utils.OptsAPIKey: "ees12345",
@@ -147,7 +147,7 @@ func testDspEEsPing(t *testing.T) {
func testDspEEsTestAuthKey(t *testing.T) {
args := &engine.CGREventWithEeIDs{
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -167,7 +167,7 @@ func testDspEEsTestAuthKey(t *testing.T) {
func testDspEEsTestAuthKey2(t *testing.T) {
args := &engine.CGREventWithEeIDs{
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -189,7 +189,7 @@ func testDspEEsTestAuthKey2(t *testing.T) {
func testDspEEsProcessEventRoundRobin(t *testing.T) {
args := &engine.CGREventWithEeIDs{
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
diff --git a/dispatchers/guardian.go b/dispatchers/guardian.go
index e18f577c2..c6b261fe0 100644
--- a/dispatchers/guardian.go
+++ b/dispatchers/guardian.go
@@ -22,14 +22,15 @@ import (
"time"
"github.com/cgrates/birpc/context"
+ "github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
// GuardianSv1Ping interogates GuardianSv1 server responsible to process the event
-func (dS *DispatcherService) GuardianSv1Ping(ctx *context.Context, args *utils.CGREvent,
+func (dS *DispatcherService) GuardianSv1Ping(ctx *context.Context, args *engine.CGREvent,
reply *string) (err error) {
if args == nil {
- args = new(utils.CGREvent)
+ args = new(engine.CGREvent)
}
args.Tenant = utils.FirstNonEmpty(args.Tenant, dS.cfg.GeneralCfg().DefaultTenant)
if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 {
@@ -54,7 +55,7 @@ func (dS *DispatcherService) GuardianSv1RemoteLock(ctx *context.Context, args At
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
APIOpts: args.APIOpts,
}, utils.MetaGuardian, utils.GuardianSv1RemoteLock, args, reply)
@@ -73,7 +74,7 @@ func (dS *DispatcherService) GuardianSv1RemoteUnlock(ctx *context.Context, args
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
APIOpts: args.APIOpts,
}, utils.MetaGuardian, utils.GuardianSv1RemoteUnlock, args, reply)
diff --git a/dispatchers/guardian_it_test.go b/dispatchers/guardian_it_test.go
index 6d616699b..46eae4423 100644
--- a/dispatchers/guardian_it_test.go
+++ b/dispatchers/guardian_it_test.go
@@ -27,6 +27,7 @@ import (
"time"
"github.com/cgrates/birpc/context"
+ "github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
@@ -64,12 +65,12 @@ func TestDspGuardianST(t *testing.T) {
func testDspGrdPing(t *testing.T) {
var reply string
- if err := allEngine.RPC.Call(context.Background(), utils.GuardianSv1Ping, new(utils.CGREvent), &reply); err != nil {
+ if err := allEngine.RPC.Call(context.Background(), utils.GuardianSv1Ping, new(engine.CGREvent), &reply); err != nil {
t.Error(err)
} else if reply != utils.Pong {
t.Errorf("Received: %s", reply)
}
- if err := dispEngine.RPC.Call(context.Background(), utils.GuardianSv1Ping, &utils.CGREvent{
+ if err := dispEngine.RPC.Call(context.Background(), utils.GuardianSv1Ping, &engine.CGREvent{
Tenant: "cgrates.org",
APIOpts: map[string]any{
diff --git a/dispatchers/guardian_test.go b/dispatchers/guardian_test.go
index 0686d0943..c2b06ff00 100644
--- a/dispatchers/guardian_test.go
+++ b/dispatchers/guardian_test.go
@@ -23,14 +23,14 @@ import (
"github.com/cgrates/birpc/context"
"github.com/cgrates/cgrates/config"
- "github.com/cgrates/cgrates/utils"
+ "github.com/cgrates/cgrates/engine"
)
func TestGuardianGuardianSv1PingErr1(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.CGREvent{
+ CGREvent := &engine.CGREvent{
Tenant: "tenant",
}
var reply *string
@@ -46,7 +46,7 @@ func TestGuardianGuardianSv1PingErr1(t *testing.T) {
func TestGuardianGuardianSv1PingErr2(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.CGREvent{
+ CGREvent := &engine.CGREvent{
Tenant: "tenant",
}
var reply *string
@@ -62,7 +62,7 @@ func TestGuardianGuardianSv1PingErr2(t *testing.T) {
func TestGuardianGuardianSv1PingErrNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- var CGREvent *utils.CGREvent
+ var CGREvent *engine.CGREvent
var reply *string
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
diff --git a/dispatchers/libdispatcher_test.go b/dispatchers/libdispatcher_test.go
index 4e5e2efeb..bf82a270c 100644
--- a/dispatchers/libdispatcher_test.go
+++ b/dispatchers/libdispatcher_test.go
@@ -731,7 +731,7 @@ func TestLibDispatcherLoadDispatcherCacheError7(t *testing.T) {
defaultRatio: 0,
sorter: new(noSort),
}
- err := wgDsp.Dispatch(dm, nil, nil, "testTENANT", "testID", &DispatcherRoute{}, utils.AttributeSv1Ping, &utils.CGREvent{}, &wgDsp)
+ err := wgDsp.Dispatch(dm, nil, nil, "testTENANT", "testID", &DispatcherRoute{}, utils.AttributeSv1Ping, &engine.CGREvent{}, &wgDsp)
expected := "UNSUPPORTED_SERVICE_METHOD"
if err == nil || err.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, err)
@@ -784,7 +784,7 @@ func TestLibDispatcherLoadDispatcherCacheError5(t *testing.T) {
defaultRatio: 0,
sorter: new(noSort),
}
- err := wgDsp.Dispatch(nil, nil, nil, "testTenant", "testID", &DispatcherRoute{}, utils.AttributeSv1Ping, &utils.CGREvent{}, &wgDsp)
+ err := wgDsp.Dispatch(nil, nil, nil, "testTenant", "testID", &DispatcherRoute{}, utils.AttributeSv1Ping, &engine.CGREvent{}, &wgDsp)
if err == nil {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", "connection is shut down", err)
}
@@ -814,7 +814,7 @@ func TestLibDispatcherSingleResultDispatcherCase1(t *testing.T) {
engine.Cache.SetWithoutReplicate(utils.CacheDispatcherHosts, "testTenant:testID",
value, nil, true, utils.NonTransactional)
wgDsp := &singleResultDispatcher{sorter: new(noSort), hosts: engine.DispatcherHostProfiles{{ID: "testID"}}}
- err := wgDsp.Dispatch(dm, nil, nil, "testTenant", "", &DispatcherRoute{}, utils.AttributeSv1Ping, &utils.CGREvent{}, &wgDsp)
+ err := wgDsp.Dispatch(dm, nil, nil, "testTenant", "", &DispatcherRoute{}, utils.AttributeSv1Ping, &engine.CGREvent{}, &wgDsp)
if err == nil {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", "connection is shut down", err)
}
@@ -851,7 +851,7 @@ func TestLibDispatcherSingleResultDispatcherCase2(t *testing.T) {
engine.Cache.SetWithoutReplicate(utils.CacheDispatcherHosts, "testTenant:testID",
value, nil, true, utils.NonTransactional)
wgDsp := &singleResultDispatcher{sorter: new(noSort), hosts: engine.DispatcherHostProfiles{{ID: "testID"}}}
- err := wgDsp.Dispatch(dm, nil, nil, "testTenant", "routeID", &DispatcherRoute{}, utils.AttributeSv1Ping, &utils.CGREvent{}, &wgDsp)
+ err := wgDsp.Dispatch(dm, nil, nil, "testTenant", "routeID", &DispatcherRoute{}, utils.AttributeSv1Ping, &engine.CGREvent{}, &wgDsp)
if err != nil {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", nil, err)
}
@@ -898,7 +898,7 @@ func TestLibDispatcherSingleResultDispatcherCase3(t *testing.T) {
engine.Cache.SetWithoutReplicate(utils.CacheDispatcherHosts, "testTenant:testID",
value, nil, true, utils.NonTransactional)
wgDsp := &singleResultDispatcher{sorter: new(noSort), hosts: engine.DispatcherHostProfiles{{ID: "testID"}}}
- err := wgDsp.Dispatch(dm, nil, nil, "testTenant", "routeID", &DispatcherRoute{}, utils.AttributeSv1Ping, &utils.CGREvent{}, &wgDsp)
+ err := wgDsp.Dispatch(dm, nil, nil, "testTenant", "routeID", &DispatcherRoute{}, utils.AttributeSv1Ping, &engine.CGREvent{}, &wgDsp)
expected := "INTERNALLY_DISCONNECTED"
if err == nil || err.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, err)
@@ -959,7 +959,7 @@ func TestLibDispatcherLoadStrategyDispatchCaseCallError(t *testing.T) {
defaultRatio: 1,
sorter: new(noSort),
}
- err := wgDsp.Dispatch(nil, nil, nil, "cgrates.org", "", &DispatcherRoute{}, utils.AttributeSv1Ping, &utils.CGREvent{}, &wgDsp)
+ err := wgDsp.Dispatch(nil, nil, nil, "cgrates.org", "", &DispatcherRoute{}, utils.AttributeSv1Ping, &engine.CGREvent{}, &wgDsp)
expected := "NO_DATABASE_CONNECTION"
if err == nil || err.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, err)
diff --git a/dispatchers/rals.go b/dispatchers/rals.go
index 251050927..326cdbbaa 100644
--- a/dispatchers/rals.go
+++ b/dispatchers/rals.go
@@ -22,12 +22,13 @@ import (
"time"
"github.com/cgrates/birpc/context"
+ "github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
-func (dS *DispatcherService) RALsV1Ping(ctx *context.Context, args *utils.CGREvent, rpl *string) (err error) {
+func (dS *DispatcherService) RALsV1Ping(ctx *context.Context, args *engine.CGREvent, rpl *string) (err error) {
if args == nil {
- args = new(utils.CGREvent)
+ args = new(engine.CGREvent)
}
args.Tenant = utils.FirstNonEmpty(args.Tenant, dS.cfg.GeneralCfg().DefaultTenant)
if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 {
@@ -47,7 +48,7 @@ func (dS *DispatcherService) RALsV1GetRatingPlansCost(ctx *context.Context, args
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tenant,
APIOpts: args.APIOpts,
}, utils.MetaRALs, utils.RALsV1GetRatingPlansCost, args, rpl)
diff --git a/dispatchers/rals_it_test.go b/dispatchers/rals_it_test.go
index f6cdc19e6..93278b2a1 100644
--- a/dispatchers/rals_it_test.go
+++ b/dispatchers/rals_it_test.go
@@ -26,6 +26,7 @@ import (
"time"
"github.com/cgrates/birpc/context"
+ "github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
@@ -63,12 +64,12 @@ func TestDspRALsIT(t *testing.T) {
func testDspRALsPing(t *testing.T) {
var reply string
- if err := allEngine.RPC.Call(context.Background(), utils.RALsV1Ping, new(utils.CGREvent), &reply); err != nil {
+ if err := allEngine.RPC.Call(context.Background(), utils.RALsV1Ping, new(engine.CGREvent), &reply); err != nil {
t.Error(err)
} else if reply != utils.Pong {
t.Errorf("Received: %s", reply)
}
- if err := dispEngine.RPC.Call(context.Background(), utils.RALsV1Ping, &utils.CGREvent{
+ if err := dispEngine.RPC.Call(context.Background(), utils.RALsV1Ping, &engine.CGREvent{
Tenant: "cgrates.org",
APIOpts: map[string]any{
diff --git a/dispatchers/rals_test.go b/dispatchers/rals_test.go
index 50a093014..4efe65594 100644
--- a/dispatchers/rals_test.go
+++ b/dispatchers/rals_test.go
@@ -23,6 +23,7 @@ import (
"github.com/cgrates/birpc/context"
"github.com/cgrates/cgrates/config"
+ "github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
@@ -30,7 +31,7 @@ func TestRALsRALsV1PingErr1(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.CGREvent{
+ CGREvent := &engine.CGREvent{
Tenant: "tenant",
}
var reply *string
@@ -46,7 +47,7 @@ func TestRALsRALsV1PingErr1(t *testing.T) {
func TestRALsRALsV1PingErr2(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.CGREvent{
+ CGREvent := &engine.CGREvent{
Tenant: "tenant",
}
var reply *string
@@ -63,7 +64,7 @@ func TestRALsRALsV1PingErrNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- var CGREvent *utils.CGREvent
+ var CGREvent *engine.CGREvent
var reply *string
expected := "MANDATORY_IE_MISSING: [ApiKey]"
diff --git a/dispatchers/replicator.go b/dispatchers/replicator.go
index 1b3225077..f68e5e883 100644
--- a/dispatchers/replicator.go
+++ b/dispatchers/replicator.go
@@ -26,9 +26,9 @@ import (
"github.com/cgrates/cgrates/utils"
)
-func (dS *DispatcherService) ReplicatorSv1Ping(ctx *context.Context, args *utils.CGREvent, rpl *string) (err error) {
+func (dS *DispatcherService) ReplicatorSv1Ping(ctx *context.Context, args *engine.CGREvent, rpl *string) (err error) {
if args == nil {
- args = new(utils.CGREvent)
+ args = new(engine.CGREvent)
}
args.Tenant = utils.FirstNonEmpty(args.Tenant, dS.cfg.GeneralCfg().DefaultTenant)
if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 {
@@ -51,7 +51,7 @@ func (dS *DispatcherService) ReplicatorSv1GetAccount(ctx *context.Context, args
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1GetAccount, args, rpl)
@@ -68,7 +68,7 @@ func (dS *DispatcherService) ReplicatorSv1GetDestination(ctx *context.Context, a
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1GetDestination, args, rpl)
@@ -85,7 +85,7 @@ func (dS *DispatcherService) ReplicatorSv1GetReverseDestination(ctx *context.Con
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1GetReverseDestination, args, rpl)
@@ -102,7 +102,7 @@ func (dS *DispatcherService) ReplicatorSv1GetStatQueue(ctx *context.Context, arg
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
ID: args.ID,
APIOpts: args.APIOpts,
@@ -120,7 +120,7 @@ func (dS *DispatcherService) ReplicatorSv1GetFilter(ctx *context.Context, args *
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
ID: args.ID,
APIOpts: args.APIOpts,
@@ -138,7 +138,7 @@ func (dS *DispatcherService) ReplicatorSv1GetThreshold(ctx *context.Context, arg
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
ID: args.ID,
APIOpts: args.APIOpts,
@@ -156,7 +156,7 @@ func (dS *DispatcherService) ReplicatorSv1GetThresholdProfile(ctx *context.Conte
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
ID: args.ID,
APIOpts: args.APIOpts,
@@ -174,7 +174,7 @@ func (dS *DispatcherService) ReplicatorSv1GetStatQueueProfile(ctx *context.Conte
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
ID: args.ID,
APIOpts: args.APIOpts,
@@ -192,7 +192,7 @@ func (dS *DispatcherService) ReplicatorSv1GetTiming(ctx *context.Context, args *
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1GetTiming, args, rpl)
@@ -209,7 +209,7 @@ func (dS *DispatcherService) ReplicatorSv1GetResource(ctx *context.Context, args
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
ID: args.ID,
APIOpts: args.APIOpts,
@@ -227,7 +227,7 @@ func (dS *DispatcherService) ReplicatorSv1GetResourceProfile(ctx *context.Contex
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
ID: args.ID,
APIOpts: args.APIOpts,
@@ -245,7 +245,7 @@ func (dS *DispatcherService) ReplicatorSv1GetActionTriggers(ctx *context.Context
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1GetActionTriggers, args, rpl)
@@ -262,7 +262,7 @@ func (dS *DispatcherService) ReplicatorSv1GetSharedGroup(ctx *context.Context, a
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1GetSharedGroup, args, rpl)
@@ -279,7 +279,7 @@ func (dS *DispatcherService) ReplicatorSv1GetActions(ctx *context.Context, args
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1GetActions, args, rpl)
@@ -296,7 +296,7 @@ func (dS *DispatcherService) ReplicatorSv1GetActionPlan(ctx *context.Context, ar
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1GetActionPlan, args, rpl)
@@ -313,7 +313,7 @@ func (dS *DispatcherService) ReplicatorSv1GetAllActionPlans(ctx *context.Context
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1GetAllActionPlans, args, rpl)
@@ -330,7 +330,7 @@ func (dS *DispatcherService) ReplicatorSv1GetAccountActionPlans(ctx *context.Con
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1GetAccountActionPlans, args, rpl)
@@ -347,7 +347,7 @@ func (dS *DispatcherService) ReplicatorSv1GetRatingPlan(ctx *context.Context, ar
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1GetRatingPlan, args, rpl)
@@ -364,7 +364,7 @@ func (dS *DispatcherService) ReplicatorSv1GetRatingProfile(ctx *context.Context,
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1GetRatingProfile, args, rpl)
@@ -381,7 +381,7 @@ func (dS *DispatcherService) ReplicatorSv1GetRouteProfile(ctx *context.Context,
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
ID: args.ID,
APIOpts: args.APIOpts,
@@ -399,7 +399,7 @@ func (dS *DispatcherService) ReplicatorSv1GetAttributeProfile(ctx *context.Conte
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
ID: args.ID,
APIOpts: args.APIOpts,
@@ -417,7 +417,7 @@ func (dS *DispatcherService) ReplicatorSv1GetChargerProfile(ctx *context.Context
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
ID: args.ID,
APIOpts: args.APIOpts,
@@ -435,7 +435,7 @@ func (dS *DispatcherService) ReplicatorSv1GetDispatcherProfile(ctx *context.Cont
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
ID: args.ID,
APIOpts: args.APIOpts,
@@ -453,7 +453,7 @@ func (dS *DispatcherService) ReplicatorSv1GetDispatcherHost(ctx *context.Context
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
ID: args.ID,
APIOpts: args.APIOpts,
@@ -471,7 +471,7 @@ func (dS *DispatcherService) ReplicatorSv1GetItemLoadIDs(ctx *context.Context, a
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1GetItemLoadIDs, args, rpl)
@@ -490,7 +490,7 @@ func (dS *DispatcherService) ReplicatorSv1SetThresholdProfile(ctx *context.Conte
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.ThresholdProfile.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1SetThresholdProfile, args, rpl)
@@ -509,7 +509,7 @@ func (dS *DispatcherService) ReplicatorSv1SetThreshold(ctx *context.Context, arg
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1SetThreshold, args, rpl)
@@ -526,7 +526,7 @@ func (dS *DispatcherService) ReplicatorSv1SetDestination(ctx *context.Context, a
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1SetDestination, args, rpl)
@@ -545,7 +545,7 @@ func (dS *DispatcherService) ReplicatorSv1SetAccount(ctx *context.Context, args
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1SetAccount, args, rpl)
@@ -562,7 +562,7 @@ func (dS *DispatcherService) ReplicatorSv1SetReverseDestination(ctx *context.Con
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1SetReverseDestination, args, rpl)
@@ -581,7 +581,7 @@ func (dS *DispatcherService) ReplicatorSv1SetStatQueue(ctx *context.Context, arg
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1SetStatQueue, args, rpl)
@@ -600,7 +600,7 @@ func (dS *DispatcherService) ReplicatorSv1SetFilter(ctx *context.Context, args *
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1SetFilter, args, rpl)
@@ -619,7 +619,7 @@ func (dS *DispatcherService) ReplicatorSv1SetStatQueueProfile(ctx *context.Conte
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1SetStatQueueProfile, args, rpl)
@@ -636,7 +636,7 @@ func (dS *DispatcherService) ReplicatorSv1SetTiming(ctx *context.Context, args *
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1SetTiming, args, rpl)
@@ -655,7 +655,7 @@ func (dS *DispatcherService) ReplicatorSv1SetResource(ctx *context.Context, args
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1SetResource, args, rpl)
@@ -674,7 +674,7 @@ func (dS *DispatcherService) ReplicatorSv1SetResourceProfile(ctx *context.Contex
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1SetResourceProfile, args, rpl)
@@ -691,7 +691,7 @@ func (dS *DispatcherService) ReplicatorSv1SetActionTriggers(ctx *context.Context
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1SetActionTriggers, args, rpl)
@@ -708,7 +708,7 @@ func (dS *DispatcherService) ReplicatorSv1SetSharedGroup(ctx *context.Context, a
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1SetSharedGroup, args, rpl)
@@ -725,7 +725,7 @@ func (dS *DispatcherService) ReplicatorSv1SetActions(ctx *context.Context, args
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1SetActions, args, rpl)
@@ -742,7 +742,7 @@ func (dS *DispatcherService) ReplicatorSv1SetRatingPlan(ctx *context.Context, ar
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1SetRatingPlan, args, rpl)
@@ -759,7 +759,7 @@ func (dS *DispatcherService) ReplicatorSv1SetRatingProfile(ctx *context.Context,
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1SetRatingProfile, args, rpl)
@@ -778,7 +778,7 @@ func (dS *DispatcherService) ReplicatorSv1SetRouteProfile(ctx *context.Context,
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1SetRouteProfile, args, rpl)
@@ -797,7 +797,7 @@ func (dS *DispatcherService) ReplicatorSv1SetAttributeProfile(ctx *context.Conte
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1SetAttributeProfile, args, rpl)
@@ -816,7 +816,7 @@ func (dS *DispatcherService) ReplicatorSv1SetChargerProfile(ctx *context.Context
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1SetChargerProfile, args, rpl)
@@ -835,7 +835,7 @@ func (dS *DispatcherService) ReplicatorSv1SetDispatcherProfile(ctx *context.Cont
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1SetDispatcherProfile, args, rpl)
@@ -852,7 +852,7 @@ func (dS *DispatcherService) ReplicatorSv1SetActionPlan(ctx *context.Context, ar
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1SetActionPlan, args, rpl)
@@ -869,7 +869,7 @@ func (dS *DispatcherService) ReplicatorSv1SetAccountActionPlans(ctx *context.Con
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1SetAccountActionPlans, args, rpl)
@@ -888,7 +888,7 @@ func (dS *DispatcherService) ReplicatorSv1SetDispatcherHost(ctx *context.Context
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1SetDispatcherHost, args, rpl)
@@ -907,7 +907,7 @@ func (dS *DispatcherService) ReplicatorSv1RemoveThreshold(ctx *context.Context,
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1RemoveThreshold, args, rpl)
@@ -924,7 +924,7 @@ func (dS *DispatcherService) ReplicatorSv1RemoveDestination(ctx *context.Context
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1RemoveDestination, args, rpl)
@@ -941,7 +941,7 @@ func (dS *DispatcherService) ReplicatorSv1SetLoadIDs(ctx *context.Context, args
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1SetLoadIDs, args, rpl)
@@ -958,7 +958,7 @@ func (dS *DispatcherService) ReplicatorSv1RemoveAccount(ctx *context.Context, ar
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1RemoveAccount, args, rpl)
@@ -977,7 +977,7 @@ func (dS *DispatcherService) ReplicatorSv1RemoveStatQueue(ctx *context.Context,
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1RemoveStatQueue, args, rpl)
@@ -996,7 +996,7 @@ func (dS *DispatcherService) ReplicatorSv1RemoveFilter(ctx *context.Context, arg
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1RemoveFilter, args, rpl)
@@ -1015,7 +1015,7 @@ func (dS *DispatcherService) ReplicatorSv1RemoveThresholdProfile(ctx *context.Co
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1RemoveThresholdProfile, args, rpl)
@@ -1034,7 +1034,7 @@ func (dS *DispatcherService) ReplicatorSv1RemoveStatQueueProfile(ctx *context.Co
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1RemoveStatQueueProfile, args, rpl)
@@ -1051,7 +1051,7 @@ func (dS *DispatcherService) ReplicatorSv1RemoveTiming(ctx *context.Context, arg
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1RemoveTiming, args, rpl)
@@ -1070,7 +1070,7 @@ func (dS *DispatcherService) ReplicatorSv1RemoveResource(ctx *context.Context, a
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1RemoveResource, args, rpl)
@@ -1089,7 +1089,7 @@ func (dS *DispatcherService) ReplicatorSv1RemoveResourceProfile(ctx *context.Con
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1RemoveResourceProfile, args, rpl)
@@ -1106,7 +1106,7 @@ func (dS *DispatcherService) ReplicatorSv1RemoveActionTriggers(ctx *context.Cont
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1RemoveActionTriggers, args, rpl)
@@ -1123,7 +1123,7 @@ func (dS *DispatcherService) ReplicatorSv1RemoveSharedGroup(ctx *context.Context
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1RemoveSharedGroup, args, rpl)
@@ -1140,7 +1140,7 @@ func (dS *DispatcherService) ReplicatorSv1RemoveActions(ctx *context.Context, ar
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1RemoveActions, args, rpl)
@@ -1157,7 +1157,7 @@ func (dS *DispatcherService) ReplicatorSv1RemoveActionPlan(ctx *context.Context,
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1RemoveActionPlan, args, rpl)
@@ -1174,7 +1174,7 @@ func (dS *DispatcherService) ReplicatorSv1RemAccountActionPlans(ctx *context.Con
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1RemAccountActionPlans, args, rpl)
@@ -1191,7 +1191,7 @@ func (dS *DispatcherService) ReplicatorSv1RemoveRatingPlan(ctx *context.Context,
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1RemoveRatingPlan, args, rpl)
@@ -1208,7 +1208,7 @@ func (dS *DispatcherService) ReplicatorSv1RemoveRatingProfile(ctx *context.Conte
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1RemoveRatingProfile, args, rpl)
@@ -1227,7 +1227,7 @@ func (dS *DispatcherService) ReplicatorSv1RemoveRouteProfile(ctx *context.Contex
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1RemoveRouteProfile, args, rpl)
@@ -1246,7 +1246,7 @@ func (dS *DispatcherService) ReplicatorSv1RemoveAttributeProfile(ctx *context.Co
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1RemoveAttributeProfile, args, rpl)
@@ -1265,7 +1265,7 @@ func (dS *DispatcherService) ReplicatorSv1RemoveChargerProfile(ctx *context.Cont
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1RemoveChargerProfile, args, rpl)
@@ -1284,7 +1284,7 @@ func (dS *DispatcherService) ReplicatorSv1RemoveDispatcherProfile(ctx *context.C
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1RemoveDispatcherProfile, args, rpl)
@@ -1303,7 +1303,7 @@ func (dS *DispatcherService) ReplicatorSv1RemoveDispatcherHost(ctx *context.Cont
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1RemoveDispatcherHost, args, rpl)
@@ -1321,7 +1321,7 @@ func (dS *DispatcherService) ReplicatorSv1GetIndexes(ctx *context.Context, args
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1GetIndexes, args, reply)
@@ -1339,7 +1339,7 @@ func (dS *DispatcherService) ReplicatorSv1SetIndexes(ctx *context.Context, args
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1SetIndexes, args, reply)
@@ -1357,7 +1357,7 @@ func (dS *DispatcherService) ReplicatorSv1RemoveIndexes(ctx *context.Context, ar
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1RemoveIndexes, args, reply)
diff --git a/dispatchers/replicator_it_test.go b/dispatchers/replicator_it_test.go
index 03cac35bc..5f8595c46 100644
--- a/dispatchers/replicator_it_test.go
+++ b/dispatchers/replicator_it_test.go
@@ -86,19 +86,19 @@ func TestDspReplicator(t *testing.T) {
func testDspRplPingFailover(t *testing.T) {
var reply string
- if err := allEngine.RPC.Call(context.Background(), utils.ReplicatorSv1Ping, new(utils.CGREvent), &reply); err != nil {
+ if err := allEngine.RPC.Call(context.Background(), utils.ReplicatorSv1Ping, new(engine.CGREvent), &reply); err != nil {
t.Error(err)
} else if reply != utils.Pong {
t.Errorf("Received: %s", reply)
}
reply = utils.EmptyString
- if err := allEngine2.RPC.Call(context.Background(), utils.ReplicatorSv1Ping, new(utils.CGREvent), &reply); err != nil {
+ if err := allEngine2.RPC.Call(context.Background(), utils.ReplicatorSv1Ping, new(engine.CGREvent), &reply); err != nil {
t.Error(err)
} else if reply != utils.Pong {
t.Errorf("Received: %s", reply)
}
reply = utils.EmptyString
- ev := utils.CGREvent{
+ ev := engine.CGREvent{
Tenant: "cgrates.org",
APIOpts: map[string]any{
diff --git a/dispatchers/replicator_test.go b/dispatchers/replicator_test.go
index 5a090ed99..64108764f 100644
--- a/dispatchers/replicator_test.go
+++ b/dispatchers/replicator_test.go
@@ -43,7 +43,7 @@ func TestDspReplicatorSv1PingNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.CGREvent{
+ CGREvent := &engine.CGREvent{
Tenant: "tenant",
}
var reply *string
@@ -57,7 +57,7 @@ func TestDspReplicatorSv1PingNil(t *testing.T) {
func TestDspReplicatorSv1PingErrorNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.CGREvent{
+ CGREvent := &engine.CGREvent{
Tenant: "tenant",
}
var reply *string
diff --git a/dispatchers/resources.go b/dispatchers/resources.go
index 9d142d8d8..57af29de7 100644
--- a/dispatchers/resources.go
+++ b/dispatchers/resources.go
@@ -26,9 +26,9 @@ import (
"github.com/cgrates/cgrates/utils"
)
-func (dS *DispatcherService) ResourceSv1Ping(ctx *context.Context, args *utils.CGREvent, rpl *string) (err error) {
+func (dS *DispatcherService) ResourceSv1Ping(ctx *context.Context, args *engine.CGREvent, rpl *string) (err error) {
if args == nil {
- args = new(utils.CGREvent)
+ args = new(engine.CGREvent)
}
args.Tenant = utils.FirstNonEmpty(args.Tenant, dS.cfg.GeneralCfg().DefaultTenant)
if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 {
@@ -40,7 +40,7 @@ func (dS *DispatcherService) ResourceSv1Ping(ctx *context.Context, args *utils.C
return dS.Dispatch(args, utils.MetaResources, utils.ResourceSv1Ping, args, rpl)
}
-func (dS *DispatcherService) ResourceSv1GetResourcesForEvent(ctx *context.Context, args *utils.CGREvent,
+func (dS *DispatcherService) ResourceSv1GetResourcesForEvent(ctx *context.Context, args *engine.CGREvent,
reply *engine.Resources) (err error) {
tnt := dS.cfg.GeneralCfg().DefaultTenant
if args != nil && args.Tenant != utils.EmptyString {
@@ -55,7 +55,7 @@ func (dS *DispatcherService) ResourceSv1GetResourcesForEvent(ctx *context.Contex
return dS.Dispatch(args, utils.MetaResources, utils.ResourceSv1GetResourcesForEvent, args, reply)
}
-func (dS *DispatcherService) ResourceSv1AuthorizeResources(ctx *context.Context, args *utils.CGREvent,
+func (dS *DispatcherService) ResourceSv1AuthorizeResources(ctx *context.Context, args *engine.CGREvent,
reply *string) (err error) {
tnt := dS.cfg.GeneralCfg().DefaultTenant
if args != nil && args.Tenant != utils.EmptyString {
@@ -70,7 +70,7 @@ func (dS *DispatcherService) ResourceSv1AuthorizeResources(ctx *context.Context,
return dS.Dispatch(args, utils.MetaResources, utils.ResourceSv1AuthorizeResources, args, reply)
}
-func (dS *DispatcherService) ResourceSv1AllocateResources(ctx *context.Context, args *utils.CGREvent,
+func (dS *DispatcherService) ResourceSv1AllocateResources(ctx *context.Context, args *engine.CGREvent,
reply *string) (err error) {
tnt := dS.cfg.GeneralCfg().DefaultTenant
if args != nil && args.Tenant != utils.EmptyString {
@@ -85,7 +85,7 @@ func (dS *DispatcherService) ResourceSv1AllocateResources(ctx *context.Context,
return dS.Dispatch(args, utils.MetaResources, utils.ResourceSv1AllocateResources, args, reply)
}
-func (dS *DispatcherService) ResourceSv1ReleaseResources(ctx *context.Context, args *utils.CGREvent,
+func (dS *DispatcherService) ResourceSv1ReleaseResources(ctx *context.Context, args *engine.CGREvent,
reply *string) (err error) {
tnt := dS.cfg.GeneralCfg().DefaultTenant
if args != nil && args.Tenant != utils.EmptyString {
@@ -111,7 +111,7 @@ func (dS *DispatcherService) ResourceSv1GetResource(ctx *context.Context, args *
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
ID: args.ID,
APIOpts: args.APIOpts,
@@ -129,7 +129,7 @@ func (dS *DispatcherService) ResourceSv1GetResourceWithConfig(ctx *context.Conte
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
ID: args.ID,
APIOpts: args.APIOpts,
diff --git a/dispatchers/resources_it_test.go b/dispatchers/resources_it_test.go
index ad9d7a649..7dc08ce6e 100644
--- a/dispatchers/resources_it_test.go
+++ b/dispatchers/resources_it_test.go
@@ -68,12 +68,12 @@ func TestDspResourceSIT(t *testing.T) {
func testDspResPingFailover(t *testing.T) {
var reply string
- if err := allEngine.RPC.Call(context.Background(), utils.ResourceSv1Ping, new(utils.CGREvent), &reply); err != nil {
+ if err := allEngine.RPC.Call(context.Background(), utils.ResourceSv1Ping, new(engine.CGREvent), &reply); err != nil {
t.Error(err)
} else if reply != utils.Pong {
t.Errorf("Received: %s", reply)
}
- ev := utils.CGREvent{
+ ev := engine.CGREvent{
Tenant: "cgrates.org",
APIOpts: map[string]any{
@@ -101,12 +101,12 @@ func testDspResPingFailover(t *testing.T) {
func testDspResPing(t *testing.T) {
var reply string
- if err := allEngine.RPC.Call(context.Background(), utils.ResourceSv1Ping, new(utils.CGREvent), &reply); err != nil {
+ if err := allEngine.RPC.Call(context.Background(), utils.ResourceSv1Ping, new(engine.CGREvent), &reply); err != nil {
t.Error(err)
} else if reply != utils.Pong {
t.Errorf("Received: %s", reply)
}
- if err := dispEngine.RPC.Call(context.Background(), utils.ResourceSv1Ping, &utils.CGREvent{
+ if err := dispEngine.RPC.Call(context.Background(), utils.ResourceSv1Ping, &engine.CGREvent{
Tenant: "cgrates.org",
APIOpts: map[string]any{
utils.OptsAPIKey: "res12345",
@@ -120,7 +120,7 @@ func testDspResPing(t *testing.T) {
func testDspResTestAuthKey(t *testing.T) {
var rs *engine.Resources
- args := &utils.CGREvent{
+ args := &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Event: map[string]any{
@@ -141,7 +141,7 @@ func testDspResTestAuthKey(t *testing.T) {
func testDspResTestAuthKey2(t *testing.T) {
var rs *engine.Resources
- args := &utils.CGREvent{
+ args := &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Event: map[string]any{
@@ -172,7 +172,7 @@ func testDspResTestAuthKey2(t *testing.T) {
func testDspResTestAuthKey3(t *testing.T) {
// first event matching Resource1
var reply string
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Event: map[string]any{
@@ -199,7 +199,7 @@ func testDspResTestAuthKey3(t *testing.T) {
} else if reply != eAllocationMsg { // already 3 usages active before allow call, we should have now more than allowed
t.Errorf("Expecting: %+v, received: %+v", eAllocationMsg, reply)
}
- ev = &utils.CGREvent{
+ ev = &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Event: map[string]any{
@@ -218,7 +218,7 @@ func testDspResTestAuthKey3(t *testing.T) {
}
// relase the only resource active for Resource1
- ev = &utils.CGREvent{
+ ev = &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Event: map[string]any{
@@ -236,7 +236,7 @@ func testDspResTestAuthKey3(t *testing.T) {
}
// try reserving with full units for Resource1, case which did not work in previous test
// only match Resource1 since we don't want for storing of the resource2 bellow
- ev = &utils.CGREvent{
+ ev = &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Event: map[string]any{
@@ -255,7 +255,7 @@ func testDspResTestAuthKey3(t *testing.T) {
t.Error("Unexpected reply returned", reply)
}
var rs *engine.Resources
- args := &utils.CGREvent{
+ args := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "Event5",
Event: map[string]any{
diff --git a/dispatchers/resources_test.go b/dispatchers/resources_test.go
index 762b70811..951da0820 100644
--- a/dispatchers/resources_test.go
+++ b/dispatchers/resources_test.go
@@ -43,7 +43,7 @@ func TestDspResourceSv1PingNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.CGREvent{
+ CGREvent := &engine.CGREvent{
Tenant: "tenant",
}
var reply *string
@@ -57,7 +57,7 @@ func TestDspResourceSv1PingNil(t *testing.T) {
func TestDspResourceSv1PingErrorNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.CGREvent{
+ CGREvent := &engine.CGREvent{
Tenant: "tenant",
}
var reply *string
@@ -72,7 +72,7 @@ func TestDspResourceSv1GetResourcesForEventNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.CGREvent{
+ CGREvent := &engine.CGREvent{
Tenant: "tenant",
}
var reply *engine.Resources
@@ -86,7 +86,7 @@ func TestDspResourceSv1GetResourcesForEventNil(t *testing.T) {
func TestDspResourceSv1GetResourcesForEventErrorNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.CGREvent{
+ CGREvent := &engine.CGREvent{
Tenant: "tenant",
}
var reply *engine.Resources
@@ -101,7 +101,7 @@ func TestDspResourceSv1AuthorizeResourcesNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.CGREvent{
+ CGREvent := &engine.CGREvent{
Tenant: "tenant",
}
var reply *string
@@ -115,7 +115,7 @@ func TestDspResourceSv1AuthorizeResourcesNil(t *testing.T) {
func TestDspResourceSv1AuthorizeResourcesErrorNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.CGREvent{
+ CGREvent := &engine.CGREvent{
Tenant: "tenant",
}
var reply *string
@@ -130,7 +130,7 @@ func TestDspResourceSv1ReleaseResourcesNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.CGREvent{
+ CGREvent := &engine.CGREvent{
Tenant: "tenant",
}
var reply *string
@@ -144,7 +144,7 @@ func TestDspResourceSv1ReleaseResourcesNil(t *testing.T) {
func TestDspResourceSv1ReleaseResourcesErrorNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.CGREvent{
+ CGREvent := &engine.CGREvent{
Tenant: "tenant",
}
var reply *string
@@ -192,7 +192,7 @@ func TestDspResourceSv1AllocateResourcesNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.CGREvent{
+ CGREvent := &engine.CGREvent{
Tenant: "tenant",
}
var reply *string
@@ -206,7 +206,7 @@ func TestDspResourceSv1AllocateResourcesNil(t *testing.T) {
func TestDspResourceSv1AllocateResourcesErrorNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.CGREvent{
+ CGREvent := &engine.CGREvent{
Tenant: "tenant",
}
var reply *string
diff --git a/dispatchers/responder.go b/dispatchers/responder.go
index fbaa80cf2..e54454918 100644
--- a/dispatchers/responder.go
+++ b/dispatchers/responder.go
@@ -27,10 +27,10 @@ import (
)
// ResponderPing interogates Responder server responsible to process the event
-func (dS *DispatcherService) ResponderPing(ctx *context.Context, args *utils.CGREvent,
+func (dS *DispatcherService) ResponderPing(ctx *context.Context, args *engine.CGREvent,
reply *string) (err error) {
if args == nil {
- args = new(utils.CGREvent)
+ args = new(engine.CGREvent)
}
args.Tenant = utils.FirstNonEmpty(args.Tenant, dS.cfg.GeneralCfg().DefaultTenant)
if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 {
@@ -117,7 +117,7 @@ func (dS *DispatcherService) ResponderShutdown(ctx *context.Context, args *utils
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
APIOpts: args.APIOpts,
}, utils.MetaResponder, utils.ResponderShutdown, args, reply)
@@ -131,7 +131,7 @@ func (dS *DispatcherService) ResponderGetCostOnRatingPlans(ctx *context.Context,
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
APIOpts: arg.APIOpts,
}, utils.MetaResponder, utils.ResponderGetCostOnRatingPlans, arg, reply)
@@ -145,7 +145,7 @@ func (dS *DispatcherService) ResponderGetMaxSessionTimeOnAccounts(ctx *context.C
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
APIOpts: arg.APIOpts,
}, utils.MetaResponder, utils.ResponderGetMaxSessionTimeOnAccounts, arg, reply)
diff --git a/dispatchers/responder_it_test.go b/dispatchers/responder_it_test.go
index f50887cb0..2f219c006 100644
--- a/dispatchers/responder_it_test.go
+++ b/dispatchers/responder_it_test.go
@@ -27,6 +27,7 @@ import (
"time"
"github.com/cgrates/birpc/context"
+ "github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
"github.com/cgrates/rpcclient"
)
@@ -97,7 +98,7 @@ func testDspResponderStatus(t *testing.T) {
func getNodeWithRoute(route string, t *testing.T) string {
var reply map[string]any
var pingReply string
- pingEv := utils.CGREvent{
+ pingEv := engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.EventName: "Random",
@@ -170,7 +171,7 @@ func testDspResponderShutdown(t *testing.T) {
func testDspResponderBroadcast(t *testing.T) {
var pingReply string
- pingEv := utils.CGREvent{
+ pingEv := engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.EventName: "Broadcast",
@@ -207,7 +208,7 @@ func testDspResponderInternal(t *testing.T) {
var reply map[string]any
var pingReply string
route := "internal"
- pingEv := utils.CGREvent{
+ pingEv := engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.EventName: "Internal",
diff --git a/dispatchers/responder_test.go b/dispatchers/responder_test.go
index eae337ee7..8cc084b80 100644
--- a/dispatchers/responder_test.go
+++ b/dispatchers/responder_test.go
@@ -44,7 +44,7 @@ func TestDspResponderPingEventNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.CGREvent{
+ CGREvent := &engine.CGREvent{
Tenant: "tenant",
}
var reply *string
@@ -58,7 +58,7 @@ func TestDspResponderPingEventNil(t *testing.T) {
func TestDspResponderPingErrorNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.CGREvent{
+ CGREvent := &engine.CGREvent{
Tenant: "tenant",
}
var reply *string
diff --git a/dispatchers/routes.go b/dispatchers/routes.go
index d5cc5fe6d..2b5ecd331 100644
--- a/dispatchers/routes.go
+++ b/dispatchers/routes.go
@@ -24,9 +24,9 @@ import (
"github.com/cgrates/cgrates/utils"
)
-func (dS *DispatcherService) RouteSv1Ping(ctx *context.Context, args *utils.CGREvent, reply *string) (err error) {
+func (dS *DispatcherService) RouteSv1Ping(ctx *context.Context, args *engine.CGREvent, reply *string) (err error) {
if args == nil {
- args = new(utils.CGREvent)
+ args = new(engine.CGREvent)
}
args.Tenant = utils.FirstNonEmpty(args.Tenant, dS.cfg.GeneralCfg().DefaultTenant)
if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 {
@@ -39,7 +39,7 @@ func (dS *DispatcherService) RouteSv1Ping(ctx *context.Context, args *utils.CGRE
return dS.Dispatch(args, utils.MetaRoutes, utils.RouteSv1Ping, args, reply)
}
-func (dS *DispatcherService) RouteSv1GetRoutes(ctx *context.Context, args *utils.CGREvent, reply *engine.SortedRoutesList) (err error) {
+func (dS *DispatcherService) RouteSv1GetRoutes(ctx *context.Context, args *engine.CGREvent, reply *engine.SortedRoutesList) (err error) {
args.Tenant = utils.FirstNonEmpty(args.Tenant, dS.cfg.GeneralCfg().DefaultTenant)
if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 {
if err = dS.authorize(utils.RouteSv1GetRoutes,
@@ -51,7 +51,7 @@ func (dS *DispatcherService) RouteSv1GetRoutes(ctx *context.Context, args *utils
return dS.Dispatch(args, utils.MetaRoutes, utils.RouteSv1GetRoutes, args, reply)
}
-func (dS *DispatcherService) RouteSv1GetRoutesList(ctx *context.Context, args *utils.CGREvent, reply *[]string) (err error) {
+func (dS *DispatcherService) RouteSv1GetRoutesList(ctx *context.Context, args *engine.CGREvent, reply *[]string) (err error) {
args.Tenant = utils.FirstNonEmpty(args.Tenant, dS.cfg.GeneralCfg().DefaultTenant)
if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 {
if err = dS.authorize(utils.RouteSv1GetRoutesList,
@@ -63,7 +63,7 @@ func (dS *DispatcherService) RouteSv1GetRoutesList(ctx *context.Context, args *u
return dS.Dispatch(args, utils.MetaRoutes, utils.RouteSv1GetRoutesList, args, reply)
}
-func (dS *DispatcherService) RouteSv1GetRouteProfilesForEvent(ctx *context.Context, args *utils.CGREvent, reply *[]*engine.RouteProfile) (err error) {
+func (dS *DispatcherService) RouteSv1GetRouteProfilesForEvent(ctx *context.Context, args *engine.CGREvent, reply *[]*engine.RouteProfile) (err error) {
args.Tenant = utils.FirstNonEmpty(args.Tenant, dS.cfg.GeneralCfg().DefaultTenant)
if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 {
if err = dS.authorize(utils.RouteSv1GetRouteProfilesForEvent,
diff --git a/dispatchers/routes_it_test.go b/dispatchers/routes_it_test.go
index b23b0d7b6..cdfe6ba83 100644
--- a/dispatchers/routes_it_test.go
+++ b/dispatchers/routes_it_test.go
@@ -75,12 +75,12 @@ func TestDspSupplierS(t *testing.T) {
func testDspSupPing(t *testing.T) {
var reply string
- if err := allEngine.RPC.Call(context.Background(), utils.RouteSv1Ping, new(utils.CGREvent), &reply); err != nil {
+ if err := allEngine.RPC.Call(context.Background(), utils.RouteSv1Ping, new(engine.CGREvent), &reply); err != nil {
t.Error(err)
} else if reply != utils.Pong {
t.Errorf("Received: %s", reply)
}
- if err := dispEngine.RPC.Call(context.Background(), utils.RouteSv1Ping, &utils.CGREvent{
+ if err := dispEngine.RPC.Call(context.Background(), utils.RouteSv1Ping, &engine.CGREvent{
Tenant: "cgrates.org",
APIOpts: map[string]any{
utils.OptsAPIKey: "sup12345",
@@ -94,12 +94,12 @@ func testDspSupPing(t *testing.T) {
func testDspSupPingFailover(t *testing.T) {
var reply string
- if err := allEngine.RPC.Call(context.Background(), utils.RouteSv1Ping, new(utils.CGREvent), &reply); err != nil {
+ if err := allEngine.RPC.Call(context.Background(), utils.RouteSv1Ping, new(engine.CGREvent), &reply); err != nil {
t.Error(err)
} else if reply != utils.Pong {
t.Errorf("Received: %s", reply)
}
- ev := utils.CGREvent{
+ ev := engine.CGREvent{
Tenant: "cgrates.org",
APIOpts: map[string]any{
@@ -164,7 +164,7 @@ func testDspSupGetSupFailover(t *testing.T) {
},
},
}}
- args := &utils.CGREvent{
+ args := &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Time: &nowTime,
@@ -199,7 +199,7 @@ func testDspSupGetSupFailover(t *testing.T) {
func testDspSupTestAuthKey(t *testing.T) {
var rpl engine.SortedRoutesList
- args := &utils.CGREvent{
+ args := &engine.CGREvent{
ID: utils.UUIDSha1Prefix(),
Time: &nowTime,
Event: map[string]any{
@@ -246,7 +246,7 @@ func testDspSupTestAuthKey2(t *testing.T) {
},
},
}}
- args := &utils.CGREvent{
+ args := &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Time: &nowTime,
@@ -309,7 +309,7 @@ func testDspSupGetSupRoundRobin(t *testing.T) {
},
},
}}
- args := &utils.CGREvent{
+ args := &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Time: &nowTime,
@@ -341,7 +341,7 @@ func testDspSupGetSupRoundRobin(t *testing.T) {
}
func testDspSupGetSupplierForEvent(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testV1SplSGetHighestCostSuppliers",
Event: map[string]any{
diff --git a/dispatchers/routes_test.go b/dispatchers/routes_test.go
index 41474196d..47154e95c 100644
--- a/dispatchers/routes_test.go
+++ b/dispatchers/routes_test.go
@@ -24,7 +24,6 @@ import (
"github.com/cgrates/birpc/context"
"github.com/cgrates/cgrates/config"
"github.com/cgrates/cgrates/engine"
- "github.com/cgrates/cgrates/utils"
)
func TestDspRouteSv1PingNilEvent(t *testing.T) {
@@ -43,7 +42,7 @@ func TestDspRouteSv1PingNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.CGREvent{
+ CGREvent := &engine.CGREvent{
Tenant: "tenant",
}
var reply *string
@@ -57,7 +56,7 @@ func TestDspRouteSv1PingNil(t *testing.T) {
func TestDspRouteSv1PingErrorNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.CGREvent{
+ CGREvent := &engine.CGREvent{
Tenant: "tenant",
}
var reply *string
@@ -72,7 +71,7 @@ func TestDspRouteSv1GetRoutesNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.CGREvent{
+ CGREvent := &engine.CGREvent{
Tenant: "tenant",
}
var reply *engine.SortedRoutesList
@@ -86,7 +85,7 @@ func TestDspRouteSv1GetRoutesNil(t *testing.T) {
func TestDspRouteSv1GetRoutesErrorNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.CGREvent{
+ CGREvent := &engine.CGREvent{
Tenant: "tenant",
}
var reply *engine.SortedRoutesList
@@ -101,7 +100,7 @@ func TestDspRouteSv1GetRoutesListNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.CGREvent{
+ CGREvent := &engine.CGREvent{
Tenant: "tenant",
}
var reply *[]string
@@ -115,7 +114,7 @@ func TestDspRouteSv1GetRoutesListNil(t *testing.T) {
func TestDspRouteSv1GetRoutesListErrorNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.CGREvent{
+ CGREvent := &engine.CGREvent{
Tenant: "tenant",
}
var reply *[]string
@@ -130,7 +129,7 @@ func TestDspRouteSv1GetRouteProfilesForEventNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.CGREvent{
+ CGREvent := &engine.CGREvent{
Tenant: "tenant",
}
var reply *[]*engine.RouteProfile
@@ -144,7 +143,7 @@ func TestDspRouteSv1GetRouteProfilesForEventNil(t *testing.T) {
func TestDspRouteSv1GetRouteProfilesForEventErrorNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.CGREvent{
+ CGREvent := &engine.CGREvent{
Tenant: "tenant",
}
var reply *[]*engine.RouteProfile
diff --git a/dispatchers/scheduler.go b/dispatchers/scheduler.go
index dd48910ed..b8872f71a 100644
--- a/dispatchers/scheduler.go
+++ b/dispatchers/scheduler.go
@@ -22,12 +22,13 @@ import (
"time"
"github.com/cgrates/birpc/context"
+ "github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
-func (dS *DispatcherService) SchedulerSv1Ping(ctx *context.Context, args *utils.CGREvent, reply *string) (err error) {
+func (dS *DispatcherService) SchedulerSv1Ping(ctx *context.Context, args *engine.CGREvent, reply *string) (err error) {
if args == nil {
- args = new(utils.CGREvent)
+ args = new(engine.CGREvent)
}
args.Tenant = utils.FirstNonEmpty(args.Tenant, dS.cfg.GeneralCfg().DefaultTenant)
if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 {
@@ -39,7 +40,7 @@ func (dS *DispatcherService) SchedulerSv1Ping(ctx *context.Context, args *utils.
return dS.Dispatch(args, utils.MetaScheduler, utils.SchedulerSv1Ping, args, reply)
}
-func (dS *DispatcherService) SchedulerSv1Reload(ctx *context.Context, args *utils.CGREvent, reply *string) (err error) {
+func (dS *DispatcherService) SchedulerSv1Reload(ctx *context.Context, args *engine.CGREvent, reply *string) (err error) {
args.Tenant = utils.FirstNonEmpty(args.Tenant, dS.cfg.GeneralCfg().DefaultTenant)
if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 {
if err = dS.authorize(utils.SchedulerSv1Ping, args.Tenant,
@@ -58,7 +59,7 @@ func (dS *DispatcherService) SchedulerSv1ExecuteActions(ctx *context.Context, ar
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaScheduler, utils.SchedulerSv1ExecuteActions, args, reply)
@@ -72,7 +73,7 @@ func (dS *DispatcherService) SchedulerSv1ExecuteActionPlans(ctx *context.Context
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
APIOpts: args.APIOpts,
}, utils.MetaScheduler, utils.SchedulerSv1ExecuteActionPlans, args, reply)
diff --git a/dispatchers/scheduler_it_test.go b/dispatchers/scheduler_it_test.go
index 2e695c35a..2ebf9bb04 100644
--- a/dispatchers/scheduler_it_test.go
+++ b/dispatchers/scheduler_it_test.go
@@ -25,6 +25,7 @@ import (
"testing"
"github.com/cgrates/birpc/context"
+ "github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
@@ -62,12 +63,12 @@ func TestDspSchedulerS(t *testing.T) {
func testDspSchedPing(t *testing.T) {
var reply string
- if err := allEngine.RPC.Call(context.Background(), utils.SchedulerSv1Ping, new(utils.CGREvent), &reply); err != nil {
+ if err := allEngine.RPC.Call(context.Background(), utils.SchedulerSv1Ping, new(engine.CGREvent), &reply); err != nil {
t.Error(err)
} else if reply != utils.Pong {
t.Errorf("Received: %s", reply)
}
- if err := dispEngine.RPC.Call(context.Background(), utils.SchedulerSv1Ping, &utils.CGREvent{
+ if err := dispEngine.RPC.Call(context.Background(), utils.SchedulerSv1Ping, &engine.CGREvent{
Tenant: "cgrates.org",
APIOpts: map[string]any{
diff --git a/dispatchers/scheduler_test.go b/dispatchers/scheduler_test.go
index dc79b6e43..52afcd0f6 100644
--- a/dispatchers/scheduler_test.go
+++ b/dispatchers/scheduler_test.go
@@ -23,6 +23,7 @@ import (
"github.com/cgrates/birpc/context"
"github.com/cgrates/cgrates/config"
+ "github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
@@ -42,7 +43,7 @@ func TestDspSchedulerSv1PingErrorNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.CGREvent{
+ CGREvent := &engine.CGREvent{
Tenant: "tenant",
}
var reply *string
@@ -56,7 +57,7 @@ func TestDspSchedulerSv1PingErrorNil(t *testing.T) {
func TestDspSchedulerSv1PingNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.CGREvent{
+ CGREvent := &engine.CGREvent{
Tenant: "tenant",
}
var reply *string
@@ -71,7 +72,7 @@ func TestDspSchedulerSv1ReloadErrorNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.CGREvent{
+ CGREvent := &engine.CGREvent{
Tenant: "tenant",
}
var reply *string
@@ -85,7 +86,7 @@ func TestDspSchedulerSv1ReloadErrorNil(t *testing.T) {
func TestDspSchedulerSv1ReloadPingNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.CGREvent{
+ CGREvent := &engine.CGREvent{
Tenant: "tenant",
}
var reply *string
diff --git a/dispatchers/servicemanager.go b/dispatchers/servicemanager.go
index a4ac260d9..4750db3ea 100644
--- a/dispatchers/servicemanager.go
+++ b/dispatchers/servicemanager.go
@@ -22,14 +22,15 @@ import (
"time"
"github.com/cgrates/birpc/context"
+ "github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
// ServiceManagerV1Ping interogates ServiceManager server responsible to process the event
-func (dS *DispatcherService) ServiceManagerV1Ping(ctx *context.Context, args *utils.CGREvent,
+func (dS *DispatcherService) ServiceManagerV1Ping(ctx *context.Context, args *engine.CGREvent,
reply *string) (err error) {
if args == nil {
- args = new(utils.CGREvent)
+ args = new(engine.CGREvent)
}
args.Tenant = utils.FirstNonEmpty(args.Tenant, dS.cfg.GeneralCfg().DefaultTenant)
if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 {
@@ -53,7 +54,7 @@ func (dS *DispatcherService) ServiceManagerV1StartService(ctx *context.Context,
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
APIOpts: args.APIOpts,
}, utils.MetaServiceManager, utils.ServiceManagerV1StartService, args, reply)
@@ -71,7 +72,7 @@ func (dS *DispatcherService) ServiceManagerV1StopService(ctx *context.Context, a
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
APIOpts: args.APIOpts,
}, utils.MetaServiceManager, utils.ServiceManagerV1StopService, args, reply)
@@ -89,7 +90,7 @@ func (dS *DispatcherService) ServiceManagerV1ServiceStatus(ctx *context.Context,
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
APIOpts: args.APIOpts,
}, utils.MetaServiceManager, utils.ServiceManagerV1ServiceStatus, args, reply)
diff --git a/dispatchers/servicemanager_test.go b/dispatchers/servicemanager_test.go
index 235af6e00..1696fab96 100644
--- a/dispatchers/servicemanager_test.go
+++ b/dispatchers/servicemanager_test.go
@@ -23,7 +23,7 @@ import (
"github.com/cgrates/birpc/context"
"github.com/cgrates/cgrates/config"
- "github.com/cgrates/cgrates/utils"
+ "github.com/cgrates/cgrates/engine"
)
func TestDspServiceManagerV1PingErrorNilEvent(t *testing.T) {
@@ -42,7 +42,7 @@ func TestDspServiceManagerV1PingErrorNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.CGREvent{
+ CGREvent := &engine.CGREvent{
Tenant: "tenant",
}
var reply *string
@@ -56,7 +56,7 @@ func TestDspServiceManagerV1PingErrorNil(t *testing.T) {
func TestDspServiceManagerV1PingNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.CGREvent{
+ CGREvent := &engine.CGREvent{
Tenant: "tenant",
}
var reply *string
diff --git a/dispatchers/sessions.go b/dispatchers/sessions.go
index 14fa89ebe..a2461bbc8 100644
--- a/dispatchers/sessions.go
+++ b/dispatchers/sessions.go
@@ -22,11 +22,12 @@ import (
"time"
"github.com/cgrates/birpc/context"
+ "github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/sessions"
"github.com/cgrates/cgrates/utils"
)
-func (dS *DispatcherService) SessionSv1Ping(ctx *context.Context, args *utils.CGREvent, reply *string) (err error) {
+func (dS *DispatcherService) SessionSv1Ping(ctx *context.Context, args *engine.CGREvent, reply *string) (err error) {
args.Tenant = utils.FirstNonEmpty(args.Tenant, dS.cfg.GeneralCfg().DefaultTenant)
if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 {
if err = dS.authorize(utils.SessionSv1Ping, args.Tenant,
@@ -109,7 +110,7 @@ func (dS *DispatcherService) SessionSv1SyncSessions(ctx *context.Context, args *
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
APIOpts: args.APIOpts,
}, utils.MetaSessionS, utils.SessionSv1SyncSessions, args, reply)
@@ -127,7 +128,7 @@ func (dS *DispatcherService) SessionSv1TerminateSession(ctx *context.Context, ar
return dS.Dispatch(args.CGREvent, utils.MetaSessionS, utils.SessionSv1TerminateSession, args, reply)
}
-func (dS *DispatcherService) SessionSv1ProcessCDR(ctx *context.Context, args *utils.CGREvent,
+func (dS *DispatcherService) SessionSv1ProcessCDR(ctx *context.Context, args *engine.CGREvent,
reply *string) (err error) {
args.Tenant = utils.FirstNonEmpty(args.Tenant, dS.cfg.GeneralCfg().DefaultTenant)
if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 {
@@ -187,7 +188,7 @@ func (dS *DispatcherService) SessionSv1GetActiveSessions(ctx *context.Context, a
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
APIOpts: args.APIOpts,
}, utils.MetaSessionS, utils.SessionSv1GetActiveSessions, args, reply)
@@ -205,7 +206,7 @@ func (dS *DispatcherService) SessionSv1GetActiveSessionsCount(ctx *context.Conte
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
APIOpts: args.APIOpts,
}, utils.MetaSessionS, utils.SessionSv1GetActiveSessionsCount, args, reply)
@@ -223,7 +224,7 @@ func (dS *DispatcherService) SessionSv1ForceDisconnect(ctx *context.Context, arg
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
APIOpts: args.APIOpts,
}, utils.MetaSessionS, utils.SessionSv1ForceDisconnect, args, reply)
@@ -241,7 +242,7 @@ func (dS *DispatcherService) SessionSv1GetPassiveSessions(ctx *context.Context,
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
APIOpts: args.APIOpts,
}, utils.MetaSessionS, utils.SessionSv1GetPassiveSessions, args, reply)
@@ -259,7 +260,7 @@ func (dS *DispatcherService) SessionSv1GetPassiveSessionsCount(ctx *context.Cont
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
APIOpts: args.APIOpts,
}, utils.MetaSessionS, utils.SessionSv1GetPassiveSessionsCount, args, reply)
@@ -277,7 +278,7 @@ func (dS *DispatcherService) SessionSv1ReplicateSessions(ctx *context.Context, a
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
APIOpts: args.APIOpts,
}, utils.MetaSessionS, utils.SessionSv1ReplicateSessions, args, reply)
@@ -295,7 +296,7 @@ func (dS *DispatcherService) SessionSv1SetPassiveSession(ctx *context.Context, a
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
APIOpts: args.OptsStart,
}, utils.MetaSessionS, utils.SessionSv1SetPassiveSession, args, reply)
@@ -312,7 +313,7 @@ func (dS *DispatcherService) SessionSv1ActivateSessions(ctx *context.Context, ar
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
APIOpts: args.APIOpts,
}, utils.MetaSessionS, utils.SessionSv1ActivateSessions, args, reply)
@@ -329,7 +330,7 @@ func (dS *DispatcherService) SessionSv1DeactivateSessions(ctx *context.Context,
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
APIOpts: args.APIOpts,
}, utils.MetaSessionS, utils.SessionSv1DeactivateSessions, args, reply)
@@ -343,7 +344,7 @@ func (dS *DispatcherService) SessionSv1STIRAuthenticate(ctx *context.Context, ar
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
APIOpts: args.APIOpts,
}, utils.MetaSessionS, utils.SessionSv1STIRAuthenticate, args, reply)
@@ -357,7 +358,7 @@ func (dS *DispatcherService) SessionSv1STIRIdentity(ctx *context.Context, args *
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
APIOpts: args.APIOpts,
}, utils.MetaSessionS, utils.SessionSv1STIRIdentity, args, reply)
diff --git a/dispatchers/sessions_it_test.go b/dispatchers/sessions_it_test.go
index 69c4a1fcf..fd790254c 100644
--- a/dispatchers/sessions_it_test.go
+++ b/dispatchers/sessions_it_test.go
@@ -135,12 +135,12 @@ func testDspSessionAddBalacne(t *testing.T) {
func testDspSessionPing(t *testing.T) {
var reply string
- if err := allEngine.RPC.Call(context.Background(), utils.SessionSv1Ping, new(utils.CGREvent), &reply); err != nil {
+ if err := allEngine.RPC.Call(context.Background(), utils.SessionSv1Ping, new(engine.CGREvent), &reply); err != nil {
t.Error(err)
} else if reply != utils.Pong {
t.Errorf("Received: %s", reply)
}
- if err := dispEngine.RPC.Call(context.Background(), utils.SessionSv1Ping, &utils.CGREvent{
+ if err := dispEngine.RPC.Call(context.Background(), utils.SessionSv1Ping, &engine.CGREvent{
Tenant: "cgrates.org",
APIOpts: map[string]any{
@@ -155,12 +155,12 @@ func testDspSessionPing(t *testing.T) {
func testDspSessionPingFailover(t *testing.T) {
var reply string
- if err := allEngine.RPC.Call(context.Background(), utils.SessionSv1Ping, new(utils.CGREvent), &reply); err != nil {
+ if err := allEngine.RPC.Call(context.Background(), utils.SessionSv1Ping, new(engine.CGREvent), &reply); err != nil {
t.Error(err)
} else if reply != utils.Pong {
t.Errorf("Received: %s", reply)
}
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
APIOpts: map[string]any{
@@ -193,7 +193,7 @@ func testDspSessionTestAuthKey(t *testing.T) {
AuthorizeResources: true,
GetRoutes: true,
GetAttributes: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSSv1ItAuth",
Event: map[string]any{
@@ -227,7 +227,7 @@ func testDspSessionAuthorize(t *testing.T) {
AuthorizeResources: true,
GetRoutes: true,
GetAttributes: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSSv1ItAuth",
Event: map[string]any{
@@ -280,7 +280,7 @@ func testDspSessionInit(t *testing.T) {
InitSession: true,
AllocateResources: true,
GetAttributes: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSSv1ItInitiateSession",
Event: map[string]any{
@@ -356,7 +356,7 @@ func testDspSessionUpdate(t *testing.T) {
argsUpdate := &sessions.V1UpdateSessionArgs{
GetAttributes: true,
UpdateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSSv1ItUpdateSession",
Event: map[string]any{
@@ -386,7 +386,7 @@ func testDspSessionUpdate(t *testing.T) {
eAttrs := &engine.AttrSProcessEventReply{
MatchedProfiles: []string{"cgrates.org:ATTR_ACNT_1001"},
AlteredFields: []string{"*req.OfficeGroup"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSSv1ItUpdateSession",
Event: map[string]any{
@@ -430,7 +430,7 @@ func testDspSessionUpdate2(t *testing.T) {
argsUpdate := &sessions.V1UpdateSessionArgs{
GetAttributes: true,
UpdateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSSv1ItUpdateSession",
Event: map[string]any{
@@ -460,7 +460,7 @@ func testDspSessionUpdate2(t *testing.T) {
MatchedProfiles: []string{"cgrates.org:ATTR_1001_SESSIONAUTH"},
AlteredFields: []string{"*req.LCRProfile", "*req.Password", "*req.RequestType", "*req.PaypalAccount"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSSv1ItUpdateSession",
Event: map[string]any{
@@ -510,7 +510,7 @@ func testDspSessionTerminate(t *testing.T) {
TerminateSession: true,
ReleaseResources: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSSv1ItUpdateSession",
Event: map[string]any{
@@ -543,7 +543,7 @@ func testDspSessionTerminate(t *testing.T) {
}
func testDspSessionProcessCDR(t *testing.T) {
- args := utils.CGREvent{
+ args := engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSSv1ItProcessCDR",
Event: map[string]any{
@@ -579,7 +579,7 @@ func testDspSessionProcessEvent(t *testing.T) {
AllocateResources: true,
Debit: true,
GetAttributes: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSSv1ItProcessEvent",
Event: map[string]any{
@@ -617,7 +617,7 @@ func testDspSessionProcessEvent(t *testing.T) {
MatchedProfiles: []string{"cgrates.org:ATTR_ACNT_1001"},
AlteredFields: []string{"*req.OfficeGroup"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSSv1ItProcessEvent",
Event: map[string]any{
@@ -662,7 +662,7 @@ func testDspSessionProcessEvent2(t *testing.T) {
AllocateResources: true,
Debit: true,
GetAttributes: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSSv1ItProcessEvent",
Event: map[string]any{
@@ -700,7 +700,7 @@ func testDspSessionProcessEvent2(t *testing.T) {
MatchedProfiles: []string{"cgrates.org:ATTR_1001_SIMPLEAUTH"},
AlteredFields: []string{"*req.EventName", "*req.Password"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSSv1ItProcessEvent",
Event: map[string]any{
@@ -941,7 +941,7 @@ func testDspSessionForceDisconect(t *testing.T) {
func testDspSessionProcessEvent3(t *testing.T) {
args := &sessions.V1ProcessEventArgs{
Flags: []string{"*rals:*terminate", "*resources:*release"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testSSv1ItProcessEventTerminateSession",
Event: map[string]any{
@@ -986,7 +986,7 @@ func testDspSessionProcessEvent3(t *testing.T) {
func testDspSessionGetCost(t *testing.T) {
args := &sessions.V1ProcessEventArgs{
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testSSv1ItGetCost",
Event: map[string]any{
diff --git a/dispatchers/sessions_test.go b/dispatchers/sessions_test.go
index 43511694e..b917002c9 100644
--- a/dispatchers/sessions_test.go
+++ b/dispatchers/sessions_test.go
@@ -23,6 +23,7 @@ import (
"github.com/cgrates/birpc/context"
"github.com/cgrates/cgrates/config"
+ "github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/sessions"
"github.com/cgrates/cgrates/utils"
)
@@ -30,7 +31,7 @@ import (
func TestDspSessionSv1PingNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.CGREvent{
+ CGREvent := &engine.CGREvent{
Tenant: "tenant",
}
var reply *string
@@ -45,7 +46,7 @@ func TestDspSessionSv1PingErrorNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.CGREvent{
+ CGREvent := &engine.CGREvent{
Tenant: "tenant",
}
var reply *string
@@ -60,7 +61,7 @@ func TestDspSessionSv1AuthorizeEventNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
CGREvent := &sessions.V1AuthorizeArgs{
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "tenant",
},
}
@@ -77,7 +78,7 @@ func TestDspSessionSv1AuthorizeEventErrorNil(t *testing.T) {
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
CGREvent := &sessions.V1AuthorizeArgs{
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "tenant",
},
}
@@ -93,7 +94,7 @@ func TestDspSessionSv1AuthorizeEventWithDigestNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
CGREvent := &sessions.V1AuthorizeArgs{
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "tenant",
},
}
@@ -110,7 +111,7 @@ func TestDspSessionSv1AuthorizeEventWithDigestErrorNil(t *testing.T) {
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
CGREvent := &sessions.V1AuthorizeArgs{
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "tenant",
},
}
@@ -126,7 +127,7 @@ func TestDspSessionSv1InitiateSessionNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
CGREvent := &sessions.V1InitSessionArgs{
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "tenant",
},
}
@@ -143,7 +144,7 @@ func TestDspSessionSv1InitiateSessionErrorNil(t *testing.T) {
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
CGREvent := &sessions.V1InitSessionArgs{
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "tenant",
},
}
@@ -159,7 +160,7 @@ func TestDspSessionSv1InitiateSessionWithDigestNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
CGREvent := &sessions.V1InitSessionArgs{
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "tenant",
},
}
@@ -176,7 +177,7 @@ func TestDspSessionSv1InitiateSessionWithDigestErrorNil(t *testing.T) {
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
CGREvent := &sessions.V1InitSessionArgs{
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "tenant",
},
}
@@ -192,7 +193,7 @@ func TestDspSessionSv1UpdateSessionNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
CGREvent := &sessions.V1UpdateSessionArgs{
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "tenant",
},
}
@@ -209,7 +210,7 @@ func TestDspSessionSv1UpdateSessionErrorNil(t *testing.T) {
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
CGREvent := &sessions.V1UpdateSessionArgs{
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "tenant",
},
}
@@ -254,7 +255,7 @@ func TestDspSessionSv1TerminateSessionNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
CGREvent := &sessions.V1TerminateSessionArgs{
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "tenant",
},
}
@@ -271,7 +272,7 @@ func TestDspSessionSv1TerminateSessionErrorNil(t *testing.T) {
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
CGREvent := &sessions.V1TerminateSessionArgs{
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "tenant",
},
}
@@ -286,7 +287,7 @@ func TestDspSessionSv1TerminateSessionErrorNil(t *testing.T) {
func TestDspSessionSv1ProcessCDRNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.CGREvent{
+ CGREvent := &engine.CGREvent{
Tenant: "tenant",
}
var reply *string
@@ -301,7 +302,7 @@ func TestDspSessionSv1ProcessCDRErrorNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.CGREvent{
+ CGREvent := &engine.CGREvent{
Tenant: "tenant",
}
var reply *string
@@ -316,7 +317,7 @@ func TestDspSessionSv1ProcessMessageNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
CGREvent := &sessions.V1ProcessMessageArgs{
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "tenant",
},
}
@@ -333,7 +334,7 @@ func TestDspSessionSv1ProcessMessageErrorNil(t *testing.T) {
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
CGREvent := &sessions.V1ProcessMessageArgs{
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "tenant",
},
}
@@ -349,7 +350,7 @@ func TestDspSessionSv1ProcessEventNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
CGREvent := &sessions.V1ProcessEventArgs{
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "tenant",
},
}
@@ -366,7 +367,7 @@ func TestDspSessionSv1ProcessEventErrorNil(t *testing.T) {
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
CGREvent := &sessions.V1ProcessEventArgs{
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "tenant",
},
}
@@ -382,7 +383,7 @@ func TestDspSessionSv1GetCostNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
CGREvent := &sessions.V1ProcessEventArgs{
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "tenant",
},
}
@@ -399,7 +400,7 @@ func TestDspSessionSv1GetCostErrorNil(t *testing.T) {
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
CGREvent := &sessions.V1ProcessEventArgs{
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "tenant",
},
}
diff --git a/dispatchers/stats.go b/dispatchers/stats.go
index 2ff34d3ea..93051a8a4 100644
--- a/dispatchers/stats.go
+++ b/dispatchers/stats.go
@@ -22,12 +22,13 @@ import (
"time"
"github.com/cgrates/birpc/context"
+ "github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
-func (dS *DispatcherService) StatSv1Ping(ctx *context.Context, args *utils.CGREvent, reply *string) (err error) {
+func (dS *DispatcherService) StatSv1Ping(ctx *context.Context, args *engine.CGREvent, reply *string) (err error) {
if args == nil {
- args = new(utils.CGREvent)
+ args = new(engine.CGREvent)
}
args.Tenant = utils.FirstNonEmpty(args.Tenant, dS.cfg.GeneralCfg().DefaultTenant)
if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 {
@@ -40,7 +41,7 @@ func (dS *DispatcherService) StatSv1Ping(ctx *context.Context, args *utils.CGREv
return dS.Dispatch(args, utils.MetaStats, utils.StatSv1Ping, args, reply)
}
-func (dS *DispatcherService) StatSv1GetStatQueuesForEvent(ctx *context.Context, args *utils.CGREvent,
+func (dS *DispatcherService) StatSv1GetStatQueuesForEvent(ctx *context.Context, args *engine.CGREvent,
reply *[]string) (err error) {
args.Tenant = utils.FirstNonEmpty(args.Tenant, dS.cfg.GeneralCfg().DefaultTenant)
if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 {
@@ -63,14 +64,14 @@ func (dS *DispatcherService) StatSv1GetQueueStringMetrics(ctx *context.Context,
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
ID: args.ID,
APIOpts: args.APIOpts,
}, utils.MetaStats, utils.StatSv1GetQueueStringMetrics, args, reply)
}
-func (dS *DispatcherService) StatSv1ProcessEvent(ctx *context.Context, args *utils.CGREvent,
+func (dS *DispatcherService) StatSv1ProcessEvent(ctx *context.Context, args *engine.CGREvent,
reply *[]string) (err error) {
args.Tenant = utils.FirstNonEmpty(args.Tenant, dS.cfg.GeneralCfg().DefaultTenant)
if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 {
@@ -92,7 +93,7 @@ func (dS *DispatcherService) StatSv1GetQueueFloatMetrics(ctx *context.Context, a
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: args.Tenant,
ID: args.ID,
APIOpts: args.APIOpts,
@@ -111,7 +112,7 @@ func (dS *DispatcherService) StatSv1GetQueueIDs(ctx *context.Context, args *util
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
APIOpts: args.APIOpts,
}, utils.MetaStats, utils.StatSv1GetQueueIDs, args, reply)
diff --git a/dispatchers/stats_it_test.go b/dispatchers/stats_it_test.go
index 10c30e5dd..b735ce34f 100644
--- a/dispatchers/stats_it_test.go
+++ b/dispatchers/stats_it_test.go
@@ -28,6 +28,7 @@ import (
"time"
"github.com/cgrates/birpc/context"
+ "github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
@@ -70,12 +71,12 @@ func TestDspStatS(t *testing.T) {
func testDspStsPingFailover(t *testing.T) {
var reply string
- if err := allEngine.RPC.Call(context.Background(), utils.StatSv1Ping, new(utils.CGREvent), &reply); err != nil {
+ if err := allEngine.RPC.Call(context.Background(), utils.StatSv1Ping, new(engine.CGREvent), &reply); err != nil {
t.Error(err)
} else if reply != utils.Pong {
t.Errorf("Received: %s", reply)
}
- ev := utils.CGREvent{
+ ev := engine.CGREvent{
Tenant: "cgrates.org",
APIOpts: map[string]any{
utils.OptsAPIKey: "stat12345",
@@ -104,7 +105,7 @@ func testDspStsGetStatFailover(t *testing.T) {
var reply []string
var metrics map[string]string
expected := []string{"Stats1"}
- args := &utils.CGREvent{
+ args := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -154,12 +155,12 @@ func testDspStsGetStatFailover(t *testing.T) {
func testDspStsPing(t *testing.T) {
var reply string
- if err := allEngine.RPC.Call(context.Background(), utils.StatSv1Ping, new(utils.CGREvent), &reply); err != nil {
+ if err := allEngine.RPC.Call(context.Background(), utils.StatSv1Ping, new(engine.CGREvent), &reply); err != nil {
t.Error(err)
} else if reply != utils.Pong {
t.Errorf("Received: %s", reply)
}
- if err := dispEngine.RPC.Call(context.Background(), utils.StatSv1Ping, &utils.CGREvent{
+ if err := dispEngine.RPC.Call(context.Background(), utils.StatSv1Ping, &engine.CGREvent{
Tenant: "cgrates.org",
APIOpts: map[string]any{
utils.OptsAPIKey: "stat12345",
@@ -173,7 +174,7 @@ func testDspStsPing(t *testing.T) {
func testDspStsTestAuthKey(t *testing.T) {
var reply []string
- args := &utils.CGREvent{
+ args := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -212,7 +213,7 @@ func testDspStsTestAuthKey2(t *testing.T) {
var reply []string
var metrics map[string]string
expected := []string{"Stats2"}
- args := &utils.CGREvent{
+ args := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -253,7 +254,7 @@ func testDspStsTestAuthKey2(t *testing.T) {
t.Errorf("expecting: %+v, received reply: %s", expectedMetrics, metrics)
}
- args = &utils.CGREvent{
+ args = &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -328,7 +329,7 @@ func testDspStsTestAuthKey3(t *testing.T) {
}
estats = []string{"Stats2"}
- if err := dispEngine.RPC.Call(context.Background(), utils.StatSv1GetStatQueuesForEvent, &utils.CGREvent{
+ if err := dispEngine.RPC.Call(context.Background(), utils.StatSv1GetStatQueuesForEvent, &engine.CGREvent{
Tenant: "cgrates.org",
ID: "GetStats",
Event: map[string]any{
diff --git a/dispatchers/stats_test.go b/dispatchers/stats_test.go
index 3f6796cc5..630fb0952 100644
--- a/dispatchers/stats_test.go
+++ b/dispatchers/stats_test.go
@@ -23,13 +23,14 @@ import (
"github.com/cgrates/birpc/context"
"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{
+ CGREvent := &engine.CGREvent{
Tenant: "tenant",
}
var reply *string
@@ -56,7 +57,7 @@ func TestDspStatSv1PingErrorNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.CGREvent{
+ CGREvent := &engine.CGREvent{
Tenant: "tenant",
}
var reply *string
@@ -70,7 +71,7 @@ func TestDspStatSv1PingErrorNil(t *testing.T) {
func TestDspStatSv1GetStatQueuesForEventNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.CGREvent{
+ CGREvent := &engine.CGREvent{
Tenant: "tenant",
}
var reply *[]string
@@ -85,7 +86,7 @@ func TestDspStatSv1GetStatQueuesForEventErrorNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.CGREvent{
+ CGREvent := &engine.CGREvent{
Tenant: "tenant",
}
var reply *[]string
@@ -132,7 +133,7 @@ func TestDspStatSv1GetQueueStringMetricsErrorNil(t *testing.T) {
func TestDspStatSv1ProcessEventNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.CGREvent{
+ CGREvent := &engine.CGREvent{
Tenant: "tenant",
}
var reply *[]string
@@ -147,7 +148,7 @@ func TestDspStatSv1ProcessEventErrorNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.CGREvent{
+ CGREvent := &engine.CGREvent{
Tenant: "tenant",
}
var reply *[]string
diff --git a/dispatchers/thresholds.go b/dispatchers/thresholds.go
index b89b6d370..016d3c486 100644
--- a/dispatchers/thresholds.go
+++ b/dispatchers/thresholds.go
@@ -26,9 +26,9 @@ import (
"github.com/cgrates/cgrates/utils"
)
-func (dS *DispatcherService) ThresholdSv1Ping(ctx *context.Context, args *utils.CGREvent, reply *string) (err error) {
+func (dS *DispatcherService) ThresholdSv1Ping(ctx *context.Context, args *engine.CGREvent, reply *string) (err error) {
if args == nil {
- args = new(utils.CGREvent)
+ args = new(engine.CGREvent)
}
args.Tenant = utils.FirstNonEmpty(args.Tenant, dS.cfg.GeneralCfg().DefaultTenant)
if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 {
@@ -40,7 +40,7 @@ func (dS *DispatcherService) ThresholdSv1Ping(ctx *context.Context, args *utils.
return dS.Dispatch(args, utils.MetaThresholds, utils.ThresholdSv1Ping, args, reply)
}
-func (dS *DispatcherService) ThresholdSv1GetThresholdsForEvent(ctx *context.Context, args *utils.CGREvent,
+func (dS *DispatcherService) ThresholdSv1GetThresholdsForEvent(ctx *context.Context, args *engine.CGREvent,
t *engine.Thresholds) (err error) {
args.Tenant = utils.FirstNonEmpty(args.Tenant, dS.cfg.GeneralCfg().DefaultTenant)
if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 {
@@ -53,7 +53,7 @@ func (dS *DispatcherService) ThresholdSv1GetThresholdsForEvent(ctx *context.Cont
return dS.Dispatch(args, utils.MetaThresholds, utils.ThresholdSv1GetThresholdsForEvent, args, t)
}
-func (dS *DispatcherService) ThresholdSv1ProcessEvent(ctx *context.Context, args *utils.CGREvent,
+func (dS *DispatcherService) ThresholdSv1ProcessEvent(ctx *context.Context, args *engine.CGREvent,
tIDs *[]string) (err error) {
args.Tenant = utils.FirstNonEmpty(args.Tenant, dS.cfg.GeneralCfg().DefaultTenant)
if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 {
@@ -77,7 +77,7 @@ func (dS *DispatcherService) ThresholdSv1GetThresholdIDs(ctx *context.Context, a
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
APIOpts: args.APIOpts,
}, utils.MetaThresholds, utils.ThresholdSv1GetThresholdIDs, args, tIDs)
@@ -94,7 +94,7 @@ func (dS *DispatcherService) ThresholdSv1GetThreshold(ctx *context.Context, args
return
}
}
- return dS.Dispatch(&utils.CGREvent{
+ return dS.Dispatch(&engine.CGREvent{
Tenant: tnt,
ID: args.ID,
APIOpts: args.APIOpts,
diff --git a/dispatchers/thresholds_it_test.go b/dispatchers/thresholds_it_test.go
index a3da35482..a4b36ba93 100644
--- a/dispatchers/thresholds_it_test.go
+++ b/dispatchers/thresholds_it_test.go
@@ -71,12 +71,12 @@ func TestDspThresholdS(t *testing.T) {
func testDspThPingFailover(t *testing.T) {
var reply string
- if err := allEngine.RPC.Call(context.Background(), utils.ThresholdSv1Ping, new(utils.CGREvent), &reply); err != nil {
+ if err := allEngine.RPC.Call(context.Background(), utils.ThresholdSv1Ping, new(engine.CGREvent), &reply); err != nil {
t.Error(err)
} else if reply != utils.Pong {
t.Errorf("Received: %s", reply)
}
- ev := utils.CGREvent{
+ ev := engine.CGREvent{
Tenant: "cgrates.org",
APIOpts: map[string]any{
@@ -106,7 +106,7 @@ func testDspThProcessEventFailover(t *testing.T) {
var ids []string
eIDs := []string{"THD_ACNT_1001"}
nowTime := time.Now()
- args := &utils.CGREvent{
+ args := &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Time: &nowTime,
@@ -134,12 +134,12 @@ func testDspThProcessEventFailover(t *testing.T) {
func testDspThPing(t *testing.T) {
var reply string
- if err := allEngine.RPC.Call(context.Background(), utils.ThresholdSv1Ping, new(utils.CGREvent), &reply); err != nil {
+ if err := allEngine.RPC.Call(context.Background(), utils.ThresholdSv1Ping, new(engine.CGREvent), &reply); err != nil {
t.Error(err)
} else if reply != utils.Pong {
t.Errorf("Received: %s", reply)
}
- if err := dispEngine.RPC.Call(context.Background(), utils.ThresholdSv1Ping, &utils.CGREvent{
+ if err := dispEngine.RPC.Call(context.Background(), utils.ThresholdSv1Ping, &engine.CGREvent{
Tenant: "cgrates.org",
APIOpts: map[string]any{
@@ -155,7 +155,7 @@ func testDspThPing(t *testing.T) {
func testDspThTestAuthKey(t *testing.T) {
var ids []string
nowTime := time.Now()
- args := &utils.CGREvent{
+ args := &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Time: &nowTime,
@@ -182,7 +182,7 @@ func testDspThTestAuthKey2(t *testing.T) {
var ids []string
eIDs := []string{"THD_ACNT_1002"}
nowTime := time.Now()
- args := &utils.CGREvent{
+ args := &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Time: &nowTime,
diff --git a/dispatchers/thresholds_test.go b/dispatchers/thresholds_test.go
index edfc86bee..b91e5068d 100644
--- a/dispatchers/thresholds_test.go
+++ b/dispatchers/thresholds_test.go
@@ -41,7 +41,7 @@ func TestDspThresholdSv1PingNilEvent(t *testing.T) {
func TestDspThresholdSv1PingNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.CGREvent{
+ CGREvent := &engine.CGREvent{
Tenant: "tenant",
}
var reply *string
@@ -56,7 +56,7 @@ func TestDspThresholdSv1PingErrorNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.CGREvent{}
+ CGREvent := &engine.CGREvent{}
var reply *string
result := dspSrv.ThresholdSv1Ping(context.Background(), CGREvent, reply)
expected := "MANDATORY_IE_MISSING: [ApiKey]"
@@ -68,7 +68,7 @@ func TestDspThresholdSv1PingErrorNil(t *testing.T) {
func TestDspThresholdSv1GetThresholdsForEventNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.CGREvent{
+ CGREvent := &engine.CGREvent{
Tenant: "tenant",
}
var reply *engine.Thresholds
@@ -83,7 +83,7 @@ func TestDspThresholdSv1GetThresholdsEvnil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.CGREvent{
+ CGREvent := &engine.CGREvent{
Tenant: "tenant",
}
var reply *engine.Thresholds
@@ -97,7 +97,7 @@ func TestDspThresholdSv1GetThresholdsEvnil(t *testing.T) {
func TestDspThresholdSv1ProcessEventNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
- CGREvent := &utils.CGREvent{
+ CGREvent := &engine.CGREvent{
Tenant: "tenant",
}
var reply *[]string
@@ -112,7 +112,7 @@ func TestDspThresholdSv1ProcessEventnNil(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
cgrCfg.DispatcherSCfg().AttributeSConns = []string{"test"}
- CGREvent := &utils.CGREvent{
+ CGREvent := &engine.CGREvent{
Tenant: "tenant",
}
var reply *[]string
diff --git a/ees/amqp_it_test.go b/ees/amqp_it_test.go
index 99122d5cb..99c8ae502 100644
--- a/ees/amqp_it_test.go
+++ b/ees/amqp_it_test.go
@@ -107,7 +107,7 @@ func testAMQPRPCConn(t *testing.T) {
func testAMQPExportEvent(t *testing.T) {
ev := &engine.CGREventWithEeIDs{
EeIDs: []string{"AMQPExporter"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "voiceEvent",
Time: utils.TimePointer(time.Now()),
diff --git a/ees/amqpv1_it_test.go b/ees/amqpv1_it_test.go
index 1892bf35a..8c25613f8 100644
--- a/ees/amqpv1_it_test.go
+++ b/ees/amqpv1_it_test.go
@@ -113,7 +113,7 @@ func testAMQPv1RPCConn(t *testing.T) {
func testAMQPv1ExportEvent(t *testing.T) {
ev := &engine.CGREventWithEeIDs{
EeIDs: []string{"amqpv1_test_file"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "dataEvent",
Event: map[string]any{
diff --git a/ees/ee.go b/ees/ee.go
index 520fbe2ce..c0a6563ab 100644
--- a/ees/ee.go
+++ b/ees/ee.go
@@ -35,7 +35,7 @@ type EventExporter interface {
ExportEvent(any, string) error // called on each event to be exported
Close() error // called when the exporter needs to terminate
GetMetrics() *utils.SafeMapStorage // called to get metrics
- PrepareMap(*utils.CGREvent) (any, error)
+ PrepareMap(*engine.CGREvent) (any, error)
PrepareOrderMap(*utils.OrderedNavigableMap) (any, error)
}
@@ -123,7 +123,7 @@ func composeHeaderTrailer(prfx string, fields []*config.FCTemplate, dc utils.Dat
return
}
-func composeExp(fields []*config.FCTemplate, cgrEv *utils.CGREvent, dc utils.DataStorage, cfg *config.CGRConfig, fltS *engine.FilterS) (r *utils.OrderedNavigableMap, err error) {
+func composeExp(fields []*config.FCTemplate, cgrEv *engine.CGREvent, dc utils.DataStorage, cfg *config.CGRConfig, fltS *engine.FilterS) (r *utils.OrderedNavigableMap, err error) {
r = utils.NewOrderedNavigableMap()
err = engine.NewExportRequest(map[string]utils.DataStorage{
utils.MetaReq: utils.MapStorage(cgrEv.Event),
@@ -230,7 +230,7 @@ func updateEEMetrics(dc *utils.SafeMapStorage, cgrID string, ev engine.MapEvent,
type bytePreparing struct{}
-func (bytePreparing) PrepareMap(mp *utils.CGREvent) (any, error) {
+func (bytePreparing) PrepareMap(mp *engine.CGREvent) (any, error) {
return json.Marshal(mp.Event)
}
func (bytePreparing) PrepareOrderMap(mp *utils.OrderedNavigableMap) (any, error) {
@@ -246,7 +246,7 @@ func (bytePreparing) PrepareOrderMap(mp *utils.OrderedNavigableMap) (any, error)
type slicePreparing struct{}
-func (slicePreparing) PrepareMap(mp *utils.CGREvent) (any, error) {
+func (slicePreparing) PrepareMap(mp *engine.CGREvent) (any, error) {
csvRecord := make([]string, 0, len(mp.Event))
for _, val := range mp.Event {
csvRecord = append(csvRecord, utils.IfaceAsString(val))
diff --git a/ees/ees.go b/ees/ees.go
index 3eb163e1f..47766ec40 100644
--- a/ees/ees.go
+++ b/ees/ees.go
@@ -102,7 +102,7 @@ func (eeS *EventExporterS) setupCache(chCfgs map[string]*config.CacheParamCfg) {
eeS.eesMux.Unlock()
}
-func (eeS *EventExporterS) attrSProcessEvent(cgrEv *utils.CGREvent, attrIDs []string, ctx string) (*utils.CGREvent, error) {
+func (eeS *EventExporterS) attrSProcessEvent(cgrEv *engine.CGREvent, attrIDs []string, ctx string) (*engine.CGREvent, error) {
var rplyEv engine.AttrSProcessEventReply
cgrEv.APIOpts[utils.MetaSubsys] = utils.MetaEEs
cgrEv.APIOpts[utils.OptsAttributesProfileIDs] = attrIDs
@@ -253,7 +253,7 @@ func (eeS *EventExporterS) V1ProcessEvent(ctx *context.Context, cgrEv *engine.CG
return
}
-func exportEventWithExporter(exp EventExporter, ev *utils.CGREvent, oneTime bool, cfg *config.CGRConfig, filterS *engine.FilterS) (err error) {
+func exportEventWithExporter(exp EventExporter, ev *engine.CGREvent, oneTime bool, cfg *config.CGRConfig, filterS *engine.FilterS) (err error) {
defer func() {
updateEEMetrics(exp.GetMetrics(), ev.ID, ev.Event, err != nil, utils.FirstNonEmpty(exp.Cfg().Timezone,
cfg.GeneralCfg().DefaultTimezone))
diff --git a/ees/ees_test.go b/ees/ees_test.go
index 4bca0bea9..4cd0c373d 100644
--- a/ees/ees_test.go
+++ b/ees/ees_test.go
@@ -103,14 +103,14 @@ func TestAttrSProcessEvent(t *testing.T) {
utils.AttributeSv1ProcessEvent: func(args, reply any) error {
rplyEv := &engine.AttrSProcessEventReply{
AlteredFields: []string{"testcase"},
- CGREvent: &utils.CGREvent{Event: map[string]any{"testcase": 1}},
+ CGREvent: &engine.CGREvent{Event: map[string]any{"testcase": 1}},
}
*reply.(*engine.AttrSProcessEventReply) = *rplyEv
return nil
},
},
}
- cgrEv := &utils.CGREvent{
+ cgrEv := &engine.CGREvent{
APIOpts: map[string]any{
utils.OptsAttributesProcessRuns: "10",
},
@@ -126,8 +126,8 @@ func TestAttrSProcessEvent(t *testing.T) {
utils.ConcatenatedKey(utils.MetaInternal, utils.MetaAttributes): clientConn,
})
eeS := NewEventExporterS(cfg, filterS, connMgr)
- // cgrEv := &utils.CGREvent{}
- exp := &utils.CGREvent{Event: map[string]any{"testcase": 1}}
+ // cgrEv := &engine.CGREvent{}
+ exp := &engine.CGREvent{Event: map[string]any{"testcase": 1}}
if rplyEv, err := eeS.attrSProcessEvent(cgrEv, []string{}, utils.EmptyString); err != nil {
t.Error(err)
} else if !reflect.DeepEqual(exp, rplyEv) {
@@ -155,7 +155,7 @@ func TestAttrSProcessEvent2(t *testing.T) {
utils.ConcatenatedKey(utils.MetaInternal, utils.MetaAttributes): clientConn,
})
eeS := NewEventExporterS(cfg, filterS, connMgr)
- cgrEv := &utils.CGREvent{
+ cgrEv := &engine.CGREvent{
APIOpts: make(map[string]any),
}
if _, err := eeS.attrSProcessEvent(cgrEv, []string{}, utils.EmptyString); err != nil {
@@ -178,7 +178,7 @@ func TestV1ProcessEvent(t *testing.T) {
eeS := NewEventExporterS(cfg, filterS, nil)
cgrEv := &engine.CGREventWithEeIDs{
EeIDs: []string{"SQLExporterFull"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "voiceEvent",
Time: utils.TimePointer(time.Now()),
@@ -228,7 +228,7 @@ func TestV1ProcessEvent2(t *testing.T) {
eeS := NewEventExporterS(cfg, filterS, nil)
cgrEv := &engine.CGREventWithEeIDs{
EeIDs: []string{"SQLExporterFull"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "voiceEvent",
Time: utils.TimePointer(time.Now()),
@@ -268,7 +268,7 @@ func TestV1ProcessEvent3(t *testing.T) {
eeS := NewEventExporterS(cfg, filterS, nil)
cgrEv := &engine.CGREventWithEeIDs{
EeIDs: []string{"SQLExporterFull"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "voiceEvent",
Time: utils.TimePointer(time.Now()),
@@ -302,7 +302,7 @@ func TestV1ProcessEvent4(t *testing.T) {
eeS.eesChs[utils.MetaHTTPPost].Set("SQLExporterFull", newEeS, []string{"grp1"})
cgrEv := &engine.CGREventWithEeIDs{
EeIDs: []string{"SQLExporterFull"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "voiceEvent",
Time: utils.TimePointer(time.Now()),
@@ -364,7 +364,7 @@ func TestV1ProcessEventMockMetrics(t *testing.T) {
eeS.eesChs[utils.MetaHTTPPost].Set("SQLExporterFull", mEe, []string{"grp1"})
cgrEv := &engine.CGREventWithEeIDs{
EeIDs: []string{"SQLExporterFull"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "voiceEvent",
Time: utils.TimePointer(time.Now()),
@@ -393,7 +393,7 @@ func TestV1ProcessEvent5(t *testing.T) {
}
cgrEv := &engine.CGREventWithEeIDs{
EeIDs: []string{"SQLExporterFull"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "voiceEvent",
Time: utils.TimePointer(time.Now()),
@@ -424,7 +424,7 @@ func TestV1ProcessEvent6(t *testing.T) {
eeS := NewEventExporterS(cfg, filterS, nil)
cgrEv := &engine.CGREventWithEeIDs{
EeIDs: []string{"SQLExporterFull"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "voiceEvent",
Time: utils.TimePointer(time.Now()),
diff --git a/ees/elastic_it_test.go b/ees/elastic_it_test.go
index a21cf55fc..77274451c 100644
--- a/ees/elastic_it_test.go
+++ b/ees/elastic_it_test.go
@@ -122,7 +122,7 @@ func testElasticStartElasticsearch(t *testing.T) {
func testElasticExportEvents(t *testing.T) {
eventVoice := &engine.CGREventWithEeIDs{
EeIDs: []string{"ElasticsearchExporter"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "voiceEvent",
Time: utils.TimePointer(time.Now()),
@@ -150,7 +150,7 @@ func testElasticExportEvents(t *testing.T) {
eventData := &engine.CGREventWithEeIDs{
EeIDs: []string{"ElasticsearchExporter"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "dataEvent",
Time: utils.TimePointer(time.Now()),
@@ -178,7 +178,7 @@ func testElasticExportEvents(t *testing.T) {
eventSMS := &engine.CGREventWithEeIDs{
EeIDs: []string{"ElasticsearchExporter"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "SMSEvent",
Time: utils.TimePointer(time.Now()),
@@ -206,7 +206,7 @@ func testElasticExportEvents(t *testing.T) {
eventSMSNoFields := &engine.CGREventWithEeIDs{
EeIDs: []string{"ElasticExporterWithNoFields"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "SMSEvent",
Time: utils.TimePointer(time.Now()),
diff --git a/ees/filecsv_it_test.go b/ees/filecsv_it_test.go
index 218e6dd91..b21e865ed 100644
--- a/ees/filecsv_it_test.go
+++ b/ees/filecsv_it_test.go
@@ -110,7 +110,7 @@ func testCsvRPCConn(t *testing.T) {
func testCsvExportEvent(t *testing.T) {
eventVoice := &engine.CGREventWithEeIDs{
EeIDs: []string{"CSVExporter"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "voiceEvent",
Time: utils.TimePointer(time.Now()),
@@ -136,7 +136,7 @@ func testCsvExportEvent(t *testing.T) {
eventData := &engine.CGREventWithEeIDs{
EeIDs: []string{"CSVExporter"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "dataEvent",
Time: utils.TimePointer(time.Now()),
@@ -162,7 +162,7 @@ func testCsvExportEvent(t *testing.T) {
eventSMS := &engine.CGREventWithEeIDs{
EeIDs: []string{"CSVExporter"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "SMSEvent",
Time: utils.TimePointer(time.Now()),
@@ -355,7 +355,7 @@ func testCsvExportComposedEvent(t *testing.T) {
}
eventVoice := &engine.CGREventWithEeIDs{
EeIDs: []string{"CSVExporterComposed"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "voiceEvent",
Time: utils.TimePointer(time.Now()),
@@ -384,7 +384,7 @@ func testCsvExportComposedEvent(t *testing.T) {
}
eventSMS := &engine.CGREventWithEeIDs{
EeIDs: []string{"CSVExporterComposed"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "SMSEvent",
Time: utils.TimePointer(time.Now()),
@@ -458,7 +458,7 @@ func testCsvExportMaskedDestination(t *testing.T) {
eventVoice := &engine.CGREventWithEeIDs{
EeIDs: []string{"CSVMaskedDestination"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "voiceEvent",
Time: utils.TimePointer(time.Now()),
@@ -513,7 +513,7 @@ func testCsvVerifyMaskedDestination(t *testing.T) {
func testCsvExportEventWithInflateTemplate(t *testing.T) {
eventVoice := &engine.CGREventWithEeIDs{
EeIDs: []string{"CSVExporterWIthTemplate"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "voiceEvent",
Time: utils.TimePointer(time.Now()),
@@ -541,7 +541,7 @@ func testCsvExportEventWithInflateTemplate(t *testing.T) {
eventData := &engine.CGREventWithEeIDs{
EeIDs: []string{"CSVExporterWIthTemplate"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "dataEvent",
Time: utils.TimePointer(time.Now()),
@@ -569,7 +569,7 @@ func testCsvExportEventWithInflateTemplate(t *testing.T) {
eventSMS := &engine.CGREventWithEeIDs{
EeIDs: []string{"CSVExporterWIthTemplate"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "SMSEvent",
Time: utils.TimePointer(time.Now()),
@@ -637,7 +637,7 @@ func testCsvVerifyExportsWithInflateTemplate(t *testing.T) {
func testCsvExportNotFoundExporter(t *testing.T) {
eventVoice := &engine.CGREventWithEeIDs{
EeIDs: []string{"ExporterNotFound"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "voiceEvent",
Time: utils.TimePointer(time.Now()),
diff --git a/ees/filefwv_it_test.go b/ees/filefwv_it_test.go
index 858aadcc4..17b379b56 100644
--- a/ees/filefwv_it_test.go
+++ b/ees/filefwv_it_test.go
@@ -101,7 +101,7 @@ func testFwvRPCConn(t *testing.T) {
func testFwvExportEvent(t *testing.T) {
event := &engine.CGREventWithEeIDs{
EeIDs: []string{"FwvExporter"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "Event",
Time: utils.TimePointer(time.Now()),
diff --git a/ees/httpjsonmap.go b/ees/httpjsonmap.go
index ff4f9b44b..e1880f00b 100644
--- a/ees/httpjsonmap.go
+++ b/ees/httpjsonmap.go
@@ -93,7 +93,7 @@ func (httpEE *HTTPjsonMapEE) Close() (_ error) { return }
func (httpEE *HTTPjsonMapEE) GetMetrics() *utils.SafeMapStorage { return httpEE.dc }
-func (httpEE *HTTPjsonMapEE) PrepareMap(mp *utils.CGREvent) (any, error) {
+func (httpEE *HTTPjsonMapEE) PrepareMap(mp *engine.CGREvent) (any, error) {
body, err := json.Marshal(mp.Event)
return &HTTPPosterRequest{
Header: httpEE.hdr.Clone(),
diff --git a/ees/httpjsonmap_test.go b/ees/httpjsonmap_test.go
index 10f5864e9..d2aba01a4 100644
--- a/ees/httpjsonmap_test.go
+++ b/ees/httpjsonmap_test.go
@@ -28,6 +28,7 @@ import (
"time"
"github.com/cgrates/cgrates/config"
+ "github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
@@ -204,7 +205,7 @@ func TestHTTPJsonMapPrepareMap(t *testing.T) {
valMp := map[string]any{
"*req.*tenant": "value1",
}
- rcv, err := httpEE.PrepareMap(&utils.CGREvent{
+ rcv, err := httpEE.PrepareMap(&engine.CGREvent{
Event: valMp,
})
if err != nil {
diff --git a/ees/httppost.go b/ees/httppost.go
index ec4b101a9..2d159e00c 100644
--- a/ees/httppost.go
+++ b/ees/httppost.go
@@ -94,7 +94,7 @@ func (httpPost *HTTPPostEE) Close() (_ error) { return }
func (httpPost *HTTPPostEE) GetMetrics() *utils.SafeMapStorage { return httpPost.dc }
-func (httpPost *HTTPPostEE) PrepareMap(mp *utils.CGREvent) (any, error) {
+func (httpPost *HTTPPostEE) PrepareMap(mp *engine.CGREvent) (any, error) {
urlVals := url.Values{}
for k, v := range mp.Event {
urlVals.Set(k, utils.IfaceAsString(v))
diff --git a/ees/httppost_it_test.go b/ees/httppost_it_test.go
index af454ba1c..48a2b765a 100644
--- a/ees/httppost_it_test.go
+++ b/ees/httppost_it_test.go
@@ -119,7 +119,7 @@ func testHTTPStartHTTPServer(t *testing.T) {
func testHTTPExportEvent(t *testing.T) {
eventVoice := &engine.CGREventWithEeIDs{
EeIDs: []string{"HTTPPostExporter"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "voiceEvent",
Time: utils.TimePointer(time.Now()),
@@ -147,7 +147,7 @@ func testHTTPExportEvent(t *testing.T) {
eventData := &engine.CGREventWithEeIDs{
EeIDs: []string{"HTTPPostExporter"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "dataEvent",
Time: utils.TimePointer(time.Now()),
@@ -175,7 +175,7 @@ func testHTTPExportEvent(t *testing.T) {
eventSMS := &engine.CGREventWithEeIDs{
EeIDs: []string{"HTTPPostExporter"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "SMSEvent",
Time: utils.TimePointer(time.Now()),
@@ -203,7 +203,7 @@ func testHTTPExportEvent(t *testing.T) {
eventSMSNoFields := &engine.CGREventWithEeIDs{
EeIDs: []string{"HTTPPostExporterWithNoFields"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "SMSEvent",
Time: utils.TimePointer(time.Now()),
diff --git a/ees/httppost_test.go b/ees/httppost_test.go
index c4b69cb2c..7f639a3fb 100644
--- a/ees/httppost_test.go
+++ b/ees/httppost_test.go
@@ -29,6 +29,7 @@ import (
"time"
"github.com/cgrates/cgrates/config"
+ "github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
@@ -52,7 +53,7 @@ func TestHttpPostGetMetrics(t *testing.T) {
func TestHttpPostExportEvent(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
cgrCfg.EEsCfg().Exporters[0].Type = utils.MetaHTTPPost
- cgrEv := new(utils.CGREvent)
+ cgrEv := new(engine.CGREvent)
httpPost, err := NewHTTPPostEE(cgrCfg.EEsCfg().Exporters[0], cgrCfg, nil, nil)
if err != nil {
t.Error(err)
@@ -87,7 +88,7 @@ func TestHttpPostExportEvent2(t *testing.T) {
if err != nil {
t.Error(err)
}
- vals, err := httpPost.PrepareMap(&utils.CGREvent{
+ vals, err := httpPost.PrepareMap(&engine.CGREvent{
Event: map[string]any{
"2": "*req.field2",
},
@@ -130,7 +131,7 @@ func TestHttpPostSync(t *testing.T) {
t.Error(err)
}
- req1, err := exp.PrepareMap(&utils.CGREvent{
+ req1, err := exp.PrepareMap(&engine.CGREvent{
Event: map[string]any{
"Account": "1001",
"Destination": "1002",
@@ -139,7 +140,7 @@ func TestHttpPostSync(t *testing.T) {
if err != nil {
t.Fatal(err)
}
- req2, err := exp.PrepareMap(&utils.CGREvent{
+ req2, err := exp.PrepareMap(&engine.CGREvent{
Event: map[string]any{
"Account": "1001",
"Destination": "1003",
@@ -148,7 +149,7 @@ func TestHttpPostSync(t *testing.T) {
if err != nil {
t.Fatal(err)
}
- req3, err := exp.PrepareMap(&utils.CGREvent{
+ req3, err := exp.PrepareMap(&engine.CGREvent{
Event: map[string]any{
"Account": "1003",
"Destination": "1001",
@@ -205,7 +206,7 @@ func TestHttpPostSyncLimit(t *testing.T) {
t.Error(err)
}
- vals, err := exp.PrepareMap(&utils.CGREvent{
+ vals, err := exp.PrepareMap(&engine.CGREvent{
Event: map[string]any{
"Account": "1001",
"Destination": "1002",
diff --git a/ees/kafka_it_test.go b/ees/kafka_it_test.go
index c8129902b..7196a98db 100644
--- a/ees/kafka_it_test.go
+++ b/ees/kafka_it_test.go
@@ -137,7 +137,7 @@ func testKafkaCreateTopic(t *testing.T) {
func testKafkaExportEvent(t *testing.T) {
event := &engine.CGREventWithEeIDs{
EeIDs: []string{"KafkaExporter"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "KafkaEvent",
Event: map[string]any{
diff --git a/ees/log.go b/ees/log.go
index bfb08b400..2aad00583 100644
--- a/ees/log.go
+++ b/ees/log.go
@@ -23,6 +23,7 @@ import (
"strings"
"github.com/cgrates/cgrates/config"
+ "github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
@@ -49,7 +50,7 @@ func (vEe *LogEE) ExportEvent(mp any, _ string) error {
}
func (vEe *LogEE) Close() error { return nil }
func (vEe *LogEE) GetMetrics() *utils.SafeMapStorage { return vEe.dc }
-func (vEe *LogEE) PrepareMap(mp *utils.CGREvent) (any, error) {
+func (vEe *LogEE) PrepareMap(mp *engine.CGREvent) (any, error) {
return mp.Event, nil
}
func (vEe *LogEE) PrepareOrderMap(mp *utils.OrderedNavigableMap) (any, error) {
diff --git a/ees/nats_it_test.go b/ees/nats_it_test.go
index 092beb11b..2509c4908 100644
--- a/ees/nats_it_test.go
+++ b/ees/nats_it_test.go
@@ -108,7 +108,7 @@ func TestNatsEEJetStream(t *testing.T) {
t.Fatal(err)
}
- cgrEv := &utils.CGREvent{
+ cgrEv := &engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
"Account": "1001",
@@ -176,7 +176,7 @@ func TestNatsEE(t *testing.T) {
defer nc.Drain()
- cgrEv := &utils.CGREvent{
+ cgrEv := &engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
"Account": "1001",
diff --git a/ees/posterjsonmap_it_test.go b/ees/posterjsonmap_it_test.go
index 7806ca176..24ed89a3b 100644
--- a/ees/posterjsonmap_it_test.go
+++ b/ees/posterjsonmap_it_test.go
@@ -116,7 +116,7 @@ func testHTTPJsonMapStartHTTPServer(t *testing.T) {
func testHTTPJsonMapExportEvent(t *testing.T) {
eventVoice := &engine.CGREventWithEeIDs{
EeIDs: []string{"HTTPJsonMapExporter"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "voiceEvent",
Time: utils.TimePointer(time.Now()),
@@ -147,7 +147,7 @@ func testHTTPJsonMapExportEvent(t *testing.T) {
eventData := &engine.CGREventWithEeIDs{
EeIDs: []string{"HTTPJsonMapExporter"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "dataEvent",
Time: utils.TimePointer(time.Now()),
@@ -178,7 +178,7 @@ func testHTTPJsonMapExportEvent(t *testing.T) {
eventSMS := &engine.CGREventWithEeIDs{
EeIDs: []string{"HTTPJsonMapExporter"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "SMSEvent",
Time: utils.TimePointer(time.Now()),
@@ -210,7 +210,7 @@ func testHTTPJsonMapExportEvent(t *testing.T) {
eventSMSNoFields := &engine.CGREventWithEeIDs{
EeIDs: []string{"HTTPJsonMapExporterWithNoFields"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "SMSEvent",
Time: utils.TimePointer(time.Now()),
diff --git a/ees/rpc.go b/ees/rpc.go
index 6aace36a3..81d1ce08d 100644
--- a/ees/rpc.go
+++ b/ees/rpc.go
@@ -85,7 +85,7 @@ func (e *RPCee) GetMetrics() (mp *utils.SafeMapStorage) {
return e.dc
}
-func (e *RPCee) PrepareMap(mp *utils.CGREvent) (any, error) {
+func (e *RPCee) PrepareMap(mp *engine.CGREvent) (any, error) {
if mp == nil {
return nil, nil
}
diff --git a/ees/rpc_test.go b/ees/rpc_test.go
index a74a000e5..b6c922126 100644
--- a/ees/rpc_test.go
+++ b/ees/rpc_test.go
@@ -168,7 +168,7 @@ func TestRPCPrepareMap(t *testing.T) {
t.Error(err)
}
- cgrEv := &utils.CGREvent{
+ cgrEv := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "CGRID1",
Event: map[string]any{
diff --git a/ees/s3_it_test.go b/ees/s3_it_test.go
index 45edb89d3..fc87ec4bc 100644
--- a/ees/s3_it_test.go
+++ b/ees/s3_it_test.go
@@ -115,7 +115,7 @@ func testS3ExportEvent(t *testing.T) {
cgrID = utils.Sha1("abcdef", time.Unix(1383813745, 0).UTC().String())
ev := &engine.CGREventWithEeIDs{
EeIDs: []string{"s3_test_file"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "dataEvent",
Time: utils.TimePointer(time.Now()),
diff --git a/ees/sql.go b/ees/sql.go
index 8514e78f8..0e43c8cff 100644
--- a/ees/sql.go
+++ b/ees/sql.go
@@ -158,7 +158,7 @@ func (sqlEe *SQLEe) Close() (err error) {
func (sqlEe *SQLEe) GetMetrics() *utils.SafeMapStorage { return sqlEe.dc }
-func (sqlEe *SQLEe) PrepareMap(*utils.CGREvent) (any, error) { return nil, nil }
+func (sqlEe *SQLEe) PrepareMap(*engine.CGREvent) (any, error) { return nil, nil }
func (sqlEe *SQLEe) PrepareOrderMap(mp *utils.OrderedNavigableMap) (any, error) {
var vals []any
diff --git a/ees/sql_it_test.go b/ees/sql_it_test.go
index 978fa528c..9c811a190 100644
--- a/ees/sql_it_test.go
+++ b/ees/sql_it_test.go
@@ -274,7 +274,7 @@ func testSqlEeExportEventFull(t *testing.T) {
}
eventVoice := &engine.CGREventWithEeIDs{
EeIDs: []string{"SQLExporterFull"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "voiceEvent",
Time: utils.TimePointer(time.Now()),
@@ -311,7 +311,7 @@ func testSqlEeExportEventFull(t *testing.T) {
func testSqlEeExportEventPartial(t *testing.T) {
eventVoice := &engine.CGREventWithEeIDs{
EeIDs: []string{"SQLExporterPartial"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "voiceEvent",
Time: utils.TimePointer(time.Now()),
diff --git a/ees/sqs_it_test.go b/ees/sqs_it_test.go
index 9382c9170..4dde156f1 100644
--- a/ees/sqs_it_test.go
+++ b/ees/sqs_it_test.go
@@ -114,7 +114,7 @@ func testSQSRPCConn(t *testing.T) {
func testSQSExportEvent(t *testing.T) {
ev := &engine.CGREventWithEeIDs{
EeIDs: []string{"sqs_test_file"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "voiceEvent",
Time: utils.TimePointer(time.Now()),
diff --git a/ees/virtual_ee_it_test.go b/ees/virtual_ee_it_test.go
index eca784b5e..fac4c0d40 100644
--- a/ees/virtual_ee_it_test.go
+++ b/ees/virtual_ee_it_test.go
@@ -103,7 +103,7 @@ func testVirtRPCConn(t *testing.T) {
func testVirtExportSupplierEvent(t *testing.T) {
supplierEvent := &engine.CGREventWithEeIDs{
EeIDs: []string{"RouteExporter"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "supplierEvent",
Time: utils.TimePointer(time.Now()),
@@ -137,7 +137,7 @@ func testVirtExportSupplierEvent(t *testing.T) {
func testVirtExportEvents(t *testing.T) {
eventVoice := &engine.CGREventWithEeIDs{
EeIDs: []string{"CSVExporterFromVirt"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "voiceEvent",
Time: utils.TimePointer(time.Now()),
diff --git a/ees/virtualee.go b/ees/virtualee.go
index 36424c354..48a8c5043 100644
--- a/ees/virtualee.go
+++ b/ees/virtualee.go
@@ -23,6 +23,7 @@ import (
"strings"
"github.com/cgrates/cgrates/config"
+ "github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
@@ -52,7 +53,7 @@ func (vEe *VirtualEE) ExportEvent(payload any, _ string) error {
func (vEe *VirtualEE) Close() error { return nil }
func (vEe *VirtualEE) GetMetrics() *utils.SafeMapStorage { return vEe.dc }
-func (vEe *VirtualEE) PrepareMap(cgrEv *utils.CGREvent) (any, error) {
+func (vEe *VirtualEE) PrepareMap(cgrEv *engine.CGREvent) (any, error) {
return cgrEv.Event, nil
}
diff --git a/engine/account.go b/engine/account.go
index 3e8144eb9..a81184dc9 100644
--- a/engine/account.go
+++ b/engine/account.go
@@ -559,7 +559,7 @@ func (acc *Account) debitCreditBalance(cd *CallDescriptor, count bool, dryRun bo
if len(config.CgrConfig().RalsCfg().ThresholdSConns) != 0 {
defaultBalance := acc.GetDefaultMoneyBalance()
acntTnt := utils.NewTenantID(acc.ID)
- thEv := &utils.CGREvent{
+ thEv := &CGREvent{
Tenant: acntTnt.Tenant,
ID: utils.GenUUID(),
Event: map[string]any{
@@ -1080,7 +1080,7 @@ func (acc *Account) Publish(initBal map[string]float64) {
for _, currentBal := range acntSummary.BalanceSummaries {
currentBal.Initial = initBal[currentBal.UUID]
}
- cgrEv := &utils.CGREvent{
+ cgrEv := &CGREvent{
Tenant: acntSummary.Tenant,
ID: utils.GenUUID(),
Time: utils.TimePointer(time.Now()),
diff --git a/engine/action.go b/engine/action.go
index 82b412bf6..700ab626f 100644
--- a/engine/action.go
+++ b/engine/action.go
@@ -380,7 +380,7 @@ func cdrLogAction(acc *Account, a *Action, acs Actions, _ *FilterS, extraData an
cdrs = append(cdrs, cdr)
}
- events := make([]*utils.CGREvent, 0, len(cdrs))
+ events := make([]*CGREvent, 0, len(cdrs))
for _, cdr := range cdrs {
events = append(events, cdr.AsCGREvent())
}
@@ -1186,10 +1186,10 @@ func resetAccountCDR(ub *Account, action *Action, acts Actions, fltrS *FilterS,
}
func export(ub *Account, a *Action, acs Actions, _ *FilterS, extraData any, _ ActionConnCfg) (err error) {
- var cgrEv *utils.CGREvent
+ var cgrEv *CGREvent
switch {
case ub != nil:
- cgrEv = &utils.CGREvent{
+ cgrEv = &CGREvent{
Tenant: utils.NewTenantID(ub.ID).Tenant,
ID: utils.GenUUID(),
Event: map[string]any{
@@ -1209,7 +1209,7 @@ func export(ub *Account, a *Action, acs Actions, _ *FilterS, extraData any, _ Ac
},
}
case extraData != nil:
- ev, canCast := extraData.(*utils.CGREvent)
+ ev, canCast := extraData.(*CGREvent)
if !canCast {
return
}
diff --git a/engine/actions_test.go b/engine/actions_test.go
index 92acdfe3f..9eef497ae 100644
--- a/engine/actions_test.go
+++ b/engine/actions_test.go
@@ -2695,7 +2695,7 @@ func TestCdrLogAction(t *testing.T) {
if mock.args == nil {
t.Fatalf("Expected a call to %s", utils.CDRsV1ProcessEvent)
}
- expCgrEv := &utils.CGREvent{
+ expCgrEv := &CGREvent{
Tenant: "cgrates.org",
ID: mock.args.CGREvents[0].ID,
Event: map[string]any{
@@ -3216,7 +3216,7 @@ func TestExportAction(t *testing.T) {
balanceValue: 10,
},
}
- extraData := &utils.CGREvent{
+ extraData := &CGREvent{
Tenant: "tenant",
ID: "id1",
Time: utils.TimePointer(time.Date(2022, 12, 1, 1, 0, 0, 0, time.UTC)),
@@ -3676,7 +3676,7 @@ func TestRemoveAccountAcc(t *testing.T) {
balanceValue: 10,
},
}
- extraData := &utils.CGREvent{
+ extraData := &CGREvent{
Tenant: "tenant",
ID: "id1",
Time: utils.TimePointer(time.Date(2022, 12, 1, 1, 0, 0, 0, time.UTC)),
@@ -3765,7 +3765,7 @@ func TestRemoveAccountActionErr(t *testing.T) {
balanceValue: 10,
},
}
- extraData := &utils.CGREvent{
+ extraData := &CGREvent{
Tenant: "tenant",
ID: "id1",
Time: utils.TimePointer(time.Date(2022, 12, 1, 1, 0, 0, 0, time.UTC)),
diff --git a/engine/argees.go b/engine/argees.go
index 444b8c70e..e1f943dd7 100644
--- a/engine/argees.go
+++ b/engine/argees.go
@@ -30,7 +30,7 @@ import (
// CGREventWithEeIDs is CGREvent with EventExporterIDs
type CGREventWithEeIDs struct {
EeIDs []string
- *utils.CGREvent
+ *CGREvent
clnb bool
}
@@ -67,7 +67,7 @@ func (cgr *CGREventWithEeIDs) UnmarshalJSON(data []byte) (err error) {
}
cgr.EeIDs = eeIDs
// populate the entire CGRevent struct in case of it's existance
- var cgrEv *utils.CGREvent
+ var cgrEv *CGREvent
if err = json.Unmarshal(data, &cgrEv); err != nil {
return
}
diff --git a/engine/attributes.go b/engine/attributes.go
index 35b718a2c..ddbeda9f6 100644
--- a/engine/attributes.go
+++ b/engine/attributes.go
@@ -145,7 +145,7 @@ func (alS *AttributeService) attributeProfileForEvent(tnt string, ctx *string, a
type AttrSProcessEventReply struct {
MatchedProfiles []string
AlteredFields []string
- *utils.CGREvent
+ *CGREvent
blocker bool // internally used to stop further processRuns
}
@@ -167,7 +167,7 @@ func (attrReply *AttrSProcessEventReply) Digest() (rplyDigest string) {
}
// processEvent will match event with attribute profile and do the necessary replacements
-func (alS *AttributeService) processEvent(tnt string, args *utils.CGREvent, evNm utils.MapStorage, dynDP utils.DataProvider,
+func (alS *AttributeService) processEvent(tnt string, args *CGREvent, evNm utils.MapStorage, dynDP utils.DataProvider,
lastID string, processedPrfNo map[string]int, profileRuns int) (
rply *AttrSProcessEventReply, err error) {
context := alS.cgrcfg.AttributeSCfg().Opts.Context
@@ -175,11 +175,11 @@ func (alS *AttributeService) processEvent(tnt string, args *utils.CGREvent, evNm
context = utils.StringPointer(utils.IfaceAsString(opt))
}
var attrIDs []string
- if attrIDs, err = utils.GetStringSliceOpts(args, alS.cgrcfg.AttributeSCfg().Opts.ProfileIDs, utils.OptsAttributesProfileIDs); err != nil {
+ if attrIDs, err = GetStringSliceOpts(args, alS.cgrcfg.AttributeSCfg().Opts.ProfileIDs, utils.OptsAttributesProfileIDs); err != nil {
return
}
var ignFilters bool
- if ignFilters, err = utils.GetBoolOpts(args, alS.cgrcfg.AttributeSCfg().Opts.ProfileIgnoreFilters,
+ if ignFilters, err = GetBoolOpts(args, alS.cgrcfg.AttributeSCfg().Opts.ProfileIgnoreFilters,
utils.OptsAttributesProfileIgnoreFilters); err != nil {
return
}
@@ -244,7 +244,7 @@ func (alS *AttributeService) processEvent(tnt string, args *utils.CGREvent, evNm
}
// V1GetAttributeForEvent returns the AttributeProfile that matches the event
-func (alS *AttributeService) V1GetAttributeForEvent(ctx *context.Context, args *utils.CGREvent,
+func (alS *AttributeService) V1GetAttributeForEvent(ctx *context.Context, args *CGREvent,
attrPrfl *AttributeProfile) (err error) {
if args == nil {
return utils.NewErrMandatoryIeMissing(utils.CGREventString)
@@ -258,11 +258,11 @@ func (alS *AttributeService) V1GetAttributeForEvent(ctx *context.Context, args *
context = utils.StringPointer(utils.IfaceAsString(opt))
}
var attrIDs []string
- if attrIDs, err = utils.GetStringSliceOpts(args, alS.cgrcfg.AttributeSCfg().Opts.ProfileIDs, utils.OptsAttributesProfileIDs); err != nil {
+ if attrIDs, err = GetStringSliceOpts(args, alS.cgrcfg.AttributeSCfg().Opts.ProfileIDs, utils.OptsAttributesProfileIDs); err != nil {
return
}
var ignFilters bool
- if ignFilters, err = utils.GetBoolOpts(args, alS.cgrcfg.AttributeSCfg().Opts.ProfileIgnoreFilters,
+ if ignFilters, err = GetBoolOpts(args, alS.cgrcfg.AttributeSCfg().Opts.ProfileIgnoreFilters,
utils.OptsAttributesProfileIgnoreFilters); err != nil {
return
}
@@ -284,7 +284,7 @@ func (alS *AttributeService) V1GetAttributeForEvent(ctx *context.Context, args *
}
// V1ProcessEvent proccess the event and returns the result
-func (alS *AttributeService) V1ProcessEvent(ctx *context.Context, args *utils.CGREvent,
+func (alS *AttributeService) V1ProcessEvent(ctx *context.Context, args *CGREvent,
reply *AttrSProcessEventReply) (err error) {
if args == nil {
return utils.NewErrMandatoryIeMissing(utils.CGREventString)
@@ -297,12 +297,12 @@ func (alS *AttributeService) V1ProcessEvent(ctx *context.Context, args *utils.CG
tnt = alS.cgrcfg.GeneralCfg().DefaultTenant
}
var processRuns int
- if processRuns, err = utils.GetIntOpts(args, alS.cgrcfg.AttributeSCfg().Opts.ProcessRuns,
+ if processRuns, err = GetIntOpts(args, alS.cgrcfg.AttributeSCfg().Opts.ProcessRuns,
utils.OptsAttributesProcessRuns); err != nil {
return
}
var profileRuns int
- if profileRuns, err = utils.GetIntOpts(args, alS.cgrcfg.AttributeSCfg().Opts.ProfileRuns,
+ if profileRuns, err = GetIntOpts(args, alS.cgrcfg.AttributeSCfg().Opts.ProfileRuns,
utils.OptsAttributesProfileRuns); err != nil {
return
}
diff --git a/engine/attributes_test.go b/engine/attributes_test.go
index b70f11758..f10428047 100644
--- a/engine/attributes_test.go
+++ b/engine/attributes_test.go
@@ -88,7 +88,7 @@ func TestAttributesV1GetAttributeForEventProfileNotFound(t *testing.T) {
filterS: &FilterS{},
cgrcfg: cfg,
}
- args := &utils.CGREvent{}
+ args := &CGREvent{}
reply := &AttributeProfile{}
experr := utils.ErrNotFound
@@ -108,7 +108,7 @@ func TestAttributesV1GetAttributeForEvent2(t *testing.T) {
filterS: &FilterS{},
cgrcfg: cfg,
}
- args := &utils.CGREvent{}
+ args := &CGREvent{}
reply := &AttributeProfile{}
experr := utils.ErrNotFound
@@ -175,7 +175,7 @@ func TestAttributesV1ProcessEvent(t *testing.T) {
expected := AttrSProcessEventReply{
MatchedProfiles: []string{"cgrates.org:ATTR_CHANGE_TENANT_FROM_USER", "adrian.itsyscom.com.co.uk:ATTR_MATCH_TENANT"},
AlteredFields: []string{"*req.Account", "*req.Password", "*tenant"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &CGREvent{
Tenant: "adrian.itsyscom.com.co.uk",
Time: nil,
Event: map[string]any{
@@ -189,7 +189,7 @@ func TestAttributesV1ProcessEvent(t *testing.T) {
blocker: false,
}
if err = alS.V1ProcessEvent(context.Background(),
- &utils.CGREvent{
+ &CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.AccountField: "adrian@itsyscom.com",
@@ -233,7 +233,7 @@ func TestAttributesV1ProcessEventErrorMetaSum(t *testing.T) {
var rply AttrSProcessEventReply
expErr := "SERVER_ERROR: NotEnoughParameters"
if err = alS.V1ProcessEvent(context.Background(),
- &utils.CGREvent{
+ &CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.AccountField: "adrian@itsyscom.com",
@@ -277,7 +277,7 @@ func TestAttributesV1ProcessEventErrorMetaDifference(t *testing.T) {
var rply AttrSProcessEventReply
expErr := "SERVER_ERROR: NotEnoughParameters"
if err := alS.V1ProcessEvent(context.Background(),
- &utils.CGREvent{
+ &CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.AccountField: "adrian@itsyscom.com",
@@ -320,7 +320,7 @@ func TestAttributesV1ProcessEventErrorMetaValueExponent(t *testing.T) {
var rply AttrSProcessEventReply
expErr := "SERVER_ERROR: invalid arguments <[{\"Rules\":\"CGRATES.ORG\"}]> to *value_exponent"
if err := alS.V1ProcessEvent(context.Background(),
- &utils.CGREvent{
+ &CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.AccountField: "adrian@itsyscom.com",
@@ -1196,7 +1196,7 @@ func TestAttributesV1ProcessEventMultipleRuns1(t *testing.T) {
t.Error(err)
}
- args := &utils.CGREvent{
+ args := &CGREvent{
Tenant: "cgrates.org",
ID: "AttrProcessEventMultipleRuns",
Event: map[string]any{
@@ -1212,7 +1212,7 @@ func TestAttributesV1ProcessEventMultipleRuns1(t *testing.T) {
exp := &AttrSProcessEventReply{
MatchedProfiles: []string{"cgrates.org:ATTR2", "cgrates.org:ATTR1", "cgrates.org:ATTR2"},
AlteredFields: []string{"*req.Password", "*req.RequestType"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &CGREvent{
Tenant: "cgrates.org",
ID: "AttrProcessEventMultipleRuns",
Event: map[string]any{
@@ -1310,7 +1310,7 @@ func TestAttributesV1ProcessEventMultipleRuns2(t *testing.T) {
t.Error(err)
}
- args := &utils.CGREvent{
+ args := &CGREvent{
Tenant: "cgrates.org",
ID: "AttrProcessEventMultipleRuns",
Event: map[string]any{},
@@ -1324,7 +1324,7 @@ func TestAttributesV1ProcessEventMultipleRuns2(t *testing.T) {
exp := &AttrSProcessEventReply{
MatchedProfiles: []string{"cgrates.org:ATTR1", "cgrates.org:ATTR2", "cgrates.org:ATTR3"},
AlteredFields: []string{"*req.Password", "*req.PaypalAccount", "*req.RequestType"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &CGREvent{
Tenant: "cgrates.org",
ID: "AttrProcessEventMultipleRuns",
Event: map[string]any{
@@ -1353,7 +1353,7 @@ func TestArgeesUnmarshalJSON(t *testing.T) {
cgr := &CGREventWithEeIDs{
EeIDs: []string{"eeID1", "eeID2", "eeID3", "eeID$"},
clnb: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &CGREvent{
Event: map[string]any{
utils.CostDetails: "22",
},
@@ -1375,7 +1375,7 @@ func TestArgeesRPCClone(t *testing.T) {
attr := &CGREventWithEeIDs{
EeIDs: []string{"eeid1", "eeid2"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &CGREvent{
Tenant: "cgrates.org",
ID: "id",
Time: &time.Time{},
@@ -1392,7 +1392,7 @@ func TestArgeesRPCClone(t *testing.T) {
attr.clnb = true
exp := &CGREventWithEeIDs{
EeIDs: []string{"eeid1", "eeid2"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &CGREvent{
Tenant: "cgrates.org",
ID: "id",
Time: &time.Time{},
@@ -1415,7 +1415,7 @@ func TestAttrSV1GetAttributeForEvent(t *testing.T) {
filterS := NewFilterS(cfg, nil, dm)
Cache.Clear(nil)
attS := NewAttributeService(dm, filterS, cfg)
- args := &utils.CGREvent{
+ args := &CGREvent{
Tenant: "cgrates.org",
ID: "AttrEvent",
Event: map[string]any{
@@ -1535,7 +1535,7 @@ func TestAttributesV1ProcessEventSentryPeer(t *testing.T) {
expected := AttrSProcessEventReply{
MatchedProfiles: []string{"cgrates.org:ATTR_CHECK_DESTINATION"},
AlteredFields: []string{"*req.Destination"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &CGREvent{
Tenant: "cgrates.org",
Time: nil,
Event: map[string]any{
@@ -1550,7 +1550,7 @@ func TestAttributesV1ProcessEventSentryPeer(t *testing.T) {
}
config.SetCgrConfig(cfg)
if err = alS.V1ProcessEvent(context.Background(),
- &utils.CGREvent{
+ &CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.AccountField: "account_1001",
@@ -1566,7 +1566,7 @@ func TestAttributesV1ProcessEventSentryPeer(t *testing.T) {
}
if err = alS.V1ProcessEvent(context.Background(),
- &utils.CGREvent{
+ &CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.AccountField: "account_1001",
diff --git a/engine/calldesc.go b/engine/calldesc.go
index 442ab75a5..b63922014 100644
--- a/engine/calldesc.go
+++ b/engine/calldesc.go
@@ -62,7 +62,7 @@ func getRpSubjectPrefixMatching() (flag bool) {
}
// NewCallDescriptorFromCGREvent converts a CGREvent into CallDescriptor
-func NewCallDescriptorFromCGREvent(cgrEv *utils.CGREvent,
+func NewCallDescriptorFromCGREvent(cgrEv *CGREvent,
timezone string) (cd *CallDescriptor, err error) {
cd = &CallDescriptor{Tenant: cgrEv.Tenant}
if _, has := cgrEv.Event[utils.Category]; has {
@@ -140,8 +140,8 @@ type CallDescriptor struct {
}
// AsCGREvent converts the CallDescriptor into CGREvent
-func (cd *CallDescriptor) AsCGREvent(opts map[string]any) *utils.CGREvent {
- cgrEv := &utils.CGREvent{
+func (cd *CallDescriptor) AsCGREvent(opts map[string]any) *CGREvent {
+ cgrEv := &CGREvent{
Tenant: cd.Tenant,
ID: utils.UUIDSha1Prefix(), // make it unique
Event: make(map[string]any),
@@ -164,7 +164,7 @@ func (cd *CallDescriptor) AsCGREvent(opts map[string]any) *utils.CGREvent {
// UpdateFromCGREvent will update CallDescriptor with fields from CGREvent
// cgrEv contains both fields and their values
// fields represent fields needing update
-func (cd *CallDescriptor) UpdateFromCGREvent(cgrEv *utils.CGREvent, fields []string) (err error) {
+func (cd *CallDescriptor) UpdateFromCGREvent(cgrEv *CGREvent, fields []string) (err error) {
for _, fldName := range fields {
switch fldName {
case utils.ToR:
diff --git a/engine/calldesc_test.go b/engine/calldesc_test.go
index f9585e7c9..826469989 100644
--- a/engine/calldesc_test.go
+++ b/engine/calldesc_test.go
@@ -1852,7 +1852,7 @@ func TestCDDebitBalanceSubjectWithFallback(t *testing.T) {
}
}
func TestCallDescriptorUpdateFromCGREvent(t *testing.T) {
- cgrEv := &utils.CGREvent{
+ cgrEv := &CGREvent{
Tenant: "cgrates.org",
ID: "Generated",
Event: map[string]any{
@@ -1900,7 +1900,7 @@ func TestCallDescriptorUpdateFromCGREvent(t *testing.T) {
t.Errorf("Expecting: %+v, received: %+v", cdExpected, cd)
}
}
- cgrEv = &utils.CGREvent{
+ cgrEv = &CGREvent{
Tenant: "cgrates.org",
ID: "Generated",
Event: map[string]any{
@@ -1921,7 +1921,7 @@ func TestCallDescriptorUpdateFromCGREvent(t *testing.T) {
t.Errorf("Expecting: %+v, received: %+v", cdExpected, cd)
}
}
- cgrEv = &utils.CGREvent{}
+ cgrEv = &CGREvent{}
if err = cd.UpdateFromCGREvent(cgrEv, []string{utils.Usage}); err == nil {
t.Error(err)
} else if err = cd.UpdateFromCGREvent(cgrEv, []string{utils.AnswerTime}); err == nil {
@@ -1941,7 +1941,7 @@ func TestCallDescriptorUpdateFromCGREvent(t *testing.T) {
} else if err = cd.UpdateFromCGREvent(cgrEv, []string{"Extra"}); err == nil {
t.Error(err)
}
- cgrEv = &utils.CGREvent{
+ cgrEv = &CGREvent{
Event: map[string]any{
"Extra": "Value",
},
@@ -1974,7 +1974,7 @@ func TestCallDescriptorAsCGREvent(t *testing.T) {
TimeEnd: time.Date(2015, 3, 23, 6, 30, 0, 0, time.UTC),
MaxCostSoFar: 0,
}
- eCGREvent := &utils.CGREvent{Tenant: "cgrates.org",
+ eCGREvent := &CGREvent{Tenant: "cgrates.org",
ID: "Generated",
Event: map[string]any{
"Account": "max",
@@ -2107,7 +2107,7 @@ func TestCalldescSetRpSubjectPrefixMatching(t *testing.T) {
}
func TestCalldescNewCallDescriptorFromCGREventNoAccount(t *testing.T) {
- cgrEv := &utils.CGREvent{
+ cgrEv := &CGREvent{
Event: map[string]any{
"testKey": 5,
},
@@ -2128,7 +2128,7 @@ func TestCalldescNewCallDescriptorFromCGREventNoAccount(t *testing.T) {
}
func TestCalldescNewCallDescriptorFromCGREventNoDestination(t *testing.T) {
- cgrEv := &utils.CGREvent{
+ cgrEv := &CGREvent{
Event: map[string]any{
utils.Category: "catField",
utils.AccountField: "accField",
@@ -2150,7 +2150,7 @@ func TestCalldescNewCallDescriptorFromCGREventNoDestination(t *testing.T) {
}
func TestCalldescNewCallDescriptorFromCGREventNoTimeStart(t *testing.T) {
- cgrEv := &utils.CGREvent{
+ cgrEv := &CGREvent{
Event: map[string]any{
utils.Category: "catField",
utils.AccountField: "accField",
@@ -2173,7 +2173,7 @@ func TestCalldescNewCallDescriptorFromCGREventNoTimeStart(t *testing.T) {
}
func TestCalldescNewCallDescriptorFromCGREventInvalidAnswerTime(t *testing.T) {
- cgrEv := &utils.CGREvent{
+ cgrEv := &CGREvent{
Event: map[string]any{
utils.Category: "catField",
utils.AccountField: "accField",
@@ -2198,7 +2198,7 @@ func TestCalldescNewCallDescriptorFromCGREventInvalidAnswerTime(t *testing.T) {
}
func TestCalldescNewCallDescriptorFromCGREventNoUsage(t *testing.T) {
- cgrEv := &utils.CGREvent{
+ cgrEv := &CGREvent{
Event: map[string]any{
utils.Category: "catField",
utils.AccountField: "accField",
@@ -2223,7 +2223,7 @@ func TestCalldescNewCallDescriptorFromCGREventNoUsage(t *testing.T) {
}
func TestCalldescNewCallDescriptorFromCGREvent(t *testing.T) {
- cgrEv := &utils.CGREvent{
+ cgrEv := &CGREvent{
Event: map[string]any{
utils.Category: "catField",
utils.AccountField: "accField",
@@ -2277,7 +2277,7 @@ func TestCalldescAsCGREvent(t *testing.T) {
}
opts := make(map[string]any)
- exp := &utils.CGREvent{
+ exp := &CGREvent{
Event: map[string]any{
utils.Category: "catField",
utils.Subject: "accField",
diff --git a/engine/cdr.go b/engine/cdr.go
index 51f48f6c5..511024874 100644
--- a/engine/cdr.go
+++ b/engine/cdr.go
@@ -306,8 +306,8 @@ func (cdr *CDR) AsCDRsql() (cdrSQL *CDRsql) {
return
}
-func (cdr *CDR) AsCGREvent() *utils.CGREvent {
- return &utils.CGREvent{
+func (cdr *CDR) AsCGREvent() *CGREvent {
+ return &CGREvent{
Tenant: cdr.Tenant,
ID: utils.UUIDSha1Prefix(),
Event: cdr.AsMapStringIface(),
diff --git a/engine/cdr_test.go b/engine/cdr_test.go
index a9e4e8165..0b9fab364 100644
--- a/engine/cdr_test.go
+++ b/engine/cdr_test.go
@@ -814,7 +814,7 @@ func TestCDRAsCGREvent(t *testing.T) {
Cost: 1.01,
ExtraFields: map[string]string{"field_extr1": "val_extr1", "fieldextr2": "valextr2"},
}
- eCGREvent := utils.CGREvent{
+ eCGREvent := CGREvent{
Tenant: "cgrates.org",
ID: "GenePreRated",
Event: map[string]any{
diff --git a/engine/cdrs.go b/engine/cdrs.go
index 02e2d00de..91191dc59 100644
--- a/engine/cdrs.go
+++ b/engine/cdrs.go
@@ -352,7 +352,7 @@ func (cdrS *CDRServer) refundEventCost(ec *EventCost, reqType, tor string) (rfnd
}
// chrgrSProcessEvent forks CGREventWithOpts into multiples based on matching ChargerS profiles
-func (cdrS *CDRServer) chrgrSProcessEvent(cgrEv *utils.CGREvent) (cgrEvs []*utils.CGREvent, err error) {
+func (cdrS *CDRServer) chrgrSProcessEvent(cgrEv *CGREvent) (cgrEvs []*CGREvent, err error) {
var chrgrs []*ChrgSProcessEventReply
if err = cdrS.connMgr.Call(context.TODO(), cdrS.cgrCfg.CdrsCfg().ChargerSConns,
utils.ChargerSv1ProcessEvent,
@@ -362,7 +362,7 @@ func (cdrS *CDRServer) chrgrSProcessEvent(cgrEv *utils.CGREvent) (cgrEvs []*util
if len(chrgrs) == 0 {
return
}
- cgrEvs = make([]*utils.CGREvent, len(chrgrs))
+ cgrEvs = make([]*CGREvent, len(chrgrs))
for i, cgrPrfl := range chrgrs {
cgrEvs[i] = cgrPrfl.CGREvent
}
@@ -370,7 +370,7 @@ func (cdrS *CDRServer) chrgrSProcessEvent(cgrEv *utils.CGREvent) (cgrEvs []*util
}
// attrSProcessEvent will send the event to StatS if the connection is configured
-func (cdrS *CDRServer) attrSProcessEvent(cgrEv *utils.CGREvent) (err error) {
+func (cdrS *CDRServer) attrSProcessEvent(cgrEv *CGREvent) (err error) {
var rplyEv AttrSProcessEventReply
if cgrEv.APIOpts == nil {
cgrEv.APIOpts = make(map[string]any)
@@ -395,7 +395,7 @@ func (cdrS *CDRServer) attrSProcessEvent(cgrEv *utils.CGREvent) (err error) {
}
// thdSProcessEvent will send the event to ThresholdS
-func (cdrS *CDRServer) thdSProcessEvent(cgrEv *utils.CGREvent) (err error) {
+func (cdrS *CDRServer) thdSProcessEvent(cgrEv *CGREvent) (err error) {
var tIDs []string
// we clone the CGREvent so we can add EventType without being propagated
thArgs := cgrEv.Clone()
@@ -413,7 +413,7 @@ func (cdrS *CDRServer) thdSProcessEvent(cgrEv *utils.CGREvent) (err error) {
}
// statSProcessEvent will send the event to StatS
-func (cdrS *CDRServer) statSProcessEvent(cgrEv *utils.CGREvent) (err error) {
+func (cdrS *CDRServer) statSProcessEvent(cgrEv *CGREvent) (err error) {
var reply []string
statArgs := cgrEv.Clone()
if err = cdrS.connMgr.Call(context.TODO(), cdrS.cgrCfg.CdrsCfg().StatSConns,
@@ -439,8 +439,8 @@ func (cdrS *CDRServer) eeSProcessEvent(cgrEv *CGREventWithEeIDs) (err error) {
// processEvent processes a CGREvent based on arguments
// in case of partially executed, both error and evs will be returned
-func (cdrS *CDRServer) processEvents(evs []*utils.CGREvent,
- chrgS, attrS, refund, ralS, store, reRate, export, thdS, stS bool) (outEvs []*utils.EventWithFlags, err error) {
+func (cdrS *CDRServer) processEvents(evs []*CGREvent,
+ chrgS, attrS, refund, ralS, store, reRate, export, thdS, stS bool) (outEvs []*EventWithFlags, err error) {
if reRate {
refund = true
}
@@ -455,10 +455,10 @@ func (cdrS *CDRServer) processEvents(evs []*utils.CGREvent,
}
}
}
- var cgrEvs []*utils.CGREvent
+ var cgrEvs []*CGREvent
if chrgS {
for _, ev := range evs {
- var chrgEvs []*utils.CGREvent
+ var chrgEvs []*CGREvent
if chrgEvs, err = cdrS.chrgrSProcessEvent(ev); err != nil {
utils.Logger.Warning(
fmt.Sprintf("<%s> error: <%s> processing event %+v with %s",
@@ -639,9 +639,9 @@ func (cdrS *CDRServer) processEvents(evs []*utils.CGREvent,
if partiallyExecuted {
err = utils.ErrPartiallyExecuted
}
- outEvs = make([]*utils.EventWithFlags, len(cgrEvs))
+ outEvs = make([]*EventWithFlags, len(cgrEvs))
for i, cgrEv := range cgrEvs {
- outEvs[i] = &utils.EventWithFlags{
+ outEvs[i] = &EventWithFlags{
Flags: procFlgs[i].AsSlice(),
Event: cgrEv.Event,
}
@@ -718,7 +718,7 @@ func (cdrS *CDRServer) V1ProcessCDR(ctx *context.Context, cdr *CDRWithAPIOpts, r
cgrEv := cdr.AsCGREvent()
cgrEv.APIOpts = cdr.APIOpts
- if _, err = cdrS.processEvents([]*utils.CGREvent{cgrEv},
+ if _, err = cdrS.processEvents([]*CGREvent{cgrEv},
len(cdrS.cgrCfg.CdrsCfg().ChargerSConns) != 0 && !cdr.PreRated,
len(cdrS.cgrCfg.CdrsCfg().AttributeSConns) != 0,
false,
@@ -737,7 +737,7 @@ func (cdrS *CDRServer) V1ProcessCDR(ctx *context.Context, cdr *CDRWithAPIOpts, r
// ArgV1ProcessEvent is the CGREvent with proccesing Flags
type ArgV1ProcessEvent struct {
Flags []string
- utils.CGREvent
+ CGREvent
clnb bool //rpcclonable
}
@@ -873,7 +873,7 @@ func (cdrS *CDRServer) V1ProcessEvent(ctx *context.Context, arg *ArgV1ProcessEve
}
// end of processing options
- if _, err = cdrS.processEvents([]*utils.CGREvent{&arg.CGREvent}, chrgS, attrS, refund,
+ if _, err = cdrS.processEvents([]*CGREvent{&arg.CGREvent}, chrgS, attrS, refund,
ralS, store, reRate, export, thdS, stS); err != nil {
return
}
@@ -882,7 +882,7 @@ func (cdrS *CDRServer) V1ProcessEvent(ctx *context.Context, arg *ArgV1ProcessEve
}
// V2ProcessEvent has the same logic with V1ProcessEvent except it adds the proccessed events to the reply
-func (cdrS *CDRServer) V2ProcessEvent(ctx *context.Context, arg *ArgV1ProcessEvent, evs *[]*utils.EventWithFlags) (err error) {
+func (cdrS *CDRServer) V2ProcessEvent(ctx *context.Context, arg *ArgV1ProcessEvent, evs *[]*EventWithFlags) (err error) {
if arg.ID == "" {
arg.ID = utils.GenUUID()
}
@@ -896,7 +896,7 @@ func (cdrS *CDRServer) V2ProcessEvent(ctx *context.Context, arg *ArgV1ProcessEve
if itm, has := Cache.Get(utils.CacheRPCResponses, cacheKey); has {
cachedResp := itm.(*utils.CachedRPCResponse)
if cachedResp.Error == nil {
- *evs = *cachedResp.Result.(*[]*utils.EventWithFlags)
+ *evs = *cachedResp.Result.(*[]*EventWithFlags)
}
return cachedResp.Error
}
@@ -949,8 +949,8 @@ func (cdrS *CDRServer) V2ProcessEvent(ctx *context.Context, arg *ArgV1ProcessEve
}
// end of processing options
- var procEvs []*utils.EventWithFlags
- if procEvs, err = cdrS.processEvents([]*utils.CGREvent{&arg.CGREvent}, chrgS, attrS, refund,
+ var procEvs []*EventWithFlags
+ if procEvs, err = cdrS.processEvents([]*CGREvent{&arg.CGREvent}, chrgS, attrS, refund,
ralS, store, reRate, export, thdS, stS); err != nil {
return
}
@@ -961,7 +961,7 @@ func (cdrS *CDRServer) V2ProcessEvent(ctx *context.Context, arg *ArgV1ProcessEve
// ArgV1ProcessEvents defines the structure for holding CGREvents about to be processed by CDRsV1.ProcessEvents.
type ArgV1ProcessEvents struct {
Flags []string
- CGREvents []*utils.CGREvent
+ CGREvents []*CGREvent
APIOpts map[string]any
clnb bool //rpcclonable
}
@@ -983,7 +983,7 @@ func (attr *ArgV1ProcessEvents) RPCClone() (any, error) {
func (attr *ArgV1ProcessEvents) Clone() *ArgV1ProcessEvents {
cln := &ArgV1ProcessEvents{
Flags: slices.Clone(attr.Flags),
- CGREvents: make([]*utils.CGREvent, 0, len(attr.CGREvents)),
+ CGREvents: make([]*CGREvent, 0, len(attr.CGREvents)),
}
for _, cgrEv := range attr.CGREvents {
cln.CGREvents = append(cln.CGREvents, cgrEv.Clone())
@@ -1249,7 +1249,7 @@ func (cdrS *CDRServer) V1RateCDRs(ctx *context.Context, arg *ArgRateCDRs, reply
if chrgS && len(cdrS.cgrCfg.CdrsCfg().ChargerSConns) == 0 {
return utils.NewErrNotConnected(utils.ChargerS)
}
- cgrEvs := make([]*utils.CGREvent, len(cdrs))
+ cgrEvs := make([]*CGREvent, len(cdrs))
for i, cdr := range cdrs {
cdr.Cost = -1 // the cost will be recalculated
cgrEvs[i] = cdr.AsCGREvent()
diff --git a/engine/cdrs_test.go b/engine/cdrs_test.go
index cac730f4b..92c7b0600 100644
--- a/engine/cdrs_test.go
+++ b/engine/cdrs_test.go
@@ -50,7 +50,7 @@ func TestCDRSV1ProcessCDRNoTenant(t *testing.T) {
if !cancast {
return fmt.Errorf("can't cast")
}
- newArgs, cancast := args.(*utils.CGREvent)
+ newArgs, cancast := args.(*CGREvent)
if !cancast {
return fmt.Errorf("can't cast")
}
@@ -59,7 +59,7 @@ func TestCDRSV1ProcessCDRNoTenant(t *testing.T) {
}
*rply = AttrSProcessEventReply{
AlteredFields: []string{utils.AccountField},
- CGREvent: &utils.CGREvent{
+ CGREvent: &CGREvent{
ID: "TestBiRPCv1AuthorizeEventNoTenant",
Time: utils.TimePointer(time.Date(2016, time.January, 5, 18, 30, 49, 0, time.UTC)),
Event: map[string]any{
@@ -121,7 +121,7 @@ func TestCDRSV1ProcessEventNoTenant(t *testing.T) {
if !cancast {
return fmt.Errorf("can't cast")
}
- newArgs, cancast := args.(*utils.CGREvent)
+ newArgs, cancast := args.(*CGREvent)
if !cancast {
return fmt.Errorf("can't cast")
}
@@ -146,7 +146,7 @@ func TestCDRSV1ProcessEventNoTenant(t *testing.T) {
}
args := &ArgV1ProcessEvent{
Flags: []string{utils.MetaChargers},
- CGREvent: utils.CGREvent{
+ CGREvent: CGREvent{
ID: "TestV1ProcessEventNoTenant",
Event: map[string]any{
utils.CGRID: "test1",
@@ -177,7 +177,7 @@ func TestCDRSV1V1ProcessExternalCDRNoTenant(t *testing.T) {
if !cancast {
return fmt.Errorf("can't cast")
}
- newArgs, cancast := args.(*utils.CGREvent)
+ newArgs, cancast := args.(*CGREvent)
if !cancast {
return fmt.Errorf("can't cast")
}
@@ -229,7 +229,7 @@ func TestCDRSV1V1ProcessExternalCDRNoTenant(t *testing.T) {
func TestArgV1ProcessClone(t *testing.T) {
attr := &ArgV1ProcessEvent{
Flags: []string{"flg,flg2,flg3"},
- CGREvent: utils.CGREvent{
+ CGREvent: CGREvent{
ID: "TestBiRPCv1AuthorizeEventNoTenant",
Time: utils.TimePointer(time.Date(2016, time.January, 5, 18, 30, 49, 0, time.UTC)),
Event: map[string]any{
@@ -352,7 +352,7 @@ func TestCDRServerThdsProcessEvent(t *testing.T) {
cdrDb: db,
dm: dm,
}
- crgEv := &utils.CGREvent{
+ crgEv := &CGREvent{
Tenant: "cgrates.org",
ID: "id",
Time: utils.TimePointer(time.Date(2019, 12, 1, 15, 0, 0, 0, time.UTC)),
@@ -392,7 +392,7 @@ func TestCDRServerStatSProcessEvent(t *testing.T) {
cdrDb: db,
connMgr: connMgr,
}
- crgEv := &utils.CGREvent{
+ crgEv := &CGREvent{
Tenant: "cgrates.org",
ID: "id",
Time: utils.TimePointer(time.Date(2019, 12, 1, 15, 0, 0, 0, time.UTC)),
@@ -437,7 +437,7 @@ func TestCDRServerEesProcessEvent(t *testing.T) {
cgrEv := &CGREventWithEeIDs{
EeIDs: []string{"ees"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &CGREvent{
Tenant: "cgrates.org",
ID: "id",
Time: utils.TimePointer(time.Date(2019, 12, 1, 15, 0, 0, 0, time.UTC)),
@@ -611,7 +611,7 @@ func TestCDRSV2ProcessEvent(t *testing.T) {
Cache = NewCacheS(cfg, dm, nil)
args := &ArgV1ProcessEvent{
Flags: []string{utils.MetaChargers},
- CGREvent: utils.CGREvent{
+ CGREvent: CGREvent{
ID: "TestV1ProcessEventNoTenant",
Event: map[string]any{
utils.CGRID: "test1",
@@ -625,7 +625,7 @@ func TestCDRSV2ProcessEvent(t *testing.T) {
},
},
}
- evs := &[]*utils.EventWithFlags{}
+ evs := &[]*EventWithFlags{}
if err := cdrs.V2ProcessEvent(context.Background(), args, evs); err != nil {
t.Error(err)
@@ -660,7 +660,7 @@ func TestCDRSV2ProcessEventCacheSet(t *testing.T) {
Cache = NewCacheS(cfg, dm, nil)
args := &ArgV1ProcessEvent{
Flags: []string{utils.MetaChargers},
- CGREvent: utils.CGREvent{
+ CGREvent: CGREvent{
ID: "TestV1ProcessEventNoTenant",
Event: map[string]any{
utils.CGRID: "test1",
@@ -674,7 +674,7 @@ func TestCDRSV2ProcessEventCacheSet(t *testing.T) {
},
},
}
- evs := &[]*utils.EventWithFlags{}
+ evs := &[]*EventWithFlags{}
Cache.Set(utils.CacheRPCResponses, utils.ConcatenatedKey(utils.CDRsV2ProcessEvent, args.CGREvent.ID),
&utils.CachedRPCResponse{Result: evs, Error: nil},
nil, true, utils.NonTransactional)
@@ -720,7 +720,7 @@ func TestCDRSV1ProcessEvent(t *testing.T) {
Cache = NewCacheS(cfg, dm, nil)
args := &ArgV1ProcessEvent{
Flags: []string{utils.MetaChargers},
- CGREvent: utils.CGREvent{
+ CGREvent: CGREvent{
ID: "TestV1ProcessEventNoTenant",
Event: map[string]any{
utils.CGRID: "test1",
@@ -769,7 +769,7 @@ func TestCDRSV1ProcessEventCacheSet(t *testing.T) {
Cache = NewCacheS(cfg, dm, nil)
args := &ArgV1ProcessEvent{
Flags: []string{utils.MetaChargers},
- CGREvent: utils.CGREvent{
+ CGREvent: CGREvent{
ID: "TestV1ProcessEventNoTenant",
Event: map[string]any{
utils.CGRID: "test1",
@@ -822,7 +822,7 @@ func TestV1ProcessEvent(t *testing.T) {
utils.AttributeSv1ProcessEvent: func(ctx *context.Context, args, reply any) error {
rpl := &AttrSProcessEventReply{
AlteredFields: []string{"*req.OfficeGroup"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &CGREvent{
Event: map[string]any{
utils.CGRID: "cgrid",
},
@@ -837,7 +837,7 @@ func TestV1ProcessEvent(t *testing.T) {
{
ChargerSProfile: "chrgs1",
AttributeSProfiles: []string{"attr1", "attr2"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &CGREvent{
Event: map[string]any{
utils.CGRID: "cgrid2",
},
@@ -901,7 +901,7 @@ func TestV1ProcessEvent(t *testing.T) {
}
arg := &ArgV1ProcessEvent{
Flags: []string{utils.MetaAttributes, utils.MetaStats, utils.MetaExport, utils.MetaStore, utils.OptsThresholdS, utils.MetaThresholds, utils.MetaStats, utils.OptsChargerS, utils.MetaChargers, utils.OptsRALs, utils.MetaRALs, utils.OptsRerate, utils.MetaRerate, utils.OptsRefund, utils.MetaRefund},
- CGREvent: utils.CGREvent{
+ CGREvent: CGREvent{
ID: "TestV1ProcessEventNoTenant",
Event: map[string]any{
utils.CGRID: "test1",
@@ -967,7 +967,7 @@ func TestCdrprocessEventsErrLog(t *testing.T) {
connMgr: connMgr,
}
- evs := []*utils.CGREvent{
+ evs := []*CGREvent{
{ID: "TestV1ProcessEventNoTenant",
Event: map[string]any{
utils.CGRID: "test1",
@@ -2016,7 +2016,7 @@ func TestChrgrSProcessEvent(t *testing.T) {
ChargerSProfile: "Charger1",
AttributeSProfiles: []string{"cgrates.org:ATTR_1001_SIMPLEAUTH"},
AlteredFields: []string{utils.MetaReqRunID, "*req.Password"},
- CGREvent: &utils.CGREvent{ // matching Charger1
+ CGREvent: &CGREvent{ // matching Charger1
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -2045,7 +2045,7 @@ func TestChrgrSProcessEvent(t *testing.T) {
dm: dm,
connMgr: connMgr,
}
- cgrEv := utils.CGREvent{
+ cgrEv := CGREvent{
ID: "TestV1ProcessEventNoTenant",
Event: map[string]any{
utils.CGRID: "test1",
@@ -2058,7 +2058,7 @@ func TestChrgrSProcessEvent(t *testing.T) {
utils.Usage: 123 * time.Minute,
},
}
- expcgrEv := []*utils.CGREvent{
+ expcgrEv := []*CGREvent{
{
Tenant: "cgrates.org",
ID: "event1",
@@ -2272,7 +2272,7 @@ func TestCDRSGetCDRs(t *testing.T) {
}),
}
arg := &ArgV1ProcessEvent{
- CGREvent: utils.CGREvent{
+ CGREvent: CGREvent{
Tenant: "cgrates.org",
ID: "Event1",
Event: map[string]any{
diff --git a/engine/cgrevent.go b/engine/cgrevent.go
new file mode 100644
index 000000000..c97de37eb
--- /dev/null
+++ b/engine/cgrevent.go
@@ -0,0 +1,369 @@
+/*
+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 engine
+
+import (
+ "strings"
+ "time"
+
+ "github.com/cgrates/cgrates/utils"
+ "github.com/ericlagergren/decimal"
+)
+
+// CGREvent is a generic event processed by CGR services
+type CGREvent struct {
+ Tenant string
+ ID string
+ Time *time.Time // event time
+ Event map[string]any
+ APIOpts map[string]any
+ clnb bool //rpcclonable
+}
+
+func (ev *CGREvent) HasField(fldName string) (has bool) {
+ _, has = ev.Event[fldName]
+ return
+}
+
+func (ev *CGREvent) CheckMandatoryFields(fldNames []string) error {
+ for _, fldName := range fldNames {
+ if _, has := ev.Event[fldName]; !has {
+ return utils.NewErrMandatoryIeMissing(fldName)
+ }
+ }
+ return nil
+}
+
+// FieldAsString returns a field as string instance
+func (ev *CGREvent) FieldAsString(fldName string) (val string, err error) {
+ iface, has := ev.Event[fldName]
+ if !has {
+ return "", utils.ErrNotFound
+ }
+ return utils.IfaceAsString(iface), nil
+}
+
+// OptAsString returns an option as string
+func (ev *CGREvent) OptAsString(optName string) (val string, err error) {
+ iface, has := ev.APIOpts[optName]
+ if !has {
+ return "", utils.ErrNotFound
+ }
+ return utils.IfaceAsString(iface), nil
+}
+
+// OptAsInt64 returns an option as int64
+func (ev *CGREvent) OptAsInt64(optName string) (int64, error) {
+ iface, has := ev.APIOpts[optName]
+ if !has {
+ return 0, utils.ErrNotFound
+ }
+ return utils.IfaceAsTInt64(iface)
+}
+
+// FieldAsTime returns a field as Time instance
+func (ev *CGREvent) FieldAsTime(fldName string, timezone string) (t time.Time, err error) {
+ iface, has := ev.Event[fldName]
+ if !has {
+ err = utils.ErrNotFound
+ return
+ }
+ return utils.IfaceAsTime(iface, timezone)
+}
+
+// FieldAsDuration returns a field as Duration instance
+func (ev *CGREvent) FieldAsDuration(fldName string) (d time.Duration, err error) {
+ iface, has := ev.Event[fldName]
+ if !has {
+ err = utils.ErrNotFound
+ return
+ }
+ return utils.IfaceAsDuration(iface)
+}
+
+// OptAsDuration returns an option as Duration instance
+func (ev *CGREvent) OptAsDuration(optName string) (d time.Duration, err error) {
+ iface, has := ev.APIOpts[optName]
+ if !has {
+ err = utils.ErrNotFound
+ return
+ }
+ return utils.IfaceAsDuration(iface)
+}
+
+// FieldAsFloat64 returns a field as float64 instance
+func (ev *CGREvent) FieldAsFloat64(fldName string) (f float64, err error) {
+ iface, has := ev.Event[fldName]
+ if !has {
+ return f, utils.ErrNotFound
+ }
+ return utils.IfaceAsFloat64(iface)
+}
+
+// FieldAsInt64 returns a field as int64 instance
+func (ev *CGREvent) FieldAsInt64(fldName string) (f int64, err error) {
+ iface, has := ev.Event[fldName]
+ if !has {
+ return f, utils.ErrNotFound
+ }
+ return utils.IfaceAsInt64(iface)
+}
+
+func (ev *CGREvent) TenantID() string {
+ return utils.ConcatenatedKey(ev.Tenant, ev.ID)
+}
+
+func (ev *CGREvent) Clone() (clned *CGREvent) {
+ clned = &CGREvent{
+ Tenant: ev.Tenant,
+ ID: ev.ID,
+ Event: make(map[string]any),
+ APIOpts: make(map[string]any),
+ }
+ if ev.Time != nil {
+ clned.Time = new(time.Time)
+ *clned.Time = *ev.Time
+ }
+ for k, v := range ev.Event {
+ clned.Event[k] = v
+ }
+ for opt, val := range ev.APIOpts {
+ clned.APIOpts[opt] = val
+ }
+ return
+}
+
+// AsDataProvider returns the CGREvent as MapStorage with *opts and *req paths set
+func (cgrEv *CGREvent) AsDataProvider() (ev utils.DataProvider) {
+ return utils.MapStorage{
+ utils.MetaOpts: cgrEv.APIOpts,
+ utils.MetaReq: cgrEv.Event,
+ }
+}
+
+// EventWithFlags is used where flags are needed to mark processing
+type EventWithFlags struct {
+ Flags []string
+ Event map[string]any
+}
+
+// GetRoutePaginatorFromOpts will consume supplierPaginator if present
+func GetRoutePaginatorFromOpts(ev map[string]any) (args utils.Paginator, err error) {
+ if ev == nil {
+ return
+ }
+ //check if we have suppliersLimit in event and in case it has add it in args
+ limitIface, hasRoutesLimit := ev[utils.OptsRoutesLimit]
+ if hasRoutesLimit {
+ delete(ev, utils.OptsRoutesLimit)
+ var limit int64
+ if limit, err = utils.IfaceAsInt64(limitIface); err != nil {
+ return
+ }
+ args = utils.Paginator{
+ Limit: utils.IntPointer(int(limit)),
+ }
+ }
+ //check if we have offset in event and in case it has add it in args
+ offsetIface, hasRoutesOffset := ev[utils.OptsRoutesOffset]
+ if !hasRoutesOffset {
+ return
+ }
+ delete(ev, utils.OptsRoutesOffset)
+ var offset int64
+ if offset, err = utils.IfaceAsInt64(offsetIface); err != nil {
+ return
+ }
+ if !hasRoutesLimit { //in case we don't have limit, but we have offset we need to initialize the struct
+ args = utils.Paginator{
+ Offset: utils.IntPointer(int(offset)),
+ }
+ return
+ }
+ args.Offset = utils.IntPointer(int(offset))
+ return
+}
+
+// NMAsCGREvent builds a CGREvent considering Time as time.Now()
+// and Event as linear map[string]any with joined paths
+// treats particular case when the value of map is []*NMItem - used in agents/AgentRequest
+func NMAsCGREvent(nM *utils.OrderedNavigableMap, tnt string, pathSep string, opts utils.MapStorage) (cgrEv *CGREvent) {
+ if nM == nil {
+ return
+ }
+ el := nM.GetFirstElement()
+ if el == nil {
+ return
+ }
+ cgrEv = &CGREvent{
+ Tenant: tnt,
+ ID: utils.UUIDSha1Prefix(),
+ Time: utils.TimePointer(time.Now()),
+ Event: make(map[string]any),
+ APIOpts: opts,
+ }
+ for ; el != nil; el = el.Next() {
+ path := el.Value
+ val, _ := nM.Field(path) // this should never return error cause we get the path from the order
+ if val.AttributeID != "" {
+ continue
+ }
+ path = path[:len(path)-1] // remove the last index
+ opath := strings.Join(path, utils.NestingSep)
+ if _, has := cgrEv.Event[opath]; !has {
+ cgrEv.Event[opath] = val.Data // first item which is not an attribute will become the value
+ }
+ }
+ return
+}
+
+// SetCloneable sets if the args should be clonned on internal connections
+func (attr *CGREvent) SetCloneable(rpcCloneable bool) {
+ attr.clnb = rpcCloneable
+}
+
+// RPCClone implements rpcclient.RPCCloner interface
+func (attr *CGREvent) RPCClone() (any, error) {
+ if !attr.clnb {
+ return attr, nil
+ }
+ return attr.Clone(), nil
+}
+
+// GetFloat64Opts checks the specified option names in order among the keys in APIOpts returning the first value it finds as float64, otherwise it
+// returns the default option (usually the value specified in config)
+func GetFloat64Opts(ev *CGREvent, dftOpt float64, optNames ...string) (cfgOpt float64, err error) {
+ for _, optName := range optNames {
+ if opt, has := ev.APIOpts[optName]; has {
+ return utils.IfaceAsFloat64(opt)
+ }
+ }
+ return dftOpt, nil
+}
+
+// GetDurationOpts checks the specified option names in order among the keys in APIOpts returning the first value it finds as time.Duration, otherwise it
+// returns the default option (usually the value specified in config)
+func GetDurationOpts(ev *CGREvent, dftOpt time.Duration, optNames ...string) (cfgOpt time.Duration, err error) {
+ for _, optName := range optNames {
+ if opt, has := ev.APIOpts[optName]; has {
+ return utils.IfaceAsDuration(opt)
+ }
+ }
+ return dftOpt, nil
+}
+
+// GetStringOpts checks the specified option names in order among the keys in APIOpts returning the first value it finds as string, otherwise it
+// returns the default option (usually the value specified in config)
+func GetStringOpts(ev *CGREvent, dftOpt string, optNames ...string) (cfgOpt string) {
+ for _, optName := range optNames {
+ if opt, has := ev.APIOpts[optName]; has {
+ return utils.IfaceAsString(opt)
+ }
+ }
+ return dftOpt
+}
+
+// GetStringSliceOpts checks the specified option names in order among the keys in APIOpts returning the first value it finds as []string, otherwise it
+// returns the default option (usually the value specified in config)
+func GetStringSliceOpts(ev *CGREvent, dftOpt []string, optNames ...string) (cfgOpt []string, err error) {
+ for _, optName := range optNames {
+ if opt, has := ev.APIOpts[optName]; has {
+ return utils.IfaceAsSliceString(opt)
+ }
+ }
+ return dftOpt, nil
+}
+
+// GetIntOpts checks the specified option names in order among the keys in APIOpts returning the first value it finds as int, otherwise it
+// returns the default option (usually the value specified in config)
+func GetIntOpts(ev *CGREvent, dftOpt int, optNames ...string) (cfgOpt int, err error) {
+ for _, optName := range optNames {
+ if opt, has := ev.APIOpts[optName]; has {
+ var value int64
+ if value, err = utils.IfaceAsTInt64(opt); err != nil {
+ return
+ }
+ return int(value), nil
+ }
+ }
+ return dftOpt, nil
+}
+
+// GetBoolOpts checks the specified option names in order among the keys in APIOpts returning the first value it finds as bool, otherwise it
+// returns the default option (usually the value specified in config)
+func GetBoolOpts(ev *CGREvent, dftOpt bool, optNames ...string) (cfgOpt bool, err error) {
+ for _, optName := range optNames {
+ if opt, has := ev.APIOpts[optName]; has {
+ return utils.IfaceAsBool(opt)
+ }
+ }
+ return dftOpt, nil
+}
+
+// GetDecimalBigOpts checks the specified option names in order among the keys in APIOpts returning the first value it finds as *decimal.Big, otherwise it
+// returns the default option (usually the value specified in config)
+func GetDecimalBigOpts(ev *CGREvent, dftOpt *decimal.Big, optNames ...string) (cfgOpt *decimal.Big, err error) {
+ for _, optName := range optNames {
+ if opt, has := ev.APIOpts[optName]; has {
+ return utils.IfaceAsBig(opt)
+ }
+ }
+ return dftOpt, nil
+}
+
+// GetInterfaceOpts checks the specified option names in order among the keys in APIOpts returning the first value it finds as any, otherwise it
+// returns the default option (usually the value specified in config)
+func GetInterfaceOpts(ev *CGREvent, dftOpt any, optNames ...string) (cfgOpt any) {
+ for _, optName := range optNames {
+ if opt, has := ev.APIOpts[optName]; has {
+ return opt
+ }
+ }
+ return dftOpt
+}
+
+// GetIntPointerOpts checks the specified option names in order among the keys in APIOpts returning the first value it finds as *int, otherwise it
+// returns the default option (usually the value specified in config)
+func GetIntPointerOpts(ev *CGREvent, dftOpt *int, optNames ...string) (cfgOpt *int, err error) {
+ for _, optName := range optNames {
+ if opt, has := ev.APIOpts[optName]; has {
+ var value int64
+ if value, err = utils.IfaceAsTInt64(opt); err != nil {
+ return
+ }
+ return utils.IntPointer(int(value)), nil
+ }
+ }
+ return dftOpt, nil
+}
+
+// GetDurationPointerOpts checks the specified option names in order among the keys in APIOpts returning the first value it finds as *time.Duration, otherwise it
+// returns the default option (usually the value specified in config)
+func GetDurationPointerOpts(ev *CGREvent, dftOpt *time.Duration, optNames ...string) (cfgOpt *time.Duration, err error) {
+ for _, optName := range optNames {
+ if opt, has := ev.APIOpts[optName]; has {
+ var value time.Duration
+ if value, err = utils.IfaceAsDuration(opt); err != nil {
+ return
+ }
+ return utils.DurationPointer(value), nil
+ }
+ }
+ return dftOpt, nil
+}
diff --git a/engine/cgrevent_test.go b/engine/cgrevent_test.go
new file mode 100644
index 000000000..9c76b1ef2
--- /dev/null
+++ b/engine/cgrevent_test.go
@@ -0,0 +1,1023 @@
+/*
+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 engine
+
+import (
+ "reflect"
+ "strings"
+ "testing"
+ "time"
+
+ "github.com/cgrates/cgrates/utils"
+ "github.com/ericlagergren/decimal"
+)
+
+func TestCGREventHasField(t *testing.T) {
+ //empty check
+ cgrEvent := new(CGREvent)
+ rcv := cgrEvent.HasField("")
+ if rcv {
+ t.Error("Expecting: false, received: ", rcv)
+ }
+ //normal check
+ cgrEvent = &CGREvent{
+ Event: map[string]any{
+ utils.Usage: 20 * time.Second,
+ },
+ }
+ rcv = cgrEvent.HasField("Usage")
+ if !rcv {
+ t.Error("Expecting: true, received: ", rcv)
+ }
+}
+
+func TestCGREventCheckMandatoryFields(t *testing.T) {
+ //empty check
+ cgrEvent := new(CGREvent)
+ fldNames := []string{}
+ err := cgrEvent.CheckMandatoryFields(fldNames)
+ if err != nil {
+ t.Error(err)
+ }
+ cgrEvent = &CGREvent{
+ Event: map[string]any{
+ utils.Usage: 20 * time.Second,
+ "test1": 1,
+ "test2": 2,
+ "test3": 3,
+ },
+ }
+ //normal check
+ fldNames = []string{"test1", "test2"}
+ err = cgrEvent.CheckMandatoryFields(fldNames)
+ if err != nil {
+ t.Error(err)
+ }
+ //MANDATORY_IE_MISSING
+ fldNames = []string{"test4", "test5"}
+ err = cgrEvent.CheckMandatoryFields(fldNames)
+ if err == nil || err.Error() != utils.NewErrMandatoryIeMissing("test4").Error() {
+ t.Errorf("Expected %s, received %s", utils.NewErrMandatoryIeMissing("test4"), err)
+ }
+}
+
+func TestCGREventFielAsString(t *testing.T) {
+ //empty check
+ cgrEvent := new(CGREvent)
+ fldname := "test"
+ _, err := cgrEvent.FieldAsString(fldname)
+ if err == nil || err.Error() != utils.ErrNotFound.Error() {
+ t.Errorf("Expected %s, received %s", utils.ErrNotFound, err)
+ }
+ //normal check
+ cgrEvent = &CGREvent{
+ Event: map[string]any{
+ utils.Usage: 20 * time.Second,
+ "test1": 1,
+ "test2": 2,
+ "test3": 3,
+ },
+ }
+ fldname = "test1"
+ rcv, err := cgrEvent.FieldAsString(fldname)
+ if err != nil {
+ t.Error(err)
+ }
+ if rcv != "1" {
+ t.Errorf("Expected: 1, received %+q", rcv)
+ }
+
+}
+
+func TestLibRoutesUsage(t *testing.T) {
+ se := &CGREvent{
+ Tenant: "cgrates.org",
+ ID: "supplierEvent1",
+ Event: map[string]any{
+ utils.Usage: 20 * time.Second,
+ },
+ }
+ seErr := &CGREvent{
+ Tenant: "cgrates.org",
+ ID: "supplierEvent1",
+ Event: make(map[string]any),
+ }
+ answ, err := se.FieldAsDuration(utils.Usage)
+ if err != nil {
+ t.Error(err)
+ }
+ if answ != se.Event[utils.Usage] {
+ t.Errorf("Expecting: %+v, received: %+v", se.Event[utils.Usage], answ)
+ }
+ _, err = seErr.FieldAsDuration(utils.Usage)
+ if err != utils.ErrNotFound {
+ t.Error(err)
+ }
+}
+
+func TestCGREventFieldAsTime(t *testing.T) {
+ se := &CGREvent{
+ Tenant: "cgrates.org",
+ ID: "supplierEvent1",
+ Event: map[string]any{
+ utils.AnswerTime: time.Now(),
+ },
+ }
+ seErr := &CGREvent{
+ Tenant: "cgrates.org",
+ ID: "supplierEvent1",
+ Event: make(map[string]any),
+ }
+ answ, err := se.FieldAsTime(utils.AnswerTime, "UTC")
+ if err != nil {
+ t.Error(err)
+ }
+ if answ != se.Event[utils.AnswerTime] {
+ t.Errorf("Expecting: %+v, received: %+v", se.Event[utils.AnswerTime], answ)
+ }
+ answ, err = seErr.FieldAsTime(utils.AnswerTime, "CET")
+ if err != utils.ErrNotFound {
+ t.Error(err)
+ }
+}
+
+func TestCGREventFieldAsString(t *testing.T) {
+ se := &CGREvent{
+ Tenant: "cgrates.org",
+ ID: "supplierEvent1",
+ Event: map[string]any{
+ "supplierprofile1": "Supplier",
+ "UsageInterval": time.Second,
+ "PddInterval": "1s",
+ "Weight": 20.0,
+ },
+ }
+ answ, err := se.FieldAsString("UsageInterval")
+ if err != nil {
+ t.Error(err)
+ }
+ if answ != "1s" {
+ t.Errorf("Expecting: %+v, received: %+v", se.Event["UsageInterval"], answ)
+ }
+ answ, err = se.FieldAsString("PddInterval")
+ if err != nil {
+ t.Error(err)
+ }
+ if answ != se.Event["PddInterval"] {
+ t.Errorf("Expecting: %+v, received: %+v", se.Event["PddInterval"], answ)
+ }
+ answ, err = se.FieldAsString("supplierprofile1")
+ if err != nil {
+ t.Error(err)
+ }
+ if answ != se.Event["supplierprofile1"] {
+ t.Errorf("Expecting: %+v, received: %+v", se.Event["supplierprofile1"], answ)
+ }
+ answ, err = se.FieldAsString("Weight")
+ if err != nil {
+ t.Error(err)
+ }
+ if answ != "20" {
+ t.Errorf("Expecting: %+v, received: %+v", se.Event["Weight"], answ)
+ }
+}
+
+func TestCGREventFieldAsFloat64(t *testing.T) {
+ se := &CGREvent{
+ Tenant: "cgrates.org",
+ ID: "supplierEvent1",
+ Event: map[string]any{
+ utils.AnswerTime: time.Now(),
+ "supplierprofile1": "Supplier",
+ "UsageInterval": "54.2",
+ "PddInterval": "1s",
+ "Weight": 20.0,
+ },
+ }
+ answ, err := se.FieldAsFloat64("UsageInterval")
+ if err != nil {
+ t.Error(err)
+ }
+ if answ != float64(54.2) {
+ t.Errorf("Expecting: %+v, received: %+v", se.Event["UsageInterval"], answ)
+ }
+ answ, err = se.FieldAsFloat64("Weight")
+ if err != nil {
+ t.Error(err)
+ }
+ if answ != float64(20.0) {
+ t.Errorf("Expecting: %+v, received: %+v", se.Event["Weight"], answ)
+ }
+ answ, err = se.FieldAsFloat64("PddInterval")
+ if err == nil || err.Error() != `strconv.ParseFloat: parsing "1s": invalid syntax` {
+ t.Errorf("Expected %s, received %s", `strconv.ParseFloat: parsing "1s": invalid syntax`, err)
+ }
+ if answ != 0 {
+ t.Errorf("Expecting: %+v, received: %+v", 0, answ)
+ }
+
+ if _, err := se.FieldAsFloat64(utils.AnswerTime); err == nil || !strings.HasPrefix(err.Error(), "cannot convert field") {
+ t.Errorf("Unexpected error : %+v", err)
+ }
+ if _, err := se.FieldAsFloat64(utils.AccountField); err == nil || err.Error() != utils.ErrNotFound.Error() {
+ t.Errorf("Expected %s, received %s", utils.ErrNotFound, err)
+ }
+ // }
+}
+
+// }
+func TestCGREventTenantID(t *testing.T) {
+ //empty check
+ cgrEvent := new(CGREvent)
+ rcv := cgrEvent.TenantID()
+ eOut := ":"
+ if !reflect.DeepEqual(eOut, rcv) {
+ t.Errorf("Expecting: %+v, received: %+v", eOut, rcv)
+ }
+ //normal check
+ cgrEvent = &CGREvent{
+ Tenant: "cgrates.org",
+ ID: "supplierEvent1",
+ }
+ rcv = cgrEvent.TenantID()
+ eOut = "cgrates.org:supplierEvent1"
+ if !reflect.DeepEqual(eOut, rcv) {
+ t.Errorf("Expecting: %+v, received: %+v", eOut, rcv)
+ }
+
+}
+
+func TestCGREventClone(t *testing.T) {
+ now := time.Now()
+ ev := &CGREvent{
+ Tenant: "cgrates.org",
+ ID: "supplierEvent1",
+ Time: &now,
+ Event: map[string]any{
+ utils.AnswerTime: time.Now(),
+ "supplierprofile1": "Supplier",
+ "UsageInterval": "54.2",
+ "PddInterval": "1s",
+ "Weight": 20.0,
+ },
+ APIOpts: map[string]any{
+ "testKey": 12,
+ },
+ }
+ cloned := ev.Clone()
+ if !reflect.DeepEqual(ev, cloned) {
+ t.Errorf("Expecting: %+v, received: %+v", ev, cloned)
+ }
+ if cloned.Time == ev.Time {
+ t.Errorf("Expecting: different pointer but received: %+v", cloned.Time)
+ }
+}
+
+func TestCGREventconsumeRoutePaginator(t *testing.T) {
+ //empty check
+ var opts map[string]any
+ rcv, err := GetRoutePaginatorFromOpts(opts)
+ if err != nil {
+ t.Error(err)
+ }
+ var eOut utils.Paginator
+ if !reflect.DeepEqual(eOut, rcv) {
+ t.Errorf("Expecting: %+v, received: %+v", eOut, rcv)
+ }
+ opts = nil
+ rcv, err = GetRoutePaginatorFromOpts(opts)
+ if err != nil {
+ t.Error(err)
+ }
+ if !reflect.DeepEqual(eOut, rcv) {
+ t.Errorf("Expecting: %+v, received: %+v", eOut, rcv)
+ }
+ //normal check
+ opts = map[string]any{
+ utils.OptsRoutesLimit: 18,
+ utils.OptsRoutesOffset: 20,
+ }
+
+ eOut = utils.Paginator{
+ Limit: utils.IntPointer(18),
+ Offset: utils.IntPointer(20),
+ }
+ rcv, err = GetRoutePaginatorFromOpts(opts)
+ if err != nil {
+ t.Error(err)
+ }
+ //check if *rouLimit and *rouOffset was deleted
+ if _, has := opts[utils.OptsRoutesLimit]; has {
+ t.Errorf("*rouLimit wasn't deleted")
+ } else if _, has := opts[utils.OptsRoutesOffset]; has {
+ t.Errorf("*rouOffset wasn't deleted")
+ }
+ if !reflect.DeepEqual(eOut, rcv) {
+ t.Errorf("Expecting: %+v, received: %+v", eOut, rcv)
+ }
+ //check without *rouLimit, but with *rouOffset
+ opts = map[string]any{
+ utils.OptsRoutesOffset: 20,
+ }
+
+ eOut = utils.Paginator{
+ Offset: utils.IntPointer(20),
+ }
+ rcv, err = GetRoutePaginatorFromOpts(opts)
+ if err != nil {
+ t.Error(err)
+ }
+ //check if *rouLimit and *rouOffset was deleted
+ if _, has := opts[utils.OptsRoutesLimit]; has {
+ t.Errorf("*rouLimit wasn't deleted")
+ } else if _, has := opts[utils.OptsRoutesOffset]; has {
+ t.Errorf("*rouOffset wasn't deleted")
+ }
+ if !reflect.DeepEqual(eOut, rcv) {
+ t.Errorf("Expecting: %+v, received: %+v", eOut, rcv)
+ }
+ //check with notAnInt at *rouLimit
+ opts = map[string]any{
+ utils.OptsRoutesLimit: "Not an int",
+ }
+ eOut = utils.Paginator{}
+ rcv, err = GetRoutePaginatorFromOpts(opts)
+ if err == nil {
+ t.Error("Expected error")
+ }
+ if !reflect.DeepEqual(eOut, rcv) {
+ t.Errorf("Expecting: %+v, received: %+v", eOut, rcv)
+ }
+ //check with notAnInt at and *rouOffset
+ opts = map[string]any{
+ utils.OptsRoutesOffset: "Not an int",
+ }
+ eOut = utils.Paginator{}
+ rcv, err = GetRoutePaginatorFromOpts(opts)
+ if err == nil {
+ t.Error("Expected error")
+ }
+ if !reflect.DeepEqual(eOut, rcv) {
+ t.Errorf("Expecting: %+v, received: %+v", eOut, rcv)
+ }
+}
+
+func TestCGREventconsumeRoutePaginatorCase1(t *testing.T) {
+ opts := map[string]any{}
+ if _, err := GetRoutePaginatorFromOpts(opts); err != nil {
+ t.Error(err)
+ }
+}
+
+func TestCGREventOptAsInt64(t *testing.T) {
+ ev := &CGREvent{
+ APIOpts: map[string]any{
+ "testKey": "13",
+ },
+ }
+
+ received, err := ev.OptAsInt64("testKey")
+ if err != nil {
+ t.Errorf("\nExpected: <%+v>, \nReceived: <%+v>", nil, err)
+ }
+ expected := int64(13)
+
+ if received != expected {
+ t.Errorf("\nExpected: %q, \nReceived: %q", expected, received)
+ }
+ errExpect := utils.ErrNotFound
+ if _, err = ev.OptAsInt64("nonExistingKey"); err == nil || err != errExpect {
+ t.Errorf("\nExpected: <%+v>, \nReceived: <%+v>", errExpect, err)
+ }
+}
+
+func TestCGREventFieldAsInt64(t *testing.T) {
+ se := &CGREvent{
+ Tenant: "cgrates.org",
+ ID: "supplierEvent1",
+ Event: map[string]any{
+ utils.AnswerTime: time.Now(),
+ "supplierprofile1": "Supplier",
+ "UsageInterval": "54",
+ "PddInterval": "1s",
+ "Weight": 20,
+ },
+ }
+ answ, err := se.FieldAsInt64("UsageInterval")
+ if err != nil {
+ t.Error(err)
+ }
+ if answ != int64(54) {
+ t.Errorf("Expecting: %+v, received: %+v", se.Event["UsageInterval"], answ)
+ }
+ answ, err = se.FieldAsInt64("Weight")
+ if err != nil {
+ t.Error(err)
+ }
+ if answ != int64(20) {
+ t.Errorf("Expecting: %+v, received: %+v", se.Event["Weight"], answ)
+ }
+ answ, err = se.FieldAsInt64("PddInterval")
+ if err == nil || err.Error() != `strconv.ParseInt: parsing "1s": invalid syntax` {
+ t.Errorf("Expected %s, received %s", `strconv.ParseInt: parsing "1s": invalid syntax`, err)
+ }
+ if answ != 0 {
+ t.Errorf("Expecting: %+v, received: %+v", 0, answ)
+ }
+
+ if _, err := se.FieldAsInt64(utils.AnswerTime); err == nil || !strings.HasPrefix(err.Error(), "cannot convert field") {
+ t.Errorf("Unexpected error : %+v", err)
+ }
+ if _, err := se.FieldAsInt64(utils.AccountField); err == nil || err.Error() != utils.ErrNotFound.Error() {
+ t.Errorf("Expected %s, received %s", utils.ErrNotFound, err)
+ }
+ // }
+}
+
+func TestCGREventOptAsStringEmpty(t *testing.T) {
+ ev := &CGREvent{}
+
+ expstr := ""
+ experr := utils.ErrNotFound
+ received, err := ev.OptAsString("testString")
+
+ if !reflect.DeepEqual(received, expstr) {
+ t.Errorf("\nExpected: %q, \nReceived: %q", expstr, received)
+ }
+ if err == nil || err != experr {
+ t.Errorf("\nExpected: %q, \nReceived: %q", experr, err)
+ }
+}
+
+func TestCGREventOptAsString(t *testing.T) {
+ ev := &CGREvent{
+ APIOpts: map[string]any{
+ "testKey": 13,
+ },
+ }
+
+ received, err := ev.OptAsString("testKey")
+ if err != nil {
+ t.Errorf("\nExpected: <%+v>, \nReceived: <%+v>", nil, err)
+ }
+ expected := "13"
+
+ if received != expected {
+ t.Errorf("\nExpected: %q, \nReceived: %q", expected, received)
+ }
+}
+
+func TestCGREventOptAsDurationEmpty(t *testing.T) {
+ ev := &CGREvent{}
+
+ var expdur time.Duration
+ experr := utils.ErrNotFound
+ received, err := ev.OptAsDuration("testString")
+
+ if !reflect.DeepEqual(received, expdur) {
+ t.Errorf("\nExpected: <%+v>, \nReceived: <%+v>", expdur, received)
+ }
+ if err == nil || err != experr {
+ t.Errorf("\nExpected: %q, \nReceived: %q", experr, err)
+ }
+}
+
+func TestCGREventOptAsDuration(t *testing.T) {
+ ev := &CGREvent{
+ APIOpts: map[string]any{
+ "testKey": 30,
+ },
+ }
+
+ received, err := ev.OptAsDuration("testKey")
+ if err != nil {
+ t.Errorf("\nExpected: <%+v>, \nReceived: <%+v>", nil, err)
+ }
+ expected := 30 * time.Nanosecond
+
+ if received != expected {
+ t.Errorf("\nExpected: <%+v>, \nReceived: <%+v>", expected, received)
+ }
+}
+
+func TestCGREventAsDataProvider(t *testing.T) {
+ ev := &CGREvent{
+ APIOpts: map[string]any{
+ "testKey1": 13,
+ "testKey2": "testString1",
+ },
+ Event: map[string]any{
+ "testKey1": 30,
+ "testKey2": "testString2",
+ },
+ }
+
+ expected := utils.MapStorage{
+ utils.MetaOpts: ev.APIOpts,
+ utils.MetaReq: ev.Event,
+ }
+
+ received := ev.AsDataProvider()
+
+ if !reflect.DeepEqual(expected, received) {
+ t.Errorf("\nExpected: <%+v>, \nReceived: <%+v>", expected, received)
+ }
+}
+
+func TestNMAsCGREvent(t *testing.T) {
+ if cgrEv := NMAsCGREvent(nil, "cgrates.org",
+ utils.NestingSep, nil); cgrEv != nil {
+ t.Errorf("expecting: %+v, \nreceived: %+v", utils.ToJSON(nil), utils.ToJSON(cgrEv.Event))
+ }
+
+ nM := utils.NewOrderedNavigableMap()
+ if cgrEv := NMAsCGREvent(nM, "cgrates.org",
+ utils.NestingSep, nil); cgrEv != nil {
+ t.Errorf("expecting: %+v, \nreceived: %+v", utils.ToJSON(nil), utils.ToJSON(cgrEv.Event))
+ }
+
+ path := []string{"FirstLevel", "SecondLevel", "ThirdLevel", "Fld1"}
+ if err := nM.SetAsSlice(&utils.FullPath{Path: strings.Join(path, utils.NestingSep), PathSlice: path}, []*utils.DataNode{
+ {Type: utils.NMDataType, Value: &utils.DataLeaf{
+ Data: "Val1",
+ }}}); err != nil {
+ t.Error(err)
+ }
+
+ path = []string{"FirstLevel2", "SecondLevel2", "Field2"}
+ if err := nM.SetAsSlice(&utils.FullPath{Path: strings.Join(path, utils.NestingSep), PathSlice: path}, []*utils.DataNode{
+ {Type: utils.NMDataType, Value: &utils.DataLeaf{
+ Data: "attrVal1",
+ AttributeID: "attribute1",
+ }},
+ {Type: utils.NMDataType, Value: &utils.DataLeaf{
+ Data: "Value2",
+ }}}); err != nil {
+ t.Error(err)
+ }
+
+ path = []string{"FirstLevel2", "Field3"}
+ if err := nM.SetAsSlice(&utils.FullPath{Path: strings.Join(path, utils.NestingSep), PathSlice: path}, []*utils.DataNode{
+ {Type: utils.NMDataType, Value: &utils.DataLeaf{
+ Data: "Value3",
+ }}}); err != nil {
+ t.Error(err)
+ }
+
+ path = []string{"FirstLevel2", "Field5"}
+ if err := nM.SetAsSlice(&utils.FullPath{Path: strings.Join(path, utils.NestingSep), PathSlice: path}, []*utils.DataNode{
+ {Type: utils.NMDataType, Value: &utils.DataLeaf{
+ Data: "Value5",
+ }},
+ {Type: utils.NMDataType, Value: &utils.DataLeaf{
+ Data: "attrVal5",
+ AttributeID: "attribute5",
+ }}}); err != nil {
+ t.Error(err)
+ }
+
+ path = []string{"FirstLevel2", "Field6"}
+ if err := nM.SetAsSlice(&utils.FullPath{Path: strings.Join(path, utils.NestingSep), PathSlice: path}, []*utils.DataNode{
+ {Type: utils.NMDataType, Value: &utils.DataLeaf{
+ Data: "Value6",
+ NewBranch: true,
+ }},
+ {Type: utils.NMDataType, Value: &utils.DataLeaf{
+ Data: "attrVal6",
+ AttributeID: "attribute6",
+ }}}); err != nil {
+ t.Error(err)
+ }
+
+ path = []string{"Field4"}
+ if err := nM.SetAsSlice(&utils.FullPath{Path: strings.Join(path, utils.NestingSep), PathSlice: path}, []*utils.DataNode{
+ {Type: utils.NMDataType, Value: &utils.DataLeaf{
+ Data: "Val4",
+ }},
+ {Type: utils.NMDataType, Value: &utils.DataLeaf{
+ Data: "attrVal2",
+ AttributeID: "attribute2",
+ }}}); err != nil {
+ t.Error(err)
+ }
+ eEv := map[string]any{
+ "FirstLevel2.SecondLevel2.Field2": "Value2",
+ "FirstLevel.SecondLevel.ThirdLevel.Fld1": "Val1",
+ "FirstLevel2.Field3": "Value3",
+ "FirstLevel2.Field5": "Value5",
+ "FirstLevel2.Field6": "Value6",
+ "Field4": "Val4",
+ }
+ if cgrEv := NMAsCGREvent(nM, "cgrates.org",
+ utils.NestingSep, utils.MapStorage{}); cgrEv.Tenant != "cgrates.org" ||
+ cgrEv.Time == nil ||
+ !reflect.DeepEqual(eEv, cgrEv.Event) {
+ t.Errorf("expecting: %+v, \nreceived: %+v", utils.ToJSON(eEv), utils.ToJSON(cgrEv.Event))
+ }
+}
+
+func TestCGREventRPCClone(t *testing.T) {
+ att := &CGREvent{
+ Tenant: "cgrates.org",
+ ID: "234",
+ clnb: false,
+ Time: utils.TimePointer(time.Date(2013, 12, 30, 15, 0, 1, 0, time.UTC)),
+ Event: map[string]any{
+ "key": "value",
+ },
+ APIOpts: map[string]any{
+ "rand": "we",
+ },
+ }
+
+ if rec, _ := att.RPCClone(); !reflect.DeepEqual(rec, att) {
+ t.Errorf("expected %v and received %v ", utils.ToJSON(att), utils.ToJSON(rec))
+
+ }
+
+ att.SetCloneable(true)
+ if att.clnb != true {
+ t.Error("expected true")
+ }
+ rec, _ := att.RPCClone()
+ att.SetCloneable(false)
+ if !reflect.DeepEqual(rec, att) {
+ t.Errorf("expected %v and received %v ", att, rec)
+
+ }
+
+}
+
+func TestOptionsGetFloat64Opts(t *testing.T) {
+
+ // option key not populated, retrieve default value
+ ev := &CGREvent{
+ APIOpts: make(map[string]any),
+ }
+ if rcv, err := GetFloat64Opts(ev, 1.2, "optionName"); err != nil {
+ t.Error(err)
+ } else if rcv != 1.2 {
+ t.Errorf("expected: <%+v>, \nreceived: <%+v>", 1.2, rcv)
+ }
+
+ // option key populated with valid input, get its value
+ ev.APIOpts["optionName"] = 0.11
+ if rcv, err := GetFloat64Opts(ev, 1.2, "optionName"); err != nil {
+ t.Error(err)
+ } else if rcv != 0.11 {
+ t.Errorf("expected: <%+v>, \nreceived: <%+v>", 0.11, rcv)
+ }
+
+ // option key populated with invalid input, receive error
+ expectedErr := `strconv.ParseFloat: parsing "invalid": invalid syntax`
+ ev.APIOpts["optionName"] = "invalid"
+ if _, err := GetFloat64Opts(ev, 1.2, "optionName"); err == nil ||
+ err.Error() != expectedErr {
+ t.Errorf("expected: <%+v>, \nreceived: <%+v>", expectedErr, err)
+ }
+}
+
+func TestOptionsGetDurationOpts(t *testing.T) {
+
+ // option key not populated, retrieve default value
+ ev := &CGREvent{
+ APIOpts: make(map[string]any),
+ }
+ if rcv, err := GetDurationOpts(ev, time.Minute, "optionName"); err != nil {
+ t.Error(err)
+ } else if rcv != time.Minute {
+ t.Errorf("expected: <%+v>, \nreceived: <%+v>", time.Minute, rcv)
+ }
+
+ // option key populated with valid input, get its value
+ ev.APIOpts["optionName"] = 2 * time.Second
+ if rcv, err := GetDurationOpts(ev, time.Minute, "optionName"); err != nil {
+ t.Error(err)
+ } else if rcv != 2*time.Second {
+ t.Errorf("expected: <%+v>, \nreceived: <%+v>", 2*time.Second, rcv)
+ }
+ ev.APIOpts["optionName"] = 600
+ if rcv, err := GetDurationOpts(ev, time.Minute, "optionName"); err != nil {
+ t.Error(err)
+ } else if rcv != 600 {
+ t.Errorf("expected: <%+v>, \nreceived: <%+v>", 600, rcv)
+ }
+ ev.APIOpts["optionName"] = "2m0s"
+ if rcv, err := GetDurationOpts(ev, time.Minute, "optionName"); err != nil {
+ t.Error(err)
+ } else if rcv != 2*time.Minute {
+ t.Errorf("expected: <%+v>, \nreceived: <%+v>", 2*time.Minute, rcv)
+ }
+
+ // option key populated with invalid input, receive error
+ expectedErr := `time: invalid duration "invalid"`
+ ev.APIOpts["optionName"] = "invalid"
+ if _, err := GetDurationOpts(ev, time.Minute, "optionName"); err == nil ||
+ err.Error() != expectedErr {
+ t.Errorf("expected: <%+v>, \nreceived: <%+v>", expectedErr, err)
+ }
+}
+
+func TestOptionsGetStringOpts(t *testing.T) {
+
+ // option key not populated, retrieve default value
+ ev := &CGREvent{
+ APIOpts: make(map[string]any),
+ }
+ if rcv := GetStringOpts(ev, "default", "optionName"); rcv != "default" {
+ t.Errorf("expected: <%+v>, \nreceived: <%+v>", "default", rcv)
+ }
+
+ // option key populated, get its value
+ ev.APIOpts["optionName"] = "optionValue"
+ if rcv := GetStringOpts(ev, "default", "optionName"); rcv != "optionValue" {
+ t.Errorf("expected: <%+v>, \nreceived: <%+v>", "optionValue", rcv)
+ }
+ ev.APIOpts["optionName"] = false
+ if rcv := GetStringOpts(ev, "default", "optionName"); rcv != "false" {
+ t.Errorf("expected: <%+v>, \nreceived: <%+v>", "false", rcv)
+ }
+ ev.APIOpts["optionName"] = 5 * time.Minute
+ if rcv := GetStringOpts(ev, "default", "optionName"); rcv != "5m0s" {
+ t.Errorf("expected: <%+v>, \nreceived: <%+v>", "5m0s", rcv)
+ }
+ ev.APIOpts["optionName"] = 12.34
+ if rcv := GetStringOpts(ev, "default", "optionName"); rcv != "12.34" {
+ t.Errorf("expected: <%+v>, \nreceived: <%+v>", "12.34", rcv)
+ }
+}
+
+func TestOptionsGetStringSliceOpts(t *testing.T) {
+
+ // option key not populated, retrieve default value
+ ev := &CGREvent{
+ APIOpts: make(map[string]any),
+ }
+ defaultValue := []string{"default"}
+ if rcv, err := GetStringSliceOpts(ev, defaultValue, "optionName"); err != nil {
+ t.Error(err)
+ } else if !reflect.DeepEqual(rcv, defaultValue) {
+ t.Errorf("expected: <%+v>, \nreceived: <%+v>", defaultValue, rcv)
+ }
+
+ // option key populated with valid input, get its value
+ optValue := []string{"optValue"}
+ ev.APIOpts["optionName"] = optValue
+ if rcv, err := GetStringSliceOpts(ev, defaultValue, "optionName"); err != nil {
+ t.Error(err)
+ } else if !reflect.DeepEqual(rcv, optValue) {
+ t.Errorf("expected: <%+v>, \nreceived: <%+v>", optValue, rcv)
+ }
+ optValue2 := []string{"true", "false"}
+ ev.APIOpts["optionName"] = []bool{true, false}
+ if rcv, err := GetStringSliceOpts(ev, defaultValue, "optionName"); err != nil {
+ t.Error(err)
+ } else if !reflect.DeepEqual(rcv, optValue2) {
+ t.Errorf("expected: <%+v>, \nreceived: <%+v>", optValue2, rcv)
+ }
+ optValue3 := []string{"12.34", "3"}
+ ev.APIOpts["optionName"] = []float64{12.34, 3}
+ if rcv, err := GetStringSliceOpts(ev, defaultValue, "optionName"); err != nil {
+ t.Error(err)
+ } else if !reflect.DeepEqual(rcv, optValue3) {
+ t.Errorf("expected: <%+v>, \nreceived: <%+v>", optValue3, rcv)
+ }
+
+ // option key populated with invalid input, receive error
+ expectedErr := `cannot convert field: string to []string`
+ ev.APIOpts["optionName"] = "invalid"
+ if _, err := GetStringSliceOpts(ev, defaultValue, "optionName"); err == nil ||
+ err.Error() != expectedErr {
+ t.Errorf("expected: <%+v>, \nreceived: <%+v>", expectedErr, err)
+ }
+}
+
+func TestOptionsGetIntOpts(t *testing.T) {
+
+ // option key not populated, retrieve default value
+ ev := &CGREvent{
+ APIOpts: make(map[string]any),
+ }
+ if rcv, err := GetIntOpts(ev, 5, "optionName"); err != nil {
+ t.Error(err)
+ } else if rcv != 5 {
+ t.Errorf("expected: <%+v>, \nreceived: <%+v>", 5, rcv)
+ }
+
+ // option key populated with valid input, get its value
+ ev.APIOpts["optionName"] = 12
+ if rcv, err := GetIntOpts(ev, 5, "optionName"); err != nil {
+ t.Error(err)
+ } else if rcv != 12 {
+ t.Errorf("expected: <%+v>, \nreceived: <%+v>", 12, rcv)
+ }
+ ev.APIOpts["optionName"] = 12.7
+ if rcv, err := GetIntOpts(ev, 5, "optionName"); err != nil {
+ t.Error(err)
+ } else if rcv != 12 {
+ t.Errorf("expected: <%+v>, \nreceived: <%+v>", 12, rcv)
+ }
+
+ // option key populated with invalid input, receive error
+ expectedErr := `strconv.ParseInt: parsing "invalid": invalid syntax`
+ ev.APIOpts["optionName"] = "invalid"
+ if _, err := GetIntOpts(ev, 5, "optionName"); err == nil ||
+ err.Error() != expectedErr {
+ t.Errorf("expected: <%+v>, \nreceived: <%+v>", expectedErr, err)
+ }
+}
+
+func TestOptionsGetBoolOpts(t *testing.T) {
+
+ // option key not populated, retrieve default value
+ ev := &CGREvent{
+ APIOpts: make(map[string]any),
+ }
+ if rcv, err := GetBoolOpts(ev, false, "optionName"); err != nil {
+ t.Error(err)
+ } else if rcv != false {
+ t.Errorf("expected: <%+v>, \nreceived: <%+v>", false, rcv)
+ }
+
+ // option key populated with valid input, get its value
+ ev.APIOpts["optionName"] = true
+ if rcv, err := GetBoolOpts(ev, false, "optionName"); err != nil {
+ t.Error(err)
+ } else if rcv != true {
+ t.Errorf("expected: <%+v>, \nreceived: <%+v>", true, rcv)
+ }
+ ev.APIOpts["optionName"] = 5
+ if rcv, err := GetBoolOpts(ev, false, "optionName"); err != nil {
+ t.Error(err)
+ } else if rcv != true {
+ t.Errorf("expected: <%+v>, \nreceived: <%+v>", true, rcv)
+ }
+ ev.APIOpts["optionName"] = "true"
+ if rcv, err := GetBoolOpts(ev, false, "optionName"); err != nil {
+ t.Error(err)
+ } else if rcv != true {
+ t.Errorf("expected: <%+v>, \nreceived: <%+v>", true, rcv)
+ }
+
+ // option key populated with invalid input, receive error
+ expectedErr := `strconv.ParseBool: parsing "invalid": invalid syntax`
+ ev.APIOpts["optionName"] = "invalid"
+ if _, err := GetBoolOpts(ev, false, "optionName"); err == nil ||
+ err.Error() != expectedErr {
+ t.Errorf("expected: <%+v>, \nreceived: <%+v>", expectedErr, err)
+ }
+}
+
+func TestOptionsGetInterfaceOpts(t *testing.T) {
+
+ // option key not populated, retrieve default value
+ ev := &CGREvent{
+ APIOpts: make(map[string]any),
+ }
+ if rcv := GetInterfaceOpts(ev, "default", "optionName"); rcv != "default" {
+ t.Errorf("expected: <%+v>, \nreceived: <%+v>", "default", rcv)
+ }
+
+ // option key populated, get its value
+ ev.APIOpts["optionName"] = 0.11
+ if rcv := GetInterfaceOpts(ev, "default", "optionName"); rcv != 0.11 {
+ t.Errorf("expected: <%+v>, \nreceived: <%+v>", 0.11, rcv)
+ }
+ ev.APIOpts["optionName"] = true
+ if rcv := GetInterfaceOpts(ev, "default", "optionName"); rcv != true {
+ t.Errorf("expected: <%+v>, \nreceived: <%+v>", true, rcv)
+ }
+ ev.APIOpts["optionName"] = 5 * time.Minute
+ if rcv := GetInterfaceOpts(ev, "default", "optionName"); rcv != 5*time.Minute {
+ t.Errorf("expected: <%+v>, \nreceived: <%+v>", 5*time.Minute, rcv)
+ }
+}
+
+func TestOptionsGetIntPointerOpts(t *testing.T) {
+ defaultValue := utils.IntPointer(5)
+
+ // option key not populated, retrieve default value
+ ev := &CGREvent{
+ APIOpts: make(map[string]any),
+ }
+ if rcv, err := GetIntPointerOpts(ev, defaultValue, "optionName"); err != nil {
+ t.Error(err)
+ } else if rcv == nil || rcv != defaultValue {
+ t.Errorf("expected: <%+v>, \nreceived: <%+v>", defaultValue, rcv)
+ }
+
+ // option key populated with valid input, get its value
+ ev.APIOpts["optionName"] = 12
+ if rcv, err := GetIntPointerOpts(ev, defaultValue, "optionName"); err != nil {
+ t.Error(err)
+ } else if rcv == nil || *rcv != 12 {
+ t.Errorf("expected: <%+v>, \nreceived: <%+v>", 12, rcv)
+ }
+ ev.APIOpts["optionName"] = 12.7
+ if rcv, err := GetIntPointerOpts(ev, defaultValue, "optionName"); err != nil {
+ t.Error(err)
+ } else if rcv == nil || *rcv != 12 {
+ t.Errorf("expected: <%+v>, \nreceived: <%+v>", 12, rcv)
+ }
+
+ // option key populated with invalid input, receive error
+ expectedErr := `strconv.ParseInt: parsing "invalid": invalid syntax`
+ ev.APIOpts["optionName"] = "invalid"
+ if _, err := GetIntPointerOpts(ev, defaultValue, "optionName"); err == nil ||
+ err.Error() != expectedErr {
+ t.Errorf("expected: <%+v>, \nreceived: <%+v>", expectedErr, err)
+ }
+}
+
+func TestOptionsGetDurationPointerOpts(t *testing.T) {
+ defaultValue := utils.DurationPointer(time.Minute)
+ // option key not populated, retrieve default value
+ ev := &CGREvent{
+ APIOpts: make(map[string]any),
+ }
+ if rcv, err := GetDurationPointerOpts(ev, defaultValue, "optionName"); err != nil {
+ t.Error(err)
+ } else if rcv == nil || rcv != defaultValue {
+ t.Errorf("expected: <%+v>, \nreceived: <%+v>", defaultValue, rcv)
+ }
+
+ // option key populated with valid input, get its value
+ ev.APIOpts["optionName"] = 2 * time.Second
+ if rcv, err := GetDurationPointerOpts(ev, defaultValue, "optionName"); err != nil {
+ t.Error(err)
+ } else if rcv == nil || *rcv != 2*time.Second {
+ t.Errorf("expected: <%+v>, \nreceived: <%+v>", 2*time.Second, rcv)
+ }
+ ev.APIOpts["optionName"] = 600
+ if rcv, err := GetDurationPointerOpts(ev, defaultValue, "optionName"); err != nil {
+ t.Error(err)
+ } else if rcv == nil || *rcv != 600 {
+ t.Errorf("expected: <%+v>, \nreceived: <%+v>", 600, rcv)
+ }
+ ev.APIOpts["optionName"] = "2m0s"
+ if rcv, err := GetDurationPointerOpts(ev, defaultValue, "optionName"); err != nil {
+ t.Error(err)
+ } else if rcv == nil || *rcv != 2*time.Minute {
+ t.Errorf("expected: <%+v>, \nreceived: <%+v>", 2*time.Minute, rcv)
+ }
+
+ // option key populated with invalid input, receive error
+ expectedErr := `time: invalid duration "invalid"`
+ ev.APIOpts["optionName"] = "invalid"
+ if _, err := GetDurationPointerOpts(ev, defaultValue, "optionName"); err == nil ||
+ err.Error() != expectedErr {
+ t.Errorf("expected: <%+v>, \nreceived: <%+v>", expectedErr, err)
+ }
+}
+
+func TestOptionsGetDecimalBigOpts(t *testing.T) {
+ defaultValue := decimal.New(1234, 3)
+
+ // option key not populated, retrieve default value
+ ev := &CGREvent{
+ APIOpts: make(map[string]any),
+ }
+ if rcv, err := GetDecimalBigOpts(ev, defaultValue, "optionName"); err != nil {
+ t.Error(err)
+ } else if rcv.Cmp(defaultValue) != 0 {
+ t.Errorf("expected: <%+v>, \nreceived: <%+v>", defaultValue, rcv)
+ }
+
+ // option key populated with valid input, get its value
+ optValue := decimal.New(15, 1)
+ ev.APIOpts["optionName"] = 1.5
+ if rcv, err := GetDecimalBigOpts(ev, defaultValue, "optionName"); err != nil {
+ t.Error(err)
+ } else if rcv.Cmp(optValue) != 0 {
+ t.Errorf("expected: <%+v>, \nreceived: <%+v>", optValue, rcv)
+ }
+ ev.APIOpts["optionName"] = "1.5"
+ if rcv, err := GetDecimalBigOpts(ev, defaultValue, "optionName"); err != nil {
+ t.Error(err)
+ } else if rcv.Cmp(optValue) != 0 {
+ t.Errorf("expected: <%+v>, \nreceived: <%+v>", optValue, rcv)
+ }
+
+ // option key populated with invalid input, receive error
+ expectedErr := `can't convert to decimal`
+ ev.APIOpts["optionName"] = "invalid"
+ if _, err := GetDecimalBigOpts(ev, defaultValue, "optionName"); err == nil ||
+ err.Error() != expectedErr {
+ t.Errorf("expected: <%+v>, \nreceived: <%+v>", expectedErr, err)
+ }
+}
diff --git a/engine/chargers.go b/engine/chargers.go
index 3f21351df..27d5de8dc 100644
--- a/engine/chargers.go
+++ b/engine/chargers.go
@@ -47,7 +47,7 @@ func (cS *ChargerService) Shutdown() {
}
// matchingChargingProfilesForEvent returns ordered list of matching chargers which are active by the time of the function call
-func (cS *ChargerService) matchingChargerProfilesForEvent(tnt string, cgrEv *utils.CGREvent) (cPs ChargerProfiles, err error) {
+func (cS *ChargerService) matchingChargerProfilesForEvent(tnt string, cgrEv *CGREvent) (cPs ChargerProfiles, err error) {
evNm := utils.MapStorage{
utils.MetaReq: cgrEv.Event,
utils.MetaOpts: cgrEv.APIOpts,
@@ -102,10 +102,10 @@ type ChrgSProcessEventReply struct {
ChargerSProfile string
AttributeSProfiles []string
AlteredFields []string
- CGREvent *utils.CGREvent
+ CGREvent *CGREvent
}
-func (cS *ChargerService) processEvent(tnt string, cgrEv *utils.CGREvent) (rply []*ChrgSProcessEventReply, err error) {
+func (cS *ChargerService) processEvent(tnt string, cgrEv *CGREvent) (rply []*ChrgSProcessEventReply, err error) {
var cPs ChargerProfiles
if cPs, err = cS.matchingChargerProfilesForEvent(tnt, cgrEv); err != nil {
return nil, err
@@ -150,7 +150,7 @@ func (cS *ChargerService) processEvent(tnt string, cgrEv *utils.CGREvent) (rply
}
// V1ProcessEvent will process the event received via API and return list of events forked
-func (cS *ChargerService) V1ProcessEvent(ctx *context.Context, args *utils.CGREvent,
+func (cS *ChargerService) V1ProcessEvent(ctx *context.Context, args *CGREvent,
reply *[]*ChrgSProcessEventReply) (err error) {
if args == nil ||
args.Event == nil {
@@ -172,7 +172,7 @@ func (cS *ChargerService) V1ProcessEvent(ctx *context.Context, args *utils.CGREv
}
// V1GetChargersForEvent exposes the list of ordered matching ChargingProfiles for an event
-func (cS *ChargerService) V1GetChargersForEvent(ctx *context.Context, args *utils.CGREvent,
+func (cS *ChargerService) V1GetChargersForEvent(ctx *context.Context, args *CGREvent,
rply *ChargerProfiles) (err error) {
tnt := args.Tenant
if tnt == utils.EmptyString {
diff --git a/engine/chargers_test.go b/engine/chargers_test.go
index 0caa1a771..36e20d9a3 100644
--- a/engine/chargers_test.go
+++ b/engine/chargers_test.go
@@ -182,7 +182,7 @@ func TestChargerMatchingChargerProfilesForEvent(t *testing.T) {
Weight: 20,
},
}
- chargerEvents := []*utils.CGREvent{
+ chargerEvents := []*CGREvent{
{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
@@ -349,7 +349,7 @@ func TestChargerProcessEvent(t *testing.T) {
Weight: 20,
},
}
- chargerEvents := []*utils.CGREvent{
+ chargerEvents := []*CGREvent{
{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
@@ -512,7 +512,7 @@ func TestChargersmatchingChargerProfilesForEventChargerProfileNotFound(t *testin
},
cfg: cfg,
}
- cgrEv := &utils.CGREvent{
+ cgrEv := &CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: "cgrEvID",
Event: map[string]any{
@@ -558,7 +558,7 @@ func TestChargersmatchingChargerProfilesForEventDoesNotPass(t *testing.T) {
},
cfg: cfg,
}
- cgrEv := &utils.CGREvent{
+ cgrEv := &CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: "cgrEvID",
Event: map[string]any{
@@ -608,7 +608,7 @@ func TestChargersmatchingChargerProfilesForEventErrGetChPrf(t *testing.T) {
},
cfg: cfg,
}
- cgrEv := &utils.CGREvent{
+ cgrEv := &CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: "cgrEvID",
Event: map[string]any{
@@ -640,7 +640,7 @@ func TestChargersprocessEvent(t *testing.T) {
cS := &ChargerService{
cfg: cfg,
}
- cgrEv := &utils.CGREvent{
+ cgrEv := &CGREvent{
Tenant: "cgrates.org",
APIOpts: map[string]any{
utils.OptsAttributesProcessRuns: 2,
@@ -661,7 +661,7 @@ func TestChargersprocessEvent(t *testing.T) {
func TestChargersV1ProcessEventMissingArgs(t *testing.T) {
cS := &ChargerService{}
- args := &utils.CGREvent{}
+ args := &CGREvent{}
var reply *[]*ChrgSProcessEventReply
experr := "MANDATORY_IE_MISSING: [Event]"
diff --git a/engine/dispatcherprfl_test.go b/engine/dispatcherprfl_test.go
index 497e149e5..38a43dd77 100644
--- a/engine/dispatcherprfl_test.go
+++ b/engine/dispatcherprfl_test.go
@@ -243,12 +243,12 @@ func TestDispatcherHostCall(t *testing.T) {
dspHost := &DispatcherHost{}
etRPC := &testRPCHost{
serviceMethod: utils.AttributeSv1Ping,
- args: &utils.CGREvent{},
+ args: &CGREvent{},
reply: utils.StringPointer(""),
}
var reply string
dspHost.rpcConn = tRPC
- if err := dspHost.Call(context.Background(), utils.AttributeSv1Ping, &utils.CGREvent{}, &reply); err != nil {
+ if err := dspHost.Call(context.Background(), utils.AttributeSv1Ping, &CGREvent{}, &reply); err != nil {
t.Error(err)
} else if !reflect.DeepEqual(*etRPC, *tRPC) {
t.Errorf("Expected: %s , received: %s", utils.ToJSON(etRPC), utils.ToJSON(tRPC))
@@ -335,7 +335,7 @@ func TestDispatcherHostCallErr(t *testing.T) {
},
}
var reply string
- if err := dH.Call(context.Background(), utils.AttributeSv1Ping, &utils.CGREvent{}, &reply); err == nil || err.Error() != "dial tcp: missing address" {
+ if err := dH.Call(context.Background(), utils.AttributeSv1Ping, &CGREvent{}, &reply); err == nil || err.Error() != "dial tcp: missing address" {
t.Error(err)
}
}
diff --git a/engine/libengine.go b/engine/libengine.go
index 925b1af8c..771701864 100644
--- a/engine/libengine.go
+++ b/engine/libengine.go
@@ -303,7 +303,7 @@ func (s IntService) Call(ctx *context.Context, serviceMethod string, args, reply
return service.Call(ctx, serviceMethod, args, reply)
}
-func ping(_ any, _ *context.Context, _ *utils.CGREvent, reply *string) error {
+func ping(_ any, _ *context.Context, _ *CGREvent, reply *string) error {
*reply = utils.Pong
return nil
}
@@ -314,7 +314,7 @@ var pingM = &birpc.MethodType{
Type: reflect.TypeOf(ping),
Func: reflect.ValueOf(ping),
},
- ArgType: reflect.TypeOf(new(utils.CGREvent)),
+ ArgType: reflect.TypeOf(new(CGREvent)),
ReplyType: reflect.TypeOf(new(string)),
}
diff --git a/engine/libroutes.go b/engine/libroutes.go
index a5e511429..85467c787 100644
--- a/engine/libroutes.go
+++ b/engine/libroutes.go
@@ -219,7 +219,7 @@ func (sRoutes *SortedRoutes) AsNavigableMap() (nm *utils.DataNode) {
// RoutesSorter is the interface which needs to be implemented by routes sorters
type RoutesSorter interface {
- SortRoutes(string, map[string]*Route, *utils.CGREvent, *optsGetRoutes) (*SortedRoutes, error)
+ SortRoutes(string, map[string]*Route, *CGREvent, *optsGetRoutes) (*SortedRoutes, error)
}
// NewRouteSortDispatcher constructs RouteSortDispatcher
@@ -240,7 +240,7 @@ func NewRouteSortDispatcher(lcrS *RouteService) (rsd RouteSortDispatcher) {
type RouteSortDispatcher map[string]RoutesSorter
func (ssd RouteSortDispatcher) SortRoutes(prflID, strategy string,
- suppls map[string]*Route, suplEv *utils.CGREvent, extraOpts *optsGetRoutes) (sortedRoutes *SortedRoutes, err error) {
+ suppls map[string]*Route, suplEv *CGREvent, extraOpts *optsGetRoutes) (sortedRoutes *SortedRoutes, err error) {
sd, has := ssd[strategy]
if !has {
return nil, fmt.Errorf("unsupported sorting strategy: %s", strategy)
diff --git a/engine/libroutes_test.go b/engine/libroutes_test.go
index e0ea3eaae..f978ddd50 100644
--- a/engine/libroutes_test.go
+++ b/engine/libroutes_test.go
@@ -1676,7 +1676,7 @@ func TestSortedRoutesListDigest(t *testing.T) {
func TestRouteSortDispatcher(t *testing.T) {
ssd := RouteSortDispatcher{}
strategy := "strategy"
- if _, err := ssd.SortRoutes("prfID", strategy, map[string]*Route{}, &utils.CGREvent{}, &optsGetRoutes{}); err == nil || err.Error() != fmt.Sprintf("unsupported sorting strategy: %s", strategy) {
+ if _, err := ssd.SortRoutes("prfID", strategy, map[string]*Route{}, &CGREvent{}, &optsGetRoutes{}); err == nil || err.Error() != fmt.Sprintf("unsupported sorting strategy: %s", strategy) {
t.Error(err)
}
}
diff --git a/engine/libstats.go b/engine/libstats.go
index c6d250f3e..4a717ce17 100644
--- a/engine/libstats.go
+++ b/engine/libstats.go
@@ -165,7 +165,7 @@ func (ssq *StoredStatQueue) AsStatQueue(ms Marshaler) (sq *StatQueue, err error)
}
type SQItem struct {
- EventID string // Bounded to the original utils.CGREvent
+ EventID string // Bounded to the original CGREvent
ExpiryTime *time.Time // Used to auto-expire events
}
@@ -232,7 +232,7 @@ func (sq *StatQueue) TenantID() string {
return utils.ConcatenatedKey(sq.Tenant, sq.ID)
}
-// ProcessEvent processes a utils.CGREvent, returns true if processed
+// ProcessEvent processes a CGREvent, returns true if processed
func (sq *StatQueue) ProcessEvent(tnt, evID string, filterS *FilterS, evNm utils.MapStorage) (err error) {
if oneEv := sq.isOneEvent(); oneEv {
return sq.addOneEvent(tnt, filterS, evNm)
diff --git a/engine/libstats_test.go b/engine/libstats_test.go
index b7608d916..dcf1ae780 100644
--- a/engine/libstats_test.go
+++ b/engine/libstats_test.go
@@ -222,7 +222,7 @@ func TestStatAddStatEvent(t *testing.T) {
if asr := asrMetric.GetFloat64Value(config.CgrConfig().GeneralCfg().RoundingDecimals); asr != 100 {
t.Errorf("received ASR: %v", asr)
}
- ev1 := &utils.CGREvent{Tenant: "cgrates.org", ID: "TestStatAddStatEvent_1"}
+ ev1 := &CGREvent{Tenant: "cgrates.org", ID: "TestStatAddStatEvent_1"}
sq.addStatEvent(ev1.Tenant, ev1.ID, nil, utils.MapStorage{utils.MetaReq: ev1.Event})
if asr := asrMetric.GetFloat64Value(config.CgrConfig().GeneralCfg().RoundingDecimals); asr != 50 {
t.Errorf("received ASR: %v", asr)
@@ -636,7 +636,7 @@ func TestStatRemoveExpiredTTL(t *testing.T) {
}
//add ev1 with ttl 100ms (after 100ms the event should be removed)
- ev1 := &utils.CGREvent{Tenant: "cgrates.org", ID: "TestStatAddStatEvent_1"}
+ ev1 := &CGREvent{Tenant: "cgrates.org", ID: "TestStatAddStatEvent_1"}
sq.ProcessEvent(ev1.Tenant, ev1.ID, nil, utils.MapStorage{utils.MetaReq: ev1.Event})
if len(sq.SQItems) != 1 && sq.SQItems[0].EventID != "TestStatAddStatEvent_1" {
@@ -646,7 +646,7 @@ func TestStatRemoveExpiredTTL(t *testing.T) {
time.Sleep(150 * time.Millisecond)
//processing a new event should clean the expired events and add the new one
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "TestStatAddStatEvent_2"}
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "TestStatAddStatEvent_2"}
sq.ProcessEvent(ev2.Tenant, ev2.ID, nil, utils.MapStorage{utils.MetaReq: ev2.Event})
if len(sq.SQItems) != 1 && sq.SQItems[0].EventID != "TestStatAddStatEvent_2" {
t.Errorf("Expecting: 1, received: %+v", len(sq.SQItems))
@@ -670,7 +670,7 @@ func TestStatRemoveExpiredQueue(t *testing.T) {
}
//add ev1 with ttl 100ms (after 100ms the event should be removed)
- ev1 := &utils.CGREvent{Tenant: "cgrates.org", ID: "TestStatAddStatEvent_1"}
+ ev1 := &CGREvent{Tenant: "cgrates.org", ID: "TestStatAddStatEvent_1"}
sq.ProcessEvent(ev1.Tenant, ev1.ID, nil, utils.MapStorage{utils.MetaReq: ev1.Event})
if len(sq.SQItems) != 1 && sq.SQItems[0].EventID != "TestStatAddStatEvent_1" {
@@ -680,7 +680,7 @@ func TestStatRemoveExpiredQueue(t *testing.T) {
time.Sleep(150 * time.Millisecond)
//processing a new event should clean the expired events and add the new one
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "TestStatAddStatEvent_2"}
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "TestStatAddStatEvent_2"}
sq.ProcessEvent(ev2.Tenant, ev2.ID, nil, utils.MapStorage{utils.MetaReq: ev2.Event})
if len(sq.SQItems) != 2 && sq.SQItems[0].EventID != "TestStatAddStatEvent_1" &&
sq.SQItems[1].EventID != "TestStatAddStatEvent_2" {
@@ -688,7 +688,7 @@ func TestStatRemoveExpiredQueue(t *testing.T) {
}
//processing a new event should clean the expired events and add the new one
- ev3 := &utils.CGREvent{Tenant: "cgrates.org", ID: "TestStatAddStatEvent_3"}
+ ev3 := &CGREvent{Tenant: "cgrates.org", ID: "TestStatAddStatEvent_3"}
sq.ProcessEvent(ev3.Tenant, ev3.ID, nil, utils.MapStorage{utils.MetaReq: ev3.Event})
if len(sq.SQItems) != 2 && sq.SQItems[0].EventID != "TestStatAddStatEvent_2" &&
sq.SQItems[1].EventID != "TestStatAddStatEvent_3" {
diff --git a/engine/resources.go b/engine/resources.go
index 1d45195fd..42fa2f054 100644
--- a/engine/resources.go
+++ b/engine/resources.go
@@ -527,7 +527,7 @@ func (rS *ResourceService) processThresholds(rs Resources, opts map[string]any)
thIDs = r.rPrf.ThresholdIDs
}
opts[utils.OptsThresholdsProfileIDs] = thIDs
- thEv := &utils.CGREvent{
+ thEv := &CGREvent{
Tenant: r.Tenant,
ID: utils.GenUUID(),
Event: map[string]any{
@@ -554,7 +554,7 @@ func (rS *ResourceService) processThresholds(rs Resources, opts map[string]any)
}
// matchingResourcesForEvent returns ordered list of matching resources which are active by the time of the call
-func (rS *ResourceService) matchingResourcesForEvent(tnt string, ev *utils.CGREvent,
+func (rS *ResourceService) matchingResourcesForEvent(tnt string, ev *CGREvent,
evUUID string, usageTTL *time.Duration) (rs Resources, err error) {
var rIDs utils.StringSet
evNm := utils.MapStorage{
@@ -667,14 +667,14 @@ func (rS *ResourceService) matchingResourcesForEvent(tnt string, ev *utils.CGREv
}
// V1GetResourcesForEvent returns active resource configs matching the event
-func (rS *ResourceService) V1GetResourcesForEvent(ctx *context.Context, args *utils.CGREvent, reply *Resources) (err error) {
+func (rS *ResourceService) V1GetResourcesForEvent(ctx *context.Context, args *CGREvent, reply *Resources) (err error) {
if args == nil {
return utils.NewErrMandatoryIeMissing(utils.Event)
}
if missing := utils.MissingStructFields(args, []string{utils.ID, utils.Event}); len(missing) != 0 { //Params missing
return utils.NewErrMandatoryIeMissing(missing...)
}
- usageID := utils.GetStringOpts(args, rS.cgrcfg.ResourceSCfg().Opts.UsageID, utils.OptsResourcesUsageID)
+ usageID := GetStringOpts(args, rS.cgrcfg.ResourceSCfg().Opts.UsageID, utils.OptsResourcesUsageID)
if usageID == utils.EmptyString {
return utils.NewErrMandatoryIeMissing(utils.UsageID)
}
@@ -703,7 +703,7 @@ func (rS *ResourceService) V1GetResourcesForEvent(ctx *context.Context, args *ut
// end of RPC caching
var usageTTL *time.Duration
- if usageTTL, err = utils.GetDurationPointerOpts(args, rS.cgrcfg.ResourceSCfg().Opts.UsageTTL,
+ if usageTTL, err = GetDurationPointerOpts(args, rS.cgrcfg.ResourceSCfg().Opts.UsageTTL,
utils.OptsResourcesUsageTTL); err != nil {
return
}
@@ -717,14 +717,14 @@ func (rS *ResourceService) V1GetResourcesForEvent(ctx *context.Context, args *ut
}
// V1AuthorizeResources queries service to find if an Usage is allowed
-func (rS *ResourceService) V1AuthorizeResources(ctx *context.Context, args *utils.CGREvent, reply *string) (err error) {
+func (rS *ResourceService) V1AuthorizeResources(ctx *context.Context, args *CGREvent, reply *string) (err error) {
if args == nil {
return utils.NewErrMandatoryIeMissing(utils.Event)
}
if missing := utils.MissingStructFields(args, []string{utils.ID, utils.Event}); len(missing) != 0 { //Params missing
return utils.NewErrMandatoryIeMissing(missing...)
}
- usageID := utils.GetStringOpts(args, rS.cgrcfg.ResourceSCfg().Opts.UsageID, utils.OptsResourcesUsageID)
+ usageID := GetStringOpts(args, rS.cgrcfg.ResourceSCfg().Opts.UsageID, utils.OptsResourcesUsageID)
if usageID == utils.EmptyString {
return utils.NewErrMandatoryIeMissing(utils.UsageID)
}
@@ -753,7 +753,7 @@ func (rS *ResourceService) V1AuthorizeResources(ctx *context.Context, args *util
// end of RPC caching
var usageTTL *time.Duration
- if usageTTL, err = utils.GetDurationPointerOpts(args, rS.cgrcfg.ResourceSCfg().Opts.UsageTTL,
+ if usageTTL, err = GetDurationPointerOpts(args, rS.cgrcfg.ResourceSCfg().Opts.UsageTTL,
utils.OptsResourcesUsageTTL); err != nil {
return
}
@@ -764,7 +764,7 @@ func (rS *ResourceService) V1AuthorizeResources(ctx *context.Context, args *util
defer mtcRLs.unlock()
var units float64
- if units, err = utils.GetFloat64Opts(args, rS.cgrcfg.ResourceSCfg().Opts.Units,
+ if units, err = GetFloat64Opts(args, rS.cgrcfg.ResourceSCfg().Opts.Units,
utils.OptsResourcesUnits); err != nil {
return
}
@@ -784,14 +784,14 @@ func (rS *ResourceService) V1AuthorizeResources(ctx *context.Context, args *util
}
// V1AllocateResources is called when a resource requires allocation
-func (rS *ResourceService) V1AllocateResources(ctx *context.Context, args *utils.CGREvent, reply *string) (err error) {
+func (rS *ResourceService) V1AllocateResources(ctx *context.Context, args *CGREvent, reply *string) (err error) {
if args == nil {
return utils.NewErrMandatoryIeMissing(utils.Event)
}
if missing := utils.MissingStructFields(args, []string{utils.ID, utils.Event}); len(missing) != 0 { //Params missing
return utils.NewErrMandatoryIeMissing(missing...)
}
- usageID := utils.GetStringOpts(args, rS.cgrcfg.ResourceSCfg().Opts.UsageID, utils.OptsResourcesUsageID)
+ usageID := GetStringOpts(args, rS.cgrcfg.ResourceSCfg().Opts.UsageID, utils.OptsResourcesUsageID)
if usageID == utils.EmptyString {
return utils.NewErrMandatoryIeMissing(utils.UsageID)
}
@@ -820,7 +820,7 @@ func (rS *ResourceService) V1AllocateResources(ctx *context.Context, args *utils
// end of RPC caching
var usageTTL *time.Duration
- if usageTTL, err = utils.GetDurationPointerOpts(args, rS.cgrcfg.ResourceSCfg().Opts.UsageTTL,
+ if usageTTL, err = GetDurationPointerOpts(args, rS.cgrcfg.ResourceSCfg().Opts.UsageTTL,
utils.OptsResourcesUsageTTL); err != nil {
return
}
@@ -832,7 +832,7 @@ func (rS *ResourceService) V1AllocateResources(ctx *context.Context, args *utils
defer mtcRLs.unlock()
var units float64
- if units, err = utils.GetFloat64Opts(args, rS.cgrcfg.ResourceSCfg().Opts.Units,
+ if units, err = GetFloat64Opts(args, rS.cgrcfg.ResourceSCfg().Opts.Units,
utils.OptsResourcesUnits); err != nil {
return
}
@@ -855,14 +855,14 @@ func (rS *ResourceService) V1AllocateResources(ctx *context.Context, args *utils
}
// V1ReleaseResources is called when we need to clear an allocation
-func (rS *ResourceService) V1ReleaseResources(ctx *context.Context, args *utils.CGREvent, reply *string) (err error) {
+func (rS *ResourceService) V1ReleaseResources(ctx *context.Context, args *CGREvent, reply *string) (err error) {
if args == nil {
return utils.NewErrMandatoryIeMissing(utils.Event)
}
if missing := utils.MissingStructFields(args, []string{utils.ID, utils.Event}); len(missing) != 0 { //Params missing
return utils.NewErrMandatoryIeMissing(missing...)
}
- usageID := utils.GetStringOpts(args, rS.cgrcfg.ResourceSCfg().Opts.UsageID, utils.OptsResourcesUsageID)
+ usageID := GetStringOpts(args, rS.cgrcfg.ResourceSCfg().Opts.UsageID, utils.OptsResourcesUsageID)
if usageID == utils.EmptyString {
return utils.NewErrMandatoryIeMissing(utils.UsageID)
}
@@ -891,7 +891,7 @@ func (rS *ResourceService) V1ReleaseResources(ctx *context.Context, args *utils.
// end of RPC caching
var usageTTL *time.Duration
- if usageTTL, err = utils.GetDurationPointerOpts(args, rS.cgrcfg.ResourceSCfg().Opts.UsageTTL,
+ if usageTTL, err = GetDurationPointerOpts(args, rS.cgrcfg.ResourceSCfg().Opts.UsageTTL,
utils.OptsResourcesUsageTTL); err != nil {
return
}
diff --git a/engine/responder.go b/engine/responder.go
index f174dce9d..848ab4513 100644
--- a/engine/responder.go
+++ b/engine/responder.go
@@ -393,7 +393,7 @@ func (rs *Responder) Shutdown(ctx *context.Context, arg *utils.TenantWithAPIOpts
}
// Ping used to detreminate if component is active
-func (chSv1 *Responder) Ping(ctx *context.Context, ign *utils.CGREvent, reply *string) error {
+func (chSv1 *Responder) Ping(ctx *context.Context, ign *CGREvent, reply *string) error {
*reply = utils.Pong
return nil
}
diff --git a/engine/route_highestcost.go b/engine/route_highestcost.go
index 9346dea3c..6b96221ec 100644
--- a/engine/route_highestcost.go
+++ b/engine/route_highestcost.go
@@ -36,7 +36,7 @@ type HightCostSorter struct {
}
func (hcs *HightCostSorter) SortRoutes(prflID string, routes map[string]*Route,
- ev *utils.CGREvent, extraOpts *optsGetRoutes) (sortedRoutes *SortedRoutes, err error) {
+ ev *CGREvent, extraOpts *optsGetRoutes) (sortedRoutes *SortedRoutes, err error) {
sortedRoutes = &SortedRoutes{ProfileID: prflID,
Sorting: hcs.sorting,
Routes: make([]*SortedRoute, 0)}
diff --git a/engine/route_leastcost.go b/engine/route_leastcost.go
index 23a6e48e4..87ddd0077 100644
--- a/engine/route_leastcost.go
+++ b/engine/route_leastcost.go
@@ -36,7 +36,7 @@ type LeastCostSorter struct {
}
func (lcs *LeastCostSorter) SortRoutes(prflID string, routes map[string]*Route,
- ev *utils.CGREvent, extraOpts *optsGetRoutes) (sortedRoutes *SortedRoutes, err error) {
+ ev *CGREvent, extraOpts *optsGetRoutes) (sortedRoutes *SortedRoutes, err error) {
sortedRoutes = &SortedRoutes{ProfileID: prflID,
Sorting: lcs.sorting,
Routes: make([]*SortedRoute, 0)}
diff --git a/engine/route_load_distribution.go b/engine/route_load_distribution.go
index a7d71a3be..f2866b240 100644
--- a/engine/route_load_distribution.go
+++ b/engine/route_load_distribution.go
@@ -38,7 +38,7 @@ type LoadDistributionSorter struct {
// SortRoutes .
func (ws *LoadDistributionSorter) SortRoutes(prflID string,
- routes map[string]*Route, suplEv *utils.CGREvent, extraOpts *optsGetRoutes) (sortedRoutes *SortedRoutes, err error) {
+ routes map[string]*Route, suplEv *CGREvent, extraOpts *optsGetRoutes) (sortedRoutes *SortedRoutes, err error) {
sortedRoutes = &SortedRoutes{
ProfileID: prflID,
Sorting: ws.sorting,
diff --git a/engine/route_qos.go b/engine/route_qos.go
index a16abb477..f3cdb7a1f 100644
--- a/engine/route_qos.go
+++ b/engine/route_qos.go
@@ -34,7 +34,7 @@ type QOSRouteSorter struct {
}
func (qos *QOSRouteSorter) SortRoutes(prflID string, routes map[string]*Route,
- ev *utils.CGREvent, extraOpts *optsGetRoutes) (sortedRoutes *SortedRoutes, err error) {
+ ev *CGREvent, extraOpts *optsGetRoutes) (sortedRoutes *SortedRoutes, err error) {
sortedRoutes = &SortedRoutes{ProfileID: prflID,
Sorting: qos.sorting,
Routes: make([]*SortedRoute, 0)}
diff --git a/engine/route_reas.go b/engine/route_reas.go
index 16f57dbf6..2611f85a5 100644
--- a/engine/route_reas.go
+++ b/engine/route_reas.go
@@ -36,7 +36,7 @@ type ResourceAscendentSorter struct {
}
func (ws *ResourceAscendentSorter) SortRoutes(prflID string,
- routes map[string]*Route, suplEv *utils.CGREvent, extraOpts *optsGetRoutes) (sortedRoutes *SortedRoutes, err error) {
+ routes map[string]*Route, suplEv *CGREvent, extraOpts *optsGetRoutes) (sortedRoutes *SortedRoutes, err error) {
sortedRoutes = &SortedRoutes{ProfileID: prflID,
Sorting: ws.sorting,
Routes: make([]*SortedRoute, 0)}
diff --git a/engine/route_reds.go b/engine/route_reds.go
index 23b84c439..f93c0d9f0 100644
--- a/engine/route_reds.go
+++ b/engine/route_reds.go
@@ -36,7 +36,7 @@ type ResourceDescendentSorter struct {
}
func (ws *ResourceDescendentSorter) SortRoutes(prflID string,
- routes map[string]*Route, suplEv *utils.CGREvent, extraOpts *optsGetRoutes) (sortedRoutes *SortedRoutes, err error) {
+ routes map[string]*Route, suplEv *CGREvent, extraOpts *optsGetRoutes) (sortedRoutes *SortedRoutes, err error) {
sortedRoutes = &SortedRoutes{ProfileID: prflID,
Sorting: ws.sorting,
Routes: make([]*SortedRoute, 0)}
diff --git a/engine/route_weight.go b/engine/route_weight.go
index b914e58fe..da4e8d160 100644
--- a/engine/route_weight.go
+++ b/engine/route_weight.go
@@ -34,7 +34,7 @@ type WeightSorter struct {
}
func (ws *WeightSorter) SortRoutes(prflID string,
- routes map[string]*Route, suplEv *utils.CGREvent, extraOpts *optsGetRoutes) (sortedRoutes *SortedRoutes, err error) {
+ routes map[string]*Route, suplEv *CGREvent, extraOpts *optsGetRoutes) (sortedRoutes *SortedRoutes, err error) {
sortedRoutes = &SortedRoutes{ProfileID: prflID,
Sorting: ws.sorting,
Routes: make([]*SortedRoute, 0)}
diff --git a/engine/routes.go b/engine/routes.go
index bb84b7fbe..dea1c1e16 100644
--- a/engine/routes.go
+++ b/engine/routes.go
@@ -142,7 +142,7 @@ func (rpS *RouteService) Shutdown() {
}
// matchingRouteProfilesForEvent returns ordered list of matching resources which are active by the time of the call
-func (rpS *RouteService) matchingRouteProfilesForEvent(tnt string, ev *utils.CGREvent) (matchingRPrf []*RouteProfile, err error) {
+func (rpS *RouteService) matchingRouteProfilesForEvent(tnt string, ev *CGREvent) (matchingRPrf []*RouteProfile, err error) {
evNm := utils.MapStorage{
utils.MetaReq: ev.Event,
utils.MetaOpts: ev.APIOpts,
@@ -188,7 +188,7 @@ func (rpS *RouteService) matchingRouteProfilesForEvent(tnt string, ev *utils.CGR
// costForEvent will compute cost out of accounts and rating plans for event
// returns map[string]any with cost and relevant matching information inside
-func (rpS *RouteService) costForEvent(ev *utils.CGREvent,
+func (rpS *RouteService) costForEvent(ev *CGREvent,
acntIDs, rpIDs []string) (costData map[string]any, err error) {
costData = make(map[string]any)
if err = ev.CheckMandatoryFields([]string{utils.AccountField,
@@ -373,7 +373,7 @@ func (rpS *RouteService) resourceUsage(resIDs []string, tenant string) (tUsage f
return
}
-func (rpS *RouteService) populateSortingData(ev *utils.CGREvent, route *Route,
+func (rpS *RouteService) populateSortingData(ev *CGREvent, route *Route,
extraOpts *optsGetRoutes) (srtRoute *SortedRoute, pass bool, err error) {
sortedSpl := &SortedRoute{
RouteID: route.ID,
@@ -500,9 +500,9 @@ func (rpS *RouteService) populateSortingData(ev *utils.CGREvent, route *Route,
return sortedSpl, true, nil
}
-func newOptsGetRoutes(ev *utils.CGREvent, fS *FilterS, cfgOpts *config.RoutesOpts) (opts *optsGetRoutes, err error) {
+func newOptsGetRoutes(ev *CGREvent, fS *FilterS, cfgOpts *config.RoutesOpts) (opts *optsGetRoutes, err error) {
var ignoreErrors bool
- if ignoreErrors, err = utils.GetBoolOpts(ev, cfgOpts.IgnoreErrors, utils.OptsRoutesIgnoreErrors); err != nil {
+ if ignoreErrors, err = GetBoolOpts(ev, cfgOpts.IgnoreErrors, utils.OptsRoutesIgnoreErrors); err != nil {
return
}
opts = &optsGetRoutes{
@@ -510,20 +510,20 @@ func newOptsGetRoutes(ev *utils.CGREvent, fS *FilterS, cfgOpts *config.RoutesOpt
paginator: &utils.Paginator{},
}
var limit *int
- if limit, err = utils.GetIntPointerOpts(ev, cfgOpts.Limit, utils.OptsRoutesLimit); err != nil {
+ if limit, err = GetIntPointerOpts(ev, cfgOpts.Limit, utils.OptsRoutesLimit); err != nil {
return
}
if limit != nil {
opts.paginator.Limit = limit
}
var offset *int
- if offset, err = utils.GetIntPointerOpts(ev, cfgOpts.Offset, utils.OptsRoutesOffset); err != nil {
+ if offset, err = GetIntPointerOpts(ev, cfgOpts.Offset, utils.OptsRoutesOffset); err != nil {
return
}
if offset != nil {
opts.paginator.Offset = offset
}
- maxCost := utils.GetInterfaceOpts(ev, cfgOpts.MaxCost, utils.OptsRoutesMaxCost)
+ maxCost := GetInterfaceOpts(ev, cfgOpts.MaxCost, utils.OptsRoutesMaxCost)
switch maxCost {
case utils.EmptyString, nil:
@@ -558,7 +558,7 @@ type optsGetRoutes struct {
}
// V1GetRoutes returns the list of valid routes
-func (rpS *RouteService) V1GetRoutes(ctx *context.Context, args *utils.CGREvent, reply *SortedRoutesList) (err error) {
+func (rpS *RouteService) V1GetRoutes(ctx *context.Context, args *CGREvent, reply *SortedRoutesList) (err error) {
if args == nil {
return utils.NewErrMandatoryIeMissing(utils.CGREventString)
}
@@ -577,7 +577,7 @@ func (rpS *RouteService) V1GetRoutes(ctx *context.Context, args *utils.CGREvent,
}
args.APIOpts[utils.MetaSubsys] = utils.MetaRoutes
args.APIOpts[utils.OptsContext] = utils.FirstNonEmpty(
- utils.GetStringOpts(args, rpS.cgrcfg.RouteSCfg().Opts.Context, utils.OptsContext),
+ GetStringOpts(args, rpS.cgrcfg.RouteSCfg().Opts.Context, utils.OptsContext),
utils.MetaRoutes,
)
var rplyEv AttrSProcessEventReply
@@ -600,7 +600,7 @@ func (rpS *RouteService) V1GetRoutes(ctx *context.Context, args *utils.CGREvent,
}
// V1GetRouteProfilesForEvent returns the list of valid route profiles
-func (rpS *RouteService) V1GetRouteProfilesForEvent(ctx *context.Context, args *utils.CGREvent, reply *[]*RouteProfile) (err error) {
+func (rpS *RouteService) V1GetRouteProfilesForEvent(ctx *context.Context, args *CGREvent, reply *[]*RouteProfile) (err error) {
if missing := utils.MissingStructFields(args, []string{utils.ID}); len(missing) != 0 {
return utils.NewErrMandatoryIeMissing(missing...)
} else if args.Event == nil {
@@ -623,7 +623,7 @@ func (rpS *RouteService) V1GetRouteProfilesForEvent(ctx *context.Context, args *
// sortedRoutesForEvent will return the list of valid route IDs
// for event based on filters and sorting algorithms
-func (rpS *RouteService) sortedRoutesForProfile(tnt string, rPrfl *RouteProfile, ev *utils.CGREvent,
+func (rpS *RouteService) sortedRoutesForProfile(tnt string, rPrfl *RouteProfile, ev *CGREvent,
pag utils.Paginator, extraOpts *optsGetRoutes) (sortedRoutes *SortedRoutes, err error) {
extraOpts.sortingParameters = rPrfl.SortingParameters // populate sortingParameters in extraOpts
extraOpts.sortingStrategy = rPrfl.Sorting // populate sortingStrategy in extraOpts
@@ -672,7 +672,7 @@ func (rpS *RouteService) sortedRoutesForProfile(tnt string, rPrfl *RouteProfile,
// sortedRoutesForEvent will return the list of valid route IDs
// for event based on filters and sorting algorithms
-func (rpS *RouteService) sortedRoutesForEvent(tnt string, args *utils.CGREvent) (sortedRoutes SortedRoutesList, err error) {
+func (rpS *RouteService) sortedRoutesForEvent(tnt string, args *CGREvent) (sortedRoutes SortedRoutesList, err error) {
if _, has := args.Event[utils.Usage]; !has {
args.Event[utils.Usage] = time.Minute // make sure we have default set for Usage
}
@@ -682,7 +682,7 @@ func (rpS *RouteService) sortedRoutesForEvent(tnt string, args *utils.CGREvent)
}
prfCount := len(rPrfs) // if the option is not present return for all profiles
var prfCountOpt *int
- if prfCountOpt, err = utils.GetIntPointerOpts(args, rpS.cgrcfg.RouteSCfg().Opts.ProfileCount,
+ if prfCountOpt, err = GetIntPointerOpts(args, rpS.cgrcfg.RouteSCfg().Opts.ProfileCount,
utils.OptsRoutesProfileCount); err != nil {
return
}
@@ -739,7 +739,7 @@ func (rpS *RouteService) sortedRoutesForEvent(tnt string, args *utils.CGREvent)
}
// V1GetRoutesList returns the list of valid routes
-func (rpS *RouteService) V1GetRoutesList(ctx *context.Context, args *utils.CGREvent, reply *[]string) (err error) {
+func (rpS *RouteService) V1GetRoutesList(ctx *context.Context, args *CGREvent, reply *[]string) (err error) {
sR := new(SortedRoutesList)
if err = rpS.V1GetRoutes(ctx, args, sR); err != nil {
return
diff --git a/engine/routes_test.go b/engine/routes_test.go
index 2d6b50bdf..1be38586a 100644
--- a/engine/routes_test.go
+++ b/engine/routes_test.go
@@ -170,10 +170,10 @@ var (
Weight: 10,
},
}
- testRoutesArgs = []*utils.CGREvent{
+ testRoutesArgs = []*CGREvent{
{ //matching RouteProfile1
Tenant: "cgrates.org",
- ID: "utils.CGREvent1",
+ ID: "CGREvent1",
Event: map[string]any{
"Route": "RouteProfile1",
utils.AnswerTime: time.Date(2014, 7, 14, 14, 30, 0, 0, time.UTC),
@@ -185,7 +185,7 @@ var (
},
{ //matching RouteProfile2
Tenant: "cgrates.org",
- ID: "utils.CGREvent1",
+ ID: "CGREvent1",
Event: map[string]any{
"Route": "RouteProfile2",
utils.AnswerTime: time.Date(2014, 7, 14, 14, 30, 0, 0, time.UTC),
@@ -197,7 +197,7 @@ var (
},
{ //matching RouteProfilePrefix
Tenant: "cgrates.org",
- ID: "utils.CGREvent1",
+ ID: "CGREvent1",
Event: map[string]any{
"Route": "RouteProfilePrefix",
},
@@ -704,9 +704,9 @@ func TestRoutesSortedForEventWithLimitAndOffset2(t *testing.T) {
Weight: 0,
},
}
- argsGetRoutes := &utils.CGREvent{
+ argsGetRoutes := &CGREvent{
Tenant: "cgrates.org",
- ID: "utils.CGREvent1",
+ ID: "CGREvent1",
Event: map[string]any{},
APIOpts: map[string]any{
utils.OptsRoutesProfileCount: 3,
@@ -936,7 +936,7 @@ func TestRouteServiceV1GetRouteProfilesForEvent(t *testing.T) {
cfg.RouteSCfg().StringIndexedFields = nil
cfg.RouteSCfg().PrefixIndexedFields = nil
rpS := NewRouteService(dmSPP, &FilterS{dm: dmSPP, cfg: cfg, connMgr: nil}, cfg, nil)
- args := &utils.CGREvent{
+ args := &CGREvent{
Tenant: "cgrates.orgs",
ID: "id",
Time: utils.TimePointer(time.Date(2022, 12, 1, 20, 0, 0, 0, time.UTC)),
@@ -1044,7 +1044,7 @@ func TestRouteServiceV1GetRoutes(t *testing.T) {
utils.ConcatenatedKey(utils.MetaInternal, utils.MetaAttributes): clientConn,
})
rpS := NewRouteService(dmSPP, &FilterS{dm: dmSPP, cfg: cfg, connMgr: nil}, cfg, connMgr)
- args := &utils.CGREvent{
+ args := &CGREvent{
ID: "CGREvent1",
Tenant: "cgrates.org",
Time: utils.TimePointer(time.Date(2022, 12, 1, 20, 0, 0, 0, time.UTC)),
@@ -1116,9 +1116,9 @@ func TestRouteServiceSortRoutes(t *testing.T) {
},
}
- ev := &utils.CGREvent{
+ ev := &CGREvent{
Tenant: "cgrates.org",
- ID: "utils.CGREvent1",
+ ID: "CGREvent1",
Event: map[string]any{
"Route": "RouteProfile1",
utils.AnswerTime: time.Date(2014, 7, 14, 14, 30, 0, 0, time.UTC),
@@ -1208,9 +1208,9 @@ func TestRDSRSortRoutes(t *testing.T) {
},
},
}
- ev := &utils.CGREvent{
+ ev := &CGREvent{
Tenant: "cgrates.org",
- ID: "utils.CGREvent1",
+ ID: "CGREvent1",
Event: map[string]any{},
APIOpts: map[string]any{
utils.OptsRoutesProfileCount: 3,
@@ -1321,9 +1321,9 @@ func TestQosRSortRoutes(t *testing.T) {
},
},
}
- ev := &utils.CGREvent{
+ ev := &CGREvent{
Tenant: "cgrates.org",
- ID: "utils.CGREvent1",
+ ID: "CGREvent1",
Event: map[string]any{},
APIOpts: map[string]any{
utils.OptsRoutesProfileCount: 3,
@@ -1406,9 +1406,9 @@ func TestReaSortRoutes(t *testing.T) {
},
},
}
- ev := &utils.CGREvent{
+ ev := &CGREvent{
Tenant: "cgrates.org",
- ID: "utils.CGREvent1",
+ ID: "CGREvent1",
Event: map[string]any{
utils.AccountField: "account",
utils.Destination: "destination",
@@ -1473,9 +1473,9 @@ func TestHCRSortRoutes(t *testing.T) {
},
},
}
- ev := &utils.CGREvent{
+ ev := &CGREvent{
Tenant: "cgrates.org",
- ID: "utils.CGREvent1",
+ ID: "CGREvent1",
Event: map[string]any{},
APIOpts: map[string]any{
utils.OptsRoutesProfileCount: 3,
@@ -1571,9 +1571,9 @@ func TestLoadDistributionSorterSortRoutes(t *testing.T) {
},
},
}
- ev := &utils.CGREvent{
+ ev := &CGREvent{
Tenant: "cgrates.org",
- ID: "utils.CGREvent1",
+ ID: "CGREvent1",
Event: map[string]any{
utils.AccountField: "account",
utils.Destination: "destination",
@@ -1693,7 +1693,7 @@ func TestRouteServicePopulateSortingData(t *testing.T) {
utils.ConcatenatedKey(utils.MetaInternal, utils.ResourceSConnsCfg): clientconn})
routeService := NewRouteService(dmSPP, &FilterS{
dm: dmSPP, cfg: cfg, connMgr: nil}, cfg, connMgr)
- ev := &utils.CGREvent{
+ ev := &CGREvent{
Tenant: "cgrates.org",
ID: "id",
@@ -1759,7 +1759,7 @@ func TestNewOptsGetRoutes(t *testing.T) {
cfg := config.NewDefaultCGRConfig()
db := NewInternalDB(nil, nil, true, cfg.DataDbCfg().Items)
dm := NewDataManager(db, cfg.CacheCfg(), nil)
- ev := &utils.CGREvent{
+ ev := &CGREvent{
APIOpts: map[string]any{
utils.OptsRoutesMaxCost: utils.MetaEventCost,
@@ -1892,7 +1892,7 @@ func TestRSLazyCheckRule(t *testing.T) {
config.SetCgrConfig(config.NewDefaultCGRConfig())
}()
rps := NewRouteService(dm, nil, cfg, nil)
- ev := &utils.CGREvent{
+ ev := &CGREvent{
Tenant: "cgrates.org",
ID: "SqProcessEvent",
Event: map[string]any{
@@ -1955,7 +1955,7 @@ func TestRSPopulateSortingDataResourceErr(t *testing.T) {
utils.ConcatenatedKey(utils.MetaInternal, utils.MetaResources): clientConn,
})
rps := NewRouteService(dm, nil, cfg, connMgr)
- ev := &utils.CGREvent{
+ ev := &CGREvent{
Tenant: "cgrates.org",
ID: "SqProcessEvent",
Event: map[string]any{
@@ -2014,7 +2014,7 @@ func TestPopulateSortingDataStatsErr(t *testing.T) {
connMgr := NewConnManager(cfg, map[string]chan birpc.ClientConnector{
utils.ConcatenatedKey(utils.MetaInternal, utils.MetaStats): clientConn,
})
- ev := &utils.CGREvent{
+ ev := &CGREvent{
Tenant: "cgrates.org",
ID: "voiceEvent",
Time: utils.TimePointer(time.Now()),
@@ -2073,7 +2073,7 @@ func TestPopulateSortingDataAccsErr(t *testing.T) {
connMgr := NewConnManager(cfg, map[string]chan birpc.ClientConnector{
utils.ConcatenatedKey(utils.MetaInternal, utils.MetaRALs): clientConn,
})
- ev := &utils.CGREvent{
+ ev := &CGREvent{
Tenant: "cgrates.org",
ID: "voiceEvent",
Time: utils.TimePointer(time.Now()),
@@ -2135,7 +2135,7 @@ func TestPopulateSortingDataAccs2(t *testing.T) {
connMgr := NewConnManager(cfg, map[string]chan birpc.ClientConnector{
utils.ConcatenatedKey(utils.MetaInternal, utils.MetaRALs): clientConn,
})
- ev := &utils.CGREvent{
+ ev := &CGREvent{
Tenant: "cgrates.org",
ID: "voiceEvent",
Time: utils.TimePointer(time.Now()),
@@ -2222,7 +2222,7 @@ func TestRoutesV1GetRoutes(t *testing.T) {
}
dm.SetRouteProfile(rpp, true)
- args := &utils.CGREvent{
+ args := &CGREvent{
Tenant: "cgrates.org",
ID: "RouteProcessEvent",
Event: map[string]any{
@@ -2320,12 +2320,12 @@ func TestRouteServiceV1GetRoutesErr(t *testing.T) {
testCases := []struct {
name string
- args *utils.CGREvent
+ args *CGREvent
reply SortedRoutesList
}{
{
name: "Missing StructFields",
- args: &utils.CGREvent{
+ args: &CGREvent{
Event: map[string]any{
"Account": "1003",
},
@@ -2334,7 +2334,7 @@ func TestRouteServiceV1GetRoutesErr(t *testing.T) {
},
{
name: "Missing Event",
- args: &utils.CGREvent{
+ args: &CGREvent{
Tenant: "cgrates.org",
ID: "RouteProcessEvent",
},
@@ -2342,7 +2342,7 @@ func TestRouteServiceV1GetRoutesErr(t *testing.T) {
},
{
name: "Failed to process event ",
- args: &utils.CGREvent{
+ args: &CGREvent{
Tenant: "cgrates.org",
ID: "RouteProcessEvent",
Event: map[string]any{
@@ -2425,7 +2425,7 @@ func TestRouteServiceSortRoutesQos(t *testing.T) {
t.Error(err)
}
var reply SortedRoutesList
- cgrEv := &utils.CGREvent{
+ cgrEv := &CGREvent{
Tenant: "cgrates.org",
ID: "sortRoutesQosEvent1",
Event: map[string]any{
diff --git a/engine/safevent.go b/engine/safevent.go
index 4427a5baa..0e3fe91fb 100644
--- a/engine/safevent.go
+++ b/engine/safevent.go
@@ -239,9 +239,9 @@ func (se *SafEvent) AsCDR(cfg *config.CGRConfig, tnt, tmz string) (cdr *CDR, err
}
// AsCGREvent exports the SafEvent as CGREvent
-func (se *SafEvent) AsCGREvent(tnt string) (cgrEv *utils.CGREvent) {
+func (se *SafEvent) AsCGREvent(tnt string) (cgrEv *CGREvent) {
se.RLock()
- cgrEv = &utils.CGREvent{
+ cgrEv = &CGREvent{
Tenant: tnt,
ID: utils.UUIDSha1Prefix(),
Time: utils.TimePointer(time.Now()),
diff --git a/engine/statmetrics_test.go b/engine/statmetrics_test.go
index f70a200b5..13e53ab27 100644
--- a/engine/statmetrics_test.go
+++ b/engine/statmetrics_test.go
@@ -31,7 +31,7 @@ import (
func TestASRGetStringValue(t *testing.T) {
asr, _ := NewASR(2, "", []string{})
- ev := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC)}}
if strVal := asr.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals); strVal != utils.NotAvailable {
@@ -41,8 +41,8 @@ func TestASRGetStringValue(t *testing.T) {
if strVal := asr.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals); strVal != utils.NotAvailable {
t.Errorf("wrong asr value: %s", strVal)
}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2"}
- ev3 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_3"}
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2"}
+ ev3 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_3"}
asr.AddEvent(ev2.ID, utils.MapStorage{utils.MetaReq: ev2.Event})
if strVal := asr.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals); strVal != "50%" {
t.Errorf("wrong asr value: %s", strVal)
@@ -55,10 +55,10 @@ func TestASRGetStringValue(t *testing.T) {
if strVal := asr.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals); strVal != "50%" {
t.Errorf("wrong asr value: %s", strVal)
}
- ev4 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_4",
+ ev4 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_4",
Event: map[string]any{
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC)}}
- ev5 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_5",
+ ev5 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_5",
Event: map[string]any{
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC)}}
asr.AddEvent(ev4.ID, utils.MapStorage{utils.MetaReq: ev4.Event})
@@ -80,11 +80,11 @@ func TestASRGetStringValue(t *testing.T) {
func TestASRGetStringValue2(t *testing.T) {
asr, _ := NewASR(2, "", []string{})
- ev := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC)}}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2"}
- ev4 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1"}
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2"}
+ ev4 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1"}
asr.AddEvent(ev.ID, utils.MapStorage{utils.MetaReq: ev.Event})
asr.AddEvent(ev2.ID, utils.MapStorage{utils.MetaReq: ev2.Event})
if strVal := asr.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals); strVal != "50%" {
@@ -124,11 +124,11 @@ func TestASRGetStringValue3(t *testing.T) {
Count: 2,
}
expected.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals)
- ev := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC)}}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2"}
- ev4 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1"}
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2"}
+ ev4 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1"}
asr.AddEvent(ev.ID, utils.MapStorage{utils.MetaReq: ev.Event})
asr.AddEvent(ev2.ID, utils.MapStorage{utils.MetaReq: ev2.Event})
if strVal := asr.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals); strVal != "50%" {
@@ -175,15 +175,15 @@ func TestASRGetStringValue3(t *testing.T) {
func TestASRGetValue(t *testing.T) {
asr, _ := NewASR(2, "", []string{})
- ev := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC)}}
asr.AddEvent(ev.ID, utils.MapStorage{utils.MetaReq: ev.Event})
if v := asr.GetValue(config.CgrConfig().GeneralCfg().RoundingDecimals); v != -1.0 {
t.Errorf("wrong asr value: %f", v)
}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2"}
- ev3 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_3"}
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2"}
+ ev3 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_3"}
asr.AddEvent(ev2.ID, utils.MapStorage{utils.MetaReq: ev2.Event})
asr.AddEvent(ev3.ID, utils.MapStorage{utils.MetaReq: ev3.Event})
if v := asr.GetValue(config.CgrConfig().GeneralCfg().RoundingDecimals); v != 33.33333 {
@@ -193,10 +193,10 @@ func TestASRGetValue(t *testing.T) {
if v := asr.GetValue(config.CgrConfig().GeneralCfg().RoundingDecimals); v != 50.0 {
t.Errorf("wrong asr value: %f", v)
}
- ev4 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_4",
+ ev4 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_4",
Event: map[string]any{
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC)}}
- ev5 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_5",
+ ev5 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_5",
Event: map[string]any{
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC)}}
asr.AddEvent(ev4.ID, utils.MapStorage{utils.MetaReq: ev4.Event})
@@ -233,11 +233,11 @@ func TestASRCompress(t *testing.T) {
Count: 2,
}
expected.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals)
- ev := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC)}}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2"}
- ev4 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1"}
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2"}
+ ev4 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1"}
asr.AddEvent(ev.ID, utils.MapStorage{utils.MetaReq: ev.Event})
asr.AddEvent(ev2.ID, utils.MapStorage{utils.MetaReq: ev2.Event})
expIDs := []string{"EVENT_1", "EVENT_2"}
@@ -298,11 +298,11 @@ func TestASRGetCompressFactor(t *testing.T) {
"EVENT_2": 1,
}
asr, _ := NewASR(2, "", []string{})
- ev := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC)}}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2"}
- ev4 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1"}
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2"}
+ ev4 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1"}
asr.AddEvent(ev.ID, utils.MapStorage{utils.MetaReq: ev.Event})
asr.AddEvent(ev2.ID, utils.MapStorage{utils.MetaReq: ev2.Event})
if CF = asr.GetCompressFactor(make(map[string]int)); !reflect.DeepEqual(expectedCF, CF) {
@@ -324,10 +324,10 @@ func TestASRGetCompressFactor(t *testing.T) {
func TestASRAddOneEvent(t *testing.T) {
asr, _ := NewASR(2, "", []string{})
- ev := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC)}}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2"}
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2"}
asr.AddOneEvent(utils.MapStorage{utils.MetaReq: ev.Event})
asr.AddOneEvent(utils.MapStorage{utils.MetaReq: ev2.Event})
if strVal := asr.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals); strVal != "50%" {
@@ -345,7 +345,7 @@ func TestASRAddOneEvent(t *testing.T) {
func TestACDGetStringValue(t *testing.T) {
acd, _ := NewACD(2, "", []string{})
- ev := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{
utils.Usage: 10 * time.Second,
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
@@ -359,8 +359,8 @@ func TestACDGetStringValue(t *testing.T) {
if strVal := acd.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals); strVal != utils.NotAvailable {
t.Errorf("wrong acd value: %s", strVal)
}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2"}
- ev3 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_3"}
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2"}
+ ev3 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_3"}
if err := acd.AddEvent(ev2.ID, utils.MapStorage{utils.MetaReq: ev2.Event}); err == nil || err.Error() != "NOT_FOUND:Usage" {
t.Error(err)
}
@@ -377,13 +377,13 @@ func TestACDGetStringValue(t *testing.T) {
if strVal := acd.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals); strVal != utils.NotAvailable {
t.Errorf("wrong acd value: %s", strVal)
}
- ev4 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_4",
+ ev4 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_4",
Event: map[string]any{
"Usage": 478433753 * time.Nanosecond,
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
},
}
- ev5 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_5",
+ ev5 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_5",
Event: map[string]any{
"Usage": 30*time.Second + 982433452*time.Nanosecond,
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
@@ -411,12 +411,12 @@ func TestACDGetStringValue(t *testing.T) {
func TestACDGetStringValue2(t *testing.T) {
acd, _ := NewACD(2, "", []string{})
- ev1 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev1 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{utils.Usage: 2 * time.Minute}}
if err := acd.AddEvent(ev1.ID, utils.MapStorage{utils.MetaReq: ev1.Event}); err != nil {
t.Error(err)
}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
Event: map[string]any{"Usage": time.Minute}}
acd.AddEvent(ev2.ID, utils.MapStorage{utils.MetaReq: ev2.Event})
if strVal := acd.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals); strVal != "1m30s" {
@@ -446,11 +446,11 @@ func TestACDGetStringValue3(t *testing.T) {
Sum: 6 * time.Minute,
}
expected.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals)
- ev1 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev1 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{utils.Usage: 2 * time.Minute}}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{utils.Usage: 3 * time.Minute}}
- ev3 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_3",
+ ev3 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_3",
Event: map[string]any{"Usage": time.Minute}}
if err := acd.AddEvent(ev1.ID, utils.MapStorage{utils.MetaReq: ev1.Event}); err != nil {
t.Error(err)
@@ -491,11 +491,11 @@ func TestACDCompress(t *testing.T) {
Sum: 6 * time.Minute,
}
expected.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals)
- ev1 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev1 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{utils.Usage: 2 * time.Minute}}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{utils.Usage: 3 * time.Minute}}
- ev3 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_3",
+ ev3 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_3",
Event: map[string]any{"Usage": time.Minute}}
acd.AddEvent(ev1.ID, utils.MapStorage{utils.MetaReq: ev1.Event})
acd.AddEvent(ev2.ID, utils.MapStorage{utils.MetaReq: ev2.Event})
@@ -539,11 +539,11 @@ func TestACDGetCompressFactor(t *testing.T) {
}
acd, _ := NewACD(2, "", []string{})
- ev := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{"Usage": time.Minute}}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
Event: map[string]any{"Usage": time.Minute}}
- ev4 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
+ ev4 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
Event: map[string]any{utils.Usage: 2 * time.Minute}}
acd.AddEvent(ev.ID, utils.MapStorage{utils.MetaReq: ev.Event})
@@ -566,7 +566,7 @@ func TestACDGetCompressFactor(t *testing.T) {
func TestACDGetFloat64Value(t *testing.T) {
acd, _ := NewACD(2, "", []string{})
- ev := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
"Usage": 10 * time.Second}}
@@ -574,18 +574,18 @@ func TestACDGetFloat64Value(t *testing.T) {
if v := acd.GetFloat64Value(config.CgrConfig().GeneralCfg().RoundingDecimals); v != -1.0 {
t.Errorf("wrong acd value: %v", v)
}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2"}
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2"}
acd.AddEvent(ev2.ID, utils.MapStorage{utils.MetaReq: ev2.Event})
if v := acd.GetFloat64Value(config.CgrConfig().GeneralCfg().RoundingDecimals); v != -1.0 {
t.Errorf("wrong acd value: %v", v)
}
- ev4 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_4",
+ ev4 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_4",
Event: map[string]any{
"Usage": time.Minute,
"AnswerTime": time.Date(2015, 7, 14, 14, 25, 0, 0, time.UTC),
},
}
- ev5 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_5",
+ ev5 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_5",
Event: map[string]any{
"Usage": time.Minute + 30*time.Second,
"AnswerTime": time.Date(2015, 7, 14, 14, 25, 0, 0, time.UTC),
@@ -644,7 +644,7 @@ func TestACDGetFloat64Value(t *testing.T) {
func TestACDGetValue(t *testing.T) {
acd, _ := NewACD(2, "", []string{})
- ev := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
"Usage": 10 * time.Second}}
@@ -652,11 +652,11 @@ func TestACDGetValue(t *testing.T) {
if v := acd.GetValue(config.CgrConfig().GeneralCfg().RoundingDecimals); v != -time.Nanosecond {
t.Errorf("wrong acd value: %+v", v)
}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
Event: map[string]any{
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
"Usage": 8 * time.Second}}
- ev3 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_3"}
+ ev3 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_3"}
acd.AddEvent(ev2.ID, utils.MapStorage{utils.MetaReq: ev2.Event})
acd.AddEvent(ev3.ID, utils.MapStorage{utils.MetaReq: ev3.Event})
if v := acd.GetValue(config.CgrConfig().GeneralCfg().RoundingDecimals); v != 9*time.Second {
@@ -670,13 +670,13 @@ func TestACDGetValue(t *testing.T) {
if v := acd.GetValue(config.CgrConfig().GeneralCfg().RoundingDecimals); v != -time.Nanosecond {
t.Errorf("wrong acd value: %+v", v)
}
- ev4 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_4",
+ ev4 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_4",
Event: map[string]any{
"Usage": time.Minute,
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
},
}
- ev5 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_5",
+ ev5 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_5",
Event: map[string]any{
"Usage": 4*time.Minute + 30*time.Second,
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
@@ -700,12 +700,12 @@ func TestACDGetValue(t *testing.T) {
func TestACDAddOneEvent(t *testing.T) {
acd, _ := NewACD(2, "", []string{})
- ev1 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev1 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{utils.Usage: 2 * time.Minute}}
if err := acd.AddOneEvent(utils.MapStorage{utils.MetaReq: ev1.Event}); err != nil {
t.Error(err)
}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
Event: map[string]any{"Usage": time.Minute}}
acd.AddOneEvent(utils.MapStorage{utils.MetaReq: ev2.Event})
if strVal := acd.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals); strVal != "1m30s" {
@@ -721,7 +721,7 @@ func TestACDAddOneEvent(t *testing.T) {
func TestTCDGetStringValue(t *testing.T) {
tcd, _ := NewTCD(2, "", []string{})
- ev := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{
"Usage": 10 * time.Second,
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
@@ -733,12 +733,12 @@ func TestTCDGetStringValue(t *testing.T) {
if strVal := tcd.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals); strVal != utils.NotAvailable {
t.Errorf("wrong tcd value: %s", strVal)
}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
Event: map[string]any{
"Usage": 10 * time.Second,
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
}}
- ev3 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_3"}
+ ev3 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_3"}
tcd.AddEvent(ev2.ID, utils.MapStorage{utils.MetaReq: ev2.Event})
tcd.AddEvent(ev3.ID, utils.MapStorage{utils.MetaReq: ev3.Event})
if strVal := tcd.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals); strVal != "20s" {
@@ -752,13 +752,13 @@ func TestTCDGetStringValue(t *testing.T) {
if strVal := tcd.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals); strVal != utils.NotAvailable {
t.Errorf("wrong tcd value: %s", strVal)
}
- ev4 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_4",
+ ev4 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_4",
Event: map[string]any{
"Usage": time.Minute,
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
},
}
- ev5 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_5",
+ ev5 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_5",
Event: map[string]any{
"Usage": time.Minute + 30*time.Second,
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
@@ -782,12 +782,12 @@ func TestTCDGetStringValue(t *testing.T) {
func TestTCDGetStringValue2(t *testing.T) {
tcd, _ := NewTCD(2, "", []string{})
- ev1 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev1 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{utils.Usage: 2 * time.Minute}}
if err := tcd.AddEvent(ev1.ID, utils.MapStorage{utils.MetaReq: ev1.Event}); err != nil {
t.Error(err)
}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
Event: map[string]any{"Usage": time.Minute}}
tcd.AddEvent(ev2.ID, utils.MapStorage{utils.MetaReq: ev2.Event})
if strVal := tcd.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals); strVal != "3m0s" {
@@ -817,11 +817,11 @@ func TestTCDGetStringValue3(t *testing.T) {
Sum: 6 * time.Minute,
}
expected.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals)
- ev1 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev1 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{utils.Usage: 2 * time.Minute}}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{utils.Usage: 3 * time.Minute}}
- ev3 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_3",
+ ev3 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_3",
Event: map[string]any{"Usage": time.Minute}}
if err := tcd.AddEvent(ev1.ID, utils.MapStorage{utils.MetaReq: ev1.Event}); err != nil {
t.Error(err)
@@ -851,7 +851,7 @@ func TestTCDGetStringValue3(t *testing.T) {
func TestTCDGetFloat64Value(t *testing.T) {
tcd, _ := NewTCD(2, "", []string{})
- ev := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
"Usage": 10 * time.Second}}
@@ -859,18 +859,18 @@ func TestTCDGetFloat64Value(t *testing.T) {
if v := tcd.GetFloat64Value(config.CgrConfig().GeneralCfg().RoundingDecimals); v != -1.0 {
t.Errorf("wrong tcd value: %f", v)
}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2"}
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2"}
tcd.AddEvent(ev2.ID, utils.MapStorage{utils.MetaReq: ev2.Event})
if v := tcd.GetFloat64Value(config.CgrConfig().GeneralCfg().RoundingDecimals); v != -1.0 {
t.Errorf("wrong tcd value: %f", v)
}
- ev4 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_4",
+ ev4 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_4",
Event: map[string]any{
"Usage": time.Minute,
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
},
}
- ev5 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_5",
+ ev5 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_5",
Event: map[string]any{
"Usage": time.Minute + 30*time.Second,
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
@@ -904,7 +904,7 @@ func TestTCDGetFloat64Value(t *testing.T) {
func TestTCDGetValue(t *testing.T) {
tcd, _ := NewTCD(2, "", []string{})
- ev := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
"Usage": 10 * time.Second}}
@@ -912,11 +912,11 @@ func TestTCDGetValue(t *testing.T) {
if v := tcd.GetValue(config.CgrConfig().GeneralCfg().RoundingDecimals); v != -time.Nanosecond {
t.Errorf("wrong tcd value: %+v", v)
}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
Event: map[string]any{
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
"Usage": 5 * time.Second}}
- ev3 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_3"}
+ ev3 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_3"}
tcd.AddEvent(ev2.ID, utils.MapStorage{utils.MetaReq: ev2.Event})
tcd.AddEvent(ev3.ID, utils.MapStorage{utils.MetaReq: ev3.Event})
if v := tcd.GetValue(config.CgrConfig().GeneralCfg().RoundingDecimals); v != 15*time.Second {
@@ -930,13 +930,13 @@ func TestTCDGetValue(t *testing.T) {
if v := tcd.GetValue(config.CgrConfig().GeneralCfg().RoundingDecimals); v != -time.Nanosecond {
t.Errorf("wrong tcd value: %+v", v)
}
- ev4 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_4",
+ ev4 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_4",
Event: map[string]any{
"Usage": time.Minute,
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
},
}
- ev5 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_5",
+ ev5 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_5",
Event: map[string]any{
"Usage": time.Minute + 30*time.Second,
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
@@ -971,11 +971,11 @@ func TestTCDCompress(t *testing.T) {
Sum: 6 * time.Minute,
}
expected.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals)
- ev1 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev1 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{utils.Usage: 2 * time.Minute}}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{utils.Usage: 3 * time.Minute}}
- ev3 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_3",
+ ev3 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_3",
Event: map[string]any{"Usage": time.Minute}}
tcd.AddEvent(ev1.ID, utils.MapStorage{utils.MetaReq: ev1.Event})
tcd.AddEvent(ev2.ID, utils.MapStorage{utils.MetaReq: ev2.Event})
@@ -1019,11 +1019,11 @@ func TestTCDGetCompressFactor(t *testing.T) {
}
tcd, _ := NewTCD(2, "", []string{})
- ev := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{"Usage": time.Minute}}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
Event: map[string]any{"Usage": time.Minute}}
- ev4 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
+ ev4 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
Event: map[string]any{utils.Usage: 2 * time.Minute}}
tcd.AddEvent(ev.ID, utils.MapStorage{utils.MetaReq: ev.Event})
@@ -1046,12 +1046,12 @@ func TestTCDGetCompressFactor(t *testing.T) {
func TestTCDAddOneEvent(t *testing.T) {
tcd, _ := NewTCD(2, "", []string{})
- ev1 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev1 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{utils.Usage: 2 * time.Minute}}
if err := tcd.AddOneEvent(utils.MapStorage{utils.MetaReq: ev1.Event}); err != nil {
t.Error(err)
}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
Event: map[string]any{"Usage": time.Minute}}
tcd.AddOneEvent(utils.MapStorage{utils.MetaReq: ev2.Event})
if strVal := tcd.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals); strVal != "3m0s" {
@@ -1066,7 +1066,7 @@ func TestTCDAddOneEvent(t *testing.T) {
func TestACCGetStringValue(t *testing.T) {
acc, _ := NewACC(2, "", []string{})
- ev := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
"Cost": 12.3}}
@@ -1077,8 +1077,8 @@ func TestACCGetStringValue(t *testing.T) {
if strVal := acc.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals); strVal != utils.NotAvailable {
t.Errorf("wrong acc value: %s", strVal)
}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2"}
- ev3 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_3",
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2"}
+ ev3 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_3",
Event: map[string]any{
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
"Cost": 12.3}}
@@ -1091,11 +1091,11 @@ func TestACCGetStringValue(t *testing.T) {
if strVal := acc.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals); strVal != utils.NotAvailable {
t.Errorf("wrong acc value: %s", strVal)
}
- ev4 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_4",
+ ev4 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_4",
Event: map[string]any{
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
"Cost": 5.6}}
- ev5 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_5",
+ ev5 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_5",
Event: map[string]any{
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
"Cost": 1.2}}
@@ -1124,12 +1124,12 @@ func TestACCGetStringValue(t *testing.T) {
func TestACCGetStringValue2(t *testing.T) {
acc, _ := NewACC(2, "", []string{})
- ev1 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev1 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{"Cost": 12.3}}
if err := acc.AddEvent(ev1.ID, utils.MapStorage{utils.MetaReq: ev1.Event}); err != nil {
t.Error(err)
}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
Event: map[string]any{"Cost": 18.3}}
acc.AddEvent(ev2.ID, utils.MapStorage{utils.MetaReq: ev2.Event})
if strVal := acc.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals); strVal != "15.3" {
@@ -1159,11 +1159,11 @@ func TestACCGetStringValue3(t *testing.T) {
Sum: 42.7,
}
expected.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals)
- ev1 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev1 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{"Cost": 18.2}}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{"Cost": 6.2}}
- ev3 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_3",
+ ev3 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_3",
Event: map[string]any{"Cost": 18.3}}
if err := acc.AddEvent(ev1.ID, utils.MapStorage{utils.MetaReq: ev1.Event}); err != nil {
t.Error(err)
@@ -1193,7 +1193,7 @@ func TestACCGetStringValue3(t *testing.T) {
func TestACCGetValue(t *testing.T) {
acc, _ := NewACC(2, "", []string{})
- ev := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
"Cost": "12.3"}}
@@ -1204,8 +1204,8 @@ func TestACCGetValue(t *testing.T) {
if strVal := acc.GetValue(config.CgrConfig().GeneralCfg().RoundingDecimals); strVal != -1.0 {
t.Errorf("wrong acc value: %v", strVal)
}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2"}
- ev3 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_3"}
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2"}
+ ev3 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_3"}
acc.AddEvent(ev2.ID, utils.MapStorage{utils.MetaReq: ev2.Event})
acc.AddEvent(ev3.ID, utils.MapStorage{utils.MetaReq: ev3.Event})
if strVal := acc.GetValue(config.CgrConfig().GeneralCfg().RoundingDecimals); strVal != -1.0 {
@@ -1215,11 +1215,11 @@ func TestACCGetValue(t *testing.T) {
if strVal := acc.GetValue(config.CgrConfig().GeneralCfg().RoundingDecimals); strVal != -1.0 {
t.Errorf("wrong acc value: %v", strVal)
}
- ev4 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_4",
+ ev4 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_4",
Event: map[string]any{
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
"Cost": "5.6"}}
- ev5 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_5",
+ ev5 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_5",
Event: map[string]any{
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
"Cost": "1.2"}}
@@ -1254,11 +1254,11 @@ func TestACCCompress(t *testing.T) {
Count: 2,
}
expected.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals)
- ev := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{"Cost": 18.2}}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
Event: map[string]any{"Cost": 6.2}}
- ev4 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev4 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{"Cost": 18.3}}
acc.AddEvent(ev.ID, utils.MapStorage{utils.MetaReq: ev.Event})
acc.AddEvent(ev2.ID, utils.MapStorage{utils.MetaReq: ev2.Event})
@@ -1315,11 +1315,11 @@ func TestACCGetCompressFactor(t *testing.T) {
"EVENT_2": 1,
}
acc, _ := NewACC(2, "", []string{})
- ev := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{"Cost": 18.2}}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
Event: map[string]any{"Cost": 18.2}}
- ev4 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev4 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{"Cost": 18.2}}
acc.AddEvent(ev.ID, utils.MapStorage{utils.MetaReq: ev.Event})
acc.AddEvent(ev2.ID, utils.MapStorage{utils.MetaReq: ev2.Event})
@@ -1341,12 +1341,12 @@ func TestACCGetCompressFactor(t *testing.T) {
}
func TestACCAddOneEvent(t *testing.T) {
acc, _ := NewACC(2, "", []string{})
- ev1 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev1 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{"Cost": 12.3}}
if err := acc.AddOneEvent(utils.MapStorage{utils.MetaReq: ev1.Event}); err != nil {
t.Error(err)
}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
Event: map[string]any{"Cost": 18.3}}
acc.AddOneEvent(utils.MapStorage{utils.MetaReq: ev2.Event})
if strVal := acc.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals); strVal != "15.3" {
@@ -1361,7 +1361,7 @@ func TestACCAddOneEvent(t *testing.T) {
func TestTCCGetStringValue(t *testing.T) {
tcc, _ := NewTCC(2, "", []string{})
- ev := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
"Cost": 12.3}}
@@ -1372,8 +1372,8 @@ func TestTCCGetStringValue(t *testing.T) {
if strVal := tcc.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals); strVal != utils.NotAvailable {
t.Errorf("wrong tcc value: %s", strVal)
}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2"}
- ev3 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_3",
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2"}
+ ev3 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_3",
Event: map[string]any{
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
"Cost": 5.7}}
@@ -1386,11 +1386,11 @@ func TestTCCGetStringValue(t *testing.T) {
if strVal := tcc.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals); strVal != utils.NotAvailable {
t.Errorf("wrong tcc value: %s", strVal)
}
- ev4 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_4",
+ ev4 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_4",
Event: map[string]any{
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
"Cost": 5.6}}
- ev5 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_5",
+ ev5 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_5",
Event: map[string]any{
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
"Cost": 1.2}}
@@ -1420,12 +1420,12 @@ func TestTCCGetStringValue(t *testing.T) {
func TestTCCGetStringValue2(t *testing.T) {
tcc, _ := NewTCC(2, "", []string{})
- ev1 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev1 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{"Cost": 12.3}}
if err := tcc.AddEvent(ev1.ID, utils.MapStorage{utils.MetaReq: ev1.Event}); err != nil {
t.Error(err)
}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
Event: map[string]any{"Cost": 18.3}}
tcc.AddEvent(ev2.ID, utils.MapStorage{utils.MetaReq: ev2.Event})
if strVal := tcc.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals); strVal != "30.6" {
@@ -1455,11 +1455,11 @@ func TestTCCGetStringValue3(t *testing.T) {
Sum: 42.7,
}
expected.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals)
- ev1 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev1 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{"Cost": 18.2}}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{"Cost": 6.2}}
- ev3 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_3",
+ ev3 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_3",
Event: map[string]any{"Cost": 18.3}}
if err := tcc.AddEvent(ev1.ID, utils.MapStorage{utils.MetaReq: ev1.Event}); err != nil {
t.Error(err)
@@ -1489,7 +1489,7 @@ func TestTCCGetStringValue3(t *testing.T) {
func TestTCCGetValue(t *testing.T) {
tcc, _ := NewTCC(2, "", []string{})
- ev := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
"Cost": "12.3"}}
@@ -1500,8 +1500,8 @@ func TestTCCGetValue(t *testing.T) {
if strVal := tcc.GetValue(config.CgrConfig().GeneralCfg().RoundingDecimals); strVal != -1.0 {
t.Errorf("wrong tcc value: %v", strVal)
}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2"}
- ev3 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_3",
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2"}
+ ev3 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_3",
Event: map[string]any{
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
"Cost": 1.2}}
@@ -1514,11 +1514,11 @@ func TestTCCGetValue(t *testing.T) {
if strVal := tcc.GetValue(config.CgrConfig().GeneralCfg().RoundingDecimals); strVal != -1.0 {
t.Errorf("wrong tcc value: %v", strVal)
}
- ev4 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_4",
+ ev4 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_4",
Event: map[string]any{
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
"Cost": "5.6"}}
- ev5 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_5",
+ ev5 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_5",
Event: map[string]any{
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
"Cost": "1.2"}}
@@ -1553,11 +1553,11 @@ func TestTCCCompress(t *testing.T) {
Count: 2,
}
expected.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals)
- ev := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{"Cost": 18.2}}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
Event: map[string]any{"Cost": 6.2}}
- ev4 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev4 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{"Cost": 18.3}}
tcc.AddEvent(ev.ID, utils.MapStorage{utils.MetaReq: ev.Event})
tcc.AddEvent(ev2.ID, utils.MapStorage{utils.MetaReq: ev2.Event})
@@ -1614,11 +1614,11 @@ func TestTCCGetCompressFactor(t *testing.T) {
"EVENT_2": 1,
}
tcc, _ := NewTCC(2, "", []string{})
- ev := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{"Cost": 18.2}}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
Event: map[string]any{"Cost": 18.2}}
- ev4 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev4 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{"Cost": 18.2}}
tcc.AddEvent(ev.ID, utils.MapStorage{utils.MetaReq: ev.Event})
tcc.AddEvent(ev2.ID, utils.MapStorage{utils.MetaReq: ev2.Event})
@@ -1641,12 +1641,12 @@ func TestTCCGetCompressFactor(t *testing.T) {
func TestTCCAddOneEvent(t *testing.T) {
tcc, _ := NewTCC(2, "", []string{})
- ev1 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev1 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{"Cost": 12.3}}
if err := tcc.AddOneEvent(utils.MapStorage{utils.MetaReq: ev1.Event}); err != nil {
t.Error(err)
}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
Event: map[string]any{"Cost": 18.3}}
tcc.AddOneEvent(utils.MapStorage{utils.MetaReq: ev2.Event})
if strVal := tcc.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals); strVal != "30.6" {
@@ -1661,7 +1661,7 @@ func TestTCCAddOneEvent(t *testing.T) {
func TestPDDGetStringValue(t *testing.T) {
pdd, _ := NewPDD(2, "", []string{})
- ev := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{
utils.Usage: 10 * time.Second,
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
@@ -1674,8 +1674,8 @@ func TestPDDGetStringValue(t *testing.T) {
if strVal := pdd.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals); strVal != utils.NotAvailable {
t.Errorf("wrong pdd value: %s", strVal)
}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2"}
- ev3 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_3"}
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2"}
+ ev3 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_3"}
pdd.AddEvent(ev2.ID, utils.MapStorage{utils.MetaReq: ev2.Event})
pdd.AddEvent(ev3.ID, utils.MapStorage{utils.MetaReq: ev3.Event})
if strVal := pdd.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals); strVal != utils.NotAvailable {
@@ -1689,14 +1689,14 @@ func TestPDDGetStringValue(t *testing.T) {
if strVal := pdd.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals); strVal != utils.NotAvailable {
t.Errorf("wrong pdd value: %s", strVal)
}
- ev4 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_4",
+ ev4 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_4",
Event: map[string]any{
"Usage": time.Minute,
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
utils.PDD: 10 * time.Second,
},
}
- ev5 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_5",
+ ev5 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_5",
Event: map[string]any{
utils.PDD: 10 * time.Second,
},
@@ -1723,12 +1723,12 @@ func TestPDDGetStringValue(t *testing.T) {
func TestPDDGetStringValue2(t *testing.T) {
pdd, _ := NewPDD(2, "", []string{})
- ev1 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev1 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{utils.PDD: 2 * time.Minute}}
if err := pdd.AddEvent(ev1.ID, utils.MapStorage{utils.MetaReq: ev1.Event}); err != nil {
t.Error(err)
}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
Event: map[string]any{utils.PDD: time.Minute}}
pdd.AddEvent(ev2.ID, utils.MapStorage{utils.MetaReq: ev2.Event})
if strVal := pdd.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals); strVal != "1m30s" {
@@ -1758,11 +1758,11 @@ func TestPDDGetStringValue3(t *testing.T) {
Sum: 6 * time.Minute,
}
expected.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals)
- ev1 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev1 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{utils.PDD: 2 * time.Minute}}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{utils.PDD: 3 * time.Minute}}
- ev3 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_3",
+ ev3 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_3",
Event: map[string]any{utils.PDD: time.Minute}}
if err := pdd.AddEvent(ev1.ID, utils.MapStorage{utils.MetaReq: ev1.Event}); err != nil {
t.Error(err)
@@ -1792,7 +1792,7 @@ func TestPDDGetStringValue3(t *testing.T) {
func TestPDDGetFloat64Value(t *testing.T) {
pdd, _ := NewPDD(2, "", []string{})
- ev := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
"Usage": 10 * time.Second,
@@ -1801,19 +1801,19 @@ func TestPDDGetFloat64Value(t *testing.T) {
if v := pdd.GetFloat64Value(config.CgrConfig().GeneralCfg().RoundingDecimals); v != -1.0 {
t.Errorf("wrong pdd value: %v", v)
}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2"}
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2"}
pdd.AddEvent(ev2.ID, utils.MapStorage{utils.MetaReq: ev2.Event})
if v := pdd.GetFloat64Value(config.CgrConfig().GeneralCfg().RoundingDecimals); v != -1.0 {
t.Errorf("wrong pdd value: %v", v)
}
- ev4 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_4",
+ ev4 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_4",
Event: map[string]any{
"Usage": time.Minute,
"AnswerTime": time.Date(2015, 7, 14, 14, 25, 0, 0, time.UTC),
utils.PDD: 10 * time.Second,
},
}
- ev5 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_5",
+ ev5 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_5",
Event: map[string]any{
"Usage": time.Minute + 30*time.Second,
"AnswerTime": time.Date(2015, 7, 14, 14, 25, 0, 0, time.UTC),
@@ -1847,7 +1847,7 @@ func TestPDDGetFloat64Value(t *testing.T) {
func TestPDDGetValue(t *testing.T) {
pdd, _ := NewPDD(2, "", []string{})
- ev := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
"Usage": 10 * time.Second,
@@ -1856,12 +1856,12 @@ func TestPDDGetValue(t *testing.T) {
if v := pdd.GetValue(config.CgrConfig().GeneralCfg().RoundingDecimals); v != -time.Nanosecond {
t.Errorf("wrong pdd value: %+v", v)
}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
Event: map[string]any{
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
"Usage": 8 * time.Second,
utils.PDD: 10 * time.Second}}
- ev3 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_3"}
+ ev3 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_3"}
if err := pdd.AddEvent(ev2.ID, utils.MapStorage{utils.MetaReq: ev2.Event}); err != nil {
t.Error(err)
}
@@ -1883,14 +1883,14 @@ func TestPDDGetValue(t *testing.T) {
if v := pdd.GetValue(config.CgrConfig().GeneralCfg().RoundingDecimals); v != -time.Nanosecond {
t.Errorf("wrong pdd value: %+v", v)
}
- ev4 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_4",
+ ev4 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_4",
Event: map[string]any{
"Usage": time.Minute,
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
utils.PDD: 8 * time.Second,
},
}
- ev5 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_5",
+ ev5 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_5",
Event: map[string]any{
"Usage": 4*time.Minute + 30*time.Second,
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
@@ -1929,11 +1929,11 @@ func TestPDDCompress(t *testing.T) {
Sum: 6 * time.Minute,
}
expected.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals)
- ev1 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev1 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{utils.PDD: 2 * time.Minute}}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{utils.PDD: 3 * time.Minute}}
- ev3 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_3",
+ ev3 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_3",
Event: map[string]any{utils.PDD: time.Minute}}
pdd.AddEvent(ev1.ID, utils.MapStorage{utils.MetaReq: ev1.Event})
pdd.AddEvent(ev2.ID, utils.MapStorage{utils.MetaReq: ev2.Event})
@@ -1977,11 +1977,11 @@ func TestPDDGetCompressFactor(t *testing.T) {
}
pdd, _ := NewPDD(2, "", []string{})
- ev := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{utils.PDD: time.Minute}}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
Event: map[string]any{utils.PDD: time.Minute}}
- ev4 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
+ ev4 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
Event: map[string]any{utils.PDD: 2 * time.Minute}}
pdd.AddEvent(ev.ID, utils.MapStorage{utils.MetaReq: ev.Event})
@@ -2004,12 +2004,12 @@ func TestPDDGetCompressFactor(t *testing.T) {
func TestPDDAddOneEvent(t *testing.T) {
pdd, _ := NewPDD(2, "", []string{})
- ev1 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev1 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{utils.PDD: 2 * time.Minute}}
if err := pdd.AddOneEvent(utils.MapStorage{utils.MetaReq: ev1.Event}); err != nil {
t.Error(err)
}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
Event: map[string]any{utils.PDD: time.Minute}}
pdd.AddOneEvent(utils.MapStorage{utils.MetaReq: ev2.Event})
if strVal := pdd.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals); strVal != "1m30s" {
@@ -2024,7 +2024,7 @@ func TestPDDAddOneEvent(t *testing.T) {
func TestDDCGetStringValue(t *testing.T) {
ddc, _ := NewDDC(2, "", []string{})
- ev := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
utils.Destination: "1002"}}
@@ -2036,12 +2036,12 @@ func TestDDCGetStringValue(t *testing.T) {
if strVal := ddc.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals); strVal != utils.NotAvailable {
t.Errorf("wrong ddc value: %s", strVal)
}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
Event: map[string]any{
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
utils.Destination: "1002"}}
- ev3 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_3",
+ ev3 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_3",
Event: map[string]any{
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
utils.Destination: "1001"}}
@@ -2066,7 +2066,7 @@ func TestDDCGetStringValue(t *testing.T) {
func TestDDCGetFloat64Value(t *testing.T) {
ddc, _ := NewDDC(2, "", []string{})
- ev := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
"Usage": 10 * time.Second,
@@ -2076,12 +2076,12 @@ func TestDDCGetFloat64Value(t *testing.T) {
if v := ddc.GetFloat64Value(config.CgrConfig().GeneralCfg().RoundingDecimals); v != -1.0 {
t.Errorf("wrong ddc value: %v", v)
}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2"}
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2"}
ddc.AddEvent(ev2.ID, utils.MapStorage{utils.MetaReq: ev2.Event})
if v := ddc.GetFloat64Value(config.CgrConfig().GeneralCfg().RoundingDecimals); v != -1.0 {
t.Errorf("wrong ddc value: %v", v)
}
- ev4 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_4",
+ ev4 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_4",
Event: map[string]any{
"Usage": time.Minute,
"AnswerTime": time.Date(2015, 7, 14, 14, 25, 0, 0, time.UTC),
@@ -2089,7 +2089,7 @@ func TestDDCGetFloat64Value(t *testing.T) {
utils.Destination: "1001",
},
}
- ev5 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_5",
+ ev5 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_5",
Event: map[string]any{
"Usage": time.Minute + 30*time.Second,
"AnswerTime": time.Date(2015, 7, 14, 14, 25, 0, 0, time.UTC),
@@ -2124,7 +2124,7 @@ func TestDDCGetFloat64Value(t *testing.T) {
func TestDDCGetStringValue2(t *testing.T) {
statDistinct, _ := NewDDC(2, "", []string{})
- ev := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{utils.Destination: "1001"}}
if strVal := statDistinct.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals); strVal != utils.NotAvailable {
t.Errorf("wrong statDistinct value: %s", strVal)
@@ -2134,7 +2134,7 @@ func TestDDCGetStringValue2(t *testing.T) {
if strVal := statDistinct.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals); strVal != utils.NotAvailable {
t.Errorf("wrong statDistinct value: %s", strVal)
}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{utils.Destination: "1002"}}
statDistinct.AddEvent(ev2.ID, utils.MapStorage{utils.MetaReq: ev2.Event})
if strVal := statDistinct.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals); strVal != "2" {
@@ -2175,11 +2175,11 @@ func TestDDCCompress(t *testing.T) {
Count: 3,
}
expected.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals)
- ev1 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev1 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{utils.Destination: "1001"}}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{utils.Destination: "1001"}}
- ev3 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_3",
+ ev3 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_3",
Event: map[string]any{utils.Destination: "1002"}}
ddc.AddEvent(ev1.ID, utils.MapStorage{utils.MetaReq: ev1.Event})
ddc.AddEvent(ev2.ID, utils.MapStorage{utils.MetaReq: ev2.Event})
@@ -2213,11 +2213,11 @@ func TestDDCGetCompressFactor(t *testing.T) {
}
ddc, _ := NewDDC(2, "", []string{})
- ev := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{utils.Destination: "1002"}}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
Event: map[string]any{utils.Destination: "1001"}}
- ev4 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
+ ev4 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
Event: map[string]any{utils.Destination: "1001"}}
ddc.AddEvent(ev.ID, utils.MapStorage{utils.MetaReq: ev.Event})
@@ -2240,7 +2240,7 @@ func TestDDCGetCompressFactor(t *testing.T) {
func TestDDCAddOneEvent(t *testing.T) {
statDistinct, _ := NewDDC(2, "", []string{})
- ev := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{utils.Destination: "1001"}}
if strVal := statDistinct.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals); strVal != utils.NotAvailable {
t.Errorf("wrong statDistinct value: %s", strVal)
@@ -2250,7 +2250,7 @@ func TestDDCAddOneEvent(t *testing.T) {
if strVal := statDistinct.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals); strVal != utils.NotAvailable {
t.Errorf("wrong statDistinct value: %s", strVal)
}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{utils.Destination: "1002"}}
statDistinct.AddOneEvent(utils.MapStorage{utils.MetaReq: ev2.Event})
if strVal := statDistinct.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals); strVal != "2" {
@@ -2260,7 +2260,7 @@ func TestDDCAddOneEvent(t *testing.T) {
func TestStatSumGetFloat64Value(t *testing.T) {
statSum, _ := NewStatSum(2, "~*req.Cost", []string{})
- ev := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{
"Cost": "20",
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
@@ -2271,14 +2271,14 @@ func TestStatSumGetFloat64Value(t *testing.T) {
if v := statSum.GetFloat64Value(config.CgrConfig().GeneralCfg().RoundingDecimals); v != -1.0 {
t.Errorf("wrong statSum value: %v", v)
}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2"}
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2"}
if err := statSum.AddEvent(ev2.ID, utils.MapStorage{utils.MetaReq: ev2.Event}); err == nil || err.Error() != "NOT_FOUND:~*req.Cost" {
t.Error(err)
}
if v := statSum.GetFloat64Value(config.CgrConfig().GeneralCfg().RoundingDecimals); v != -1.0 {
t.Errorf("wrong statSum value: %v", v)
}
- ev4 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_4",
+ ev4 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_4",
Event: map[string]any{
"Cost": "20",
"Usage": time.Minute,
@@ -2287,7 +2287,7 @@ func TestStatSumGetFloat64Value(t *testing.T) {
utils.Destination: "1001",
},
}
- ev5 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_5",
+ ev5 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_5",
Event: map[string]any{
"Cost": "20",
"Usage": time.Minute + 30*time.Second,
@@ -2323,7 +2323,7 @@ func TestStatSumGetFloat64Value(t *testing.T) {
func TestStatSumGetStringValue(t *testing.T) {
statSum, _ := NewStatSum(2, "~*req.Cost", []string{})
- ev := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{
"Cost": "20",
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
@@ -2336,13 +2336,13 @@ func TestStatSumGetStringValue(t *testing.T) {
if strVal := statSum.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals); strVal != utils.NotAvailable {
t.Errorf("wrong statSum value: %s", strVal)
}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
Event: map[string]any{
"Cost": "20",
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
utils.Destination: "1002"}}
- ev3 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_3",
+ ev3 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_3",
Event: map[string]any{
"Cost": "20",
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
@@ -2368,12 +2368,12 @@ func TestStatSumGetStringValue(t *testing.T) {
func TestStatSumGetStringValue2(t *testing.T) {
statSum, _ := NewStatSum(2, "~*req.Cost", []string{})
- ev1 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev1 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{"Cost": 12.3}}
if err := statSum.AddEvent(ev1.ID, utils.MapStorage{utils.MetaReq: ev1.Event}); err != nil {
t.Error(err)
}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
Event: map[string]any{"Cost": 18.3}}
statSum.AddEvent(ev2.ID, utils.MapStorage{utils.MetaReq: ev2.Event})
if strVal := statSum.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals); strVal != "30.6" {
@@ -2404,11 +2404,11 @@ func TestStatSumGetStringValue3(t *testing.T) {
Sum: 42.7,
}
expected.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals)
- ev1 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev1 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{"Cost": 18.2}}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{"Cost": 6.2}}
- ev3 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_3",
+ ev3 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_3",
Event: map[string]any{"Cost": 18.3}}
if err := statSum.AddEvent(ev1.ID, utils.MapStorage{utils.MetaReq: ev1.Event}); err != nil {
t.Error(err)
@@ -2451,11 +2451,11 @@ func TestStatSumCompress(t *testing.T) {
Count: 2,
}
expected.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals)
- ev := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{"Cost": 18.2}}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
Event: map[string]any{"Cost": 6.2}}
- ev4 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev4 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{"Cost": 18.3}}
sum.AddEvent(ev.ID, utils.MapStorage{utils.MetaReq: ev.Event})
sum.AddEvent(ev2.ID, utils.MapStorage{utils.MetaReq: ev2.Event})
@@ -2513,11 +2513,11 @@ func TestStatSumGetCompressFactor(t *testing.T) {
"EVENT_2": 1,
}
sum, _ := NewStatSum(2, "~*req.Cost", []string{})
- ev := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{"Cost": 18.2}}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
Event: map[string]any{"Cost": 18.2}}
- ev4 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev4 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{"Cost": 18.2}}
sum.AddEvent(ev.ID, utils.MapStorage{utils.MetaReq: ev.Event})
sum.AddEvent(ev2.ID, utils.MapStorage{utils.MetaReq: ev2.Event})
@@ -2540,12 +2540,12 @@ func TestStatSumGetCompressFactor(t *testing.T) {
func TestStatSumAddOneEvent(t *testing.T) {
statSum, _ := NewStatSum(2, "~*req.Cost", []string{})
- ev1 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev1 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{"Cost": 12.3}}
if err := statSum.AddOneEvent(utils.MapStorage{utils.MetaReq: ev1.Event}); err != nil {
t.Error(err)
}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
Event: map[string]any{"Cost": 18.3}}
statSum.AddOneEvent(utils.MapStorage{utils.MetaReq: ev2.Event})
if strVal := statSum.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals); strVal != "30.6" {
@@ -2560,7 +2560,7 @@ func TestStatSumAddOneEvent(t *testing.T) {
func TestStatAverageGetFloat64Value(t *testing.T) {
statAvg, _ := NewStatAverage(2, "~*req.Cost", []string{})
- ev := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{
"Cost": "20",
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
@@ -2571,12 +2571,12 @@ func TestStatAverageGetFloat64Value(t *testing.T) {
if v := statAvg.GetFloat64Value(config.CgrConfig().GeneralCfg().RoundingDecimals); v != -1.0 {
t.Errorf("wrong statAvg value: %v", v)
}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2"}
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2"}
statAvg.AddEvent(ev2.ID, utils.MapStorage{utils.MetaReq: ev2.Event})
if v := statAvg.GetFloat64Value(config.CgrConfig().GeneralCfg().RoundingDecimals); v != -1.0 {
t.Errorf("wrong statAvg value: %v", v)
}
- ev4 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_4",
+ ev4 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_4",
Event: map[string]any{
"Cost": "30",
"Usage": time.Minute,
@@ -2585,7 +2585,7 @@ func TestStatAverageGetFloat64Value(t *testing.T) {
utils.Destination: "1001",
},
}
- ev5 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_5",
+ ev5 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_5",
Event: map[string]any{
"Cost": "20",
"Usage": time.Minute + 30*time.Second,
@@ -2621,7 +2621,7 @@ func TestStatAverageGetFloat64Value(t *testing.T) {
func TestStatAverageGetStringValue(t *testing.T) {
statAvg, _ := NewStatAverage(2, "~*req.Cost", []string{})
- ev := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{
"Cost": "20",
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
@@ -2634,13 +2634,13 @@ func TestStatAverageGetStringValue(t *testing.T) {
if strVal := statAvg.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals); strVal != utils.NotAvailable {
t.Errorf("wrong statAvg value: %s", strVal)
}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
Event: map[string]any{
"Cost": "20",
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
utils.Destination: "1002"}}
- ev3 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_3",
+ ev3 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_3",
Event: map[string]any{
"Cost": "20",
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
@@ -2666,12 +2666,12 @@ func TestStatAverageGetStringValue(t *testing.T) {
func TestStatAverageGetStringValue2(t *testing.T) {
statAvg, _ := NewStatAverage(2, "~*req.Cost", []string{})
- ev1 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev1 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{"Cost": 12.3}}
if err := statAvg.AddEvent(ev1.ID, utils.MapStorage{utils.MetaReq: ev1.Event}); err != nil {
t.Error(err)
}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
Event: map[string]any{"Cost": 18.3}}
statAvg.AddEvent(ev2.ID, utils.MapStorage{utils.MetaReq: ev2.Event})
if strVal := statAvg.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals); strVal != "15.3" {
@@ -2703,11 +2703,11 @@ func TestStatAverageGetStringValue3(t *testing.T) {
Sum: 42.7,
}
expected.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals)
- ev1 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev1 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{"Cost": 18.2}}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{"Cost": 6.2}}
- ev3 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_3",
+ ev3 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_3",
Event: map[string]any{"Cost": 18.3}}
if err := statAvg.AddEvent(ev1.ID, utils.MapStorage{utils.MetaReq: ev1.Event}); err != nil {
t.Error(err)
@@ -2750,11 +2750,11 @@ func TestStatAverageCompress(t *testing.T) {
Count: 2,
}
expected.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals)
- ev := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{"Cost": 18.2}}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
Event: map[string]any{"Cost": 6.2}}
- ev4 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev4 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{"Cost": 18.3}}
avg.AddEvent(ev.ID, utils.MapStorage{utils.MetaReq: ev.Event})
avg.AddEvent(ev2.ID, utils.MapStorage{utils.MetaReq: ev2.Event})
@@ -2812,11 +2812,11 @@ func TestStatAverageGetCompressFactor(t *testing.T) {
"EVENT_2": 1,
}
avg, _ := NewStatAverage(2, "~*req.Cost", []string{})
- ev := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{"Cost": 18.2}}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
Event: map[string]any{"Cost": 18.2}}
- ev4 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev4 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{"Cost": 18.2}}
avg.AddEvent(ev.ID, utils.MapStorage{utils.MetaReq: ev.Event})
avg.AddEvent(ev2.ID, utils.MapStorage{utils.MetaReq: ev2.Event})
@@ -2839,12 +2839,12 @@ func TestStatAverageGetCompressFactor(t *testing.T) {
func TestStatAverageAddOneEvent(t *testing.T) {
statAvg, _ := NewStatAverage(2, "~*req.Cost", []string{})
- ev1 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev1 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{"Cost": 12.3}}
if err := statAvg.AddOneEvent(utils.MapStorage{utils.MetaReq: ev1.Event}); err != nil {
t.Error(err)
}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
Event: map[string]any{"Cost": 18.3}}
statAvg.AddOneEvent(utils.MapStorage{utils.MetaReq: ev2.Event})
if strVal := statAvg.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals); strVal != "15.3" {
@@ -2859,23 +2859,23 @@ func TestStatAverageAddOneEvent(t *testing.T) {
func TestStatDistinctGetFloat64Value(t *testing.T) {
statDistinct, _ := NewStatDistinct(2, "~*req.Usage", []string{})
- ev := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{"Usage": 10 * time.Second}}
statDistinct.AddEvent(ev.ID, utils.MapStorage{utils.MetaReq: ev.Event})
if v := statDistinct.GetFloat64Value(config.CgrConfig().GeneralCfg().RoundingDecimals); v != -1.0 {
t.Errorf("wrong statDistinct value: %v", v)
}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2"}
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2"}
statDistinct.AddEvent(ev2.ID, utils.MapStorage{utils.MetaReq: ev2.Event})
if v := statDistinct.GetFloat64Value(config.CgrConfig().GeneralCfg().RoundingDecimals); v != -1.0 {
t.Errorf("wrong statDistinct value: %v", v)
}
- ev4 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_4",
+ ev4 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_4",
Event: map[string]any{
"Usage": time.Minute,
},
}
- ev5 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_5",
+ ev5 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_5",
Event: map[string]any{
"Usage": time.Minute + 30*time.Second,
},
@@ -2910,7 +2910,7 @@ func TestStatDistinctGetFloat64Value(t *testing.T) {
func TestStatDistinctGetStringValue(t *testing.T) {
statDistinct, _ := NewStatDistinct(2, "~*req.Cost", []string{})
- ev := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{"Cost": "20"}}
if strVal := statDistinct.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals); strVal != utils.NotAvailable {
t.Errorf("wrong statDistinct value: %s", strVal)
@@ -2920,9 +2920,9 @@ func TestStatDistinctGetStringValue(t *testing.T) {
if strVal := statDistinct.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals); strVal != utils.NotAvailable {
t.Errorf("wrong statDistinct value: %s", strVal)
}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
Event: map[string]any{"Cost": "20"}}
- ev3 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_3",
+ ev3 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_3",
Event: map[string]any{"Cost": "40"}}
statDistinct.AddEvent(ev2.ID, utils.MapStorage{utils.MetaReq: ev2.Event})
statDistinct.AddEvent(ev3.ID, utils.MapStorage{utils.MetaReq: ev3.Event})
@@ -2945,7 +2945,7 @@ func TestStatDistinctGetStringValue(t *testing.T) {
func TestStatDistinctGetStringValue2(t *testing.T) {
statDistinct, _ := NewStatDistinct(2, "~*req.Cost", []string{})
- ev := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{"Cost": "20"}}
if strVal := statDistinct.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals); strVal != utils.NotAvailable {
t.Errorf("wrong statDistinct value: %s", strVal)
@@ -2955,7 +2955,7 @@ func TestStatDistinctGetStringValue2(t *testing.T) {
if strVal := statDistinct.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals); strVal != utils.NotAvailable {
t.Errorf("wrong statDistinct value: %s", strVal)
}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{"Cost": "40"}}
statDistinct.AddEvent(ev2.ID, utils.MapStorage{utils.MetaReq: ev2.Event})
if strVal := statDistinct.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals); strVal != "2" {
@@ -2998,11 +2998,11 @@ func TestStatDistinctCompress(t *testing.T) {
Count: 3,
}
expected.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals)
- ev1 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev1 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{utils.Destination: "1001"}}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{utils.Destination: "1001"}}
- ev3 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_3",
+ ev3 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_3",
Event: map[string]any{utils.Destination: "1002"}}
ddc.AddEvent(ev1.ID, utils.MapStorage{utils.MetaReq: ev1.Event})
ddc.AddEvent(ev2.ID, utils.MapStorage{utils.MetaReq: ev2.Event})
@@ -3036,11 +3036,11 @@ func TestStatDistinctGetCompressFactor(t *testing.T) {
}
ddc, _ := NewStatDistinct(2, utils.DynamicDataPrefix+utils.MetaReq+utils.NestingSep+utils.Destination, []string{})
- ev := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{utils.Destination: "1002"}}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
Event: map[string]any{utils.Destination: "1001"}}
- ev4 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
+ ev4 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_2",
Event: map[string]any{utils.Destination: "1001"}}
ddc.AddEvent(ev.ID, utils.MapStorage{utils.MetaReq: ev.Event})
@@ -3063,7 +3063,7 @@ func TestStatDistinctGetCompressFactor(t *testing.T) {
func TestStatDistinctAddOneEvent(t *testing.T) {
statDistinct, _ := NewStatDistinct(2, "~*req.Cost", []string{})
- ev := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{"Cost": "20"}}
if strVal := statDistinct.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals); strVal != utils.NotAvailable {
t.Errorf("wrong statDistinct value: %s", strVal)
@@ -3073,7 +3073,7 @@ func TestStatDistinctAddOneEvent(t *testing.T) {
if strVal := statDistinct.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals); strVal != utils.NotAvailable {
t.Errorf("wrong statDistinct value: %s", strVal)
}
- ev2 := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev2 := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{"Cost": "40"}}
statDistinct.AddOneEvent(utils.MapStorage{utils.MetaReq: ev2.Event})
if strVal := statDistinct.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals); strVal != "2" {
@@ -3085,7 +3085,7 @@ var jMarshaler JSONMarshaler
func TestASRMarshal(t *testing.T) {
asr, _ := NewASR(2, "", []string{"*string:Account:1001"})
- ev := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC)}}
asr.AddEvent(ev.ID, utils.MapStorage{utils.MetaReq: ev.Event})
@@ -3104,7 +3104,7 @@ func TestASRMarshal(t *testing.T) {
func TestACDMarshal(t *testing.T) {
acd, _ := NewACD(2, "", []string{})
- ev := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
"Usage": 10 * time.Second}}
@@ -3124,7 +3124,7 @@ func TestACDMarshal(t *testing.T) {
func TestTCDMarshal(t *testing.T) {
tcd, _ := NewTCD(2, "", []string{})
- ev := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
"Usage": 10 * time.Second}}
@@ -3144,7 +3144,7 @@ func TestTCDMarshal(t *testing.T) {
func TestACCMarshal(t *testing.T) {
acc, _ := NewACC(2, "", []string{})
- ev := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
"Cost": "12.3"}}
@@ -3164,7 +3164,7 @@ func TestACCMarshal(t *testing.T) {
func TestTCCMarshal(t *testing.T) {
tcc, _ := NewTCC(2, "", []string{})
- ev := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
"Cost": "12.3"}}
@@ -3184,7 +3184,7 @@ func TestTCCMarshal(t *testing.T) {
func TestPDDMarshal(t *testing.T) {
pdd, _ := NewPDD(2, "", []string{})
- ev := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
"Usage": 10 * time.Second,
@@ -3205,7 +3205,7 @@ func TestPDDMarshal(t *testing.T) {
func TestDCCMarshal(t *testing.T) {
ddc, _ := NewDDC(2, "", []string{})
- ev := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
"Usage": 10 * time.Second,
@@ -3227,7 +3227,7 @@ func TestDCCMarshal(t *testing.T) {
func TestStatSumMarshal(t *testing.T) {
statSum, _ := NewStatSum(2, "~*req.Cost", []string{})
- ev := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{
"Cost": "20",
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
@@ -3250,7 +3250,7 @@ func TestStatSumMarshal(t *testing.T) {
func TestStatAverageMarshal(t *testing.T) {
statAvg, _ := NewStatAverage(2, "~*req.Cost", []string{})
- ev := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{
"Cost": "20",
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
@@ -3273,7 +3273,7 @@ func TestStatAverageMarshal(t *testing.T) {
func TestStatDistrictMarshal(t *testing.T) {
statDistinct, _ := NewStatDistinct(2, "~*req.Usage", []string{})
- ev := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{
"Cost": "20",
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC),
@@ -3480,7 +3480,7 @@ func TestStatMetricsStatDistinctRemEvent2(t *testing.T) {
func TestStatMetricsStatDistinctAddEventErr(t *testing.T) {
asr, _ := NewASR(2, "", []string{})
- ev := &utils.CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
+ ev := &CGREvent{Tenant: "cgrates.org", ID: "EVENT_1",
Event: map[string]any{
"AnswerTime": time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC)}}
if strVal := asr.GetStringValue(config.CgrConfig().GeneralCfg().RoundingDecimals); strVal != utils.NotAvailable {
@@ -4021,7 +4021,7 @@ func TestStatMetricsStatDDCGetValue(t *testing.T) {
}
func TestStatMetricsStatASRAddEventErr1(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &CGREvent{
Tenant: "cgrates.org",
ID: "EVENT_1",
Event: map[string]any{
@@ -4046,7 +4046,7 @@ func TestStatMetricsStatASRAddEventErr1(t *testing.T) {
}
func TestStatMetricsStatASRAddEventErr2(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &CGREvent{
Tenant: "cgrates.org",
ID: "EVENT_1",
Event: map[string]any{
@@ -4071,7 +4071,7 @@ func TestStatMetricsStatASRAddEventErr2(t *testing.T) {
}
func TestStatMetricsStatACDAddEventErr(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &CGREvent{
Tenant: "cgrates.org",
ID: "EVENT_1",
Event: map[string]any{
@@ -4120,7 +4120,7 @@ func TestStatMetricsStatACDGetCompressFactor(t *testing.T) {
}
func TestStatMetricsStatTCDAddEventErr(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &CGREvent{
Tenant: "cgrates.org",
ID: "EVENT_1",
Event: map[string]any{
@@ -4169,7 +4169,7 @@ func TestStatMetricsStatTCDGetCompressFactor(t *testing.T) {
}
func TestStatMetricsStatACCAddEventErr(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &CGREvent{
Tenant: "cgrates.org",
ID: "EVENT_1",
Event: map[string]any{
@@ -4195,7 +4195,7 @@ func TestStatMetricsStatACCAddEventErr(t *testing.T) {
}
func TestStatMetricsStatTCCAddEventErr(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &CGREvent{
Tenant: "cgrates.org",
ID: "EVENT_1",
Event: map[string]any{
@@ -4221,7 +4221,7 @@ func TestStatMetricsStatTCCAddEventErr(t *testing.T) {
}
func TestStatMetricsStatPDDAddEventErr(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &CGREvent{
Tenant: "cgrates.org",
ID: "EVENT_1",
Event: map[string]any{
@@ -4293,7 +4293,7 @@ func TestStatMetricsStatDDCGetCompressFactor(t *testing.T) {
}
func TestStatMetricsStatSumAddEventErr(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &CGREvent{
Tenant: "cgrates.org",
ID: "EVENT_1",
Event: map[string]any{
@@ -4319,7 +4319,7 @@ func TestStatMetricsStatSumAddEventErr(t *testing.T) {
}
func TestStatMetricsStatAverageAddEventErr(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &CGREvent{
Tenant: "cgrates.org",
ID: "EVENT_1",
Event: map[string]any{
diff --git a/engine/stats.go b/engine/stats.go
index ee6977101..e3720e779 100644
--- a/engine/stats.go
+++ b/engine/stats.go
@@ -296,7 +296,7 @@ func (sS *StatService) processThresholds(sQs StatQueues, opts map[string]any) (e
thIDs = sq.sqPrfl.ThresholdIDs
}
opts[utils.OptsThresholdsProfileIDs] = thIDs
- thEv := &utils.CGREvent{
+ thEv := &CGREvent{
Tenant: sq.Tenant,
ID: utils.GenUUID(),
Event: map[string]any{
@@ -325,18 +325,18 @@ func (sS *StatService) processThresholds(sQs StatQueues, opts map[string]any) (e
// processEvent processes a new event, dispatching to matching queues
// queues matching are also cached to speed up
-func (sS *StatService) processEvent(tnt string, args *utils.CGREvent) (statQueueIDs []string, err error) {
+func (sS *StatService) processEvent(tnt string, args *CGREvent) (statQueueIDs []string, err error) {
evNm := utils.MapStorage{
utils.MetaReq: args.Event,
utils.MetaOpts: args.APIOpts,
}
var stsIDs []string
- if stsIDs, err = utils.GetStringSliceOpts(args, sS.cgrcfg.StatSCfg().Opts.ProfileIDs,
+ if stsIDs, err = GetStringSliceOpts(args, sS.cgrcfg.StatSCfg().Opts.ProfileIDs,
utils.OptsStatsProfileIDs); err != nil {
return
}
var ignFilters bool
- if ignFilters, err = utils.GetBoolOpts(args, sS.cgrcfg.StatSCfg().Opts.ProfileIgnoreFilters,
+ if ignFilters, err = GetBoolOpts(args, sS.cgrcfg.StatSCfg().Opts.ProfileIgnoreFilters,
utils.OptsStatsProfileIgnoreFilters); err != nil {
return
}
@@ -366,7 +366,7 @@ func (sS *StatService) processEvent(tnt string, args *utils.CGREvent) (statQueue
}
// V1ProcessEvent implements StatV1 method for processing an Event
-func (sS *StatService) V1ProcessEvent(ctx *context.Context, args *utils.CGREvent, reply *[]string) (err error) {
+func (sS *StatService) V1ProcessEvent(ctx *context.Context, args *CGREvent, reply *[]string) (err error) {
if args == nil {
return utils.NewErrMandatoryIeMissing(utils.CGREventString)
}
@@ -388,7 +388,7 @@ func (sS *StatService) V1ProcessEvent(ctx *context.Context, args *utils.CGREvent
}
// V1GetStatQueuesForEvent implements StatV1 method for processing an Event
-func (sS *StatService) V1GetStatQueuesForEvent(ctx *context.Context, args *utils.CGREvent, reply *[]string) (err error) {
+func (sS *StatService) V1GetStatQueuesForEvent(ctx *context.Context, args *CGREvent, reply *[]string) (err error) {
if args == nil {
return utils.NewErrMandatoryIeMissing(utils.CGREventString)
}
@@ -402,12 +402,12 @@ func (sS *StatService) V1GetStatQueuesForEvent(ctx *context.Context, args *utils
tnt = sS.cgrcfg.GeneralCfg().DefaultTenant
}
var stsIDs []string
- if stsIDs, err = utils.GetStringSliceOpts(args, sS.cgrcfg.StatSCfg().Opts.ProfileIDs,
+ if stsIDs, err = GetStringSliceOpts(args, sS.cgrcfg.StatSCfg().Opts.ProfileIDs,
utils.OptsStatsProfileIDs); err != nil {
return
}
var ignFilters bool
- if ignFilters, err = utils.GetBoolOpts(args, sS.cgrcfg.StatSCfg().Opts.ProfileIgnoreFilters,
+ if ignFilters, err = GetBoolOpts(args, sS.cgrcfg.StatSCfg().Opts.ProfileIgnoreFilters,
utils.OptsStatsProfileIgnoreFilters); err != nil {
return
}
diff --git a/engine/stats_test.go b/engine/stats_test.go
index 6cbe95261..b2ec8ddac 100644
--- a/engine/stats_test.go
+++ b/engine/stats_test.go
@@ -102,7 +102,7 @@ var (
{Tenant: "cgrates.org", ID: "StatQueueProfile2", sqPrfl: testStatsPrfs[1], SQMetrics: make(map[string]StatMetric)},
{Tenant: "cgrates.org", ID: "StatQueueProfilePrefix", sqPrfl: testStatsPrfs[2], SQMetrics: make(map[string]StatMetric)},
}
- testStatsArgs = []*utils.CGREvent{
+ testStatsArgs = []*CGREvent{
{
Tenant: "cgrates.org",
ID: "event1",
@@ -1235,7 +1235,7 @@ func TestStatQueueProcessEventOK(t *testing.T) {
t.Error(err)
}
- args := &utils.CGREvent{
+ args := &CGREvent{
Tenant: "cgrates.org",
ID: "SqProcessEvent",
Event: map[string]any{
@@ -1293,7 +1293,7 @@ func TestStatQueueProcessEventProcessThPartExec(t *testing.T) {
t.Error(err)
}
- args := &utils.CGREvent{
+ args := &CGREvent{
Tenant: "cgrates.org",
ID: "SqProcessEvent",
Event: map[string]any{
@@ -1362,7 +1362,7 @@ func TestStatQueueProcessEventProcessEventErr(t *testing.T) {
t.Error(err)
}
- args := &utils.CGREvent{
+ args := &CGREvent{
Tenant: "cgrates.org",
ID: "SqProcessEvent",
Event: map[string]any{
@@ -1440,7 +1440,7 @@ func TestStatQueueV1ProcessEventProcessEventErr(t *testing.T) {
t.Error(err)
}
- args := &utils.CGREvent{
+ args := &CGREvent{
ID: "SqProcessEvent",
Event: map[string]any{
utils.AccountField: "1001",
@@ -1516,7 +1516,7 @@ func TestStatQueueV1ProcessEventMissingArgs(t *testing.T) {
t.Errorf("expected: <%+v>, received: <%+v>", experr, err)
}
- args := &utils.CGREvent{
+ args := &CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.AccountField: "1001",
@@ -1532,7 +1532,7 @@ func TestStatQueueV1ProcessEventMissingArgs(t *testing.T) {
t.Errorf("expected: <%+v>, received: <%+v>", experr, err)
}
- args = &utils.CGREvent{
+ args = &CGREvent{
Tenant: "cgrates.org",
ID: "SqProcessEvent",
Event: nil,
@@ -1859,7 +1859,7 @@ func TestStatQueueV1GetStatQueuesForEventOK(t *testing.T) {
t.Error(err)
}
- args := &utils.CGREvent{
+ args := &CGREvent{
ID: "TestGetStatQueuesForEvent",
Event: map[string]any{
utils.AccountField: "1001",
@@ -1914,7 +1914,7 @@ func TestStatQueueV1GetStatQueuesForEventNotFoundErr(t *testing.T) {
t.Error(err)
}
- args := &utils.CGREvent{
+ args := &CGREvent{
ID: "TestGetStatQueuesForEvent",
Event: map[string]any{
utils.AccountField: "1002",
@@ -1971,7 +1971,7 @@ func TestStatQueueV1GetStatQueuesForEventMissingArgs(t *testing.T) {
t.Errorf("expected: <%+v>, received: <%+v>", experr, err)
}
- args := &utils.CGREvent{
+ args := &CGREvent{
Tenant: "cgrates.org",
ID: utils.EmptyString,
Event: map[string]any{
@@ -1985,7 +1985,7 @@ func TestStatQueueV1GetStatQueuesForEventMissingArgs(t *testing.T) {
t.Errorf("expected: <%+v>, received: <%+v>", experr, err)
}
- args = &utils.CGREvent{
+ args = &CGREvent{
Tenant: "cgrates.org",
ID: "TestGetStatQueuesForEvent",
Event: nil,
@@ -2356,9 +2356,9 @@ func TestStatQueueProcessThresholdsOK(t *testing.T) {
ccM := &ccMock{
calls: map[string]func(ctx *context.Context, args any, reply any) error{
utils.ThresholdSv1ProcessEvent: func(ctx *context.Context, args, reply any) error {
- exp := &utils.CGREvent{
+ exp := &CGREvent{
Tenant: "cgrates.org",
- ID: args.(*utils.CGREvent).ID,
+ ID: args.(*CGREvent).ID,
Event: map[string]any{
utils.EventType: utils.StatUpdate,
utils.StatID: "SQ1",
@@ -3159,7 +3159,7 @@ func TestStatQueueV1GetStatQueuesForSliceOptsErr(t *testing.T) {
if err := dm.SetStatQueueProfile(sqPrf2, true); err != nil {
t.Error(err)
}
- args := &utils.CGREvent{
+ args := &CGREvent{
ID: "TestGetStatQueuesForEvent",
Event: map[string]any{
utils.AccountField: "1001",
@@ -3227,7 +3227,7 @@ func TestStatQueueV1GetStatQueuesForEventBoolOptsErr(t *testing.T) {
if err := dm.SetStatQueueProfile(sqPrf2, true); err != nil {
t.Error(err)
}
- args := &utils.CGREvent{
+ args := &CGREvent{
ID: "TestGetStatQueuesForEvent",
Event: map[string]any{
utils.AccountField: "1001",
@@ -3254,7 +3254,7 @@ func TestMatchingStatQueuesForEventErr(t *testing.T) {
filterS := NewFilterS(cfg, nil, dm)
sS := NewStatService(dm, cfg, filterS, nil)
- args := &utils.CGREvent{
+ args := &CGREvent{
ID: "TestGetStatQueuesForEvent",
Event: map[string]any{
utils.AccountField: "1001",
@@ -3313,7 +3313,7 @@ func TestStatQueueProcessEventErr(t *testing.T) {
t.Error(err)
}
- args := &utils.CGREvent{
+ args := &CGREvent{
Tenant: "cgrates.org",
ID: "SqProcessEvent",
Event: map[string]any{
diff --git a/engine/thresholds.go b/engine/thresholds.go
index 13f7dbbf2..202a7111c 100644
--- a/engine/thresholds.go
+++ b/engine/thresholds.go
@@ -144,7 +144,7 @@ func (t *Threshold) isLocked() bool {
// ProcessEvent processes an ThresholdEvent
// concurrentActions limits the number of simultaneous action sets executed
-func (t *Threshold) ProcessEvent(args *utils.CGREvent, dm *DataManager, fltrS *FilterS) (err error) {
+func (t *Threshold) ProcessEvent(args *CGREvent, dm *DataManager, fltrS *FilterS) (err error) {
if t.Snooze.After(time.Now()) || // snoozed, not executing actions
t.Hits < t.tPrfl.MinHits || // number of hits was not met, will not execute actions
(t.tPrfl.MaxHits != -1 &&
@@ -328,18 +328,18 @@ func (tS *ThresholdService) StoreThreshold(t *Threshold) (err error) {
}
// matchingThresholdsForEvent returns ordered list of matching thresholds which are active for an Event
-func (tS *ThresholdService) matchingThresholdsForEvent(tnt string, args *utils.CGREvent) (ts Thresholds, err error) {
+func (tS *ThresholdService) matchingThresholdsForEvent(tnt string, args *CGREvent) (ts Thresholds, err error) {
evNm := utils.MapStorage{
utils.MetaReq: args.Event,
utils.MetaOpts: args.APIOpts,
}
var thdIDs []string
- if thdIDs, err = utils.GetStringSliceOpts(args, tS.cgrcfg.ThresholdSCfg().Opts.ProfileIDs,
+ if thdIDs, err = GetStringSliceOpts(args, tS.cgrcfg.ThresholdSCfg().Opts.ProfileIDs,
utils.OptsThresholdsProfileIDs); err != nil {
return
}
var ignFilters bool
- if ignFilters, err = utils.GetBoolOpts(args, tS.cgrcfg.ThresholdSCfg().Opts.ProfileIgnoreFilters,
+ if ignFilters, err = GetBoolOpts(args, tS.cgrcfg.ThresholdSCfg().Opts.ProfileIgnoreFilters,
utils.OptsThresholdsProfileIgnoreFilters); err != nil {
return
}
@@ -428,7 +428,7 @@ func (tS *ThresholdService) matchingThresholdsForEvent(tnt string, args *utils.C
}
// processEvent processes a new event, dispatching to matching thresholds
-func (tS *ThresholdService) processEvent(tnt string, args *utils.CGREvent) (thresholdsIDs []string, err error) {
+func (tS *ThresholdService) processEvent(tnt string, args *CGREvent) (thresholdsIDs []string, err error) {
var matchTs Thresholds
if matchTs, err = tS.matchingThresholdsForEvent(tnt, args); err != nil {
return nil, err
@@ -483,7 +483,7 @@ func (tS *ThresholdService) processEvent(tnt string, args *utils.CGREvent) (thre
}
// V1ProcessEvent implements ThresholdService method for processing an Event
-func (tS *ThresholdService) V1ProcessEvent(ctx *context.Context, args *utils.CGREvent, reply *[]string) (err error) {
+func (tS *ThresholdService) V1ProcessEvent(ctx *context.Context, args *CGREvent, reply *[]string) (err error) {
if args == nil {
return utils.NewErrMandatoryIeMissing(utils.CGREventString)
}
@@ -505,7 +505,7 @@ func (tS *ThresholdService) V1ProcessEvent(ctx *context.Context, args *utils.CGR
}
// V1GetThresholdsForEvent queries thresholds matching an Event
-func (tS *ThresholdService) V1GetThresholdsForEvent(ctx *context.Context, args *utils.CGREvent, reply *Thresholds) (err error) {
+func (tS *ThresholdService) V1GetThresholdsForEvent(ctx *context.Context, args *CGREvent, reply *Thresholds) (err error) {
if args == nil {
return utils.NewErrMandatoryIeMissing(utils.CGREventString)
}
diff --git a/engine/thresholds_test.go b/engine/thresholds_test.go
index 00b9c4011..1c92fa7b7 100644
--- a/engine/thresholds_test.go
+++ b/engine/thresholds_test.go
@@ -86,7 +86,7 @@ var (
ID: "TH_3",
},
}
- testThresholdArgs = []*utils.CGREvent{
+ testThresholdArgs = []*CGREvent{
{
Tenant: "cgrates.org",
ID: "Ev1",
@@ -586,7 +586,7 @@ func TestThresholdsProcessEventAccountUpdateErrPartExec(t *testing.T) {
tPrfl: thPrf,
}
- args := &utils.CGREvent{
+ args := &CGREvent{
Tenant: "cgrates.org",
ID: "ThresholdProcessEvent",
Event: map[string]any{
@@ -636,7 +636,7 @@ func TestThresholdsProcessEventAsyncExecErr(t *testing.T) {
tPrfl: thPrf,
}
- args := &utils.CGREvent{
+ args := &CGREvent{
Tenant: "cgrates.org",
ID: "ThresholdProcessEvent",
Event: map[string]any{
@@ -675,7 +675,7 @@ func TestThresholdsProcessEvent3(t *testing.T) {
tPrfl: thPrf,
}
- args := &utils.CGREvent{
+ args := &CGREvent{
Tenant: "cgrates.org",
ID: "ThresholdProcessEvent",
Event: map[string]any{
@@ -875,7 +875,7 @@ func TestThresholdsProcessEventOK(t *testing.T) {
t.Error(err)
}
- args := &utils.CGREvent{
+ args := &CGREvent{
Tenant: "cgrates.org",
ID: "ThdProcessEvent",
Event: map[string]any{
@@ -922,7 +922,7 @@ func TestThresholdsProcessEventStoreThOK(t *testing.T) {
t.Error(err)
}
- args := &utils.CGREvent{
+ args := &CGREvent{
Tenant: "cgrates.org",
ID: "ThdProcessEvent",
Event: map[string]any{
@@ -1013,7 +1013,7 @@ func TestThresholdsProcessEventMaxHitsDMErr(t *testing.T) {
Cache.SetWithoutReplicate(utils.CacheThresholdProfiles, thPrf.TenantID(), thPrf, nil, true, utils.NonTransactional)
Cache.SetWithoutReplicate(utils.CacheThresholds, thPrf.TenantID(), th, nil, true, utils.NonTransactional)
- args := &utils.CGREvent{
+ args := &CGREvent{
Tenant: "cgrates.org",
ID: "ThdProcessEvent",
Event: map[string]any{
@@ -1075,7 +1075,7 @@ func TestThresholdsProcessEventNotFound(t *testing.T) {
t.Error(err)
}
- args := &utils.CGREvent{
+ args := &CGREvent{
Tenant: "cgrates.org",
ID: "ThdProcessEvent",
Event: map[string]any{
@@ -1126,7 +1126,7 @@ func TestThresholdsV1ProcessEventOK(t *testing.T) {
t.Error(err)
}
- args := &utils.CGREvent{
+ args := &CGREvent{
ID: "V1ProcessEventTest",
Event: map[string]any{
utils.AccountField: "1001",
@@ -1187,7 +1187,7 @@ func TestThresholdsV1ProcessEventPartExecErr(t *testing.T) {
t.Error(err)
}
- args := &utils.CGREvent{
+ args := &CGREvent{
ID: "V1ProcessEventTest",
Event: map[string]any{
utils.AccountField: "1001",
@@ -1243,14 +1243,14 @@ func TestThresholdsV1ProcessEventMissingArgs(t *testing.T) {
t.Error(err)
}
- args := &utils.CGREvent{
+ args := &CGREvent{
ID: "V1ProcessEventTest",
Event: map[string]any{
utils.AccountField: "1001",
},
}
- args = &utils.CGREvent{
+ args = &CGREvent{
Event: map[string]any{
utils.AccountField: "1001",
},
@@ -1268,7 +1268,7 @@ func TestThresholdsV1ProcessEventMissingArgs(t *testing.T) {
t.Errorf("expected: <%+v>, \nreceived: <%+v>", experr, err)
}
- args = &utils.CGREvent{
+ args = &CGREvent{
ID: "V1ProcessEventTest",
Event: nil,
}
@@ -1378,7 +1378,7 @@ func TestThresholdMatchingThresholdForEventLocks(t *testing.T) {
ids.Add(rPrf.ID)
}
dm.RemoveThreshold("cgrates.org", "TH1")
- mth, err := rS.matchingThresholdsForEvent("cgrates.org", &utils.CGREvent{
+ mth, err := rS.matchingThresholdsForEvent("cgrates.org", &CGREvent{
APIOpts: map[string]any{
utils.OptsThresholdsProfileIDs: ids.AsSlice(),
},
@@ -1443,7 +1443,7 @@ func TestThresholdMatchingThresholdForEventLocks2(t *testing.T) {
}
prfs = append(prfs, rPrf)
ids.Add(rPrf.ID)
- _, err := rS.matchingThresholdsForEvent("cgrates.org", &utils.CGREvent{
+ _, err := rS.matchingThresholdsForEvent("cgrates.org", &CGREvent{
APIOpts: map[string]any{
utils.OptsThresholdsProfileIDs: ids.AsSlice(),
},
@@ -1492,7 +1492,7 @@ func TestThresholdMatchingThresholdForEventLocksBlocker(t *testing.T) {
prfs = append(prfs, rPrf)
ids.Add(rPrf.ID)
}
- mres, err := rS.matchingThresholdsForEvent("cgrates.org", &utils.CGREvent{
+ mres, err := rS.matchingThresholdsForEvent("cgrates.org", &CGREvent{
APIOpts: map[string]any{
utils.OptsThresholdsProfileIDs: ids.AsSlice(),
},
@@ -1559,7 +1559,7 @@ func TestThresholdMatchingThresholdForEventLocksActivationInterval(t *testing.T)
}
dm.SetThresholdProfile(rPrf, true)
ids.Add(rPrf.ID)
- mres, err := rS.matchingThresholdsForEvent("cgrates.org", &utils.CGREvent{
+ mres, err := rS.matchingThresholdsForEvent("cgrates.org", &CGREvent{
Time: utils.TimePointer(time.Now()),
APIOpts: map[string]any{
utils.OptsThresholdsProfileIDs: ids.AsSlice(),
@@ -1613,7 +1613,7 @@ func TestThresholdMatchingThresholdForEventLocks3(t *testing.T) {
for i := 0; i < 10; i++ {
ids.Add(fmt.Sprintf("TH%d", i))
}
- _, err := rS.matchingThresholdsForEvent("cgrates.org", &utils.CGREvent{
+ _, err := rS.matchingThresholdsForEvent("cgrates.org", &CGREvent{
APIOpts: map[string]any{
utils.OptsThresholdsProfileIDs: ids.AsSlice(),
},
@@ -1654,7 +1654,7 @@ func TestThresholdMatchingThresholdForEventLocks4(t *testing.T) {
ids.Add(rPrf.ID)
}
ids.Add("TH20")
- mres, err := rS.matchingThresholdsForEvent("cgrates.org", &utils.CGREvent{
+ mres, err := rS.matchingThresholdsForEvent("cgrates.org", &CGREvent{
APIOpts: map[string]any{
utils.OptsThresholdsProfileIDs: ids.AsSlice(),
},
@@ -1709,7 +1709,7 @@ func TestThresholdMatchingThresholdForEventLocks5(t *testing.T) {
ids.Add(rPrf.ID)
}
dm.RemoveThreshold("cgrates.org", "TH1")
- _, err := rS.matchingThresholdsForEvent("cgrates.org", &utils.CGREvent{
+ _, err := rS.matchingThresholdsForEvent("cgrates.org", &CGREvent{
APIOpts: map[string]any{
utils.OptsThresholdsProfileIDs: ids.AsSlice(),
},
@@ -1869,7 +1869,7 @@ func TestThresholdsV1GetThresholdsForEventOK(t *testing.T) {
if err := dm.SetThresholdProfile(thPrf, true); err != nil {
t.Error(err)
}
- args := &utils.CGREvent{
+ args := &CGREvent{
ID: "TestGetThresholdsForEvent",
Event: map[string]any{
utils.AccountField: "1001",
@@ -1927,7 +1927,7 @@ func TestThresholdsV1GetThresholdsForEventMissingArgs(t *testing.T) {
t.Error(err)
}
- args := &utils.CGREvent{
+ args := &CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.AccountField: "1001",
@@ -1943,7 +1943,7 @@ func TestThresholdsV1GetThresholdsForEventMissingArgs(t *testing.T) {
t.Error(err)
}
- args = &utils.CGREvent{
+ args = &CGREvent{
Tenant: "cgrates.org",
ID: "TestGetThresholdsForEvent",
Event: nil,
@@ -2313,7 +2313,7 @@ func TestThresholdsMatchingThresholdsForEventNotFoundErr(t *testing.T) {
t.Error(err)
}
- args := &utils.CGREvent{
+ args := &CGREvent{
Tenant: "cgrates.org",
ID: "TestEvent",
Event: map[string]any{},
diff --git a/engine/tpreader.go b/engine/tpreader.go
index e5f157103..9e59be02d 100644
--- a/engine/tpreader.go
+++ b/engine/tpreader.go
@@ -2373,7 +2373,7 @@ func (tpr *TpReader) ReloadScheduler(verbose bool) (err error) {
log.Print("Reloading scheduler")
}
if err = connMgr.Call(context.TODO(), tpr.schedulerConns, utils.SchedulerSv1Reload,
- new(utils.CGREvent), &reply); err != nil {
+ new(CGREvent), &reply); err != nil {
log.Printf("WARNING: Got error on scheduler reload: %s\n", err.Error())
}
return
diff --git a/engine/z_actions_it_test.go b/engine/z_actions_it_test.go
index 75275c8d4..38cf9be58 100644
--- a/engine/z_actions_it_test.go
+++ b/engine/z_actions_it_test.go
@@ -374,7 +374,7 @@ func testActionsitThresholdCDrLog(t *testing.T) {
} else if !reflect.DeepEqual(tPrfl.ThresholdProfile, thReply) {
t.Errorf("Expecting: %+v, received: %+v", tPrfl.ThresholdProfile, thReply)
}
- ev := &utils.CGREvent{
+ ev := &CGREvent{
Tenant: "cgrates.org",
ID: "cdrev1",
Event: map[string]any{
@@ -590,7 +590,7 @@ func testActionsitThresholdCgrRpcAction(t *testing.T) {
} else if !reflect.DeepEqual(tPrfl.ThresholdProfile, thReply) {
t.Errorf("Expecting: %+v, received: %+v", tPrfl.ThresholdProfile, thReply)
}
- ev := &utils.CGREvent{
+ ev := &CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Event: map[string]any{
@@ -654,7 +654,7 @@ func testActionsitThresholdPostEvent(t *testing.T) {
} else if !reflect.DeepEqual(tPrfl.ThresholdProfile, thReply) {
t.Errorf("Expecting: %+v, received: %+v", tPrfl.ThresholdProfile, thReply)
}
- ev := &utils.CGREvent{
+ ev := &CGREvent{
Tenant: "cgrates.org",
ID: "cdrev1",
Event: map[string]any{
@@ -766,7 +766,7 @@ func testActionsitSetSDestinations(t *testing.T) {
var reply2 []string
expected := []string{"DistinctMetricProfile"}
- args := &utils.CGREvent{
+ args := &CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -780,7 +780,7 @@ func testActionsitSetSDestinations(t *testing.T) {
t.Errorf("Expecting: %+v, received: %+v", expected, reply2)
}
- args = &utils.CGREvent{
+ args = &CGREvent{
Tenant: "cgrates.org",
ID: "event2",
Event: map[string]any{
diff --git a/engine/z_attributes_test.go b/engine/z_attributes_test.go
index 7ffdc20b2..e54515552 100644
--- a/engine/z_attributes_test.go
+++ b/engine/z_attributes_test.go
@@ -36,7 +36,7 @@ var (
expTimeAttributes = time.Now().Add(20 * time.Minute)
attrS *AttributeService
dmAtr *DataManager
- attrEvs = []*utils.CGREvent{
+ attrEvs = []*CGREvent{
{ //matching AttributeProfile1
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
@@ -363,7 +363,7 @@ func TestAttributeEventReplyDigest(t *testing.T) {
eRpl := &AttrSProcessEventReply{
MatchedProfiles: []string{"cgrates.org:ATTR_1"},
AlteredFields: []string{utils.AccountField, utils.Subject},
- CGREvent: &utils.CGREvent{
+ CGREvent: &CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEvent",
Event: map[string]any{
@@ -384,7 +384,7 @@ func TestAttributeEventReplyDigest2(t *testing.T) {
eRpl := &AttrSProcessEventReply{
MatchedProfiles: []string{"cgrates.org:ATTR_1"},
AlteredFields: []string{},
- CGREvent: &utils.CGREvent{
+ CGREvent: &CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEvent",
Event: map[string]any{
@@ -405,7 +405,7 @@ func TestAttributeEventReplyDigest3(t *testing.T) {
eRpl := &AttrSProcessEventReply{
MatchedProfiles: []string{"cgrates.org:ATTR_1"},
AlteredFields: []string{"*req.Subject"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEvent",
Event: map[string]any{
@@ -426,7 +426,7 @@ func TestAttributeEventReplyDigest4(t *testing.T) {
eRpl := &AttrSProcessEventReply{
MatchedProfiles: []string{"cgrates.org:ATTR_1"},
AlteredFields: []string{"*req.Subject"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEvent",
Event: map[string]any{
@@ -575,7 +575,7 @@ func TestAttributeProcessWithMultipleRuns1(t *testing.T) {
if err = dmAtr.SetAttributeProfile(attrPrf3, true); err != nil {
t.Errorf("Error: %+v", err)
}
- attrArgs := &utils.CGREvent{
+ attrArgs := &CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]any{
@@ -593,7 +593,7 @@ func TestAttributeProcessWithMultipleRuns1(t *testing.T) {
utils.MetaReq + utils.NestingSep + "Field2",
utils.MetaReq + utils.NestingSep + "Field3",
},
- CGREvent: &utils.CGREvent{
+ CGREvent: &CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]any{
@@ -688,7 +688,7 @@ func TestAttributeProcessWithMultipleRuns2(t *testing.T) {
if err = dmAtr.SetAttributeProfile(attrPrf3, true); err != nil {
t.Errorf("Error: %+v", err)
}
- attrArgs := &utils.CGREvent{
+ attrArgs := &CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]any{
@@ -703,7 +703,7 @@ func TestAttributeProcessWithMultipleRuns2(t *testing.T) {
MatchedProfiles: []string{"cgrates.org:ATTR_1", "cgrates.org:ATTR_2", "cgrates.org:ATTR_1", "cgrates.org:ATTR_2"},
AlteredFields: []string{utils.MetaReq + utils.NestingSep + "Field1",
utils.MetaReq + utils.NestingSep + "Field2"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]any{
@@ -797,7 +797,7 @@ func TestAttributeProcessWithMultipleRuns3(t *testing.T) {
if err = dmAtr.SetAttributeProfile(attrPrf3, true); err != nil {
t.Errorf("Error: %+v", err)
}
- attrArgs := &utils.CGREvent{
+ attrArgs := &CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]any{
@@ -812,7 +812,7 @@ func TestAttributeProcessWithMultipleRuns3(t *testing.T) {
MatchedProfiles: []string{"cgrates.org:ATTR_1", "cgrates.org:ATTR_2"},
AlteredFields: []string{utils.MetaReq + utils.NestingSep + "Field1",
utils.MetaReq + utils.NestingSep + "Field2"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]any{
@@ -887,7 +887,7 @@ func TestAttributeProcessWithMultipleRuns4(t *testing.T) {
if err = dmAtr.SetAttributeProfile(attrPrf2, true); err != nil {
t.Errorf("Error: %+v", err)
}
- attrArgs := &utils.CGREvent{
+ attrArgs := &CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]any{
@@ -902,7 +902,7 @@ func TestAttributeProcessWithMultipleRuns4(t *testing.T) {
MatchedProfiles: []string{"cgrates.org:ATTR_1", "cgrates.org:ATTR_2", "cgrates.org:ATTR_1", "cgrates.org:ATTR_2"},
AlteredFields: []string{utils.MetaReq + utils.NestingSep + "Field1",
utils.MetaReq + utils.NestingSep + "Field2"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]any{
@@ -999,7 +999,7 @@ func TestAttributeMultipleProcessWithBlocker(t *testing.T) {
if err = dmAtr.SetAttributeProfile(attrPrf3, true); err != nil {
t.Errorf("Error: %+v", err)
}
- attrArgs := &utils.CGREvent{
+ attrArgs := &CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]any{
@@ -1014,7 +1014,7 @@ func TestAttributeMultipleProcessWithBlocker(t *testing.T) {
MatchedProfiles: []string{"cgrates.org:ATTR_1", "cgrates.org:ATTR_2"},
AlteredFields: []string{utils.MetaReq + utils.NestingSep + "Field1",
utils.MetaReq + utils.NestingSep + "Field2"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]any{
@@ -1110,7 +1110,7 @@ func TestAttributeMultipleProcessWithBlocker2(t *testing.T) {
if err = dmAtr.SetAttributeProfile(attrPrf3, true); err != nil {
t.Errorf("Error: %+v", err)
}
- attrArgs := &utils.CGREvent{
+ attrArgs := &CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]any{
@@ -1124,7 +1124,7 @@ func TestAttributeMultipleProcessWithBlocker2(t *testing.T) {
eRply := &AttrSProcessEventReply{
MatchedProfiles: []string{"cgrates.org:ATTR_1"},
AlteredFields: []string{utils.MetaReq + utils.NestingSep + "Field1"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]any{
@@ -1180,7 +1180,7 @@ func TestAttributeProcessValue(t *testing.T) {
if err := dmAtr.SetAttributeProfile(attrPrf1, true); err != nil {
t.Error(err)
}
- attrArgs := &utils.CGREvent{
+ attrArgs := &CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]any{
@@ -1194,7 +1194,7 @@ func TestAttributeProcessValue(t *testing.T) {
eRply := &AttrSProcessEventReply{
MatchedProfiles: []string{"cgrates.org:ATTR_1"},
AlteredFields: []string{utils.MetaReq + utils.NestingSep + "Field2"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]any{
@@ -1259,7 +1259,7 @@ func TestAttributeAttributeFilterIDs(t *testing.T) {
if err := dmAtr.SetAttributeProfile(attrPrf1, true); err != nil {
t.Error(err)
}
- attrArgs := &utils.CGREvent{
+ attrArgs := &CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]any{
@@ -1274,7 +1274,7 @@ func TestAttributeAttributeFilterIDs(t *testing.T) {
MatchedProfiles: []string{"cgrates.org:ATTR_1"},
AlteredFields: []string{utils.MetaReq + utils.NestingSep + "PassField",
utils.MetaReq + utils.NestingSep + "RandomField"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]any{
@@ -1332,7 +1332,7 @@ func TestAttributeProcessEventConstant(t *testing.T) {
if err := dmAtr.SetAttributeProfile(attrPrf1, true); err != nil {
t.Error(err)
}
- attrArgs := &utils.CGREvent{
+ attrArgs := &CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]any{
@@ -1346,7 +1346,7 @@ func TestAttributeProcessEventConstant(t *testing.T) {
eRply := &AttrSProcessEventReply{
MatchedProfiles: []string{"cgrates.org:ATTR_1"},
AlteredFields: []string{utils.MetaReq + utils.NestingSep + "Field2"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]any{
@@ -1408,7 +1408,7 @@ func TestAttributeProcessEventVariable(t *testing.T) {
if err := dmAtr.SetAttributeProfile(attrPrf1, true); err != nil {
t.Error(err)
}
- attrArgs := &utils.CGREvent{
+ attrArgs := &CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]any{
@@ -1423,7 +1423,7 @@ func TestAttributeProcessEventVariable(t *testing.T) {
eRply := &AttrSProcessEventReply{
MatchedProfiles: []string{"cgrates.org:ATTR_1"},
AlteredFields: []string{utils.MetaReq + utils.NestingSep + "Field2"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]any{
@@ -1491,7 +1491,7 @@ func TestAttributeProcessEventComposed(t *testing.T) {
if err := dmAtr.SetAttributeProfile(attrPrf1, true); err != nil {
t.Error(err)
}
- attrArgs := &utils.CGREvent{
+ attrArgs := &CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]any{
@@ -1506,7 +1506,7 @@ func TestAttributeProcessEventComposed(t *testing.T) {
eRply := &AttrSProcessEventReply{
MatchedProfiles: []string{"cgrates.org:ATTR_1"},
AlteredFields: []string{utils.MetaReq + utils.NestingSep + "Field2"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]any{
@@ -1564,7 +1564,7 @@ func TestAttributeProcessEventSum(t *testing.T) {
if err := dmAtr.SetAttributeProfile(attrPrf1, true); err != nil {
t.Error(err)
}
- attrArgs := &utils.CGREvent{
+ attrArgs := &CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]any{
@@ -1580,7 +1580,7 @@ func TestAttributeProcessEventSum(t *testing.T) {
eRply := &AttrSProcessEventReply{
MatchedProfiles: []string{"cgrates.org:ATTR_1"},
AlteredFields: []string{utils.MetaReq + utils.NestingSep + "Field2"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]any{
@@ -1639,7 +1639,7 @@ func TestAttributeProcessEventUsageDifference(t *testing.T) {
if err := dmAtr.SetAttributeProfile(attrPrf1, true); err != nil {
t.Error(err)
}
- attrArgs := &utils.CGREvent{
+ attrArgs := &CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]any{
@@ -1656,7 +1656,7 @@ func TestAttributeProcessEventUsageDifference(t *testing.T) {
eRply := &AttrSProcessEventReply{
MatchedProfiles: []string{"cgrates.org:ATTR_1"},
AlteredFields: []string{utils.MetaReq + utils.NestingSep + "Field2"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]any{
@@ -1716,7 +1716,7 @@ func TestAttributeProcessEventValueExponent(t *testing.T) {
if err := dmAtr.SetAttributeProfile(attrPrf1, true); err != nil {
t.Error(err)
}
- attrArgs := &utils.CGREvent{
+ attrArgs := &CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]any{
@@ -1733,7 +1733,7 @@ func TestAttributeProcessEventValueExponent(t *testing.T) {
eRply := &AttrSProcessEventReply{
MatchedProfiles: []string{"cgrates.org:ATTR_1"},
AlteredFields: []string{utils.MetaReq + utils.NestingSep + "Field2"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]any{
@@ -1798,7 +1798,7 @@ func BenchmarkAttributeProcessEventConstant(b *testing.B) {
if err := dmAtr.SetAttributeProfile(attrPrf1, true); err != nil {
b.Error(err)
}
- attrArgs := &utils.CGREvent{
+ attrArgs := &CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]any{
@@ -1857,7 +1857,7 @@ func BenchmarkAttributeProcessEventVariable(b *testing.B) {
if err := dmAtr.SetAttributeProfile(attrPrf1, true); err != nil {
b.Error(err)
}
- attrArgs := &utils.CGREvent{
+ attrArgs := &CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]any{
@@ -1931,7 +1931,7 @@ func TestProcessAttributeConstant(t *testing.T) {
if err := dmAtr.SetAttributeProfile(attrPrf, true); err != nil {
t.Error(err)
}
- ev := &utils.CGREvent{ //matching ATTR_CONSTANT
+ ev := &CGREvent{ //matching ATTR_CONSTANT
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: "TestProcessAttributeConstant",
Event: map[string]any{
@@ -1989,7 +1989,7 @@ func TestProcessAttributeVariable(t *testing.T) {
if err := dmAtr.SetAttributeProfile(attrPrf, true); err != nil {
t.Error(err)
}
- ev := &utils.CGREvent{ //matching ATTR_VARIABLE
+ ev := &CGREvent{ //matching ATTR_VARIABLE
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: "TestProcessAttributeVariable",
Event: map[string]any{
@@ -2054,7 +2054,7 @@ func TestProcessAttributeComposed(t *testing.T) {
if err := dmAtr.SetAttributeProfile(attrPrf, true); err != nil {
t.Error(err)
}
- ev := &utils.CGREvent{ //matching ATTR_COMPOSED
+ ev := &CGREvent{ //matching ATTR_COMPOSED
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: "TestProcessAttributeComposed",
Event: map[string]any{
@@ -2115,7 +2115,7 @@ func TestProcessAttributeUsageDifference(t *testing.T) {
if err := dmAtr.SetAttributeProfile(attrPrf, true); err != nil {
t.Error(err)
}
- ev := &utils.CGREvent{ //matching ATTR_USAGE_DIFF
+ ev := &CGREvent{ //matching ATTR_USAGE_DIFF
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: "TestProcessAttributeUsageDifference",
Event: map[string]any{
@@ -2176,7 +2176,7 @@ func TestProcessAttributeSum(t *testing.T) {
if err := dmAtr.SetAttributeProfile(attrPrf, true); err != nil {
t.Error(err)
}
- ev := &utils.CGREvent{ //matching ATTR_SUM
+ ev := &CGREvent{ //matching ATTR_SUM
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: "TestProcessAttributeSum",
Event: map[string]any{
@@ -2237,7 +2237,7 @@ func TestProcessAttributeDiff(t *testing.T) {
if err := dmAtr.SetAttributeProfile(attrPrf, true); err != nil {
t.Error(err)
}
- ev := &utils.CGREvent{ //matching ATTR_DIFF
+ ev := &CGREvent{ //matching ATTR_DIFF
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: "TestProcessAttributeDiff",
Event: map[string]any{
@@ -2298,7 +2298,7 @@ func TestProcessAttributeMultiply(t *testing.T) {
if err := dmAtr.SetAttributeProfile(attrPrf, true); err != nil {
t.Error(err)
}
- ev := &utils.CGREvent{ //matching ATTR_MULTIPLY
+ ev := &CGREvent{ //matching ATTR_MULTIPLY
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: "TestProcessAttributeMultiply",
Event: map[string]any{
@@ -2359,7 +2359,7 @@ func TestProcessAttributeDivide(t *testing.T) {
if err := dmAtr.SetAttributeProfile(attrPrf, true); err != nil {
t.Error(err)
}
- ev := &utils.CGREvent{ //matching ATTR_DIVIDE
+ ev := &CGREvent{ //matching ATTR_DIVIDE
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: "TestProcessAttributeDivide",
Event: map[string]any{
@@ -2420,7 +2420,7 @@ func TestProcessAttributeValueExponent(t *testing.T) {
if err := dmAtr.SetAttributeProfile(attrPrf, true); err != nil {
t.Error(err)
}
- ev := &utils.CGREvent{ //matching ATTR_VAL_EXP
+ ev := &CGREvent{ //matching ATTR_VAL_EXP
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: "TestProcessAttributeValueExponent",
Event: map[string]any{
@@ -2481,7 +2481,7 @@ func TestProcessAttributeUnixTimeStamp(t *testing.T) {
if err := dmAtr.SetAttributeProfile(attrPrf, true); err != nil {
t.Error(err)
}
- ev := &utils.CGREvent{ //matching ATTR_UNIX_TIMESTAMP
+ ev := &CGREvent{ //matching ATTR_UNIX_TIMESTAMP
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: "TestProcessAttributeUnixTimeStamp",
Event: map[string]any{
@@ -2542,7 +2542,7 @@ func TestProcessAttributePrefix(t *testing.T) {
if err := dmAtr.SetAttributeProfile(attrPrf, true); err != nil {
t.Error(err)
}
- ev := &utils.CGREvent{ //matching ATTR_VAL_EXP
+ ev := &CGREvent{ //matching ATTR_VAL_EXP
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: "TestProcessAttributeValueExponent",
Event: map[string]any{
@@ -2602,7 +2602,7 @@ func TestProcessAttributeSuffix(t *testing.T) {
if err := dmAtr.SetAttributeProfile(attrPrf, true); err != nil {
t.Error(err)
}
- ev := &utils.CGREvent{ //matching ATTR_VAL_EXP
+ ev := &CGREvent{ //matching ATTR_VAL_EXP
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: "TestProcessAttributeValueExponent",
Event: map[string]any{
@@ -2693,7 +2693,7 @@ func TestProcessAttributeHTTP(t *testing.T) {
if err := dmAtr.SetAttributeProfile(attrPrf, true); err != nil {
t.Error(err)
}
- attrArgs := &utils.CGREvent{
+ attrArgs := &CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]any{
@@ -2707,7 +2707,7 @@ func TestProcessAttributeHTTP(t *testing.T) {
eRply := &AttrSProcessEventReply{
MatchedProfiles: []string{"cgrates.org:ATTR_HTTP"},
AlteredFields: []string{utils.MetaReq + utils.NestingSep + utils.AccountField, utils.MetaReq + utils.NestingSep + "Password"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: "TestProcessAttributeHTTP",
Event: map[string]any{
@@ -2776,7 +2776,7 @@ func TestAttributeIndexSelectsFalse(t *testing.T) {
t.Error(err)
}
- attrArgs := &utils.CGREvent{
+ attrArgs := &CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]any{
@@ -2837,7 +2837,7 @@ func TestProcessAttributeWithSameWeight(t *testing.T) {
if err := dmAtr.SetAttributeProfile(attrPrf2, true); err != nil {
t.Error(err)
}
- ev := &utils.CGREvent{ //matching ATTR_UNIX_TIMESTAMP
+ ev := &CGREvent{ //matching ATTR_UNIX_TIMESTAMP
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: "TestProcessAttributeUnixTimeStamp",
Event: map[string]any{
@@ -2922,7 +2922,7 @@ func TestAttributeMultipleProcessWithFiltersExists(t *testing.T) {
if _, err := dmAtr.GetAttributeProfile(attrPrf2Exists.Tenant, attrPrf2Exists.ID, true, false, utils.NonTransactional); err != nil {
t.Error(err)
}
- attrArgs := &utils.CGREvent{
+ attrArgs := &CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]any{
@@ -2937,7 +2937,7 @@ func TestAttributeMultipleProcessWithFiltersExists(t *testing.T) {
MatchedProfiles: []string{"cgrates.org:ATTR_1_EXISTS", "cgrates.org:ATTR_2_EXISTS", "cgrates.org:ATTR_1_EXISTS", "cgrates.org:ATTR_2_EXISTS"},
AlteredFields: []string{utils.MetaReq + utils.NestingSep + "Field1",
utils.MetaReq + utils.NestingSep + "Field2"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]any{
@@ -3019,7 +3019,7 @@ func TestAttributeMultipleProcessWithFiltersNotEmpty(t *testing.T) {
if _, err := dmAtr.GetAttributeProfile(attrPrf2NotEmpty.Tenant, attrPrf2NotEmpty.ID, true, false, utils.NonTransactional); err != nil {
t.Error(err)
}
- attrArgs := &utils.CGREvent{
+ attrArgs := &CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]any{
@@ -3034,7 +3034,7 @@ func TestAttributeMultipleProcessWithFiltersNotEmpty(t *testing.T) {
MatchedProfiles: []string{"cgrates.org:ATTR_1_NOTEMPTY", "cgrates.org:ATTR_2_NOTEMPTY", "cgrates.org:ATTR_1_NOTEMPTY", "cgrates.org:ATTR_2_NOTEMPTY"},
AlteredFields: []string{utils.MetaReq + utils.NestingSep + "Field1",
utils.MetaReq + utils.NestingSep + "Field2"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]any{
@@ -3089,7 +3089,7 @@ func TestAttributeMetaTenant(t *testing.T) {
if _, err := dm.GetAttributeProfile(attr1.Tenant, attr1.ID, true, false, utils.NonTransactional); err != nil {
t.Error(err)
}
- args := &utils.CGREvent{
+ args := &CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
Event: map[string]any{},
APIOpts: map[string]any{
@@ -3099,7 +3099,7 @@ func TestAttributeMetaTenant(t *testing.T) {
eRply := AttrSProcessEventReply{
MatchedProfiles: []string{"cgrates.org:ATTR_TNT"},
AlteredFields: []string{utils.MetaTenant},
- CGREvent: &utils.CGREvent{
+ CGREvent: &CGREvent{
Tenant: "prfx_" + config.CgrConfig().GeneralCfg().DefaultTenant,
Event: map[string]any{},
APIOpts: map[string]any{
@@ -3188,7 +3188,7 @@ func TestAttributesPorcessEventMatchingProcessRuns(t *testing.T) {
attr := NewAttributeService(dm, fltrS, cfg)
- args := &utils.CGREvent{
+ args := &CGREvent{
Event: map[string]any{
"Account": "pc_test",
"CompanyName": "MY_company_will_be_changed",
@@ -3202,7 +3202,7 @@ func TestAttributesPorcessEventMatchingProcessRuns(t *testing.T) {
expReply := &AttrSProcessEventReply{
MatchedProfiles: []string{"cgrates.org:ATTR_MatchSecond", "cgrates.org:ATTR_ProcessRuns"},
AlteredFields: []string{"*req.CompanyName", "*req.Password"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
"Account": "pc_test",
@@ -3264,7 +3264,7 @@ func TestAttributeMultipleProfileRunns(t *testing.T) {
if _, err := dm.GetAttributeProfile(attrPrf2Exists.Tenant, attrPrf2Exists.ID, true, false, utils.NonTransactional); err != nil {
t.Error(err)
}
- args := &utils.CGREvent{
+ args := &CGREvent{
Tenant: cfg.GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]any{
@@ -3280,7 +3280,7 @@ func TestAttributeMultipleProfileRunns(t *testing.T) {
MatchedProfiles: []string{"cgrates.org:ATTR_1", "cgrates.org:ATTR_2", "cgrates.org:ATTR_1", "cgrates.org:ATTR_2"},
AlteredFields: []string{utils.MetaReq + utils.NestingSep + "Field1",
utils.MetaReq + utils.NestingSep + "Field2"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &CGREvent{
Tenant: cfg.GeneralCfg().DefaultTenant,
ID: args.ID,
Event: map[string]any{
@@ -3304,7 +3304,7 @@ func TestAttributeMultipleProfileRunns(t *testing.T) {
t.Errorf("Expecting %+v, received: %+v", utils.ToJSON(eRply), utils.ToJSON(reply))
}
- args = &utils.CGREvent{
+ args = &CGREvent{
Tenant: cfg.GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]any{
@@ -3320,7 +3320,7 @@ func TestAttributeMultipleProfileRunns(t *testing.T) {
MatchedProfiles: []string{"cgrates.org:ATTR_1", "cgrates.org:ATTR_2"},
AlteredFields: []string{utils.MetaReq + utils.NestingSep + "Field1",
utils.MetaReq + utils.NestingSep + "Field2"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &CGREvent{
Tenant: cfg.GeneralCfg().DefaultTenant,
ID: args.ID,
Event: map[string]any{
diff --git a/engine/z_chargers_test.go b/engine/z_chargers_test.go
index 5fe9c9bfb..582754074 100644
--- a/engine/z_chargers_test.go
+++ b/engine/z_chargers_test.go
@@ -62,7 +62,7 @@ func TestChargersmatchingChargerProfilesForEventErrPass(t *testing.T) {
cfg: cfg,
}
cgrEvTm := time.Date(2021, 4, 19, 12, 0, 0, 0, time.UTC)
- cgrEv := &utils.CGREvent{
+ cgrEv := &CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: "cgrEvID",
Event: map[string]any{
@@ -123,7 +123,7 @@ func TestChargersmatchingChargerProfilesForEventNotActive(t *testing.T) {
cfg: cfg,
}
cgrEvTm := time.Date(2021, 4, 19, 12, 0, 0, 0, time.UTC)
- cgrEv := &utils.CGREvent{
+ cgrEv := &CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: "cgrEvID",
Event: map[string]any{
@@ -184,7 +184,7 @@ func TestChargersprocessEventNoConnIDs(t *testing.T) {
cfg: cfg,
}
cgrEvTm := time.Date(2021, 4, 19, 12, 0, 0, 0, time.UTC)
- cgrEv := &utils.CGREvent{
+ cgrEv := &CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: "cgrEvID",
Event: map[string]any{
@@ -249,7 +249,7 @@ func TestChargersprocessEventCallNilErr(t *testing.T) {
utils.AttributeSv1ProcessEvent: func(ctx *context.Context, args, reply any) error {
rply := AttrSProcessEventReply{
AlteredFields: []string{utils.AccountField},
- CGREvent: &utils.CGREvent{
+ CGREvent: &CGREvent{
Tenant: "cgrates.org",
ID: "cgrEvID",
Event: map[string]any{
@@ -277,7 +277,7 @@ func TestChargersprocessEventCallNilErr(t *testing.T) {
}),
}
- cgrEv := &utils.CGREvent{
+ cgrEv := &CGREvent{
Tenant: "cgrates.org",
ID: "cgrEvID",
Event: map[string]any{
@@ -289,7 +289,7 @@ func TestChargersprocessEventCallNilErr(t *testing.T) {
{
ChargerSProfile: "1001",
AlteredFields: []string{utils.MetaReqRunID, utils.AccountField},
- CGREvent: &utils.CGREvent{
+ CGREvent: &CGREvent{
Tenant: "cgrates.org",
ID: "cgrEvID",
Event: map[string]any{
@@ -355,7 +355,7 @@ func TestChargersprocessEventCallErr(t *testing.T) {
}),
}
- cgrEv := &utils.CGREvent{
+ cgrEv := &CGREvent{
Tenant: "cgrates.org",
ID: "cgrEvID",
Event: map[string]any{
@@ -367,7 +367,7 @@ func TestChargersprocessEventCallErr(t *testing.T) {
{
ChargerSProfile: "1001",
AlteredFields: []string{utils.MetaReqRunID},
- CGREvent: &utils.CGREvent{
+ CGREvent: &CGREvent{
Tenant: "cgrates.org",
ID: "cgrEvID",
Event: map[string]any{
@@ -421,7 +421,7 @@ func TestChargersV1ProcessEventErrNotFound(t *testing.T) {
utils.AttributeSv1ProcessEvent: func(ctx *context.Context, args, reply any) error {
rply := AttrSProcessEventReply{
AlteredFields: []string{utils.AccountField},
- CGREvent: &utils.CGREvent{
+ CGREvent: &CGREvent{
Tenant: "cgrates.org",
ID: "cgrEvID",
Event: map[string]any{
@@ -448,7 +448,7 @@ func TestChargersV1ProcessEventErrNotFound(t *testing.T) {
utils.ConcatenatedKey(utils.MetaInternal, utils.MetaAttributes): rpcInternal,
}),
}
- args := &utils.CGREvent{
+ args := &CGREvent{
ID: "cgrEvID",
Event: map[string]any{
utils.AccountField: "1002",
@@ -492,7 +492,7 @@ func TestChargersV1ProcessEventErrOther(t *testing.T) {
"invalidMethod": func(ctx *context.Context, args, reply any) error {
rply := AttrSProcessEventReply{
AlteredFields: []string{utils.AccountField},
- CGREvent: &utils.CGREvent{
+ CGREvent: &CGREvent{
Tenant: "cgrates.org",
ID: "cgrEvID",
Event: map[string]any{
@@ -519,7 +519,7 @@ func TestChargersV1ProcessEventErrOther(t *testing.T) {
utils.ConcatenatedKey(utils.MetaInternal, utils.MetaAttributes): rpcInternal,
}),
}
- args := &utils.CGREvent{
+ args := &CGREvent{
ID: "cgrEvID",
Event: map[string]any{
utils.AccountField: "1001",
@@ -569,7 +569,7 @@ func TestChargersV1ProcessEvent(t *testing.T) {
utils.AttributeSv1ProcessEvent: func(ctx *context.Context, args, reply any) error {
rply := AttrSProcessEventReply{
AlteredFields: []string{utils.AccountField},
- CGREvent: &utils.CGREvent{
+ CGREvent: &CGREvent{
Tenant: "cgrates.org",
ID: "cgrEvID",
Event: map[string]any{
@@ -596,7 +596,7 @@ func TestChargersV1ProcessEvent(t *testing.T) {
utils.ConcatenatedKey(utils.MetaInternal, utils.MetaAttributes): rpcInternal,
}),
}
- args := &utils.CGREvent{
+ args := &CGREvent{
ID: "cgrEvID",
Event: map[string]any{
utils.AccountField: "1001",
@@ -608,7 +608,7 @@ func TestChargersV1ProcessEvent(t *testing.T) {
{
ChargerSProfile: "1001",
AlteredFields: []string{utils.MetaReqRunID, utils.AccountField},
- CGREvent: &utils.CGREvent{
+ CGREvent: &CGREvent{
Tenant: "cgrates.org",
ID: "cgrEvID",
Event: map[string]any{
@@ -660,7 +660,7 @@ func TestChargersV1GetChargersForEventNilErr(t *testing.T) {
},
cfg: cfg,
}
- args := &utils.CGREvent{
+ args := &CGREvent{
ID: "cgrEvID",
Event: map[string]any{
utils.AccountField: "1001",
@@ -712,7 +712,7 @@ func TestChargersV1GetChargersForEventErr(t *testing.T) {
},
cfg: cfg,
}
- args := &utils.CGREvent{
+ args := &CGREvent{
ID: "cgrEvID",
Event: map[string]any{
utils.AccountField: "1001",
diff --git a/engine/z_resources_test.go b/engine/z_resources_test.go
index d632f2bed..5b8f6e852 100644
--- a/engine/z_resources_test.go
+++ b/engine/z_resources_test.go
@@ -930,7 +930,7 @@ func TestResourceV1AuthorizeResourceMissingStruct(t *testing.T) {
t.Errorf("Error: %+v", err)
}
var reply *string
- argsMissingTenant := &utils.CGREvent{
+ argsMissingTenant := &CGREvent{
ID: "id1",
Event: map[string]any{},
APIOpts: map[string]any{
@@ -938,7 +938,7 @@ func TestResourceV1AuthorizeResourceMissingStruct(t *testing.T) {
utils.OptsResourcesUnits: 20,
},
}
- argsMissingUsageID := &utils.CGREvent{
+ argsMissingUsageID := &CGREvent{
Tenant: "cgrates.org",
ID: "id1",
Event: map[string]any{},
@@ -1252,7 +1252,7 @@ func TestResourceMatchingResourcesForEvent(t *testing.T) {
rPrf: resprf[2],
},
}
- resEvs := []*utils.CGREvent{
+ resEvs := []*CGREvent{
{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: "event1",
@@ -1360,7 +1360,7 @@ func TestResourceUsageTTLCase1(t *testing.T) {
rPrf: resprf,
ttl: utils.DurationPointer(timeDurationExample),
}
- resEvs := &utils.CGREvent{
+ resEvs := &CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: "event1",
Event: map[string]any{
@@ -1503,7 +1503,7 @@ func TestResourceUsageTTLCase2(t *testing.T) {
rPrf: resprf[2],
},
}
- resEvs := []*utils.CGREvent{
+ resEvs := []*CGREvent{
{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: "event1",
@@ -1661,7 +1661,7 @@ func TestResourceUsageTTLCase3(t *testing.T) {
TTLIdx: []string{},
rPrf: resprf,
}
- resEvs := &utils.CGREvent{
+ resEvs := &CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: "event1",
Event: map[string]any{
@@ -1757,7 +1757,7 @@ func TestResourceUsageTTLCase4(t *testing.T) {
rPrf: resprf,
ttl: utils.DurationPointer(timeDurationExample),
}
- resEvs := &utils.CGREvent{
+ resEvs := &CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: "event1",
Event: map[string]any{
@@ -2054,7 +2054,7 @@ func TestResourceMatchWithIndexFalse(t *testing.T) {
rPrf: resprf[2],
},
}
- resEvs := []*utils.CGREvent{
+ resEvs := []*CGREvent{
{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: "event1",
@@ -2191,7 +2191,7 @@ func TestResourceCaching(t *testing.T) {
t.Errorf("Expecting: nil, received: %s", err)
}
- ev := &utils.CGREvent{
+ ev := &CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Event: map[string]any{
@@ -2651,7 +2651,7 @@ func TestResourceAllocateResourceOtherDB(t *testing.T) {
var reply string
exp := rProf.ID
if err := rs.V1AllocateResources(context.Background(),
- &utils.CGREvent{
+ &CGREvent{
Tenant: "cgrates.org",
ID: "ef0f554",
Event: map[string]any{"": ""},
@@ -2898,9 +2898,9 @@ func TestResourcesProcessThresholdsOK(t *testing.T) {
ccM := &ccMock{
calls: map[string]func(ctx *context.Context, args any, reply any) error{
utils.ThresholdSv1ProcessEvent: func(ctx *context.Context, args, reply any) error {
- exp := &utils.CGREvent{
+ exp := &CGREvent{
Tenant: "cgrates.org",
- ID: args.(*utils.CGREvent).ID,
+ ID: args.(*CGREvent).ID,
Event: map[string]any{
utils.EventType: utils.ResourceUpdate,
utils.ResourceID: "RES_1",
@@ -2965,9 +2965,9 @@ func TestResourcesProcessThresholdsCallErr(t *testing.T) {
ccM := &ccMock{
calls: map[string]func(ctx *context.Context, args any, reply any) error{
utils.ThresholdSv1ProcessEvent: func(ctx *context.Context, args, reply any) error {
- exp := &utils.CGREvent{
+ exp := &CGREvent{
Tenant: "cgrates.org",
- ID: args.(*utils.CGREvent).ID,
+ ID: args.(*CGREvent).ID,
Event: map[string]any{
utils.EventType: utils.ResourceUpdate,
utils.ResourceID: "RES_1",
@@ -3206,7 +3206,7 @@ func TestResourcesV1ResourcesForEventOK(t *testing.T) {
fltrs := NewFilterS(cfg, nil, dm)
rS := NewResourceService(dm, cfg, fltrs, nil)
- args := &utils.CGREvent{
+ args := &CGREvent{
ID: "ResourcesForEventTest",
Event: map[string]any{
utils.AccountField: "1001",
@@ -3281,7 +3281,7 @@ func TestResourcesV1ResourcesForEventNotFound(t *testing.T) {
fltrs := NewFilterS(cfg, nil, dm)
rS := NewResourceService(dm, cfg, fltrs, nil)
- args := &utils.CGREvent{
+ args := &CGREvent{
Tenant: "cgrates.org",
ID: "ResourcesForEventTest",
Event: map[string]any{
@@ -3344,7 +3344,7 @@ func TestResourcesV1ResourcesForEventMissingParameters(t *testing.T) {
t.Errorf("expected: <%+v>, \nreceived: <%+v>", experr, err)
}
- args := &utils.CGREvent{
+ args := &CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.AccountField: "1001",
@@ -3360,7 +3360,7 @@ func TestResourcesV1ResourcesForEventMissingParameters(t *testing.T) {
t.Errorf("expected: <%+v>, \nreceived: <%+v>", experr, err)
}
- args = &utils.CGREvent{
+ args = &CGREvent{
Tenant: "cgrates.org",
ID: "ResourcesForEventTest",
APIOpts: map[string]any{
@@ -3374,7 +3374,7 @@ func TestResourcesV1ResourcesForEventMissingParameters(t *testing.T) {
t.Errorf("expected: <%+v>, \nreceived: <%+v>", experr, err)
}
- args = &utils.CGREvent{
+ args = &CGREvent{
Tenant: "cgrates.org",
ID: "ResourcesForEventTest",
Event: map[string]any{
@@ -3440,7 +3440,7 @@ func TestResourcesV1ResourcesForEventCacheReplyExists(t *testing.T) {
fltrs := NewFilterS(cfg, nil, dm)
rS := NewResourceService(dm, cfg, fltrs, nil)
- args := &utils.CGREvent{
+ args := &CGREvent{
ID: "ResourcesForEventTest",
Event: map[string]any{
utils.AccountField: "1001",
@@ -3535,7 +3535,7 @@ func TestResourcesV1ResourcesForEventCacheReplySet(t *testing.T) {
fltrs := NewFilterS(cfg, nil, dm)
rS := NewResourceService(dm, cfg, fltrs, nil)
- args := &utils.CGREvent{
+ args := &CGREvent{
ID: "ResourcesForEventTest",
Event: map[string]any{
utils.AccountField: "1001",
@@ -4098,7 +4098,7 @@ func TestResourcesV1AuthorizeResourcesOK(t *testing.T) {
fltrs := NewFilterS(cfg, nil, dm)
rS := NewResourceService(dm, cfg, fltrs, nil)
- args := &utils.CGREvent{
+ args := &CGREvent{
ID: "EventAuthorizeResource",
Event: map[string]any{
utils.AccountField: "1001",
@@ -4144,7 +4144,7 @@ func TestResourcesV1AuthorizeResourcesNotAuthorized(t *testing.T) {
fltrs := NewFilterS(cfg, nil, dm)
rS := NewResourceService(dm, cfg, fltrs, nil)
- args := &utils.CGREvent{
+ args := &CGREvent{
Tenant: "cgrates.org",
ID: "EventAuthorizeResource",
Event: map[string]any{
@@ -4190,7 +4190,7 @@ func TestResourcesV1AuthorizeResourcesNoMatch(t *testing.T) {
fltrs := NewFilterS(cfg, nil, dm)
rS := NewResourceService(dm, cfg, fltrs, nil)
- args := &utils.CGREvent{
+ args := &CGREvent{
Tenant: "cgrates.org",
ID: "EventAuthorizeResource",
Event: map[string]any{
@@ -4236,7 +4236,7 @@ func TestResourcesV1AuthorizeResourcesNilCGREvent(t *testing.T) {
fltrs := NewFilterS(cfg, nil, dm)
rS := NewResourceService(dm, cfg, fltrs, nil)
- args := &utils.CGREvent{
+ args := &CGREvent{
ID: "Event",
}
experr := `MANDATORY_IE_MISSING: [Event]`
@@ -4274,7 +4274,7 @@ func TestResourcesV1AuthorizeResourcesMissingUsageID(t *testing.T) {
fltrs := NewFilterS(cfg, nil, dm)
rS := NewResourceService(dm, cfg, fltrs, nil)
- args := &utils.CGREvent{
+ args := &CGREvent{
ID: "EventAuthorizeResource",
Event: map[string]any{
utils.AccountField: "1001",
@@ -4348,7 +4348,7 @@ func TestResourcesV1AuthorizeResourcesCacheReplyExists(t *testing.T) {
fltrs := NewFilterS(cfg, nil, dm)
rS := NewResourceService(dm, cfg, fltrs, nil)
- args := &utils.CGREvent{
+ args := &CGREvent{
ID: "EventAuthorizeResource",
Event: map[string]any{
utils.AccountField: "1001",
@@ -4429,7 +4429,7 @@ func TestResourcesV1AuthorizeResourcesCacheReplySet(t *testing.T) {
fltrs := NewFilterS(cfg, nil, dm)
rS := NewResourceService(dm, cfg, fltrs, nil)
- args := &utils.CGREvent{
+ args := &CGREvent{
ID: "EventAuthorizeResource",
Event: map[string]any{
utils.AccountField: "1001",
@@ -4485,7 +4485,7 @@ func TestResourcesV1AllocateResourcesOK(t *testing.T) {
fltrs := NewFilterS(cfg, nil, dm)
rS := NewResourceService(dm, cfg, fltrs, nil)
- args := &utils.CGREvent{
+ args := &CGREvent{
ID: "EventAuthorizeResource",
Event: map[string]any{
utils.AccountField: "1001",
@@ -4531,7 +4531,7 @@ func TestResourcesV1AllocateResourcesNoMatch(t *testing.T) {
fltrs := NewFilterS(cfg, nil, dm)
rS := NewResourceService(dm, cfg, fltrs, nil)
- args := &utils.CGREvent{
+ args := &CGREvent{
ID: "EventAuthorizeResource",
Event: map[string]any{
utils.AccountField: "1002",
@@ -4576,7 +4576,7 @@ func TestResourcesV1AllocateResourcesMissingParameters(t *testing.T) {
fltrs := NewFilterS(cfg, nil, dm)
rS := NewResourceService(dm, cfg, fltrs, nil)
- args := &utils.CGREvent{
+ args := &CGREvent{
ID: "EventAuthorizeResource",
Event: map[string]any{
utils.AccountField: "1001",
@@ -4594,7 +4594,7 @@ func TestResourcesV1AllocateResourcesMissingParameters(t *testing.T) {
t.Errorf("expected: <%+v>, \nreceived: <%+v>", experr, err)
}
- args = &utils.CGREvent{
+ args = &CGREvent{
ID: "EventAuthorizeResource",
APIOpts: map[string]any{
utils.OptsResourcesUsageID: "RU_Test",
@@ -4609,7 +4609,7 @@ func TestResourcesV1AllocateResourcesMissingParameters(t *testing.T) {
t.Errorf("expected: <%+v>, \nreceived: <%+v>", experr, err)
}
- args = &utils.CGREvent{
+ args = &CGREvent{
Event: map[string]any{
utils.AccountField: "1001",
},
@@ -4682,7 +4682,7 @@ func TestResourcesV1AllocateResourcesCacheReplyExists(t *testing.T) {
fltrs := NewFilterS(cfg, nil, dm)
rS := NewResourceService(dm, cfg, fltrs, nil)
- args := &utils.CGREvent{
+ args := &CGREvent{
ID: "EventAllocateResource",
Event: map[string]any{
utils.AccountField: "1001",
@@ -4763,7 +4763,7 @@ func TestResourcesV1AllocateResourcesCacheReplySet(t *testing.T) {
fltrs := NewFilterS(cfg, nil, dm)
rS := NewResourceService(dm, cfg, fltrs, nil)
- args := &utils.CGREvent{
+ args := &CGREvent{
ID: "EventAllocateResource",
Event: map[string]any{
utils.AccountField: "1001",
@@ -4818,7 +4818,7 @@ func TestResourcesV1AllocateResourcesResAllocErr(t *testing.T) {
fltrs := NewFilterS(cfg, nil, dm)
rS := NewResourceService(dm, cfg, fltrs, nil)
- args := &utils.CGREvent{
+ args := &CGREvent{
ID: "EventAuthorizeResource",
Event: map[string]any{
utils.AccountField: "1001",
@@ -4896,7 +4896,7 @@ func TestResourcesV1AllocateResourcesProcessThErr(t *testing.T) {
fltrs := NewFilterS(cfg, nil, dm)
rS := NewResourceService(dm, cfg, fltrs, cM)
- args := &utils.CGREvent{
+ args := &CGREvent{
ID: "EventAuthorizeResource",
Event: map[string]any{
utils.AccountField: "1001",
@@ -4942,7 +4942,7 @@ func TestResourcesV1ReleaseResourcesOK(t *testing.T) {
fltrs := NewFilterS(cfg, nil, dm)
rS := NewResourceService(dm, cfg, fltrs, nil)
- args := &utils.CGREvent{
+ args := &CGREvent{
ID: "EventAuthorizeResource",
Event: map[string]any{
utils.AccountField: "1001",
@@ -4993,7 +4993,7 @@ func TestResourcesV1ReleaseResourcesUsageNotFound(t *testing.T) {
fltrs := NewFilterS(cfg, nil, dm)
rS := NewResourceService(dm, cfg, fltrs, nil)
- args := &utils.CGREvent{
+ args := &CGREvent{
ID: "EventAuthorizeResource",
Event: map[string]any{
utils.AccountField: "1001",
@@ -5011,7 +5011,7 @@ func TestResourcesV1ReleaseResourcesUsageNotFound(t *testing.T) {
t.Errorf("Unexpected reply returned: %q", reply)
}
- args = &utils.CGREvent{
+ args = &CGREvent{
ID: "EventAuthorizeResource",
Event: map[string]any{
utils.AccountField: "1001",
@@ -5056,7 +5056,7 @@ func TestResourcesV1ReleaseResourcesNoMatch(t *testing.T) {
fltrs := NewFilterS(cfg, nil, dm)
rS := NewResourceService(dm, cfg, fltrs, nil)
- args := &utils.CGREvent{
+ args := &CGREvent{
ID: "EventAuthorizeResource",
Event: map[string]any{
utils.AccountField: "1002",
@@ -5101,7 +5101,7 @@ func TestResourcesV1ReleaseResourcesMissingParameters(t *testing.T) {
fltrs := NewFilterS(cfg, nil, dm)
rS := NewResourceService(dm, cfg, fltrs, nil)
- args := &utils.CGREvent{
+ args := &CGREvent{
ID: "EventAuthorizeResource",
Event: map[string]any{
utils.AccountField: "1001",
@@ -5119,7 +5119,7 @@ func TestResourcesV1ReleaseResourcesMissingParameters(t *testing.T) {
t.Errorf("expected: <%+v>, \nreceived: <%+v>", experr, err)
}
- args = &utils.CGREvent{
+ args = &CGREvent{
ID: "EventAuthorizeResource",
APIOpts: map[string]any{
utils.OptsResourcesUsageID: "RU_Test",
@@ -5134,7 +5134,7 @@ func TestResourcesV1ReleaseResourcesMissingParameters(t *testing.T) {
t.Errorf("expected: <%+v>, \nreceived: <%+v>", experr, err)
}
- args = &utils.CGREvent{
+ args = &CGREvent{
Event: map[string]any{
utils.AccountField: "1001",
},
@@ -5207,7 +5207,7 @@ func TestResourcesV1ReleaseResourcesCacheReplyExists(t *testing.T) {
fltrs := NewFilterS(cfg, nil, dm)
rS := NewResourceService(dm, cfg, fltrs, nil)
- args := &utils.CGREvent{
+ args := &CGREvent{
Tenant: "cgrates.org",
ID: "EventReleaseResource",
Event: map[string]any{
@@ -5288,7 +5288,7 @@ func TestResourcesV1ReleaseResourcesCacheReplySet(t *testing.T) {
fltrs := NewFilterS(cfg, nil, dm)
rS := NewResourceService(dm, cfg, fltrs, nil)
- args := &utils.CGREvent{
+ args := &CGREvent{
ID: "EventReleaseResource",
Event: map[string]any{
utils.AccountField: "1001",
@@ -5377,7 +5377,7 @@ func TestResourcesV1ReleaseResourcesProcessThErr(t *testing.T) {
fltrs := NewFilterS(cfg, nil, dm)
rS := NewResourceService(dm, cfg, fltrs, cM)
- args := &utils.CGREvent{
+ args := &CGREvent{
ID: "EventAuthorizeResource",
Event: map[string]any{
utils.AccountField: "1001",
@@ -5440,7 +5440,7 @@ func TestResourcesStoreResourceError(t *testing.T) {
t.Fatal(err)
}
- args := &utils.CGREvent{
+ args := &CGREvent{
ID: "EventAuthorizeResource",
Event: map[string]any{
utils.AccountField: "1001",
@@ -5481,7 +5481,7 @@ func TestResourceMatchingResourcesForEventNotFoundInCache(t *testing.T) {
&FilterS{dm: dmRES, cfg: cfg}, nil)
Cache.Set(utils.CacheEventResources, "TestResourceMatchingResourcesForEventNotFoundInCache", nil, nil, true, utils.NonTransactional)
- _, err := rS.matchingResourcesForEvent("cgrates.org", new(utils.CGREvent),
+ _, err := rS.matchingResourcesForEvent("cgrates.org", new(CGREvent),
"TestResourceMatchingResourcesForEventNotFoundInCache", utils.DurationPointer(10*time.Second))
if err != utils.ErrNotFound {
t.Errorf("Error: %+v", err)
@@ -5499,7 +5499,7 @@ func TestResourceMatchingResourcesForEventNotFoundInDB(t *testing.T) {
&FilterS{dm: dmRES, cfg: cfg}, nil)
Cache.Set(utils.CacheEventResources, "TestResourceMatchingResourcesForEventNotFoundInDB", utils.StringSet{"Res2": {}}, nil, true, utils.NonTransactional)
- _, err := rS.matchingResourcesForEvent("cgrates.org", new(utils.CGREvent),
+ _, err := rS.matchingResourcesForEvent("cgrates.org", new(CGREvent),
"TestResourceMatchingResourcesForEventNotFoundInDB", utils.DurationPointer(10*time.Second))
if err != utils.ErrNotFound {
t.Errorf("Error: %+v", err)
@@ -5534,7 +5534,7 @@ func TestResourceMatchingResourcesForEventLocks(t *testing.T) {
}
dm.RemoveResource("cgrates.org", "RES1")
Cache.Set(utils.CacheEventResources, "TestResourceMatchingResourcesForEventLocks", ids, nil, true, utils.NonTransactional)
- _, err := rS.matchingResourcesForEvent("cgrates.org", new(utils.CGREvent),
+ _, err := rS.matchingResourcesForEvent("cgrates.org", new(CGREvent),
"TestResourceMatchingResourcesForEventLocks", utils.DurationPointer(10*time.Second))
if err != utils.ErrNotFound {
t.Errorf("Error: %+v", err)
@@ -5598,7 +5598,7 @@ func TestResourceMatchingResourcesForEventLocks2(t *testing.T) {
prfs = append(prfs, rPrf)
ids.Add(rPrf.ID)
Cache.Set(utils.CacheEventResources, "TestResourceMatchingResourcesForEventLocks2", ids, nil, true, utils.NonTransactional)
- _, err := rS.matchingResourcesForEvent("cgrates.org", new(utils.CGREvent),
+ _, err := rS.matchingResourcesForEvent("cgrates.org", new(CGREvent),
"TestResourceMatchingResourcesForEventLocks2", utils.DurationPointer(10*time.Second))
expErr := utils.ErrPrefixNotFound(rPrf.FilterIDs[0])
if err == nil || err.Error() != expErr.Error() {
@@ -5647,7 +5647,7 @@ func TestResourceMatchingResourcesForEventLocksBlocker(t *testing.T) {
ids.Add(rPrf.ID)
}
Cache.Set(utils.CacheEventResources, "TestResourceMatchingResourcesForEventLocksBlocker", ids, nil, true, utils.NonTransactional)
- mres, err := rS.matchingResourcesForEvent("cgrates.org", new(utils.CGREvent),
+ mres, err := rS.matchingResourcesForEvent("cgrates.org", new(CGREvent),
"TestResourceMatchingResourcesForEventLocksBlocker", utils.DurationPointer(10*time.Second))
if err != nil {
t.Errorf("Error: %+v", err)
@@ -5717,7 +5717,7 @@ func TestResourceMatchingResourcesForEventLocksActivationInterval(t *testing.T)
dm.SetResourceProfile(rPrf, true)
ids.Add(rPrf.ID)
Cache.Set(utils.CacheEventResources, "TestResourceMatchingResourcesForEventLocks2", ids, nil, true, utils.NonTransactional)
- mres, err := rS.matchingResourcesForEvent("cgrates.org", &utils.CGREvent{Time: utils.TimePointer(time.Now())},
+ mres, err := rS.matchingResourcesForEvent("cgrates.org", &CGREvent{Time: utils.TimePointer(time.Now())},
"TestResourceMatchingResourcesForEventLocks2", utils.DurationPointer(10*time.Second))
if err != nil {
t.Errorf("Error: %+v", err)
@@ -5772,7 +5772,7 @@ func TestResourceMatchingResourcesForEventLocks3(t *testing.T) {
ids.Add(fmt.Sprintf("RES%d", i))
}
Cache.Set(utils.CacheEventResources, "TestResourceMatchingResourcesForEventLocks3", ids, nil, true, utils.NonTransactional)
- _, err := rS.matchingResourcesForEvent("cgrates.org", new(utils.CGREvent),
+ _, err := rS.matchingResourcesForEvent("cgrates.org", new(CGREvent),
"TestResourceMatchingResourcesForEventLocks3", utils.DurationPointer(10*time.Second))
if err != utils.ErrNotImplemented {
t.Errorf("Error: %+v", err)
@@ -5826,7 +5826,7 @@ func TestResourceMatchingResourcesForEventLocks3(t *testing.T) {
// }
// rS := NewResourceService(dm, cfg, fltrs, connMgr)
-// ev := &utils.CGREvent{
+// ev := &CGREvent{
// Tenant: "cgrates.org",
// ID: "TestMatchingResourcesForEvent",
// Event: map[string]any{
@@ -6049,7 +6049,7 @@ func TestResourcesMatchingResourcesForEventCacheSetErr(t *testing.T) {
fltrs := NewFilterS(cfg, nil, dm)
rS := NewResourceService(dm, cfg, fltrs, connMgr)
- ev := &utils.CGREvent{
+ ev := &CGREvent{
Tenant: "cgrates.org",
ID: "TestMatchingResourcesForEvent",
Event: map[string]any{
@@ -6106,7 +6106,7 @@ func TestResourcesMatchingResourcesForEventFinalCacheSetErr(t *testing.T) {
}
rS := NewResourceService(dm, cfg, fltrs, connMgr)
- ev := &utils.CGREvent{
+ ev := &CGREvent{
Tenant: "cgrates.org",
ID: "TestMatchingResourcesForEvent",
Event: map[string]any{
diff --git a/ers/amqp.go b/ers/amqp.go
index 7ed9b7cab..5c3c338f0 100644
--- a/ers/amqp.go
+++ b/ers/amqp.go
@@ -137,7 +137,7 @@ func (rdr *AMQPER) processMessage(msg []byte) error {
if err = agReq.SetFields(rdr.Config().Fields); err != nil {
return err
}
- cgrEv := utils.NMAsCGREvent(agReq.CGRRequest, agReq.Tenant, utils.NestingSep, agReq.Opts)
+ cgrEv := engine.NMAsCGREvent(agReq.CGRRequest, agReq.Tenant, utils.NestingSep, agReq.Opts)
rdrEv := rdr.eventChan
if _, isPartial := cgrEv.APIOpts[utils.PartialOpt]; isPartial {
rdrEv = rdr.partialEvChan
diff --git a/ers/amqp_it_test.go b/ers/amqp_it_test.go
index 441b8bd29..f456a9832 100644
--- a/ers/amqp_it_test.go
+++ b/ers/amqp_it_test.go
@@ -115,7 +115,7 @@ func TestAMQPER(t *testing.T) {
if ev.rdrCfg.ID != "amqp" {
t.Errorf("Expected 'amqp' received `%s`", ev.rdrCfg.ID)
}
- expected := &utils.CGREvent{
+ expected := &engine.CGREvent{
Tenant: "cgrates.org",
ID: ev.cgrEvent.ID,
Time: ev.cgrEvent.Time,
diff --git a/ers/amqpv1.go b/ers/amqpv1.go
index 7fc502a56..2c2084df5 100644
--- a/ers/amqpv1.go
+++ b/ers/amqpv1.go
@@ -173,7 +173,7 @@ func (rdr *AMQPv1ER) processMessage(msg []byte) (err error) {
if err = agReq.SetFields(rdr.Config().Fields); err != nil {
return
}
- cgrEv := utils.NMAsCGREvent(agReq.CGRRequest, agReq.Tenant, utils.NestingSep, agReq.Opts)
+ cgrEv := engine.NMAsCGREvent(agReq.CGRRequest, agReq.Tenant, utils.NestingSep, agReq.Opts)
rdrEv := rdr.rdrEvents
if _, isPartial := cgrEv.APIOpts[utils.PartialOpt]; isPartial {
rdrEv = rdr.partialEvents
diff --git a/ers/amqpv1_it_test.go b/ers/amqpv1_it_test.go
index 410791d61..583990b90 100644
--- a/ers/amqpv1_it_test.go
+++ b/ers/amqpv1_it_test.go
@@ -120,7 +120,7 @@ func TestAMQPERv1(t *testing.T) {
if ev.rdrCfg.ID != "amqpv1" {
t.Errorf("Expected 'amqpv1' received `%s`", ev.rdrCfg.ID)
}
- expected := &utils.CGREvent{
+ expected := &engine.CGREvent{
Tenant: "cgrates.org",
ID: ev.cgrEvent.ID,
Time: ev.cgrEvent.Time,
diff --git a/ers/amqpv1_test.go b/ers/amqpv1_test.go
index 45f8278d8..f88d59901 100644
--- a/ers/amqpv1_test.go
+++ b/ers/amqpv1_test.go
@@ -40,7 +40,7 @@ func TestAMQPv1ERProcessMessage(t *testing.T) {
cap: nil,
queueID: "cgrates_cdrs",
}
- expEvent := &utils.CGREvent{
+ expEvent := &engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.CGRID: "testCgrId",
diff --git a/ers/ers.go b/ers/ers.go
index e8b0a0411..1f93c4f8d 100644
--- a/ers/ers.go
+++ b/ers/ers.go
@@ -40,7 +40,7 @@ import (
// erEvent is passed from reader to ERs
type erEvent struct {
- cgrEvent *utils.CGREvent
+ cgrEvent *engine.CGREvent
rdrCfg *config.EventReaderCfg
}
@@ -183,7 +183,7 @@ func (erS *ERService) addReader(rdrID string, cfgIdx int) (err error) {
}
// processEvent will be called each time a new event is received from readers
-func (erS *ERService) processEvent(cgrEv *utils.CGREvent,
+func (erS *ERService) processEvent(cgrEv *engine.CGREvent,
rdrCfg *config.EventReaderCfg) (err error) {
// log the event created if requested by flags
if rdrCfg.Flags.Has(utils.MetaLog) {
@@ -207,7 +207,7 @@ func (erS *ERService) processEvent(cgrEv *utils.CGREvent,
if reqType == utils.MetaAuthorize ||
reqType == utils.MetaMessage ||
reqType == utils.MetaEvent {
- if cgrArgs, err = utils.GetRoutePaginatorFromOpts(cgrEv.APIOpts); err != nil {
+ if cgrArgs, err = engine.GetRoutePaginatorFromOpts(cgrEv.APIOpts); err != nil {
utils.Logger.Warning(fmt.Sprintf("<%s> args extraction for reader <%s> failed because <%s>",
utils.ERs, rdrCfg.ID, err.Error()))
err = nil // reset the error and continue the processing
@@ -334,12 +334,12 @@ func (erS *ERService) closeAllRdrs() {
}
type erEvents struct {
- events []*utils.CGREvent
+ events []*engine.CGREvent
rdrCfg *config.EventReaderCfg
}
// processPartialEvent process the event as a partial event
-func (erS *ERService) processPartialEvent(ev *utils.CGREvent, rdrCfg *config.EventReaderCfg) (err error) {
+func (erS *ERService) processPartialEvent(ev *engine.CGREvent, rdrCfg *config.EventReaderCfg) (err error) {
// to identify the event the originID and originHost is used to create the CGRID
orgID, err := ev.FieldAsString(utils.OriginID)
if err == utils.ErrNotFound { // the field is missing ignore the event
@@ -355,7 +355,7 @@ func (erS *ERService) processPartialEvent(ev *utils.CGREvent, rdrCfg *config.Eve
var cgrEvs *erEvents
if !has || evs == nil {
cgrEvs = &erEvents{
- events: []*utils.CGREvent{ev},
+ events: []*engine.CGREvent{ev},
rdrCfg: rdrCfg,
}
} else {
@@ -364,7 +364,7 @@ func (erS *ERService) processPartialEvent(ev *utils.CGREvent, rdrCfg *config.Eve
cgrEvs.rdrCfg = rdrCfg
}
- var cgrEv *utils.CGREvent
+ var cgrEv *engine.CGREvent
if cgrEv, err = mergePartialEvents(cgrEvs.events, cgrEvs.rdrCfg, erS.filterS, // merge the events
erS.cfg.GeneralCfg().DefaultTenant,
erS.cfg.GeneralCfg().DefaultTimezone,
diff --git a/ers/ers_it_test.go b/ers/ers_it_test.go
index 1c50300ce..9ca58700f 100644
--- a/ers/ers_it_test.go
+++ b/ers/ers_it_test.go
@@ -114,7 +114,7 @@ func TestERsProcessEventErr(t *testing.T) {
ID: "",
Type: "",
}
- cgrEvent := &utils.CGREvent{
+ cgrEvent := &engine.CGREvent{
Tenant: "",
ID: "",
}
@@ -193,7 +193,7 @@ func TestERsListenAndServeRdrEvents(t *testing.T) {
srv.rdrErr = make(chan error, 1)
srv.rdrEvents = make(chan *erEvent, 1)
srv.rdrEvents <- &erEvent{
- cgrEvent: &utils.CGREvent{
+ cgrEvent: &engine.CGREvent{
Tenant: "",
ID: "",
Time: nil,
@@ -438,7 +438,7 @@ func TestERsProcessEvent(t *testing.T) {
},
},
}
- cgrEvent := &utils.CGREvent{
+ cgrEvent := &engine.CGREvent{
Tenant: "",
ID: "",
Time: nil,
@@ -467,7 +467,7 @@ func TestERsProcessEvent2(t *testing.T) {
},
},
}
- cgrEvent := &utils.CGREvent{
+ cgrEvent := &engine.CGREvent{
Tenant: "",
ID: "",
Time: nil,
@@ -495,7 +495,7 @@ func TestERsProcessEvent3(t *testing.T) {
utils.MetaEvent: map[string][]string{},
},
}
- cgrEvent := &utils.CGREvent{
+ cgrEvent := &engine.CGREvent{
APIOpts: map[string]any{
utils.OptsRoutesLimit: true,
},
@@ -522,7 +522,7 @@ func TestERsProcessEvent4(t *testing.T) {
utils.MetaAuthorize: map[string][]string{},
},
}
- cgrEvent := &utils.CGREvent{
+ cgrEvent := &engine.CGREvent{
APIOpts: map[string]any{
utils.OptsRoutesLimit: true,
},
@@ -549,7 +549,7 @@ func TestERsProcessEvent5(t *testing.T) {
utils.MetaTerminate: map[string][]string{},
},
}
- cgrEvent := &utils.CGREvent{
+ cgrEvent := &engine.CGREvent{
Tenant: "",
ID: "",
Time: nil,
@@ -580,7 +580,7 @@ func TestERsProcessEvent6(t *testing.T) {
utils.MetaInitiate: map[string][]string{},
},
}
- cgrEvent := &utils.CGREvent{
+ cgrEvent := &engine.CGREvent{
APIOpts: map[string]any{
utils.OptsRoutesLimit: true,
},
@@ -606,7 +606,7 @@ func TestERsProcessEvent7(t *testing.T) {
utils.MetaUpdate: map[string][]string{},
},
}
- cgrEvent := &utils.CGREvent{
+ cgrEvent := &engine.CGREvent{
APIOpts: map[string]any{
utils.OptsRoutesLimit: true,
},
@@ -632,7 +632,7 @@ func TestERsProcessEvent8(t *testing.T) {
utils.MetaMessage: map[string][]string{},
},
}
- cgrEvent := &utils.CGREvent{
+ cgrEvent := &engine.CGREvent{
Tenant: "",
ID: "",
Time: nil,
@@ -663,7 +663,7 @@ func TestERsProcessEvent9(t *testing.T) {
utils.MetaCDRs: map[string][]string{},
},
}
- cgrEvent := &utils.CGREvent{
+ cgrEvent := &engine.CGREvent{
Tenant: "",
ID: "",
Time: nil,
@@ -695,7 +695,7 @@ func TestERsProcessEvent10(t *testing.T) {
utils.MetaAccounts: map[string][]string{},
},
}
- cgrEvent := &utils.CGREvent{
+ cgrEvent := &engine.CGREvent{
Tenant: "",
ID: "",
Time: nil,
@@ -752,7 +752,7 @@ func TestERsProcessEvent11(t *testing.T) {
utils.MetaMessage: map[string][]string{},
},
}
- cgrEvent := &utils.CGREvent{
+ cgrEvent := &engine.CGREvent{
Tenant: "",
ID: "",
Time: nil,
@@ -781,7 +781,7 @@ func TestErsOnEvictedMetaDumpToFileOK(t *testing.T) {
val2 := config.NewRSRParsersMustCompile("1001", ",")
val3 := config.NewRSRParsersMustCompile("1002", ",")
value := &erEvents{
- events: []*utils.CGREvent{
+ events: []*engine.CGREvent{
{
Tenant: "cgrates.org",
ID: "EventErsOnEvicted",
@@ -865,7 +865,7 @@ func TestErsOnEvictedMetaDumpToFileCSVWriteErr(t *testing.T) {
defer os.RemoveAll(dirPath)
value := &erEvents{
- events: []*utils.CGREvent{
+ events: []*engine.CGREvent{
{
Tenant: "cgrates.org",
ID: "EventErsOnEvicted",
@@ -923,7 +923,7 @@ func TestErsOnEvictedMetaDumpToFileCreateErr(t *testing.T) {
defer os.RemoveAll(dirPath)
value := &erEvents{
- events: []*utils.CGREvent{
+ events: []*engine.CGREvent{
{
Tenant: "cgrates.org",
ID: "EventErsOnEvicted",
@@ -973,7 +973,7 @@ func TestERsOnEvictedDumpToJSON(t *testing.T) {
}
value := &erEvents{
- events: []*utils.CGREvent{
+ events: []*engine.CGREvent{
{
Tenant: "cgrates.org",
ID: "EventErsOnEvicted",
@@ -1057,7 +1057,7 @@ func TestERsOnEvictedDumpToJSON(t *testing.T) {
func TestErsOnEvictedDumpToJSONNoPath(t *testing.T) {
dirPath := ""
value := &erEvents{
- events: []*utils.CGREvent{
+ events: []*engine.CGREvent{
{
Tenant: "cgrates.org",
ID: "EventErsOnEvicted",
@@ -1118,7 +1118,7 @@ func TestErsOnEvictedDumpToJSONMergeError(t *testing.T) {
}
value := &erEvents{
- events: []*utils.CGREvent{
+ events: []*engine.CGREvent{
{
Tenant: "cgrates.org",
ID: "EventErsOnEvicted",
@@ -1202,7 +1202,7 @@ func TestERsOnEvictedDumpToJSONWithCacheDumpFieldsErrPrefix(t *testing.T) {
}()
value := &erEvents{
- events: []*utils.CGREvent{
+ events: []*engine.CGREvent{
{
Tenant: "cgrates.org",
ID: "EventErsOnEvicted",
@@ -1274,7 +1274,7 @@ func TestERsOnEvictedDumpToJSONWithCacheDumpFields(t *testing.T) {
}
value := &erEvents{
- events: []*utils.CGREvent{
+ events: []*engine.CGREvent{
{
Tenant: "cgrates.org",
ID: "EventErsOnEvicted",
@@ -1374,7 +1374,7 @@ func TestErsOnEvictedDumpToJSONInvalidPath(t *testing.T) {
// t.Error(err)
// }
value := &erEvents{
- events: []*utils.CGREvent{
+ events: []*engine.CGREvent{
{
Tenant: "cgrates.org",
ID: "EventErsOnEvicted",
@@ -1441,7 +1441,7 @@ func TestErsOnEvictedDumpToJSONEncodeErr(t *testing.T) {
t.Error(err)
}
value := &erEvents{
- events: []*utils.CGREvent{
+ events: []*engine.CGREvent{
{
Tenant: "cgrates.org",
ID: "EventErsOnEvicted",
diff --git a/ers/ers_test.go b/ers/ers_test.go
index 62215adff..3bb99b66e 100644
--- a/ers/ers_test.go
+++ b/ers/ers_test.go
@@ -35,7 +35,7 @@ import (
func TestERsProcessPartialEvent(t *testing.T) {
cfg := config.NewDefaultCGRConfig()
erS := NewERService(cfg, nil, nil)
- event := &utils.CGREvent{
+ event := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "EventERsProcessPartial",
Event: map[string]any{
@@ -80,7 +80,7 @@ func TestErsOnEvictedNilValue(t *testing.T) {
func TestErsOnEvictedMetaPostCDROK(t *testing.T) {
value := &erEvents{
- events: []*utils.CGREvent{
+ events: []*engine.CGREvent{
{
Tenant: "cgrates.org",
ID: "EventErsOnEvicted",
@@ -134,7 +134,7 @@ func TestErsOnEvictedMetaPostCDRMergeErr(t *testing.T) {
}()
value := &erEvents{
- events: []*utils.CGREvent{
+ events: []*engine.CGREvent{
{
Tenant: "cgrates.org",
ID: "EventErsOnEvicted",
@@ -194,7 +194,7 @@ func TestErsOnEvictedMetaDumpToFileSetFieldsErr(t *testing.T) {
dirPath := "/tmp/TestErsOnEvictedMetaDumpToFile"
value := &erEvents{
- events: []*utils.CGREvent{
+ events: []*engine.CGREvent{
{
Tenant: "cgrates.org",
ID: "EventErsOnEvicted",
@@ -250,7 +250,7 @@ func TestErsOnEvictedMetaDumpToFileMergeErr(t *testing.T) {
dirPath := "/tmp/TestErsOnEvictedMetaDumpToFile"
value := &erEvents{
- events: []*utils.CGREvent{
+ events: []*engine.CGREvent{
{
Tenant: "cgrates.org",
ID: "EventErsOnEvicted",
@@ -303,7 +303,7 @@ func TestErsOnEvictedMetaDumpToFileMergeErr(t *testing.T) {
func TestErsOnEvictedMetaDumpToFileEmptyPath(t *testing.T) {
value := &erEvents{
- events: []*utils.CGREvent{
+ events: []*engine.CGREvent{
{
Tenant: "cgrates.org",
ID: "EventErsOnEvicted",
diff --git a/ers/filecsv.go b/ers/filecsv.go
index 0987f264b..b2476d6c8 100644
--- a/ers/filecsv.go
+++ b/ers/filecsv.go
@@ -198,7 +198,7 @@ func (rdr *CSVFileER) processFile(fPath, fName string) (err error) {
utils.ERs, absPath, rowNr, err.Error()))
return
}
- cgrEv := utils.NMAsCGREvent(agReq.CGRRequest, agReq.Tenant, utils.NestingSep, agReq.Opts)
+ cgrEv := engine.NMAsCGREvent(agReq.CGRRequest, agReq.Tenant, utils.NestingSep, agReq.Opts)
rdrEv := rdr.rdrEvents
if _, isPartial := cgrEv.APIOpts[utils.PartialOpt]; isPartial {
rdrEv = rdr.partialEvents
diff --git a/ers/filecsv_it_test.go b/ers/filecsv_it_test.go
index ca5f75515..df012cebd 100644
--- a/ers/filecsv_it_test.go
+++ b/ers/filecsv_it_test.go
@@ -401,7 +401,7 @@ func TestFileCSVProcessEvent(t *testing.T) {
rdrExit: make(chan struct{}),
conReqs: make(chan struct{}, 1),
}
- expEvent := &utils.CGREvent{
+ expEvent := &engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.AccountField: "1001",
diff --git a/ers/filefwv.go b/ers/filefwv.go
index 95377e8aa..c8bd36f05 100644
--- a/ers/filefwv.go
+++ b/ers/filefwv.go
@@ -220,7 +220,7 @@ func (rdr *FWVFileER) processFile(fPath, fName string) (err error) {
return
}
rdr.offset += rdr.lineLen // increase the offset
- cgrEv := utils.NMAsCGREvent(agReq.CGRRequest, agReq.Tenant, utils.NestingSep, agReq.Opts)
+ cgrEv := engine.NMAsCGREvent(agReq.CGRRequest, agReq.Tenant, utils.NestingSep, agReq.Opts)
rdrEv := rdr.rdrEvents
if _, isPartial := cgrEv.APIOpts[utils.PartialOpt]; isPartial {
rdrEv = rdr.partialEvents
@@ -312,7 +312,7 @@ func (rdr *FWVFileER) processTrailer(file *os.File, rowNr, evsPosted int, absPat
utils.ERs, absPath, rowNr, err.Error()))
return err
}
- cgrEv := utils.NMAsCGREvent(agReq.CGRRequest, agReq.Tenant, utils.NestingSep, agReq.Opts)
+ cgrEv := engine.NMAsCGREvent(agReq.CGRRequest, agReq.Tenant, utils.NestingSep, agReq.Opts)
rdrEv := rdr.rdrEvents
if _, isPartial := cgrEv.APIOpts[utils.PartialOpt]; isPartial {
rdrEv = rdr.partialEvents
@@ -357,7 +357,7 @@ func (rdr *FWVFileER) createHeaderMap(record string, rowNr, evsPosted int, absPa
utils.ERs, absPath, rowNr, err.Error()))
return err
}
- cgrEv := utils.NMAsCGREvent(agReq.CGRRequest, agReq.Tenant, utils.NestingSep, agReq.Opts)
+ cgrEv := engine.NMAsCGREvent(agReq.CGRRequest, agReq.Tenant, utils.NestingSep, agReq.Opts)
rdrEv := rdr.rdrEvents
if _, isPartial := cgrEv.APIOpts[utils.PartialOpt]; isPartial {
rdrEv = rdr.partialEvents
diff --git a/ers/filefwv_it_test.go b/ers/filefwv_it_test.go
index df431a04b..b151814f3 100644
--- a/ers/filefwv_it_test.go
+++ b/ers/filefwv_it_test.go
@@ -449,7 +449,7 @@ func TestFileFWVProcessTrailer(t *testing.T) {
rdrExit: make(chan struct{}),
conReqs: make(chan struct{}, 1),
}
- expEvent := &utils.CGREvent{
+ expEvent := &engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
"OriginID": "testOriginID",
@@ -624,7 +624,7 @@ func TestFileFWVCreateHeaderMap(t *testing.T) {
conReqs: make(chan struct{}, 1),
}
eR.conReqs <- struct{}{}
- expEvent := &utils.CGREvent{
+ expEvent := &engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
"OriginID": "testOriginID",
diff --git a/ers/filejson.go b/ers/filejson.go
index bd1c34e58..7cb2c4e19 100644
--- a/ers/filejson.go
+++ b/ers/filejson.go
@@ -170,7 +170,7 @@ func (rdr *JSONFileER) processFile(fPath, fName string) (err error) {
utils.ERs, absPath, err.Error()))
return
}
- cgrEv := utils.NMAsCGREvent(agReq.CGRRequest, agReq.Tenant, utils.NestingSep, agReq.Opts)
+ cgrEv := engine.NMAsCGREvent(agReq.CGRRequest, agReq.Tenant, utils.NestingSep, agReq.Opts)
rdrEv := rdr.rdrEvents
if _, isPartial := cgrEv.APIOpts[utils.PartialOpt]; isPartial {
rdrEv = rdr.partialEvents
diff --git a/ers/filejson_it_test.go b/ers/filejson_it_test.go
index 53987b798..188f12eca 100644
--- a/ers/filejson_it_test.go
+++ b/ers/filejson_it_test.go
@@ -346,7 +346,7 @@ func TestFileJSONProcessEvent(t *testing.T) {
rdrExit: make(chan struct{}),
conReqs: make(chan struct{}, 1),
}
- expEvent := &utils.CGREvent{
+ expEvent := &engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.AccountField: "account_test",
@@ -363,7 +363,7 @@ func TestFileJSONProcessEvent(t *testing.T) {
},
APIOpts: map[string]any{},
}
- // expEvent := &utils.CGREvent{}
+ // expEvent := &engine.CGREvent{}
eR.conReqs <- struct{}{}
fname := "file1.json"
if err := eR.processFile(filePath, fname); err != nil {
diff --git a/ers/filexml.go b/ers/filexml.go
index d12d5ed6c..d41813bcc 100644
--- a/ers/filexml.go
+++ b/ers/filexml.go
@@ -194,7 +194,7 @@ func (rdr *XMLFileER) processFile(fPath, fName string) error {
utils.ERs, absPath, rowNr, err.Error()))
continue
}
- cgrEv := utils.NMAsCGREvent(agReq.CGRRequest, agReq.Tenant, utils.NestingSep, agReq.Opts)
+ cgrEv := engine.NMAsCGREvent(agReq.CGRRequest, agReq.Tenant, utils.NestingSep, agReq.Opts)
rdrEv := rdr.rdrEvents
if _, isPartial := cgrEv.APIOpts[utils.PartialOpt]; isPartial {
rdrEv = rdr.partialEvents
diff --git a/ers/filexml_it_test.go b/ers/filexml_it_test.go
index b9eb37719..7e6512e1f 100644
--- a/ers/filexml_it_test.go
+++ b/ers/filexml_it_test.go
@@ -427,7 +427,7 @@ func TestFileXMLProcessEvent(t *testing.T) {
if err := eR.processFile(filePath, fileName); err != nil {
t.Error(err)
}
- expEvent := &utils.CGREvent{
+ expEvent := &engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
"OriginID": "25160047719:0",
diff --git a/ers/kafka.go b/ers/kafka.go
index ad01de723..0b33068d3 100644
--- a/ers/kafka.go
+++ b/ers/kafka.go
@@ -193,7 +193,7 @@ func (rdr *KafkaER) processMessage(msg []byte) (err error) {
if err = agReq.SetFields(rdr.Config().Fields); err != nil {
return
}
- cgrEv := utils.NMAsCGREvent(agReq.CGRRequest, agReq.Tenant, utils.NestingSep, agReq.Opts)
+ cgrEv := engine.NMAsCGREvent(agReq.CGRRequest, agReq.Tenant, utils.NestingSep, agReq.Opts)
rdrEv := rdr.rdrEvents
if _, isPartial := cgrEv.APIOpts[utils.PartialOpt]; isPartial {
rdrEv = rdr.partialEvents
diff --git a/ers/kafka_it_test.go b/ers/kafka_it_test.go
index aa7326bc7..47580016e 100644
--- a/ers/kafka_it_test.go
+++ b/ers/kafka_it_test.go
@@ -141,7 +141,7 @@ func TestKafkaER(t *testing.T) {
if ev.rdrCfg.ID != "kafka" {
t.Errorf("expected %s, received %s", "kafka", ev.rdrCfg.ID)
}
- expected := &utils.CGREvent{
+ expected := &engine.CGREvent{
Tenant: "cgrates.org",
ID: ev.cgrEvent.ID,
Time: ev.cgrEvent.Time,
diff --git a/ers/kafka_test.go b/ers/kafka_test.go
index 421c1a4f1..d4c6bb176 100644
--- a/ers/kafka_test.go
+++ b/ers/kafka_test.go
@@ -161,7 +161,7 @@ func TestKafkaERProcessMessage(t *testing.T) {
maxWait: time.Duration(1),
cap: make(chan struct{}, 1),
}
- expEvent := &utils.CGREvent{
+ expEvent := &engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.ToR: "*voice",
diff --git a/ers/libers.go b/ers/libers.go
index 7b32b0517..5aef70c1a 100644
--- a/ers/libers.go
+++ b/ers/libers.go
@@ -30,7 +30,7 @@ import (
)
// mergePartialEvents will unite the events using the reader configuration
-func mergePartialEvents(cgrEvs []*utils.CGREvent, cfg *config.EventReaderCfg, fltrS *engine.FilterS, dftTnt, dftTmz, rsrSep string) (cgrEv *utils.CGREvent, err error) {
+func mergePartialEvents(cgrEvs []*engine.CGREvent, cfg *config.EventReaderCfg, fltrS *engine.FilterS, dftTnt, dftTmz, rsrSep string) (cgrEv *engine.CGREvent, err error) {
cgrEv = cgrEvs[0] // by default there is at least one event
if len(cgrEvs) != 1 { // need to merge the incoming events
// prepare the field after which the events are ordered
@@ -66,7 +66,7 @@ func mergePartialEvents(cgrEvs []*utils.CGREvent, cfg *config.EventReaderCfg, fl
}
// compose the CGREvent from slice
- cgrEv = &utils.CGREvent{
+ cgrEv = &engine.CGREvent{
Tenant: cgrEvs[0].Tenant,
ID: utils.UUIDSha1Prefix(),
Time: utils.TimePointer(time.Now()),
@@ -94,7 +94,7 @@ func mergePartialEvents(cgrEvs []*utils.CGREvent, cfg *config.EventReaderCfg, fl
utils.ERs, utils.ToJSON(cgrEv), err.Error()))
return
}
- if ev := utils.NMAsCGREvent(agReq.CGRRequest, agReq.Tenant,
+ if ev := engine.NMAsCGREvent(agReq.CGRRequest, agReq.Tenant,
utils.NestingSep, agReq.Opts); ev != nil { // add the modified fields in the event
for k, v := range ev.Event {
cgrEv.Event[k] = v
diff --git a/ers/nats.go b/ers/nats.go
index b1f2d9c64..f487f600d 100644
--- a/ers/nats.go
+++ b/ers/nats.go
@@ -196,7 +196,7 @@ func (rdr *NatsER) processMessage(msg []byte) (err error) {
if err = agReq.SetFields(rdr.Config().Fields); err != nil {
return
}
- cgrEv := utils.NMAsCGREvent(agReq.CGRRequest, agReq.Tenant, utils.NestingSep, agReq.Opts)
+ cgrEv := engine.NMAsCGREvent(agReq.CGRRequest, agReq.Tenant, utils.NestingSep, agReq.Opts)
rdrEv := rdr.rdrEvents
if _, isPartial := cgrEv.APIOpts[utils.PartialOpt]; isPartial {
rdrEv = rdr.partialEvents
diff --git a/ers/nats_it_test.go b/ers/nats_it_test.go
index d87cc88a6..2d69939c5 100644
--- a/ers/nats_it_test.go
+++ b/ers/nats_it_test.go
@@ -132,7 +132,7 @@ func testCheckNatsData(t *testing.T, randomCGRID, expData string, ch chan string
if ev.rdrCfg.ID != "nats" {
t.Fatalf("Expected 'nats' received `%s`", ev.rdrCfg.ID)
}
- expected := &utils.CGREvent{
+ expected := &engine.CGREvent{
Tenant: "cgrates.org",
ID: ev.cgrEvent.ID,
Time: ev.cgrEvent.Time,
diff --git a/ers/nats_test.go b/ers/nats_test.go
index fa0bc5acc..c28389742 100644
--- a/ers/nats_test.go
+++ b/ers/nats_test.go
@@ -58,7 +58,7 @@ func TestNatsERProcessMessage(t *testing.T) {
rdrErr: make(chan error, 1),
}
- expEvent := &utils.CGREvent{
+ expEvent := &engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.ToR: "*voice",
diff --git a/ers/s3.go b/ers/s3.go
index 194e0e3f7..c6182ee93 100644
--- a/ers/s3.go
+++ b/ers/s3.go
@@ -134,7 +134,7 @@ func (rdr *S3ER) processMessage(body []byte) (err error) {
if err = agReq.SetFields(rdr.Config().Fields); err != nil {
return
}
- cgrEv := utils.NMAsCGREvent(agReq.CGRRequest, agReq.Tenant, utils.NestingSep, agReq.Opts)
+ cgrEv := engine.NMAsCGREvent(agReq.CGRRequest, agReq.Tenant, utils.NestingSep, agReq.Opts)
rdrEv := rdr.rdrEvents
if _, isPartial := cgrEv.APIOpts[utils.PartialOpt]; isPartial {
rdrEv = rdr.partialEvents
diff --git a/ers/s3_it_test.go b/ers/s3_it_test.go
index a8d1be888..b4a9d80a4 100644
--- a/ers/s3_it_test.go
+++ b/ers/s3_it_test.go
@@ -118,7 +118,7 @@ func TestS3ER(t *testing.T) {
if ev.rdrCfg.ID != "s3" {
t.Errorf("Expected 's3' received `%s`", ev.rdrCfg.ID)
}
- expected := &utils.CGREvent{
+ expected := &engine.CGREvent{
Tenant: "cgrates.org",
ID: ev.cgrEvent.ID,
Time: ev.cgrEvent.Time,
diff --git a/ers/s3_test.go b/ers/s3_test.go
index d3dad8ba4..617e71c83 100644
--- a/ers/s3_test.go
+++ b/ers/s3_test.go
@@ -83,7 +83,7 @@ func TestS3ERProcessMessage(t *testing.T) {
bucket: "cgrates_cdrs",
session: nil,
}
- expEvent := &utils.CGREvent{
+ expEvent := &engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.CGRID: "testCgrId",
diff --git a/ers/sql.go b/ers/sql.go
index 77434b3d7..12238f088 100644
--- a/ers/sql.go
+++ b/ers/sql.go
@@ -240,7 +240,7 @@ func (rdr *SQLEventReader) processMessage(msg map[string]any) (err error) {
if err = agReq.SetFields(rdr.Config().Fields); err != nil {
return
}
- cgrEv := utils.NMAsCGREvent(agReq.CGRRequest, agReq.Tenant, utils.NestingSep, agReq.Opts)
+ cgrEv := engine.NMAsCGREvent(agReq.CGRRequest, agReq.Tenant, utils.NestingSep, agReq.Opts)
rdrEv := rdr.rdrEvents
if _, isPartial := cgrEv.APIOpts[utils.PartialOpt]; isPartial {
rdrEv = rdr.partialEvents
diff --git a/ers/sql_it_test.go b/ers/sql_it_test.go
index b6d1c87e1..33bf81f32 100644
--- a/ers/sql_it_test.go
+++ b/ers/sql_it_test.go
@@ -247,7 +247,7 @@ func testSQLReader(t *testing.T) {
if ev.rdrCfg.ID != "mysql" {
t.Errorf("Expected 'mysql' received `%s`", ev.rdrCfg.ID)
}
- expected := &utils.CGREvent{
+ expected := &engine.CGREvent{
Tenant: "cgrates.org",
ID: ev.cgrEvent.ID,
Time: ev.cgrEvent.Time,
@@ -281,7 +281,7 @@ func testSQLReader2(t *testing.T) {
if ev.rdrCfg.ID != "mysql" {
t.Errorf("Expected 'mysql' received `%s`", ev.rdrCfg.ID)
}
- expected := &utils.CGREvent{
+ expected := &engine.CGREvent{
Tenant: "cgrates.org",
ID: ev.cgrEvent.ID,
Time: ev.cgrEvent.Time,
@@ -494,7 +494,7 @@ func testSQLReader3(t *testing.T) {
if ev.rdrCfg.ID != "mysql" {
t.Errorf("Expected 'mysql' received `%s`", ev.rdrCfg.ID)
}
- expected := &utils.CGREvent{
+ expected := &engine.CGREvent{
Tenant: "cgrates.org",
ID: ev.cgrEvent.ID,
Time: ev.cgrEvent.Time,
@@ -528,7 +528,7 @@ func testSQLReader4(t *testing.T) {
if ev.rdrCfg.ID != "mysql" {
t.Errorf("Expected 'mysql' received `%s`", ev.rdrCfg.ID)
}
- expected := &utils.CGREvent{
+ expected := &engine.CGREvent{
Tenant: "cgrates.org",
ID: ev.cgrEvent.ID,
Time: ev.cgrEvent.Time,
diff --git a/ers/sqs.go b/ers/sqs.go
index fa08a1bfc..6df60c8be 100644
--- a/ers/sqs.go
+++ b/ers/sqs.go
@@ -122,7 +122,7 @@ func (rdr *SQSER) processMessage(body []byte) (err error) {
if err = agReq.SetFields(rdr.Config().Fields); err != nil {
return
}
- cgrEv := utils.NMAsCGREvent(agReq.CGRRequest, agReq.Tenant, utils.NestingSep, agReq.Opts)
+ cgrEv := engine.NMAsCGREvent(agReq.CGRRequest, agReq.Tenant, utils.NestingSep, agReq.Opts)
rdrEv := rdr.rdrEvents
if _, isPartial := cgrEv.APIOpts[utils.PartialOpt]; isPartial {
rdrEv = rdr.partialEvents
diff --git a/ers/sqs_it_test.go b/ers/sqs_it_test.go
index 0dc912955..e27f0cf6d 100644
--- a/ers/sqs_it_test.go
+++ b/ers/sqs_it_test.go
@@ -116,7 +116,7 @@ func TestSQSER(t *testing.T) {
if ev.rdrCfg.ID != "sqs" {
t.Errorf("Expected 'sqs' received `%s`", ev.rdrCfg.ID)
}
- expected := &utils.CGREvent{
+ expected := &engine.CGREvent{
Tenant: "cgrates.org",
ID: ev.cgrEvent.ID,
Time: ev.cgrEvent.Time,
diff --git a/ers/sqs_test.go b/ers/sqs_test.go
index 0cfbf5efa..b7d000695 100644
--- a/ers/sqs_test.go
+++ b/ers/sqs_test.go
@@ -133,7 +133,7 @@ func TestSQSERProcessMessage(t *testing.T) {
queueID: "cgrates_cdrs",
session: nil,
}
- expEvent := &utils.CGREvent{
+ expEvent := &engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.CGRID: "testCgrId",
diff --git a/general_tests/a1_it_test.go b/general_tests/a1_it_test.go
index 6766d9be3..85d59d7cd 100644
--- a/general_tests/a1_it_test.go
+++ b/general_tests/a1_it_test.go
@@ -188,7 +188,7 @@ func testA1itDataSession1(t *testing.T) {
initArgs := &sessions.V1InitSessionArgs{
InitSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestA1itDataSession1",
Event: map[string]any{
@@ -225,7 +225,7 @@ func testA1itDataSession1(t *testing.T) {
updateArgs := &sessions.V1UpdateSessionArgs{
UpdateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionsVoiceLastUsed",
Event: map[string]any{
@@ -264,7 +264,7 @@ func testA1itDataSession1(t *testing.T) {
usage = time.Minute
termArgs := &sessions.V1TerminateSessionArgs{
TerminateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionsVoiceLastUsed",
Event: map[string]any{
diff --git a/general_tests/all_cfg_sect_rld_it_test.go b/general_tests/all_cfg_sect_rld_it_test.go
index bdec76c3e..dc42331b7 100644
--- a/general_tests/all_cfg_sect_rld_it_test.go
+++ b/general_tests/all_cfg_sect_rld_it_test.go
@@ -158,7 +158,7 @@ func testSectRPCConn(t *testing.T) {
func testSectConfigSReloadCores(t *testing.T) {
var replyPingBf string
- if err := testSectRPC.Call(context.Background(), utils.CoreSv1Ping, &utils.CGREvent{}, &replyPingBf); err != nil {
+ if err := testSectRPC.Call(context.Background(), utils.CoreSv1Ping, &engine.CGREvent{}, &replyPingBf); err != nil {
t.Error(err)
} else if replyPingBf != utils.Pong {
t.Errorf("Expected OK received: %s", replyPingBf)
@@ -184,7 +184,7 @@ func testSectConfigSReloadCores(t *testing.T) {
}
var replyPingAf string
- if err := testSectRPC.Call(context.Background(), utils.CoreSv1Ping, &utils.CGREvent{}, &replyPingAf); err != nil {
+ if err := testSectRPC.Call(context.Background(), utils.CoreSv1Ping, &engine.CGREvent{}, &replyPingAf); err != nil {
t.Error(err)
} else if replyPingAf != utils.Pong {
t.Errorf("Expected OK received: %s", replyPingAf)
@@ -333,7 +333,7 @@ func testSectConfigSReloadHTTP(t *testing.T) {
func testSectConfigSReloadSchedulers(t *testing.T) {
var replyPingBf string
- if err := testSectRPC.Call(context.Background(), utils.SchedulerSv1Ping, &utils.CGREvent{}, &replyPingBf); err != nil {
+ if err := testSectRPC.Call(context.Background(), utils.SchedulerSv1Ping, &engine.CGREvent{}, &replyPingBf); err != nil {
t.Error(err)
} else if replyPingBf != utils.Pong {
t.Errorf("Expected OK received: %s", replyPingBf)
@@ -360,7 +360,7 @@ func testSectConfigSReloadSchedulers(t *testing.T) {
}
var replyPingAf string
- if err := testSectRPC.Call(context.Background(), utils.SchedulerSv1Ping, &utils.CGREvent{}, &replyPingAf); err != nil {
+ if err := testSectRPC.Call(context.Background(), utils.SchedulerSv1Ping, &engine.CGREvent{}, &replyPingAf); err != nil {
t.Error(err)
} else if replyPingAf != utils.Pong {
t.Errorf("Expected OK received: %s", replyPingAf)
@@ -370,7 +370,7 @@ func testSectConfigSReloadSchedulers(t *testing.T) {
func testSectConfigSReloadCaches(t *testing.T) {
var replyPingBf string
- if err := testSectRPC.Call(context.Background(), utils.CacheSv1Ping, &utils.CGREvent{}, &replyPingBf); err != nil {
+ if err := testSectRPC.Call(context.Background(), utils.CacheSv1Ping, &engine.CGREvent{}, &replyPingBf); err != nil {
t.Error(err)
} else if replyPingBf != utils.Pong {
t.Errorf("Expected OK received: %s", replyPingBf)
@@ -397,7 +397,7 @@ func testSectConfigSReloadCaches(t *testing.T) {
}
var replyPingAf string
- if err := testSectRPC.Call(context.Background(), utils.CacheSv1Ping, &utils.CGREvent{}, &replyPingAf); err != nil {
+ if err := testSectRPC.Call(context.Background(), utils.CacheSv1Ping, &engine.CGREvent{}, &replyPingAf); err != nil {
t.Error(err)
} else if replyPingAf != utils.Pong {
t.Errorf("Expected OK received: %s", replyPingAf)
@@ -450,7 +450,7 @@ func testSectConfigSReloadRALS(t *testing.T) {
}
var replyPingAf string
- if err := testSectRPC.Call(context.Background(), utils.RALsV1Ping, &utils.CGREvent{}, &replyPingAf); err != nil {
+ if err := testSectRPC.Call(context.Background(), utils.RALsV1Ping, &engine.CGREvent{}, &replyPingAf); err != nil {
t.Error(err)
} else if replyPingAf != utils.Pong {
t.Errorf("Expected OK received: %s", replyPingAf)
@@ -460,7 +460,7 @@ func testSectConfigSReloadRALS(t *testing.T) {
func testSectConfigSReloadCDRS(t *testing.T) {
var replyPingBf string
- if err := testSectRPC.Call(context.Background(), utils.CDRsV1Ping, &utils.CGREvent{}, &replyPingBf); err != nil {
+ if err := testSectRPC.Call(context.Background(), utils.CDRsV1Ping, &engine.CGREvent{}, &replyPingBf); err != nil {
t.Error(err)
} else if replyPingBf != utils.Pong {
t.Errorf("Expected OK received: %s", replyPingBf)
@@ -487,7 +487,7 @@ func testSectConfigSReloadCDRS(t *testing.T) {
}
var replyPingAf string
- if err := testSectRPC.Call(context.Background(), utils.CDRsV1Ping, &utils.CGREvent{}, &replyPingAf); err != nil {
+ if err := testSectRPC.Call(context.Background(), utils.CDRsV1Ping, &engine.CGREvent{}, &replyPingAf); err != nil {
t.Error(err)
} else if replyPingAf != utils.Pong {
t.Errorf("Expected OK received: %s", replyPingAf)
@@ -563,7 +563,7 @@ func testSectConfigSReloadSessions(t *testing.T) {
}
var replyPingAf string
- if err := testSectRPC.Call(context.Background(), utils.SessionSv1Ping, &utils.CGREvent{}, &replyPingAf); err != nil {
+ if err := testSectRPC.Call(context.Background(), utils.SessionSv1Ping, &engine.CGREvent{}, &replyPingAf); err != nil {
t.Error(err)
} else if replyPingAf != utils.Pong {
t.Errorf("Expected OK received: %s", replyPingAf)
@@ -929,7 +929,7 @@ func testSectConfigSReloadAttributes(t *testing.T) {
}
var replyPingAf string
- if err := testSectRPC.Call(context.Background(), utils.AttributeSv1Ping, &utils.CGREvent{}, &replyPingAf); err != nil {
+ if err := testSectRPC.Call(context.Background(), utils.AttributeSv1Ping, &engine.CGREvent{}, &replyPingAf); err != nil {
t.Error(err)
} else if replyPingAf != utils.Pong {
t.Errorf("Expected OK received: %s", replyPingAf)
@@ -968,7 +968,7 @@ func testSectConfigSReloadChargers(t *testing.T) {
}
var replyPingAf string
- if err := testSectRPC.Call(context.Background(), utils.ChargerSv1Ping, &utils.CGREvent{}, &replyPingAf); err != nil {
+ if err := testSectRPC.Call(context.Background(), utils.ChargerSv1Ping, &engine.CGREvent{}, &replyPingAf); err != nil {
t.Error(err)
} else if replyPingAf != utils.Pong {
t.Errorf("Expected OK received: %s", replyPingAf)
@@ -1007,7 +1007,7 @@ func testSectConfigSReloadResources(t *testing.T) {
}
var replyPingAf string
- if err := testSectRPC.Call(context.Background(), utils.ResourceSv1Ping, &utils.CGREvent{}, &replyPingAf); err != nil {
+ if err := testSectRPC.Call(context.Background(), utils.ResourceSv1Ping, &engine.CGREvent{}, &replyPingAf); err != nil {
t.Error(err)
} else if replyPingAf != utils.Pong {
t.Errorf("Expected OK received: %s", replyPingAf)
@@ -1047,7 +1047,7 @@ func testSectConfigSReloadStats(t *testing.T) {
t.Errorf("\nExpected %+v ,\n received: %+v", utils.ToIJSON(cfgStr), utils.ToIJSON(rpl))
}
var replyPingAf string
- if err := testSectRPC.Call(context.Background(), utils.StatSv1Ping, &utils.CGREvent{}, &replyPingAf); err != nil {
+ if err := testSectRPC.Call(context.Background(), utils.StatSv1Ping, &engine.CGREvent{}, &replyPingAf); err != nil {
t.Error(err)
} else if replyPingAf != utils.Pong {
t.Errorf("Expected OK received: %s", replyPingAf)
@@ -1078,7 +1078,7 @@ func testSectConfigSReloadThresholds(t *testing.T) {
}
var replyPingAf string
- if err := testSectRPC.Call(context.Background(), utils.ThresholdSv1Ping, &utils.CGREvent{}, &replyPingAf); err != nil {
+ if err := testSectRPC.Call(context.Background(), utils.ThresholdSv1Ping, &engine.CGREvent{}, &replyPingAf); err != nil {
t.Error(err)
} else if replyPingAf != utils.Pong {
t.Errorf("Expected OK received: %s", replyPingAf)
@@ -1121,7 +1121,7 @@ func testSectConfigSReloadRoutes(t *testing.T) {
}
var replyPingAf string
- if err := testSectRPC.Call(context.Background(), utils.RouteSv1Ping, &utils.CGREvent{}, &replyPingAf); err != nil {
+ if err := testSectRPC.Call(context.Background(), utils.RouteSv1Ping, &engine.CGREvent{}, &replyPingAf); err != nil {
t.Error(err)
} else if replyPingAf != utils.Pong {
t.Errorf("Expected OK received: %s", replyPingAf)
@@ -1275,7 +1275,7 @@ func testSectConfigSReloadMigrator(t *testing.T) {
func testSectConfigSReloadDispatchers(t *testing.T) {
var replyPingBf string
- err := testSectRPC.Call(context.Background(), utils.DispatcherSv1Ping, &utils.CGREvent{}, &replyPingBf)
+ err := testSectRPC.Call(context.Background(), utils.DispatcherSv1Ping, &engine.CGREvent{}, &replyPingBf)
if err == nil || err.Error() != "rpc: can't find service DispatcherSv1.Ping" {
t.Error(err)
}
diff --git a/general_tests/api_escape_char_it_test.go b/general_tests/api_escape_char_it_test.go
index 965c09598..3d087175a 100644
--- a/general_tests/api_escape_char_it_test.go
+++ b/general_tests/api_escape_char_it_test.go
@@ -103,7 +103,7 @@ func TestEscapeCharacters(t *testing.T) {
}
// Call AttributeSv1.ProcessEvent to check if filters match.
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
"Password": "password\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000",
diff --git a/general_tests/attributes_filters_index_it_test.go b/general_tests/attributes_filters_index_it_test.go
index 93be8af57..e9e3d2826 100644
--- a/general_tests/attributes_filters_index_it_test.go
+++ b/general_tests/attributes_filters_index_it_test.go
@@ -162,7 +162,7 @@ func testAttributeSetProfile(t *testing.T) {
t.Error("Unexpected reply returned", result)
}
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
"Subject": "44",
@@ -212,7 +212,7 @@ func testAttributeSetFltr2(t *testing.T) {
}
//same event for process
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
"Subject": "4444",
@@ -224,7 +224,7 @@ func testAttributeSetFltr2(t *testing.T) {
exp := engine.AttrSProcessEventReply{
MatchedProfiles: []string{"cgrates.org:ApierTest"},
AlteredFields: []string{"*req.FL1"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
"Subject": "4444",
diff --git a/general_tests/attributes_it_test.go b/general_tests/attributes_it_test.go
index 395887716..24ca05954 100644
--- a/general_tests/attributes_it_test.go
+++ b/general_tests/attributes_it_test.go
@@ -129,7 +129,7 @@ func testAttributeSLoadFromFolder(t *testing.T) {
}
func testAttributeSProcessEvent(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEvent",
Event: map[string]any{
@@ -143,7 +143,7 @@ func testAttributeSProcessEvent(t *testing.T) {
eRply := engine.AttrSProcessEventReply{
MatchedProfiles: []string{"cgrates.org:ATTR_VARIABLE"},
AlteredFields: []string{utils.MetaReq + utils.NestingSep + utils.Category},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEvent",
Event: map[string]any{
@@ -213,7 +213,7 @@ func testAttributeSProcessEventWithAccount(t *testing.T) {
t.Errorf("Expecting : %+v, received: %+v", alsPrf.AttributeProfile, replyAttr)
}
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEventWithAccount",
Event: map[string]any{
@@ -227,7 +227,7 @@ func testAttributeSProcessEventWithAccount(t *testing.T) {
eRply := engine.AttrSProcessEventReply{
MatchedProfiles: []string{"cgrates.org:ATTR_ACCOUNT"},
AlteredFields: []string{utils.MetaReq + utils.NestingSep + "Balance"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEventWithAccount",
Event: map[string]any{
@@ -296,7 +296,7 @@ func testAttributeSProcessEventWithAccountFull(t *testing.T) {
t.Errorf("Expecting : %+v, received: %+v", alsPrf.AttributeProfile, replyAttr)
}
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEventWithAccount2",
Event: map[string]any{
@@ -310,7 +310,7 @@ func testAttributeSProcessEventWithAccountFull(t *testing.T) {
eRply := engine.AttrSProcessEventReply{
MatchedProfiles: []string{"cgrates.org:ATTR_ACCOUNT2"},
AlteredFields: []string{utils.MetaReq + utils.NestingSep + "FullAccount"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEventWithAccount2",
Event: map[string]any{
@@ -348,7 +348,7 @@ func testAttributeSProcessEventWithStat(t *testing.T) {
// simulate some stat event
var reply []string
expected := []string{"Stat_1"}
- ev1 := &utils.CGREvent{
+ ev1 := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -365,7 +365,7 @@ func testAttributeSProcessEventWithStat(t *testing.T) {
}
expected = []string{"Stat_1"}
- ev1 = &utils.CGREvent{
+ ev1 = &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event2",
Event: map[string]any{
@@ -424,7 +424,7 @@ func testAttributeSProcessEventWithStat(t *testing.T) {
t.Errorf("Expecting : %+v, received: %+v", alsPrf.AttributeProfile, replyAttr)
}
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEventWithStat",
Event: map[string]any{
@@ -438,7 +438,7 @@ func testAttributeSProcessEventWithStat(t *testing.T) {
eRply := engine.AttrSProcessEventReply{
MatchedProfiles: []string{"cgrates.org:ATTR_STATS"},
AlteredFields: []string{utils.MetaReq + utils.NestingSep + "AcdMetric"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEventWithStat",
Event: map[string]any{
@@ -507,7 +507,7 @@ func testAttributeSProcessEventWithStatFull(t *testing.T) {
t.Errorf("Expecting : %+v, received: %+v", alsPrf.AttributeProfile, replyAttr)
}
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEventWithStat",
Event: map[string]any{
@@ -521,7 +521,7 @@ func testAttributeSProcessEventWithStatFull(t *testing.T) {
eRply := engine.AttrSProcessEventReply{
MatchedProfiles: []string{"cgrates.org:ATTR_STATS2"},
AlteredFields: []string{utils.MetaReq + utils.NestingSep + "AllMetrics"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEventWithStat",
Event: map[string]any{
@@ -575,7 +575,7 @@ func testAttributeSProcessEventWithResource(t *testing.T) {
}
// Allocate 3 units for resource ResTest
- argsRU := &utils.CGREvent{
+ argsRU := &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Event: map[string]any{
@@ -591,7 +591,7 @@ func testAttributeSProcessEventWithResource(t *testing.T) {
t.Error(err)
}
// Allocate 2 units for resource ResTest
- argsRU2 := &utils.CGREvent{
+ argsRU2 := &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Event: map[string]any{
@@ -649,7 +649,7 @@ func testAttributeSProcessEventWithResource(t *testing.T) {
t.Errorf("Expecting : %+v, received: %+v", alsPrf.AttributeProfile, replyAttr)
}
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEventWithResource",
Event: map[string]any{
@@ -663,7 +663,7 @@ func testAttributeSProcessEventWithResource(t *testing.T) {
eRply := engine.AttrSProcessEventReply{
MatchedProfiles: []string{"cgrates.org:ATTR_RESOURCE"},
AlteredFields: []string{utils.MetaReq + utils.NestingSep + "ResourceTotalUsages"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEventWithResource",
Event: map[string]any{
@@ -732,7 +732,7 @@ func testAttributeSProcessEventWithResourceFull(t *testing.T) {
t.Errorf("Expecting : %+v, received: %+v", alsPrf.AttributeProfile, replyAttr)
}
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEventWithResource2",
Event: map[string]any{
@@ -746,7 +746,7 @@ func testAttributeSProcessEventWithResourceFull(t *testing.T) {
eRply := engine.AttrSProcessEventReply{
MatchedProfiles: []string{"cgrates.org:ATTR_RESOURCE2"},
AlteredFields: []string{utils.MetaReq + utils.NestingSep + "FullResource"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEventWithResource2",
Event: map[string]any{
@@ -823,7 +823,7 @@ func testAttributeSProcessEventWithLibPhoneNumber(t *testing.T) {
t.Errorf("Expecting : %+v, received: %+v", alsPrf.AttributeProfile, replyAttr)
}
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEventWithLibPhoneNumber2",
Event: map[string]any{
@@ -838,7 +838,7 @@ func testAttributeSProcessEventWithLibPhoneNumber(t *testing.T) {
eRply := engine.AttrSProcessEventReply{
MatchedProfiles: []string{"cgrates.org:ATTR_LIBPHONENUMBER2"},
AlteredFields: []string{utils.MetaReq + utils.NestingSep + "DestinationCarrier"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEventWithLibPhoneNumber2",
Event: map[string]any{
@@ -926,7 +926,7 @@ func testAttributeSProcessEventWithLibPhoneNumberComposed(t *testing.T) {
t.Errorf("Expecting : %+v, received: %+v", alsPrf.AttributeProfile, replyAttr)
}
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEventWithLibPhoneNumberComposed",
Event: map[string]any{
@@ -941,7 +941,7 @@ func testAttributeSProcessEventWithLibPhoneNumberComposed(t *testing.T) {
eRply := engine.AttrSProcessEventReply{
MatchedProfiles: []string{"cgrates.org:ATTR_LIBPHONENUMBER_COMPOSED"},
AlteredFields: []string{utils.MetaReq + utils.NestingSep + "DestinationCarrier"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEventWithLibPhoneNumberComposed",
Event: map[string]any{
@@ -1011,7 +1011,7 @@ func testAttributeSProcessEventWithLibPhoneNumberFull(t *testing.T) {
t.Errorf("Expecting : %+v, received: %+v", alsPrf.AttributeProfile, replyAttr)
}
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEventWithLibPhoneNumber",
Event: map[string]any{
@@ -1026,7 +1026,7 @@ func testAttributeSProcessEventWithLibPhoneNumberFull(t *testing.T) {
eRply := engine.AttrSProcessEventReply{
MatchedProfiles: []string{"cgrates.org:ATTR_LIBPHONENUMBER"},
AlteredFields: []string{utils.MetaReq + utils.NestingSep + "DestinationDetails"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEventWithLibPhoneNumber",
Event: map[string]any{
@@ -1174,7 +1174,7 @@ cgrates.org,FLTR_DESTINATION_MATCH,*destinations,~*req.Destination,DST_10,`,
})
t.Run("CheckFieldsAlteredByAttributeS", func(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event_test",
Event: map[string]any{
@@ -1185,7 +1185,7 @@ cgrates.org,FLTR_DESTINATION_MATCH,*destinations,~*req.Destination,DST_10,`,
expected := engine.AttrSProcessEventReply{
MatchedProfiles: []string{"cgrates.org:ATTR_INLINE_FILTER"},
AlteredFields: []string{"*req.InlineDestinationMatch", "*req.InlineOrDestinationMatch"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event_test",
Event: map[string]any{
@@ -1366,7 +1366,7 @@ cgrates.org,ATTR_ARITH,,,,,*req.MultiplyBetweenVariables,*multiply,~*req.Elem1;~
})
t.Run("CheckFieldsAlteredByAttributeS", func(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event_test",
Event: map[string]any{
@@ -1378,7 +1378,7 @@ cgrates.org,ATTR_ARITH,,,,,*req.MultiplyBetweenVariables,*multiply,~*req.Elem1;~
expected := engine.AttrSProcessEventReply{
MatchedProfiles: []string{"cgrates.org:ATTR_ARITH"},
AlteredFields: []string{"*req.12/4", "*req.3*4", "*req.3+4", "*req.3-4", "*req.MultiplyBetweenVariables"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event_test",
Event: map[string]any{
diff --git a/general_tests/attributeswithdataconverters_it_test.go b/general_tests/attributeswithdataconverters_it_test.go
index 1c787980e..544f4c627 100644
--- a/general_tests/attributeswithdataconverters_it_test.go
+++ b/general_tests/attributeswithdataconverters_it_test.go
@@ -120,7 +120,7 @@ func testAttrWDcLoadFromFolder(t *testing.T) {
}
func testAttrWDcProcessEvent(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttrWDcProcessEvent",
Event: map[string]any{
@@ -133,7 +133,7 @@ func testAttrWDcProcessEvent(t *testing.T) {
eRply := engine.AttrSProcessEventReply{
MatchedProfiles: []string{"cgrates.org:ATTR_SEC"},
AlteredFields: []string{"*req.Cost"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttrWDcProcessEvent",
Event: map[string]any{
@@ -158,7 +158,7 @@ func testAttrWDcProcessEvent(t *testing.T) {
func testAttrWDcProcessEventWithStat(t *testing.T) {
var reply []string
expected := []string{"Stat_1"}
- ev1 := &utils.CGREvent{
+ ev1 := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -174,7 +174,7 @@ func testAttrWDcProcessEventWithStat(t *testing.T) {
t.Errorf("Expecting: %+v, received: %+v", expected, reply)
}
- ev1 = &utils.CGREvent{
+ ev1 = &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event2",
Event: map[string]any{
@@ -190,7 +190,7 @@ func testAttrWDcProcessEventWithStat(t *testing.T) {
t.Errorf("Expecting: %+v, received: %+v", expected, reply)
}
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttrWDcProcessEventWithStat",
Event: map[string]any{
@@ -204,7 +204,7 @@ func testAttrWDcProcessEventWithStat(t *testing.T) {
eRply := engine.AttrSProcessEventReply{
MatchedProfiles: []string{"cgrates.org:ATTR_STAT"},
AlteredFields: []string{"*req.AcdMetric"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttrWDcProcessEventWithStat",
Event: map[string]any{
@@ -227,7 +227,7 @@ func testAttrWDcProcessEventWithStat(t *testing.T) {
}
}
func testAttrWDcStripConverter(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttrWDcStripConverter",
Event: map[string]any{
@@ -243,7 +243,7 @@ func testAttrWDcStripConverter(t *testing.T) {
eRply := engine.AttrSProcessEventReply{
MatchedProfiles: []string{"cgrates.org:ATTR_VARIABLE"},
AlteredFields: []string{"*req.AnswerTime", "*req.Category"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttrWDcStripConverter",
Event: map[string]any{
diff --git a/general_tests/authorize_event_sms_data_it_test.go b/general_tests/authorize_event_sms_data_it_test.go
index 82fab9092..937690916 100644
--- a/general_tests/authorize_event_sms_data_it_test.go
+++ b/general_tests/authorize_event_sms_data_it_test.go
@@ -26,6 +26,7 @@ import (
"time"
"github.com/cgrates/birpc/context"
+ "github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/sessions"
"github.com/cgrates/cgrates/utils"
)
@@ -59,7 +60,7 @@ func TestSSv1AuthorizeEventSMS(t *testing.T) {
args := &sessions.V1AuthorizeArgs{
GetMaxUsage: true,
GetAttributes: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSSv1ItAuthSMS",
Event: map[string]any{
@@ -85,7 +86,7 @@ func TestSSv1AuthorizeEventSMS(t *testing.T) {
t.Run("AuthorizeEventData", func(t *testing.T) {
args := &sessions.V1AuthorizeArgs{
GetMaxUsage: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSSv1ItAuthData",
Event: map[string]any{
diff --git a/general_tests/balance_it_test.go b/general_tests/balance_it_test.go
index 2a1d1e210..96ae99e19 100644
--- a/general_tests/balance_it_test.go
+++ b/general_tests/balance_it_test.go
@@ -142,7 +142,7 @@ cgrates.org,sms,1001,2014-01-14T00:00:00Z,RP_ANY,`,
if err := client.Call(context.Background(), utils.CDRsV1ProcessEvent,
&engine.ArgV1ProcessEvent{
Flags: []string{utils.MetaRALs},
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -188,7 +188,7 @@ cgrates.org,sms,1001,2014-01-14T00:00:00Z,RP_ANY,`,
if err := client.Call(context.Background(), utils.CDRsV1ProcessEvent,
&engine.ArgV1ProcessEvent{
Flags: []string{utils.MetaRALs},
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -359,7 +359,7 @@ cgrates.org,sms,1001,2014-01-14T00:00:00Z,RP_ANY,`,
if err := client.Call(context.Background(), utils.CDRsV1ProcessEvent,
&engine.ArgV1ProcessEvent{
Flags: []string{utils.MetaRALs},
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
diff --git a/general_tests/birpc_benchmark_test.go b/general_tests/birpc_benchmark_test.go
index 58a84d490..d9d82f6e6 100644
--- a/general_tests/birpc_benchmark_test.go
+++ b/general_tests/birpc_benchmark_test.go
@@ -228,7 +228,7 @@ cgrates.org,ROUTE_RPC,,,,,route2,,,,,,10,,,
ChargerSProfile: "DEFAULT",
AttributeSProfiles: []string{"cgrates.org:ATTR_RPC"},
AlteredFields: []string{utils.MetaReqRunID, "*req.Password"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -248,7 +248,7 @@ cgrates.org,ROUTE_RPC,,,,,route2,,,,,,10,,,
for i := 0; i < b.N; i++ {
if err := benchRPC.Call(
context.Background(),
- utils.ChargerSv1ProcessEvent, &utils.CGREvent{
+ utils.ChargerSv1ProcessEvent, &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -270,7 +270,7 @@ cgrates.org,ROUTE_RPC,,,,,route2,,,,,,10,,,
Attributes: &engine.AttrSProcessEventReply{
MatchedProfiles: []string{"cgrates.org:ATTR_RPC"},
AlteredFields: []string{"*req.Password"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "benchmarkSession",
Event: map[string]any{
@@ -326,7 +326,7 @@ cgrates.org,ROUTE_RPC,,,,,route2,,,,,,10,,,
AuthorizeResources: true,
GetRoutes: true,
GetAttributes: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "benchmarkSession",
Event: map[string]any{
diff --git a/general_tests/broadcast_client_it_test.go b/general_tests/broadcast_client_it_test.go
index b58d2add0..53a69126d 100644
--- a/general_tests/broadcast_client_it_test.go
+++ b/general_tests/broadcast_client_it_test.go
@@ -135,7 +135,7 @@ func testbrodcastItLoadFromFolder(t *testing.T) {
}
func testbrodcastItProccessEvent(t *testing.T) {
- args := utils.CGREvent{
+ args := engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSSv1ItProcessCDR",
Event: map[string]any{
diff --git a/general_tests/cacherpl_filter_update_it_test.go b/general_tests/cacherpl_filter_update_it_test.go
index 92d5ac1df..42cec5902 100644
--- a/general_tests/cacherpl_filter_update_it_test.go
+++ b/general_tests/cacherpl_filter_update_it_test.go
@@ -58,7 +58,7 @@ var (
testFilterUpdateGetAttrProfileForEventEv2E2,
testFilterUpdateStopEngine,
}
- ev1 = &utils.CGREvent{
+ ev1 = &engine.CGREvent{
Tenant: "cgrates.org",
ID: "Event1",
Event: map[string]any{
@@ -68,7 +68,7 @@ var (
utils.OptsContext: utils.MetaAny,
},
}
- ev2 = &utils.CGREvent{
+ ev2 = &engine.CGREvent{
Tenant: "cgrates.org",
ID: "Event2",
Event: map[string]any{
diff --git a/general_tests/cacherpl_it_test.go b/general_tests/cacherpl_it_test.go
index 9ae2ada75..8c80a1378 100644
--- a/general_tests/cacherpl_it_test.go
+++ b/general_tests/cacherpl_it_test.go
@@ -322,7 +322,7 @@ func testCacheRplPing(t *testing.T) {
}
var rpl string
- if err := dspEngine1RPC.Call(context.Background(), utils.AttributeSv1Ping, &utils.CGREvent{
+ if err := dspEngine1RPC.Call(context.Background(), utils.AttributeSv1Ping, &engine.CGREvent{
Tenant: "cgrates.org",
APIOpts: map[string]any{
@@ -363,7 +363,7 @@ func testCacheRplCheckReplication(t *testing.T) {
}
var rpl string
- if err := dspEngine2RPC.Call(context.Background(), utils.AttributeSv1Ping, &utils.CGREvent{
+ if err := dspEngine2RPC.Call(context.Background(), utils.AttributeSv1Ping, &engine.CGREvent{
Tenant: "cgrates.org",
APIOpts: map[string]any{
@@ -394,7 +394,7 @@ func testCacheRplAACheckReplication(t *testing.T) {
}
var rpl string
- if err := dspEngine2RPC.Call(context.Background(), utils.AttributeSv1Ping, &utils.CGREvent{
+ if err := dspEngine2RPC.Call(context.Background(), utils.AttributeSv1Ping, &engine.CGREvent{
Tenant: "cgrates.org",
APIOpts: map[string]any{
@@ -406,7 +406,7 @@ func testCacheRplAACheckReplication(t *testing.T) {
t.Errorf("Received: %s", rpl)
}
- if err := dspEngine1RPC.Call(context.Background(), utils.AttributeSv1Ping, &utils.CGREvent{
+ if err := dspEngine1RPC.Call(context.Background(), utils.AttributeSv1Ping, &engine.CGREvent{
Tenant: "cgrates.org",
APIOpts: map[string]any{
utils.OptsRouteID: "testRouteFromDispatcher1",
@@ -463,7 +463,7 @@ func testCacheRplAACheckLoadReplication(t *testing.T) {
wgDisp2.Add(1)
go func() {
var rpl []*engine.ChrgSProcessEventReply
- if err := dspEngine1RPC.Call(context.Background(), utils.ChargerSv1ProcessEvent, &utils.CGREvent{
+ if err := dspEngine1RPC.Call(context.Background(), utils.ChargerSv1ProcessEvent, &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testCacheRplAACheckLoadReplication",
Event: map[string]any{
@@ -484,7 +484,7 @@ func testCacheRplAACheckLoadReplication(t *testing.T) {
}()
go func() {
var rpl []*engine.ChrgSProcessEventReply
- if err := dspEngine2RPC.Call(context.Background(), utils.ChargerSv1ProcessEvent, &utils.CGREvent{
+ if err := dspEngine2RPC.Call(context.Background(), utils.ChargerSv1ProcessEvent, &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testCacheRplAACheckLoadReplication",
@@ -575,7 +575,7 @@ func testCacheRplCheckLoadReplication(t *testing.T) {
for i := 0; i < 10; i++ {
wg.Add(1)
go func() {
- if err := dspEngine1RPC.Call(context.Background(), utils.ChargerSv1ProcessEvent, &utils.CGREvent{
+ if err := dspEngine1RPC.Call(context.Background(), utils.ChargerSv1ProcessEvent, &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testCacheRplCheckLoadReplication",
diff --git a/general_tests/cdrs_exp_it_test.go b/general_tests/cdrs_exp_it_test.go
index 4c5679ac5..a7fd11b3e 100644
--- a/general_tests/cdrs_exp_it_test.go
+++ b/general_tests/cdrs_exp_it_test.go
@@ -57,7 +57,7 @@ var (
cdrsExpAMQPCon *amqp.Connection
- cdrsExpEv = &utils.CGREvent{
+ cdrsExpEv = &engine.CGREvent{
ID: "Export",
Tenant: "cgrates.org",
diff --git a/general_tests/cdrs_internal_it_test.go b/general_tests/cdrs_internal_it_test.go
index 1d80e6e90..a4cc4237b 100644
--- a/general_tests/cdrs_internal_it_test.go
+++ b/general_tests/cdrs_internal_it_test.go
@@ -96,7 +96,7 @@ func testCdrsIntRpcConn(t *testing.T) {
func testCdrsIntTestTTL(t *testing.T) {
args := &engine.ArgV1ProcessEvent{
Flags: []string{"*store:true"},
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.OriginID: "testCdrsIntTestTTL",
diff --git a/general_tests/cdrs_it_test.go b/general_tests/cdrs_it_test.go
index cd84a39f8..786e8bae9 100644
--- a/general_tests/cdrs_it_test.go
+++ b/general_tests/cdrs_it_test.go
@@ -163,7 +163,7 @@ func testV2CDRsProcessCDR(t *testing.T) {
args := &engine.ArgV1ProcessEvent{
Flags: []string{utils.MetaRALs},
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.OriginID: "testV2CDRsProcessCDR1",
@@ -234,7 +234,7 @@ func testV2CDRsProcessCDR2(t *testing.T) {
args := &engine.ArgV1ProcessEvent{
Flags: []string{"*attributes:false", utils.MetaRALs},
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.OriginID: "testV2CDRsProcessCDR2",
@@ -306,7 +306,7 @@ func testV2CDRsGetCdrs2(t *testing.T) {
func testV2CDRsProcessCDR3(t *testing.T) {
args := &engine.ArgV1ProcessEvent{
Flags: []string{"*attributes:false", "*chargers:false"},
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.OriginID: "testV2CDRsProcessCDR3",
@@ -367,7 +367,7 @@ func testV2CDRsGetCdrs3(t *testing.T) {
func testV2CDRsProcessCDR4(t *testing.T) {
args := &engine.ArgV1ProcessEvent{
Flags: []string{utils.MetaAttributes, utils.MetaRALs},
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.OriginID: "testV2CDRsProcessCDR4",
@@ -556,7 +556,7 @@ func testV2CDRsSetThresholdProfile(t *testing.T) {
func testV2CDRsProcessCDR5(t *testing.T) {
args := &engine.ArgV1ProcessEvent{
Flags: []string{"*store:false", "*stats:false", "*thresholds:false"},
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.OriginID: "testV2CDRsProcessCDR5",
@@ -622,7 +622,7 @@ func testV2CDRsGetThreshold1(t *testing.T) {
func testV2CDRsProcessCDR6(t *testing.T) {
args := &engine.ArgV1ProcessEvent{
Flags: []string{"*store:false", "*stats:true", "*thresholds:true"},
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.OriginID: "testV2CDRsProcessCDR5",
@@ -681,7 +681,7 @@ func testV2CDRsProcessCDR7(t *testing.T) {
args := &engine.ArgV1ProcessEvent{
Flags: []string{utils.MetaStore, utils.MetaRALs},
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.OriginID: "testV2CDRsProcessCDR7",
diff --git a/general_tests/cdrs_post_failover_it_test.go b/general_tests/cdrs_post_failover_it_test.go
index e97fa13b0..232d73272 100644
--- a/general_tests/cdrs_post_failover_it_test.go
+++ b/general_tests/cdrs_post_failover_it_test.go
@@ -143,7 +143,7 @@ func testCDRsPostFailoverProcessCDR(t *testing.T) {
args := &engine.ArgV1ProcessEvent{
Flags: []string{utils.MetaExport, "*attributes:false", "*rals:false", "*chargers:false",
"*store:false", "*thresholds:false", "*stats:false"}, // only export the CDR
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
ID: "1",
Tenant: "cgrates.org",
Event: map[string]any{
diff --git a/general_tests/cdrs_processevent_it_test.go b/general_tests/cdrs_processevent_it_test.go
index 17047171f..f4dd600a6 100644
--- a/general_tests/cdrs_processevent_it_test.go
+++ b/general_tests/cdrs_processevent_it_test.go
@@ -166,7 +166,7 @@ func testV1CDRsProcessEventAttrS(t *testing.T) {
}
argsEv := &engine.ArgV1ProcessEvent{
Flags: []string{utils.MetaAttributes, utils.MetaStore, "*chargers:false", "*export:false"},
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
ID: "test1",
Event: map[string]any{
@@ -250,7 +250,7 @@ func testV1CDRsProcessEventAttrS(t *testing.T) {
func testV1CDRsProcessEventChrgS(t *testing.T) {
argsEv := &engine.ArgV1ProcessEvent{
Flags: []string{utils.MetaChargers, "*attributes:false", "*export:false"},
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
ID: "test2",
Event: map[string]any{
@@ -293,7 +293,7 @@ func testV1CDRsProcessEventChrgS(t *testing.T) {
func testV1CDRsProcessEventRalS(t *testing.T) {
argsEv := &engine.ArgV1ProcessEvent{
Flags: []string{utils.MetaRALs, "*attributes:false", "*chargers:false", "*export:false"},
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
ID: "test3",
Event: map[string]any{
@@ -328,7 +328,7 @@ func testV1CDRsProcessEventRalS(t *testing.T) {
func testV1CDRsProcessEventSts(t *testing.T) {
argsEv := &engine.ArgV1ProcessEvent{
Flags: []string{utils.MetaStats, "*rals:false", "*attributes:false", "*chargers:false", "*export:false"},
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
ID: "test4",
Event: map[string]any{
@@ -413,7 +413,7 @@ func testV1CDRsProcessEventSts(t *testing.T) {
func testV1CDRsProcessEventStore(t *testing.T) {
argsEv := &engine.ArgV1ProcessEvent{
Flags: []string{"*store:false", "*attributes:false", "*chargers:false", "*export:false"},
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
ID: "test5",
Event: map[string]any{
@@ -504,7 +504,7 @@ func testV1CDRsProcessEventThreshold(t *testing.T) {
}
args := &engine.ArgV1ProcessEvent{
Flags: []string{utils.MetaThresholds, utils.MetaRALs, utils.ConcatenatedKey(utils.MetaChargers, "false"), "*export:false"},
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.OriginID: "testV2CDRsProcessCDRWithThreshold",
@@ -558,7 +558,7 @@ func testV1CDRsProcessEventExport(t *testing.T) {
var reply string
args := &engine.ArgV1ProcessEvent{
Flags: []string{utils.MetaExport, "*store:false", "*attributes:false", "*chargers:false", "*stats:false", "*thresholds:false"},
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
ID: "test7",
Event: map[string]any{
@@ -611,7 +611,7 @@ func testV1CDRsProcessEventExportCheck(t *testing.T) {
func testV1CDRsV2ProcessEventRalS(t *testing.T) {
argsEv := &engine.ArgV1ProcessEvent{
Flags: []string{utils.MetaRALs, "*attributes:false", "*chargers:false", "*export:false"},
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
ID: "test101",
Event: map[string]any{
@@ -626,7 +626,7 @@ func testV1CDRsV2ProcessEventRalS(t *testing.T) {
},
},
}
- expRply := []*utils.EventWithFlags{
+ expRply := []*engine.EventWithFlags{
{
Flags: []string{},
Event: map[string]any{
@@ -655,7 +655,7 @@ func testV1CDRsV2ProcessEventRalS(t *testing.T) {
},
},
}
- var reply []*utils.EventWithFlags
+ var reply []*engine.EventWithFlags
if err := pecdrsRpc.Call(context.Background(), utils.CDRsV2ProcessEvent, argsEv, &reply); err != nil {
t.Error(err)
}
diff --git a/general_tests/data_it_test.go b/general_tests/data_it_test.go
index 8fb9e803a..5fce366ab 100644
--- a/general_tests/data_it_test.go
+++ b/general_tests/data_it_test.go
@@ -447,7 +447,7 @@ func testV1DataInitSession(t *testing.T) {
args := &sessions.V1InitSessionArgs{
InitSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testV1DataInitSession",
Event: map[string]any{
@@ -492,7 +492,7 @@ func testV1DataUpdateWith1Mo(t *testing.T) {
args := &sessions.V1UpdateSessionArgs{
UpdateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testV1DataUpdateWith1Mo",
Event: map[string]any{
@@ -536,7 +536,7 @@ func testV1DataUpdateWith1Go(t *testing.T) {
reqUsage := 1000000000
args := &sessions.V1UpdateSessionArgs{
UpdateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testV1DataUpdateWith1Go",
Event: map[string]any{
diff --git a/general_tests/ees_it_test.go b/general_tests/ees_it_test.go
index e84a07875..79cef7943 100644
--- a/general_tests/ees_it_test.go
+++ b/general_tests/ees_it_test.go
@@ -150,7 +150,7 @@ func TestEEsExportEventChanges(t *testing.T) {
t.Run("ExportEvent", func(t *testing.T) {
eventToExport := &engine.CGREventWithEeIDs{
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "voiceEvent",
Time: utils.TimePointer(time.Now()),
diff --git a/general_tests/fallback_depth_it_test.go b/general_tests/fallback_depth_it_test.go
index 05494561d..99c0eaf1b 100644
--- a/general_tests/fallback_depth_it_test.go
+++ b/general_tests/fallback_depth_it_test.go
@@ -147,11 +147,11 @@ cgrates.org,call,FallbackSubject4,2014-01-01T00:00:00Z,RP_ANY,`,
defer shutdown()
t.Run("ProcessCdrFallbackSuccess", func(t *testing.T) {
- var reply []*utils.EventWithFlags
+ var reply []*engine.EventWithFlags
err := client.Call(context.Background(), utils.CDRsV2ProcessEvent,
&engine.ArgV1ProcessEvent{
Flags: []string{utils.MetaRALs},
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -207,11 +207,11 @@ cgrates.org,call,FallbackSubject4,2014-01-01T00:00:00Z,RP_ANY,`,
})
t.Run("ProcessCdrFallbackFail", func(t *testing.T) {
- var reply []*utils.EventWithFlags
+ var reply []*engine.EventWithFlags
err := client.Call(context.Background(), utils.CDRsV2ProcessEvent,
&engine.ArgV1ProcessEvent{
Flags: []string{utils.MetaRALs},
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
ID: "event2",
Event: map[string]any{
diff --git a/general_tests/filtered_replication_it_test.go b/general_tests/filtered_replication_it_test.go
index fcdecb83f..f8ea70ea6 100644
--- a/general_tests/filtered_replication_it_test.go
+++ b/general_tests/filtered_replication_it_test.go
@@ -493,7 +493,7 @@ func testFltrRplThresholdProfile(t *testing.T) {
t.Fatalf("Unexpected error: %v", err)
}
- tEv := &utils.CGREvent{
+ tEv := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -680,7 +680,7 @@ func testFltrRplStatQueueProfile(t *testing.T) {
t.Fatalf("Unexpected error: %v", err)
}
- sEv := &utils.CGREvent{
+ sEv := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -858,7 +858,7 @@ func testFltrRplResourceProfile(t *testing.T) {
t.Fatalf("Unexpected error: %v", err)
}
- rEv := &utils.CGREvent{
+ rEv := &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Event: map[string]any{
diff --git a/general_tests/filterhttp_it_test.go b/general_tests/filterhttp_it_test.go
index 5934f60e7..c0e2e120b 100644
--- a/general_tests/filterhttp_it_test.go
+++ b/general_tests/filterhttp_it_test.go
@@ -180,7 +180,7 @@ cgrates.org,ATTR_DEST,*any,FLTR_DST_1002;FLTR_DEST,,,*req.Supplier,*constant,Sup
t.Run("FilterHTTPFullEvent", func(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEvent",
Event: map[string]any{
@@ -195,7 +195,7 @@ cgrates.org,ATTR_DEST,*any,FLTR_DST_1002;FLTR_DEST,,,*req.Supplier,*constant,Sup
eRply := engine.AttrSProcessEventReply{
MatchedProfiles: []string{"cgrates.org:ATTR_ACNT_1001"},
AlteredFields: []string{"*req.OfficeGroup"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEvent",
Event: map[string]any{
@@ -224,7 +224,7 @@ cgrates.org,ATTR_DEST,*any,FLTR_DST_1002;FLTR_DEST,,,*req.Supplier,*constant,Sup
t.Run("FilterHTTPField", func(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeFilterHTTP",
Event: map[string]any{
@@ -239,7 +239,7 @@ cgrates.org,ATTR_DEST,*any,FLTR_DST_1002;FLTR_DEST,,,*req.Supplier,*constant,Sup
eRply := engine.AttrSProcessEventReply{
MatchedProfiles: []string{"cgrates.org:ATTR_DEST"},
AlteredFields: []string{"*req.Supplier"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeFilterHTTP",
Event: map[string]any{
diff --git a/general_tests/filters_it_test.go b/general_tests/filters_it_test.go
index bd962c7d7..b0f77345b 100644
--- a/general_tests/filters_it_test.go
+++ b/general_tests/filters_it_test.go
@@ -146,7 +146,7 @@ func testV1FltrLoadTarrifPlans(t *testing.T) {
func testV1FltrAddStats(t *testing.T) {
var reply []string
expected := []string{"Stat_1"}
- ev1 := &utils.CGREvent{
+ ev1 := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -163,7 +163,7 @@ func testV1FltrAddStats(t *testing.T) {
}
expected = []string{"Stat_1"}
- ev1 = &utils.CGREvent{
+ ev1 = &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event2",
Event: map[string]any{
@@ -180,7 +180,7 @@ func testV1FltrAddStats(t *testing.T) {
}
expected = []string{"Stat_2"}
- ev1 = &utils.CGREvent{
+ ev1 = &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event2",
Event: map[string]any{
@@ -197,7 +197,7 @@ func testV1FltrAddStats(t *testing.T) {
}
expected = []string{"Stat_2"}
- ev1 = &utils.CGREvent{
+ ev1 = &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event2",
Event: map[string]any{
@@ -214,7 +214,7 @@ func testV1FltrAddStats(t *testing.T) {
}
expected = []string{"Stat_3"}
- ev1 = &utils.CGREvent{
+ ev1 = &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event3",
Event: map[string]any{
@@ -231,7 +231,7 @@ func testV1FltrAddStats(t *testing.T) {
}
expected = []string{"Stat_1_1"}
- ev1 = &utils.CGREvent{
+ ev1 = &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event3",
Event: map[string]any{
@@ -249,7 +249,7 @@ func testV1FltrAddStats(t *testing.T) {
}
expected = []string{"Stat_1_1"}
- ev1 = &utils.CGREvent{
+ ev1 = &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event3",
Event: map[string]any{
@@ -334,7 +334,7 @@ func testV1FltrPopulateThreshold(t *testing.T) {
func testV1FltrGetThresholdForEvent(t *testing.T) {
// check the event
- tEv := &utils.CGREvent{
+ tEv := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -395,7 +395,7 @@ func testV1FltrGetThresholdForEvent2(t *testing.T) {
t.Error("Unexpected reply returned", result)
}
- tEv := &utils.CGREvent{
+ tEv := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -437,7 +437,7 @@ func testV1FltrPopulateResources(t *testing.T) {
}
// Allocate 3 units for resource ResTest
- argsRU := &utils.CGREvent{
+ argsRU := &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Event: map[string]any{
@@ -502,7 +502,7 @@ func testV1FltrPopulateResources(t *testing.T) {
}
// check the event
- tEv := &utils.CGREvent{
+ tEv := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -581,7 +581,7 @@ func testV1FltrPopulateResourcesAvailableUnits(t *testing.T) {
}
//Allocate 9 units for resource ResTest
- argsRU := &utils.CGREvent{
+ argsRU := &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Event: map[string]any{
@@ -650,7 +650,7 @@ func testV1FltrPopulateResourcesAvailableUnits(t *testing.T) {
}
//here will check the event
- statsEv := &utils.CGREvent{
+ statsEv := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event_nr2",
Event: map[string]any{
@@ -770,7 +770,7 @@ func testV1FltrAccounts(t *testing.T) {
t.Errorf("Expecting: %+v, received: %+v", tPrfl.ThresholdProfile, rcvTh)
}
- tEv := &utils.CGREvent{
+ tEv := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -856,7 +856,7 @@ func testV1FltrAccountsExistsDynamicaly(t *testing.T) {
t.Errorf("Expecting: %+v, received: %+v", tPrfl.ThresholdProfile, rcvTh)
}
- tEv := &utils.CGREvent{
+ tEv := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -869,7 +869,7 @@ func testV1FltrAccountsExistsDynamicaly(t *testing.T) {
t.Error("Unexpected reply returned", ids)
}
- tEv = &utils.CGREvent{
+ tEv = &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event2",
Event: map[string]any{
@@ -929,7 +929,7 @@ func testV1FltrChargerSuffix(t *testing.T) {
AttributeSProfiles: []string{"*constant:*req.Subject:intraState"},
AlteredFields: []string{utils.MetaReqRunID, "*req.Subject"},
- CGREvent: &utils.CGREvent{ // matching Charger1
+ CGREvent: &engine.CGREvent{ // matching Charger1
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -945,7 +945,7 @@ func testV1FltrChargerSuffix(t *testing.T) {
},
},
}
- cgrEv := &utils.CGREvent{
+ cgrEv := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -967,7 +967,7 @@ func testV1FltrChargerSuffix(t *testing.T) {
AttributeSProfiles: []string{"*constant:*req.Subject:interState"},
AlteredFields: []string{utils.MetaReqRunID, "*req.Subject"},
- CGREvent: &utils.CGREvent{ // matching Charger1
+ CGREvent: &engine.CGREvent{ // matching Charger1
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -983,7 +983,7 @@ func testV1FltrChargerSuffix(t *testing.T) {
},
},
}
- cgrEv = &utils.CGREvent{
+ cgrEv = &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
@@ -1029,7 +1029,7 @@ func testV1FltrAttributesPrefix(t *testing.T) {
AlteredFields: []string{"*req.CustomField"},
MatchedProfiles: []string{"cgrates.new:ATTR_1001"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.new",
ID: "event1",
Event: map[string]any{
@@ -1042,7 +1042,7 @@ func testV1FltrAttributesPrefix(t *testing.T) {
},
},
}
- cgrEv := &utils.CGREvent{
+ cgrEv := &engine.CGREvent{
Tenant: "cgrates.new",
ID: "event1",
Event: map[string]any{
@@ -1124,7 +1124,7 @@ func testV1FltrPopulateTimings(t *testing.T) {
t.Error("Unexpected reply returned", result)
}
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testV1FltrPopulateTimings",
Event: map[string]any{
@@ -1138,7 +1138,7 @@ func testV1FltrPopulateTimings(t *testing.T) {
eRply := &engine.AttrSProcessEventReply{
MatchedProfiles: []string{"cgrates.org:FltrTest"},
AlteredFields: []string{utils.MetaReq + utils.NestingSep + utils.AnswerTime},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testV1FltrPopulateTimings",
Event: map[string]any{
diff --git a/general_tests/fltr_sep_it_test.go b/general_tests/fltr_sep_it_test.go
index f25242355..ac02a4043 100644
--- a/general_tests/fltr_sep_it_test.go
+++ b/general_tests/fltr_sep_it_test.go
@@ -121,7 +121,7 @@ func testFltrSepLoadTarrifPlans(t *testing.T) {
}
func testFltrSepFilterSeparation(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "filter_separation_test",
Event: map[string]any{
diff --git a/general_tests/fraud_detection_it_test.go b/general_tests/fraud_detection_it_test.go
index 6f7e7b576..1cbda7df2 100644
--- a/general_tests/fraud_detection_it_test.go
+++ b/general_tests/fraud_detection_it_test.go
@@ -261,7 +261,7 @@ cgrates.org,THD_FRD,*gte:~*req.*tcc:2,,-1,1,0,false,0,ACT_FRD_STOP;ACT_FRD_LOG,t
func testFraudAuthorizeandProcess1(t *testing.T) {
originID := utils.GenUUID()
- cgrEv := &utils.CGREvent{
+ cgrEv := &engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.Tenant: "cgrates.org",
@@ -285,7 +285,7 @@ func testFraudAuthorizeandProcess1(t *testing.T) {
if err := fraudRPC.Call(context.Background(), utils.SessionSv1AuthorizeEvent, args, &rply); err != nil {
t.Error(err)
}
- cgrEv = &utils.CGREvent{
+ cgrEv = &engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.Tenant: "cgrates.org",
@@ -311,7 +311,7 @@ func testFraudAuthorizeandProcess1(t *testing.T) {
func testFraudAuthorizeandProcess2(t *testing.T) {
originID := utils.GenUUID()
- cgrEv := &utils.CGREvent{
+ cgrEv := &engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.Tenant: "cgrates.org",
@@ -335,7 +335,7 @@ func testFraudAuthorizeandProcess2(t *testing.T) {
if err := fraudRPC.Call(context.Background(), utils.SessionSv1AuthorizeEvent, args, &rply); err != nil {
t.Error(err)
}
- cgrEv = &utils.CGREvent{
+ cgrEv = &engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.Tenant: "cgrates.org",
@@ -361,7 +361,7 @@ func testFraudAuthorizeandProcess2(t *testing.T) {
func testFraudAuthorizeandProcess3(t *testing.T) {
originID := utils.GenUUID()
- cgrEv := &utils.CGREvent{
+ cgrEv := &engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.Tenant: "cgrates.org",
@@ -385,7 +385,7 @@ func testFraudAuthorizeandProcess3(t *testing.T) {
if err := fraudRPC.Call(context.Background(), utils.SessionSv1AuthorizeEvent, args, &rply); err != nil {
t.Error(err)
}
- cgrEv = &utils.CGREvent{
+ cgrEv = &engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.Tenant: "cgrates.org",
@@ -412,7 +412,7 @@ func testFraudAuthorizeandProcess3(t *testing.T) {
}
func testFraudFinalAuthorize(t *testing.T) {
- cgrEv := &utils.CGREvent{
+ cgrEv := &engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.Tenant: "cgrates.org",
diff --git a/general_tests/get_account_cost_it_test.go b/general_tests/get_account_cost_it_test.go
index f2ae44fc7..cf7a963fe 100644
--- a/general_tests/get_account_cost_it_test.go
+++ b/general_tests/get_account_cost_it_test.go
@@ -139,7 +139,7 @@ func TestGetAccountCost(t *testing.T) {
err := client.Call(context.Background(), utils.APIerSV1GetAccountCost,
&engine.ArgV1ProcessEvent{
Flags: []string{utils.MetaRALs},
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -177,11 +177,11 @@ func TestGetAccountCost(t *testing.T) {
t.Run("CheckAccountBalancesAfterGetAccountCost", checkAccountBalances(client))
t.Run("ProcessFirstCDR", func(t *testing.T) {
- var reply []*utils.EventWithFlags
+ var reply []*engine.EventWithFlags
err := client.Call(context.Background(), utils.CDRsV2ProcessEvent,
&engine.ArgV1ProcessEvent{
Flags: []string{utils.MetaRALs},
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
diff --git a/general_tests/gocs_it_test.go b/general_tests/gocs_it_test.go
index 6ebe02e31..95de14280 100644
--- a/general_tests/gocs_it_test.go
+++ b/general_tests/gocs_it_test.go
@@ -224,7 +224,7 @@ func testGOCSAuthSession(t *testing.T) {
authUsage := 5 * time.Minute
args := &sessions.V1AuthorizeArgs{
GetMaxUsage: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSSv1ItAuth",
Event: map[string]any{
@@ -254,7 +254,7 @@ func testGOCSInitSession(t *testing.T) {
initUsage := 5 * time.Minute
args := &sessions.V1InitSessionArgs{
InitSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSSv1ItInitiateSession",
Event: map[string]any{
@@ -319,7 +319,7 @@ func testGOCSUpdateSession(t *testing.T) {
reqUsage := 5 * time.Minute
args := &sessions.V1UpdateSessionArgs{
UpdateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSSv1ItUpdateSession",
Event: map[string]any{
@@ -396,7 +396,7 @@ func testGOCSUpdateSession2(t *testing.T) {
reqUsage := 5 * time.Minute
args := &sessions.V1UpdateSessionArgs{
UpdateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSSv1ItUpdateSession2",
Event: map[string]any{
@@ -467,7 +467,7 @@ func testGOCSUpdateSession2(t *testing.T) {
func testGOCSTerminateSession(t *testing.T) {
args := &sessions.V1TerminateSessionArgs{
TerminateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testGOCSTerminateSession",
Event: map[string]any{
@@ -521,7 +521,7 @@ func testGOCSTerminateSession(t *testing.T) {
}
func testGOCSProcessCDR(t *testing.T) {
- args := &utils.CGREvent{
+ args := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSSv1ItProcessCDR",
diff --git a/general_tests/kafka_ssl_it_test.go b/general_tests/kafka_ssl_it_test.go
index 00436847b..809e89435 100644
--- a/general_tests/kafka_ssl_it_test.go
+++ b/general_tests/kafka_ssl_it_test.go
@@ -114,7 +114,7 @@ func testKafkaSSLRPCConn(t *testing.T) {
func testKafkaSSLExportEvent(t *testing.T) {
event := &engine.CGREventWithEeIDs{
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "KafkaEvent",
Event: map[string]interface{}{
diff --git a/general_tests/rerate_cdrs_it_test.go b/general_tests/rerate_cdrs_it_test.go
index c8b166392..d246d1dee 100644
--- a/general_tests/rerate_cdrs_it_test.go
+++ b/general_tests/rerate_cdrs_it_test.go
@@ -106,7 +106,7 @@ func TestRerateCDRs(t *testing.T) {
err := client.Call(context.Background(), utils.CDRsV1ProcessEvent,
&engine.ArgV1ProcessEvent{
Flags: []string{utils.MetaRALs},
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -183,7 +183,7 @@ func TestRerateCDRs(t *testing.T) {
err := client.Call(context.Background(), utils.CDRsV1ProcessEvent,
&engine.ArgV1ProcessEvent{
Flags: []string{utils.MetaRALs},
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
ID: "event2",
Event: map[string]any{
diff --git a/general_tests/rerate_ers_cdrs_it_test.go b/general_tests/rerate_ers_cdrs_it_test.go
index 74e22823e..b013d3955 100644
--- a/general_tests/rerate_ers_cdrs_it_test.go
+++ b/general_tests/rerate_ers_cdrs_it_test.go
@@ -41,7 +41,7 @@ var (
rrErsCdrsRPC *birpc.Client
rrErsCdrsDelay int
rrErsCdrsUUID = "38e4d9f4-577f-4260-a7a5-bae8cd5417de"
- cdrEvent *utils.CGREvent
+ cdrEvent *engine.CGREvent
rrErsCdrsTests = []func(t *testing.T){
testRerateCDRsERsCreateFolders,
@@ -191,7 +191,7 @@ func testRerateCDRsERsGetAccountAfterBalanceSet(t *testing.T) {
func testRerateCDRsERsProcessEventCDR1(t *testing.T) {
argsEv := &engine.ArgV1ProcessEvent{
Flags: []string{utils.MetaRALs, "*export:false"},
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
diff --git a/general_tests/rerate_exp_it_test.go b/general_tests/rerate_exp_it_test.go
index af1c23d0d..8993f9cef 100644
--- a/general_tests/rerate_exp_it_test.go
+++ b/general_tests/rerate_exp_it_test.go
@@ -209,7 +209,7 @@ func testRerateExpGetAccountAfterBalanceSet(t *testing.T) {
func testRerateExpProcessEventCDR1(t *testing.T) {
argsEv := &engine.ArgV1ProcessEvent{
Flags: []string{utils.MetaRALs, utils.MetaExport},
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -286,7 +286,7 @@ func testRerateExpGetAccountAfterProcessEvent1(t *testing.T) {
func testRerateExpProcessEventCDR2(t *testing.T) {
argsEv := &engine.ArgV1ProcessEvent{
Flags: []string{utils.MetaRALs, utils.MetaExport},
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
ID: "event2",
Event: map[string]any{
@@ -362,7 +362,7 @@ func testRerateExpGetAccountAfterProcessEvent2(t *testing.T) {
func testRerateExpProcessEventCDR3(t *testing.T) {
argsEv := &engine.ArgV1ProcessEvent{
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
ID: "event3",
Event: map[string]any{
diff --git a/general_tests/resourcesv1_it_test.go b/general_tests/resourcesv1_it_test.go
index b359a6e99..c87709300 100644
--- a/general_tests/resourcesv1_it_test.go
+++ b/general_tests/resourcesv1_it_test.go
@@ -131,7 +131,7 @@ func testV1RsSetProfile(t *testing.T) {
}
func testV1RsAllocate(t *testing.T) {
- cgrEv := &utils.CGREvent{
+ cgrEv := &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Event: map[string]any{
@@ -151,7 +151,7 @@ func testV1RsAllocate(t *testing.T) {
t.Error("Unexpected reply returned", reply)
}
- cgrEv2 := &utils.CGREvent{
+ cgrEv2 := &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Event: map[string]any{
@@ -173,7 +173,7 @@ func testV1RsAllocate(t *testing.T) {
func testV1RsAuthorize(t *testing.T) {
var reply *engine.Resources
- args := &utils.CGREvent{
+ args := &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Event: map[string]any{
@@ -206,7 +206,7 @@ func testV1RsAuthorize(t *testing.T) {
}
var reply2 string
- cgrEv := &utils.CGREvent{
+ cgrEv := &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Event: map[string]any{
diff --git a/general_tests/route_it_test.go b/general_tests/route_it_test.go
index 2cc791d69..d5468c374 100644
--- a/general_tests/route_it_test.go
+++ b/general_tests/route_it_test.go
@@ -163,7 +163,7 @@ func testV1SplSSetRouteProfilesWithoutRatingPlanIDs(t *testing.T) {
} else if !reflect.DeepEqual(splPrf.RouteProfile, reply) {
t.Errorf("Expecting: %+v, received: %+v", splPrf.RouteProfile, reply)
}
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testV1SplSGetLeastCostSuppliers",
Event: map[string]any{
@@ -340,7 +340,7 @@ func testV1SplSAddNewResPrf(t *testing.T) {
func testV1SplSPopulateResUsage(t *testing.T) {
var reply string
- cgrEv := &utils.CGREvent{
+ cgrEv := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "Event1",
Event: map[string]any{
@@ -362,7 +362,7 @@ func testV1SplSPopulateResUsage(t *testing.T) {
t.Errorf("Expecting: %+v, received: %+v", eAllocationMsg, reply)
}
- cgrEv = &utils.CGREvent{
+ cgrEv = &engine.CGREvent{
Tenant: "cgrates.org",
ID: "Event2",
Event: map[string]any{
@@ -384,7 +384,7 @@ func testV1SplSPopulateResUsage(t *testing.T) {
t.Errorf("Expecting: %+v, received: %+v", eAllocationMsg, reply)
}
- cgrEv = &utils.CGREvent{
+ cgrEv = &engine.CGREvent{
Tenant: "cgrates.org",
ID: "Event3",
Event: map[string]any{
@@ -406,7 +406,7 @@ func testV1SplSPopulateResUsage(t *testing.T) {
t.Errorf("Expecting: %+v, received: %+v", eAllocationMsg, reply)
}
- cgrEv = &utils.CGREvent{
+ cgrEv = &engine.CGREvent{
Tenant: "cgrates.org",
ID: "Event4",
Event: map[string]any{
@@ -431,7 +431,7 @@ func testV1SplSPopulateResUsage(t *testing.T) {
}
func testV1SplSGetSortedRoutes(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testV1SplSGetSortedRoutes",
Event: map[string]any{
@@ -513,7 +513,7 @@ func testV1SplSAddNewRoutePrf2(t *testing.T) {
}
func testV1SplSGetSortedRoutes2(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testV1SplSGetSortedSuppliers2",
Event: map[string]any{
@@ -546,7 +546,7 @@ func testV1SplSPopulateStats(t *testing.T) {
// so we can check the metrics in Suppliers for *load strategy
var reply []string
expected := []string{"Stat_Supplier1"}
- ev1 := &utils.CGREvent{
+ ev1 := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -561,7 +561,7 @@ func testV1SplSPopulateStats(t *testing.T) {
}
expected = []string{"Stat_Supplier1"}
- ev1 = &utils.CGREvent{
+ ev1 = &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event2",
Event: map[string]any{
@@ -588,7 +588,7 @@ func testV1SplSPopulateStats(t *testing.T) {
}
expected = []string{"Stat_Supplier2"}
- ev1 = &utils.CGREvent{
+ ev1 = &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event3",
Event: map[string]any{
@@ -603,7 +603,7 @@ func testV1SplSPopulateStats(t *testing.T) {
}
expected = []string{"Stat_Supplier2"}
- ev1 = &utils.CGREvent{
+ ev1 = &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event4",
Event: map[string]any{
@@ -626,7 +626,7 @@ func testV1SplSPopulateStats(t *testing.T) {
}
expected = []string{"Stat_Supplier3"}
- ev1 = &utils.CGREvent{
+ ev1 = &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event5",
Event: map[string]any{
@@ -641,7 +641,7 @@ func testV1SplSPopulateStats(t *testing.T) {
}
expected = []string{"Stat_Supplier3"}
- ev1 = &utils.CGREvent{
+ ev1 = &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event6",
Event: map[string]any{
@@ -656,7 +656,7 @@ func testV1SplSPopulateStats(t *testing.T) {
}
expected = []string{"Stat_Supplier3"}
- ev1 = &utils.CGREvent{
+ ev1 = &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event7",
Event: map[string]any{
@@ -684,7 +684,7 @@ func testV1SplSPopulateStats(t *testing.T) {
}
func testV1SplSGetSoredRoutesWithLoad(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testV1SplSGetSoredSuppliersWithLoad",
Event: map[string]any{
diff --git a/general_tests/routes_cases_it_test.go b/general_tests/routes_cases_it_test.go
index a002e7afe..aa203d977 100644
--- a/general_tests/routes_cases_it_test.go
+++ b/general_tests/routes_cases_it_test.go
@@ -395,7 +395,7 @@ func testV1RtsCaseGetRoutesAfterLoading(t *testing.T) {
}
func testV1RtsCasesSortingRoutesWeightAccountValue(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
ID: "WEIGHT_SORT",
Tenant: "cgrates.org",
Event: map[string]any{
@@ -432,7 +432,7 @@ func testV1RtsCasesSortingRoutesWeightAccountValue(t *testing.T) {
}
func testV1RtsCasesSortingRoutesWeightAllRoutes(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
ID: "WEIGHT_SORT",
Tenant: "cgrates.org",
Event: map[string]any{
@@ -500,7 +500,7 @@ func testV1RtsCasesSortingRoutesWeightNotMatchingValue(t *testing.T) {
t.Errorf("Unexpected result returned")
}
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
ID: "WEIGHT_SORT",
Tenant: "cgrates.org",
Event: map[string]any{
@@ -544,7 +544,7 @@ func testV1RtsCasesSortingRoutesWeightNotMatchingValue(t *testing.T) {
}
func testV1RtsCasesSortingRoutesLowestCost(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
ID: "LC_SORT",
Tenant: "cgrates.org",
Event: map[string]any{
@@ -590,7 +590,7 @@ func testV1RtsCasesSortingRoutesLowestCost(t *testing.T) {
func testV1RtsCasesSortingRoutesLowestCostDefaultUsage(t *testing.T) {
// default usage given by routes is 1m
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
ID: "LC_SORT",
Tenant: "cgrates.org",
Event: map[string]any{
@@ -644,7 +644,7 @@ func testV1RtsCasesSortingRoutesLowestCostDefaultUsage(t *testing.T) {
func testV1RtsCasesSortingRoutesLCSetStatsAndResForMatching(t *testing.T) {
//not gonna match our vendor1 filter because 6 > 5
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Event: map[string]any{
@@ -666,7 +666,7 @@ func testV1RtsCasesSortingRoutesLCSetStatsAndResForMatching(t *testing.T) {
//gonna match one stats for matching vendor 2 acd filter
var result []string
expected := []string{"STATS_VENDOR_2", "STATS_TCC1"}
- ev1 := &utils.CGREvent{
+ ev1 := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -690,7 +690,7 @@ func testV1RtsCasesSortingRoutesLCSetStatsAndResForMatching(t *testing.T) {
func testV1RtsCasesSortingRoutesLowestCostStats(t *testing.T) {
//not gonna match vendor1 because of its TotalUsage by allocating resources
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
ID: "LC_SORT",
Tenant: "cgrates.org",
Event: map[string]any{
@@ -745,7 +745,7 @@ func testV1RtsCasesSortingRoutesLowestCostStats(t *testing.T) {
func testV1RtsCasesSortingRoutesLowestCosMatchingAllRoutes(t *testing.T) {
// deallocate resources for matching vendor1
- evRes := &utils.CGREvent{
+ evRes := &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Event: map[string]any{
@@ -764,7 +764,7 @@ func testV1RtsCasesSortingRoutesLowestCosMatchingAllRoutes(t *testing.T) {
t.Errorf("Unexpected result returned: %s", result)
}
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
ID: "LC_SORT",
Tenant: "cgrates.org",
Event: map[string]any{
@@ -825,7 +825,7 @@ func testV1RtsCasesSortingRoutesLowestCosMatchingAllRoutes(t *testing.T) {
}
func testV1RtsCasesSortingRoutesLowestCosMaxCost(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
ID: "LC_SORT",
Tenant: "cgrates.org",
Event: map[string]any{
@@ -881,7 +881,7 @@ func testV1RtsCasesSortingRoutesLowestCosMaxCost(t *testing.T) {
}
func testV1RtsCasesSortingRoutesLowestCosMaxCostNotMatch(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
ID: "LC_SORT",
Tenant: "cgrates.org",
Event: map[string]any{
@@ -906,7 +906,7 @@ func testV1RtsCasesSortingRoutesProcessMetrics(t *testing.T) {
//we will process this stats 2 times
//Vendor2
expected := []string{"STATS_TCC1", "STATS_VENDOR_2"}
- ev1 := &utils.CGREvent{
+ ev1 := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -939,7 +939,7 @@ func testV1RtsCasesSortingRoutesProcessMetrics(t *testing.T) {
//Vendor1
expected = []string{"STATS_TCC1", "STATS_VENDOR_1"}
- ev1 = &utils.CGREvent{
+ ev1 = &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -972,7 +972,7 @@ func testV1RtsCasesSortingRoutesProcessMetrics(t *testing.T) {
func testV1RtsCasesSortingRoutesQOS(t *testing.T) {
//not gonna match vendor3 because *tcc is not bigger that 6
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
ID: "LC_SORT",
Tenant: "cgrates.org",
Event: map[string]any{
@@ -1025,7 +1025,7 @@ func testV1RtsCasesSortingRoutesQOS(t *testing.T) {
func testV1RtsCasesSortingRoutesQOSAllRoutes(t *testing.T) {
// process *tcc metric for matching vendor3
- ev1 := &utils.CGREvent{
+ ev1 := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -1042,7 +1042,7 @@ func testV1RtsCasesSortingRoutesQOSAllRoutes(t *testing.T) {
}
// match all 3 routes
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
ID: "LC_SORT",
Tenant: "cgrates.org",
Event: map[string]any{
@@ -1105,7 +1105,7 @@ func testV1RtsCasesSortingRoutesQOSAllRoutes(t *testing.T) {
}
func testV1RtsCasesSortingRoutesQOSNotFound(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
ID: "LC_SORT",
Tenant: "cgrates.org",
Event: map[string]any{
@@ -1124,7 +1124,7 @@ func testV1RtsCasesSortingRoutesQOSNotFound(t *testing.T) {
}
func testV1RtsCasesSortingRoutesAllocateResources(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Event: map[string]any{
@@ -1143,7 +1143,7 @@ func testV1RtsCasesSortingRoutesAllocateResources(t *testing.T) {
t.Errorf("Unexpected reply returned: %s", reply)
}
- ev = &utils.CGREvent{
+ ev = &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Event: map[string]any{
@@ -1163,7 +1163,7 @@ func testV1RtsCasesSortingRoutesAllocateResources(t *testing.T) {
}
func testV1RtsCasesSortingRoutesReasNotAllRoutes(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
ID: "LC_SORT",
Tenant: "cgrates.org",
Event: map[string]any{
@@ -1203,7 +1203,7 @@ func testV1RtsCasesSortingRoutesReasNotAllRoutes(t *testing.T) {
}
func testV1RtsCasesSortingRoutesReasAllRoutes(t *testing.T) {
- evRs := &utils.CGREvent{
+ evRs := &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Event: map[string]any{
@@ -1222,7 +1222,7 @@ func testV1RtsCasesSortingRoutesReasAllRoutes(t *testing.T) {
t.Errorf("Unexpected reply returned: %s", replyStr)
}
//allocate more resources for matching
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
ID: "LC_SORT",
Tenant: "cgrates.org",
Event: map[string]any{
@@ -1272,7 +1272,7 @@ func testV1RtsCasesRoutesProcessStatsForLoadRtsSorting(t *testing.T) {
// "STATS_VENDOR_1"
var reply []string
expected := []string{"STATS_VENDOR_1", "STATS_TCC1"}
- ev1 := &utils.CGREvent{
+ ev1 := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -1295,7 +1295,7 @@ func testV1RtsCasesRoutesProcessStatsForLoadRtsSorting(t *testing.T) {
}
}
// different usage for *distinct metric
- ev1 = &utils.CGREvent{
+ ev1 = &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -1320,7 +1320,7 @@ func testV1RtsCasesRoutesProcessStatsForLoadRtsSorting(t *testing.T) {
// "STATS_VENDOR_2"
expected = []string{"STATS_VENDOR_2", "STATS_TCC1"}
- ev1 = &utils.CGREvent{
+ ev1 = &engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -1343,7 +1343,7 @@ func testV1RtsCasesRoutesProcessStatsForLoadRtsSorting(t *testing.T) {
}
func testV1RtsCasesRoutesLoadRtsSorting(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
ID: "LC_SORT",
Tenant: "cgrates.org",
Event: map[string]any{
@@ -1393,7 +1393,7 @@ func testV1RtsCasesRoutesLoadRtsSorting(t *testing.T) {
}
func testV1RtsCasesSortRoutesHigherCostV2V3(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
ID: "LC_SORT",
Tenant: "cgrates.org",
Event: map[string]any{
@@ -1442,7 +1442,7 @@ func testV1RtsCasesSortRoutesHigherCostAllocateRes(t *testing.T) {
// to match route 1, RES_GRP2 must have *gte available 6 resources
// first we have to remove them
var result string
- evRs := &utils.CGREvent{
+ evRs := &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Event: map[string]any{
@@ -1460,7 +1460,7 @@ func testV1RtsCasesSortRoutesHigherCostAllocateRes(t *testing.T) {
t.Errorf("Unexpected result returned: %s", result)
}
- evRs = &utils.CGREvent{
+ evRs = &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Event: map[string]any{
@@ -1478,7 +1478,7 @@ func testV1RtsCasesSortRoutesHigherCostAllocateRes(t *testing.T) {
t.Errorf("Unexpected result returned: %s", result)
}
- evRs = &utils.CGREvent{
+ evRs = &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Event: map[string]any{
@@ -1497,7 +1497,7 @@ func testV1RtsCasesSortRoutesHigherCostAllocateRes(t *testing.T) {
}
// also, to not match route2, totalUsage of RES_GRP1 must be lower than 9
- evRs = &utils.CGREvent{
+ evRs = &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Event: map[string]any{
@@ -1517,7 +1517,7 @@ func testV1RtsCasesSortRoutesHigherCostAllocateRes(t *testing.T) {
}
func testV1RtsCasesSortRoutesHigherCostV1V3(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
ID: "LC_SORT",
Tenant: "cgrates.org",
Event: map[string]any{
@@ -1564,7 +1564,7 @@ func testV1RtsCasesSortRoutesHigherCostV1V3(t *testing.T) {
func testV1RtsCasesSortRoutesHigherCostAllRoutes(t *testing.T) {
//allocate for matching all routes
- evRs := &utils.CGREvent{
+ evRs := &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Event: map[string]any{
@@ -1581,7 +1581,7 @@ func testV1RtsCasesSortRoutesHigherCostAllRoutes(t *testing.T) {
} else if result != "RES_GRP1" {
t.Errorf("Unexpected result returned: %s", result)
}
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
ID: "LC_SORT",
Tenant: "cgrates.org",
Event: map[string]any{
diff --git a/general_tests/rpccaching_it_test.go b/general_tests/rpccaching_it_test.go
index a08c714a7..7c4417328 100644
--- a/general_tests/rpccaching_it_test.go
+++ b/general_tests/rpccaching_it_test.go
@@ -204,7 +204,7 @@ func testRPCMethodsAuthorizeSession(t *testing.T) {
authUsage := 5 * time.Minute
args := &sessions.V1AuthorizeArgs{
GetMaxUsage: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testRPCMethodsAuthorizeSession",
Event: map[string]any{
@@ -231,7 +231,7 @@ func testRPCMethodsAuthorizeSession(t *testing.T) {
//disable the account
var ids []string
- thEvent := &utils.CGREvent{
+ thEvent := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "DisableAccount",
Event: map[string]any{
@@ -276,7 +276,7 @@ func testRPCMethodsAuthorizeSession(t *testing.T) {
}
//enable the account
- thEvent = &utils.CGREvent{
+ thEvent = &engine.CGREvent{
Tenant: "cgrates.org",
ID: "EnableAccount",
Event: map[string]any{
@@ -296,7 +296,7 @@ func testRPCMethodsInitSession(t *testing.T) {
initUsage := 5 * time.Minute
args := &sessions.V1InitSessionArgs{
InitSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testRPCMethodsInitSession",
Event: map[string]any{
@@ -324,7 +324,7 @@ func testRPCMethodsInitSession(t *testing.T) {
//disable the account
var ids []string
- thEvent := &utils.CGREvent{
+ thEvent := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "DisableAccount",
Event: map[string]any{
@@ -370,7 +370,7 @@ func testRPCMethodsInitSession(t *testing.T) {
}
//enable the account
- thEvent = &utils.CGREvent{
+ thEvent = &engine.CGREvent{
Tenant: "cgrates.org",
ID: "EnableAccount",
Event: map[string]any{
@@ -390,7 +390,7 @@ func testRPCMethodsUpdateSession(t *testing.T) {
reqUsage := 5 * time.Minute
args := &sessions.V1UpdateSessionArgs{
UpdateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testRPCMethodsUpdateSession",
Event: map[string]any{
@@ -418,7 +418,7 @@ func testRPCMethodsUpdateSession(t *testing.T) {
//disable the account
var ids []string
- thEvent := &utils.CGREvent{
+ thEvent := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "DisableAccount",
Event: map[string]any{
@@ -463,7 +463,7 @@ func testRPCMethodsUpdateSession(t *testing.T) {
}
//enable the account
- thEvent = &utils.CGREvent{
+ thEvent = &engine.CGREvent{
Tenant: "cgrates.org",
ID: "EnableAccount",
Event: map[string]any{
@@ -482,7 +482,7 @@ func testRPCMethodsUpdateSession(t *testing.T) {
func testRPCMethodsTerminateSession(t *testing.T) {
args := &sessions.V1TerminateSessionArgs{
TerminateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testRPCMethodsTerminateSession",
Event: map[string]any{
@@ -528,7 +528,7 @@ func testRPCMethodsTerminateSession(t *testing.T) {
}
func testRPCMethodsProcessCDR(t *testing.T) {
- args := &utils.CGREvent{
+ args := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testRPCMethodsProcessCDR",
Event: map[string]any{
@@ -601,7 +601,7 @@ func testRPCMethodsProcessEvent(t *testing.T) {
initUsage := 5 * time.Minute
args := &sessions.V1ProcessMessageArgs{
Debit: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testRPCMethodsProcessEvent",
Event: map[string]any{
@@ -628,7 +628,7 @@ func testRPCMethodsProcessEvent(t *testing.T) {
//disable the account
var ids []string
- thEvent := &utils.CGREvent{
+ thEvent := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "DisableAccount",
Event: map[string]any{
@@ -674,7 +674,7 @@ func testRPCMethodsProcessEvent(t *testing.T) {
}
//enable the account
- thEvent = &utils.CGREvent{
+ thEvent = &engine.CGREvent{
Tenant: "cgrates.org",
ID: "EnableAccount",
Event: map[string]any{
@@ -692,7 +692,7 @@ func testRPCMethodsProcessEvent(t *testing.T) {
func testRPCMethodsCdrsProcessCDR(t *testing.T) {
args := &engine.ArgV1ProcessEvent{
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
ID: "testRPCMethodsCdrsProcessCDR",
Event: map[string]any{
diff --git a/general_tests/rpsubj_set_it_test.go b/general_tests/rpsubj_set_it_test.go
index 8afe68646..59b7ad329 100644
--- a/general_tests/rpsubj_set_it_test.go
+++ b/general_tests/rpsubj_set_it_test.go
@@ -112,11 +112,11 @@ cgrates.org,data,RPF_DATA,2022-01-14T00:00:00Z,RP_DATA,`,
})
t.Run("ProcessCDR", func(t *testing.T) {
- var reply []*utils.EventWithFlags
+ var reply []*engine.EventWithFlags
if err := client.Call(context.Background(), utils.CDRsV2ProcessEvent,
&engine.ArgV1ProcessEvent{
Flags: []string{utils.MetaRALs},
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -247,11 +247,11 @@ cgrates.org,data,1001,2022-01-14T00:00:00Z,RP_DATA,`,
})
t.Run("ProcessCDR", func(t *testing.T) {
- var reply []*utils.EventWithFlags
+ var reply []*engine.EventWithFlags
if err := client.Call(context.Background(), utils.CDRsV2ProcessEvent,
&engine.ArgV1ProcessEvent{
Flags: []string{utils.MetaRALs},
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
diff --git a/general_tests/session2_it_test.go b/general_tests/session2_it_test.go
index da52de941..d86b9adeb 100644
--- a/general_tests/session2_it_test.go
+++ b/general_tests/session2_it_test.go
@@ -137,7 +137,7 @@ func testSes2ItInitSession(t *testing.T) {
// Init session
initArgs := &sessions.V1InitSessionArgs{
InitSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Event: map[string]any{
@@ -190,7 +190,7 @@ func testSes2StirAuthenticate(t *testing.T) {
args := &sessions.V1ProcessEventArgs{
Flags: []string{utils.MetaSTIRAuthenticate},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testSes2StirAuthorize",
Event: map[string]any{
@@ -231,7 +231,7 @@ func testSes2StirInit(t *testing.T) {
args := &sessions.V1ProcessEventArgs{
Flags: []string{utils.MetaSTIRInitiate},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testSes2StirInit",
Event: map[string]any{
diff --git a/general_tests/session3_it_test.go b/general_tests/session3_it_test.go
index 2ddacfe3d..cd37174ca 100644
--- a/general_tests/session3_it_test.go
+++ b/general_tests/session3_it_test.go
@@ -132,7 +132,7 @@ func testSes3ItProcessEvent(t *testing.T) {
GetAttributes: true,
ProcessThresholds: true,
ProcessStats: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSSv1ItProcessEvent",
Event: map[string]any{
@@ -168,7 +168,7 @@ func testSes3ItProcessEvent(t *testing.T) {
MatchedProfiles: []string{"cgrates.org:ATTR_ACNT_1001"},
AlteredFields: []string{"*req.OfficeGroup"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSSv1ItProcessEvent",
Event: map[string]any{
@@ -305,7 +305,7 @@ func testSes3ItTerminatWithoutInit(t *testing.T) {
// because it needs to call initSession when the call for Teminate is still active
args := &sessions.V1TerminateSessionArgs{
TerminateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSesItUpdateSession",
Event: map[string]any{
@@ -336,7 +336,7 @@ func testSes3ItTerminatWithoutInit(t *testing.T) {
time.Sleep(time.Millisecond)
args1 := &sessions.V1InitSessionArgs{
InitSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSesItInitiateSession",
Event: map[string]any{
@@ -386,7 +386,7 @@ func testSes3ItBalance(t *testing.T) {
func testSes3ItCDRs(t *testing.T) {
var reply string
- if err := ses3RPC.Call(context.Background(), utils.SessionSv1ProcessCDR, &utils.CGREvent{
+ if err := ses3RPC.Call(context.Background(), utils.SessionSv1ProcessCDR, &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSesItProccesCDR",
Event: map[string]any{
diff --git a/general_tests/session4_it_test.go b/general_tests/session4_it_test.go
index f66e3dfde..37b9e044b 100644
--- a/general_tests/session4_it_test.go
+++ b/general_tests/session4_it_test.go
@@ -131,7 +131,7 @@ func testSes4CDRsProcessCDR(t *testing.T) {
// will make the BalanceInfo nil and result in a panic
args := &engine.ArgV1ProcessEvent{
Flags: []string{utils.MetaRALs, utils.MetaStore, "*routes:false"},
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.OriginID: "testV2CDRsProcessCDR1",
diff --git a/general_tests/session_graceful_shutdown_it_test.go b/general_tests/session_graceful_shutdown_it_test.go
index b9d3af41d..1472bb1ee 100644
--- a/general_tests/session_graceful_shutdown_it_test.go
+++ b/general_tests/session_graceful_shutdown_it_test.go
@@ -176,7 +176,7 @@ func testSessionSRplcApierSetChargerS(t *testing.T) {
func testSessionSRplcApierGetInitateSessions(t *testing.T) {
args := &sessions.V1InitSessionArgs{
InitSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSSv1ItInitiateSession",
Event: map[string]any{
diff --git a/general_tests/session_it_test.go b/general_tests/session_it_test.go
index 936e486a2..502e03a83 100644
--- a/general_tests/session_it_test.go
+++ b/general_tests/session_it_test.go
@@ -153,7 +153,7 @@ func testSesItAddVoiceBalance(t *testing.T) {
func testSesItInitSession(t *testing.T) {
args1 := &sessions.V1InitSessionArgs{
InitSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: sesTenant,
ID: "TestSesItInitiateSession",
Event: map[string]any{
@@ -185,7 +185,7 @@ func testSesItInitSession(t *testing.T) {
func testSesItTerminateSession(t *testing.T) {
args := &sessions.V1TerminateSessionArgs{
TerminateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: sesTenant,
ID: "TestSesItUpdateSession",
Event: map[string]any{
diff --git a/general_tests/session_money_rating_subject_it_test.go b/general_tests/session_money_rating_subject_it_test.go
index 79195a8d1..c812257a3 100644
--- a/general_tests/session_money_rating_subject_it_test.go
+++ b/general_tests/session_money_rating_subject_it_test.go
@@ -41,7 +41,7 @@ var (
sesMRSAccount = "refundAcc"
sesMRSTenant = "cgrates.org"
- sesMRSCgrEv = &utils.CGREvent{
+ sesMRSCgrEv = &engine.CGREvent{
Tenant: sesMRSTenant,
Event: map[string]any{
utils.Tenant: sesMRSTenant,
diff --git a/general_tests/session_nonereq_it_test.go b/general_tests/session_nonereq_it_test.go
index 8be52e971..765832832 100644
--- a/general_tests/session_nonereq_it_test.go
+++ b/general_tests/session_nonereq_it_test.go
@@ -128,7 +128,7 @@ func testSesNoneReqTypeItAddChargerS(t *testing.T) {
func testSesNoneReqTypeItInit(t *testing.T) {
args1 := &sessions.V1InitSessionArgs{
InitSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.CGRID: "cgrID",
diff --git a/general_tests/session_refund_expired_it_test.go b/general_tests/session_refund_expired_it_test.go
index 2adfb7417..cedf42fb3 100644
--- a/general_tests/session_refund_expired_it_test.go
+++ b/general_tests/session_refund_expired_it_test.go
@@ -41,7 +41,7 @@ var (
sesExpAccount = "refundAcc"
sesExpTenant = "cgrates.org"
- sesExpCgrEv = &utils.CGREvent{
+ sesExpCgrEv = &engine.CGREvent{
Tenant: sesExpTenant,
Event: map[string]any{
utils.Tenant: sesExpTenant,
diff --git a/general_tests/session_replications_automaticdebit_it_test.go b/general_tests/session_replications_automaticdebit_it_test.go
index 70bb83d5d..9c82112be 100644
--- a/general_tests/session_replications_automaticdebit_it_test.go
+++ b/general_tests/session_replications_automaticdebit_it_test.go
@@ -176,7 +176,7 @@ func testSessionSRplInitiate(t *testing.T) {
argsInit := &sessions.V1InitSessionArgs{
InitSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionSRplInitiate",
Event: map[string]any{
@@ -355,7 +355,7 @@ func testSessionSRplCheckAccount(t *testing.T) {
func testSessionSRplTerminate(t *testing.T) {
args := &sessions.V1TerminateSessionArgs{
TerminateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionSRplTerminate",
Event: map[string]any{
diff --git a/general_tests/session_rounding_it_test.go b/general_tests/session_rounding_it_test.go
index f52c353db..18bf8a5d9 100644
--- a/general_tests/session_rounding_it_test.go
+++ b/general_tests/session_rounding_it_test.go
@@ -46,7 +46,7 @@ var (
sesRndExpMaxUsage time.Duration
sesRndExpBalanceValue float64
- sesRndCgrEv = &utils.CGREvent{
+ sesRndCgrEv = &engine.CGREvent{
Tenant: sesRndTenant,
Event: map[string]any{
utils.Tenant: sesRndTenant,
diff --git a/general_tests/sessionpause_it_test.go b/general_tests/sessionpause_it_test.go
index 3c5ed6361..336f6efdc 100644
--- a/general_tests/sessionpause_it_test.go
+++ b/general_tests/sessionpause_it_test.go
@@ -122,7 +122,7 @@ func testSesPauseItLoadFromFolder(t *testing.T) {
func testSesPauseItInitSession(t *testing.T, cgrID string, chargeable bool, usage time.Duration) {
args1 := &sessions.V1InitSessionArgs{
InitSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.CGRID: cgrID,
@@ -156,7 +156,7 @@ func testSesPauseItInitSession(t *testing.T, cgrID string, chargeable bool, usag
func testSesPauseItUpdateSession(t *testing.T, cgrID string, chargeable bool, usage time.Duration) {
updtArgs := &sessions.V1UpdateSessionArgs{
UpdateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.CGRID: cgrID,
@@ -189,7 +189,7 @@ func testSesPauseItUpdateSession(t *testing.T, cgrID string, chargeable bool, us
func testSesPauseItTerminateSession(t *testing.T, cgrID string, chargeable bool, usage time.Duration) {
args := &sessions.V1TerminateSessionArgs{
TerminateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.CGRID: cgrID,
@@ -217,7 +217,7 @@ func testSesPauseItTerminateSession(t *testing.T, cgrID string, chargeable bool,
if rply != utils.OK {
t.Errorf("Unexpected reply: %s", rply)
}
- if err := sesPauseRPC.Call(context.Background(), utils.SessionSv1ProcessCDR, &utils.CGREvent{
+ if err := sesPauseRPC.Call(context.Background(), utils.SessionSv1ProcessCDR, &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testSesPauseItProccesCDR",
Event: map[string]any{
diff --git a/general_tests/sessionrefund_it_test.go b/general_tests/sessionrefund_it_test.go
index ac6484dc7..1e999cf0b 100644
--- a/general_tests/sessionrefund_it_test.go
+++ b/general_tests/sessionrefund_it_test.go
@@ -158,7 +158,7 @@ func testSrItInitSession(t *testing.T) {
args1 := &sessions.V1InitSessionArgs{
InitSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: srtenant,
ID: "TestSrItInitiateSession",
Event: map[string]any{
@@ -192,7 +192,7 @@ func testSrItInitSession(t *testing.T) {
func testSrItTerminateSession(t *testing.T) {
args := &sessions.V1TerminateSessionArgs{
TerminateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: srtenant,
ID: "TestSrItUpdateSession",
Event: map[string]any{
@@ -252,7 +252,7 @@ func testSrItInitSession2(t *testing.T) {
args1 := &sessions.V1InitSessionArgs{
InitSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: srtenant,
ID: "TestSrItInitiateSession1",
Event: map[string]any{
@@ -285,7 +285,7 @@ func testSrItTerminateSession2(t *testing.T) {
args := &sessions.V1TerminateSessionArgs{
TerminateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: srtenant,
ID: "TestSrItUpdateSession",
Event: map[string]any{
diff --git a/general_tests/sessionroutes_it_test.go b/general_tests/sessionroutes_it_test.go
index 518f19403..40ddd1f73 100644
--- a/general_tests/sessionroutes_it_test.go
+++ b/general_tests/sessionroutes_it_test.go
@@ -118,7 +118,7 @@ func testSesRoutesItLoadFromFolder(t *testing.T) {
}
func testSesRoutesAuthorizeEvent(t *testing.T) {
- cgrEv := &utils.CGREvent{
+ cgrEv := &engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.Source: "testV4CDRsProcessCDR",
@@ -249,7 +249,7 @@ func testSesRoutesAuthorizeEvent(t *testing.T) {
}
func testSesRoutesProcessMessage(t *testing.T) {
- cgrEv := &utils.CGREvent{
+ cgrEv := &engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.Source: "testV4CDRsProcessCDR",
@@ -384,7 +384,7 @@ func testSesRoutesProcessMessage(t *testing.T) {
}
func testSesRoutesProcessEvent(t *testing.T) {
- cgrEv := &utils.CGREvent{
+ cgrEv := &engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.Source: "testV4CDRsProcessCDR",
diff --git a/general_tests/sessions_benchmark_it_test.go b/general_tests/sessions_benchmark_it_test.go
index ce7b41df0..ec26f4407 100644
--- a/general_tests/sessions_benchmark_it_test.go
+++ b/general_tests/sessions_benchmark_it_test.go
@@ -168,7 +168,7 @@ func initSes(n int) (err error) {
initArgs := &sessions.V1InitSessionArgs{
InitSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Event: map[string]any{
diff --git a/general_tests/sessions_concur_test.go b/general_tests/sessions_concur_test.go
index e9283d17a..23a66d98c 100644
--- a/general_tests/sessions_concur_test.go
+++ b/general_tests/sessions_concur_test.go
@@ -229,7 +229,7 @@ package general_tests
// authDur := 5 * time.Minute
// authArgs := &sessions.V1AuthorizeArgs{
// GetMaxUsage: true,
-// CGREvent: &utils.CGREvent{
+// CGREvent: &engine.CGREvent{
// Tenant: "cgrates.org",
// ID: fmt.Sprintf("TestSCncrAuth%s", originID),
// Event: map[string]any{
@@ -255,7 +255,7 @@ package general_tests
// initArgs := &sessions.V1InitSessionArgs{
// InitSession: true,
// GetAttributes: true,
-// CGREvent: &utils.CGREvent{
+// CGREvent: &engine.CGREvent{
// Tenant: "cgrates.org",
// ID: fmt.Sprintf("TestSCncrInit%s", originID),
// Event: map[string]any{
@@ -285,7 +285,7 @@ package general_tests
// updtArgs := &sessions.V1UpdateSessionArgs{
// GetAttributes: true,
// UpdateSession: true,
-// CGREvent: &utils.CGREvent{
+// CGREvent: &engine.CGREvent{
// Tenant: "cgrates.org",
// ID: fmt.Sprintf("TestSCncrUpdate%s", originID),
// Event: map[string]any{
@@ -308,7 +308,7 @@ package general_tests
// // Terminate the session
// trmntArgs := &sessions.V1TerminateSessionArgs{
// TerminateSession: true,
-// CGREvent: &utils.CGREvent{
+// CGREvent: &engine.CGREvent{
// Tenant: "cgrates.org",
// ID: fmt.Sprintf("TestSCncrTerminate%s", originID),
// Event: map[string]any{
@@ -328,8 +328,8 @@ package general_tests
// utils.RandomInteger(0, 100)) * time.Millisecond)
// // processCDR
-// argsCDR := &utils.CGREventWithOpts{
-// CGREvent: &utils.CGREvent{
+// argsCDR := &engine.CGREventWithOpts{
+// CGREvent: &engine.CGREvent{
// Tenant: "cgrates.org",
// ID: fmt.Sprintf("TestSCncrCDR%s", originID),
// Event: map[string]any{
diff --git a/general_tests/sessions_message_it_test.go b/general_tests/sessions_message_it_test.go
index e7eaaf815..73d08d05d 100644
--- a/general_tests/sessions_message_it_test.go
+++ b/general_tests/sessions_message_it_test.go
@@ -168,7 +168,7 @@ func testSesMFDItProcessMessage(t *testing.T) {
&sessions.V1ProcessMessageArgs{
Debit: true,
ForceDuration: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: utils.UUIDSha1Prefix(),
Event: map[string]any{
diff --git a/general_tests/sessions_race_test.go b/general_tests/sessions_race_test.go
index 94f84d312..72a62d313 100644
--- a/general_tests/sessions_race_test.go
+++ b/general_tests/sessions_race_test.go
@@ -50,7 +50,7 @@ var (
type raceConn struct{}
func (_ raceConn) Call(_ *context.Context, serviceMethod string, args any, reply any) (err error) {
- cgrev := args.(*utils.CGREvent)
+ cgrev := args.(*engine.CGREvent)
for {
for k := range cgrev.Event {
if _, has := cgrev.Event[k]; !has {
@@ -136,7 +136,7 @@ func TestSessionSRace(t *testing.T) {
&sessions.V1InitSessionArgs{
InitSession: true,
ProcessThresholds: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testSSv1ItProcessEventInitiateSession",
Event: map[string]any{
@@ -162,7 +162,7 @@ func TestSessionSRace(t *testing.T) {
&sessions.V1ProcessEventArgs{
Flags: []string{utils.ConcatenatedKey(utils.MetaRALs, utils.MetaInitiate),
utils.MetaThresholds},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testSSv1ItProcessEventInitiateSession",
Event: map[string]any{
diff --git a/general_tests/sessions_tnt_change_cdr_it_test.go b/general_tests/sessions_tnt_change_cdr_it_test.go
index 50c810cf5..b8c762a9e 100644
--- a/general_tests/sessions_tnt_change_cdr_it_test.go
+++ b/general_tests/sessions_tnt_change_cdr_it_test.go
@@ -204,7 +204,7 @@ func testChargerSCdrsAuthProcessEventAuth(t *testing.T) {
}
ev := &engine.ArgV1ProcessEvent{
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestEv1",
Event: map[string]any{
diff --git a/general_tests/sessions_tnt_change_it_test.go b/general_tests/sessions_tnt_change_it_test.go
index 34a81c909..079e99bc9 100644
--- a/general_tests/sessions_tnt_change_it_test.go
+++ b/general_tests/sessions_tnt_change_it_test.go
@@ -205,7 +205,7 @@ func testChargerSAuthProcessEventAuth(t *testing.T) {
ev := &sessions.V1AuthorizeArgs{
GetMaxUsage: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestEv1",
Event: map[string]any{
diff --git a/general_tests/set_rmv_prfl_dlay_it_test.go b/general_tests/set_rmv_prfl_dlay_it_test.go
index e9761e613..71ccf4fa7 100644
--- a/general_tests/set_rmv_prfl_dlay_it_test.go
+++ b/general_tests/set_rmv_prfl_dlay_it_test.go
@@ -77,7 +77,7 @@ func TestSetRemoveProfilesWithCachingDelay(t *testing.T) {
})
t.Run("SetAttributeProfile", func(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSGetAttributeForEventWihMetaAnyContext",
Event: map[string]any{
@@ -546,7 +546,7 @@ func TestSetRemoveProfilesWithCachingDelay(t *testing.T) {
t.Run("ReplicatorSv1SetAttributeProfile", func(t *testing.T) {
- ev := &utils.CGREvent{
+ ev := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSGetAttributeForEventWihMetaAnyContext",
Event: map[string]any{
diff --git a/general_tests/shared_client_lock_it_test.go b/general_tests/shared_client_lock_it_test.go
index 44d49373f..a295bc519 100644
--- a/general_tests/shared_client_lock_it_test.go
+++ b/general_tests/shared_client_lock_it_test.go
@@ -191,7 +191,7 @@ func testSharedClientLockSetProfiles(t *testing.T) {
func testSharedClientLockCDRsProcessEvent(t *testing.T) {
argsEv := &engine.ArgV1ProcessEvent{
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
ID: "cdr_test_event",
Event: make(map[string]any),
diff --git a/general_tests/shared_subject_it_test.go b/general_tests/shared_subject_it_test.go
index 5f0379129..a6beb4904 100644
--- a/general_tests/shared_subject_it_test.go
+++ b/general_tests/shared_subject_it_test.go
@@ -134,11 +134,11 @@ cgrates.org,call,Subject2,2014-01-14T00:00:00Z,RP_Subject2,`,
defer shutdown()
t.Run("Cost1001->1002", func(t *testing.T) {
- var reply []*utils.EventWithFlags
+ var reply []*engine.EventWithFlags
err := client.Call(context.Background(), utils.CDRsV2ProcessEvent,
&engine.ArgV1ProcessEvent{
Flags: []string{utils.MetaRALs},
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -171,11 +171,11 @@ cgrates.org,call,Subject2,2014-01-14T00:00:00Z,RP_Subject2,`,
})
t.Run("Cost1002->1001", func(t *testing.T) {
- var reply []*utils.EventWithFlags
+ var reply []*engine.EventWithFlags
err := client.Call(context.Background(), utils.CDRsV2ProcessEvent,
&engine.ArgV1ProcessEvent{
Flags: []string{utils.MetaRALs},
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -208,11 +208,11 @@ cgrates.org,call,Subject2,2014-01-14T00:00:00Z,RP_Subject2,`,
})
t.Run("Cost1001->1010", func(t *testing.T) {
- var reply []*utils.EventWithFlags
+ var reply []*engine.EventWithFlags
err := client.Call(context.Background(), utils.CDRsV2ProcessEvent,
&engine.ArgV1ProcessEvent{
Flags: []string{utils.MetaRALs},
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
@@ -248,11 +248,11 @@ cgrates.org,call,Subject2,2014-01-14T00:00:00Z,RP_Subject2,`,
})
t.Run("Cost1010->1001", func(t *testing.T) {
- var reply []*utils.EventWithFlags
+ var reply []*engine.EventWithFlags
err := client.Call(context.Background(), utils.CDRsV2ProcessEvent,
&engine.ArgV1ProcessEvent{
Flags: []string{utils.MetaRALs},
- CGREvent: utils.CGREvent{
+ CGREvent: engine.CGREvent{
Tenant: "cgrates.org",
ID: "event1",
Event: map[string]any{
diff --git a/general_tests/tls_it_test.go b/general_tests/tls_it_test.go
index 645b7c115..752af469f 100644
--- a/general_tests/tls_it_test.go
+++ b/general_tests/tls_it_test.go
@@ -111,17 +111,17 @@ func testTLSRpcConn(t *testing.T) {
func testTLSPing(t *testing.T) {
var reply string
- if err := tlsRpcClientJson.Call(context.Background(), utils.ThresholdSv1Ping, new(utils.CGREvent), &reply); err != nil {
+ if err := tlsRpcClientJson.Call(context.Background(), utils.ThresholdSv1Ping, new(engine.CGREvent), &reply); err != nil {
t.Error(err)
} else if reply != utils.Pong {
t.Errorf("Received: %s", reply)
}
- if err := tlsRpcClientGob.Call(context.Background(), utils.ThresholdSv1Ping, new(utils.CGREvent), &reply); err != nil {
+ if err := tlsRpcClientGob.Call(context.Background(), utils.ThresholdSv1Ping, new(engine.CGREvent), &reply); err != nil {
t.Error(err)
} else if reply != utils.Pong {
t.Errorf("Received: %s", reply)
}
- if err := tlsHTTPJson.Call(context.Background(), utils.ThresholdSv1Ping, new(utils.CGREvent), &reply); err != nil {
+ if err := tlsHTTPJson.Call(context.Background(), utils.ThresholdSv1Ping, new(engine.CGREvent), &reply); err != nil {
t.Error(err)
} else if reply != utils.Pong {
t.Errorf("Received: %s", reply)
@@ -142,7 +142,7 @@ func testTLSPing(t *testing.T) {
AllocateResources: true,
GetAttributes: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSSv1ItInitiateSession",
Event: map[string]any{
diff --git a/general_tests/tutorial2_calls_test.go b/general_tests/tutorial2_calls_test.go
index 2d092c582..e705ca7c6 100644
--- a/general_tests/tutorial2_calls_test.go
+++ b/general_tests/tutorial2_calls_test.go
@@ -214,7 +214,7 @@ package general_tests
// var rs *engine.Resources
// args := &utils.ArgRSv1ResourceUsage{
// UsageID: "OriginID",
-// CGREvent: &utils.CGREvent{
+// CGREvent: &engine.CGREvent{
// Tenant: "cgrates.org",
// ID: "ResourceEvent",
// Event: map[string]any{
@@ -324,7 +324,7 @@ package general_tests
// var rs *engine.Resources
// args := &utils.ArgRSv1ResourceUsage{
// UsageID: "OriginID1",
-// CGREvent: &utils.CGREvent{
+// CGREvent: &engine.CGREvent{
// Tenant: "cgrates.org",
// ID: "ResourceAllocation",
// Event: map[string]any{
@@ -429,7 +429,7 @@ package general_tests
// var rs *engine.Resources
// args := &utils.ArgRSv1ResourceUsage{
// UsageID: "OriginID2",
-// CGREvent: &utils.CGREvent{
+// CGREvent: &engine.CGREvent{
// Tenant: "cgrates.org",
// ID: "ResourceRelease",
// Event: map[string]any{
@@ -506,7 +506,7 @@ package general_tests
// var rs *engine.Resources
// args := &utils.ArgRSv1ResourceUsage{
// UsageID: "OriginID3",
-// CGREvent: &utils.CGREvent{
+// CGREvent: &engine.CGREvent{
// Tenant: "cgrates.org",
// ID: "AllocateResource",
// Event: map[string]any{
diff --git a/general_tests/tutorial_calls_test.go b/general_tests/tutorial_calls_test.go
index 4297440e0..8d0aa9dba 100644
--- a/general_tests/tutorial_calls_test.go
+++ b/general_tests/tutorial_calls_test.go
@@ -307,7 +307,7 @@ func testCallStatMetricsBefore(t *testing.T) {
func testCallCheckResourceBeforeAllocation(t *testing.T) {
var rs *engine.Resources
- args := &utils.CGREvent{
+ args := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "ResourceEvent",
Event: map[string]any{
@@ -458,7 +458,7 @@ func testCallCall1003To1001SecondTime(t *testing.T) {
// Check if the resource was Allocated
func testCallCheckResourceAllocation(t *testing.T) {
var rs *engine.Resources
- args := &utils.CGREvent{
+ args := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "ResourceAllocation",
Event: map[string]any{
@@ -648,7 +648,7 @@ func testCallStatMetrics(t *testing.T) {
func testCallCheckResourceRelease(t *testing.T) {
var rs *engine.Resources
- args := &utils.CGREvent{
+ args := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "ResourceRelease",
Event: map[string]any{
@@ -725,7 +725,7 @@ func testCallSyncSessions(t *testing.T) {
}
//check if resource was allocated for 2 calls(1001->1002;1001->1003)
var rs *engine.Resources
- args := &utils.CGREvent{
+ args := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "AllocateResource",
Event: map[string]any{
diff --git a/registrarc/registrarcrpc_it_test.go b/registrarc/registrarcrpc_it_test.go
index 7b38cc6c0..45f8b2d5b 100644
--- a/registrarc/registrarcrpc_it_test.go
+++ b/registrarc/registrarcrpc_it_test.go
@@ -120,7 +120,7 @@ func testRPCLoadData(t *testing.T) {
}
func testRPCChargerSNoAttr(t *testing.T) {
- cgrEv := &utils.CGREvent{ // matching Charger1
+ cgrEv := &engine.CGREvent{ // matching Charger1
Tenant: "cgrates.org",
Event: map[string]any{
utils.AccountField: "1010",
@@ -143,7 +143,7 @@ func testRPCStartRegc(t *testing.T) {
}
func testRPCChargerSWithAttr(t *testing.T) {
- cgrEv := &utils.CGREvent{ // matching Charger1
+ cgrEv := &engine.CGREvent{ // matching Charger1
Tenant: "cgrates.org",
Event: map[string]any{
utils.AccountField: "1010",
@@ -155,7 +155,7 @@ func testRPCChargerSWithAttr(t *testing.T) {
{
ChargerSProfile: "CustomerCharges",
AlteredFields: []string{"*req.RunID"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
"Account": "1010",
@@ -170,7 +170,7 @@ func testRPCChargerSWithAttr(t *testing.T) {
ChargerSProfile: "Raw",
AttributeSProfiles: []string{"*constant:*req.RequestType:*none"},
AlteredFields: []string{"*req.RunID", "*req.RequestType"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
"Account": "1010",
@@ -187,7 +187,7 @@ func testRPCChargerSWithAttr(t *testing.T) {
ChargerSProfile: "SupplierCharges",
AttributeSProfiles: []string{"cgrates.org:ATTR_SUPPLIER1"},
AlteredFields: []string{"*req.RunID", "*req.Subject"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
"Account": "1010",
diff --git a/services/sessions_it_test.go b/services/sessions_it_test.go
index 664ae6866..a7ba2f575 100644
--- a/services/sessions_it_test.go
+++ b/services/sessions_it_test.go
@@ -92,7 +92,7 @@ func TestSessionSReload1(t *testing.T) {
ChargerSProfile: "raw",
AttributeSProfiles: []string{utils.MetaNone},
AlteredFields: []string{"~*req.RunID"},
- CGREvent: args.(*utils.CGREvent),
+ CGREvent: args.(*engine.CGREvent),
},
}
return nil
@@ -113,7 +113,7 @@ func TestSessionSReload1(t *testing.T) {
args := &sessions.V1InitSessionArgs{
InitSession: true,
ProcessThresholds: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testSSv1ItProcessEventInitiateSession",
Event: map[string]any{
diff --git a/sessions/libsessions.go b/sessions/libsessions.go
index ba1ef7222..797684a07 100644
--- a/sessions/libsessions.go
+++ b/sessions/libsessions.go
@@ -47,7 +47,7 @@ var authReqs = engine.MapEvent{
type BiRPCClient interface {
V1DisconnectSession(*context.Context, utils.AttrDisconnectSession, *string) error
V1GetActiveSessionIDs(*context.Context, string, *[]*SessionID) error
- V1AlterSessions(*context.Context, utils.CGREvent, *string) error
+ V1AlterSessions(*context.Context, engine.CGREvent, *string) error
V1DisconnectPeer(*context.Context, *utils.DPRArgs, *string) error
V1WarnDisconnect(*context.Context, map[string]any, *string) error
}
@@ -266,11 +266,11 @@ type V1STIRIdentityArgs struct {
}
// getDerivedEvents returns only the *raw event if derivedReply flag is not specified
-func getDerivedEvents(events map[string]*utils.CGREvent, derivedReply bool) map[string]*utils.CGREvent {
+func getDerivedEvents(events map[string]*engine.CGREvent, derivedReply bool) map[string]*engine.CGREvent {
if derivedReply {
return events
}
- return map[string]*utils.CGREvent{
+ return map[string]*engine.CGREvent{
utils.MetaRaw: events[utils.MetaRaw],
}
}
diff --git a/sessions/libsessions_test.go b/sessions/libsessions_test.go
index c11f16a9c..132477a54 100644
--- a/sessions/libsessions_test.go
+++ b/sessions/libsessions_test.go
@@ -335,14 +335,14 @@ aa+jqv4dwkr/FLEcN1zC76Y/IniI65fId55hVJvN3ORuzUqYEtzD3irmsw==
}
func TestGetDerivedEvents(t *testing.T) {
- events := map[string]*utils.CGREvent{
+ events := map[string]*engine.CGREvent{
utils.MetaRaw: {},
"DEFAULT": {},
}
if rply := getDerivedEvents(events, true); !reflect.DeepEqual(events, rply) {
t.Errorf("Expected %s received %s", utils.ToJSON(events), utils.ToJSON(rply))
}
- exp := map[string]*utils.CGREvent{
+ exp := map[string]*engine.CGREvent{
utils.MetaRaw: events[utils.MetaRaw],
}
if rply := getDerivedEvents(events, false); !reflect.DeepEqual(exp, rply) {
diff --git a/sessions/session.go b/sessions/session.go
index 90452b64d..b0b27e13e 100644
--- a/sessions/session.go
+++ b/sessions/session.go
@@ -222,10 +222,10 @@ func (s *Session) totalUsage() (tDur time.Duration) {
// AsCGREvents is a method to return the Session as CGREvents
// AsCGREvents is not thread safe since it is supposed to run by the time Session is closed
-func (s *Session) asCGREvents() (cgrEvs []*utils.CGREvent) {
- cgrEvs = make([]*utils.CGREvent, len(s.SRuns)) // so we can gather all cdr info while under lock
+func (s *Session) asCGREvents() (cgrEvs []*engine.CGREvent) {
+ cgrEvs = make([]*engine.CGREvent, len(s.SRuns)) // so we can gather all cdr info while under lock
for i, sr := range s.SRuns {
- cgrEvs[i] = &utils.CGREvent{
+ cgrEvs[i] = &engine.CGREvent{
Tenant: s.Tenant,
ID: utils.UUIDSha1Prefix(),
Event: sr.Event,
diff --git a/sessions/sessions.go b/sessions/sessions.go
index dccdbb9c4..4a0dc547d 100644
--- a/sessions/sessions.go
+++ b/sessions/sessions.go
@@ -385,7 +385,7 @@ func (sS *SessionS) forceSTerminate(s *Session, extraUsage time.Duration, tUsage
// release the resources for the session
if len(sS.cgrCfg.SessionSCfg().ResSConns) != 0 && s.ResourceID != "" {
var reply string
- cgrEv := &utils.CGREvent{
+ cgrEv := &engine.CGREvent{
Tenant: s.Tenant,
ID: utils.GenUUID(),
Event: s.EventStart,
@@ -1160,7 +1160,7 @@ func (sS *SessionS) filterSessionsCount(sf *utils.SessionFilter, psv bool) (coun
// newSession will populate SRuns within a Session based on ChargerS output
// forSession can only be called once per Session
// not thread-safe since it should be called in init where there is no concurrency
-func (sS *SessionS) newSession(cgrEv *utils.CGREvent, resID, clntConnID string,
+func (sS *SessionS) newSession(cgrEv *engine.CGREvent, resID, clntConnID string,
dbtItval time.Duration, forceDuration, isMsg bool) (s *Session, err error) {
if len(sS.cgrCfg.SessionSCfg().ChargerSConns) == 0 {
err = errors.New("ChargerS is disabled")
@@ -1228,7 +1228,7 @@ func (sS *SessionS) newSession(cgrEv *utils.CGREvent, resID, clntConnID string,
}
// processChargerS processes the event with chargers and cahces the response based on the requestID
-func (sS *SessionS) processChargerS(cgrEv *utils.CGREvent) (chrgrs []*engine.ChrgSProcessEventReply, err error) {
+func (sS *SessionS) processChargerS(cgrEv *engine.CGREvent) (chrgrs []*engine.ChrgSProcessEventReply, err error) {
if x, ok := engine.Cache.Get(utils.CacheEventCharges, cgrEv.ID); ok && x != nil {
return x.([]*engine.ChrgSProcessEventReply), nil
}
@@ -1446,7 +1446,7 @@ func (sS *SessionS) initSessionDebitLoops(s *Session) {
}
// authEvent calculates maximum usage allowed for the given event
-func (sS *SessionS) authEvent(cgrEv *utils.CGREvent, forceDuration bool) (usage map[string]time.Duration, err error) {
+func (sS *SessionS) authEvent(cgrEv *engine.CGREvent, forceDuration bool) (usage map[string]time.Duration, err error) {
evStart := engine.MapEvent(cgrEv.Event)
var eventUsage time.Duration
if eventUsage, err = evStart.GetDuration(utils.Usage); err != nil {
@@ -1486,7 +1486,7 @@ func (sS *SessionS) authEvent(cgrEv *utils.CGREvent, forceDuration bool) (usage
// initSession handles a new session
// not thread-safe for Session since it is constructed here
-func (sS *SessionS) initSession(cgrEv *utils.CGREvent, clntConnID,
+func (sS *SessionS) initSession(cgrEv *engine.CGREvent, clntConnID,
resID string, dbtItval time.Duration, isMsg, forceDuration bool) (s *Session, err error) {
if s, err = sS.newSession(cgrEv, resID, clntConnID, dbtItval, forceDuration, isMsg); err != nil {
return nil, err
@@ -1653,7 +1653,7 @@ func (sS *SessionS) endSession(s *Session, tUsage, lastUsage *time.Duration,
}
// chargeEvent will charge a single event (ie: SMS)
-func (sS *SessionS) chargeEvent(cgrEv *utils.CGREvent, forceDuration bool) (maxUsage time.Duration, err error) {
+func (sS *SessionS) chargeEvent(cgrEv *engine.CGREvent, forceDuration bool) (maxUsage time.Duration, err error) {
var s *Session
if s, err = sS.initSession(cgrEv, "", "", 0, true, forceDuration); err != nil {
return
@@ -1787,7 +1787,7 @@ func (sS *SessionS) BiRPCv1ReplicateSessions(ctx *context.Context,
func NewV1AuthorizeArgs(attrs bool, attributeIDs []string,
thrslds bool, thresholdIDs []string, statQueues bool, statIDs []string,
res, maxUsage, routes, routesIgnoreErrs, routesEventCost bool,
- cgrEv *utils.CGREvent, routePaginator utils.Paginator,
+ cgrEv *engine.CGREvent, routePaginator utils.Paginator,
forceDuration bool, routesMaxCost string) (args *V1AuthorizeArgs) {
args = &V1AuthorizeArgs{
GetAttributes: attrs,
@@ -1833,7 +1833,7 @@ type V1AuthorizeArgs struct {
AttributeIDs []string
ThresholdIDs []string
StatIDs []string
- *utils.CGREvent
+ *engine.CGREvent
utils.Paginator
}
@@ -1868,7 +1868,7 @@ func (args *V1AuthorizeArgs) ParseFlags(flags, sep string) {
args.ForceDuration = true
}
}
- args.Paginator, _ = utils.GetRoutePaginatorFromOpts(args.APIOpts)
+ args.Paginator, _ = engine.GetRoutePaginatorFromOpts(args.APIOpts)
}
// V1AuthorizeReply are options available in auth reply
@@ -2102,7 +2102,7 @@ func (sS *SessionS) BiRPCv1AuthorizeEventWithDigest(ctx *context.Context,
// NewV1InitSessionArgs is a constructor for V1InitSessionArgs
func NewV1InitSessionArgs(attrs bool, attributeIDs []string,
thrslds bool, thresholdIDs []string, stats bool, statIDs []string,
- resrc, acnt bool, cgrEv *utils.CGREvent, forceDuration bool) (args *V1InitSessionArgs) {
+ resrc, acnt bool, cgrEv *engine.CGREvent, forceDuration bool) (args *V1InitSessionArgs) {
args = &V1InitSessionArgs{
GetAttributes: attrs,
AllocateResources: resrc,
@@ -2135,7 +2135,7 @@ type V1InitSessionArgs struct {
AttributeIDs []string
ThresholdIDs []string
StatIDs []string
- *utils.CGREvent
+ *engine.CGREvent
}
func (V1InitSessionArgs) RPCClone() {}
@@ -2397,7 +2397,7 @@ func (sS *SessionS) BiRPCv1InitiateSessionWithDigest(ctx *context.Context,
// NewV1UpdateSessionArgs is a constructor for update session arguments
func NewV1UpdateSessionArgs(attrs bool, attributeIDs []string,
- acnts bool, cgrEv *utils.CGREvent, forceDuration bool) (args *V1UpdateSessionArgs) {
+ acnts bool, cgrEv *engine.CGREvent, forceDuration bool) (args *V1UpdateSessionArgs) {
args = &V1UpdateSessionArgs{
GetAttributes: attrs,
UpdateSession: acnts,
@@ -2416,7 +2416,7 @@ type V1UpdateSessionArgs struct {
UpdateSession bool
ForceDuration bool
AttributeIDs []string
- *utils.CGREvent
+ *engine.CGREvent
}
func (V1UpdateSessionArgs) RPCClone() {}
@@ -2548,7 +2548,7 @@ func (sS *SessionS) BiRPCv1UpdateSession(ctx *context.Context,
// NewV1TerminateSessionArgs creates a new V1TerminateSessionArgs using the given arguments
func NewV1TerminateSessionArgs(acnts, resrc,
thrds bool, thresholdIDs []string, stats bool,
- statIDs []string, cgrEv *utils.CGREvent, forceDuration bool) (args *V1TerminateSessionArgs) {
+ statIDs []string, cgrEv *engine.CGREvent, forceDuration bool) (args *V1TerminateSessionArgs) {
args = &V1TerminateSessionArgs{
TerminateSession: acnts,
ReleaseResources: resrc,
@@ -2575,7 +2575,7 @@ type V1TerminateSessionArgs struct {
ProcessStats bool
ThresholdIDs []string
StatIDs []string
- *utils.CGREvent
+ *engine.CGREvent
}
func (V1TerminateSessionArgs) RPCClone() {}
@@ -2738,7 +2738,7 @@ func (sS *SessionS) BiRPCv1TerminateSession(ctx *context.Context,
// BiRPCv1ProcessCDR sends the CDR to CDRs
func (sS *SessionS) BiRPCv1ProcessCDR(ctx *context.Context,
- cgrEv *utils.CGREvent, rply *string) (err error) {
+ cgrEv *engine.CGREvent, rply *string) (err error) {
if cgrEv.Event == nil {
return utils.NewErrMandatoryIeMissing(utils.Event)
}
@@ -2779,7 +2779,7 @@ func (sS *SessionS) BiRPCv1ProcessCDR(ctx *context.Context,
// NewV1ProcessMessageArgs is a constructor for MessageArgs used by ProcessMessage
func NewV1ProcessMessageArgs(attrs bool, attributeIDs []string,
thds bool, thresholdIDs []string, stats bool, statIDs []string, resrc, acnts,
- routes, routesIgnoreErrs, routesEventCost bool, cgrEv *utils.CGREvent,
+ routes, routesIgnoreErrs, routesEventCost bool, cgrEv *engine.CGREvent,
routePaginator utils.Paginator, forceDuration bool, routesMaxCost string) (args *V1ProcessMessageArgs) {
args = &V1ProcessMessageArgs{
AllocateResources: resrc,
@@ -2824,7 +2824,7 @@ type V1ProcessMessageArgs struct {
AttributeIDs []string
ThresholdIDs []string
StatIDs []string
- *utils.CGREvent
+ *engine.CGREvent
utils.Paginator
}
@@ -2859,7 +2859,7 @@ func (args *V1ProcessMessageArgs) ParseFlags(flags, sep string) {
args.ForceDuration = true
}
}
- args.Paginator, _ = utils.GetRoutePaginatorFromOpts(args.APIOpts)
+ args.Paginator, _ = engine.GetRoutePaginatorFromOpts(args.APIOpts)
}
// V1ProcessMessageReply is the reply for the ProcessMessage API
@@ -3040,7 +3040,7 @@ func (sS *SessionS) BiRPCv1ProcessMessage(ctx *context.Context,
// V1ProcessEventArgs are the options passed to ProcessEvent API
type V1ProcessEventArgs struct {
Flags []string
- *utils.CGREvent
+ *engine.CGREvent
utils.Paginator
}
@@ -3176,7 +3176,7 @@ func (sS *SessionS) BiRPCv1ProcessEvent(ctx *context.Context,
argsFlagsWithParams := utils.FlagsWithParamsFromSlice(args.Flags)
blockError := argsFlagsWithParams.GetBool(utils.MetaBlockerError)
- events := map[string]*utils.CGREvent{
+ events := map[string]*engine.CGREvent{
utils.MetaRaw: args.CGREvent,
}
if argsFlagsWithParams.GetBool(utils.MetaChargers) {
@@ -3754,7 +3754,7 @@ func (sS *SessionS) BiRPCv1DeactivateSessions(ctx *context.Context,
return
}
-func (sS *SessionS) processCDR(cgrEv *utils.CGREvent, flags []string, rply *string, clnb bool) (err error) {
+func (sS *SessionS) processCDR(cgrEv *engine.CGREvent, flags []string, rply *string, clnb bool) (err error) {
ev := engine.MapEvent(cgrEv.Event)
cgrID := GetSetCGRID(ev)
s := sS.getRelocateSession(cgrID,
@@ -3810,7 +3810,7 @@ func (sS *SessionS) processCDR(cgrEv *utils.CGREvent, flags []string, rply *stri
}
// processThreshold will receive the event and send it to ThresholdS to be processed
-func (sS *SessionS) processThreshold(cgrEv *utils.CGREvent, thIDs []string, clnb bool) (tIDs []string, err error) {
+func (sS *SessionS) processThreshold(cgrEv *engine.CGREvent, thIDs []string, clnb bool) (tIDs []string, err error) {
if len(sS.cgrCfg.SessionSCfg().ThreshSConns) == 0 {
return tIDs, utils.NewErrNotConnected(utils.ThresholdS)
}
@@ -3828,7 +3828,7 @@ func (sS *SessionS) processThreshold(cgrEv *utils.CGREvent, thIDs []string, clnb
}
// processStats will receive the event and send it to StatS to be processed
-func (sS *SessionS) processStats(cgrEv *utils.CGREvent, stsIDs []string, clnb bool) (sIDs []string, err error) {
+func (sS *SessionS) processStats(cgrEv *engine.CGREvent, stsIDs []string, clnb bool) (sIDs []string, err error) {
if len(sS.cgrCfg.SessionSCfg().StatSConns) == 0 {
return sIDs, utils.NewErrNotConnected(utils.StatS)
}
@@ -3846,7 +3846,7 @@ func (sS *SessionS) processStats(cgrEv *utils.CGREvent, stsIDs []string, clnb bo
}
// getRoutes will receive the event and send it to SupplierS to find the suppliers
-func (sS *SessionS) getRoutes(cgrEv *utils.CGREvent, pag utils.Paginator, ignoreErrors bool,
+func (sS *SessionS) getRoutes(cgrEv *engine.CGREvent, pag utils.Paginator, ignoreErrors bool,
maxCost string, clnb bool) (routesReply engine.SortedRoutesList, err error) {
if len(sS.cgrCfg.SessionSCfg().RouteSConns) == 0 {
return routesReply, utils.NewErrNotConnected(utils.RouteS)
@@ -3869,7 +3869,7 @@ func (sS *SessionS) getRoutes(cgrEv *utils.CGREvent, pag utils.Paginator, ignore
}
// processAttributes will receive the event and send it to AttributeS to be processed
-func (sS *SessionS) processAttributes(cgrEv *utils.CGREvent, attrIDs []string,
+func (sS *SessionS) processAttributes(cgrEv *engine.CGREvent, attrIDs []string,
clnb bool) (rplyEv engine.AttrSProcessEventReply, err error) {
if len(sS.cgrCfg.SessionSCfg().AttrSConns) == 0 {
return rplyEv, utils.NewErrNotConnected(utils.AttributeS)
@@ -3901,7 +3901,7 @@ func (sS *SessionS) BiRPCV1GetMaxUsage(ctx *context.Context,
ctx,
&V1AuthorizeArgs{
GetMaxUsage: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: utils.FirstNonEmpty(
ev.GetStringIgnoreErrors(utils.Tenant),
sS.cgrCfg.GeneralCfg().DefaultTenant),
@@ -3926,7 +3926,7 @@ func (sS *SessionS) BiRPCV1InitiateSession(ctx *context.Context,
ctx,
&V1InitSessionArgs{
InitSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: utils.FirstNonEmpty(
ev.GetStringIgnoreErrors(utils.Tenant),
sS.cgrCfg.GeneralCfg().DefaultTenant),
@@ -3951,7 +3951,7 @@ func (sS *SessionS) BiRPCV1UpdateSession(ctx *context.Context,
ctx,
&V1UpdateSessionArgs{
UpdateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: utils.FirstNonEmpty(
ev.GetStringIgnoreErrors(utils.Tenant),
sS.cgrCfg.GeneralCfg().DefaultTenant),
@@ -3975,7 +3975,7 @@ func (sS *SessionS) BiRPCV1TerminateSession(ctx *context.Context,
ctx,
&V1TerminateSessionArgs{
TerminateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: utils.FirstNonEmpty(
ev.GetStringIgnoreErrors(utils.Tenant),
sS.cgrCfg.GeneralCfg().DefaultTenant),
@@ -3993,7 +3993,7 @@ func (sS *SessionS) BiRPCV1ProcessCDR(ctx *context.Context,
ev engine.MapEvent, rply *string) (err error) {
return sS.BiRPCv1ProcessCDR(
ctx,
- &utils.CGREvent{
+ &engine.CGREvent{
Tenant: utils.FirstNonEmpty(
ev.GetStringIgnoreErrors(utils.Tenant),
sS.cgrCfg.GeneralCfg().DefaultTenant),
@@ -4019,7 +4019,7 @@ func (sS *SessionS) sendRar(ctx *context.Context, s *Session, apiOpts map[string
event[key] = val
}
}
- args := utils.CGREvent{
+ args := engine.CGREvent{
ID: utils.GenUUID(),
Time: utils.TimePointer(time.Now()),
APIOpts: apiOpts,
diff --git a/sessions/sessions_bench_test.go b/sessions/sessions_bench_test.go
index cddd75516..b8766609e 100644
--- a/sessions/sessions_bench_test.go
+++ b/sessions/sessions_bench_test.go
@@ -112,7 +112,7 @@ func initSession(i int) {
defer func() { maxCps <- oneCps }()
initArgs := &V1InitSessionArgs{
InitSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "",
Event: map[string]any{
diff --git a/sessions/sessions_birpc_it_test.go b/sessions/sessions_birpc_it_test.go
index f8aec291e..60576bcd5 100644
--- a/sessions/sessions_birpc_it_test.go
+++ b/sessions/sessions_birpc_it_test.go
@@ -174,7 +174,7 @@ func testSessionsBiRPCSessionAutomaticDisconnects(t *testing.T) {
initArgs := &V1InitSessionArgs{
InitSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionsBiRPCSessionAutomaticDisconnects",
Event: map[string]any{
@@ -216,7 +216,7 @@ func testSessionsBiRPCSessionAutomaticDisconnects(t *testing.T) {
}
termArgs := &V1TerminateSessionArgs{
TerminateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionsDataLastUsedData",
Event: map[string]any{
@@ -296,7 +296,7 @@ func testSessionsBiRPCSessionOriginatorTerminate(t *testing.T) {
initArgs := &V1InitSessionArgs{
InitSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionsBiRPCSessionOriginatorTerminate",
Event: map[string]any{
@@ -331,7 +331,7 @@ func testSessionsBiRPCSessionOriginatorTerminate(t *testing.T) {
termArgs := &V1TerminateSessionArgs{
TerminateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionsBiRPCSessionOriginatorTerminate",
Event: map[string]any{
diff --git a/sessions/sessions_data_it_test.go b/sessions/sessions_data_it_test.go
index a674d7001..9412ac71e 100644
--- a/sessions/sessions_data_it_test.go
+++ b/sessions/sessions_data_it_test.go
@@ -156,7 +156,7 @@ func testSessionsDataLastUsedData(t *testing.T) {
usage := int64(5120)
initArgs := &V1InitSessionArgs{
InitSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionsDataLastUsedData",
Event: map[string]any{
@@ -195,7 +195,7 @@ func testSessionsDataLastUsedData(t *testing.T) {
updateArgs := &V1UpdateSessionArgs{
UpdateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionsDataLastUsedData",
Event: map[string]any{
@@ -233,7 +233,7 @@ func testSessionsDataLastUsedData(t *testing.T) {
termArgs := &V1TerminateSessionArgs{
TerminateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionsDataLastUsedData",
Event: map[string]any{
@@ -294,7 +294,7 @@ func testSessionsDataLastUsedMultipleUpdates(t *testing.T) {
usage := int64(6144)
initArgs := &V1InitSessionArgs{
InitSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionsDataLastUsedMultipleUpdates",
Event: map[string]any{
@@ -340,7 +340,7 @@ func testSessionsDataLastUsedMultipleUpdates(t *testing.T) {
usage = int64(8192)
updateArgs := &V1UpdateSessionArgs{
UpdateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionsDataLastUsedMultipleUpdates",
Event: map[string]any{
@@ -388,7 +388,7 @@ func testSessionsDataLastUsedMultipleUpdates(t *testing.T) {
usage = int64(1024)
updateArgs = &V1UpdateSessionArgs{
UpdateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionsDataLastUsedMultipleUpdates",
Event: map[string]any{
@@ -438,7 +438,7 @@ func testSessionsDataLastUsedMultipleUpdates(t *testing.T) {
usage = int64(1024)
updateArgs = &V1UpdateSessionArgs{
UpdateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionsDataLastUsedMultipleUpdates",
Event: map[string]any{
@@ -480,7 +480,7 @@ func testSessionsDataLastUsedMultipleUpdates(t *testing.T) {
termArgs := &V1TerminateSessionArgs{
TerminateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionsDataLastUsedMultipleUpdates",
Event: map[string]any{
@@ -569,7 +569,7 @@ func testSessionsDataTTLExpired(t *testing.T) {
usage := int64(1024)
initArgs := &V1InitSessionArgs{
InitSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionsDataTTLExpired",
Event: map[string]any{
@@ -661,7 +661,7 @@ func testSessionsDataTTLExpMultiUpdates(t *testing.T) {
usage := int64(4096)
initArgs := &V1InitSessionArgs{
InitSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionsDataTTLExpMultiUpdates",
Event: map[string]any{
@@ -709,7 +709,7 @@ func testSessionsDataTTLExpMultiUpdates(t *testing.T) {
updateArgs := &V1UpdateSessionArgs{
UpdateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionsDataTTLExpMultiUpdates",
Event: map[string]any{
@@ -803,7 +803,7 @@ func testSessionsDataMultipleDataNoUsage(t *testing.T) {
usage := int64(2048)
initArgs := &V1InitSessionArgs{
InitSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionsDataMultipleDataNoUsage",
Event: map[string]any{
@@ -849,7 +849,7 @@ func testSessionsDataMultipleDataNoUsage(t *testing.T) {
usage = int64(1024)
updateArgs := &V1UpdateSessionArgs{
UpdateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionsDataMultipleDataNoUsage",
Event: map[string]any{
@@ -898,7 +898,7 @@ func testSessionsDataMultipleDataNoUsage(t *testing.T) {
usage = int64(0)
updateArgs = &V1UpdateSessionArgs{
UpdateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionsDataMultipleDataNoUsage",
Event: map[string]any{
@@ -952,7 +952,7 @@ func testSessionsDataMultipleDataNoUsage(t *testing.T) {
termArgs := &V1TerminateSessionArgs{
TerminateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionsDataMultipleDataNoUsage",
Event: map[string]any{
@@ -1021,7 +1021,7 @@ func testSessionsDataTTLUsageProtection(t *testing.T) {
usage := int64(2048)
initArgs := &V1InitSessionArgs{
InitSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionsDataTTLUsageProtection",
Event: map[string]any{
@@ -1098,7 +1098,7 @@ func testSessionsDataTTLLastUsage(t *testing.T) {
usage := int64(1024)
initArgs := &V1InitSessionArgs{
InitSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionsDataTTLLastUsage",
Event: map[string]any{
diff --git a/sessions/sessions_it_test.go b/sessions/sessions_it_test.go
index 68c8e804c..58952bd2a 100644
--- a/sessions/sessions_it_test.go
+++ b/sessions/sessions_it_test.go
@@ -135,7 +135,7 @@ func testSessionsItTerminatNonexist(t *testing.T) {
usage := 2 * time.Minute
termArgs := &V1TerminateSessionArgs{
TerminateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testSessionsItTerminatNonexist",
Event: map[string]any{
@@ -210,7 +210,7 @@ func testSessionsItUpdateNonexist(t *testing.T) {
usage := 2 * time.Minute
updtArgs := &V1UpdateSessionArgs{
UpdateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testSessionsItUpdateNonexist",
Event: map[string]any{
@@ -252,7 +252,7 @@ func testSessionsItUpdateNonexist(t *testing.T) {
var rpl string
termArgs := &V1TerminateSessionArgs{
TerminateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testSessionsItTerminatNonexist",
Event: map[string]any{
@@ -332,7 +332,7 @@ func testSessionsItTerminatePassive(t *testing.T) {
termArgs := &V1TerminateSessionArgs{
TerminateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testSessionsItTerminatNonexist",
Event: map[string]any{
@@ -391,7 +391,7 @@ func testSessionsItEventCostCompressing(t *testing.T) {
// Init the session
initArgs := &V1InitSessionArgs{
InitSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionsItEventCostCompressing",
Event: map[string]any{
@@ -414,7 +414,7 @@ func testSessionsItEventCostCompressing(t *testing.T) {
}
updateArgs := &V1UpdateSessionArgs{
UpdateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionsItEventCostCompressing",
Event: map[string]any{
@@ -438,7 +438,7 @@ func testSessionsItEventCostCompressing(t *testing.T) {
}
termArgs := &V1TerminateSessionArgs{
TerminateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionsDataLastUsedData",
Event: map[string]any{
diff --git a/sessions/sessions_rpl_it_test.go b/sessions/sessions_rpl_it_test.go
index 6c2b7dc4d..0b9bc2758 100644
--- a/sessions/sessions_rpl_it_test.go
+++ b/sessions/sessions_rpl_it_test.go
@@ -144,7 +144,7 @@ func testSessionSRplInitiate(t *testing.T) {
usage := time.Minute + 30*time.Second
argsInit := &V1InitSessionArgs{
InitSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionSRplInitiate",
Event: map[string]any{
@@ -210,7 +210,7 @@ func testSessionSRplUpdate(t *testing.T) {
usage := time.Minute
argsUpdate := &V1UpdateSessionArgs{
UpdateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionSRplUpdate",
Event: map[string]any{
@@ -288,7 +288,7 @@ func testSessionSRplUpdate(t *testing.T) {
func testSessionSRplTerminate(t *testing.T) {
args := &V1TerminateSessionArgs{
TerminateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionSRplTerminate",
Event: map[string]any{
@@ -351,7 +351,7 @@ func testSessionSRplManualReplicate(t *testing.T) {
// create two sessions
argsInit1 := &V1InitSessionArgs{
InitSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSSv1ItAuth",
Event: map[string]any{
@@ -373,7 +373,7 @@ func testSessionSRplManualReplicate(t *testing.T) {
argsInit2 := &V1InitSessionArgs{
InitSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSSv1ItAuth2",
Event: map[string]any{
diff --git a/sessions/sessions_test.go b/sessions/sessions_test.go
index a70b2d431..aaa91ce1a 100644
--- a/sessions/sessions_test.go
+++ b/sessions/sessions_test.go
@@ -37,7 +37,7 @@ import (
var attrs = &engine.AttrSProcessEventReply{
MatchedProfiles: []string{"ATTR_ACNT_1001"},
AlteredFields: []string{"*req.OfficeGroup"},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSSv1ItAuth",
Event: map[string]any{
@@ -891,7 +891,7 @@ func TestSessionSRegisterAndUnregisterPSessions(t *testing.T) {
}
func TestSessionSNewV1AuthorizeArgs(t *testing.T) {
- cgrEv := &utils.CGREvent{
+ cgrEv := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "Event",
Event: map[string]any{
@@ -971,9 +971,9 @@ func TestSessionSNewV1AuthorizeArgs(t *testing.T) {
func TestV1AuthorizeArgsParseFlags11(t *testing.T) {
v1authArgs := new(V1AuthorizeArgs)
- v1authArgs.CGREvent = new(utils.CGREvent)
+ v1authArgs.CGREvent = new(engine.CGREvent)
eOut := new(V1AuthorizeArgs)
- eOut.CGREvent = new(utils.CGREvent)
+ eOut.CGREvent = new(engine.CGREvent)
//empty check
strArg := ""
v1authArgs.ParseFlags(strArg, utils.InfieldSep)
@@ -981,7 +981,7 @@ func TestV1AuthorizeArgsParseFlags11(t *testing.T) {
t.Errorf("Expecting %+v,\n received: %+v", eOut, v1authArgs)
}
//normal check -> without *dispatchers
- cgrArgs, _ := utils.GetRoutePaginatorFromOpts(v1authArgs.APIOpts)
+ cgrArgs, _ := engine.GetRoutePaginatorFromOpts(v1authArgs.APIOpts)
eOut = &V1AuthorizeArgs{
GetMaxUsage: true,
AuthorizeResources: true,
@@ -1001,13 +1001,13 @@ func TestV1AuthorizeArgsParseFlags11(t *testing.T) {
strArg = "*accounts;*fd;*resources;*routes;*routes_ignore_errors;*routes_event_cost;*attributes:Attr1&Attr2;*thresholds:tr1&tr2&tr3;*stats:st1&st2&st3"
v1authArgs = new(V1AuthorizeArgs)
- v1authArgs.CGREvent = new(utils.CGREvent)
+ v1authArgs.CGREvent = new(engine.CGREvent)
v1authArgs.ParseFlags(strArg, utils.InfieldSep)
if !reflect.DeepEqual(eOut, v1authArgs) {
t.Errorf("Expecting %+v,\n received: %+v\n", utils.ToJSON(eOut), utils.ToJSON(v1authArgs))
}
// //normal check -> with *dispatchers
- cgrArgs, _ = utils.GetRoutePaginatorFromOpts(v1authArgs.APIOpts)
+ cgrArgs, _ = engine.GetRoutePaginatorFromOpts(v1authArgs.APIOpts)
eOut = &V1AuthorizeArgs{
GetMaxUsage: true,
AuthorizeResources: true,
@@ -1027,7 +1027,7 @@ func TestV1AuthorizeArgsParseFlags11(t *testing.T) {
strArg = "*accounts;*fd;*resources;;*dispatchers;*routes;*routes_ignore_errors;*routes_event_cost;*attributes:Attr1&Attr2;*thresholds:tr1&tr2&tr3;*stats:st1&st2&st3"
v1authArgs = new(V1AuthorizeArgs)
- v1authArgs.CGREvent = new(utils.CGREvent)
+ v1authArgs.CGREvent = new(engine.CGREvent)
v1authArgs.ParseFlags(strArg, utils.InfieldSep)
if !reflect.DeepEqual(eOut, v1authArgs) {
t.Errorf("Expecting %+v,\n received: %+v\n", utils.ToJSON(eOut), utils.ToJSON(v1authArgs))
@@ -1051,7 +1051,7 @@ func TestV1AuthorizeArgsParseFlags11(t *testing.T) {
strArg = "*accounts;*fd;*resources;;*dispatchers;*routes;*routes_ignore_errors;*routes_maxcost:100;*attributes:Attr1&Attr2;*thresholds:tr1&tr2&tr3;*stats:st1&st2&st3"
v1authArgs = new(V1AuthorizeArgs)
- v1authArgs.CGREvent = new(utils.CGREvent)
+ v1authArgs.CGREvent = new(engine.CGREvent)
v1authArgs.ParseFlags(strArg, utils.InfieldSep)
if !reflect.DeepEqual(eOut, v1authArgs) {
t.Errorf("Expecting %+v,\n received: %+v\n", utils.ToJSON(eOut), utils.ToJSON(v1authArgs))
@@ -1059,7 +1059,7 @@ func TestV1AuthorizeArgsParseFlags11(t *testing.T) {
}
func TestSessionSNewV1UpdateSessionArgs(t *testing.T) {
- cgrEv := &utils.CGREvent{
+ cgrEv := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "Event",
Event: map[string]any{
@@ -1097,7 +1097,7 @@ func TestSessionSNewV1UpdateSessionArgs(t *testing.T) {
}
func TestSessionSNewV1TerminateSessionArgs(t *testing.T) {
- cgrEv := &utils.CGREvent{
+ cgrEv := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "Event",
Event: map[string]any{
@@ -1140,7 +1140,7 @@ func TestSessionSNewV1TerminateSessionArgs(t *testing.T) {
}
func TestSessionSNewV1ProcessMessageArgs(t *testing.T) {
- cgrEv := &utils.CGREvent{
+ cgrEv := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "Event",
Event: map[string]any{
@@ -1215,7 +1215,7 @@ func TestSessionSNewV1ProcessMessageArgs(t *testing.T) {
func TestSessionSNewV1InitSessionArgs(t *testing.T) {
//t1
- cgrEv := &utils.CGREvent{
+ cgrEv := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "Event",
Event: map[string]any{
@@ -1244,7 +1244,7 @@ func TestSessionSNewV1InitSessionArgs(t *testing.T) {
}
//t2
- cgrEv = &utils.CGREvent{
+ cgrEv = &engine.CGREvent{
Tenant: "cgrates.org",
ID: "Event",
Event: map[string]any{
@@ -1682,7 +1682,7 @@ func TestSessionSrelocateSessionS(t *testing.T) {
func TestSessionSNewV1AuthorizeArgsWithOpts(t *testing.T) {
- cgrEv := &utils.CGREvent{
+ cgrEv := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "Event",
Event: map[string]any{
@@ -1700,7 +1700,7 @@ func TestSessionSNewV1AuthorizeArgsWithOpts(t *testing.T) {
CGREvent: cgrEv,
ForceDuration: true,
}
- cgrArgs, _ := utils.GetRoutePaginatorFromOpts(cgrEv.APIOpts)
+ cgrArgs, _ := engine.GetRoutePaginatorFromOpts(cgrEv.APIOpts)
rply := NewV1AuthorizeArgs(true, nil, false, nil, false, nil, true, false,
false, false, false, cgrEv, cgrArgs, true, "")
if !reflect.DeepEqual(expected, rply) {
@@ -1727,7 +1727,7 @@ func TestSessionSNewV1AuthorizeArgsWithOpts(t *testing.T) {
func TestSessionSNewV1AuthorizeArgsWithOpts2(t *testing.T) {
- cgrEv := &utils.CGREvent{
+ cgrEv := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "Event",
Event: map[string]any{
@@ -1744,7 +1744,7 @@ func TestSessionSNewV1AuthorizeArgsWithOpts2(t *testing.T) {
CGREvent: cgrEv,
ForceDuration: true,
}
- cgrArgs, _ := utils.GetRoutePaginatorFromOpts(cgrEv.APIOpts)
+ cgrArgs, _ := engine.GetRoutePaginatorFromOpts(cgrEv.APIOpts)
rply := NewV1AuthorizeArgs(true, nil, false, nil, false, nil, true, false, false,
false, false, cgrEv, cgrArgs, true, "")
if !reflect.DeepEqual(expected, rply) {
@@ -2050,9 +2050,9 @@ func TestV1TerminateSessionArgsParseFlags(t *testing.T) {
func TestV1ProcessMessageArgsParseFlags(t *testing.T) {
v1ProcessMsgArgs := new(V1ProcessMessageArgs)
- v1ProcessMsgArgs.CGREvent = new(utils.CGREvent)
+ v1ProcessMsgArgs.CGREvent = new(engine.CGREvent)
eOut := new(V1ProcessMessageArgs)
- eOut.CGREvent = new(utils.CGREvent)
+ eOut.CGREvent = new(engine.CGREvent)
//empty check
strArg := ""
v1ProcessMsgArgs.ParseFlags(strArg, utils.InfieldSep)
@@ -2077,7 +2077,7 @@ func TestV1ProcessMessageArgsParseFlags(t *testing.T) {
strArg = "*accounts;*resources;*routes;*routes_ignore_errors;*routes_event_cost;*attributes:Attr1&Attr2;*thresholds:tr1&tr2&tr3;*stats:st1&st2&st3"
v1ProcessMsgArgs = new(V1ProcessMessageArgs)
- v1ProcessMsgArgs.CGREvent = new(utils.CGREvent)
+ v1ProcessMsgArgs.CGREvent = new(engine.CGREvent)
v1ProcessMsgArgs.ParseFlags(strArg, utils.InfieldSep)
if !reflect.DeepEqual(eOut, v1ProcessMsgArgs) {
t.Errorf("Expecting %+v,\n received: %+v\n", utils.ToJSON(eOut), utils.ToJSON(v1ProcessMsgArgs))
@@ -2102,7 +2102,7 @@ func TestV1ProcessMessageArgsParseFlags(t *testing.T) {
strArg = "*accounts;*resources;*dispatchers;*routes;*routes_ignore_errors;*routes_event_cost;*attributes:Attr1&Attr2;*thresholds:tr1&tr2&tr3;*stats:st1&st2&st3;*fd"
v1ProcessMsgArgs = new(V1ProcessMessageArgs)
- v1ProcessMsgArgs.CGREvent = new(utils.CGREvent)
+ v1ProcessMsgArgs.CGREvent = new(engine.CGREvent)
v1ProcessMsgArgs.ParseFlags(strArg, utils.InfieldSep)
if !reflect.DeepEqual(eOut, v1ProcessMsgArgs) {
t.Errorf("Expecting %+v,\n received: %+v\n", utils.ToJSON(eOut), utils.ToJSON(v1ProcessMsgArgs))
@@ -2125,7 +2125,7 @@ func TestV1ProcessMessageArgsParseFlags(t *testing.T) {
strArg = "*accounts;*resources;*dispatchers;*routes;*routes_ignore_errors;*routes_maxcost:100;*attributes:Attr1&Attr2;*thresholds:tr1&tr2&tr3;*stats:st1&st2&st3"
v1ProcessMsgArgs = new(V1ProcessMessageArgs)
- v1ProcessMsgArgs.CGREvent = new(utils.CGREvent)
+ v1ProcessMsgArgs.CGREvent = new(engine.CGREvent)
v1ProcessMsgArgs.ParseFlags(strArg, utils.InfieldSep)
if !reflect.DeepEqual(eOut, v1ProcessMsgArgs) {
t.Errorf("Expecting %+v,\n received: %+v\n", utils.ToJSON(eOut), utils.ToJSON(v1ProcessMsgArgs))
@@ -2618,7 +2618,7 @@ func TestInitSession(t *testing.T) {
ChargerSProfile: "raw",
AttributeSProfiles: []string{utils.MetaNone},
AlteredFields: []string{"~*req.RunID"},
- CGREvent: args.(*utils.CGREvent),
+ CGREvent: args.(*engine.CGREvent),
},
}
return nil
@@ -2627,7 +2627,7 @@ func TestInitSession(t *testing.T) {
utils.ConcatenatedKey(utils.MetaInternal, utils.MetaChargers): clientConect,
})
sS := NewSessionS(cfg, nil, conMng)
- s, err := sS.initSession(&utils.CGREvent{
+ s, err := sS.initSession(&engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.Category: "call",
@@ -2694,7 +2694,7 @@ func TestBiRPCv1AuthorizeEventNoTenant(t *testing.T) {
if !cancast {
return fmt.Errorf("can't cast")
}
- newArgs, cancast := args.(*utils.CGREvent)
+ newArgs, cancast := args.(*engine.CGREvent)
if !cancast {
return fmt.Errorf("can't cast")
}
@@ -2702,7 +2702,7 @@ func TestBiRPCv1AuthorizeEventNoTenant(t *testing.T) {
return fmt.Errorf("Tenant is missing")
}
*rply = engine.AttrSProcessEventReply{
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestBiRPCv1AuthorizeEventNoTenant",
Time: utils.TimePointer(time.Date(2016, time.January, 5, 18, 30, 49, 0, time.UTC)),
@@ -2731,7 +2731,7 @@ func TestBiRPCv1AuthorizeEventNoTenant(t *testing.T) {
args := &V1AuthorizeArgs{
GetAttributes: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
ID: "TestBiRPCv1AuthorizeEventNoTenant",
Time: utils.TimePointer(time.Date(2016, time.January, 5, 18, 30, 49, 0, time.UTC)),
Event: map[string]any{
@@ -2764,7 +2764,7 @@ func TestBiRPCv1AuthorizeEventWithDigestNoTenant(t *testing.T) {
if !cancast {
return fmt.Errorf("can't cast")
}
- newArgs, cancast := args.(*utils.CGREvent)
+ newArgs, cancast := args.(*engine.CGREvent)
if !cancast {
return fmt.Errorf("can't cast")
}
@@ -2772,7 +2772,7 @@ func TestBiRPCv1AuthorizeEventWithDigestNoTenant(t *testing.T) {
return fmt.Errorf("Tenant is missing")
}
*rply = engine.AttrSProcessEventReply{
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestBiRPCv1AuthorizeEventNoTenant",
Time: utils.TimePointer(time.Date(2016, time.January, 5, 18, 30, 49, 0, time.UTC)),
@@ -2801,7 +2801,7 @@ func TestBiRPCv1AuthorizeEventWithDigestNoTenant(t *testing.T) {
args := &V1AuthorizeArgs{
GetAttributes: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
ID: "TestBiRPCv1AuthorizeEventNoTenant",
Time: utils.TimePointer(time.Date(2016, time.January, 5, 18, 30, 49, 0, time.UTC)),
Event: map[string]any{
@@ -2832,7 +2832,7 @@ func TestBiRPCv1InitiateSessionNoTenant(t *testing.T) {
if !cancast {
return fmt.Errorf("can't cast")
}
- newArgs, cancast := args.(*utils.CGREvent)
+ newArgs, cancast := args.(*engine.CGREvent)
if !cancast {
return fmt.Errorf("can't cast")
}
@@ -2840,7 +2840,7 @@ func TestBiRPCv1InitiateSessionNoTenant(t *testing.T) {
return fmt.Errorf("Tenant is missing")
}
*rply = engine.AttrSProcessEventReply{
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestBiRPCv1AuthorizeEventNoTenant",
Time: utils.TimePointer(time.Date(2016, time.January, 5, 18, 30, 49, 0, time.UTC)),
@@ -2869,7 +2869,7 @@ func TestBiRPCv1InitiateSessionNoTenant(t *testing.T) {
args := &V1InitSessionArgs{
GetAttributes: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
ID: "TestBiRPCv1AuthorizeEventNoTenant",
Time: utils.TimePointer(time.Date(2016, time.January, 5, 18, 30, 49, 0, time.UTC)),
Event: map[string]any{
@@ -2900,7 +2900,7 @@ func TestBiRPCv1InitiateSessionWithDigestNoTenant(t *testing.T) {
if !cancast {
return fmt.Errorf("can't cast")
}
- newArgs, cancast := args.(*utils.CGREvent)
+ newArgs, cancast := args.(*engine.CGREvent)
if !cancast {
return fmt.Errorf("can't cast")
}
@@ -2908,7 +2908,7 @@ func TestBiRPCv1InitiateSessionWithDigestNoTenant(t *testing.T) {
return fmt.Errorf("Tenant is missing")
}
*rply = engine.AttrSProcessEventReply{
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestBiRPCv1AuthorizeEventNoTenant",
Time: utils.TimePointer(time.Date(2016, time.January, 5, 18, 30, 49, 0, time.UTC)),
@@ -2936,7 +2936,7 @@ func TestBiRPCv1InitiateSessionWithDigestNoTenant(t *testing.T) {
args := &V1InitSessionArgs{
GetAttributes: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
ID: "TestBiRPCv1AuthorizeEventNoTenant",
Time: utils.TimePointer(time.Date(2016, time.January, 5, 18, 30, 49, 0, time.UTC)),
Event: map[string]any{
@@ -2965,7 +2965,7 @@ func TestBiRPCv1UpdateSessionNoTenant(t *testing.T) {
if !cancast {
return fmt.Errorf("can't cast")
}
- newArgs, cancast := args.(*utils.CGREvent)
+ newArgs, cancast := args.(*engine.CGREvent)
if !cancast {
return fmt.Errorf("can't cast")
}
@@ -2973,7 +2973,7 @@ func TestBiRPCv1UpdateSessionNoTenant(t *testing.T) {
return fmt.Errorf("Tenant is missing")
}
*rply = engine.AttrSProcessEventReply{
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestBiRPCv1AuthorizeEventNoTenant",
Time: utils.TimePointer(time.Date(2016, time.January, 5, 18, 30, 49, 0, time.UTC)),
@@ -3001,7 +3001,7 @@ func TestBiRPCv1UpdateSessionNoTenant(t *testing.T) {
args := &V1UpdateSessionArgs{
GetAttributes: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
ID: "TestBiRPCv1AuthorizeEventNoTenant",
Time: utils.TimePointer(time.Date(2016, time.January, 5, 18, 30, 49, 0, time.UTC)),
Event: map[string]any{
@@ -3030,7 +3030,7 @@ func TestBiRPCv1TerminateSessionNoTenant(t *testing.T) {
if !cancast {
return fmt.Errorf("can't cast")
}
- newArgs, cancast := args.(*utils.CGREvent)
+ newArgs, cancast := args.(*engine.CGREvent)
if !cancast {
return fmt.Errorf("can't cast")
}
@@ -3051,7 +3051,7 @@ func TestBiRPCv1TerminateSessionNoTenant(t *testing.T) {
args := &V1TerminateSessionArgs{
TerminateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
ID: "TestBiRPCv1AuthorizeEventNoTenant",
Time: utils.TimePointer(time.Date(2016, time.January, 5, 18, 30, 49, 0, time.UTC)),
Event: map[string]any{
@@ -3081,7 +3081,7 @@ func TestBiRPCv1ProcessMessageNoTenant(t *testing.T) {
if !cancast {
return fmt.Errorf("can't cast")
}
- newArgs, cancast := args.(*utils.CGREvent)
+ newArgs, cancast := args.(*engine.CGREvent)
if !cancast {
return fmt.Errorf("can't cast")
}
@@ -3089,7 +3089,7 @@ func TestBiRPCv1ProcessMessageNoTenant(t *testing.T) {
return fmt.Errorf("Tenant is missing")
}
*rply = engine.AttrSProcessEventReply{
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestBiRPCv1AuthorizeEventNoTenant",
Time: utils.TimePointer(time.Date(2016, time.January, 5, 18, 30, 49, 0, time.UTC)),
@@ -3117,7 +3117,7 @@ func TestBiRPCv1ProcessMessageNoTenant(t *testing.T) {
args := &V1ProcessMessageArgs{
GetAttributes: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
ID: "TestBiRPCv1AuthorizeEventNoTenant",
Time: utils.TimePointer(time.Date(2016, time.January, 5, 18, 30, 49, 0, time.UTC)),
Event: map[string]any{
@@ -3149,7 +3149,7 @@ func TestBiRPCv1ProcessEventNoTenant(t *testing.T) {
if !cancast {
return fmt.Errorf("can't cast")
}
- newArgs, cancast := args.(*utils.CGREvent)
+ newArgs, cancast := args.(*engine.CGREvent)
if !cancast {
return fmt.Errorf("can't cast")
}
@@ -3157,7 +3157,7 @@ func TestBiRPCv1ProcessEventNoTenant(t *testing.T) {
return fmt.Errorf("Tenant is missing")
}
*rply = engine.AttrSProcessEventReply{
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestBiRPCv1AuthorizeEventNoTenant",
Time: utils.TimePointer(time.Date(2016, time.January, 5, 18, 30, 49, 0, time.UTC)),
@@ -3185,7 +3185,7 @@ func TestBiRPCv1ProcessEventNoTenant(t *testing.T) {
args := &V1ProcessEventArgs{
Flags: []string{utils.MetaAttributes},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
ID: "TestBiRPCv1AuthorizeEventNoTenant",
Time: utils.TimePointer(time.Date(2016, time.January, 5, 18, 30, 49, 0, time.UTC)),
Event: map[string]any{
diff --git a/sessions/sessions_voice_it_test.go b/sessions/sessions_voice_it_test.go
index e28313ac8..27135386a 100644
--- a/sessions/sessions_voice_it_test.go
+++ b/sessions/sessions_voice_it_test.go
@@ -131,7 +131,7 @@ func testSessionsVoiceMonetaryRefund(t *testing.T) {
usage := time.Minute + 30*time.Second
initArgs := &V1InitSessionArgs{
InitSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionsVoiceMonetaryRefund",
Event: map[string]any{
@@ -171,7 +171,7 @@ func testSessionsVoiceMonetaryRefund(t *testing.T) {
usage = time.Minute
termArgs := &V1TerminateSessionArgs{
TerminateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionsVoiceMonetaryRefund",
Event: map[string]any{
@@ -208,7 +208,7 @@ func testSessionsVoiceVoiceRefund(t *testing.T) {
usage := time.Minute + 30*time.Second
initArgs := &V1InitSessionArgs{
InitSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionsVoiceVoiceRefund",
Event: map[string]any{
@@ -250,7 +250,7 @@ func testSessionsVoiceVoiceRefund(t *testing.T) {
usage = time.Minute
termArgs := &V1TerminateSessionArgs{
TerminateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionsVoiceVoiceRefund",
Event: map[string]any{
@@ -293,7 +293,7 @@ func testSessionsVoiceMixedRefund(t *testing.T) {
usage := time.Minute + 30*time.Second
initArgs := &V1InitSessionArgs{
InitSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionsVoiceMixedRefund",
Event: map[string]any{
@@ -338,7 +338,7 @@ func testSessionsVoiceMixedRefund(t *testing.T) {
usage = time.Minute
termArgs := &V1TerminateSessionArgs{
TerminateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionsVoiceMixedRefund",
Event: map[string]any{
@@ -390,7 +390,7 @@ func testSessionsVoiceLastUsed(t *testing.T) {
usage := 2 * time.Minute
initArgs := &V1InitSessionArgs{
InitSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionsVoiceLastUsed",
Event: map[string]any{
@@ -429,7 +429,7 @@ func testSessionsVoiceLastUsed(t *testing.T) {
lastUsage := time.Minute + 30*time.Second
updateArgs := &V1UpdateSessionArgs{
UpdateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionsVoiceLastUsed",
Event: map[string]any{
@@ -466,7 +466,7 @@ func testSessionsVoiceLastUsed(t *testing.T) {
lastUsage = 2*time.Minute + 30*time.Second
updateArgs = &V1UpdateSessionArgs{
UpdateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionsVoiceLastUsed",
Event: map[string]any{
@@ -504,7 +504,7 @@ func testSessionsVoiceLastUsed(t *testing.T) {
usage = time.Minute
termArgs := &V1TerminateSessionArgs{
TerminateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionsVoiceLastUsed",
Event: map[string]any{
@@ -551,7 +551,7 @@ func testSessionsVoiceLastUsedEnd(t *testing.T) {
usage := 2 * time.Minute
initArgs := &V1InitSessionArgs{
InitSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionsVoiceLastUsedEnd",
Event: map[string]any{
@@ -590,7 +590,7 @@ func testSessionsVoiceLastUsedEnd(t *testing.T) {
lastUsage := 30 * time.Second
updateArgs := &V1UpdateSessionArgs{
UpdateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionsVoiceLastUsedEnd",
Event: map[string]any{
@@ -628,7 +628,7 @@ func testSessionsVoiceLastUsedEnd(t *testing.T) {
termArgs := &V1TerminateSessionArgs{
TerminateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionsVoiceLastUsedEnd",
Event: map[string]any{
@@ -673,7 +673,7 @@ func testSessionsVoiceLastUsedNotFixed(t *testing.T) {
usage := 2 * time.Minute
initArgs := &V1InitSessionArgs{
InitSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionsVoiceLastUsedNotFixed",
Event: map[string]any{
@@ -713,7 +713,7 @@ func testSessionsVoiceLastUsedNotFixed(t *testing.T) {
lastUsage := 12 * time.Second
updateArgs := &V1UpdateSessionArgs{
UpdateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionsVoiceLastUsedNotFixed",
Event: map[string]any{
@@ -750,7 +750,7 @@ func testSessionsVoiceLastUsedNotFixed(t *testing.T) {
termArgs := &V1TerminateSessionArgs{
TerminateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionsVoiceLastUsedNotFixed",
Event: map[string]any{
@@ -796,7 +796,7 @@ func testSessionsVoiceSessionTTL(t *testing.T) {
usage := 2 * time.Minute
initArgs := &V1InitSessionArgs{
InitSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionsVoiceSessionTTL",
Event: map[string]any{
@@ -864,7 +864,7 @@ func testSessionsVoiceSessionTTL(t *testing.T) {
lastUsage := 30 * time.Second
updateArgs := &V1UpdateSessionArgs{
UpdateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionsVoiceSessionTTL",
Event: map[string]any{
@@ -969,7 +969,7 @@ func testSessionsVoiceSessionTTLWithRelocate(t *testing.T) {
usage := 2 * time.Minute
initArgs := &V1InitSessionArgs{
InitSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionsVoiceSessionTTLWithRelocate",
Event: map[string]any{
@@ -1025,7 +1025,7 @@ func testSessionsVoiceSessionTTLWithRelocate(t *testing.T) {
lastUsage := 30 * time.Second
updateArgs := &V1UpdateSessionArgs{
UpdateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionsVoiceSessionTTLWithRelocate",
Event: map[string]any{
@@ -1142,7 +1142,7 @@ func testSessionsVoiceRelocateWithOriginIDPrefix(t *testing.T) {
usage := 2 * time.Minute
initArgs := &V1InitSessionArgs{
InitSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionsVoiceRelocateWithOriginIDPrefix",
Event: map[string]any{
@@ -1198,7 +1198,7 @@ func testSessionsVoiceRelocateWithOriginIDPrefix(t *testing.T) {
lastUsage := 30 * time.Second
updateArgs := &V1UpdateSessionArgs{
UpdateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionsVoiceSessionTTLWithRelocate",
Event: map[string]any{
@@ -1253,7 +1253,7 @@ func testSessionsVoiceRelocateWithOriginIDPrefix(t *testing.T) {
termArgs := &V1TerminateSessionArgs{
TerminateSession: true,
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestSessionsVoiceLastUsedNotFixed",
Event: map[string]any{
diff --git a/sessions/sessionscover_test.go b/sessions/sessionscover_test.go
index b0144ec97..64ba73428 100644
--- a/sessions/sessionscover_test.go
+++ b/sessions/sessionscover_test.go
@@ -1358,12 +1358,12 @@ func TestNewSession(t *testing.T) {
testMock1 := &testMockClients{
calls: map[string]func(args any, reply any) error{
utils.ChargerSv1ProcessEvent: func(args any, reply any) error {
- if args.(*utils.CGREvent).ID == utils.EmptyString {
+ if args.(*engine.CGREvent).ID == utils.EmptyString {
return utils.ErrNotImplemented
}
chrgrs := []*engine.ChrgSProcessEventReply{
{ChargerSProfile: "TEST_PROFILE1",
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TEST_ID",
Event: map[string]any{
@@ -1386,7 +1386,7 @@ func TestNewSession(t *testing.T) {
sessions := NewSessionS(cfg, dm, connMgr)
- cgrEv := &utils.CGREvent{
+ cgrEv := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TEST_ID",
Event: map[string]any{
@@ -1478,7 +1478,7 @@ func TestProcessChargerS(t *testing.T) {
sessions := NewSessionS(cfg, dm, connMgr)
- cgrEv := &utils.CGREvent{
+ cgrEv := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TEST_ID",
Event: map[string]any{
@@ -1768,7 +1768,7 @@ func TestAuthEvent(t *testing.T) {
utils.ChargerSv1ProcessEvent: func(args any, reply any) error {
chrgrs := []*engine.ChrgSProcessEventReply{
{ChargerSProfile: "TEST_PROFILE1",
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TEST_ID",
Event: map[string]any{
@@ -1793,7 +1793,7 @@ func TestAuthEvent(t *testing.T) {
dm := engine.NewDataManager(data, cfg.CacheCfg(), connMgr)
sessions := NewSessionS(cfg, dm, connMgr)
- cgrEv := &utils.CGREvent{
+ cgrEv := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TEST_ID",
Event: map[string]any{
@@ -1841,7 +1841,7 @@ func TestAuthEventMockCall(t *testing.T) {
utils.ChargerSv1ProcessEvent: func(args any, reply any) error {
chrgrs := []*engine.ChrgSProcessEventReply{
{ChargerSProfile: "TEST_PROFILE1",
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TEST_ID",
Event: map[string]any{
@@ -1866,7 +1866,7 @@ func TestAuthEventMockCall(t *testing.T) {
dm := engine.NewDataManager(data, cfg.CacheCfg(), connMgr)
sessions := NewSessionS(cfg, dm, connMgr)
- cgrEv := &utils.CGREvent{
+ cgrEv := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TEST_ID",
Event: map[string]any{
@@ -1909,7 +1909,7 @@ func TestChargeEvent(t *testing.T) {
utils.ChargerSv1ProcessEvent: func(args any, reply any) error {
chrgrs := []*engine.ChrgSProcessEventReply{
{ChargerSProfile: "TEST_PROFILE1",
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TEST_ID",
Event: map[string]any{
@@ -1918,7 +1918,7 @@ func TestChargeEvent(t *testing.T) {
},
}},
}
- if args.(*utils.CGREvent).Tenant != "cgrates.org" {
+ if args.(*engine.CGREvent).Tenant != "cgrates.org" {
chrgrs[0].CGREvent.Event[utils.RequestType] = utils.MetaPrepaid
}
*reply.(*[]*engine.ChrgSProcessEventReply) = chrgrs
@@ -1944,7 +1944,7 @@ func TestChargeEvent(t *testing.T) {
dm := engine.NewDataManager(data, cfg.CacheCfg(), connMgr)
sessions := NewSessionS(cfg, dm, connMgr)
- cgrEv := &utils.CGREvent{
+ cgrEv := &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TEST_ID",
Event: map[string]any{
@@ -2392,7 +2392,7 @@ func TestBiRPCv1AuthorizeEvent(t *testing.T) {
calls: map[string]func(args any, reply any) error{
utils.AttributeSv1ProcessEvent: func(args any, reply any) error {
cgrEv := engine.AttrSProcessEventReply{
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
ID: "TestID",
Tenant: "cgrates.org",
Event: map[string]any{},
@@ -2413,7 +2413,7 @@ func TestBiRPCv1AuthorizeEvent(t *testing.T) {
dm := engine.NewDataManager(data, cfg.CacheCfg(), connMgr)
sessions := NewSessionS(cfg, dm, connMgr)
- cgrEvent := &utils.CGREvent{
+ cgrEvent := &engine.CGREvent{
ID: "TestID",
Event: map[string]any{
utils.Usage: "10s",
@@ -2486,7 +2486,7 @@ func TestBiRPCv1AuthorizeEvent2(t *testing.T) {
utils.ChargerSv1ProcessEvent: func(args any, reply any) error {
cghrgs := []*engine.ChrgSProcessEventReply{
{
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestID",
Event: map[string]any{
@@ -2499,7 +2499,7 @@ func TestBiRPCv1AuthorizeEvent2(t *testing.T) {
return nil
},
utils.ResourceSv1AuthorizeResources: func(args any, reply any) error {
- if args.(*utils.CGREvent).Tenant == "new_tenant" {
+ if args.(*engine.CGREvent).Tenant == "new_tenant" {
return utils.ErrNotImplemented
}
return nil
@@ -2533,7 +2533,7 @@ func TestBiRPCv1AuthorizeEvent2(t *testing.T) {
dm := engine.NewDataManager(data, cfg.CacheCfg(), connMgr)
sessions := NewSessionS(cfg, dm, connMgr)
- cgrEvent := &utils.CGREvent{
+ cgrEvent := &engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.Usage: "10s",
@@ -2621,7 +2621,7 @@ func TestBiRPCv1AuthorizeEventWithDigest(t *testing.T) {
calls: map[string]func(args any, reply any) error{
utils.AttributeSv1ProcessEvent: func(args any, reply any) error {
cgrEv := engine.AttrSProcessEventReply{
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
ID: "TestID",
Tenant: "cgrates.org",
Event: map[string]any{},
@@ -2634,7 +2634,7 @@ func TestBiRPCv1AuthorizeEventWithDigest(t *testing.T) {
utils.ChargerSv1ProcessEvent: func(args any, reply any) error {
cghrgs := []*engine.ChrgSProcessEventReply{
{
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestID",
Event: map[string]any{
@@ -2648,7 +2648,7 @@ func TestBiRPCv1AuthorizeEventWithDigest(t *testing.T) {
return nil
},
utils.ResourceSv1AuthorizeResources: func(args any, reply any) error {
- if args.(*utils.CGREvent).Tenant == "new_tenant" {
+ if args.(*engine.CGREvent).Tenant == "new_tenant" {
return utils.ErrNotImplemented
}
return nil
@@ -2693,7 +2693,7 @@ func TestBiRPCv1AuthorizeEventWithDigest(t *testing.T) {
dm := engine.NewDataManager(data, cfg.CacheCfg(), connMgr)
sessions := NewSessionS(cfg, dm, connMgr)
- cgrEvent := &utils.CGREvent{
+ cgrEvent := &engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.Usage: "10s",
@@ -2736,7 +2736,7 @@ func TestBiRPCv1InitiateSession1(t *testing.T) {
utils.ChargerSv1ProcessEvent: func(args any, reply any) error {
cghrgs := []*engine.ChrgSProcessEventReply{
{
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestID",
Event: map[string]any{
@@ -2750,25 +2750,25 @@ func TestBiRPCv1InitiateSession1(t *testing.T) {
return nil
},
utils.ResourceSv1AuthorizeResources: func(args any, reply any) error {
- if args.(*utils.CGREvent).Tenant == "new_tenant" {
+ if args.(*engine.CGREvent).Tenant == "new_tenant" {
return utils.ErrNotImplemented
}
return nil
},
utils.ResourceSv1AllocateResources: func(args any, reply any) error {
- usageID := utils.IfaceAsString(args.(*utils.CGREvent).APIOpts[utils.OptsResourcesUsageID])
+ usageID := utils.IfaceAsString(args.(*engine.CGREvent).APIOpts[utils.OptsResourcesUsageID])
if usageID == "ORIGIN_ID" {
return utils.ErrNotImplemented
}
return nil
},
utils.AttributeSv1ProcessEvent: func(args any, reply any) error {
- if attrIDs, err := utils.IfaceAsSliceString(args.(*utils.CGREvent).APIOpts[utils.OptsAttributesProfileIDs]); err == nil &&
+ if attrIDs, err := utils.IfaceAsSliceString(args.(*engine.CGREvent).APIOpts[utils.OptsAttributesProfileIDs]); err == nil &&
len(attrIDs) != 0 {
return utils.ErrNotImplemented
}
attrRply := engine.AttrSProcessEventReply{
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestID",
Event: map[string]any{
@@ -2798,7 +2798,7 @@ func TestBiRPCv1InitiateSession1(t *testing.T) {
dm := engine.NewDataManager(data, cfg.CacheCfg(), connMgr)
sessions := NewSessionS(cfg, dm, connMgr)
- cgrEvent := &utils.CGREvent{
+ cgrEvent := &engine.CGREvent{
Event: map[string]any{
utils.Usage: "10s",
utils.OriginID: "TEST_ID",
@@ -2865,7 +2865,7 @@ func TestBiRPCv1InitiateSession1(t *testing.T) {
t.Errorf("Expected %+v, received %+v", expected, err)
}
- cgrEvent = &utils.CGREvent{
+ cgrEvent = &engine.CGREvent{
ID: "Test_id",
Tenant: "cgrates.org",
Event: map[string]any{
@@ -2899,7 +2899,7 @@ func TestBiRPCv1InitiateSession2(t *testing.T) {
utils.ChargerSv1ProcessEvent: func(args any, reply any) error {
cghrgs := []*engine.ChrgSProcessEventReply{
{
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestID",
Event: map[string]any{
@@ -2908,14 +2908,14 @@ func TestBiRPCv1InitiateSession2(t *testing.T) {
},
},
}
- if args.(*utils.CGREvent).ID == "PREPAID" {
+ if args.(*engine.CGREvent).ID == "PREPAID" {
cghrgs[0].CGREvent.Event[utils.RequestType] = utils.MetaPrepaid
}
*reply.(*[]*engine.ChrgSProcessEventReply) = cghrgs
return nil
},
utils.ResourceSv1AuthorizeResources: func(args any, reply any) error {
- if args.(*utils.CGREvent).Tenant == "new_tenant" {
+ if args.(*engine.CGREvent).Tenant == "new_tenant" {
return utils.ErrNotImplemented
}
return nil
@@ -2940,7 +2940,7 @@ func TestBiRPCv1InitiateSession2(t *testing.T) {
dm := engine.NewDataManager(data, cfg.CacheCfg(), connMgr)
sessions := NewSessionS(cfg, dm, connMgr)
- cgrEvent := &utils.CGREvent{
+ cgrEvent := &engine.CGREvent{
ID: "Test_id",
Tenant: "cgrates.org",
Event: map[string]any{
@@ -2989,7 +2989,7 @@ func TestBiRPCv1InitiateSession2(t *testing.T) {
}
//is prepaid
- cgrEvent = &utils.CGREvent{
+ cgrEvent = &engine.CGREvent{
ID: "PREPAID",
Event: map[string]any{
utils.Usage: "1s",
@@ -3015,7 +3015,7 @@ func TestBiRPCv1InitiateSessionWithDigest(t *testing.T) {
calls: map[string]func(args any, reply any) error{
utils.AttributeSv1ProcessEvent: func(args any, reply any) error {
cgrEv := engine.AttrSProcessEventReply{
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
ID: "TestID",
Tenant: "cgrates.org",
Event: map[string]any{},
@@ -3028,7 +3028,7 @@ func TestBiRPCv1InitiateSessionWithDigest(t *testing.T) {
utils.ChargerSv1ProcessEvent: func(args any, reply any) error {
cghrgs := []*engine.ChrgSProcessEventReply{
{
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestID",
Event: map[string]any{
@@ -3084,7 +3084,7 @@ func TestBiRPCv1InitiateSessionWithDigest(t *testing.T) {
dm := engine.NewDataManager(data, cfg.CacheCfg(), connMgr)
sessions := NewSessionS(cfg, dm, connMgr)
- cgrEvent := &utils.CGREvent{
+ cgrEvent := &engine.CGREvent{
Tenant: "cgrates.org",
Event: map[string]any{
utils.Usage: "10s",
@@ -3127,7 +3127,7 @@ func TestBiRPCv1UpdateSession1(t *testing.T) {
clnt := &testMockClients{
calls: map[string]func(args any, reply any) error{
utils.AttributeSv1ProcessEvent: func(args any, reply any) error {
- if attrIDs, err := utils.IfaceAsSliceString(args.(*utils.CGREvent).APIOpts[utils.OptsAttributesProfileIDs]); err == nil &&
+ if attrIDs, err := utils.IfaceAsSliceString(args.(*engine.CGREvent).APIOpts[utils.OptsAttributesProfileIDs]); err == nil &&
len(attrIDs) == 1 {
return utils.ErrNotImplemented
}
@@ -3147,7 +3147,7 @@ func TestBiRPCv1UpdateSession1(t *testing.T) {
dm := engine.NewDataManager(data, cfg.CacheCfg(), connMgr)
sessions := NewSessionS(cfg, dm, connMgr)
- cgrEvent := &utils.CGREvent{
+ cgrEvent := &engine.CGREvent{
Event: map[string]any{
utils.Usage: "10s",
utils.OriginID: "TEST_ID",
@@ -3210,7 +3210,7 @@ func TestBiRPCv1UpdateSession2(t *testing.T) {
utils.ChargerSv1ProcessEvent: func(args any, reply any) error {
cghrgs := []*engine.ChrgSProcessEventReply{
{
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestID",
Event: map[string]any{
@@ -3234,7 +3234,7 @@ func TestBiRPCv1UpdateSession2(t *testing.T) {
dm := engine.NewDataManager(data, cfg.CacheCfg(), connMgr)
sessions := NewSessionS(cfg, dm, connMgr)
- cgrEvent := &utils.CGREvent{
+ cgrEvent := &engine.CGREvent{
ID: "test_id",
Event: map[string]any{
utils.Usage: "invalid_dur_format",
@@ -3284,7 +3284,7 @@ func TestBiRPCv1TerminateSession1(t *testing.T) {
utils.ChargerSv1ProcessEvent: func(args any, reply any) error {
cghrgs := []*engine.ChrgSProcessEventReply{
{
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TestID",
Event: map[string]any{
@@ -3314,7 +3314,7 @@ func TestBiRPCv1TerminateSession1(t *testing.T) {
dm := engine.NewDataManager(data, cfg.CacheCfg(), connMgr)
sessions := NewSessionS(cfg, dm, connMgr)
- cgrEvent := &utils.CGREvent{
+ cgrEvent := &engine.CGREvent{
ID: "test_id",
Event: map[string]any{
utils.Usage: "10s",
@@ -3395,7 +3395,7 @@ func TestBiRPCv1TerminateSession1(t *testing.T) {
}
cgrEvent.Event[utils.Usage] = "1m"
- cgrEvent = &utils.CGREvent{
+ cgrEvent = &engine.CGREvent{
ID: "test_id",
Event: map[string]any{
utils.Usage: "10s",
@@ -3430,7 +3430,7 @@ func TestBiRPCv1TerminateSession2(t *testing.T) {
clnt := &testMockClients{
calls: map[string]func(args any, reply any) error{
utils.ResourceSv1ReleaseResources: func(args any, reply any) error {
- if args.(*utils.CGREvent).Tenant == "CHANGED_ID" {
+ if args.(*engine.CGREvent).Tenant == "CHANGED_ID" {
return nil
}
return utils.ErrNotImplemented
@@ -3448,7 +3448,7 @@ func TestBiRPCv1TerminateSession2(t *testing.T) {
dm := engine.NewDataManager(data, cfg.CacheCfg(), connMgr)
sessions := NewSessionS(cfg, dm, connMgr)
- cgrEvent := &utils.CGREvent{
+ cgrEvent := &engine.CGREvent{
ID: "test_id",
Event: map[string]any{
utils.Usage: "10s",
@@ -3496,7 +3496,7 @@ func TestBiRPCv1ProcessCDR(t *testing.T) {
dm := engine.NewDataManager(data, cfg.CacheCfg(), nil)
sessions := NewSessionS(cfg, dm, nil)
- cgrEvent := &utils.CGREvent{
+ cgrEvent := &engine.CGREvent{
Event: map[string]any{
utils.Usage: "10s",
utils.OriginID: "TEST_ID",
@@ -3533,7 +3533,7 @@ func TestBiRPCv1ProcessMessage1(t *testing.T) {
clnt := &testMockClients{
calls: map[string]func(args any, reply any) error{
utils.AttributeSv1ProcessEvent: func(args any, reply any) error {
- if args.(*utils.CGREvent).ID == "test_id" {
+ if args.(*engine.CGREvent).ID == "test_id" {
return nil
}
return utils.ErrNotImplemented
@@ -3552,7 +3552,7 @@ func TestBiRPCv1ProcessMessage1(t *testing.T) {
dm := engine.NewDataManager(data, cfg.CacheCfg(), connMgr)
sessions := NewSessionS(cfg, dm, connMgr)
- cgrEvent := &utils.CGREvent{
+ cgrEvent := &engine.CGREvent{
ID: "test_id",
Event: map[string]any{
utils.Usage: "10s",
@@ -3612,7 +3612,7 @@ func TestBiRPCv1ProcessMessage2(t *testing.T) {
clnt := &testMockClients{
calls: map[string]func(args any, reply any) error{
utils.ResourceSv1AllocateResources: func(args any, reply any) error {
- usageID := utils.IfaceAsString(args.(*utils.CGREvent).APIOpts[utils.OptsResourcesUsageID])
+ usageID := utils.IfaceAsString(args.(*engine.CGREvent).APIOpts[utils.OptsResourcesUsageID])
if usageID == "ORIGIN_ID" {
return nil
}
@@ -3631,7 +3631,7 @@ func TestBiRPCv1ProcessMessage2(t *testing.T) {
utils.ChargerSv1ProcessEvent: func(args any, reply any) error {
chrgrs := []*engine.ChrgSProcessEventReply{
{ChargerSProfile: "TEST_PROFILE1",
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TEST_ID",
Event: map[string]any{
@@ -3658,7 +3658,7 @@ func TestBiRPCv1ProcessMessage2(t *testing.T) {
dm := engine.NewDataManager(data, cfg.CacheCfg(), connMgr)
sessions := NewSessionS(cfg, dm, connMgr)
- cgrEvent := &utils.CGREvent{
+ cgrEvent := &engine.CGREvent{
ID: "test_id",
Event: map[string]any{
utils.Usage: "10s",
@@ -3720,7 +3720,7 @@ func TestBiRPCv1ProcessEvent(t *testing.T) {
utils.ChargerSv1ProcessEvent: func(args any, reply any) error {
chrgrs := []*engine.ChrgSProcessEventReply{
{ChargerSProfile: "TEST_PROFILE1",
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TEST_ID",
Event: map[string]any{
@@ -3733,7 +3733,7 @@ func TestBiRPCv1ProcessEvent(t *testing.T) {
},
utils.AttributeSv1ProcessEvent: func(args any, reply any) error {
attrs := engine.AttrSProcessEventReply{
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TEST_ID",
Event: map[string]any{
@@ -3741,14 +3741,14 @@ func TestBiRPCv1ProcessEvent(t *testing.T) {
},
},
}
- if args.(*utils.CGREvent).ID == "CHANGED_ID" {
+ if args.(*engine.CGREvent).ID == "CHANGED_ID" {
*reply.(*engine.AttrSProcessEventReply) = attrs
return nil
}
return utils.ErrNotImplemented
},
utils.RouteSv1GetRoutes: func(args any, reply any) error {
- if args.(*utils.CGREvent).ID == "SECOND_ID" {
+ if args.(*engine.CGREvent).ID == "SECOND_ID" {
*reply.(*engine.SortedRoutesList) = engine.SortedRoutesList{{
ProfileID: "ROUTE_PRFID",
Routes: []*engine.SortedRoute{
@@ -3780,7 +3780,7 @@ func TestBiRPCv1ProcessEvent(t *testing.T) {
dm := engine.NewDataManager(data, cfg.CacheCfg(), connMgr)
sessions := NewSessionS(cfg, dm, connMgr)
- cgrEvent := &utils.CGREvent{
+ cgrEvent := &engine.CGREvent{
ID: "test_id",
Event: map[string]any{
utils.Usage: "10s",
@@ -3862,7 +3862,7 @@ func TestBiRPCv1ProcessEventStats(t *testing.T) {
utils.ChargerSv1ProcessEvent: func(args any, reply any) error {
chrgrs := []*engine.ChrgSProcessEventReply{
{ChargerSProfile: "TEST_PROFILE1",
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TEST_ID",
Event: map[string]any{
@@ -3891,7 +3891,7 @@ func TestBiRPCv1ProcessEventStats(t *testing.T) {
dm := engine.NewDataManager(data, cfg.CacheCfg(), connMgr)
sessions := NewSessionS(cfg, dm, connMgr)
- cgrEvent := &utils.CGREvent{
+ cgrEvent := &engine.CGREvent{
ID: "test_id",
Event: map[string]any{
utils.Usage: "10s",
@@ -3966,7 +3966,7 @@ func TestBiRPCv1ProcessEventResources(t *testing.T) {
utils.ConcatenatedKey(utils.MetaResources, utils.MetaDerivedReply),
utils.ConcatenatedKey(utils.MetaResources, utils.MetaAuthorize),
utils.MetaChargers},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testBiRPCv1ProcessEventStatsResources",
Event: map[string]any{
@@ -4043,12 +4043,12 @@ func TestBiRPCv1ProcessEventRals1(t *testing.T) {
clnt := &testMockClients{
calls: map[string]func(args any, reply any) error{
utils.ChargerSv1ProcessEvent: func(args any, reply any) error {
- if args.(*utils.CGREvent).ID != "RALS_ID" {
+ if args.(*engine.CGREvent).ID != "RALS_ID" {
return nil
}
chrgrs := []*engine.ChrgSProcessEventReply{
{ChargerSProfile: "TEST_PROFILE1",
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TEST_ID",
Event: map[string]any{
@@ -4087,7 +4087,7 @@ func TestBiRPCv1ProcessEventRals1(t *testing.T) {
utils.ConcatenatedKey(utils.MetaRALs, utils.MetaCost),
utils.ConcatenatedKey(utils.MetaRALs, utils.MetaDerivedReply),
utils.MetaChargers},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testBiRPCv1ProcessEventStatsResources",
Event: map[string]any{
@@ -4158,7 +4158,7 @@ func TestBiRPCv1ProcessEventRals2(t *testing.T) {
utils.ChargerSv1ProcessEvent: func(args any, reply any) error {
chrgrs := []*engine.ChrgSProcessEventReply{
{ChargerSProfile: "TEST_PROFILE1",
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TEST_ID",
Event: map[string]any{
@@ -4199,7 +4199,7 @@ func TestBiRPCv1ProcessEventRals2(t *testing.T) {
Flags: []string{utils.MetaRALs,
utils.ConcatenatedKey(utils.MetaRALs, utils.MetaInitiate),
utils.MetaChargers},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testBiRPCv1ProcessEventStatsResources",
Event: map[string]any{
@@ -4297,7 +4297,7 @@ func TestBiRPCv1ProcessEventCDRs11(t *testing.T) {
utils.ChargerSv1ProcessEvent: func(args any, reply any) error {
chrgrs := []*engine.ChrgSProcessEventReply{
{ChargerSProfile: "TEST_PROFILE1",
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "TEST_ID",
Event: map[string]any{
@@ -4331,7 +4331,7 @@ func TestBiRPCv1ProcessEventCDRs11(t *testing.T) {
Flags: []string{utils.MetaCDRs,
utils.ConcatenatedKey(utils.MetaRALs, utils.MetaDerivedReply),
utils.MetaChargers},
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "testBiRPCv1ProcessEventStatsResources",
Event: map[string]any{
@@ -4409,7 +4409,7 @@ func TestBiRPCv1GetCost(t *testing.T) {
calls: map[string]func(args any, reply any) error{
utils.AttributeSv1ProcessEvent: func(args any, reply any) error {
attr := &engine.AttrSProcessEventReply{
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "ATTRIBUTES",
Event: map[string]any{
@@ -4442,7 +4442,7 @@ func TestBiRPCv1GetCost(t *testing.T) {
utils.ConcatenatedKey(utils.MetaRALs, utils.MetaDerivedReply),
utils.MetaChargers},
}
- cgrEvent := &utils.CGREvent{
+ cgrEvent := &engine.CGREvent{
ID: "TestBiRPCv1GetCost",
Event: map[string]any{
utils.Tenant: "cgrates.org",
@@ -4492,7 +4492,7 @@ func TestBiRPCv1GetCost(t *testing.T) {
expectedVal := V1GetCostReply{
Attributes: &engine.AttrSProcessEventReply{
- CGREvent: &utils.CGREvent{
+ CGREvent: &engine.CGREvent{
Tenant: "cgrates.org",
ID: "ATTRIBUTES",
Event: map[string]any{
diff --git a/utils/cgrevent.go b/utils/cgrevent.go
deleted file mode 100644
index 7f26783b4..000000000
--- a/utils/cgrevent.go
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
-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 utils
-
-import (
- "strings"
- "time"
-)
-
-// CGREvent is a generic event processed by CGR services
-type CGREvent struct {
- Tenant string
- ID string
- Time *time.Time // event time
- Event map[string]any
- APIOpts map[string]any
- clnb bool //rpcclonable
-}
-
-func (ev *CGREvent) HasField(fldName string) (has bool) {
- _, has = ev.Event[fldName]
- return
-}
-
-func (ev *CGREvent) CheckMandatoryFields(fldNames []string) error {
- for _, fldName := range fldNames {
- if _, has := ev.Event[fldName]; !has {
- return NewErrMandatoryIeMissing(fldName)
- }
- }
- return nil
-}
-
-// FieldAsString returns a field as string instance
-func (ev *CGREvent) FieldAsString(fldName string) (val string, err error) {
- iface, has := ev.Event[fldName]
- if !has {
- return "", ErrNotFound
- }
- return IfaceAsString(iface), nil
-}
-
-// OptAsString returns an option as string
-func (ev *CGREvent) OptAsString(optName string) (val string, err error) {
- iface, has := ev.APIOpts[optName]
- if !has {
- return "", ErrNotFound
- }
- return IfaceAsString(iface), nil
-}
-
-// OptAsInt64 returns an option as int64
-func (ev *CGREvent) OptAsInt64(optName string) (int64, error) {
- iface, has := ev.APIOpts[optName]
- if !has {
- return 0, ErrNotFound
- }
- return IfaceAsTInt64(iface)
-}
-
-// FieldAsTime returns a field as Time instance
-func (ev *CGREvent) FieldAsTime(fldName string, timezone string) (t time.Time, err error) {
- iface, has := ev.Event[fldName]
- if !has {
- err = ErrNotFound
- return
- }
- return IfaceAsTime(iface, timezone)
-}
-
-// FieldAsDuration returns a field as Duration instance
-func (ev *CGREvent) FieldAsDuration(fldName string) (d time.Duration, err error) {
- iface, has := ev.Event[fldName]
- if !has {
- err = ErrNotFound
- return
- }
- return IfaceAsDuration(iface)
-}
-
-// OptAsDuration returns an option as Duration instance
-func (ev *CGREvent) OptAsDuration(optName string) (d time.Duration, err error) {
- iface, has := ev.APIOpts[optName]
- if !has {
- err = ErrNotFound
- return
- }
- return IfaceAsDuration(iface)
-}
-
-// FieldAsFloat64 returns a field as float64 instance
-func (ev *CGREvent) FieldAsFloat64(fldName string) (f float64, err error) {
- iface, has := ev.Event[fldName]
- if !has {
- return f, ErrNotFound
- }
- return IfaceAsFloat64(iface)
-}
-
-// FieldAsInt64 returns a field as int64 instance
-func (ev *CGREvent) FieldAsInt64(fldName string) (f int64, err error) {
- iface, has := ev.Event[fldName]
- if !has {
- return f, ErrNotFound
- }
- return IfaceAsInt64(iface)
-}
-
-func (ev *CGREvent) TenantID() string {
- return ConcatenatedKey(ev.Tenant, ev.ID)
-}
-
-func (ev *CGREvent) Clone() (clned *CGREvent) {
- clned = &CGREvent{
- Tenant: ev.Tenant,
- ID: ev.ID,
- Event: make(map[string]any),
- APIOpts: make(map[string]any),
- }
- if ev.Time != nil {
- clned.Time = new(time.Time)
- *clned.Time = *ev.Time
- }
- for k, v := range ev.Event {
- clned.Event[k] = v
- }
- for opt, val := range ev.APIOpts {
- clned.APIOpts[opt] = val
- }
- return
-}
-
-// AsDataProvider returns the CGREvent as MapStorage with *opts and *req paths set
-func (cgrEv *CGREvent) AsDataProvider() (ev DataProvider) {
- return MapStorage{
- MetaOpts: cgrEv.APIOpts,
- MetaReq: cgrEv.Event,
- }
-}
-
-// EventWithFlags is used where flags are needed to mark processing
-type EventWithFlags struct {
- Flags []string
- Event map[string]any
-}
-
-// GetRoutePaginatorFromOpts will consume supplierPaginator if present
-func GetRoutePaginatorFromOpts(ev map[string]any) (args Paginator, err error) {
- if ev == nil {
- return
- }
- //check if we have suppliersLimit in event and in case it has add it in args
- limitIface, hasRoutesLimit := ev[OptsRoutesLimit]
- if hasRoutesLimit {
- delete(ev, OptsRoutesLimit)
- var limit int64
- if limit, err = IfaceAsInt64(limitIface); err != nil {
- return
- }
- args = Paginator{
- Limit: IntPointer(int(limit)),
- }
- }
- //check if we have offset in event and in case it has add it in args
- offsetIface, hasRoutesOffset := ev[OptsRoutesOffset]
- if !hasRoutesOffset {
- return
- }
- delete(ev, OptsRoutesOffset)
- var offset int64
- if offset, err = IfaceAsInt64(offsetIface); err != nil {
- return
- }
- if !hasRoutesLimit { //in case we don't have limit, but we have offset we need to initialize the struct
- args = Paginator{
- Offset: IntPointer(int(offset)),
- }
- return
- }
- args.Offset = IntPointer(int(offset))
- return
-}
-
-// NMAsCGREvent builds a CGREvent considering Time as time.Now()
-// and Event as linear map[string]any with joined paths
-// treats particular case when the value of map is []*NMItem - used in agents/AgentRequest
-func NMAsCGREvent(nM *OrderedNavigableMap, tnt string, pathSep string, opts MapStorage) (cgrEv *CGREvent) {
- if nM == nil {
- return
- }
- el := nM.GetFirstElement()
- if el == nil {
- return
- }
- cgrEv = &CGREvent{
- Tenant: tnt,
- ID: UUIDSha1Prefix(),
- Time: TimePointer(time.Now()),
- Event: make(map[string]any),
- APIOpts: opts,
- }
- for ; el != nil; el = el.Next() {
- path := el.Value
- val, _ := nM.Field(path) // this should never return error cause we get the path from the order
- if val.AttributeID != "" {
- continue
- }
- path = path[:len(path)-1] // remove the last index
- opath := strings.Join(path, NestingSep)
- if _, has := cgrEv.Event[opath]; !has {
- cgrEv.Event[opath] = val.Data // first item which is not an attribute will become the value
- }
- }
- return
-}
-
-// SetCloneable sets if the args should be clonned on internal connections
-func (attr *CGREvent) SetCloneable(rpcCloneable bool) {
- attr.clnb = rpcCloneable
-}
-
-// RPCClone implements rpcclient.RPCCloner interface
-func (attr *CGREvent) RPCClone() (any, error) {
- if !attr.clnb {
- return attr, nil
- }
- return attr.Clone(), nil
-}
diff --git a/utils/cgrevent_test.go b/utils/cgrevent_test.go
deleted file mode 100644
index e265932b8..000000000
--- a/utils/cgrevent_test.go
+++ /dev/null
@@ -1,661 +0,0 @@
-/*
-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 utils
-
-import (
- "reflect"
- "strings"
- "testing"
- "time"
-)
-
-func TestCGREventHasField(t *testing.T) {
- //empty check
- cgrEvent := new(CGREvent)
- rcv := cgrEvent.HasField("")
- if rcv {
- t.Error("Expecting: false, received: ", rcv)
- }
- //normal check
- cgrEvent = &CGREvent{
- Event: map[string]any{
- Usage: 20 * time.Second,
- },
- }
- rcv = cgrEvent.HasField("Usage")
- if !rcv {
- t.Error("Expecting: true, received: ", rcv)
- }
-}
-
-func TestCGREventCheckMandatoryFields(t *testing.T) {
- //empty check
- cgrEvent := new(CGREvent)
- fldNames := []string{}
- err := cgrEvent.CheckMandatoryFields(fldNames)
- if err != nil {
- t.Error(err)
- }
- cgrEvent = &CGREvent{
- Event: map[string]any{
- Usage: 20 * time.Second,
- "test1": 1,
- "test2": 2,
- "test3": 3,
- },
- }
- //normal check
- fldNames = []string{"test1", "test2"}
- err = cgrEvent.CheckMandatoryFields(fldNames)
- if err != nil {
- t.Error(err)
- }
- //MANDATORY_IE_MISSING
- fldNames = []string{"test4", "test5"}
- err = cgrEvent.CheckMandatoryFields(fldNames)
- if err == nil || err.Error() != NewErrMandatoryIeMissing("test4").Error() {
- t.Errorf("Expected %s, received %s", NewErrMandatoryIeMissing("test4"), err)
- }
-}
-
-func TestCGREventFielAsString(t *testing.T) {
- //empty check
- cgrEvent := new(CGREvent)
- fldname := "test"
- _, err := cgrEvent.FieldAsString(fldname)
- if err == nil || err.Error() != ErrNotFound.Error() {
- t.Errorf("Expected %s, received %s", ErrNotFound, err)
- }
- //normal check
- cgrEvent = &CGREvent{
- Event: map[string]any{
- Usage: 20 * time.Second,
- "test1": 1,
- "test2": 2,
- "test3": 3,
- },
- }
- fldname = "test1"
- rcv, err := cgrEvent.FieldAsString(fldname)
- if err != nil {
- t.Error(err)
- }
- if rcv != "1" {
- t.Errorf("Expected: 1, received %+q", rcv)
- }
-
-}
-
-func TestLibRoutesUsage(t *testing.T) {
- se := &CGREvent{
- Tenant: "cgrates.org",
- ID: "supplierEvent1",
- Event: map[string]any{
- Usage: 20 * time.Second,
- },
- }
- seErr := &CGREvent{
- Tenant: "cgrates.org",
- ID: "supplierEvent1",
- Event: make(map[string]any),
- }
- answ, err := se.FieldAsDuration(Usage)
- if err != nil {
- t.Error(err)
- }
- if answ != se.Event[Usage] {
- t.Errorf("Expecting: %+v, received: %+v", se.Event[Usage], answ)
- }
- _, err = seErr.FieldAsDuration(Usage)
- if err != ErrNotFound {
- t.Error(err)
- }
-}
-
-func TestCGREventFieldAsTime(t *testing.T) {
- se := &CGREvent{
- Tenant: "cgrates.org",
- ID: "supplierEvent1",
- Event: map[string]any{
- AnswerTime: time.Now(),
- },
- }
- seErr := &CGREvent{
- Tenant: "cgrates.org",
- ID: "supplierEvent1",
- Event: make(map[string]any),
- }
- answ, err := se.FieldAsTime(AnswerTime, "UTC")
- if err != nil {
- t.Error(err)
- }
- if answ != se.Event[AnswerTime] {
- t.Errorf("Expecting: %+v, received: %+v", se.Event[AnswerTime], answ)
- }
- answ, err = seErr.FieldAsTime(AnswerTime, "CET")
- if err != ErrNotFound {
- t.Error(err)
- }
-}
-
-func TestCGREventFieldAsString(t *testing.T) {
- se := &CGREvent{
- Tenant: "cgrates.org",
- ID: "supplierEvent1",
- Event: map[string]any{
- "supplierprofile1": "Supplier",
- "UsageInterval": time.Second,
- "PddInterval": "1s",
- "Weight": 20.0,
- },
- }
- answ, err := se.FieldAsString("UsageInterval")
- if err != nil {
- t.Error(err)
- }
- if answ != "1s" {
- t.Errorf("Expecting: %+v, received: %+v", se.Event["UsageInterval"], answ)
- }
- answ, err = se.FieldAsString("PddInterval")
- if err != nil {
- t.Error(err)
- }
- if answ != se.Event["PddInterval"] {
- t.Errorf("Expecting: %+v, received: %+v", se.Event["PddInterval"], answ)
- }
- answ, err = se.FieldAsString("supplierprofile1")
- if err != nil {
- t.Error(err)
- }
- if answ != se.Event["supplierprofile1"] {
- t.Errorf("Expecting: %+v, received: %+v", se.Event["supplierprofile1"], answ)
- }
- answ, err = se.FieldAsString("Weight")
- if err != nil {
- t.Error(err)
- }
- if answ != "20" {
- t.Errorf("Expecting: %+v, received: %+v", se.Event["Weight"], answ)
- }
-}
-
-func TestCGREventFieldAsFloat64(t *testing.T) {
- se := &CGREvent{
- Tenant: "cgrates.org",
- ID: "supplierEvent1",
- Event: map[string]any{
- AnswerTime: time.Now(),
- "supplierprofile1": "Supplier",
- "UsageInterval": "54.2",
- "PddInterval": "1s",
- "Weight": 20.0,
- },
- }
- answ, err := se.FieldAsFloat64("UsageInterval")
- if err != nil {
- t.Error(err)
- }
- if answ != float64(54.2) {
- t.Errorf("Expecting: %+v, received: %+v", se.Event["UsageInterval"], answ)
- }
- answ, err = se.FieldAsFloat64("Weight")
- if err != nil {
- t.Error(err)
- }
- if answ != float64(20.0) {
- t.Errorf("Expecting: %+v, received: %+v", se.Event["Weight"], answ)
- }
- answ, err = se.FieldAsFloat64("PddInterval")
- if err == nil || err.Error() != `strconv.ParseFloat: parsing "1s": invalid syntax` {
- t.Errorf("Expected %s, received %s", `strconv.ParseFloat: parsing "1s": invalid syntax`, err)
- }
- if answ != 0 {
- t.Errorf("Expecting: %+v, received: %+v", 0, answ)
- }
-
- if _, err := se.FieldAsFloat64(AnswerTime); err == nil || !strings.HasPrefix(err.Error(), "cannot convert field") {
- t.Errorf("Unexpected error : %+v", err)
- }
- if _, err := se.FieldAsFloat64(AccountField); err == nil || err.Error() != ErrNotFound.Error() {
- t.Errorf("Expected %s, received %s", ErrNotFound, err)
- }
- // }
-}
-
-// }
-func TestCGREventTenantID(t *testing.T) {
- //empty check
- cgrEvent := new(CGREvent)
- rcv := cgrEvent.TenantID()
- eOut := ":"
- if !reflect.DeepEqual(eOut, rcv) {
- t.Errorf("Expecting: %+v, received: %+v", eOut, rcv)
- }
- //normal check
- cgrEvent = &CGREvent{
- Tenant: "cgrates.org",
- ID: "supplierEvent1",
- }
- rcv = cgrEvent.TenantID()
- eOut = "cgrates.org:supplierEvent1"
- if !reflect.DeepEqual(eOut, rcv) {
- t.Errorf("Expecting: %+v, received: %+v", eOut, rcv)
- }
-
-}
-
-func TestCGREventClone(t *testing.T) {
- now := time.Now()
- ev := &CGREvent{
- Tenant: "cgrates.org",
- ID: "supplierEvent1",
- Time: &now,
- Event: map[string]any{
- AnswerTime: time.Now(),
- "supplierprofile1": "Supplier",
- "UsageInterval": "54.2",
- "PddInterval": "1s",
- "Weight": 20.0,
- },
- APIOpts: map[string]any{
- "testKey": 12,
- },
- }
- cloned := ev.Clone()
- if !reflect.DeepEqual(ev, cloned) {
- t.Errorf("Expecting: %+v, received: %+v", ev, cloned)
- }
- if cloned.Time == ev.Time {
- t.Errorf("Expecting: different pointer but received: %+v", cloned.Time)
- }
-}
-
-func TestCGREventconsumeRoutePaginator(t *testing.T) {
- //empty check
- var opts map[string]any
- rcv, err := GetRoutePaginatorFromOpts(opts)
- if err != nil {
- t.Error(err)
- }
- var eOut Paginator
- if !reflect.DeepEqual(eOut, rcv) {
- t.Errorf("Expecting: %+v, received: %+v", eOut, rcv)
- }
- opts = nil
- rcv, err = GetRoutePaginatorFromOpts(opts)
- if err != nil {
- t.Error(err)
- }
- if !reflect.DeepEqual(eOut, rcv) {
- t.Errorf("Expecting: %+v, received: %+v", eOut, rcv)
- }
- //normal check
- opts = map[string]any{
- OptsRoutesLimit: 18,
- OptsRoutesOffset: 20,
- }
-
- eOut = Paginator{
- Limit: IntPointer(18),
- Offset: IntPointer(20),
- }
- rcv, err = GetRoutePaginatorFromOpts(opts)
- if err != nil {
- t.Error(err)
- }
- //check if *rouLimit and *rouOffset was deleted
- if _, has := opts[OptsRoutesLimit]; has {
- t.Errorf("*rouLimit wasn't deleted")
- } else if _, has := opts[OptsRoutesOffset]; has {
- t.Errorf("*rouOffset wasn't deleted")
- }
- if !reflect.DeepEqual(eOut, rcv) {
- t.Errorf("Expecting: %+v, received: %+v", eOut, rcv)
- }
- //check without *rouLimit, but with *rouOffset
- opts = map[string]any{
- OptsRoutesOffset: 20,
- }
-
- eOut = Paginator{
- Offset: IntPointer(20),
- }
- rcv, err = GetRoutePaginatorFromOpts(opts)
- if err != nil {
- t.Error(err)
- }
- //check if *rouLimit and *rouOffset was deleted
- if _, has := opts[OptsRoutesLimit]; has {
- t.Errorf("*rouLimit wasn't deleted")
- } else if _, has := opts[OptsRoutesOffset]; has {
- t.Errorf("*rouOffset wasn't deleted")
- }
- if !reflect.DeepEqual(eOut, rcv) {
- t.Errorf("Expecting: %+v, received: %+v", eOut, rcv)
- }
- //check with notAnInt at *rouLimit
- opts = map[string]any{
- OptsRoutesLimit: "Not an int",
- }
- eOut = Paginator{}
- rcv, err = GetRoutePaginatorFromOpts(opts)
- if err == nil {
- t.Error("Expected error")
- }
- if !reflect.DeepEqual(eOut, rcv) {
- t.Errorf("Expecting: %+v, received: %+v", eOut, rcv)
- }
- //check with notAnInt at and *rouOffset
- opts = map[string]any{
- OptsRoutesOffset: "Not an int",
- }
- eOut = Paginator{}
- rcv, err = GetRoutePaginatorFromOpts(opts)
- if err == nil {
- t.Error("Expected error")
- }
- if !reflect.DeepEqual(eOut, rcv) {
- t.Errorf("Expecting: %+v, received: %+v", eOut, rcv)
- }
-}
-
-func TestCGREventconsumeRoutePaginatorCase1(t *testing.T) {
- opts := map[string]any{}
- if _, err := GetRoutePaginatorFromOpts(opts); err != nil {
- t.Error(err)
- }
-}
-
-func TestCGREventOptAsInt64(t *testing.T) {
- ev := &CGREvent{
- APIOpts: map[string]any{
- "testKey": "13",
- },
- }
-
- received, err := ev.OptAsInt64("testKey")
- if err != nil {
- t.Errorf("\nExpected: <%+v>, \nReceived: <%+v>", nil, err)
- }
- expected := int64(13)
-
- if received != expected {
- t.Errorf("\nExpected: %q, \nReceived: %q", expected, received)
- }
- errExpect := ErrNotFound
- if _, err = ev.OptAsInt64("nonExistingKey"); err == nil || err != errExpect {
- t.Errorf("\nExpected: <%+v>, \nReceived: <%+v>", errExpect, err)
- }
-}
-
-func TestCGREventFieldAsInt64(t *testing.T) {
- se := &CGREvent{
- Tenant: "cgrates.org",
- ID: "supplierEvent1",
- Event: map[string]any{
- AnswerTime: time.Now(),
- "supplierprofile1": "Supplier",
- "UsageInterval": "54",
- "PddInterval": "1s",
- "Weight": 20,
- },
- }
- answ, err := se.FieldAsInt64("UsageInterval")
- if err != nil {
- t.Error(err)
- }
- if answ != int64(54) {
- t.Errorf("Expecting: %+v, received: %+v", se.Event["UsageInterval"], answ)
- }
- answ, err = se.FieldAsInt64("Weight")
- if err != nil {
- t.Error(err)
- }
- if answ != int64(20) {
- t.Errorf("Expecting: %+v, received: %+v", se.Event["Weight"], answ)
- }
- answ, err = se.FieldAsInt64("PddInterval")
- if err == nil || err.Error() != `strconv.ParseInt: parsing "1s": invalid syntax` {
- t.Errorf("Expected %s, received %s", `strconv.ParseInt: parsing "1s": invalid syntax`, err)
- }
- if answ != 0 {
- t.Errorf("Expecting: %+v, received: %+v", 0, answ)
- }
-
- if _, err := se.FieldAsInt64(AnswerTime); err == nil || !strings.HasPrefix(err.Error(), "cannot convert field") {
- t.Errorf("Unexpected error : %+v", err)
- }
- if _, err := se.FieldAsInt64(AccountField); err == nil || err.Error() != ErrNotFound.Error() {
- t.Errorf("Expected %s, received %s", ErrNotFound, err)
- }
- // }
-}
-
-func TestCGREventOptAsStringEmpty(t *testing.T) {
- ev := &CGREvent{}
-
- expstr := ""
- experr := ErrNotFound
- received, err := ev.OptAsString("testString")
-
- if !reflect.DeepEqual(received, expstr) {
- t.Errorf("\nExpected: %q, \nReceived: %q", expstr, received)
- }
- if err == nil || err != experr {
- t.Errorf("\nExpected: %q, \nReceived: %q", experr, err)
- }
-}
-
-func TestCGREventOptAsString(t *testing.T) {
- ev := &CGREvent{
- APIOpts: map[string]any{
- "testKey": 13,
- },
- }
-
- received, err := ev.OptAsString("testKey")
- if err != nil {
- t.Errorf("\nExpected: <%+v>, \nReceived: <%+v>", nil, err)
- }
- expected := "13"
-
- if received != expected {
- t.Errorf("\nExpected: %q, \nReceived: %q", expected, received)
- }
-}
-
-func TestCGREventOptAsDurationEmpty(t *testing.T) {
- ev := &CGREvent{}
-
- var expdur time.Duration
- experr := ErrNotFound
- received, err := ev.OptAsDuration("testString")
-
- if !reflect.DeepEqual(received, expdur) {
- t.Errorf("\nExpected: <%+v>, \nReceived: <%+v>", expdur, received)
- }
- if err == nil || err != experr {
- t.Errorf("\nExpected: %q, \nReceived: %q", experr, err)
- }
-}
-
-func TestCGREventOptAsDuration(t *testing.T) {
- ev := &CGREvent{
- APIOpts: map[string]any{
- "testKey": 30,
- },
- }
-
- received, err := ev.OptAsDuration("testKey")
- if err != nil {
- t.Errorf("\nExpected: <%+v>, \nReceived: <%+v>", nil, err)
- }
- expected := 30 * time.Nanosecond
-
- if received != expected {
- t.Errorf("\nExpected: <%+v>, \nReceived: <%+v>", expected, received)
- }
-}
-
-func TestCGREventAsDataProvider(t *testing.T) {
- ev := &CGREvent{
- APIOpts: map[string]any{
- "testKey1": 13,
- "testKey2": "testString1",
- },
- Event: map[string]any{
- "testKey1": 30,
- "testKey2": "testString2",
- },
- }
-
- expected := MapStorage{
- MetaOpts: ev.APIOpts,
- MetaReq: ev.Event,
- }
-
- received := ev.AsDataProvider()
-
- if !reflect.DeepEqual(expected, received) {
- t.Errorf("\nExpected: <%+v>, \nReceived: <%+v>", expected, received)
- }
-}
-
-func TestNMAsCGREvent(t *testing.T) {
- if cgrEv := NMAsCGREvent(nil, "cgrates.org",
- NestingSep, nil); cgrEv != nil {
- t.Errorf("expecting: %+v, \nreceived: %+v", ToJSON(nil), ToJSON(cgrEv.Event))
- }
-
- nM := NewOrderedNavigableMap()
- if cgrEv := NMAsCGREvent(nM, "cgrates.org",
- NestingSep, nil); cgrEv != nil {
- t.Errorf("expecting: %+v, \nreceived: %+v", ToJSON(nil), ToJSON(cgrEv.Event))
- }
-
- path := []string{"FirstLevel", "SecondLevel", "ThirdLevel", "Fld1"}
- if err := nM.SetAsSlice(&FullPath{Path: strings.Join(path, NestingSep), PathSlice: path}, []*DataNode{
- {Type: NMDataType, Value: &DataLeaf{
- Data: "Val1",
- }}}); err != nil {
- t.Error(err)
- }
-
- path = []string{"FirstLevel2", "SecondLevel2", "Field2"}
- if err := nM.SetAsSlice(&FullPath{Path: strings.Join(path, NestingSep), PathSlice: path}, []*DataNode{
- {Type: NMDataType, Value: &DataLeaf{
- Data: "attrVal1",
- AttributeID: "attribute1",
- }},
- {Type: NMDataType, Value: &DataLeaf{
- Data: "Value2",
- }}}); err != nil {
- t.Error(err)
- }
-
- path = []string{"FirstLevel2", "Field3"}
- if err := nM.SetAsSlice(&FullPath{Path: strings.Join(path, NestingSep), PathSlice: path}, []*DataNode{
- {Type: NMDataType, Value: &DataLeaf{
- Data: "Value3",
- }}}); err != nil {
- t.Error(err)
- }
-
- path = []string{"FirstLevel2", "Field5"}
- if err := nM.SetAsSlice(&FullPath{Path: strings.Join(path, NestingSep), PathSlice: path}, []*DataNode{
- {Type: NMDataType, Value: &DataLeaf{
- Data: "Value5",
- }},
- {Type: NMDataType, Value: &DataLeaf{
- Data: "attrVal5",
- AttributeID: "attribute5",
- }}}); err != nil {
- t.Error(err)
- }
-
- path = []string{"FirstLevel2", "Field6"}
- if err := nM.SetAsSlice(&FullPath{Path: strings.Join(path, NestingSep), PathSlice: path}, []*DataNode{
- {Type: NMDataType, Value: &DataLeaf{
- Data: "Value6",
- NewBranch: true,
- }},
- {Type: NMDataType, Value: &DataLeaf{
- Data: "attrVal6",
- AttributeID: "attribute6",
- }}}); err != nil {
- t.Error(err)
- }
-
- path = []string{"Field4"}
- if err := nM.SetAsSlice(&FullPath{Path: strings.Join(path, NestingSep), PathSlice: path}, []*DataNode{
- {Type: NMDataType, Value: &DataLeaf{
- Data: "Val4",
- }},
- {Type: NMDataType, Value: &DataLeaf{
- Data: "attrVal2",
- AttributeID: "attribute2",
- }}}); err != nil {
- t.Error(err)
- }
- eEv := map[string]any{
- "FirstLevel2.SecondLevel2.Field2": "Value2",
- "FirstLevel.SecondLevel.ThirdLevel.Fld1": "Val1",
- "FirstLevel2.Field3": "Value3",
- "FirstLevel2.Field5": "Value5",
- "FirstLevel2.Field6": "Value6",
- "Field4": "Val4",
- }
- if cgrEv := NMAsCGREvent(nM, "cgrates.org",
- NestingSep, MapStorage{}); cgrEv.Tenant != "cgrates.org" ||
- cgrEv.Time == nil ||
- !reflect.DeepEqual(eEv, cgrEv.Event) {
- t.Errorf("expecting: %+v, \nreceived: %+v", ToJSON(eEv), ToJSON(cgrEv.Event))
- }
-}
-
-func TestCGREventRPCClone(t *testing.T) {
- att := &CGREvent{
- Tenant: "cgrates.org",
- ID: "234",
- clnb: false,
- Time: TimePointer(time.Date(2013, 12, 30, 15, 0, 1, 0, time.UTC)),
- Event: map[string]any{
- "key": "value",
- },
- APIOpts: map[string]any{
- "rand": "we",
- },
- }
-
- if rec, _ := att.RPCClone(); !reflect.DeepEqual(rec, att) {
- t.Errorf("expected %v and received %v ", ToJSON(att), ToJSON(rec))
-
- }
-
- att.SetCloneable(true)
- if att.clnb != true {
- t.Error("expected true")
- }
- rec, _ := att.RPCClone()
- att.SetCloneable(false)
- if !reflect.DeepEqual(rec, att) {
- t.Errorf("expected %v and received %v ", att, rec)
-
- }
-
-}
diff --git a/utils/dataconverter_test.go b/utils/dataconverter_test.go
index a7df03030..5acacf155 100644
--- a/utils/dataconverter_test.go
+++ b/utils/dataconverter_test.go
@@ -1310,19 +1310,20 @@ func TestDataConverterConvertJSONOK(t *testing.T) {
t.Error(err)
}
- obj := &CGREvent{
+ testObj := struct {
+ Tenant string
+ ID string
+ Event map[string]any
+ }{
Tenant: "cgrates.org",
- ID: "TestCGREv",
+ ID: "testStruct",
Event: map[string]any{
- AccountField: "1001",
- },
- APIOpts: map[string]any{
- "opt": "value",
+ "Field": "Value",
},
}
- exp := ToJSON(obj)
- if rcv, err := dc.Convert(obj); err != nil {
+ exp := ToJSON(testObj)
+ if rcv, err := dc.Convert(testObj); err != nil {
t.Error(err)
} else if rcv.(string) != exp {
t.Errorf("expected: <%+v>, \nreceived: <%+v>", exp, rcv)
diff --git a/utils/options.go b/utils/options.go
deleted file mode 100644
index ea6d2e490..000000000
--- a/utils/options.go
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
-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 utils
-
-import (
- "time"
-
- "github.com/ericlagergren/decimal"
-)
-
-// GetFloat64Opts checks the specified option names in order among the keys in APIOpts returning the first value it finds as float64, otherwise it
-// returns the default option (usually the value specified in config)
-func GetFloat64Opts(ev *CGREvent, dftOpt float64, optNames ...string) (cfgOpt float64, err error) {
- for _, optName := range optNames {
- if opt, has := ev.APIOpts[optName]; has {
- return IfaceAsFloat64(opt)
- }
- }
- return dftOpt, nil
-}
-
-// GetDurationOpts checks the specified option names in order among the keys in APIOpts returning the first value it finds as time.Duration, otherwise it
-// returns the default option (usually the value specified in config)
-func GetDurationOpts(ev *CGREvent, dftOpt time.Duration, optNames ...string) (cfgOpt time.Duration, err error) {
- for _, optName := range optNames {
- if opt, has := ev.APIOpts[optName]; has {
- return IfaceAsDuration(opt)
- }
- }
- return dftOpt, nil
-}
-
-// GetStringOpts checks the specified option names in order among the keys in APIOpts returning the first value it finds as string, otherwise it
-// returns the default option (usually the value specified in config)
-func GetStringOpts(ev *CGREvent, dftOpt string, optNames ...string) (cfgOpt string) {
- for _, optName := range optNames {
- if opt, has := ev.APIOpts[optName]; has {
- return IfaceAsString(opt)
- }
- }
- return dftOpt
-}
-
-// GetStringSliceOpts checks the specified option names in order among the keys in APIOpts returning the first value it finds as []string, otherwise it
-// returns the default option (usually the value specified in config)
-func GetStringSliceOpts(ev *CGREvent, dftOpt []string, optNames ...string) (cfgOpt []string, err error) {
- for _, optName := range optNames {
- if opt, has := ev.APIOpts[optName]; has {
- return IfaceAsSliceString(opt)
- }
- }
- return dftOpt, nil
-}
-
-// GetIntOpts checks the specified option names in order among the keys in APIOpts returning the first value it finds as int, otherwise it
-// returns the default option (usually the value specified in config)
-func GetIntOpts(ev *CGREvent, dftOpt int, optNames ...string) (cfgOpt int, err error) {
- for _, optName := range optNames {
- if opt, has := ev.APIOpts[optName]; has {
- var value int64
- if value, err = IfaceAsTInt64(opt); err != nil {
- return
- }
- return int(value), nil
- }
- }
- return dftOpt, nil
-}
-
-// GetBoolOpts checks the specified option names in order among the keys in APIOpts returning the first value it finds as bool, otherwise it
-// returns the default option (usually the value specified in config)
-func GetBoolOpts(ev *CGREvent, dftOpt bool, optNames ...string) (cfgOpt bool, err error) {
- for _, optName := range optNames {
- if opt, has := ev.APIOpts[optName]; has {
- return IfaceAsBool(opt)
- }
- }
- return dftOpt, nil
-}
-
-// GetDecimalBigOpts checks the specified option names in order among the keys in APIOpts returning the first value it finds as *decimal.Big, otherwise it
-// returns the default option (usually the value specified in config)
-func GetDecimalBigOpts(ev *CGREvent, dftOpt *decimal.Big, optNames ...string) (cfgOpt *decimal.Big, err error) {
- for _, optName := range optNames {
- if opt, has := ev.APIOpts[optName]; has {
- return IfaceAsBig(opt)
- }
- }
- return dftOpt, nil
-}
-
-// GetInterfaceOpts checks the specified option names in order among the keys in APIOpts returning the first value it finds as any, otherwise it
-// returns the default option (usually the value specified in config)
-func GetInterfaceOpts(ev *CGREvent, dftOpt any, optNames ...string) (cfgOpt any) {
- for _, optName := range optNames {
- if opt, has := ev.APIOpts[optName]; has {
- return opt
- }
- }
- return dftOpt
-}
-
-// GetIntPointerOpts checks the specified option names in order among the keys in APIOpts returning the first value it finds as *int, otherwise it
-// returns the default option (usually the value specified in config)
-func GetIntPointerOpts(ev *CGREvent, dftOpt *int, optNames ...string) (cfgOpt *int, err error) {
- for _, optName := range optNames {
- if opt, has := ev.APIOpts[optName]; has {
- var value int64
- if value, err = IfaceAsTInt64(opt); err != nil {
- return
- }
- return IntPointer(int(value)), nil
- }
- }
- return dftOpt, nil
-}
-
-// GetDurationPointerOpts checks the specified option names in order among the keys in APIOpts returning the first value it finds as *time.Duration, otherwise it
-// returns the default option (usually the value specified in config)
-func GetDurationPointerOpts(ev *CGREvent, dftOpt *time.Duration, optNames ...string) (cfgOpt *time.Duration, err error) {
- for _, optName := range optNames {
- if opt, has := ev.APIOpts[optName]; has {
- var value time.Duration
- if value, err = IfaceAsDuration(opt); err != nil {
- return
- }
- return DurationPointer(value), nil
- }
- }
- return dftOpt, nil
-}
diff --git a/utils/options_test.go b/utils/options_test.go
deleted file mode 100644
index bf4b2dc80..000000000
--- a/utils/options_test.go
+++ /dev/null
@@ -1,386 +0,0 @@
-/*
-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 utils
-
-import (
- "reflect"
- "testing"
- "time"
-
- "github.com/ericlagergren/decimal"
-)
-
-func TestOptionsGetFloat64Opts(t *testing.T) {
-
- // option key not populated, retrieve default value
- ev := &CGREvent{
- APIOpts: make(map[string]any),
- }
- if rcv, err := GetFloat64Opts(ev, 1.2, "optionName"); err != nil {
- t.Error(err)
- } else if rcv != 1.2 {
- t.Errorf("expected: <%+v>, \nreceived: <%+v>", 1.2, rcv)
- }
-
- // option key populated with valid input, get its value
- ev.APIOpts["optionName"] = 0.11
- if rcv, err := GetFloat64Opts(ev, 1.2, "optionName"); err != nil {
- t.Error(err)
- } else if rcv != 0.11 {
- t.Errorf("expected: <%+v>, \nreceived: <%+v>", 0.11, rcv)
- }
-
- // option key populated with invalid input, receive error
- expectedErr := `strconv.ParseFloat: parsing "invalid": invalid syntax`
- ev.APIOpts["optionName"] = "invalid"
- if _, err := GetFloat64Opts(ev, 1.2, "optionName"); err == nil ||
- err.Error() != expectedErr {
- t.Errorf("expected: <%+v>, \nreceived: <%+v>", expectedErr, err)
- }
-}
-
-func TestOptionsGetDurationOpts(t *testing.T) {
-
- // option key not populated, retrieve default value
- ev := &CGREvent{
- APIOpts: make(map[string]any),
- }
- if rcv, err := GetDurationOpts(ev, time.Minute, "optionName"); err != nil {
- t.Error(err)
- } else if rcv != time.Minute {
- t.Errorf("expected: <%+v>, \nreceived: <%+v>", time.Minute, rcv)
- }
-
- // option key populated with valid input, get its value
- ev.APIOpts["optionName"] = 2 * time.Second
- if rcv, err := GetDurationOpts(ev, time.Minute, "optionName"); err != nil {
- t.Error(err)
- } else if rcv != 2*time.Second {
- t.Errorf("expected: <%+v>, \nreceived: <%+v>", 2*time.Second, rcv)
- }
- ev.APIOpts["optionName"] = 600
- if rcv, err := GetDurationOpts(ev, time.Minute, "optionName"); err != nil {
- t.Error(err)
- } else if rcv != 600 {
- t.Errorf("expected: <%+v>, \nreceived: <%+v>", 600, rcv)
- }
- ev.APIOpts["optionName"] = "2m0s"
- if rcv, err := GetDurationOpts(ev, time.Minute, "optionName"); err != nil {
- t.Error(err)
- } else if rcv != 2*time.Minute {
- t.Errorf("expected: <%+v>, \nreceived: <%+v>", 2*time.Minute, rcv)
- }
-
- // option key populated with invalid input, receive error
- expectedErr := `time: invalid duration "invalid"`
- ev.APIOpts["optionName"] = "invalid"
- if _, err := GetDurationOpts(ev, time.Minute, "optionName"); err == nil ||
- err.Error() != expectedErr {
- t.Errorf("expected: <%+v>, \nreceived: <%+v>", expectedErr, err)
- }
-}
-
-func TestOptionsGetStringOpts(t *testing.T) {
-
- // option key not populated, retrieve default value
- ev := &CGREvent{
- APIOpts: make(map[string]any),
- }
- if rcv := GetStringOpts(ev, "default", "optionName"); rcv != "default" {
- t.Errorf("expected: <%+v>, \nreceived: <%+v>", "default", rcv)
- }
-
- // option key populated, get its value
- ev.APIOpts["optionName"] = "optionValue"
- if rcv := GetStringOpts(ev, "default", "optionName"); rcv != "optionValue" {
- t.Errorf("expected: <%+v>, \nreceived: <%+v>", "optionValue", rcv)
- }
- ev.APIOpts["optionName"] = false
- if rcv := GetStringOpts(ev, "default", "optionName"); rcv != "false" {
- t.Errorf("expected: <%+v>, \nreceived: <%+v>", "false", rcv)
- }
- ev.APIOpts["optionName"] = 5 * time.Minute
- if rcv := GetStringOpts(ev, "default", "optionName"); rcv != "5m0s" {
- t.Errorf("expected: <%+v>, \nreceived: <%+v>", "5m0s", rcv)
- }
- ev.APIOpts["optionName"] = 12.34
- if rcv := GetStringOpts(ev, "default", "optionName"); rcv != "12.34" {
- t.Errorf("expected: <%+v>, \nreceived: <%+v>", "12.34", rcv)
- }
-}
-
-func TestOptionsGetStringSliceOpts(t *testing.T) {
-
- // option key not populated, retrieve default value
- ev := &CGREvent{
- APIOpts: make(map[string]any),
- }
- defaultValue := []string{"default"}
- if rcv, err := GetStringSliceOpts(ev, defaultValue, "optionName"); err != nil {
- t.Error(err)
- } else if !reflect.DeepEqual(rcv, defaultValue) {
- t.Errorf("expected: <%+v>, \nreceived: <%+v>", defaultValue, rcv)
- }
-
- // option key populated with valid input, get its value
- optValue := []string{"optValue"}
- ev.APIOpts["optionName"] = optValue
- if rcv, err := GetStringSliceOpts(ev, defaultValue, "optionName"); err != nil {
- t.Error(err)
- } else if !reflect.DeepEqual(rcv, optValue) {
- t.Errorf("expected: <%+v>, \nreceived: <%+v>", optValue, rcv)
- }
- optValue2 := []string{"true", "false"}
- ev.APIOpts["optionName"] = []bool{true, false}
- if rcv, err := GetStringSliceOpts(ev, defaultValue, "optionName"); err != nil {
- t.Error(err)
- } else if !reflect.DeepEqual(rcv, optValue2) {
- t.Errorf("expected: <%+v>, \nreceived: <%+v>", optValue2, rcv)
- }
- optValue3 := []string{"12.34", "3"}
- ev.APIOpts["optionName"] = []float64{12.34, 3}
- if rcv, err := GetStringSliceOpts(ev, defaultValue, "optionName"); err != nil {
- t.Error(err)
- } else if !reflect.DeepEqual(rcv, optValue3) {
- t.Errorf("expected: <%+v>, \nreceived: <%+v>", optValue3, rcv)
- }
-
- // option key populated with invalid input, receive error
- expectedErr := `cannot convert field: string to []string`
- ev.APIOpts["optionName"] = "invalid"
- if _, err := GetStringSliceOpts(ev, defaultValue, "optionName"); err == nil ||
- err.Error() != expectedErr {
- t.Errorf("expected: <%+v>, \nreceived: <%+v>", expectedErr, err)
- }
-}
-
-func TestOptionsGetIntOpts(t *testing.T) {
-
- // option key not populated, retrieve default value
- ev := &CGREvent{
- APIOpts: make(map[string]any),
- }
- if rcv, err := GetIntOpts(ev, 5, "optionName"); err != nil {
- t.Error(err)
- } else if rcv != 5 {
- t.Errorf("expected: <%+v>, \nreceived: <%+v>", 5, rcv)
- }
-
- // option key populated with valid input, get its value
- ev.APIOpts["optionName"] = 12
- if rcv, err := GetIntOpts(ev, 5, "optionName"); err != nil {
- t.Error(err)
- } else if rcv != 12 {
- t.Errorf("expected: <%+v>, \nreceived: <%+v>", 12, rcv)
- }
- ev.APIOpts["optionName"] = 12.7
- if rcv, err := GetIntOpts(ev, 5, "optionName"); err != nil {
- t.Error(err)
- } else if rcv != 12 {
- t.Errorf("expected: <%+v>, \nreceived: <%+v>", 12, rcv)
- }
-
- // option key populated with invalid input, receive error
- expectedErr := `strconv.ParseInt: parsing "invalid": invalid syntax`
- ev.APIOpts["optionName"] = "invalid"
- if _, err := GetIntOpts(ev, 5, "optionName"); err == nil ||
- err.Error() != expectedErr {
- t.Errorf("expected: <%+v>, \nreceived: <%+v>", expectedErr, err)
- }
-}
-
-func TestOptionsGetBoolOpts(t *testing.T) {
-
- // option key not populated, retrieve default value
- ev := &CGREvent{
- APIOpts: make(map[string]any),
- }
- if rcv, err := GetBoolOpts(ev, false, "optionName"); err != nil {
- t.Error(err)
- } else if rcv != false {
- t.Errorf("expected: <%+v>, \nreceived: <%+v>", false, rcv)
- }
-
- // option key populated with valid input, get its value
- ev.APIOpts["optionName"] = true
- if rcv, err := GetBoolOpts(ev, false, "optionName"); err != nil {
- t.Error(err)
- } else if rcv != true {
- t.Errorf("expected: <%+v>, \nreceived: <%+v>", true, rcv)
- }
- ev.APIOpts["optionName"] = 5
- if rcv, err := GetBoolOpts(ev, false, "optionName"); err != nil {
- t.Error(err)
- } else if rcv != true {
- t.Errorf("expected: <%+v>, \nreceived: <%+v>", true, rcv)
- }
- ev.APIOpts["optionName"] = "true"
- if rcv, err := GetBoolOpts(ev, false, "optionName"); err != nil {
- t.Error(err)
- } else if rcv != true {
- t.Errorf("expected: <%+v>, \nreceived: <%+v>", true, rcv)
- }
-
- // option key populated with invalid input, receive error
- expectedErr := `strconv.ParseBool: parsing "invalid": invalid syntax`
- ev.APIOpts["optionName"] = "invalid"
- if _, err := GetBoolOpts(ev, false, "optionName"); err == nil ||
- err.Error() != expectedErr {
- t.Errorf("expected: <%+v>, \nreceived: <%+v>", expectedErr, err)
- }
-}
-
-func TestOptionsGetInterfaceOpts(t *testing.T) {
-
- // option key not populated, retrieve default value
- ev := &CGREvent{
- APIOpts: make(map[string]any),
- }
- if rcv := GetInterfaceOpts(ev, "default", "optionName"); rcv != "default" {
- t.Errorf("expected: <%+v>, \nreceived: <%+v>", "default", rcv)
- }
-
- // option key populated, get its value
- ev.APIOpts["optionName"] = 0.11
- if rcv := GetInterfaceOpts(ev, "default", "optionName"); rcv != 0.11 {
- t.Errorf("expected: <%+v>, \nreceived: <%+v>", 0.11, rcv)
- }
- ev.APIOpts["optionName"] = true
- if rcv := GetInterfaceOpts(ev, "default", "optionName"); rcv != true {
- t.Errorf("expected: <%+v>, \nreceived: <%+v>", true, rcv)
- }
- ev.APIOpts["optionName"] = 5 * time.Minute
- if rcv := GetInterfaceOpts(ev, "default", "optionName"); rcv != 5*time.Minute {
- t.Errorf("expected: <%+v>, \nreceived: <%+v>", 5*time.Minute, rcv)
- }
-}
-
-func TestOptionsGetIntPointerOpts(t *testing.T) {
- defaultValue := IntPointer(5)
-
- // option key not populated, retrieve default value
- ev := &CGREvent{
- APIOpts: make(map[string]any),
- }
- if rcv, err := GetIntPointerOpts(ev, defaultValue, "optionName"); err != nil {
- t.Error(err)
- } else if rcv == nil || rcv != defaultValue {
- t.Errorf("expected: <%+v>, \nreceived: <%+v>", defaultValue, rcv)
- }
-
- // option key populated with valid input, get its value
- ev.APIOpts["optionName"] = 12
- if rcv, err := GetIntPointerOpts(ev, defaultValue, "optionName"); err != nil {
- t.Error(err)
- } else if rcv == nil || *rcv != 12 {
- t.Errorf("expected: <%+v>, \nreceived: <%+v>", 12, rcv)
- }
- ev.APIOpts["optionName"] = 12.7
- if rcv, err := GetIntPointerOpts(ev, defaultValue, "optionName"); err != nil {
- t.Error(err)
- } else if rcv == nil || *rcv != 12 {
- t.Errorf("expected: <%+v>, \nreceived: <%+v>", 12, rcv)
- }
-
- // option key populated with invalid input, receive error
- expectedErr := `strconv.ParseInt: parsing "invalid": invalid syntax`
- ev.APIOpts["optionName"] = "invalid"
- if _, err := GetIntPointerOpts(ev, defaultValue, "optionName"); err == nil ||
- err.Error() != expectedErr {
- t.Errorf("expected: <%+v>, \nreceived: <%+v>", expectedErr, err)
- }
-}
-
-func TestOptionsGetDurationPointerOpts(t *testing.T) {
- defaultValue := DurationPointer(time.Minute)
- // option key not populated, retrieve default value
- ev := &CGREvent{
- APIOpts: make(map[string]any),
- }
- if rcv, err := GetDurationPointerOpts(ev, defaultValue, "optionName"); err != nil {
- t.Error(err)
- } else if rcv == nil || rcv != defaultValue {
- t.Errorf("expected: <%+v>, \nreceived: <%+v>", defaultValue, rcv)
- }
-
- // option key populated with valid input, get its value
- ev.APIOpts["optionName"] = 2 * time.Second
- if rcv, err := GetDurationPointerOpts(ev, defaultValue, "optionName"); err != nil {
- t.Error(err)
- } else if rcv == nil || *rcv != 2*time.Second {
- t.Errorf("expected: <%+v>, \nreceived: <%+v>", 2*time.Second, rcv)
- }
- ev.APIOpts["optionName"] = 600
- if rcv, err := GetDurationPointerOpts(ev, defaultValue, "optionName"); err != nil {
- t.Error(err)
- } else if rcv == nil || *rcv != 600 {
- t.Errorf("expected: <%+v>, \nreceived: <%+v>", 600, rcv)
- }
- ev.APIOpts["optionName"] = "2m0s"
- if rcv, err := GetDurationPointerOpts(ev, defaultValue, "optionName"); err != nil {
- t.Error(err)
- } else if rcv == nil || *rcv != 2*time.Minute {
- t.Errorf("expected: <%+v>, \nreceived: <%+v>", 2*time.Minute, rcv)
- }
-
- // option key populated with invalid input, receive error
- expectedErr := `time: invalid duration "invalid"`
- ev.APIOpts["optionName"] = "invalid"
- if _, err := GetDurationPointerOpts(ev, defaultValue, "optionName"); err == nil ||
- err.Error() != expectedErr {
- t.Errorf("expected: <%+v>, \nreceived: <%+v>", expectedErr, err)
- }
-}
-
-func TestOptionsGetDecimalBigOpts(t *testing.T) {
- defaultValue := decimal.New(1234, 3)
-
- // option key not populated, retrieve default value
- ev := &CGREvent{
- APIOpts: make(map[string]any),
- }
- if rcv, err := GetDecimalBigOpts(ev, defaultValue, "optionName"); err != nil {
- t.Error(err)
- } else if rcv.Cmp(defaultValue) != 0 {
- t.Errorf("expected: <%+v>, \nreceived: <%+v>", defaultValue, rcv)
- }
-
- // option key populated with valid input, get its value
- optValue := decimal.New(15, 1)
- ev.APIOpts["optionName"] = 1.5
- if rcv, err := GetDecimalBigOpts(ev, defaultValue, "optionName"); err != nil {
- t.Error(err)
- } else if rcv.Cmp(optValue) != 0 {
- t.Errorf("expected: <%+v>, \nreceived: <%+v>", optValue, rcv)
- }
- ev.APIOpts["optionName"] = "1.5"
- if rcv, err := GetDecimalBigOpts(ev, defaultValue, "optionName"); err != nil {
- t.Error(err)
- } else if rcv.Cmp(optValue) != 0 {
- t.Errorf("expected: <%+v>, \nreceived: <%+v>", optValue, rcv)
- }
-
- // option key populated with invalid input, receive error
- expectedErr := `can't convert to decimal`
- ev.APIOpts["optionName"] = "invalid"
- if _, err := GetDecimalBigOpts(ev, defaultValue, "optionName"); err == nil ||
- err.Error() != expectedErr {
- t.Errorf("expected: <%+v>, \nreceived: <%+v>", expectedErr, err)
- }
-}