Package org.objectweb.speedo.pobjects.ref

Examples of org.objectweb.speedo.pobjects.ref.Member


      Group grp = new Group(gName);
     
      // Two members
      String m1Name = "Jean";
      String m2Name = "Sophie";
      Member mem1 = new Member(m1Name, grp);
      Member mem2 = new Member(m2Name, grp);
     
      // We make the members persistant
        pm.makePersistent(mem1);
        pm.makePersistent(mem2);
       
        // Get the ids
        Object m1Id = pm.getObjectId(mem1);
        Object m2Id = pm.getObjectId(mem2);
        Object gId = pm.getObjectId(grp);

        pm.close();

        mem1 = null;
        mem2 = null;
        grp = null;
       
        // Check the creation of the group and its members
        pm = pmf.getPersistenceManager();
        mem1 = (Member) pm.getObjectById(m1Id, true);
        mem2 = (Member) pm.getObjectById(m2Id, true);
        grp = (Group) pm.getObjectById(gId, true);
    Assert.assertNotNull("null instance for the member 1", mem1);
    Assert.assertEquals("Bad member 1 name", m1Name, mem1.getName());
    Assert.assertNotNull("null instance for the member 2", mem2);
    Assert.assertEquals("Bad member 2 name", m2Name, mem2.getName());
    Assert.assertNotNull("null instance returned for group", grp);
    Assert.assertEquals("Bad group name", gName, grp.getName());
   
    /* Delete the group :
     * this should delete both members.
View Full Code Here


      String m6Name = "Rose";
         String m7Name = "Baptiste";
      String m8Name = "Alexandre";
         String m9Name = "Noemie";
      String m10Name = "Eve";
      Member mem1 = new Member(m1Name, grp);
      Member mem2 = new Member(m2Name, grp);
      Member mem3 = new Member(m3Name, grp);
      Member mem4 = new Member(m4Name, grp);
      Member mem5 = new Member(m5Name, grp);
      Member mem6 = new Member(m6Name, grp);
      Member mem7 = new Member(m7Name, grp);
      Member mem8 = new Member(m8Name, grp);
      Member mem9 = new Member(m9Name, grp);
      Member mem10 = new Member(m10Name, grp);
     
      // We make the members persistant
        pm.makePersistent(mem1);
        pm.makePersistent(mem2);
        pm.makePersistent(mem3);
        pm.makePersistent(mem4);
        pm.makePersistent(mem5);
        pm.makePersistent(mem6);
        pm.makePersistent(mem7);
        pm.makePersistent(mem8);
        pm.makePersistent(mem9);
        pm.makePersistent(mem10);
       
        // Get the ids
        Object m1Id = pm.getObjectId(mem1);
        Object m2Id = pm.getObjectId(mem2);
        Object m3Id = pm.getObjectId(mem3);
        Object m4Id = pm.getObjectId(mem4);
        Object m5Id = pm.getObjectId(mem5);
        Object m6Id = pm.getObjectId(mem6);
        Object m7Id = pm.getObjectId(mem7);
        Object m8Id = pm.getObjectId(mem8);
        Object m9Id = pm.getObjectId(mem9);
        Object m10Id = pm.getObjectId(mem10);
        Object gId = pm.getObjectId(grp);

        pm.close();

        mem1 = null;
        mem2 = null;
        mem3 = null;
        mem4 = null;
        mem5 = null;
        mem6 = null;
        mem7 = null;
        mem8 = null;
        mem9 = null;
        mem10 = null;
        grp = null;
       
        // Check the creation of the employee and the department
        pm = pmf.getPersistenceManager();
        mem1 = (Member) pm.getObjectById(m1Id, true);
        mem2 = (Member) pm.getObjectById(m2Id, true);
        mem3 = (Member) pm.getObjectById(m3Id, true);
        mem4 = (Member) pm.getObjectById(m4Id, true);
        mem5 = (Member) pm.getObjectById(m5Id, true);
        mem6 = (Member) pm.getObjectById(m6Id, true);
        mem7 = (Member) pm.getObjectById(m7Id, true);
        mem8 = (Member) pm.getObjectById(m8Id, true);
        mem9 = (Member) pm.getObjectById(m9Id, true);
        mem10 = (Member) pm.getObjectById(m10Id, true);
        grp = (Group) pm.getObjectById(gId, true);
    Assert.assertNotNull("null instance for the member 1", mem1);
    Assert.assertEquals("Bad member 1 name", m1Name, mem1.getName());
    Assert.assertNotNull("null instance for the member 2", mem2);
    Assert.assertEquals("Bad member 2 name", m2Name, mem2.getName());
    Assert.assertNotNull("null instance for the member 3", mem3);
    Assert.assertEquals("Bad member 3 name", m3Name, mem3.getName());
    Assert.assertNotNull("null instance for the member 4", mem4);
    Assert.assertEquals("Bad member 4 name", m4Name, mem4.getName());
    Assert.assertNotNull("null instance for the member 5", mem5);
    Assert.assertEquals("Bad member 5 name", m5Name, mem5.getName());
    Assert.assertNotNull("null instance for the member 6", mem6);
    Assert.assertEquals("Bad member 6 name", m6Name, mem6.getName());
    Assert.assertNotNull("null instance for the member 7", mem7);
    Assert.assertEquals("Bad member 7 name", m7Name, mem7.getName());
    Assert.assertNotNull("null instance for the member 8", mem8);
    Assert.assertEquals("Bad member 8 name", m8Name, mem8.getName());
    Assert.assertNotNull("null instance for the member 9", mem9);
    Assert.assertEquals("Bad member 9 name", m9Name, mem9.getName());
    Assert.assertNotNull("null instance for the member 10", mem10);
    Assert.assertEquals("Bad member 10 name", m10Name, mem10.getName());
    Assert.assertNotNull("null instance returned for group", grp);
    Assert.assertEquals("Bad group name", gName, grp.getName());
   
    /* Delete the group :
     * this should delete its members too.
View Full Code Here

TOP

Related Classes of org.objectweb.speedo.pobjects.ref.Member

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.