[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnue-appserver/src test.py testRPC.py geasRpcCl...
From: |
Reinhard Mueller |
Subject: |
gnue-appserver/src test.py testRPC.py geasRpcCl... |
Date: |
Mon, 28 Jul 2003 17:48:22 -0400 |
CVSROOT: /cvsroot/gnue
Module name: gnue-appserver
Branch:
Changes by: Reinhard Mueller <address@hidden> 03/07/28 17:48:22
Modified files:
src : test.py
Added files:
src : testRPC.py
Removed files:
src : geasRpcClient.py geasRpcClient2.py test2.py
Log message:
Updated all test programs to new API, deleted test programs for old API.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-appserver/src/testRPC.py?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-appserver/src/test.py.diff?tr1=1.15&tr2=1.16&r1=text&r2=text
Patches:
Index: gnue-appserver/src/test.py
diff -c gnue-appserver/src/test.py:1.15 gnue-appserver/src/test.py:1.16
*** gnue-appserver/src/test.py:1.15 Mon Feb 17 02:32:46 2003
--- gnue-appserver/src/test.py Mon Jul 28 17:48:22 2003
***************
*** 19,30 ****
# write to the Free Software Foundation, Inc., 59 Temple Place
# - Suite 330, Boston, MA 02111-1307, USA.
#
! # $Id: test.py,v 1.15 2003/02/17 07:32:46 jcater Exp $
import os
from gnue.common.apps import GClientApp
from gnue.common.datasources import GLoginHandler
! import geasSession
#
=============================================================================
# Test application
--- 19,30 ----
# write to the Free Software Foundation, Inc., 59 Temple Place
# - Suite 330, Boston, MA 02111-1307, USA.
#
! # $Id: test.py,v 1.16 2003/07/28 21:48:22 reinhard Exp $
import os
from gnue.common.apps import GClientApp
from gnue.common.datasources import GLoginHandler
! import geasSessionManager
#
=============================================================================
# Test application
***************
*** 33,84 ****
class testApp (GClientApp.GClientApp):
#
---------------------------------------------------------------------------
! # Create a session object
#
---------------------------------------------------------------------------
! def getSession (self):
# set up login handler
self.connections.setLoginHandler (testLoginHandler ())
! print "Creating session object ..."
! return geasSession.geasSession (self.connections)
#
---------------------------------------------------------------------------
# Main program
#
---------------------------------------------------------------------------
def run (self):
! # created extra method to get the session, which can be overwritten
! # by testRpcApp
! session = self.getSession()
! print "Logging into the session ..."
! session.login ("hacker", "secret")
!
! print "Creating list object ..."
! list = session.createList ("address_person")
! print "Setting up list object ..."
! list.setPrefetch (["address_name", "address_street", "address_city"])
! list.setConditions ([])
! list.setSort (["address_zip"])
!
! print "Populating list ..."
! list.populate ()
print "Retrieving first instance ..."
! instance = list.firstInstance ()
print "These are the values of the first instance:"
! print " Name :", instance.get ("address_name")
! print " Street:", instance.get ("address_street")
! print " City :", instance.get ("address_city")
!
! # print "Check if person live in a rich/poor area:"
! # print " calling 'checkAreaRichness' results in: ",
! # instance.call('checkAreaRichness','') # demographic data
!
! print "Thank you for playing!"
#
=============================================================================
# Login Handler
--- 33,71 ----
class testApp (GClientApp.GClientApp):
#
---------------------------------------------------------------------------
! # Create a session manager object
#
---------------------------------------------------------------------------
! def getSessionManager (self):
# set up login handler
self.connections.setLoginHandler (testLoginHandler ())
+
+ print "Creating session manager ..."
+ sm = geasSessionManager.geasSessionManager (self.connections)
! return sm
#
---------------------------------------------------------------------------
# Main program
#
---------------------------------------------------------------------------
def run (self):
! sm = self.getSessionManager ()
! print "Opening session ..."
! session = sm.open ({"user":"hacker", "password":"secret"})
! print "Creating and populating list object ..."
! list = sm.request (session, "address_person", [], ["address_zip"],
! ["address_name", "address_street", "address_city"])
print "Retrieving first instance ..."
! rset = sm.fetch (session,list,0,1)
print "These are the values of the first instance:"
! print " Name :", rset[0][1]
! print " Street:", rset[0][2]
! print " City :", rset[0][3]
#
=============================================================================
# Login Handler
***************
*** 92,100 ****
# Let it rock
#
=============================================================================
-
- def run():
- testApp().run()
-
if __name__ == "__main__":
! run()
--- 79,84 ----
# Let it rock
#
=============================================================================
if __name__ == "__main__":
! testApp().run()
! print "Thank you for playing!"
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- gnue-appserver/src test.py testRPC.py geasRpcCl...,
Reinhard Mueller <=