1 8 package com.sleepycat.persist.test; 9 10 import java.util.List ; 11 12 import junit.framework.TestCase; 13 14 import com.sleepycat.je.DatabaseException; 15 import com.sleepycat.je.Environment; 16 17 class PersistTestUtils { 18 19 24 static void assertDbExists(boolean expectExists, 25 Environment env, 26 String storeName, 27 String entityClassName, 28 String keyName) { 29 String dbName = "persist#" + storeName + '#' + entityClassName; 30 if (keyName != null) { 31 dbName += "#" + keyName; 32 } 33 List allDbNames; 34 try { 35 allDbNames = env.getDatabaseNames(); 36 } catch (DatabaseException e) { 37 throw new RuntimeException (e); 38 } 39 if (expectExists != allDbNames.contains(dbName)) { 40 TestCase.fail 41 ((expectExists ? "Does not exist: " : "Does exist: ") + 42 dbName); 43 } 44 } 45 } 46 | Popular Tags |