Package domain

Examples of domain.Person


 
  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

  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

    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

TOP

Related Classes of 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.