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)
 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)                   
 def testPutGet(self):
     MacroCache.put("$x","123")
     assert(MacroCache.get("$x") == "123")
 def setUp(self):
     MacroCache.clear()
 def testClear(self):
     MacroCache.put("$x","x")
     assert(MacroCache.get("$x") == "x")
     MacroCache.clear()
     assert(MacroCache.get("$x") == None)
 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")