diff --git a/agent/system/rpcapi.py b/agent/system/rpcapi.py index 2a89df6..9c99e25 100644 --- a/agent/system/rpcapi.py +++ b/agent/system/rpcapi.py @@ -25,9 +25,6 @@ $Id: rpcapi.py def setup(config): global xmlrpc if config.transportserver.xmlrpc == 'testing': - from cybertools.agent.testing.rpcserver import RPCServer + from cybertools.agent.testing.rpcserver import RPCServer, xmlrpc else: - try: - from twisted.web import xmlrpc - except ImportError: - from cybertools.agent.testing.rpcserver import RPCServer \ No newline at end of file + from twisted.web import xmlrpc \ No newline at end of file diff --git a/agent/testing/rpcserver.py b/agent/testing/rpcserver.py index 077e2ef..208ab93 100644 --- a/agent/testing/rpcserver.py +++ b/agent/testing/rpcserver.py @@ -22,6 +22,8 @@ Fake rpcserver for testing purposes $Id$ """ +from twisted.internet.defer import succeed + class RPCServer(object): serverURL = '' @@ -40,23 +42,89 @@ class RPCServer(object): self.password = password self.controller = controlObj - def callRemote(self, methodName, *params): - """ - intended to simulate the callRemote command of a real xmlrpcserver - that takes a method name and calls the method, returning the results - as xml formatted strings - """ - method = getattr(self, methodName) - return method(*params) - def getMetadata(self, metadata): if self.controller is not None: # pass metadata to controller # this is done AFTER the resource (like e.g. file or mail) # is handed over pass - return "Metadata received!" + deferred = defer.succeed('Metadata accepted by server') + return deferred def xmlrpc_shutdownRPCServer(): return "xmlrRPC server shutdown completed!" - \ No newline at end of file + + +class xmlrpc(object): + + Proxy = None + XMLRPC = None + Handler = None + XMLRPCIntrospection = None + QueryProtocol = None + _QueryFactory = None + + def __init__(self): + self.Proxy = Proxy() + self.XMLRPC = XMLRPC() + self.Handler = Handler() + self.XMLRPCIntrospection = XMLRPCIntrospection() + self.QueryProtocol = QueryProtocol() + self._QueryFactory = _QueryFactory() + + def addIntrospection(self, xmlrpc): + pass + +class Proxy(object): + + url = '' + user = None + password = None + allowNone = False + queryFactory = None + + def __init__(self, url, user=None, password=None, allowNone=False): + self.url = url + self.user = user + self.password = password + self.allowNone = allowNone + self.RPCServer = RPCServer() + + def callRemote(self, methodName, *params): + """ + intended to simulate the callRemote command of a real xmlrpcserver + that takes a method name and calls the method, returning the results + as xml formatted strings + """ + method = getattr(self.RPCServer, methodName) + return method(*params) + + +class XMLRPC(object): + + def __init__(self): + pass + + +class Handler(object): + + def __init__(self): + pass + + +class XMLRPCIntrospection(object): + + def __init__(self): + pass + + +class QueryProtocol(object): + + def __init__(self): + pass + + +class _QueryFactory(object): + + def __init__(self): + pass