Package org.objectweb.speedo.pobjects.ref.fkId

Examples of org.objectweb.speedo.pobjects.ref.fkId.Project


  public void testRetrieveRelationship() {
   
    PersistenceManager pm = pmf.getPersistenceManager();
    String name_id = "project1";
    String team_id = "dpc";
    Project p1 = new Project(name_id, team_id);
    Release r1 = new Release();
    r1.setProject(p1);
    r1.setVersion(1);
    //make the project persistent
    pm.makePersistent(p1);
    //keep the id of the project
    Object project1ID = pm.getObjectId(p1);
    Assert.assertNotNull("null object identifier", project1ID);
    pm.close();

    p1 = null;
    r1 = null;
    pm = pmf.getPersistenceManager();
    //retrieve the project
    p1 = (Project) pm.getObjectById(project1ID, true);
    Assert.assertNotNull("null instance returned by getObjectById", p1);
    Assert.assertEquals("Bad project name", name_id, p1.getNameId());
    Assert.assertEquals("Bad project name", team_id, p1.getTeamId());
    Assert.assertNotNull("null instance returned by p1.getRelease()", p1.getRelease());
    Assert.assertEquals("Bad project name for release", name_id, p1.getRelease().getNameId());
    Assert.assertEquals("Bad team name for release", team_id, p1.getRelease().getTeamId());
   
    //delete the release and the project
    pm.currentTransaction().begin();
    pm.deletePersistent(p1.getRelease());
    pm.deletePersistent(p1);
    pm.currentTransaction().commit();
    pm.close();
  }
View Full Code Here

TOP

Related Classes of org.objectweb.speedo.pobjects.ref.fkId.Project

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.