Renamed HaPoolJson to RemoteHostJson

This commit is contained in:
Tripon Alexandru-Ionut
2019-04-09 14:12:15 +03:00
committed by Dan Christian Bogos
parent 9f10cd8ef4
commit d6399737f6
5 changed files with 86 additions and 86 deletions

View File

@@ -231,8 +231,8 @@ func TestDfStorDBJsonCfg(t *testing.T) {
func TestDfRalsJsonCfg(t *testing.T) {
eCfg := &RalsJsonCfg{
Enabled: utils.BoolPointer(false),
Thresholds_conns: &[]*HaPoolJsonCfg{},
Stats_conns: &[]*HaPoolJsonCfg{},
Thresholds_conns: &[]*RemoteHostJson{},
Stats_conns: &[]*RemoteHostJson{},
Rp_subject_prefix_matching: utils.BoolPointer(false),
Remove_expired: utils.BoolPointer(true),
Max_computed_usage: &map[string]string{
@@ -251,7 +251,7 @@ func TestDfRalsJsonCfg(t *testing.T) {
func TestDfSchedulerJsonCfg(t *testing.T) {
eCfg := &SchedulerJsonCfg{
Enabled: utils.BoolPointer(false),
Cdrs_conns: &[]*HaPoolJsonCfg{},
Cdrs_conns: &[]*RemoteHostJson{},
}
if cfg, err := dfCgrJsonCfg.SchedulerJsonCfg(); err != nil {
t.Error(err)
@@ -266,17 +266,17 @@ func TestDfCdrsJsonCfg(t *testing.T) {
Extra_fields: &[]string{},
Store_cdrs: utils.BoolPointer(true),
Session_cost_retries: utils.IntPointer(5),
Chargers_conns: &[]*HaPoolJsonCfg{
Chargers_conns: &[]*RemoteHostJson{
{
Address: utils.StringPointer("*internal"),
}},
Rals_conns: &[]*HaPoolJsonCfg{
Rals_conns: &[]*RemoteHostJson{
{
Address: utils.StringPointer("*internal"),
}},
Attributes_conns: &[]*HaPoolJsonCfg{},
Thresholds_conns: &[]*HaPoolJsonCfg{},
Stats_conns: &[]*HaPoolJsonCfg{},
Attributes_conns: &[]*RemoteHostJson{},
Thresholds_conns: &[]*RemoteHostJson{},
Stats_conns: &[]*RemoteHostJson{},
Online_cdr_exports: &[]string{},
}
if cfg, err := dfCgrJsonCfg.CdrsJsonCfg(); err != nil {
@@ -437,7 +437,7 @@ func TestDfCdrcJsonCfg(t *testing.T) {
Id: utils.StringPointer(utils.META_DEFAULT),
Enabled: utils.BoolPointer(false),
Dry_run: utils.BoolPointer(false),
Cdrs_conns: &[]*HaPoolJsonCfg{{
Cdrs_conns: &[]*RemoteHostJson{{
Address: utils.StringPointer(utils.MetaInternal),
}},
Cdr_format: utils.StringPointer("*csv"),
@@ -473,21 +473,21 @@ func TestSmgJsonCfg(t *testing.T) {
eCfg := &SessionSJsonCfg{
Enabled: utils.BoolPointer(false),
Listen_bijson: utils.StringPointer("127.0.0.1:2014"),
Chargers_conns: &[]*HaPoolJsonCfg{{
Chargers_conns: &[]*RemoteHostJson{{
Address: utils.StringPointer(utils.MetaInternal),
}},
Rals_conns: &[]*HaPoolJsonCfg{{
Rals_conns: &[]*RemoteHostJson{{
Address: utils.StringPointer(utils.MetaInternal),
}},
Cdrs_conns: &[]*HaPoolJsonCfg{{
Cdrs_conns: &[]*RemoteHostJson{{
Address: utils.StringPointer(utils.MetaInternal),
}},
Resources_conns: &[]*HaPoolJsonCfg{},
Thresholds_conns: &[]*HaPoolJsonCfg{},
Stats_conns: &[]*HaPoolJsonCfg{},
Suppliers_conns: &[]*HaPoolJsonCfg{},
Attributes_conns: &[]*HaPoolJsonCfg{},
Session_replication_conns: &[]*HaPoolJsonCfg{},
Resources_conns: &[]*RemoteHostJson{},
Thresholds_conns: &[]*RemoteHostJson{},
Stats_conns: &[]*RemoteHostJson{},
Suppliers_conns: &[]*RemoteHostJson{},
Attributes_conns: &[]*RemoteHostJson{},
Session_replication_conns: &[]*RemoteHostJson{},
Debit_interval: utils.StringPointer("0s"),
Store_session_costs: utils.BoolPointer(false),
Min_call_duration: utils.StringPointer("0s"),
@@ -507,7 +507,7 @@ func TestSmgJsonCfg(t *testing.T) {
func TestFsAgentJsonCfg(t *testing.T) {
eCfg := &FreeswitchAgentJsonCfg{
Enabled: utils.BoolPointer(false),
Sessions_conns: &[]*HaPoolJsonCfg{
Sessions_conns: &[]*RemoteHostJson{
{
Address: utils.StringPointer(utils.MetaInternal),
}},
@@ -535,7 +535,7 @@ func TestFsAgentJsonCfg(t *testing.T) {
func TestKamAgentJsonCfg(t *testing.T) {
eCfg := &KamAgentJsonCfg{
Enabled: utils.BoolPointer(false),
Sessions_conns: &[]*HaPoolJsonCfg{
Sessions_conns: &[]*RemoteHostJson{
{
Address: utils.StringPointer(utils.MetaInternal),
}},
@@ -558,7 +558,7 @@ func TestKamAgentJsonCfg(t *testing.T) {
func TestAsteriskAgentJsonCfg(t *testing.T) {
eCfg := &AsteriskAgentJsonCfg{
Enabled: utils.BoolPointer(false),
Sessions_conns: &[]*HaPoolJsonCfg{
Sessions_conns: &[]*RemoteHostJson{
{
Address: utils.StringPointer(utils.MetaInternal),
}},
@@ -586,7 +586,7 @@ func TestDiameterAgentJsonCfg(t *testing.T) {
Listen: utils.StringPointer("127.0.0.1:3868"),
Listen_net: utils.StringPointer("tcp"),
Dictionaries_path: utils.StringPointer("/usr/share/cgrates/diameter/dict/"),
Sessions_conns: &[]*HaPoolJsonCfg{
Sessions_conns: &[]*RemoteHostJson{
{
Address: utils.StringPointer(utils.MetaInternal),
}},
@@ -714,7 +714,7 @@ func TestRadiusAgentJsonCfg(t *testing.T) {
Client_dictionaries: utils.MapStringStringPointer(map[string]string{
utils.META_DEFAULT: "/usr/share/cgrates/radius/dict/",
}),
Sessions_conns: &[]*HaPoolJsonCfg{
Sessions_conns: &[]*RemoteHostJson{
{
Address: utils.StringPointer(utils.MetaInternal),
}},
@@ -742,7 +742,7 @@ func TestDNSAgentJsonCfg(t *testing.T) {
Enabled: utils.BoolPointer(false),
Listen_net: utils.StringPointer("udp"),
Listen: utils.StringPointer("127.0.0.1:2053"),
Sessions_conns: &[]*HaPoolJsonCfg{
Sessions_conns: &[]*RemoteHostJson{
{
Address: utils.StringPointer(utils.MetaInternal),
}},
@@ -776,7 +776,7 @@ func TestDfChargerServJsonCfg(t *testing.T) {
eCfg := &ChargerSJsonCfg{
Enabled: utils.BoolPointer(false),
Indexed_selects: utils.BoolPointer(true),
Attributes_conns: &[]*HaPoolJsonCfg{},
Attributes_conns: &[]*RemoteHostJson{},
String_indexed_fields: nil,
Prefix_indexed_fields: &[]string{},
}
@@ -789,8 +789,8 @@ func TestDfChargerServJsonCfg(t *testing.T) {
func TestDfFilterSJsonCfg(t *testing.T) {
eCfg := &FilterSJsonCfg{
Stats_conns: &[]*HaPoolJsonCfg{},
Resources_conns: &[]*HaPoolJsonCfg{},
Stats_conns: &[]*RemoteHostJson{},
Resources_conns: &[]*RemoteHostJson{},
}
if cfg, err := dfCgrJsonCfg.FilterSJsonCfg(); err != nil {
t.Error(err)
@@ -803,7 +803,7 @@ func TestDfResourceLimiterSJsonCfg(t *testing.T) {
eCfg := &ResourceSJsonCfg{
Enabled: utils.BoolPointer(false),
Indexed_selects: utils.BoolPointer(true),
Thresholds_conns: &[]*HaPoolJsonCfg{},
Thresholds_conns: &[]*RemoteHostJson{},
Store_interval: utils.StringPointer(""),
String_indexed_fields: nil,
Prefix_indexed_fields: &[]string{},
@@ -821,7 +821,7 @@ func TestDfStatServiceJsonCfg(t *testing.T) {
Indexed_selects: utils.BoolPointer(true),
Store_interval: utils.StringPointer(""),
Max_queue_length: utils.IntPointer(0),
Thresholds_conns: &[]*HaPoolJsonCfg{},
Thresholds_conns: &[]*RemoteHostJson{},
String_indexed_fields: nil,
Prefix_indexed_fields: &[]string{},
}
@@ -853,14 +853,14 @@ func TestDfSupplierSJsonCfg(t *testing.T) {
Indexed_selects: utils.BoolPointer(true),
String_indexed_fields: nil,
Prefix_indexed_fields: &[]string{},
Attributes_conns: &[]*HaPoolJsonCfg{},
Rals_conns: &[]*HaPoolJsonCfg{
Attributes_conns: &[]*RemoteHostJson{},
Rals_conns: &[]*RemoteHostJson{
{
Address: utils.StringPointer("*internal"),
},
},
Resources_conns: &[]*HaPoolJsonCfg{},
Stats_conns: &[]*HaPoolJsonCfg{},
Resources_conns: &[]*RemoteHostJson{},
Stats_conns: &[]*RemoteHostJson{},
}
if cfg, err := dfCgrJsonCfg.SupplierSJsonCfg(); err != nil {
t.Error(err)
@@ -878,7 +878,7 @@ func TestDfLoaderJsonCfg(t *testing.T) {
Dry_run: utils.BoolPointer(false),
Run_delay: utils.IntPointer(0),
Lock_filename: utils.StringPointer(".cgr.lck"),
Caches_conns: &[]*HaPoolJsonCfg{{
Caches_conns: &[]*RemoteHostJson{{
Address: utils.StringPointer(utils.MetaInternal),
}},
Field_separator: utils.StringPointer(","),
@@ -1438,7 +1438,7 @@ func TestDfDispatcherSJsonCfg(t *testing.T) {
Indexed_selects: utils.BoolPointer(true),
String_indexed_fields: nil,
Prefix_indexed_fields: &[]string{},
Attributes_conns: &[]*HaPoolJsonCfg{},
Attributes_conns: &[]*RemoteHostJson{},
}
if cfg, err := dfCgrJsonCfg.DispatcherSJsonCfg(); err != nil {
t.Error(err)
@@ -1453,13 +1453,13 @@ func TestDfLoaderCfg(t *testing.T) {
Data_path: utils.StringPointer("./"),
Disable_reverse: utils.BoolPointer(false),
Field_separator: utils.StringPointer(","),
Caches_conns: &[]*HaPoolJsonCfg{
Caches_conns: &[]*RemoteHostJson{
{
Address: utils.StringPointer("127.0.0.1:2012"),
Transport: utils.StringPointer(utils.MetaJSONrpc),
},
},
Scheduler_conns: &[]*HaPoolJsonCfg{
Scheduler_conns: &[]*RemoteHostJson{
{
Address: utils.StringPointer("127.0.0.1:2012"),
Transport: utils.StringPointer(utils.MetaJSONrpc),
@@ -1527,12 +1527,12 @@ func TestDfAnalyzerCfg(t *testing.T) {
func TestDfApierCfg(t *testing.T) {
eCfg := &ApierJsonCfg{
Caches_conns: &[]*HaPoolJsonCfg{
Caches_conns: &[]*RemoteHostJson{
{
Address: utils.StringPointer(utils.MetaInternal),
},
},
Scheduler_conns: &[]*HaPoolJsonCfg{
Scheduler_conns: &[]*RemoteHostJson{
{
Address: utils.StringPointer(utils.MetaInternal),
},

View File

@@ -223,7 +223,7 @@ func TestHttpAgentCfgloadFromJsonCfg(t *testing.T) {
jsnhttpCfg := &HttpAgentJsonCfg{
Id: utils.StringPointer("conecto1"),
Url: utils.StringPointer("/conecto"),
Sessions_conns: &[]*HaPoolJsonCfg{{Address: utils.StringPointer("127.0.0.1:2012"), Transport: utils.StringPointer("*json")}},
Sessions_conns: &[]*RemoteHostJson{{Address: utils.StringPointer("127.0.0.1:2012"), Transport: utils.StringPointer("*json")}},
Request_payload: utils.StringPointer("*url"),
Reply_payload: utils.StringPointer("*xml"),
Request_processors: &[]*HttpAgentProcessorJsnCfg{

View File

@@ -93,15 +93,15 @@ type DbJsonCfg struct {
// Filters config
type FilterSJsonCfg struct {
Stats_conns *[]*HaPoolJsonCfg
Resources_conns *[]*HaPoolJsonCfg
Stats_conns *[]*RemoteHostJson
Resources_conns *[]*RemoteHostJson
}
// Rater config section
type RalsJsonCfg struct {
Enabled *bool
Thresholds_conns *[]*HaPoolJsonCfg
Stats_conns *[]*HaPoolJsonCfg
Thresholds_conns *[]*RemoteHostJson
Stats_conns *[]*RemoteHostJson
Rp_subject_prefix_matching *bool
Remove_expired *bool
Max_computed_usage *map[string]string
@@ -110,7 +110,7 @@ type RalsJsonCfg struct {
// Scheduler config section
type SchedulerJsonCfg struct {
Enabled *bool
Cdrs_conns *[]*HaPoolJsonCfg
Cdrs_conns *[]*RemoteHostJson
}
// Cdrs config section
@@ -119,11 +119,11 @@ type CdrsJsonCfg struct {
Extra_fields *[]string
Store_cdrs *bool
Session_cost_retries *int
Chargers_conns *[]*HaPoolJsonCfg
Rals_conns *[]*HaPoolJsonCfg
Attributes_conns *[]*HaPoolJsonCfg
Thresholds_conns *[]*HaPoolJsonCfg
Stats_conns *[]*HaPoolJsonCfg
Chargers_conns *[]*RemoteHostJson
Rals_conns *[]*RemoteHostJson
Attributes_conns *[]*RemoteHostJson
Thresholds_conns *[]*RemoteHostJson
Stats_conns *[]*RemoteHostJson
Online_cdr_exports *[]string
}
@@ -183,7 +183,7 @@ type CdrcJsonCfg struct {
Id *string
Enabled *bool
Dry_run *bool
Cdrs_conns *[]*HaPoolJsonCfg
Cdrs_conns *[]*RemoteHostJson
Cdr_format *string
Field_separator *string
Timezone *string
@@ -210,15 +210,15 @@ type CdrcJsonCfg struct {
type SessionSJsonCfg struct {
Enabled *bool
Listen_bijson *string
Chargers_conns *[]*HaPoolJsonCfg
Rals_conns *[]*HaPoolJsonCfg
Resources_conns *[]*HaPoolJsonCfg
Thresholds_conns *[]*HaPoolJsonCfg
Stats_conns *[]*HaPoolJsonCfg
Suppliers_conns *[]*HaPoolJsonCfg
Cdrs_conns *[]*HaPoolJsonCfg
Session_replication_conns *[]*HaPoolJsonCfg
Attributes_conns *[]*HaPoolJsonCfg
Chargers_conns *[]*RemoteHostJson
Rals_conns *[]*RemoteHostJson
Resources_conns *[]*RemoteHostJson
Thresholds_conns *[]*RemoteHostJson
Stats_conns *[]*RemoteHostJson
Suppliers_conns *[]*RemoteHostJson
Cdrs_conns *[]*RemoteHostJson
Session_replication_conns *[]*RemoteHostJson
Attributes_conns *[]*RemoteHostJson
Debit_interval *string
Store_session_costs *bool
Min_call_duration *string
@@ -235,7 +235,7 @@ type SessionSJsonCfg struct {
// FreeSWITCHAgent config section
type FreeswitchAgentJsonCfg struct {
Enabled *bool
Sessions_conns *[]*HaPoolJsonCfg
Sessions_conns *[]*RemoteHostJson
Subscribe_park *bool
Create_cdr *bool
Extra_fields *[]string
@@ -256,7 +256,7 @@ type FsConnJsonCfg struct {
}
// Represents one connection instance towards a rater/cdrs server
type HaPoolJsonCfg struct {
type RemoteHostJson struct {
Address *string
Transport *string
Synchronous *bool
@@ -273,7 +273,7 @@ type AstConnJsonCfg struct {
type AsteriskAgentJsonCfg struct {
Enabled *bool
Sessions_conns *[]*HaPoolJsonCfg
Sessions_conns *[]*RemoteHostJson
Create_cdr *bool
Asterisk_conns *[]*AstConnJsonCfg
}
@@ -290,7 +290,7 @@ type CacheJsonCfg map[string]*CacheParamJsonCfg
// SM-Kamailio config section
type KamAgentJsonCfg struct {
Enabled *bool
Sessions_conns *[]*HaPoolJsonCfg
Sessions_conns *[]*RemoteHostJson
Create_cdr *bool
Evapi_conns *[]*KamConnJsonCfg
}
@@ -305,8 +305,8 @@ type KamConnJsonCfg struct {
type SmOsipsJsonCfg struct {
Enabled *bool
Listen_udp *string
Rals_conns *[]*HaPoolJsonCfg
Cdrs_conns *[]*HaPoolJsonCfg
Rals_conns *[]*RemoteHostJson
Cdrs_conns *[]*RemoteHostJson
Create_cdr *bool
Debit_interval *string
Min_call_duration *string
@@ -327,7 +327,7 @@ type DiameterAgentJsonCfg struct {
Listen *string
Listen_net *string
Dictionaries_path *string
Sessions_conns *[]*HaPoolJsonCfg
Sessions_conns *[]*RemoteHostJson
Origin_host *string
Origin_realm *string
Vendor_id *int
@@ -359,7 +359,7 @@ type RadiusAgentJsonCfg struct {
Listen_acct *string
Client_secrets *map[string]string
Client_dictionaries *map[string]string
Sessions_conns *[]*HaPoolJsonCfg
Sessions_conns *[]*RemoteHostJson
Timezone *string
Request_processors *[]*RAReqProcessorJsnCfg
}
@@ -379,7 +379,7 @@ type RAReqProcessorJsnCfg struct {
type HttpAgentJsonCfg struct {
Id *string
Url *string
Sessions_conns *[]*HaPoolJsonCfg
Sessions_conns *[]*RemoteHostJson
Request_payload *string
Reply_payload *string
Request_processors *[]*HttpAgentProcessorJsnCfg
@@ -401,7 +401,7 @@ type DNSAgentJsonCfg struct {
Enabled *bool
Listen *string
Listen_net *string
Sessions_conns *[]*HaPoolJsonCfg
Sessions_conns *[]*RemoteHostJson
Timezone *string
Request_processors *[]*ReqProcessorJsnCfg
}
@@ -430,7 +430,7 @@ type AttributeSJsonCfg struct {
type ChargerSJsonCfg struct {
Enabled *bool
Indexed_selects *bool
Attributes_conns *[]*HaPoolJsonCfg
Attributes_conns *[]*RemoteHostJson
String_indexed_fields *[]string
Prefix_indexed_fields *[]string
}
@@ -439,7 +439,7 @@ type ChargerSJsonCfg struct {
type ResourceSJsonCfg struct {
Enabled *bool
Indexed_selects *bool
Thresholds_conns *[]*HaPoolJsonCfg
Thresholds_conns *[]*RemoteHostJson
Store_interval *string
String_indexed_fields *[]string
Prefix_indexed_fields *[]string
@@ -451,7 +451,7 @@ type StatServJsonCfg struct {
Indexed_selects *bool
Store_interval *string
Max_queue_length *int
Thresholds_conns *[]*HaPoolJsonCfg
Thresholds_conns *[]*RemoteHostJson
String_indexed_fields *[]string
Prefix_indexed_fields *[]string
}
@@ -471,10 +471,10 @@ type SupplierSJsonCfg struct {
Indexed_selects *bool
String_indexed_fields *[]string
Prefix_indexed_fields *[]string
Attributes_conns *[]*HaPoolJsonCfg
Rals_conns *[]*HaPoolJsonCfg
Resources_conns *[]*HaPoolJsonCfg
Stats_conns *[]*HaPoolJsonCfg
Attributes_conns *[]*RemoteHostJson
Rals_conns *[]*RemoteHostJson
Resources_conns *[]*RemoteHostJson
Stats_conns *[]*RemoteHostJson
}
type LoaderJsonDataType struct {
@@ -490,7 +490,7 @@ type LoaderJsonCfg struct {
Dry_run *bool
Run_delay *int
Lock_filename *string
Caches_conns *[]*HaPoolJsonCfg
Caches_conns *[]*RemoteHostJson
Field_separator *string
Tp_in_dir *string
Tp_out_dir *string
@@ -540,7 +540,7 @@ type DispatcherSJsonCfg struct {
Indexed_selects *bool
String_indexed_fields *[]string
Prefix_indexed_fields *[]string
Attributes_conns *[]*HaPoolJsonCfg
Attributes_conns *[]*RemoteHostJson
}
type LoaderCfgJson struct {
@@ -548,8 +548,8 @@ type LoaderCfgJson struct {
Data_path *string
Disable_reverse *bool
Field_separator *string
Caches_conns *[]*HaPoolJsonCfg
Scheduler_conns *[]*HaPoolJsonCfg
Caches_conns *[]*RemoteHostJson
Scheduler_conns *[]*RemoteHostJson
}
type MigratorCfgJson struct {
@@ -599,6 +599,6 @@ type AnalyzerSJsonCfg struct {
}
type ApierJsonCfg struct {
Caches_conns *[]*HaPoolJsonCfg
Scheduler_conns *[]*HaPoolJsonCfg
Caches_conns *[]*RemoteHostJson
Scheduler_conns *[]*RemoteHostJson
}

View File

@@ -41,7 +41,7 @@ type RemoteHost struct {
TLS bool
}
func (self *RemoteHost) loadFromJsonCfg(jsnCfg *HaPoolJsonCfg) error {
func (self *RemoteHost) loadFromJsonCfg(jsnCfg *RemoteHostJson) error {
if jsnCfg == nil {
return nil
}

View File

@@ -219,12 +219,12 @@ func TestRemoteHostloadFromJsonCfg(t *testing.T) {
} else if !reflect.DeepEqual(hpoolcfg, expected) {
t.Errorf("Expected: %+v ,recived: %+v", expected, hpoolcfg)
}
if err := hpoolcfg.loadFromJsonCfg(new(HaPoolJsonCfg)); err != nil {
if err := hpoolcfg.loadFromJsonCfg(new(RemoteHostJson)); err != nil {
t.Error(err)
} else if !reflect.DeepEqual(hpoolcfg, expected) {
t.Errorf("Expected: %+v ,recived: %+v", expected, hpoolcfg)
}
json := &HaPoolJsonCfg{
json := &RemoteHostJson{
Address: utils.StringPointer("127.0.0.1:8448"),
Synchronous: utils.BoolPointer(true),
}