[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
r5308 - in trunk/gnue-appserver: samples src
From: |
reinhard |
Subject: |
r5308 - in trunk/gnue-appserver: samples src |
Date: |
Thu, 11 Mar 2004 13:43:43 -0600 (CST) |
Author: reinhard
Date: 2004-03-11 13:43:43 -0600 (Thu, 11 Mar 2004)
New Revision: 5308
Added:
trunk/gnue-appserver/samples/unicode.gsd
trunk/gnue-appserver/src/utest.py
Log:
Added sample to test appserver's unicode capabilities.
Added: trunk/gnue-appserver/samples/unicode.gsd
===================================================================
--- trunk/gnue-appserver/samples/unicode.gsd 2004-03-11 19:41:53 UTC (rev
5307)
+++ trunk/gnue-appserver/samples/unicode.gsd 2004-03-11 19:43:43 UTC (rev
5308)
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Schema definition created by GNUe Appserver's Schema Support. -->
+<!-- run this file through gnue-schema to create SQL scripts -->
+<schema author="Appserver SchemaSupport" title="Appserver Schema Dump"
+ version="1.0">
+ <tables>
+ <table name="ünicôde_cláss">
+ <fields>
+ <field name="gnue_id" length="32" nullable="N" type="string"/>
+ <field name="ünicôde_prôperty" length="35" type="string"/>
+ </fields>
+ <constraints/>
+ <indexes/>
+ <primarykey name="gnue_id_pk_ünicôde_cláss">
+ <pkfield name="gnue_id"/>
+ </primarykey>
+ </table>
+ </tables>
+ <data>
+ <tabledata name="gnue_module_dump" tablename="gnue_module">
+ <definition>
+ <column field="gnue_comment" type="string(70)"/>
+ <column field="gnue_id" type="string(32)"/>
+ <column field="gnue_name" type="string(35)"/>
+ </definition>
+ <rows>
+ <row>
+ <value field="gnue_id">59617945671097149934377940072858</value>
+ <value field="gnue_name">ünicôde</value>
+ <value field="gnue_comment">Test for all kinds of non-ASCII
characters like áàâä</value>
+ </row>
+ </rows>
+ </tabledata>
+ <tabledata name="gnue_class_dump" tablename="gnue_class">
+ <definition>
+ <column field="gnue_comment" type="string(70)"/>
+ <column field="gnue_id" type="string(32)"/>
+ <column field="gnue_module" type="string(32)"/>
+ <column field="gnue_name" type="string(35)"/>
+ </definition>
+ <rows>
+ <row>
+ <value field="gnue_id">39421396290653294646125352302005</value>
+ <value field="gnue_module">59617945671097149934377940072858</value>
+ <value field="gnue_name">cláss</value>
+ <value field="gnue_comment">Classname containing non-ASCII
characters</value>
+ </row>
+ </rows>
+ </tabledata>
+ <tabledata name="gnue_property_dump" tablename="gnue_property">
+ <definition>
+ <column field="gnue_class" type="string(32)"/>
+ <column field="gnue_comment" type="string(70)"/>
+ <column field="gnue_id" type="string(32)"/>
+ <column field="gnue_length" type="number(6)"/>
+ <column field="gnue_module" type="string(32)"/>
+ <column field="gnue_name" type="string(35)"/>
+ <column field="gnue_scale" type="number(4)"/>
+ <column field="gnue_type" type="string(35)"/>
+ </definition>
+ <rows>
+ <row>
+ <value field="gnue_id">22979790054990796653141560113055</value>
+ <value field="gnue_module">00000000000000000000000000000000</value>
+ <value field="gnue_class">39421396290653294646125352302005</value>
+ <value field="gnue_name">id</value>
+ <value field="gnue_type">id</value>
+ <value field="gnue_length">0</value>
+ <value field="gnue_scale">0</value>
+ <value field="gnue_comment"></value>
+ </row>
+ <row>
+ <value field="gnue_id">98776057542410384975276209074597</value>
+ <value field="gnue_module">59617945671097149934377940072858</value>
+ <value field="gnue_class">39421396290653294646125352302005</value>
+ <value field="gnue_name">prôperty</value>
+ <value field="gnue_type">string</value>
+ <value field="gnue_length">35</value>
+ <value field="gnue_scale">0</value>
+ <value field="gnue_comment"></value>
+ </row>
+ </rows>
+ </tabledata>
+ <tabledata name="gnue_procedure_dump" tablename="gnue_procedure">
+ <definition>
+ <column field="gnue_class" type="string(32)"/>
+ <column field="gnue_code" type="string"/>
+ <column field="gnue_comment" type="string(70)"/>
+ <column field="gnue_compiledcode" type="string"/>
+ <column field="gnue_id" type="string(32)"/>
+ <column field="gnue_language" type="string(10)"/>
+ <column field="gnue_module" type="string(32)"/>
+ <column field="gnue_name" type="string(35)"/>
+ </definition>
+ <rows>
+ <row>
+ <value field="gnue_id">30242985601389174912481891027355</value>
+ <value field="gnue_module">59617945671097149934377940072858</value>
+ <value field="gnue_class">39421396290653294646125352302005</value>
+ <value field="gnue_name">prôcedure</value>
+ <value field="gnue_language">python</value>
+ <value field="gnue_code">self[u'prôperty'] =
self[u'ünicôde_prôperty'] + u'²'</value>
+ <value field="gnue_comment"></value>
+ </row>
+ </rows>
+ </tabledata>
+ </data>
+</schema>
Added: trunk/gnue-appserver/src/utest.py
===================================================================
--- trunk/gnue-appserver/src/utest.py 2004-03-11 19:41:53 UTC (rev 5307)
+++ trunk/gnue-appserver/src/utest.py 2004-03-11 19:43:43 UTC (rev 5308)
@@ -0,0 +1,111 @@
+# GNU Enterprise Application Server - Test Program
+#
+# Copyright 2001-2004 Free Software Foundation
+#
+# This file is part of GNU Enterprise.
+#
+# GNU Enterprise is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
+# version 2, or (at your option) any later version.
+#
+# GNU Enterprise is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with program; see the file COPYING. If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place
+# - Suite 330, Boston, MA 02111-1307, USA.
+#
+# $Id: test.py 5257 2004-03-08 10:06:17Z johannes $
+
+from gnue.common.apps.GClientApp import GClientApp
+from gnue.common.apps import i18n
+from gnue.common.datasources.GLoginHandler import LoginHandler
+from gnue.appserver.geasSessionManager import geasSessionManager
+
+# =============================================================================
+# Test application
+# =============================================================================
+
+class testApp (GClientApp):
+
+ # ---------------------------------------------------------------------------
+ # Constructor
+ # ---------------------------------------------------------------------------
+ def __init__ (self, connections = None):
+ ConfigOptions = {}
+ GClientApp.__init__ (self, connections, 'appserver', ConfigOptions)
+
+
+ # ---------------------------------------------------------------------------
+ # Create a session manager object
+ # ---------------------------------------------------------------------------
+ def getSessionManager (self):
+ self.connections.setLoginHandler (testLoginHandler ())
+
+ print "Creating session manager ..."
+ sm = geasSessionManager (self.connections)
+
+ return sm
+
+
+ # ---------------------------------------------------------------------------
+ # Main program
+ # ---------------------------------------------------------------------------
+ def run (self):
+ sm = self.getSessionManager ()
+
+ print "Opening session ..."
+ session = sm.open ({"user":"hacker", "password":"secret"})
+
+ print "Inserting new instance ..."
+ sm.store (session, u'�nic�de_cl�ss', [''], [u'�nic�de_pr�perty'],
+ [[(u'd�t�').encode ('utf-8')]])
+ sm.commit (session)
+
+ print "Creating and populating list object ..."
+ list = sm.request (session, u'�nic�de_cl�ss', [], [],
[u'�nic�de_pr�perty'])
+
+ print "Retrieving first instance ..."
+ rset = sm.fetch (session,list,0,1)
+
+ print "Value:", o(unicode (rset[0][1], 'utf-8'))
+
+ print "Calling procedure 'pr�cedure' for the first instance:"
+ sm.call (session, u'�nic�de_cl�ss', [rset[0][0]], u'�nic�de_pr�cedure', "")
+
+ print "Creating and populating list object ..."
+ list = sm.request (session, u'�nic�de_cl�ss', [], [],
[u'�nic�de_pr�perty'])
+
+ print "Retrieving first instance ..."
+ rset = sm.fetch (session,list,0,1)
+
+ print "Value:", o(unicode (rset[0][1], 'utf-8'))
+
+ print "Committing ..."
+ sm.commit (session)
+
+ print "Deleting the instance ..."
+ sm.delete (session, u'�nic�de_cl�ss', [rset[0][0]])
+
+ print "Committing and closing session ..."
+ sm.close (session, 1)
+
+
+# =============================================================================
+# Login Handler
+# =============================================================================
+class testLoginHandler (LoginHandler):
+ def getLogin (self, *arguments):
+ return {"_username": "gnue", "_password": None}
+
+
+# =============================================================================
+# Let it rock
+# =============================================================================
+if __name__ == "__main__":
+ testApp().run()
+ print "Thank you for playing!"
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- r5308 - in trunk/gnue-appserver: samples src,
reinhard <=