1 18 package org.objectweb.speedo.runtime.userid; 19 20 import org.objectweb.speedo.SpeedoTestHelper; 21 import org.objectweb.speedo.pobjects.userid.IntervenantHelper; 22 import org.objectweb.speedo.pobjects.userid.ConventionHelper; 23 import org.objectweb.util.monolog.api.BasicLevel; 24 25 import javax.jdo.PersistenceManager; 26 import java.util.ArrayList ; 27 import java.util.Calendar ; 28 29 33 public class TestGroupama extends SpeedoTestHelper { 34 35 public TestGroupama(String s) { 36 super(s); 37 } 38 39 protected String getLoggerName() { 40 return LOG_NAME + "rt.userid.groupama"; 41 } 42 public void testA() { 43 try { 44 PersistenceManager pm = pmf.getPersistenceManager(); 45 pm.currentTransaction().begin(); 46 for(int i=0; i<5; i++) { 47 IntervenantHelper ih = new IntervenantHelper(); 48 ih.setNomep(i); 49 ih.setConventions(new ArrayList ()); 50 for(int j=0; j<i; j++) { 51 ConventionHelper ch = new ConventionHelper(); 52 ch.setCdmec("cdmec" + i + "_" + j); 53 ch.setCdmem("cdmem" + i + "_" + j); 54 ch.setCdmed("cdmed" + i + "_" + j); 55 ch.setNomep(i); 56 ch.setIntervenant(ih); 57 ch.setDdmec(Calendar.getInstance().getTime()); 58 ch.setCdmese("cdmese" + i + "_" + j); 59 ih.getConventions().add(ch); 60 } 61 pm.makePersistent(ih); 62 } 63 pm.currentTransaction().commit(); 64 65 pm.evictAll(); 67 pm.currentTransaction().begin(); 68 IntervenantHelper ih = (IntervenantHelper) pm.getObjectById( 69 pm.newObjectIdInstance(IntervenantHelper.class, "" + 2), 70 false); 71 assertEquals("Bad convention elements in collection", 72 2, 73 ih.getConventions().size()); 74 pm.currentTransaction().commit(); 75 76 pm.close(); 77 } catch (Exception e) { 78 logger.log(BasicLevel.ERROR, "Exception", e); 79 fail(e.getMessage()); 80 } 81 } 82 83 } 84 | Popular Tags |