Package org.jugile.proto2.domain

Examples of org.jugile.proto2.domain.Person


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


public class DeleteCleanupN1Test extends JugileTestCase {
 
  public void testRemoveFrom1NCollections() throws Exception {
    DBTest.clearDatabase();
    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

public class ExamplesTest extends JugileTestCase {
 
  public void testDemo1() {
   
    Domain d = Domain.getDomain();
    Person p1 = d.createPerson().setName("Bart Simpson").setAge(12).setTs(new Time("21.06.1971"));
    long id = p1.id();
    d.commit();
   
    p1 = d.getPerson(id);
    assertNotNull(p1);
    String name = p1.getName();
    assertEquals("Bart Simpson", name);
   
    d.rollback();
  }
View Full Code Here

   
    d.rollback();
  }
 
  public void testDelete() {
    Domain d = Domain.getDomain();
    for (Person p : d.getPersons()) p.delete();
    d.commit();
  }
View Full Code Here

import org.jugile.util.JugileTestCase;

public class CollectionPropsTest extends JugileTestCase {
 
  public void testProps() {
    Domain d = Domain.getDomain();
    PersonCollection pc = new PersonCollection();
    pc.add(d.createPerson().setName("p1"), "p1");
    pc.add(d.createPerson().setName("p2"), "p2");
    pc.add(d.createPerson().setName("p3"), "p3");
    for (Person p : pc) {
      print(p.getName() + "=" + pc.getProp(p.id()));
    }
  }
View Full Code Here

import org.jugile.util.Jugile;

public class TestDB extends Jugile {

  public static void main(String args[]) throws Exception {
    Domain d = Domain.getDomain();
    d.createPerson().setName("name1");
    d.createPerson().setName("name2");
    d.commit();
  }
View Full Code Here

import org.jugile.util.Time;

public class PersonTest extends JugileTestCase {

  public void testSet() {
    Domain d = Domain.getDomain();
    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

    assertTrue(p == p3);
   
  }
 
  public void testDomain() {
    Domain d = Domain.getDomain();
    Person p1 = d.createPerson(); // new instance, no origin
    p1.setName("Jukka");
    assertEquals("Jukka",p1.getName());
    d.rollback();
  }
View Full Code Here

import org.jugile.util.JugileTestCase;

public class ConcurrencyTest extends JugileTestCase {
 
  public void testCommitAfterRollback() {
    Domain d = Domain.getDomain();
    d.rollback();
    d.commit();
  }
View Full Code Here

    d.rollback();
    d.commit();
  }
 
  public void testCommitAndRollback() {
    Domain d = Domain.getDomain();
    Person p = d.createPerson();
    assertNotNull(p);
    d.commit();
   
    p = d.getPerson(p.id());
    d.commit();
    d.commit();
    d.rollback();
    p = d.getPerson(p.id());
    d.rollback();
    d.commit();
  }
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.