예제 #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 setUp(self):
     MacroCache.clear()
예제 #5
0
 def testClear(self):
     MacroCache.put("$x","x")
     assert(MacroCache.get("$x") == "x")
     MacroCache.clear()
     assert(MacroCache.get("$x") == None)
예제 #6
0
 def testPopulate(self):
     MacroCache.populate("src/tests/macros/")
     assert(MacroCache.get("$a")     == "a")
     assert(MacroCache.get("$b")     == "b")
     assert(MacroCache.get("$c.d")   == "d")
     assert(MacroCache.get("$c.e.a") == "f")