Package org.jugile.proto2.domain

Examples of org.jugile.proto2.domain.DomainBase


    p1.setName("Jukka");
    p1.setAge(10);
    p1.setTs(new Time("11.11.2011"));
    pid1 = p1.id();
   
    Family f1 = d.createFamily().setName("f1");
    f1.setType(FamilyType.BIG);
    fid1 = f1.id();
    Family f2 = d.createFamily().setName("f2");
    fid2 = f2.id();

    Person p2 = d.createPerson().setName("p2");
    pid2 = p2.id();

    p1.setFamily(f1);
View Full Code Here


    Person p1 = d.getPerson(pid1);
    assertEquals("Jukka",p1.getName());
    assertEquals(10,p1.getAge());
    assertEquals(new Time("11.11.2011"),p1.getTs());

    Family f1 = p1.getFamily();
    assertNotNull(f1);
    assertEquals("f1", f1.getName());
    assertEquals(FamilyType.BIG, f1.getType());

    assertEquals(2, p1.getFriendFamilies().size());
    Person p2 = d.getPerson(pid2);
    assertEquals(1, p2.getFriendFamilies().size());
    assertEquals(2, f1.getFriendPersons().size());
    assertEquals(1, p1.getChildren().size());

  }
View Full Code Here

 
  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);
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());
   
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

 
  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);
View Full Code Here

    Domain.reset();
    Domain d = Domain.getDomain();
 
    Person p1 = d.createPerson().setName("p1");
    Person p2 = d.createPerson().setName("p2");
    Family f1 = d.createFamily().setName("f1");
   
    f1.addPerson(p1);
    f1.addPerson(p2);

    d.commit();

    f1 = d.getFamily(f1.id());
    assertEquals(2, f1.getPersons().size());
   
    //p1 = d.getPerson(p1.id());
    //p2 = d.getPerson(p2.id());
    d.dump("before delete");
    for (Person p : f1.getPersons()) {
      print("================================ DELETE: " + p);
      p.delete();
    }
    d.dump("after delete");
    assertEquals(0,f1.getPersons().size());
    d.commit();
   
    f1 = d.getFamily(f1.id());
    assertEquals(0,f1.getPersons().size());
    d.rollback();
   
  }
View Full Code Here

    Person p = (Person)Bo.createNew(Person.class);
    p.setName("Jukka");
    String name = p.getName();
    print("name: " + name);
   
    Family f = (Family)Bo.createNew(Family.class);
    f.setName("Rahkonen");
    p.setFamily(f);

    assertEquals("Rahkonen", p.getFamily().getName());
    d.rollback();
  }
View Full Code Here

    assertEquals("Jukka",p.getName());
    assertEquals(40,p.getAge());
    assertEquals(new Time("21.06.1971"),p.getTs());

    UnitOfWork uow = DomainCore.getUnitOfWork();
    Family f = (Family)uow.createNewBo(Family.class);
    f.setName("Rahkonen");
    p.setFamily(f);
    assertEquals("Rahkonen",p.getFamily().getName());
   
    print("p: " +p);
View Full Code Here

 
  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

TOP

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

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.