コード例 #1
0
 def testGetAll(self):
     MacroCache.put("$a","a")
     MacroCache.put("$b","b")
     assert(len(MacroCache.getAll()) == 2)
     assert(MacroCache.get("$a") == "a")
     assert(MacroCache.get("$b") == "b")
     assert(MacroCache.get("$c") == None)
コード例 #2
0
 def setUp(self):
     """ Create a DB connection pool to an embedded Apache
     Derby instance for testing. Create some macros for testing
     as well. """            
     driver = "org.apache.derby.jdbc.EmbeddedDriver"
     dsn    = "jdbc:derby:/testdb;create=true"
     self.maxObjects        = 10
     self.expirationTime    = 10
     self.connectionTimeout = 10
     self.pool              = JDBCConnectionPool(driver, dsn, "", "", 
                                                 self.maxObjects, 
                                                 self.expirationTime, 
                                                 self.connectionTimeout,"")
     self.executor          = QueryExecutor(self.pool)          
     MacroCache.put("$macro",   "SELECT 3 cold FROM SYSIBM.SYSDUMMY1")
     MacroCache.put("$pmacro",  "SELECT 4 cole FROM SYSIBM.SYSDUMMY1 where 1 = ?")
     MacroCache.put("$umacro",  "insert into qe_test (id,txt) values(7,'700')")
     MacroCache.put("$upmacro", "insert into qe_test (id,txt) values(?,?)")
     
     #Setup dummy table
     reqStr  =  '[{query:"create table qe_test (id int, txt varchar(100))"}]'
     self.executor.execute(reqStr, True, True)                   
コード例 #3
0
 def testPutGet(self):
     MacroCache.put("$x","123")
     assert(MacroCache.get("$x") == "123")
コード例 #4
0
 def testClear(self):
     MacroCache.put("$x","x")
     assert(MacroCache.get("$x") == "x")
     MacroCache.clear()
     assert(MacroCache.get("$x") == None)