Package org.jugile.proto2.domain

Examples of org.jugile.proto2.domain.Domain


  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

    verifyDomain(d); // after commit, all is now in dd
    d.rollback();
  }
 
  public static void createDomain(Domain d) {
    Person p1 = d.createPerson();
    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);
    p1.addFriendFamily(f1);
    p1.addFriendFamily(f2);
    f1.addFriendPerson(p2);

    Person c1 = d.createPerson().setName("c1");
    c1.setParent(p1);
  }
View Full Code Here

   
    print("stats: " + d.stats());
    print("  families: " + d.getFamilies().size());
   
    assertTrue(d.getPersons().size() > 2);
    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

    cols.add("19750621-000000.100");
    headers.add("age");
    cols.add("44");
    bm.parse(headers, cols);
   
    Person p = bm.getOriginal(1000);
    assertNotNull(p);
    print("p: " + p);
  }
View Full Code Here

  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

TOP

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

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.