Rename from ResourceMessage to ResourceAllocation

This commit is contained in:
TeoV
2020-07-10 11:54:18 +03:00
parent 299e4324a3
commit f99894d705
5 changed files with 22 additions and 22 deletions

View File

@@ -182,8 +182,8 @@ func testSSv1ItProcessEventAuth(t *testing.T) {
if rply.MaxUsage == nil || rply.MaxUsage["CustomerCharges"] != authUsage {
t.Errorf("Unexpected MaxUsage: %v", rply.MaxUsage)
}
if rply.ResourceMessage == nil || rply.ResourceMessage["CustomerCharges"] == utils.EmptyString {
t.Errorf("Unexpected ResourceMessage: %s", rply.ResourceMessage)
if rply.ResourceAllocation == nil || rply.ResourceAllocation["CustomerCharges"] == utils.EmptyString {
t.Errorf("Unexpected ResourceAllocation: %s", rply.ResourceAllocation)
}
eSplrs := &engine.SortedRoutes{
ProfileID: "SPL_ACNT_1001",
@@ -266,8 +266,8 @@ func testSSv1ItProcessEventInitiateSession(t *testing.T) {
if rply.MaxUsage == nil || rply.MaxUsage["CustomerCharges"] != initUsage {
t.Errorf("Unexpected MaxUsage: %v", rply.MaxUsage)
}
if rply.ResourceMessage == nil || rply.ResourceMessage["CustomerCharges"] != "RES_ACNT_1001" {
t.Errorf("Unexpected ResourceMessage: %s", rply.ResourceMessage)
if rply.ResourceAllocation == nil || rply.ResourceAllocation["CustomerCharges"] != "RES_ACNT_1001" {
t.Errorf("Unexpected ResourceAllocation: %s", rply.ResourceAllocation)
}
eAttrs := &engine.AttrSProcessEventReply{
MatchedProfiles: []string{"ATTR_ACNT_1001"},

View File

@@ -77,6 +77,7 @@ cgrates (0.11.0~dev) UNRELEASED; urgency=medium
* [RSRParsers] Removed attribute sistem from RSRParser
* [RSRParsers] Added grave accent(`) char as a delimiter to not split tge RSR value
* [RSRParsers] Moved RSRFilter from RSRParsers to the *rsr FilterS
* [SessionS] Rename from ResourceMessage to ResourceAllocation
-- DanB <danb@cgrates.org> Wed, 19 Feb 2020 13:25:52 +0200

View File

@@ -3024,14 +3024,14 @@ type V1ProcessEventArgs struct {
// V1ProcessEventReply is the reply for the ProcessEvent API
type V1ProcessEventReply struct {
MaxUsage map[string]time.Duration
Cost *float64 // Cost is the cost received from Rater, ignoring accounting part
ResourceMessage map[string]string
Attributes *engine.AttrSProcessEventReply
Routes *engine.SortedRoutes
ThresholdIDs *[]string
StatQueueIDs *[]string
STIRIdentity map[string]string
MaxUsage map[string]time.Duration
Cost *float64 // Cost is the cost received from Rater, ignoring accounting part
ResourceAllocation map[string]string
Attributes *engine.AttrSProcessEventReply
Routes *engine.SortedRoutes
ThresholdIDs *[]string
StatQueueIDs *[]string
STIRIdentity map[string]string
}
// AsNavigableMap is part of engine.NavigableMapper interface
@@ -3045,12 +3045,12 @@ func (v1Rply *V1ProcessEventReply) AsNavigableMap() utils.NavigableMap2 {
}
cgrReply[utils.CapMaxUsage] = usage
}
if v1Rply.ResourceMessage != nil {
if v1Rply.ResourceAllocation != nil {
res := make(utils.NavigableMap2)
for k, v := range v1Rply.ResourceMessage {
for k, v := range v1Rply.ResourceAllocation {
res[k] = utils.NewNMData(v)
}
cgrReply[utils.CapResourceMessage] = res
cgrReply[utils.CapResourceAllocation] = res
}
if v1Rply.Attributes != nil {
attrs := make(utils.NavigableMap2)
@@ -3286,7 +3286,7 @@ func (sS *SessionS) BiRPCv1ProcessEvent(clnt rpcclient.ClientConnector,
}); err != nil {
return
}
rply.ResourceMessage = make(map[string]string)
rply.ResourceAllocation = make(map[string]string)
for _, chrs := range chrgrs {
runID := chrs.ChargerSProfile
@@ -3309,19 +3309,19 @@ func (sS *SessionS) BiRPCv1ProcessEvent(clnt rpcclient.ClientConnector,
attrRU, &resMessage); err != nil {
return utils.NewErrResourceS(err)
}
rply.ResourceMessage[runID] = resMessage
rply.ResourceAllocation[runID] = resMessage
} else if resourceFlagsWithParams.HasKey(utils.MetaAllocate) {
if err = sS.connMgr.Call(sS.cgrCfg.SessionSCfg().ResSConns, nil, utils.ResourceSv1AllocateResources,
attrRU, &resMessage); err != nil {
return utils.NewErrResourceS(err)
}
rply.ResourceMessage[runID] = resMessage
rply.ResourceAllocation[runID] = resMessage
} else if resourceFlagsWithParams.HasKey(utils.MetaRelease) {
if err = sS.connMgr.Call(sS.cgrCfg.SessionSCfg().ResSConns, nil, utils.ResourceSv1ReleaseResources,
attrRU, &resMessage); err != nil {
return utils.NewErrResourceS(err)
}
rply.ResourceMessage[runID] = resMessage
rply.ResourceAllocation[runID] = resMessage
}
}
}

View File

@@ -1341,8 +1341,8 @@ func TestV1ProcessEventReplyAsNavigableMap(t *testing.T) {
t.Errorf("Expecting \n%+v\n, received: \n%+v", expected, rply)
}
//resource message check
v1per.ResourceMessage = map[string]string{utils.MetaDefault: "Resource"}
expected[utils.CapResourceMessage] = utils.NavigableMap2{utils.MetaDefault: utils.NewNMData("Resource")}
v1per.ResourceAllocation = map[string]string{utils.MetaDefault: "Resource"}
expected[utils.CapResourceAllocation] = utils.NavigableMap2{utils.MetaDefault: utils.NewNMData("Resource")}
if rply := v1per.AsNavigableMap(); !reflect.DeepEqual(expected, rply) {
t.Errorf("Expecting \n%+v\n, received: \n%+v", expected, rply)
}

View File

@@ -919,7 +919,6 @@ const (
MetaDurationSeconds = "*duration_seconds"
MetaDurationNanoseconds = "*duration_nanoseconds"
CapAttributes = "Attributes"
CapResourceMessage = "ResourceMessage"
CapResourceAllocation = "ResourceAllocation"
CapMaxUsage = "MaxUsage"
CapRoutes = "Routes"