diff --git a/apier/v1/tpaccountactions_it_test.go b/apier/v1/tpaccountactions_it_test.go index 1a8fbb4f5..ba5a4a16d 100644 --- a/apier/v1/tpaccountactions_it_test.go +++ b/apier/v1/tpaccountactions_it_test.go @@ -21,14 +21,15 @@ along with this program. If not, see package v1 import ( - "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/engine" - "github.com/cgrates/cgrates/utils" "net/rpc" "net/rpc/jsonrpc" "path" "reflect" "testing" + + "github.com/cgrates/cgrates/config" + "github.com/cgrates/cgrates/engine" + "github.com/cgrates/cgrates/utils" ) var ( @@ -110,7 +111,7 @@ func testTPAccActionsStartEngine(t *testing.T) { // Connect rpc client to rater func testTPAccActionsRpcConn(t *testing.T) { var err error - tpAccActionsRPC, err = jsonrpc.Dial("tcp", tpAccActionsCfg.RPCJSONListen) // We connect over JSON so we can also troubleshoot if needed + tpAccActionsRPC, err = jsonrpc.Dial("tcp", tpAccActionsCfg.ListenCfg().RPCJSONListen) // We connect over JSON so we can also troubleshoot if needed if err != nil { t.Fatal(err) } @@ -118,7 +119,8 @@ func testTPAccActionsRpcConn(t *testing.T) { func testTPAccActionsGetTPAccActionBeforeSet(t *testing.T) { var reply *utils.TPAccountActions - if err := tpAccActionsRPC.Call("ApierV1.GetTPAccountActions", &AttrGetTPAccountActions{TPid: "TPAcc", AccountActionsId: tpAccActionID}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { + if err := tpAccActionsRPC.Call("ApierV1.GetTPAccountActions", + &AttrGetTPAccountActions{TPid: "TPAcc", AccountActionsId: tpAccActionID}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } @@ -145,7 +147,8 @@ func testTPAccActionsSetTPAccAction(t *testing.T) { func testTPAccActionsGetTPAccActionAfterSet(t *testing.T) { var reply *utils.TPAccountActions - if err := tpAccActionsRPC.Call("ApierV1.GetTPAccountActions", &AttrGetTPAccountActions{TPid: "TPAcc", AccountActionsId: tpAccActionID}, &reply); err != nil { + if err := tpAccActionsRPC.Call("ApierV1.GetTPAccountActions", + &AttrGetTPAccountActions{TPid: "TPAcc", AccountActionsId: tpAccActionID}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(tpAccActions, reply) { t.Errorf("Expecting : %+v, received: %+v", tpAccActions, reply) @@ -155,7 +158,8 @@ func testTPAccActionsGetTPAccActionAfterSet(t *testing.T) { func testTPAccActionsGetTPAccountActionLoadIds(t *testing.T) { var result []string expectedTPID := []string{"ID"} - if err := tpAccActionsRPC.Call("ApierV1.GetTPAccountActionLoadIds", &AttrGetTPAccountActionIds{TPid: "TPAcc"}, &result); err != nil { + if err := tpAccActionsRPC.Call("ApierV1.GetTPAccountActionLoadIds", + &AttrGetTPAccountActionIds{TPid: "TPAcc"}, &result); err != nil { t.Error(err) } else if !reflect.DeepEqual(expectedTPID, result) { t.Errorf("Expecting: %+v, received: %+v", expectedTPID, result) @@ -165,7 +169,8 @@ func testTPAccActionsGetTPAccountActionLoadIds(t *testing.T) { func testTPAccActionsGetTPAccountActionIds(t *testing.T) { var result []string expectedTPID := []string{"ID:cgrates.org:1001"} - if err := tpAccActionsRPC.Call("ApierV1.GetTPAccountActionIds", &AttrGetTPAccountActionIds{TPid: "TPAcc"}, &result); err != nil { + if err := tpAccActionsRPC.Call("ApierV1.GetTPAccountActionIds", + &AttrGetTPAccountActionIds{TPid: "TPAcc"}, &result); err != nil { t.Error(err) } else if !reflect.DeepEqual(expectedTPID, result) { t.Errorf("Expecting: %+v, received: %+v", expectedTPID, result) @@ -185,7 +190,8 @@ func testTPAccActionsUpdateTPAccAction(t *testing.T) { func testTPAccActionsGetTPAccActionAfterUpdate(t *testing.T) { var reply *utils.TPAccountActions - if err := tpAccActionsRPC.Call("ApierV1.GetTPAccountActions", &AttrGetTPAccountActions{TPid: "TPAcc", AccountActionsId: tpAccActionID}, &reply); err != nil { + if err := tpAccActionsRPC.Call("ApierV1.GetTPAccountActions", + &AttrGetTPAccountActions{TPid: "TPAcc", AccountActionsId: tpAccActionID}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(tpAccActions, reply) { t.Errorf("Expecting : %+v, received: %+v", tpAccActions, reply) @@ -195,7 +201,8 @@ func testTPAccActionsGetTPAccActionAfterUpdate(t *testing.T) { func testTPAccActionsRemTPAccAction(t *testing.T) { var resp string - if err := tpAccActionsRPC.Call("ApierV1.RemTPAccountActions", &AttrGetTPAccountActions{TPid: "TPAcc", AccountActionsId: tpAccActionID}, &resp); err != nil { + if err := tpAccActionsRPC.Call("ApierV1.RemTPAccountActions", + &AttrGetTPAccountActions{TPid: "TPAcc", AccountActionsId: tpAccActionID}, &resp); err != nil { t.Error(err) } else if resp != utils.OK { t.Error("Unexpected reply returned", resp) @@ -205,7 +212,8 @@ func testTPAccActionsRemTPAccAction(t *testing.T) { func testTPAccActionsGetTPAccActionAfterRemove(t *testing.T) { var reply *utils.TPAccountActions - if err := tpAccActionsRPC.Call("ApierV1.GetTPAccountActions", &AttrGetTPAccountActions{TPid: "TPAcc", AccountActionsId: tpAccActionID}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { + if err := tpAccActionsRPC.Call("ApierV1.GetTPAccountActions", + &AttrGetTPAccountActions{TPid: "TPAcc", AccountActionsId: tpAccActionID}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } } diff --git a/apier/v1/tpactionplans_it_test.go b/apier/v1/tpactionplans_it_test.go index c61782af8..ee80eea17 100644 --- a/apier/v1/tpactionplans_it_test.go +++ b/apier/v1/tpactionplans_it_test.go @@ -21,14 +21,15 @@ along with this program. If not, see package v1 import ( - "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/engine" - "github.com/cgrates/cgrates/utils" "net/rpc" "net/rpc/jsonrpc" "path" "reflect" "testing" + + "github.com/cgrates/cgrates/config" + "github.com/cgrates/cgrates/engine" + "github.com/cgrates/cgrates/utils" ) var ( @@ -114,7 +115,7 @@ func testTPAccPlansStartEngine(t *testing.T) { // Connect rpc client to rater func testTPAccPlansRpcConn(t *testing.T) { var err error - tpAccPlansRPC, err = jsonrpc.Dial("tcp", tpAccPlansCfg.RPCJSONListen) // We connect over JSON so we can also troubleshoot if needed + tpAccPlansRPC, err = jsonrpc.Dial("tcp", tpAccPlansCfg.ListenCfg().RPCJSONListen) // We connect over JSON so we can also troubleshoot if needed if err != nil { t.Fatal(err) } @@ -122,7 +123,8 @@ func testTPAccPlansRpcConn(t *testing.T) { func testTPAccPlansGetTPAccPlanBeforeSet(t *testing.T) { var reply *utils.TPActionPlan - if err := tpAccPlansRPC.Call("ApierV1.GetTPActionPlan", &AttrGetTPActionPlan{TPid: "TPAcc", ID: "ID"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { + if err := tpAccPlansRPC.Call("ApierV1.GetTPActionPlan", + &AttrGetTPActionPlan{TPid: "TPAcc", ID: "ID"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } } @@ -154,7 +156,8 @@ func testTPAccPlansSetTPAccPlan(t *testing.T) { func testTPAccPlansGetTPAccPlanAfterSet(t *testing.T) { var reply *utils.TPActionPlan - if err := tpAccPlansRPC.Call("ApierV1.GetTPActionPlan", &AttrGetTPActionPlan{TPid: "TPAcc", ID: "ID"}, &reply); err != nil { + if err := tpAccPlansRPC.Call("ApierV1.GetTPActionPlan", + &AttrGetTPActionPlan{TPid: "TPAcc", ID: "ID"}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(tpAccPlan.TPid, reply.TPid) { t.Errorf("Expecting : %+v, received: %+v", tpAccPlan.TPid, reply.TPid) @@ -168,7 +171,8 @@ func testTPAccPlansGetTPAccPlanAfterSet(t *testing.T) { func testTPAccPlansGetTPAccPlanIds(t *testing.T) { var result []string expectedTPID := []string{"ID"} - if err := tpAccPlansRPC.Call("ApierV1.GetTPActionPlanIds", &AttrGetTPActionPlanIds{TPid: "TPAcc"}, &result); err != nil { + if err := tpAccPlansRPC.Call("ApierV1.GetTPActionPlanIds", + &AttrGetTPActionPlanIds{TPid: "TPAcc"}, &result); err != nil { t.Error(err) } else if !reflect.DeepEqual(expectedTPID, result) { t.Errorf("Expecting: %+v, received: %+v", expectedTPID, result) @@ -205,7 +209,8 @@ func testTPAccPlansUpdateTPAccPlan(t *testing.T) { func testTPAccPlansGetTPAccPlanAfterUpdate(t *testing.T) { var reply *utils.TPActionPlan - if err := tpAccPlansRPC.Call("ApierV1.GetTPActionPlan", &AttrGetTPActionPlan{TPid: "TPAcc", ID: "ID"}, &reply); err != nil { + if err := tpAccPlansRPC.Call("ApierV1.GetTPActionPlan", + &AttrGetTPActionPlan{TPid: "TPAcc", ID: "ID"}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(tpAccPlan.TPid, reply.TPid) { t.Errorf("Expecting : %+v, received: %+v", tpAccPlan.TPid, reply.TPid) @@ -219,7 +224,8 @@ func testTPAccPlansGetTPAccPlanAfterUpdate(t *testing.T) { func testTPAccPlansRemTPAccPlan(t *testing.T) { var resp string - if err := tpAccPlansRPC.Call("ApierV1.RemTPActionPlan", &AttrGetTPActionPlan{TPid: "TPAcc", ID: "ID"}, &resp); err != nil { + if err := tpAccPlansRPC.Call("ApierV1.RemTPActionPlan", + &AttrGetTPActionPlan{TPid: "TPAcc", ID: "ID"}, &resp); err != nil { t.Error(err) } else if resp != utils.OK { t.Error("Unexpected reply returned", resp) @@ -229,7 +235,8 @@ func testTPAccPlansRemTPAccPlan(t *testing.T) { func testTPAccPlansGetTPAccPlanAfterRemove(t *testing.T) { var reply *utils.TPActionPlan - if err := tpAccPlansRPC.Call("ApierV1.GetTPActionPlan", &AttrGetTPActionPlan{TPid: "TPAcc", ID: "ID"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { + if err := tpAccPlansRPC.Call("ApierV1.GetTPActionPlan", + &AttrGetTPActionPlan{TPid: "TPAcc", ID: "ID"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } } diff --git a/apier/v1/tpactions_it_test.go b/apier/v1/tpactions_it_test.go index 4eac031b1..c3809770e 100644 --- a/apier/v1/tpactions_it_test.go +++ b/apier/v1/tpactions_it_test.go @@ -21,14 +21,15 @@ along with this program. If not, see package v1 import ( - "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/engine" - "github.com/cgrates/cgrates/utils" "net/rpc" "net/rpc/jsonrpc" "path" "reflect" "testing" + + "github.com/cgrates/cgrates/config" + "github.com/cgrates/cgrates/engine" + "github.com/cgrates/cgrates/utils" ) var ( @@ -114,7 +115,7 @@ func testTPActionsStartEngine(t *testing.T) { // Connect rpc client to rater func testTPActionsRpcConn(t *testing.T) { var err error - tpActionRPC, err = jsonrpc.Dial("tcp", tpActionCfg.RPCJSONListen) // We connect over JSON so we can also troubleshoot if needed + tpActionRPC, err = jsonrpc.Dial("tcp", tpActionCfg.ListenCfg().RPCJSONListen) // We connect over JSON so we can also troubleshoot if needed if err != nil { t.Fatal(err) } @@ -122,7 +123,8 @@ func testTPActionsRpcConn(t *testing.T) { func testTPActionsGetTPActionBeforeSet(t *testing.T) { var reply *utils.TPActionPlan - if err := tpActionRPC.Call("ApierV1.GetTPActions", &AttrGetTPActions{TPid: "TPAcc", ID: "ID"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { + if err := tpActionRPC.Call("ApierV1.GetTPActions", + &AttrGetTPActions{TPid: "TPAcc", ID: "ID"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } } @@ -184,7 +186,8 @@ func testTPActionsSetTPAction(t *testing.T) { func testTPActionsGetTPActionAfterSet(t *testing.T) { var reply *utils.TPActions - if err := tpActionRPC.Call("ApierV1.GetTPActions", &AttrGetTPActions{TPid: "TPAcc", ID: "ID"}, &reply); err != nil { + if err := tpActionRPC.Call("ApierV1.GetTPActions", + &AttrGetTPActions{TPid: "TPAcc", ID: "ID"}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(tpActions.TPid, reply.TPid) { t.Errorf("Expecting : %+v, received: %+v", tpActions.TPid, reply.TPid) @@ -198,7 +201,8 @@ func testTPActionsGetTPActionAfterSet(t *testing.T) { func testTPActionsGetTPActionIds(t *testing.T) { var result []string expectedTPID := []string{"ID"} - if err := tpActionRPC.Call("ApierV1.GetTPActionIds", &AttrGetTPActionIds{TPid: "TPAcc"}, &result); err != nil { + if err := tpActionRPC.Call("ApierV1.GetTPActionIds", + &AttrGetTPActionIds{TPid: "TPAcc"}, &result); err != nil { t.Error(err) } else if !reflect.DeepEqual(expectedTPID, result) { t.Errorf("Expecting: %+v, received: %+v", expectedTPID, result) @@ -279,7 +283,8 @@ func testTPActionsUpdateTPAction(t *testing.T) { func testTPActionsGetTPActionAfterUpdate(t *testing.T) { var reply *utils.TPActions - if err := tpActionRPC.Call("ApierV1.GetTPActions", &AttrGetTPActions{TPid: "TPAcc", ID: "ID"}, &reply); err != nil { + if err := tpActionRPC.Call("ApierV1.GetTPActions", + &AttrGetTPActions{TPid: "TPAcc", ID: "ID"}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(tpActions.TPid, reply.TPid) { t.Errorf("Expecting : %+v, received: %+v", tpActions.TPid, reply.TPid) @@ -293,7 +298,8 @@ func testTPActionsGetTPActionAfterUpdate(t *testing.T) { func testTPActionsRemTPAction(t *testing.T) { var resp string - if err := tpActionRPC.Call("ApierV1.RemTPActions", &AttrGetTPActions{TPid: "TPAcc", ID: "ID"}, &resp); err != nil { + if err := tpActionRPC.Call("ApierV1.RemTPActions", + &AttrGetTPActions{TPid: "TPAcc", ID: "ID"}, &resp); err != nil { t.Error(err) } else if resp != utils.OK { t.Error("Unexpected reply returned", resp) @@ -303,7 +309,8 @@ func testTPActionsRemTPAction(t *testing.T) { func testTPActionsGetTPActionAfterRemove(t *testing.T) { var reply *utils.TPActionPlan - if err := tpActionRPC.Call("ApierV1.GetTPActions", &AttrGetTPActions{TPid: "TPAcc", ID: "ID"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { + if err := tpActionRPC.Call("ApierV1.GetTPActions", + &AttrGetTPActions{TPid: "TPAcc", ID: "ID"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } } diff --git a/apier/v1/tpactiontriggers_it_test.go b/apier/v1/tpactiontriggers_it_test.go index 98da3f997..aac036c77 100644 --- a/apier/v1/tpactiontriggers_it_test.go +++ b/apier/v1/tpactiontriggers_it_test.go @@ -21,14 +21,15 @@ along with this program. If not, see package v1 import ( - "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/engine" - "github.com/cgrates/cgrates/utils" "net/rpc" "net/rpc/jsonrpc" "path" "reflect" "testing" + + "github.com/cgrates/cgrates/config" + "github.com/cgrates/cgrates/engine" + "github.com/cgrates/cgrates/utils" ) var ( @@ -114,7 +115,7 @@ func testTPActionTriggersStartEngine(t *testing.T) { // Connect rpc client to rater func testTPActionTriggersRpcConn(t *testing.T) { var err error - tpActionTriggerRPC, err = jsonrpc.Dial("tcp", tpActionTriggerCfg.RPCJSONListen) // We connect over JSON so we can also troubleshoot if needed + tpActionTriggerRPC, err = jsonrpc.Dial("tcp", tpActionTriggerCfg.ListenCfg().RPCJSONListen) // We connect over JSON so we can also troubleshoot if needed if err != nil { t.Fatal(err) } @@ -122,7 +123,8 @@ func testTPActionTriggersRpcConn(t *testing.T) { func testTPActionTriggersGetTPActionTriggersBeforeSet(t *testing.T) { var reply *utils.TPActionTriggers - if err := tpActionTriggerRPC.Call("ApierV1.GetTPActionTriggers", &AttrGetTPActionTriggers{TPid: "TPAct", ID: "ID"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { + if err := tpActionTriggerRPC.Call("ApierV1.GetTPActionTriggers", + &AttrGetTPActionTriggers{TPid: "TPAct", ID: "ID"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } } @@ -194,7 +196,8 @@ func testTPActionTriggersSetTPActionTriggers(t *testing.T) { func testTPActionTriggersGetTPActionTriggersAfterSet(t *testing.T) { var reply *utils.TPActionTriggers - if err := tpActionTriggerRPC.Call("ApierV1.GetTPActionTriggers", &AttrGetTPActionTriggers{TPid: "TPAct", ID: "ID"}, &reply); err != nil { + if err := tpActionTriggerRPC.Call("ApierV1.GetTPActionTriggers", + &AttrGetTPActionTriggers{TPid: "TPAct", ID: "ID"}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(tpActionTriggers.TPid, reply.TPid) { t.Errorf("Expecting : %+v, received: %+v", tpActionTriggers.TPid, reply.TPid) @@ -208,7 +211,8 @@ func testTPActionTriggersGetTPActionTriggersAfterSet(t *testing.T) { func testTPActionTriggersGetTPActionTriggersIds(t *testing.T) { var result []string expectedTPID := []string{"ID"} - if err := tpActionTriggerRPC.Call("ApierV1.GetTPActionTriggerIds", &AttrGetTPActionTriggerIds{TPid: "TPAct"}, &result); err != nil { + if err := tpActionTriggerRPC.Call("ApierV1.GetTPActionTriggerIds", + &AttrGetTPActionTriggerIds{TPid: "TPAct"}, &result); err != nil { t.Error(err) } else if !reflect.DeepEqual(expectedTPID, result) { t.Errorf("Expecting: %+v, received: %+v", expectedTPID, result) @@ -305,7 +309,8 @@ func testTPActionTriggersUpdateTPActionTriggers(t *testing.T) { func testTPActionTriggersGetTPActionTriggersAfterUpdate(t *testing.T) { var reply *utils.TPActionTriggers - if err := tpActionTriggerRPC.Call("ApierV1.GetTPActionTriggers", &AttrGetTPActionTriggers{TPid: "TPAct", ID: "ID"}, &reply); err != nil { + if err := tpActionTriggerRPC.Call("ApierV1.GetTPActionTriggers", + &AttrGetTPActionTriggers{TPid: "TPAct", ID: "ID"}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(tpActionTriggers.TPid, reply.TPid) { t.Errorf("Expecting : %+v, received: %+v", tpActionTriggers.TPid, reply.TPid) @@ -319,7 +324,8 @@ func testTPActionTriggersGetTPActionTriggersAfterUpdate(t *testing.T) { func testTPActionTriggersRemTPActionTriggers(t *testing.T) { var resp string - if err := tpActionTriggerRPC.Call("ApierV1.RemTPActionTriggers", &AttrGetTPActionTriggers{TPid: "TPAct", ID: "ID"}, &resp); err != nil { + if err := tpActionTriggerRPC.Call("ApierV1.RemTPActionTriggers", + &AttrGetTPActionTriggers{TPid: "TPAct", ID: "ID"}, &resp); err != nil { t.Error(err) } else if resp != utils.OK { t.Error("Unexpected reply returned", resp) @@ -329,7 +335,8 @@ func testTPActionTriggersRemTPActionTriggers(t *testing.T) { func testTPActionTriggersGetTPActionTriggersAfterRemove(t *testing.T) { var reply *utils.TPActionTriggers - if err := tpActionTriggerRPC.Call("ApierV1.GetTPActionTriggers", &AttrGetTPActionTriggers{TPid: "TPAct", ID: "ID"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { + if err := tpActionTriggerRPC.Call("ApierV1.GetTPActionTriggers", + &AttrGetTPActionTriggers{TPid: "TPAct", ID: "ID"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } } diff --git a/apier/v1/tpattributes_it_test.go b/apier/v1/tpattributes_it_test.go index 70cf06cec..150d8879d 100644 --- a/apier/v1/tpattributes_it_test.go +++ b/apier/v1/tpattributes_it_test.go @@ -21,14 +21,15 @@ along with this program. If not, see package v1 import ( - "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/engine" - "github.com/cgrates/cgrates/utils" "net/rpc" "net/rpc/jsonrpc" "path" "reflect" "testing" + + "github.com/cgrates/cgrates/config" + "github.com/cgrates/cgrates/engine" + "github.com/cgrates/cgrates/utils" ) var ( @@ -106,7 +107,7 @@ func testTPAlsPrfStartEngine(t *testing.T) { // Connect rpc client to rater func testTPAlsPrfRPCConn(t *testing.T) { var err error - tpAlsPrfRPC, err = jsonrpc.Dial("tcp", tpAlsPrfCfg.RPCJSONListen) // We connect over JSON so we can also troubleshoot if needed + tpAlsPrfRPC, err = jsonrpc.Dial("tcp", tpAlsPrfCfg.ListenCfg().RPCJSONListen) // We connect over JSON so we can also troubleshoot if needed if err != nil { t.Fatal(err) } @@ -114,7 +115,8 @@ func testTPAlsPrfRPCConn(t *testing.T) { func testTPAlsPrfGetTPAlsPrfBeforeSet(t *testing.T) { var reply *utils.TPAttributeProfile - if err := tpAlsPrfRPC.Call("ApierV1.GetTPAttributeProfile", &AttrGetTPAttributeProfile{TPid: "TP1", ID: "ALS1"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { + if err := tpAlsPrfRPC.Call("ApierV1.GetTPAttributeProfile", + &AttrGetTPAttributeProfile{TPid: "TP1", ID: "ALS1"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } } @@ -150,7 +152,8 @@ func testTPAlsPrfSetTPAlsPrf(t *testing.T) { func testTPAlsPrfGetTPAlsPrfAfterSet(t *testing.T) { var reply *utils.TPAttributeProfile - if err := tpAlsPrfRPC.Call("ApierV1.GetTPAttributeProfile", &AttrGetTPAttributeProfile{TPid: "TP1", ID: "Attr1"}, &reply); err != nil { + if err := tpAlsPrfRPC.Call("ApierV1.GetTPAttributeProfile", + &AttrGetTPAttributeProfile{TPid: "TP1", ID: "Attr1"}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(tpAlsPrf, reply) { t.Errorf("Expecting : %+v, received: %+v", tpAlsPrf, reply) @@ -160,7 +163,8 @@ func testTPAlsPrfGetTPAlsPrfAfterSet(t *testing.T) { func testTPAlsPrfGetTPAlsPrfIDs(t *testing.T) { var result []string expectedTPID := []string{"Attr1"} - if err := tpAlsPrfRPC.Call("ApierV1.GetTPAttributeProfileIds", &AttrGetTPAttributeProfileIds{TPid: "TP1"}, &result); err != nil { + if err := tpAlsPrfRPC.Call("ApierV1.GetTPAttributeProfileIds", + &AttrGetTPAttributeProfileIds{TPid: "TP1"}, &result); err != nil { t.Error(err) } else if !reflect.DeepEqual(expectedTPID, result) { t.Errorf("Expecting: %+v, received: %+v", expectedTPID, result) diff --git a/apier/v1/tpderivedcharges_it_test.go b/apier/v1/tpderivedcharges_it_test.go index 9aeba19c0..59091e761 100644 --- a/apier/v1/tpderivedcharges_it_test.go +++ b/apier/v1/tpderivedcharges_it_test.go @@ -21,14 +21,15 @@ along with this program. If not, see package v1 import ( - "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/engine" - "github.com/cgrates/cgrates/utils" "net/rpc" "net/rpc/jsonrpc" "path" "reflect" "testing" + + "github.com/cgrates/cgrates/config" + "github.com/cgrates/cgrates/engine" + "github.com/cgrates/cgrates/utils" ) var ( @@ -114,7 +115,7 @@ func testTPDerivedChargersStartEngine(t *testing.T) { // Connect rpc client to rater func testTPDerivedChargersRpcConn(t *testing.T) { var err error - tpDerivedChargersRPC, err = jsonrpc.Dial("tcp", tpDerivedChargersCfg.RPCJSONListen) // We connect over JSON so we can also troubleshoot if needed + tpDerivedChargersRPC, err = jsonrpc.Dial("tcp", tpDerivedChargersCfg.ListenCfg().RPCJSONListen) // We connect over JSON so we can also troubleshoot if needed if err != nil { t.Fatal(err) } @@ -122,7 +123,8 @@ func testTPDerivedChargersRpcConn(t *testing.T) { func testTPDerivedChargersGetTPDerivedChargersBeforeSet(t *testing.T) { var reply *utils.TPDerivedChargers - if err := tpDerivedChargersRPC.Call("ApierV1.GetTPDerivedChargers", &AttrGetTPDerivedChargers{TPid: "TPD", DerivedChargersId: tpDerivedChargersID}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { + if err := tpDerivedChargersRPC.Call("ApierV1.GetTPDerivedChargers", + &AttrGetTPDerivedChargers{TPid: "TPD", DerivedChargersId: tpDerivedChargersID}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } @@ -170,7 +172,8 @@ func testTPDerivedChargersSetTPDerivedChargers(t *testing.T) { func testTPDerivedChargersGetTPDerivedChargersAfterSet(t *testing.T) { var reply *utils.TPDerivedChargers - if err := tpDerivedChargersRPC.Call("ApierV1.GetTPDerivedChargers", &AttrGetTPDerivedChargers{TPid: "TPD", DerivedChargersId: tpDerivedChargersID}, &reply); err != nil { + if err := tpDerivedChargersRPC.Call("ApierV1.GetTPDerivedChargers", + &AttrGetTPDerivedChargers{TPid: "TPD", DerivedChargersId: tpDerivedChargersID}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(tpDerivedChargers.TPid, reply.TPid) { t.Errorf("Expecting : %+v, received: %+v", tpDerivedChargers.TPid, reply.TPid) @@ -197,7 +200,8 @@ func testTPDerivedChargersGetTPDerivedChargersAfterSet(t *testing.T) { func testTPDerivedChargersGetTPDerivedChargerIds(t *testing.T) { var result []string expectedTPID := []string{"LoadID:*out:cgrates.org:call:1001:1001"} - if err := tpDerivedChargersRPC.Call("ApierV1.GetTPDerivedChargerIds", &AttrGetTPDerivedChargeIds{TPid: "TPD"}, &result); err != nil { + if err := tpDerivedChargersRPC.Call("ApierV1.GetTPDerivedChargerIds", + &AttrGetTPDerivedChargeIds{TPid: "TPD"}, &result); err != nil { t.Error(err) } else if !reflect.DeepEqual(expectedTPID, result) { t.Errorf("Expecting: %+v, received: %+v", expectedTPID, result) @@ -257,7 +261,8 @@ func testTPDerivedChargersUpdateTPDerivedChargers(t *testing.T) { func testTPDerivedChargersGetTPDerivedChargersAfterUpdate(t *testing.T) { var reply *utils.TPDerivedChargers - if err := tpDerivedChargersRPC.Call("ApierV1.GetTPDerivedChargers", &AttrGetTPDerivedChargers{TPid: "TPD", DerivedChargersId: tpDerivedChargersID}, &reply); err != nil { + if err := tpDerivedChargersRPC.Call("ApierV1.GetTPDerivedChargers", + &AttrGetTPDerivedChargers{TPid: "TPD", DerivedChargersId: tpDerivedChargersID}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(tpDerivedChargers.TPid, reply.TPid) { t.Errorf("Expecting : %+v, received: %+v", tpDerivedChargers.TPid, reply.TPid) @@ -283,7 +288,8 @@ func testTPDerivedChargersGetTPDerivedChargersAfterUpdate(t *testing.T) { func testTPDerivedChargersRemTPDerivedChargers(t *testing.T) { var resp string - if err := tpDerivedChargersRPC.Call("ApierV1.RemTPDerivedChargers", &AttrGetTPDerivedChargers{TPid: "TPD", DerivedChargersId: tpDerivedChargersID}, &resp); err != nil { + if err := tpDerivedChargersRPC.Call("ApierV1.RemTPDerivedChargers", + &AttrGetTPDerivedChargers{TPid: "TPD", DerivedChargersId: tpDerivedChargersID}, &resp); err != nil { t.Error(err) } else if resp != utils.OK { t.Error("Unexpected reply returned", resp) @@ -293,7 +299,8 @@ func testTPDerivedChargersRemTPDerivedChargers(t *testing.T) { func testTPDerivedChargersGetTPDerivedChargersAfterRemove(t *testing.T) { var reply *utils.TPDerivedChargers - if err := tpDerivedChargersRPC.Call("ApierV1.GetTPDerivedChargers", &AttrGetTPDerivedChargers{TPid: "TPD", DerivedChargersId: tpDerivedChargersID}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { + if err := tpDerivedChargersRPC.Call("ApierV1.GetTPDerivedChargers", + &AttrGetTPDerivedChargers{TPid: "TPD", DerivedChargersId: tpDerivedChargersID}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } } diff --git a/apier/v1/tpdestinations_it_test.go b/apier/v1/tpdestinations_it_test.go index fb85da7db..2de20d2f3 100644 --- a/apier/v1/tpdestinations_it_test.go +++ b/apier/v1/tpdestinations_it_test.go @@ -21,14 +21,15 @@ along with this program. If not, see package v1 import ( - "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/engine" - "github.com/cgrates/cgrates/utils" "net/rpc" "net/rpc/jsonrpc" "path" "reflect" "testing" + + "github.com/cgrates/cgrates/config" + "github.com/cgrates/cgrates/engine" + "github.com/cgrates/cgrates/utils" ) var ( @@ -113,7 +114,7 @@ func testTPDestinationsStartEngine(t *testing.T) { // Connect rpc client to rater func testTPDestinationsRpcConn(t *testing.T) { var err error - tpDestinationRPC, err = jsonrpc.Dial("tcp", tpDestinationCfg.RPCJSONListen) // We connect over JSON so we can also troubleshoot if needed + tpDestinationRPC, err = jsonrpc.Dial("tcp", tpDestinationCfg.ListenCfg().RPCJSONListen) // We connect over JSON so we can also troubleshoot if needed if err != nil { t.Fatal(err) } @@ -121,7 +122,8 @@ func testTPDestinationsRpcConn(t *testing.T) { func testTPDestinationsGetTPDestinationBeforeSet(t *testing.T) { var reply *utils.TPDestination - if err := tpDestinationRPC.Call("ApierV1.GetTPDestination", &AttrGetTPDestination{TPid: "TPD", ID: "GERMANY"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { + if err := tpDestinationRPC.Call("ApierV1.GetTPDestination", + &AttrGetTPDestination{TPid: "TPD", ID: "GERMANY"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } @@ -143,7 +145,8 @@ func testTPDestinationsSetTPDestination(t *testing.T) { func testTPDestinationsGetTPDestinationAfterSet(t *testing.T) { var reply *utils.TPDestination - if err := tpDestinationRPC.Call("ApierV1.GetTPDestination", &AttrGetTPDestination{TPid: "TPD", ID: "GERMANY"}, &reply); err != nil { + if err := tpDestinationRPC.Call("ApierV1.GetTPDestination", + &AttrGetTPDestination{TPid: "TPD", ID: "GERMANY"}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(tpDestination.TPid, reply.TPid) { t.Errorf("Expecting : %+v, received: %+v", tpDestination.TPid, reply.TPid) @@ -158,7 +161,8 @@ func testTPDestinationsGetTPDestinationAfterSet(t *testing.T) { func testTPDestinationsGetTPDestinationIds(t *testing.T) { var result []string expectedTPID := []string{"GERMANY"} - if err := tpDestinationRPC.Call("ApierV1.GetTPDestinationIDs", &AttrGetTPDestinationIds{TPid: "TPD"}, &result); err != nil { + if err := tpDestinationRPC.Call("ApierV1.GetTPDestinationIDs", + &AttrGetTPDestinationIds{TPid: "TPD"}, &result); err != nil { t.Error(err) } else if !reflect.DeepEqual(expectedTPID, result) { t.Errorf("Expecting: %+v, received: %+v", expectedTPID, result) @@ -179,7 +183,8 @@ func testTPDestinationsUpdateTPDestination(t *testing.T) { func testTPDestinationsGetTPDestinationAfterUpdate(t *testing.T) { var reply *utils.TPDestination - if err := tpDestinationRPC.Call("ApierV1.GetTPDestination", &AttrGetTPDestination{TPid: "TPD", ID: "GERMANY"}, &reply); err != nil { + if err := tpDestinationRPC.Call("ApierV1.GetTPDestination", + &AttrGetTPDestination{TPid: "TPD", ID: "GERMANY"}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(tpDestination.TPid, reply.TPid) { t.Errorf("Expecting : %+v, received: %+v", tpDestination.TPid, reply.TPid) @@ -193,7 +198,8 @@ func testTPDestinationsGetTPDestinationAfterUpdate(t *testing.T) { func testTPDestinationsRemTPDestination(t *testing.T) { var resp string - if err := tpDestinationRPC.Call("ApierV1.RemTPDestination", &AttrGetTPDestination{TPid: "TPD", ID: "GERMANY"}, &resp); err != nil { + if err := tpDestinationRPC.Call("ApierV1.RemTPDestination", + &AttrGetTPDestination{TPid: "TPD", ID: "GERMANY"}, &resp); err != nil { t.Error(err) } else if resp != utils.OK { t.Error("Unexpected reply returned", resp) @@ -203,7 +209,8 @@ func testTPDestinationsRemTPDestination(t *testing.T) { func testTPDestinationsGetTPDestinationAfterRemove(t *testing.T) { var reply *utils.TPDestination - if err := tpDestinationRPC.Call("ApierV1.GetTPDestination", &AttrGetTPDestination{TPid: "TPD", ID: "GERMANY"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { + if err := tpDestinationRPC.Call("ApierV1.GetTPDestination", + &AttrGetTPDestination{TPid: "TPD", ID: "GERMANY"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } } diff --git a/apier/v1/tpfilters_it_test.go b/apier/v1/tpfilters_it_test.go index 908eed431..62072ab75 100644 --- a/apier/v1/tpfilters_it_test.go +++ b/apier/v1/tpfilters_it_test.go @@ -21,14 +21,15 @@ along with this program. If not, see package v1 import ( - "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/engine" - "github.com/cgrates/cgrates/utils" "net/rpc" "net/rpc/jsonrpc" "path" "reflect" "testing" + + "github.com/cgrates/cgrates/config" + "github.com/cgrates/cgrates/engine" + "github.com/cgrates/cgrates/utils" ) var ( @@ -113,7 +114,7 @@ func testTPFilterStartEngine(t *testing.T) { // Connect rpc client to rater func testTPFilterRpcConn(t *testing.T) { var err error - tpFilterRPC, err = jsonrpc.Dial("tcp", tpFilterCfg.RPCJSONListen) // We connect over JSON so we can also troubleshoot if needed + tpFilterRPC, err = jsonrpc.Dial("tcp", tpFilterCfg.ListenCfg().RPCJSONListen) // We connect over JSON so we can also troubleshoot if needed if err != nil { t.Fatal(err) } @@ -121,7 +122,8 @@ func testTPFilterRpcConn(t *testing.T) { func ttestTPFilterGetTPFilterBeforeSet(t *testing.T) { var reply *utils.TPFilterProfile - if err := tpFilterRPC.Call("ApierV1.GetTPFilterProfile", &AttrGetTPFilterProfile{TPid: "TP1", ID: "Filter"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { + if err := tpFilterRPC.Call("ApierV1.GetTPFilterProfile", + &AttrGetTPFilterProfile{TPid: "TP1", ID: "Filter"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } } @@ -154,7 +156,8 @@ func testTPFilterSetTPFilter(t *testing.T) { func testTPFilterGetTPFilterAfterSet(t *testing.T) { var reply *utils.TPFilterProfile - if err := tpFilterRPC.Call("ApierV1.GetTPFilterProfile", &AttrGetTPFilterProfile{TPid: "TP1", ID: "Filter"}, &reply); err != nil { + if err := tpFilterRPC.Call("ApierV1.GetTPFilterProfile", + &AttrGetTPFilterProfile{TPid: "TP1", ID: "Filter"}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(tpFilter, reply) { t.Errorf("Expecting : %+v, received: %+v", tpFilter, reply) @@ -164,7 +167,8 @@ func testTPFilterGetTPFilterAfterSet(t *testing.T) { func testTPFilterGetFilterIds(t *testing.T) { var result []string expectedTPID := []string{"Filter"} - if err := tpFilterRPC.Call("ApierV1.GetTPFilterProfileIds", &AttrGetTPFilterProfileIds{TPid: "TP1"}, &result); err != nil { + if err := tpFilterRPC.Call("ApierV1.GetTPFilterProfileIds", + &AttrGetTPFilterProfileIds{TPid: "TP1"}, &result); err != nil { t.Error(err) } else if !reflect.DeepEqual(expectedTPID, result) { t.Errorf("Expecting: %+v, received: %+v", expectedTPID, result) @@ -194,7 +198,8 @@ func testTPFilterUpdateTPFilter(t *testing.T) { func testTPFilterGetTPFilterAfterUpdate(t *testing.T) { var reply *utils.TPFilterProfile - if err := tpFilterRPC.Call("ApierV1.GetTPFilterProfile", &AttrGetTPFilterProfile{TPid: "TP1", ID: "Filter"}, &reply); err != nil { + if err := tpFilterRPC.Call("ApierV1.GetTPFilterProfile", + &AttrGetTPFilterProfile{TPid: "TP1", ID: "Filter"}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(tpFilter, reply) { t.Errorf("Expecting : %+v, received: %+v", tpFilter, reply) @@ -203,7 +208,8 @@ func testTPFilterGetTPFilterAfterUpdate(t *testing.T) { func testTPFilterRemTPFilter(t *testing.T) { var resp string - if err := tpFilterRPC.Call("ApierV1.RemTPFilterProfile", &AttrRemTPFilterProfile{TPid: "TP1", Tenant: "cgrates.org", ID: "Filter"}, &resp); err != nil { + if err := tpFilterRPC.Call("ApierV1.RemTPFilterProfile", + &AttrRemTPFilterProfile{TPid: "TP1", Tenant: "cgrates.org", ID: "Filter"}, &resp); err != nil { t.Error(err) } else if resp != utils.OK { t.Error("Unexpected reply returned", resp) @@ -212,7 +218,8 @@ func testTPFilterRemTPFilter(t *testing.T) { func testTPFilterGetTPFilterAfterRemove(t *testing.T) { var reply *utils.TPFilterProfile - if err := tpFilterRPC.Call("ApierV1.GetTPFilterProfile", &AttrGetTPFilterProfile{TPid: "TP1", ID: "Filter"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { + if err := tpFilterRPC.Call("ApierV1.GetTPFilterProfile", + &AttrGetTPFilterProfile{TPid: "TP1", ID: "Filter"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } } diff --git a/apier/v1/tprates_it_test.go b/apier/v1/tprates_it_test.go index 282cd9df2..ed30f8e81 100644 --- a/apier/v1/tprates_it_test.go +++ b/apier/v1/tprates_it_test.go @@ -21,14 +21,15 @@ along with this program. If not, see package v1 import ( - "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/engine" - "github.com/cgrates/cgrates/utils" "net/rpc" "net/rpc/jsonrpc" "path" "reflect" "testing" + + "github.com/cgrates/cgrates/config" + "github.com/cgrates/cgrates/engine" + "github.com/cgrates/cgrates/utils" ) var ( @@ -113,7 +114,7 @@ func testTPRatesStartEngine(t *testing.T) { // Connect rpc client to rater func testTPRatesRpcConn(t *testing.T) { var err error - tpRateRPC, err = jsonrpc.Dial("tcp", tpRateCfg.RPCJSONListen) // We connect over JSON so we can also troubleshoot if needed + tpRateRPC, err = jsonrpc.Dial("tcp", tpRateCfg.ListenCfg().RPCJSONListen) // We connect over JSON so we can also troubleshoot if needed if err != nil { t.Fatal(err) } @@ -121,7 +122,8 @@ func testTPRatesRpcConn(t *testing.T) { func testTPRatesGetTPRateforeSet(t *testing.T) { var reply *utils.TPRate - if err := tpRateRPC.Call("ApierV1.GetTPRate", &AttrGetTPRate{TPid: "TPidTpRate", ID: "RT_FS_USERS"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { + if err := tpRateRPC.Call("ApierV1.GetTPRate", + &AttrGetTPRate{TPid: "TPidTpRate", ID: "RT_FS_USERS"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } } @@ -208,7 +210,8 @@ func testTPRatesUpdateTPRate(t *testing.T) { func testTPRatesGetTPRateAfterUpdate(t *testing.T) { var reply *utils.TPRate - if err := tpRateRPC.Call("ApierV1.GetTPRate", &AttrGetTPRate{TPid: "TPidTpRate", ID: tpRate.ID}, &reply); err != nil { + if err := tpRateRPC.Call("ApierV1.GetTPRate", + &AttrGetTPRate{TPid: "TPidTpRate", ID: tpRate.ID}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(tpRate, reply) { t.Errorf("Expecting : %+v, received: %+v", tpRate, reply) @@ -218,7 +221,8 @@ func testTPRatesGetTPRateAfterUpdate(t *testing.T) { func testTPRatesRemTPRate(t *testing.T) { var resp string - if err := tpRateRPC.Call("ApierV1.RemTPRate", &AttrGetTPRate{TPid: "TPidTpRate", ID: "RT_FS_USERS"}, &resp); err != nil { + if err := tpRateRPC.Call("ApierV1.RemTPRate", + &AttrGetTPRate{TPid: "TPidTpRate", ID: "RT_FS_USERS"}, &resp); err != nil { t.Error(err) } else if resp != utils.OK { t.Error("Unexpected reply returned", resp) @@ -227,7 +231,8 @@ func testTPRatesRemTPRate(t *testing.T) { func testTPRatesGetTPRateAfterRemove(t *testing.T) { var reply *utils.TPRate - if err := tpRateRPC.Call("ApierV1.GetTPRate", &AttrGetTPRate{TPid: "TPidTpRate", ID: "RT_FS_USERS"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { + if err := tpRateRPC.Call("ApierV1.GetTPRate", + &AttrGetTPRate{TPid: "TPidTpRate", ID: "RT_FS_USERS"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } } diff --git a/apier/v1/tpratingplans_it_test.go b/apier/v1/tpratingplans_it_test.go index e2390f98d..43a83166a 100644 --- a/apier/v1/tpratingplans_it_test.go +++ b/apier/v1/tpratingplans_it_test.go @@ -21,14 +21,15 @@ along with this program. If not, see package v1 import ( - "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/engine" - "github.com/cgrates/cgrates/utils" "net/rpc" "net/rpc/jsonrpc" "path" "reflect" "testing" + + "github.com/cgrates/cgrates/config" + "github.com/cgrates/cgrates/engine" + "github.com/cgrates/cgrates/utils" ) var ( @@ -113,7 +114,7 @@ func testTPRatingPlansStartEngine(t *testing.T) { // Connect rpc client to rater func testTPRatingPlansRpcConn(t *testing.T) { var err error - tpRatingPlanRPC, err = jsonrpc.Dial("tcp", tpRatingPlanCfg.RPCJSONListen) // We connect over JSON so we can also troubleshoot if needed + tpRatingPlanRPC, err = jsonrpc.Dial("tcp", tpRatingPlanCfg.ListenCfg().RPCJSONListen) // We connect over JSON so we can also troubleshoot if needed if err != nil { t.Fatal(err) } @@ -121,7 +122,8 @@ func testTPRatingPlansRpcConn(t *testing.T) { func testTPRatingPlansGetTPRatingPlanBeforeSet(t *testing.T) { var reply *utils.TPRatingPlan - if err := tpRatingPlanRPC.Call("ApierV1.GetTPRatingPlan", &AttrGetTPRatingPlan{TPid: "TPRP1", ID: "Plan1"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { + if err := tpRatingPlanRPC.Call("ApierV1.GetTPRatingPlan", + &AttrGetTPRatingPlan{TPid: "TPRP1", ID: "Plan1"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } } @@ -153,7 +155,8 @@ func testTPRatingPlansSetTPRatingPlan(t *testing.T) { func testTPRatingPlansGetTPRatingPlanAfterSet(t *testing.T) { var respond *utils.TPRatingPlan - if err := tpRatingPlanRPC.Call("ApierV1.GetTPRatingPlan", &AttrGetTPRatingPlan{TPid: "TPRP1", ID: "Plan1"}, &respond); err != nil { + if err := tpRatingPlanRPC.Call("ApierV1.GetTPRatingPlan", + &AttrGetTPRatingPlan{TPid: "TPRP1", ID: "Plan1"}, &respond); err != nil { t.Error(err) } else if !reflect.DeepEqual(tpRatingPlan.TPid, respond.TPid) { t.Errorf("Expecting : %+v, received: %+v", tpRatingPlan.TPid, respond.TPid) @@ -167,7 +170,8 @@ func testTPRatingPlansGetTPRatingPlanAfterSet(t *testing.T) { func testTPRatingPlansGetTPRatingPlanIds(t *testing.T) { var result []string expected := []string{"Plan1"} - if err := tpRatingPlanRPC.Call("ApierV1.GetTPRatingPlanIds", &AttrGetTPRatingPlanIds{TPid: tpRatingPlan.TPid}, &result); err != nil { + if err := tpRatingPlanRPC.Call("ApierV1.GetTPRatingPlanIds", + &AttrGetTPRatingPlanIds{TPid: tpRatingPlan.TPid}, &result); err != nil { t.Error(err) } else if !reflect.DeepEqual(expected, result) { t.Errorf("Expecting: %+v, received: %+v", expected, result) @@ -202,7 +206,8 @@ func testTPRatingPlansUpdateTPRatingPlan(t *testing.T) { func testTPRatingPlansGetTPRatingPlanAfterUpdate(t *testing.T) { var respond *utils.TPRatingPlan - if err := tpRatingPlanRPC.Call("ApierV1.GetTPRatingPlan", &AttrGetTPRatingPlan{TPid: "TPRP1", ID: "Plan1"}, &respond); err != nil { + if err := tpRatingPlanRPC.Call("ApierV1.GetTPRatingPlan", + &AttrGetTPRatingPlan{TPid: "TPRP1", ID: "Plan1"}, &respond); err != nil { t.Error(err) } else if !reflect.DeepEqual(tpRatingPlan.TPid, respond.TPid) { t.Errorf("Expecting : %+v, received: %+v", tpRatingPlan.TPid, respond.TPid) @@ -215,7 +220,8 @@ func testTPRatingPlansGetTPRatingPlanAfterUpdate(t *testing.T) { func testTPRatingPlansRemTPRatingPlan(t *testing.T) { var resp string - if err := tpRatingPlanRPC.Call("ApierV1.RemTPRatingPlan", &AttrGetTPRatingPlan{TPid: "TPRP1", ID: "Plan1"}, &resp); err != nil { + if err := tpRatingPlanRPC.Call("ApierV1.RemTPRatingPlan", + &AttrGetTPRatingPlan{TPid: "TPRP1", ID: "Plan1"}, &resp); err != nil { t.Error(err) } else if resp != utils.OK { t.Error("Unexpected reply returned", resp) @@ -224,7 +230,8 @@ func testTPRatingPlansRemTPRatingPlan(t *testing.T) { func testTPRatingPlansGetTPRatingPlanAfterRemove(t *testing.T) { var respond *utils.TPRatingPlan - if err := tpRatingPlanRPC.Call("ApierV1.GetTPRatingPlan", &AttrGetTPRatingPlan{TPid: "TPRP1", ID: "Plan1"}, &respond); err == nil || err.Error() != utils.ErrNotFound.Error() { + if err := tpRatingPlanRPC.Call("ApierV1.GetTPRatingPlan", + &AttrGetTPRatingPlan{TPid: "TPRP1", ID: "Plan1"}, &respond); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } } diff --git a/apier/v1/tpratingprofiles.go b/apier/v1/tpratingprofiles.go index 9c4252a7e..0e8fd351f 100644 --- a/apier/v1/tpratingprofiles.go +++ b/apier/v1/tpratingprofiles.go @@ -57,7 +57,7 @@ func (self *ApierV1) GetTPRatingProfilesByLoadId(attrs utils.TPRatingProfile, re } return err } else { - reply = &rps + *reply = rps } return nil } diff --git a/apier/v1/tpratingprofiles_it_test.go b/apier/v1/tpratingprofiles_it_test.go index f754a35a1..36451f0e4 100644 --- a/apier/v1/tpratingprofiles_it_test.go +++ b/apier/v1/tpratingprofiles_it_test.go @@ -21,14 +21,15 @@ along with this program. If not, see package v1 import ( - "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/engine" - "github.com/cgrates/cgrates/utils" "net/rpc" "net/rpc/jsonrpc" "path" "reflect" "testing" + + "github.com/cgrates/cgrates/config" + "github.com/cgrates/cgrates/engine" + "github.com/cgrates/cgrates/utils" ) var ( @@ -51,6 +52,7 @@ var sTestsTPRatingProfiles = []func(t *testing.T){ testTPRatingProfilesSetTPRatingProfile, testTPRatingProfilesGetTPRatingProfileAfterSet, testTPRatingProfilesGetTPRatingProfileLoadIds, + testTPRatingProfilesGetTPRatingProfilesByLoadId, testTPRatingProfilesUpdateTPRatingProfile, testTPRatingProfilesGetTPRatingProfileAfterUpdate, testTPRatingProfilesRemTPRatingProfile, @@ -114,7 +116,7 @@ func testTPRatingProfilesStartEngine(t *testing.T) { // Connect rpc client to rater func testTPRatingProfilesRpcConn(t *testing.T) { var err error - tpRatingProfileRPC, err = jsonrpc.Dial("tcp", tpRatingProfileCfg.RPCJSONListen) // We connect over JSON so we can also troubleshoot if needed + tpRatingProfileRPC, err = jsonrpc.Dial("tcp", tpRatingProfileCfg.ListenCfg().RPCJSONListen) // We connect over JSON so we can also troubleshoot if needed if err != nil { t.Fatal(err) } @@ -122,7 +124,8 @@ func testTPRatingProfilesRpcConn(t *testing.T) { func testTPRatingProfilesGetTPRatingProfileBeforeSet(t *testing.T) { var reply *utils.TPRatingProfile - if err := tpRatingProfileRPC.Call("ApierV1.GetTPRatingProfile", &AttrGetTPRatingProfile{TPid: "TPRProf1", RatingProfileId: tpRatingProfileID}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { + if err := tpRatingProfileRPC.Call("ApierV1.GetTPRatingProfile", + &AttrGetTPRatingProfile{TPid: "TPRProf1", RatingProfileId: tpRatingProfileID}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } } @@ -160,7 +163,8 @@ func testTPRatingProfilesSetTPRatingProfile(t *testing.T) { func testTPRatingProfilesGetTPRatingProfileAfterSet(t *testing.T) { var respond *utils.TPRatingProfile - if err := tpRatingProfileRPC.Call("ApierV1.GetTPRatingProfile", &AttrGetTPRatingProfile{TPid: "TPRProf1", RatingProfileId: tpRatingProfileID}, &respond); err != nil { + if err := tpRatingProfileRPC.Call("ApierV1.GetTPRatingProfile", + &AttrGetTPRatingProfile{TPid: "TPRProf1", RatingProfileId: tpRatingProfileID}, &respond); err != nil { t.Error(err) } else if !reflect.DeepEqual(tpRatingProfile.TPid, respond.TPid) { t.Errorf("Expecting : %+v, received: %+v", tpRatingProfile.TPid, respond.TPid) @@ -182,13 +186,37 @@ func testTPRatingProfilesGetTPRatingProfileAfterSet(t *testing.T) { func testTPRatingProfilesGetTPRatingProfileLoadIds(t *testing.T) { var result []string expected := []string{"RPrf"} - if err := tpRatingProfileRPC.Call("ApierV1.GetTPRatingProfileLoadIds", &utils.AttrTPRatingProfileIds{TPid: tpRatingProfile.TPid, Tenant: tpRatingProfile.Tenant, Category: tpRatingProfile.Category, Direction: tpRatingProfile.Direction, Subject: tpRatingProfile.Subject}, &result); err != nil { + if err := tpRatingProfileRPC.Call("ApierV1.GetTPRatingProfileLoadIds", + &utils.AttrTPRatingProfileIds{TPid: tpRatingProfile.TPid, Tenant: tpRatingProfile.Tenant, + Category: tpRatingProfile.Category, Direction: tpRatingProfile.Direction, Subject: tpRatingProfile.Subject}, &result); err != nil { t.Error(err) } else if !reflect.DeepEqual(expected, result) { t.Errorf("Expecting: %+v, received: %+v", expected, result) } } +func testTPRatingProfilesGetTPRatingProfilesByLoadId(t *testing.T) { + var respond *[]*utils.TPRatingProfile + if err := tpRatingProfileRPC.Call("ApierV1.GetTPRatingProfilesByLoadId", + &utils.TPRatingProfile{TPid: "TPRProf1", LoadId: "RPrf"}, &respond); err != nil { + t.Error(err) + } else if !reflect.DeepEqual(tpRatingProfile.TPid, (*respond)[0].TPid) { + t.Errorf("Expecting : %+v, received: %+v", tpRatingProfile.TPid, (*respond)[0].TPid) + } else if !reflect.DeepEqual(tpRatingProfile.LoadId, (*respond)[0].LoadId) { + t.Errorf("Expecting : %+v, received: %+v", tpRatingProfile.LoadId, (*respond)[0].LoadId) + } else if !reflect.DeepEqual(tpRatingProfile.Direction, (*respond)[0].Direction) { + t.Errorf("Expecting : %+v, received: %+v", tpRatingProfile.Direction, (*respond)[0].Direction) + } else if !reflect.DeepEqual(tpRatingProfile.Tenant, (*respond)[0].Tenant) { + t.Errorf("Expecting : %+v, received: %+v", tpRatingProfile.Tenant, (*respond)[0].Tenant) + } else if !reflect.DeepEqual(tpRatingProfile.Category, (*respond)[0].Category) { + t.Errorf("Expecting : %+v, received: %+v", tpRatingProfile.Category, (*respond)[0].Category) + } else if !reflect.DeepEqual(tpRatingProfile.Subject, (*respond)[0].Subject) { + t.Errorf("Expecting : %+v, received: %+v", tpRatingProfile.Subject, (*respond)[0].Subject) + } else if !reflect.DeepEqual(len(tpRatingProfile.RatingPlanActivations), len((*respond)[0].RatingPlanActivations)) { + t.Errorf("Expecting : %+v, received: %+v", len(tpRatingProfile.RatingPlanActivations), len((*respond)[0].RatingPlanActivations)) + } +} + func testTPRatingProfilesUpdateTPRatingProfile(t *testing.T) { var result string tpRatingProfile.RatingPlanActivations = []*utils.TPRatingActivation{ @@ -220,7 +248,8 @@ func testTPRatingProfilesUpdateTPRatingProfile(t *testing.T) { func testTPRatingProfilesGetTPRatingProfileAfterUpdate(t *testing.T) { var respond *utils.TPRatingProfile - if err := tpRatingProfileRPC.Call("ApierV1.GetTPRatingProfile", &AttrGetTPRatingProfile{TPid: "TPRProf1", RatingProfileId: tpRatingProfileID}, &respond); err != nil { + if err := tpRatingProfileRPC.Call("ApierV1.GetTPRatingProfile", + &AttrGetTPRatingProfile{TPid: "TPRProf1", RatingProfileId: tpRatingProfileID}, &respond); err != nil { t.Error(err) } else if !reflect.DeepEqual(tpRatingProfile.TPid, respond.TPid) { t.Errorf("Expecting : %+v, received: %+v", tpRatingProfile.TPid, respond.TPid) @@ -241,7 +270,8 @@ func testTPRatingProfilesGetTPRatingProfileAfterUpdate(t *testing.T) { func testTPRatingProfilesRemTPRatingProfile(t *testing.T) { var resp string - if err := tpRatingProfileRPC.Call("ApierV1.RemTPRatingProfile", &AttrGetTPRatingProfile{TPid: "TPRProf1", RatingProfileId: tpRatingProfile.GetRatingProfilesId()}, &resp); err != nil { + if err := tpRatingProfileRPC.Call("ApierV1.RemTPRatingProfile", + &AttrGetTPRatingProfile{TPid: "TPRProf1", RatingProfileId: tpRatingProfile.GetRatingProfilesId()}, &resp); err != nil { t.Error(err) } else if resp != utils.OK { t.Error("Unexpected reply returned", resp) @@ -250,7 +280,8 @@ func testTPRatingProfilesRemTPRatingProfile(t *testing.T) { func testTPRatingProfilesGetTPRatingProfileAfterRemove(t *testing.T) { var respond *utils.TPRatingProfile - if err := tpRatingProfileRPC.Call("ApierV1.GetTPRatingProfile", &AttrGetTPRatingProfile{TPid: "TPRProf1", RatingProfileId: tpRatingProfileID}, &respond); err == nil || err.Error() != utils.ErrNotFound.Error() { + if err := tpRatingProfileRPC.Call("ApierV1.GetTPRatingProfile", + &AttrGetTPRatingProfile{TPid: "TPRProf1", RatingProfileId: tpRatingProfileID}, &respond); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } } diff --git a/apier/v1/tpresources_it_test.go b/apier/v1/tpresources_it_test.go index 1debbf39e..bbb8146e6 100644 --- a/apier/v1/tpresources_it_test.go +++ b/apier/v1/tpresources_it_test.go @@ -21,14 +21,15 @@ along with this program. If not, see package v1 import ( - "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/engine" - "github.com/cgrates/cgrates/utils" "net/rpc" "net/rpc/jsonrpc" "path" "reflect" "testing" + + "github.com/cgrates/cgrates/config" + "github.com/cgrates/cgrates/engine" + "github.com/cgrates/cgrates/utils" ) var ( @@ -112,7 +113,7 @@ func testTPResStartEngine(t *testing.T) { // Connect rpc client to rater func testTPResRpcConn(t *testing.T) { var err error - tpResRPC, err = jsonrpc.Dial("tcp", tpResCfg.RPCJSONListen) // We connect over JSON so we can also troubleshoot if needed + tpResRPC, err = jsonrpc.Dial("tcp", tpResCfg.ListenCfg().RPCJSONListen) // We connect over JSON so we can also troubleshoot if needed if err != nil { t.Fatal(err) } diff --git a/apier/v1/tpsharedgroups_it_test.go b/apier/v1/tpsharedgroups_it_test.go index e6000e30e..c49e8b4e7 100644 --- a/apier/v1/tpsharedgroups_it_test.go +++ b/apier/v1/tpsharedgroups_it_test.go @@ -21,14 +21,15 @@ along with this program. If not, see package v1 import ( - "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/engine" - "github.com/cgrates/cgrates/utils" "net/rpc" "net/rpc/jsonrpc" "path" "reflect" "testing" + + "github.com/cgrates/cgrates/config" + "github.com/cgrates/cgrates/engine" + "github.com/cgrates/cgrates/utils" ) var ( @@ -113,7 +114,7 @@ func testTPSharedGroupsStartEngine(t *testing.T) { // Connect rpc client to rater func testTPSharedGroupsRpcConn(t *testing.T) { var err error - tpSharedGroupRPC, err = jsonrpc.Dial("tcp", tpSharedGroupCfg.RPCJSONListen) // We connect over JSON so we can also troubleshoot if needed + tpSharedGroupRPC, err = jsonrpc.Dial("tcp", tpSharedGroupCfg.ListenCfg().RPCJSONListen) // We connect over JSON so we can also troubleshoot if needed if err != nil { t.Fatal(err) } diff --git a/apier/v1/tpstats_it_test.go b/apier/v1/tpstats_it_test.go index 766d950f1..a8962763d 100644 --- a/apier/v1/tpstats_it_test.go +++ b/apier/v1/tpstats_it_test.go @@ -21,14 +21,15 @@ along with this program. If not, see package v1 import ( - "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/engine" - "github.com/cgrates/cgrates/utils" "net/rpc" "net/rpc/jsonrpc" "path" "reflect" "testing" + + "github.com/cgrates/cgrates/config" + "github.com/cgrates/cgrates/engine" + "github.com/cgrates/cgrates/utils" ) var ( @@ -112,7 +113,7 @@ func testTPStatsStartEngine(t *testing.T) { // Connect rpc client to rater func testTPStatsRpcConn(t *testing.T) { var err error - tpStatRPC, err = jsonrpc.Dial("tcp", tpStatCfg.RPCJSONListen) // We connect over JSON so we can also troubleshoot if needed + tpStatRPC, err = jsonrpc.Dial("tcp", tpStatCfg.ListenCfg().RPCJSONListen) // We connect over JSON so we can also troubleshoot if needed if err != nil { t.Fatal(err) } diff --git a/apier/v1/tpsuppliers_it_test.go b/apier/v1/tpsuppliers_it_test.go index 4b62d4b3a..199aa16cf 100644 --- a/apier/v1/tpsuppliers_it_test.go +++ b/apier/v1/tpsuppliers_it_test.go @@ -21,14 +21,15 @@ along with this program. If not, see package v1 import ( - "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/engine" - "github.com/cgrates/cgrates/utils" "net/rpc" "net/rpc/jsonrpc" "path" "reflect" "testing" + + "github.com/cgrates/cgrates/config" + "github.com/cgrates/cgrates/engine" + "github.com/cgrates/cgrates/utils" ) var ( @@ -106,7 +107,7 @@ func testTPSplPrfStartEngine(t *testing.T) { // Connect rpc client to rater func testTPSplPrfRPCConn(t *testing.T) { var err error - tpSplPrfRPC, err = jsonrpc.Dial("tcp", tpSplPrfCfg.RPCJSONListen) // We connect over JSON so we can also troubleshoot if needed + tpSplPrfRPC, err = jsonrpc.Dial("tcp", tpSplPrfCfg.ListenCfg().RPCJSONListen) // We connect over JSON so we can also troubleshoot if needed if err != nil { t.Fatal(err) } diff --git a/apier/v1/tpthresholds_it_test.go b/apier/v1/tpthresholds_it_test.go index dd67531d0..56f4c692a 100644 --- a/apier/v1/tpthresholds_it_test.go +++ b/apier/v1/tpthresholds_it_test.go @@ -21,14 +21,15 @@ along with this program. If not, see package v1 import ( - "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/engine" - "github.com/cgrates/cgrates/utils" "net/rpc" "net/rpc/jsonrpc" "path" "reflect" "testing" + + "github.com/cgrates/cgrates/config" + "github.com/cgrates/cgrates/engine" + "github.com/cgrates/cgrates/utils" ) var ( @@ -113,7 +114,7 @@ func testTPThreholdStartEngine(t *testing.T) { // Connect rpc client to rater func testTPThreholdRpcConn(t *testing.T) { var err error - tpThresholdRPC, err = jsonrpc.Dial("tcp", tpThresholdCfg.RPCJSONListen) // We connect over JSON so we can also troubleshoot if needed + tpThresholdRPC, err = jsonrpc.Dial("tcp", tpThresholdCfg.ListenCfg().RPCJSONListen) // We connect over JSON so we can also troubleshoot if needed if err != nil { t.Fatal(err) } @@ -121,7 +122,8 @@ func testTPThreholdRpcConn(t *testing.T) { func testTPThreholdGetTPThreholdBeforeSet(t *testing.T) { var reply *utils.TPThreshold - if err := tpThresholdRPC.Call("ApierV1.GetTPThreshold", AttrGetTPThreshold{TPid: "TH1", ID: "Threshold"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { + if err := tpThresholdRPC.Call("ApierV1.GetTPThreshold", + AttrGetTPThreshold{TPid: "TH1", ID: "Threshold"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } } @@ -136,7 +138,6 @@ func testTPThreholdSetTPThrehold(t *testing.T) { ActivationTime: "2014-07-29T15:00:00Z", ExpiryTime: "", }, - Recurrent: true, MinSleep: "1s", Blocker: true, Weight: 10, diff --git a/apier/v1/tptimings_it_test.go b/apier/v1/tptimings_it_test.go index 194b35c2a..bbd089e29 100644 --- a/apier/v1/tptimings_it_test.go +++ b/apier/v1/tptimings_it_test.go @@ -21,14 +21,15 @@ along with this program. If not, see package v1 import ( - "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/engine" - "github.com/cgrates/cgrates/utils" "net/rpc" "net/rpc/jsonrpc" "path" "reflect" "testing" + + "github.com/cgrates/cgrates/config" + "github.com/cgrates/cgrates/engine" + "github.com/cgrates/cgrates/utils" ) var ( @@ -113,7 +114,7 @@ func testTPTimingsStartEngine(t *testing.T) { // Connect rpc client to rater func testTPTimingsRpcConn(t *testing.T) { var err error - tpTimingRPC, err = jsonrpc.Dial("tcp", tpTimingCfg.RPCJSONListen) // We connect over JSON so we can also troubleshoot if needed + tpTimingRPC, err = jsonrpc.Dial("tcp", tpTimingCfg.ListenCfg().RPCJSONListen) // We connect over JSON so we can also troubleshoot if needed if err != nil { t.Fatal(err) } diff --git a/apier/v1/tpusers_it_test.go b/apier/v1/tpusers_it_test.go index 08b1368ac..ca0c8e8e6 100644 --- a/apier/v1/tpusers_it_test.go +++ b/apier/v1/tpusers_it_test.go @@ -21,14 +21,15 @@ along with this program. If not, see package v1 import ( - "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/engine" - "github.com/cgrates/cgrates/utils" "net/rpc" "net/rpc/jsonrpc" "path" "reflect" "testing" + + "github.com/cgrates/cgrates/config" + "github.com/cgrates/cgrates/engine" + "github.com/cgrates/cgrates/utils" ) var ( @@ -113,7 +114,7 @@ func testTPUsersStartEngine(t *testing.T) { // Connect rpc client to rater func testTPUsersRpcConn(t *testing.T) { var err error - tpUserRPC, err = jsonrpc.Dial("tcp", tpUserCfg.RPCJSONListen) // We connect over JSON so we can also troubleshoot if needed + tpUserRPC, err = jsonrpc.Dial("tcp", tpUserCfg.ListenCfg().RPCJSONListen) // We connect over JSON so we can also troubleshoot if needed if err != nil { t.Fatal(err) }