Removing accounts (build.sh runs)

This commit is contained in:
andronache
2021-03-31 09:26:39 +03:00
committed by Dan Christian Bogos
parent 06f648b987
commit 51c201e50e
42 changed files with 236 additions and 2594 deletions

View File

@@ -1,65 +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 <http://www.gnu.org/licenses/>
*/
package console
import (
"github.com/cgrates/cgrates/utils"
)
func init() {
c := &CmdGetAccountsProfile{
name: "accounts_profile",
rpcMethod: utils.APIerSv1GetAccountProfile,
rpcParams: &utils.TenantIDWithAPIOpts{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
}
// Commander implementation
type CmdGetAccountsProfile struct {
name string
rpcMethod string
rpcParams *utils.TenantIDWithAPIOpts
*CommandExecuter
}
func (self *CmdGetAccountsProfile) Name() string {
return self.name
}
func (self *CmdGetAccountsProfile) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdGetAccountsProfile) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &utils.TenantIDWithAPIOpts{}
}
return self.rpcParams
}
func (self *CmdGetAccountsProfile) PostprocessRpcParams() error {
return nil
}
func (self *CmdGetAccountsProfile) RpcResult() interface{} {
var atr utils.AccountProfile
return &atr
}

View File

@@ -1,65 +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 <http://www.gnu.org/licenses/>
*/
package console
import (
"github.com/cgrates/cgrates/utils"
)
func init() {
c := &CmdGetAccountsProfileIDs{
name: "accounts_profile_ids",
rpcMethod: utils.APIerSv1GetAccountProfileIDs,
rpcParams: &utils.PaginatorWithTenant{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
}
// Commander implementation
type CmdGetAccountsProfileIDs struct {
name string
rpcMethod string
rpcParams *utils.PaginatorWithTenant
*CommandExecuter
}
func (self *CmdGetAccountsProfileIDs) Name() string {
return self.name
}
func (self *CmdGetAccountsProfileIDs) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdGetAccountsProfileIDs) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &utils.PaginatorWithTenant{}
}
return self.rpcParams
}
func (self *CmdGetAccountsProfileIDs) PostprocessRpcParams() error {
return nil
}
func (self *CmdGetAccountsProfileIDs) RpcResult() interface{} {
var atr []string
return &atr
}

View File

@@ -1,54 +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 <http://www.gnu.org/licenses/>
*/
package console
import (
"reflect"
"strings"
"testing"
v1 "github.com/cgrates/cgrates/apier/v1"
"github.com/cgrates/cgrates/utils"
)
func TestCmdAccountsProfileIDs(t *testing.T) {
// commands map is initiated in init function
command := commands["accounts_profile_ids"]
// verify if ApierSv1 object has method on it
m, ok := reflect.TypeOf(new(v1.APIerSv1)).MethodByName(strings.Split(command.RpcMethod(), utils.NestingSep)[1])
if !ok {
t.Fatal("method not found")
}
if m.Type.NumIn() != 3 { // ApierSv1 is consider and we expect 3 inputs
t.Fatalf("invalid number of input parameters ")
}
// verify the type of input parameter
if ok := m.Type.In(1).AssignableTo(reflect.TypeOf(command.RpcParams(true))); !ok {
t.Fatalf("cannot assign input parameter")
}
// verify the type of output parameter
if ok := m.Type.In(2).AssignableTo(reflect.TypeOf(command.RpcResult())); !ok {
t.Fatalf("cannot assign output parameter")
}
// for coverage purpose
if err := command.PostprocessRpcParams(); err != nil {
t.Fatal(err)
}
}

View File

@@ -1,62 +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 <http://www.gnu.org/licenses/>
*/
package console
import "github.com/cgrates/cgrates/utils"
func init() {
c := &CmdRemoveAccountsProfile{
name: "accounts_profile_remove",
rpcMethod: utils.APIerSv1RemoveAccountProfile,
rpcParams: &utils.TenantIDWithAPIOpts{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
}
type CmdRemoveAccountsProfile struct {
name string
rpcMethod string
rpcParams *utils.TenantIDWithAPIOpts
*CommandExecuter
}
func (self *CmdRemoveAccountsProfile) Name() string {
return self.name
}
func (self *CmdRemoveAccountsProfile) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdRemoveAccountsProfile) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &utils.TenantIDWithAPIOpts{APIOpts: make(map[string]interface{})}
}
return self.rpcParams
}
func (self *CmdRemoveAccountsProfile) PostprocessRpcParams() error {
return nil
}
func (self *CmdRemoveAccountsProfile) RpcResult() interface{} {
var s string
return &s
}

View File

@@ -1,54 +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 <http://www.gnu.org/licenses/>
*/
package console
import (
"reflect"
"strings"
"testing"
v1 "github.com/cgrates/cgrates/apier/v1"
"github.com/cgrates/cgrates/utils"
)
func TestCmdAccountsProfileRem(t *testing.T) {
// commands map is initiated in init function
command := commands["accounts_profile_remove"]
// verify if ApierSv1 object has method on it
m, ok := reflect.TypeOf(new(v1.APIerSv1)).MethodByName(strings.Split(command.RpcMethod(), utils.NestingSep)[1])
if !ok {
t.Fatal("method not found")
}
if m.Type.NumIn() != 3 { // ApierSv1 is consider and we expect 3 inputs
t.Fatalf("invalid number of input parameters ")
}
// verify the type of input parameter
if ok := m.Type.In(1).AssignableTo(reflect.TypeOf(command.RpcParams(true))); !ok {
t.Fatalf("cannot assign input parameter")
}
// verify the type of output parameter
if ok := m.Type.In(2).AssignableTo(reflect.TypeOf(command.RpcResult())); !ok {
t.Fatalf("cannot assign output parameter")
}
// for coverage purpose
if err := command.PostprocessRpcParams(); err != nil {
t.Fatal(err)
}
}

View File

@@ -1,64 +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 <http://www.gnu.org/licenses/>
*/
package console
import (
"github.com/cgrates/cgrates/utils"
)
func init() {
c := &CmdSetAccountProfile{
name: "accounts_profile_set",
rpcMethod: utils.APIerSv1SetAccountProfile,
rpcParams: &utils.APIAccountProfileWithOpts{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
}
type CmdSetAccountProfile struct {
name string
rpcMethod string
rpcParams *utils.APIAccountProfileWithOpts
*CommandExecuter
}
func (self *CmdSetAccountProfile) Name() string {
return self.name
}
func (self *CmdSetAccountProfile) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdSetAccountProfile) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &utils.APIAccountProfileWithOpts{APIAccountProfile: new(utils.APIAccountProfile)}
}
return self.rpcParams
}
func (self *CmdSetAccountProfile) PostprocessRpcParams() error {
return nil
}
func (self *CmdSetAccountProfile) RpcResult() interface{} {
var s string
return &s
}

View File

@@ -1,54 +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 <http://www.gnu.org/licenses/>
*/
package console
import (
"reflect"
"strings"
"testing"
v1 "github.com/cgrates/cgrates/apier/v1"
"github.com/cgrates/cgrates/utils"
)
func TestCmdAccountsProfileSet(t *testing.T) {
// commands map is initiated in init function
command := commands["accounts_profile_set"]
// verify if ApierSv1 object has method on it
m, ok := reflect.TypeOf(new(v1.APIerSv1)).MethodByName(strings.Split(command.RpcMethod(), utils.NestingSep)[1])
if !ok {
t.Fatal("method not found")
}
if m.Type.NumIn() != 3 { // ApierSv1 is consider and we expect 3 inputs
t.Fatalf("invalid number of input parameters ")
}
// verify the type of input parameter
if ok := m.Type.In(1).AssignableTo(reflect.TypeOf(command.RpcParams(true))); !ok {
t.Fatalf("cannot assign input parameter")
}
// verify the type of output parameter
if ok := m.Type.In(2).AssignableTo(reflect.TypeOf(command.RpcResult())); !ok {
t.Fatalf("cannot assign output parameter")
}
// for coverage purpose
if err := command.PostprocessRpcParams(); err != nil {
t.Fatal(err)
}
}

View File

@@ -1,54 +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 <http://www.gnu.org/licenses/>
*/
package console
import (
"reflect"
"strings"
"testing"
v1 "github.com/cgrates/cgrates/apier/v1"
"github.com/cgrates/cgrates/utils"
)
func TestCmdAccountsProfile(t *testing.T) {
// commands map is initiated in init function
command := commands["accounts_profile"]
// verify if ApierSv1 object has method on it
m, ok := reflect.TypeOf(new(v1.APIerSv1)).MethodByName(strings.Split(command.RpcMethod(), utils.NestingSep)[1])
if !ok {
t.Fatal("method not found")
}
if m.Type.NumIn() != 3 { // ApierSv1 is consider and we expect 3 inputs
t.Fatalf("invalid number of input parameters ")
}
// verify the type of input parameter
if ok := m.Type.In(1).AssignableTo(reflect.TypeOf(command.RpcParams(true))); !ok {
t.Fatalf("cannot assign input parameter")
}
// verify the type of output parameter
if ok := m.Type.In(2).AssignableTo(reflect.TypeOf(command.RpcResult())); !ok {
t.Fatalf("cannot assign output parameter")
}
// for coverage purpose
if err := command.PostprocessRpcParams(); err != nil {
t.Fatal(err)
}
}