Package org.jugile.daims

Source Code of org.jugile.daims.NNRemoveUowTest

package org.jugile.daims;

import org.jugile.proto2.domain.Domain;
import org.jugile.proto2.domain.Family;
import org.jugile.proto2.domain.Person;
import org.jugile.util.JugileTestCase;

public class NNRemoveUowTest extends JugileTestCase {
 
  public void testNNRemoveUow() {
    Domain.reset();
    Domain d = Domain.getDomain();

    Family f1 = d.createFamily().setName("f1");
    Family f2 = d.createFamily().setName("f2");
   
    Person p1 = d.createPerson().setName("p1");
    Person p2 = d.createPerson().setName("p2");
   
    f1.addFriendPerson(p1);
    f1.addFriendPerson(p2);

    d.commit();
   
    f1 = d.getFamily(f1.id());
    assertEquals(2,f1.getFriendPersons().size());
    p1 = d.getPerson(p1.id());
    assertEquals(1,p1.getFriendFamilies().size());
   
    f1.removeFriendPerson(p1); // family -> person
    f1 = d.getFamily(f1.id());
    assertEquals(1,f1.getFriendPersons().size());
    assertEquals(0,p1.getFriendFamilies().size());
    //d.dump("f1.removeFriendPerson(p1) done");

    d.commit();
   
    f1 = d.getFamily(f1.id());
    p2 = d.getPerson(p2.id());
    p2.removeFriendFamily(f1)// person -> family
    //d.dump("p2.removeFriendFamily(f1) done");

    assertEquals(0,p2.getFriendFamilies().size());
    assertEquals(0,f1.getFriendPersons().size());

    d.rollback();
  }
 
}
TOP

Related Classes of org.jugile.daims.NNRemoveUowTest

TOP
Copyright © 2018 www.massapi.com. 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.