mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-25 09:08:45 +05:00
work in proggress
This commit is contained in:
@@ -8,14 +8,21 @@ func (rpc *RpcStruct) Hopa(normal string, out *float64) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func TestRPCObjectSimple(t *testing.T) {
|
||||
func (rpc *RpcStruct) Tropa(pointer *string, out *float64) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func TestRPCObjectPointer(t *testing.T) {
|
||||
RegisterRpcObject("", &RpcStruct{})
|
||||
if len(RpcObjects) != 1 {
|
||||
if len(RpcObjects) != 2 {
|
||||
t.Errorf("error registering rpc object: %v", RpcObjects)
|
||||
}
|
||||
x, found := RpcObjects["RpcStruct.Hopa"]
|
||||
if found {
|
||||
if !found {
|
||||
t.Errorf("error getting rpcobject: %v (%+v)", RpcObjects, x)
|
||||
}
|
||||
x, found = RpcObjects["RpcStruct.Tropa"]
|
||||
if !found {
|
||||
t.Errorf("error getting rpcobject: %v (%+v)", RpcObjects, x)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,8 +29,8 @@ func RegisterRpcObject(name string, rpcObject interface{}) {
|
||||
if methodType.NumIn() == 3 { // if it has three parameters (one is self and two are rpc params)
|
||||
RpcObjects[name+"."+method.Name] = &RpcObject{
|
||||
Object: objType,
|
||||
InParam: reflect.New(methodType.In(1)).Elem().Interface(),
|
||||
OutParam: reflect.New(methodType.In(2)).Elem().Interface(),
|
||||
InParam: reflect.New(methodType.In(1)).Interface(),
|
||||
OutParam: reflect.New(methodType.In(2).Elem()).Interface(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user