* Test storing an reloading of a map for a given connection
* @exception Exception if an error occurs
* @param usecon connection to be used
*/
private void storeAndLoadCon(Connection useCon) throws Exception {
JDBCPersistentMap storeMap = new JDBCPersistentMap(null, "Danet");
storeMap.setConnection(useCon);
assertTrue(storeMap.maxKeyLength() == 50);
assertTrue(!storeMap.isModified());
storeMap.put("HSc", "Holger Schl�ter");
assertTrue(storeMap.isModified());
storeMap.put("MSc", "Matthias Schirm");
storeMap.put("ML", "Dr. Michael Lipp");
storeMap.put("GB", "Gunnar von de Beck");
StringBuffer sb = new StringBuffer ();
for (int i = 0; i < 1600; i++) {
sb.append ("0123456789");
}
String longString = sb.toString ();
storeMap.put("LONG", longString);
storeMap.put("INT", new Integer(1307));
storeMap.put("NULL", null);
boolean exceptionCaught = false;
try {
storeMap.put(null, null);
} catch (IllegalArgumentException exc) {
exceptionCaught = true;
}
assertTrue(exceptionCaught);
storeMap.store();
storeMap.store();
JDBCPersistentMap loadMap = new JDBCPersistentMap(null, "Danet");
loadMap.setConnection(useCon);
loadMap.load();
// Verfiy that maps do match
assertTrue(loadMap.size() == 7);
// for (Iterator i = loadMap.entrySet().iterator(); i.hasNext ();) {
// Map.Entry e = (Map.Entry)i.next ();
// assertTrue ("Got: " + e.getValue() + " != Put: "
// + storeMap.get (e.getKey()),
// e.getValue ().equals (storeMap.get (e.getKey())));