commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnue] r7046 - trunk/gnue-common/src/rpc


From: jan
Subject: [gnue] r7046 - trunk/gnue-common/src/rpc
Date: Sun, 20 Feb 2005 08:43:18 -0600 (CST)

Author: jan
Date: 2005-02-20 08:43:17 -0600 (Sun, 20 Feb 2005)
New Revision: 7046

Modified:
   trunk/gnue-common/src/rpc/client.py
   trunk/gnue-common/src/rpc/server.py
Log:
Update server/client testscripts to accept the choosen service by command line


Modified: trunk/gnue-common/src/rpc/client.py
===================================================================
--- trunk/gnue-common/src/rpc/client.py 2005-02-18 20:00:00 UTC (rev 7045)
+++ trunk/gnue-common/src/rpc/client.py 2005-02-20 14:43:17 UTC (rev 7046)
@@ -102,14 +102,28 @@
 if __name__ == '__main__':
 
   import traceback
+  import sys
   from gnue.common.apps import errors
+  
+  if (len(sys.argv)==2) and \
+     (sys.argv[1] in 
['pyro','xmlrpc','socket','soap','xmlrpc.pw_xmlrpc','xmlrpc.py_xmlrpc']):
+    connection = attach (sys.argv[1], {})
+  else:
+    print """
+GNUe RPC test client
 
-  connection = attach ('xmlrpc', {})
+Usage: gcvs client.py <transport>
 
+"""
+    raise SystemExit
+
   obj = connection.request ('test')
 
   print 'stringtest:', repr (obj.stringtest ('This'))
-  print 'ustringtest:', (obj.ustringtest (u'\xe0\xe2\xe1\xe4')).encode 
('utf-8')
+  try:
+    print 'ustringtest:', (obj.ustringtest (u'\xe0\xe2\xe1\xe4')).encode 
('utf-8')
+  except:
+    print "UnicodeStringtest failed"
   print 'inttest: 21 * 2 =', repr (obj.inttest (21))
   print 'floattest: 123.45 * 2 =', repr (obj.floattest (123.45))
   print 'datetimetest:', repr (obj.datetimetest ())
@@ -143,7 +157,7 @@
       print "remote exception detail:", e.getDetail ()
       print "-" * 70
 
-  print 'shutting donwn server ...'
+  print 'shutting down server ...'
   try:
     # This will raise an exception because the server will not even answer any
     # more. Need to find a better way to shutdown the server.

Modified: trunk/gnue-common/src/rpc/server.py
===================================================================
--- trunk/gnue-common/src/rpc/server.py 2005-02-18 20:00:00 UTC (rev 7045)
+++ trunk/gnue-common/src/rpc/server.py 2005-02-20 14:43:17 UTC (rev 7046)
@@ -219,8 +219,18 @@
 #                               '</service>'
                               '</gnurpc>')
 
-  drivers = {'xmlrpc': {'port': 8765}}
+  if (len(sys.argv)==2) and \
+     (sys.argv[1] in 
['pyro','xmlrpc','socket','soap','xmlrpc.pw_xmlrpc','xmlrpc.py_xmlrpc']):
+    drivers = {sys.argv[1]: {'port': 8765}}
+  else:
+    print """
+GNUe RPC test server
 
+Usage: gcvs server.py <transport>
+
+"""
+    raise SystemExit
+
   bindings = {'test': servertest}
 
   servers = bind (rpcdef, drivers, bindings)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]