testBasicType(0);
}
public void testSerialization() {
logger.log(BasicLevel.DEBUG, "testSerialization");
BasicA ba = new BasicA();
ba.writeF1("testSerialization");
ba.writeF2(5);
Locale l = new Locale("en"); //Examples: "en", "de_DE", "_GB", "en_US_WIN", "de__POSIX", "fr__MAC"
ba.setLocale(l);
PersistenceManager pm = pmf.getPersistenceManager();
pm.currentTransaction().begin();
pm.makePersistent(ba);
Object oid = pm.getObjectId(ba);
pm.currentTransaction().commit();
pm.close();
File f = new File(new File(new File("output"),"test"), "testSerialization");
if (f.exists()) {
f.delete();
}
try {
ObjectOutputStream oos = new ObjectOutputStream(
new FileOutputStream(f));
oos.writeObject(ba);
oos.close();
ba = null;
ObjectInputStream ois = new ObjectInputStream(
new FileInputStream(f));
ba = (BasicA) ois.readObject();
ois.close();
ba.readF1_F2();
assertEquals("Bad locale language value", l.getLanguage(), ba.getLocale().getLanguage());
assertEquals("Bad locale country value", l.getCountry(), ba.getLocale().getCountry());
assertEquals("Bad locale variant value", l.getVariant(), ba.getLocale().getVariant());
} catch (Exception e) {
logger.log(BasicLevel.ERROR, "testSerialization fails: ", e);
fail(e.getMessage());
} finally {