Package org.jugile.proto2.domain

Examples of org.jugile.proto2.domain.Domain


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

    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

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.