Ejemplo n.º 1
0
def test_marshalling():
    actual = (Outer()).setup(101);
    encoded = (quark.toJSON(actual, quark.reflect.Class.get(_getClass(actual)))).toString();
    _println(encoded);
    expected = Outer();
    quark.fromJSON(quark.reflect.Class.get(_getClass(expected)), expected, _JSONObject.parse(encoded));
    _println(_toString((expected).outer_int));
    _println((expected).outer_string);
    _println(repr((expected).outer_float));
    _println(repr((((expected).outer_inner_list)[1]).inner_float));
Ejemplo n.º 2
0
    def call(self, args):
        result = None;
        (self).instance = ((self).service).getInstance()
        if (((self).instance) != (None)):
            request = _HTTPRequest(((self).instance).getURL());
            json = quark.toJSON(args, None);
            envelope = _JSONObject();
            (envelope).setObjectItem((u"$method"), ((_JSONObject()).setString((self).methodName)));
            (envelope).setObjectItem((u"$context"), ((_JSONObject()).setString(u"TBD")));
            (envelope).setObjectItem((u"rpc"), (json));
            body = (envelope).toString();
            (request).setBody(body);
            (request).setMethod(u"POST");
            rpc = RPCRequest(args, self);
            result = (rpc).call(request)
        else:
            result = (self.returned).construct(_List([]))
            (result).finish(u"all services are down");

        quark.concurrent.FutureWait.waitFor(result, 10.0);
        return result