Package org.jugile.proto2.domain

Examples of org.jugile.proto2.domain.Person


import org.jugile.util.JugileTestCase;

public class BoCollectionTest extends JugileTestCase {
 
  public void testPaging() {
    Domain d = Domain.getDomain();
    PersonCollection pc = new PersonCollection();
    for (int i = 0; i < 20; i++) {
      Person p = d.createPerson();
      p.setName("p"+i);
      pc.add(p);
    }
    for (Person p : pc) {
      print("p: " + p);
View Full Code Here


  private static long fid1;
  private static long fid2;

  public void testCreateAndVerify() {
    Domain.reset();
    Domain d = Domain.getDomain();
    createDomain(d);
    verifyDomain(d); // before commit, all is in uow
    d.commit();
    verifyDomain(d); // after commit, all is now in dd
    d.rollback();
  }
View Full Code Here

public class EmptyStringTest extends JugileTestCase {

  public void testModifyName() {
    HiLo.setHasdb(false);
    Props.setIsAdminNode(true);
    Domain d = Domain.getDomain();
    Person p = d.createPerson();
    p.setName("joo");
    d.commit();
   
    p = d.getPerson(p.id());
    print("name: " + p.getName());
    assertEquals("joo",p.getName());
   
    p.setName("joo2");
    d.commit();
   
    p = d.getPerson(p.id());
    print("name: " + p.getName());
    assertEquals("joo2",p.getName());
  }
View Full Code Here

  }

  public void testSetNullName() {
    HiLo.setHasdb(false);
    Props.setIsAdminNode(true);
    Domain d = Domain.getDomain();
    Person p = d.createPerson();
    p.setName("joo");
    d.commit();
   
    p = d.getPerson(p.id());
    print("name: " + p.getName());
    assertEquals("joo",p.getName());
   
    p.setName(null);
    d.commit();
   
    p = d.getPerson(p.id());
    print("name: " + p.getName());
    assertEquals(null,p.getName());
  }
View Full Code Here

  }

  public void testAddEmptyString() {
    HiLo.setHasdb(false);
    Props.setIsAdminNode(true);
    Domain d = Domain.getDomain();
    Person p = d.createPerson();
    p.setName("joo");
    d.commit();
   
    p = d.getPerson(p.id());
    print("name: " + p.getName());
    assertEquals("joo",p.getName());
   
    p.setName("");
    d.commit();
   
    p = d.getPerson(p.id());
    print("name: " + p.getName());
    assertEquals(null,p.getName());
  }
View Full Code Here

  }
 
  public void testAddNullChar() {
    HiLo.setHasdb(false);
    Props.setIsAdminNode(true);
    Domain d = Domain.getDomain();
    Person p = d.createPerson();
    p.setName("joo");
    d.commit();
   
    p = d.getPerson(p.id());
    print("name: " + p.getName());
    assertEquals("joo",p.getName());
   
    p.setName(""+Bo.NULLCHAR);
    d.commit();
   
    p = d.getPerson(p.id());
    print("name: " + p.getName());
    assertEquals(""+Bo.NULLCHAR,p.getName());
  }
View Full Code Here

  }
 
  public void testStartsWithNull() {
    HiLo.setHasdb(false);
    Props.setIsAdminNode(true);
    Domain d = Domain.getDomain();
    Person p = d.createPerson();
    p.setName("joo");
    d.commit();
   
    p = d.getPerson(p.id());
    print("name: " + p.getName());
    assertEquals("joo",p.getName());
   
    p.setName(""+Bo.NULLCHAR+"x");
    d.commit();
   
    p = d.getPerson(p.id());
    print("name: " + p.getName());
    assertEquals(""+Bo.NULLCHAR+"x",p.getName());
  }
View Full Code Here

public class DeleteCleanupTest extends JugileTestCase {
 
  public void testNNRemoveAfterCommit() {
    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

    d.commit();
   
    f1 = d.getFamily(f1.id());
    assertEquals(1,f1.getFriendPersons().size());
    p1 = d.getPerson(p1.id());
    assertEquals(0,p1.getFriendFamilies().size());

    p2 = d.getPerson(p2.id());
    p2.removeFriendFamily(f1)// person -> family

    d.commit();
    f1 = d.getFamily(f1.id());
    assertEquals(0,f1.getFriendPersons().size());
    p2 = d.getPerson(p2.id());
    assertEquals(0,p2.getFriendFamilies().size());

  }
View Full Code Here

 
 
 
  public void testCleanUpConnectionsOnDelete() {
    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.addPerson(p1);
    f1.addPerson(p2);
   
    assertEquals(2,f1.getPersons().size());
    p1.delete();
    assertEquals(1,f1.getPersons().size());
   
    d.commit();
    f1 = d.getFamily(f1.id());
    assertEquals(1,f1.getPersons().size())
   
    f2 = d.getFamily(f2.id());
    p2 = d.getPerson(p2.id());
    p2.addFriendFamily(f1);
    p2.addFriendFamily(f2);
    assertEquals(2,p2.getFriendFamilies().size());
   
    f2.delete();
    assertEquals(1,p2.getFriendFamilies().size());
    d.commit();
    p2 = d.getPerson(p2.id());
    assertEquals(1,p2.getFriendFamilies().size());
   
    d.rollback();
   
  }
View Full Code Here

   
  }

  public void testDeleteNNEnd() {
    Domain.reset();
    Domain d = Domain.getDomain();
   
    Person p1 = d.createPerson().setName("p1");
    Family f1 = d.createFamily().setName("f1");
    p1.addFriendFamily(f1);
    assertEquals(1,p1.getFriendFamilies().size());
    assertEquals(1,f1.getFriendPersons().size());
    d.dump("1");
    d.commit();
    d.dump("2");
    p1 = d.getPerson(p1.id());
    f1 = d.getFamily(f1.id());
    assertEquals(1,p1.getFriendFamilies().size());
    assertEquals(1,f1.getFriendPersons().size());
    d.dump("3");
//    p1.delete();
//    assertEquals(0,f1.getFriendPersons().size());
    //f1.removeFriendPerson(p1);
   
    f1.delete();
    d.dump("deleted f1");
    assertEquals(0,p1.getFriendFamilies().size());

    d.rollback();
  }
View Full Code Here

TOP

Related Classes of org.jugile.proto2.domain.Person

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.