public static void setUpPersistence() throws Exception {
managerImpl = new RemoteEntityManagerImpl();
managerImpl.context = new ContextHolder() {
@Override
public List<Locale> getAvailableLocales() {
Locale l = new Locale();
l.setDescription("English");
l.setLocale("en");
Locale le = new Locale();
le.setDescription("Spanish");
le.setLocale("es");
List<Locale> list = new ArrayList<Locale>(1);
list.add(l);
list.add(le);
return list;
}
};
crypto = new DES3CiphererDecipherer();
crypto.init();
managerImpl.decipherer = crypto;
managerImpl.dao = new AbstractDAO() {
@Override
protected EntityManager getEntityManager() {
return RemoteEntityManagerImplTest.entityManager;
}
};
factory = Persistence.createEntityManagerFactory("MODEL");
entityManager = factory.createEntityManager();
entityManager.getTransaction().begin();
Locale en = new Locale("en", "English");
managerImpl.dao.create(en);
Locale es = new Locale("es", "Spanish");
managerImpl.dao.create(es);
Classification c = new Classification();
c.setColor(new Color());
c.getColor().setRed(100);c.getColor().setGreen(100);c.getColor().setBlue(20);
c.setLetter("A");