Package siena.base.test.model

Examples of siena.base.test.model.RelatedSeveralQueryParent


    assertEquals(god, godbis2);
    assertNull(godbis2.child.get());
  }
 
  public void testRelatedSeveralQuery() {
    RelatedSeveralQueryParent god = new RelatedSeveralQueryParent("god");
    god.insert();

    RelatedSeveralQueryChild adam1 = new RelatedSeveralQueryChild("adam1");
    adam1.owner = god;
    adam1.insert();
   
    RelatedSeveralQueryChild adam2 = new RelatedSeveralQueryChild("adam2");
    adam2.owner = god;
    adam2.insert();


    assertNotNull(god.id);
    assertEquals(god.id, adam1.owner.id);
    assertEquals(god.id, adam2.owner.id);
   
    RelatedSeveralQueryParent godbis = Model.getByKey(RelatedSeveralQueryParent.class, god.id);
    List<RelatedSeveralQueryChild> children = godbis.children.fetch();
   
    assertEquals(god, godbis);
    assertEquals(adam1, children.get(0));
    assertEquals(adam2, children.get(1));
View Full Code Here


    assertEquals(adam1, children.get(0));
    assertEquals(adam2, children.get(1));
  }
 
  public void testRelatedSeveralQueryLotsPaginate() {
    RelatedSeveralQueryParent god = new RelatedSeveralQueryParent("god");
    god.insert();

    List<RelatedSeveralQueryChild> adams = new ArrayList<RelatedSeveralQueryChild>();
    for(int i=0; i<100; i++){
      RelatedSeveralQueryChild adam = new RelatedSeveralQueryChild("adam"+i);
      adam.owner = god;
      adam.insert();
      adams.add(adam);
    }
     
    RelatedSeveralQueryParent godbis = Model.getByKey(RelatedSeveralQueryParent.class, god.id);
    assertEquals(god, godbis);
    Query<RelatedSeveralQueryChild> q = godbis.children.paginate(10);
    List<RelatedSeveralQueryChild> children = q.fetch();
    for(int i=0; i<10; i++){
      assertEquals(adams.get(i), children.get(i));
View Full Code Here

TOP

Related Classes of siena.base.test.model.RelatedSeveralQueryParent

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.