Package org.objectweb.speedo.pobjects.detach

Examples of org.objectweb.speedo.pobjects.detach.Player


   */
  public void testVersion3() {
    logger.log(BasicLevel.DEBUG, "***************testVersion3*****************");
    Team t = new Team("T3",null,null);
    Collection players = new ArrayList();
    Player p1 = new Player("p5", t, 20);
    players.add(p1);
    Player p2 = new Player("p6", t, 30);
    players.add(p2);
    t.setPlayers(players);
    Coach c = new Coach("c3", 10, t);
    t.setCoach(c);
    PersistenceManager pm = pmf.getPersistenceManager();
    pm.currentTransaction().begin();
    pm.makePersistent(t);
    pm.currentTransaction().commit();
    //begin
    pm.currentTransaction().begin();
    //detach the team t
    Team copyOfT = null;
    try {
      copyOfT = (Team) pm.detachCopy(t);
      //  modify the coach
      t.setCoach(new Coach("c31", 10, t));
      Iterator it  = t.getPlayers().iterator();
      //modify the players
      while(it.hasNext()){
        Player p = (Player) it.next();
        p.setAge(99);
      }
      //commit
      pm.currentTransaction().commit();
    } catch (Exception e) {
      fail("Detach error: " + e.getMessage());
View Full Code Here


   */
  public void testVersion4() {
    logger.log(BasicLevel.DEBUG, "***************testVersion4*****************");
    Team t = new Team("T4",null,null);
    Collection players = new ArrayList();
    Player p1 = new Player("p7", t, 20);
    players.add(p1);
    Player p2 = new Player("p8", t, 30);
    players.add(p2);
    t.setPlayers(players);
    Coach c = new Coach("c4", 10, t);
    t.setCoach(c);
    PersistenceManager pm = pmf.getPersistenceManager();
View Full Code Here

   */
  public void testVersion5() {
    logger.log(BasicLevel.DEBUG, "***************testVersion5*****************");
    Team t = new Team("T5",null,null);
    Collection players = new ArrayList();
    Player p1 = new Player("p9", t, 20);
    players.add(p1);
    Player p2 = new Player("p10", t, 30);
    players.add(p2);
    t.setPlayers(players);
    Coach c = new Coach("c5", 10, t);
    t.setCoach(c);
    PersistenceManager pm = pmf.getPersistenceManager();
    pm.currentTransaction().begin();
    pm.makePersistent(t);
    pm.currentTransaction().commit();
    //begin
    pm.currentTransaction().begin();
    //modify the coach
    t.setCoach(new Coach("c51", 10, t));
    Iterator it  = t.getPlayers().iterator();
    //modify the players
    while(it.hasNext()){
      Player p = (Player) it.next();
      p.setAge(99);
    }
    //detach the team t
    Team copyOfT = (Team) pm.detachCopy(t);
    //rollback
    pm.currentTransaction().rollback();
View Full Code Here

   */
  public void testVersion6() {
    logger.log(BasicLevel.DEBUG, "***************testVersion6*****************");
    Team t = new Team("T6",null,null);
    Collection players = new ArrayList();
    Player p1 = new Player("p11", t, 20);
    players.add(p1);
    Player p2 = new Player("p12", t, 30);
    players.add(p2);
    t.setPlayers(players);
    Coach c = new Coach("c6", 10, t);
    t.setCoach(c);
    PersistenceManager pm = pmf.getPersistenceManager();
    pm.currentTransaction().begin();
    pm.makePersistent(t);
    pm.currentTransaction().commit();
    //begin
    pm.currentTransaction().begin();
    //detach the team t
    Team copyOfT = (Team) pm.detachCopy(t);
    //modify the coach
    t.getCoach().setExperience(99);
    Iterator it  = t.getPlayers().iterator();
    //modify the players
    while(it.hasNext()){
      Player p = (Player) it.next();
      p.setAge(99);
    }
    //rollback
    pm.currentTransaction().rollback();
    pm.currentTransaction().begin();
    try
View Full Code Here

   */
  public void testVersion7() {
    logger.log(BasicLevel.DEBUG, "***************testVersion7*****************");
    Team t = new Team("T7",null,null);
    Collection players = new ArrayList();
    Player p1 = new Player("p13", t, 20);
    players.add(p1);
    Player p2 = new Player("p14", t, 30);
    players.add(p2);
    t.setPlayers(players);
    Coach c = new Coach("c7", 10, t);
    t.setCoach(c);
    PersistenceManager pm = pmf.getPersistenceManager();
    pm.currentTransaction().begin();
    pm.makePersistent(t);
    pm.currentTransaction().commit();
    //begin
    pm.currentTransaction().begin();
    //detach the team t
    Team copyOfT1 = (Team) pm.detachCopy(t);
    //detach the team t
    Team copyOfT2 = (Team) pm.detachCopy(t);
    //commit
    pm.currentTransaction().commit();
   
    //modify the copy1
    copyOfT1.getCoach().setExperience(99);
    Iterator it  = copyOfT1.getPlayers().iterator();
    //modify the players
    while(it.hasNext()){
      Player p = (Player) it.next();
      p.setAge(99);
    }
    //modify the copy2
    copyOfT2.getCoach().setExperience(99);
    it  = copyOfT2.getPlayers().iterator();
    //modify the players
    while(it.hasNext()){
      Player p = (Player) it.next();
      p.setAge(99);
    }
   
    boolean attach1OK = false;
    try{
      pm.currentTransaction().begin();
View Full Code Here

   */
  public void testVersion8() {
    logger.log(BasicLevel.DEBUG, "***************testVersion8*****************");
    Team t = new Team("T8",null,null);
    Collection players = new ArrayList();
    Player p1 = new Player("p15", t, 20);
    players.add(p1);
    Player p2 = new Player("p16", t, 30);
    players.add(p2);
    t.setPlayers(players);
    Coach c = new Coach("c8", 10, t);
    t.setCoach(c);
    PersistenceManager pm = pmf.getPersistenceManager();
    pm.currentTransaction().begin();
    pm.makePersistent(t);
    pm.currentTransaction().commit();
    //begin
    pm.currentTransaction().begin();
    //detach the team t
    Team copyOfT1 = (Team) pm.detachCopy(t);
    //detach the team t
    Team copyOfT2 = (Team) pm.detachCopy(t);
    //commit
    pm.currentTransaction().commit();
   
    //modify the copy1
    copyOfT1.getCoach().setExperience(99);
    Iterator it  = copyOfT1.getPlayers().iterator();
    //modify the players
    while(it.hasNext()){
      Player p = (Player) it.next();
      p.setAge(99);
    }
    //modify the copy2
    copyOfT2.getCoach().setExperience(99);
    it  = copyOfT2.getPlayers().iterator();
    //modify the players
    while(it.hasNext()){
      Player p = (Player) it.next();
      p.setAge(99);
    }
   
    boolean attach2OK = false;
    try{
      pm.currentTransaction().begin();
View Full Code Here

   */
  public void testVersion9() {
    logger.log(BasicLevel.DEBUG, "***************testVersion9*****************");
    Team t = new Team("T9",null,null);
    Collection players = new ArrayList();
    Player p1 = new Player("p17", t, 20);
    players.add(p1);
    Player p2 = new Player("p18", t, 30);
    players.add(p2);
    t.setPlayers(players);
    Coach c = new Coach("c9", 10, t);
    t.setCoach(c);
    PersistenceManager pm = pmf.getPersistenceManager();
    pm.currentTransaction().begin();
    pm.makePersistent(t);
    pm.currentTransaction().commit();
    //detach the team t
    Team copyOfT = (Team) pm.detachCopy(t);
    //begin
    pm.currentTransaction().begin();
    //modify the coach
    t.getCoach().setExperience(99);
    Iterator it  = t.getPlayers().iterator();
    //modify the players
    while(it.hasNext()){
      Player p = (Player) it.next();
      p.setAge(99);
    }
    try
      //attach the team
      Team attachedTeam = (Team) pm.makePersistent(copyOfT);
        pm.currentTransaction().commit();
View Full Code Here

   */
  public void testVersion10() {
    logger.log(BasicLevel.DEBUG, "***************testVersion10*****************");
    Team t = new Team("T10",null,null);
    Collection players = new ArrayList();
    Player p1 = new Player("p19", t, 20);
    players.add(p1);
    Player p2 = new Player("p20", t, 30);
    players.add(p2);
    t.setPlayers(players);
    Coach c = new Coach("c10", 10, t);
    t.setCoach(c);
    PersistenceManager pm = pmf.getPersistenceManager();
    pm.currentTransaction().begin();
    pm.makePersistent(t);
    pm.currentTransaction().commit();
    //detach the team t
    Team copyOfT = (Team) pm.detachCopy(t);
    //begin
    pm.currentTransaction().begin();
    //modify the coach
    t.getCoach().setExperience(99);
    Iterator it  = t.getPlayers().iterator();
    //modify the players
    while(it.hasNext()){
      Player p = (Player) it.next();
      p.setAge(99);
    }
    //commit
    pm.currentTransaction().commit();
    //begin
    pm.currentTransaction().begin();
View Full Code Here

   */
  public void testVersion11() {
    logger.log(BasicLevel.DEBUG, "***************testVersion11*****************");
    Team t = new Team("T11",null,null);
    Collection players = new ArrayList();
    Player p1 = new Player("p21", t, 20);
    players.add(p1);
    Player p2 = new Player("p22", t, 30);
    players.add(p2);
    t.setPlayers(players);
    Coach c = new Coach("c11", 10, t);
    t.setCoach(c);
    PersistenceManager pm = pmf.getPersistenceManager();
    pm.currentTransaction().begin();
    pm.makePersistent(t);
    pm.currentTransaction().commit();
    //detach the team t
    Team copyOfT = (Team) pm.detachCopy(t);
    //begin
    pm.currentTransaction().begin();
    //modify the coach
    t.getCoach().setExperience(99);
    Iterator it  = t.getPlayers().iterator();
    //modify the players
    while(it.hasNext()){
      Player p = (Player) it.next();
      p.setAge(99);
    }
    //rollback
    pm.currentTransaction().rollback();
    //begin
    pm.currentTransaction().begin();
View Full Code Here

   */
  public void testAttachCopy() {
    logger.log(BasicLevel.DEBUG, "***************testAttachCopy*****************");
    Team t = new Team("Bordeaux",null,null);
    Collection players = new ArrayList();
    Player p1 = new Player("p1", t, 25);
    players.add(p1);
    Player p2 = new Player("p2", t, 32);
    players.add(p2);
    t.setPlayers(players);
    Coach c = new Coach("c1", 5, t);
    t.setCoach(c);
   
View Full Code Here

TOP

Related Classes of org.objectweb.speedo.pobjects.detach.Player

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.