Package org.objectweb.speedo.pobjects.map

Examples of org.objectweb.speedo.pobjects.map.D


    pm.currentTransaction().begin();
    C c = new C(1);
    ArrayList ds = new ArrayList(MAP_SIZE * 2);
    for(int i=0; i<MAP_SIZE; i++) {
      String f1 = F1_PREFIX + i;
      ds.add(new D(i, f1));
    }
    pm.makePersistent(c);
    pm.makePersistentAll(ds);
    pm.currentTransaction().commit();

    //Add into the map
    pm.currentTransaction().begin();
    Map m = c.getDkey2d();
    for(int i=0; i<MAP_SIZE; i++) {
      D d = (D) ds.get(i);
      m.put(d.getF1(), d);
    }
    c = null;
    ds = null;
    pm.currentTransaction().commit();
    finishTest(pm, MAP_SIZE, F1_PREFIX);
View Full Code Here


    pm.currentTransaction().begin();
    C c = new C(1);
    Map m = c.getDkey2d();
    for(int i=0; i<MAP_SIZE; i++) {
      String f1 = "f1_" + i;
      D d = new D(i, f1);
      m.put(f1, d);
    }
    pm.makePersistent(c);
    pm.currentTransaction().commit();
    finishTest(pm, MAP_SIZE, F1_PREFIX);
View Full Code Here

    PersistenceManager pm = pmf.getPersistenceManager();
    pm.currentTransaction().begin();
    C c = new C(1);
    for(int i=0; i<MAP_SIZE; i++) {
      String f1 = "f1_" + i;
      D d = new D(i, f1);
      d.setMyc(c);
      pm.makePersistent(d);
    }
    pm.currentTransaction().commit();
    finishTest(pm, MAP_SIZE, F1_PREFIX);
  }
View Full Code Here

    pm.currentTransaction().begin();
    C c = new C(1);
    ArrayList ds = new ArrayList(MAP_SIZE * 2);
    for(int i=0; i<MAP_SIZE; i++) {
      String f1 = F1_PREFIX + i;
      ds.add(new D(i, f1));
    }
    pm.makePersistent(c);
    pm.makePersistentAll(ds);
    pm.currentTransaction().commit();

    //Add into the map
    pm.currentTransaction().begin();
    Map m = c.getDkey2d();
    for(int i=0; i<MAP_SIZE; i++) {
      D d = (D) ds.get(i);
      m.put(d.getF1(), d);
    }
    pm.currentTransaction().commit();
   
    pm.getFetchPlan().addGroup("all").removeGroup("default");
    C copyOfC = (C) pm.detachCopy(c);
    assertEquals("Not the same id for c and its detached copy", c.getMyid(), copyOfC.getMyid());
    Map mC = c.getDkey2d();
    Map mCopyOfC = copyOfC.getDkey2d();
    assertEquals("The maps' size should be the same.",mC.size(), mCopyOfC.size());
    Iterator itC = mC.values().iterator();
    Collection col = mCopyOfC.values();
    while(itC.hasNext()) {
      D dC = (D) itC.next();
      boolean contained = false;
      Iterator it = col.iterator();
      while (it.hasNext() && !contained) {
        D dCopy = (D) it.next();
        if (dC.getMyid()==dCopy.getMyid() && dC.getF1().equals(dCopy.getF1()))
          contained = true;
      }
      assertTrue("The element " + dC.getMyid() + " is not contained", contained);
    }
  }
View Full Code Here

TOP

Related Classes of org.objectweb.speedo.pobjects.map.D

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.