Package siena.base.test.model

Examples of siena.base.test.model.AggregateChildModel


  }
 
  public void testAggregateListQuerysFetchLimitOffset() {
    List<AggregateChildModel> adams = new ArrayList<AggregateChildModel>();
    for(int i=0; i<100; i++){
      AggregateChildModel adam = new AggregateChildModel();
      adam.name = "adam"+i;
      adams.add(adam);
    }
   
    AggregateChildModel eve = new AggregateChildModel();
    eve.name = "eve";

    AggregateParentModel god = new AggregateParentModel();
    god.name = "god";
    god.child.set(eve);
View Full Code Here


  }
 
  public void testAggregateListQuerysFetchKeys() {
    List<AggregateChildModel> adams = new ArrayList<AggregateChildModel>();
    for(int i=0; i<100; i++){
      AggregateChildModel adam = new AggregateChildModel();
      adam.name = "adam"+i;
      adams.add(adam);
    }
   
    AggregateChildModel eve = new AggregateChildModel();
    eve.name = "eve";

    AggregateParentModel god = new AggregateParentModel();
    god.name = "god";
    god.child.set(eve);
    god.children.asList().addAll(adams);
       
    god.insert();
   
    assertNotNull(god.id);
    assertNotNull(god.child.get().id);
   
    // get aggregated one2many
    AggregateParentModel godbis = AggregateParentModel.all().filter("name", "god").get();
    List<AggregateChildModel> children = godbis.children.asQuery().fetchKeys();
    for(int i=0; i<100; i++){
      assertEquals(adams.get(i).id, children.get(i).id);     
      assertTrue(children.get(i).name == null);     
    }
   
    for(int i=0; i<100; i++){
      assertEquals(adams.get(i), godbis.children.asList().get(i));     
    }
   
    Iterator<AggregateChildModel> it = godbis.children.asList().iterator();
    int i=0;
    while(it.hasNext()){
      AggregateChildModel child = it.next();
      assertEquals(adams.get(i++), child)
    }
    assertEquals(100, i);
  }
View Full Code Here

  }
 
  public void testAggregateListQuerysFetchKeysLimit() {
    List<AggregateChildModel> adams = new ArrayList<AggregateChildModel>();
    for(int i=0; i<100; i++){
      AggregateChildModel adam = new AggregateChildModel();
      adam.name = "adam"+i;
      adams.add(adam);
    }
   
    AggregateChildModel eve = new AggregateChildModel();
    eve.name = "eve";

    AggregateParentModel god = new AggregateParentModel();
    god.name = "god";
    god.child.set(eve);
    god.children.asList().addAll(adams);
       
    god.insert();
   
    assertNotNull(god.id);
    assertNotNull(god.child.get().id);
   
    // get aggregated one2many
    AggregateParentModel godbis = AggregateParentModel.all().filter("name", "god").get();
    List<AggregateChildModel> children = godbis.children.asQuery().fetchKeys(10);
    for(int i=0; i<10; i++){
      assertEquals(adams.get(i).id, children.get(i).id);     
      assertTrue(children.get(i).name == null);     
    }
   
    for(int i=0; i<100; i++){
      assertEquals(adams.get(i).id, godbis.children.asList().get(i).id);     
    }
   
    Iterator<AggregateChildModel> it = godbis.children.asList().iterator();
    int i=0;
    while(it.hasNext()){
      AggregateChildModel child = it.next();
      assertEquals(adams.get(i++).id, child.id)
    }
    assertEquals(100, i);
  }
View Full Code Here

  }
 
  public void testAggregateListQuerysFetchKeysLimitOffset() {
    List<AggregateChildModel> adams = new ArrayList<AggregateChildModel>();
    for(int i=0; i<100; i++){
      AggregateChildModel adam = new AggregateChildModel();
      adam.name = "adam"+i;
      adams.add(adam);
    }
   
    AggregateChildModel eve = new AggregateChildModel();
    eve.name = "eve";

    AggregateParentModel god = new AggregateParentModel();
    god.name = "god";
    god.child.set(eve);
    god.children.asList().addAll(adams);
       
    god.insert();
   
    assertNotNull(god.id);
    assertNotNull(god.child.get().id);
   
    // get aggregated one2many
    AggregateParentModel godbis = AggregateParentModel.all().filter("name", "god").get();
    List<AggregateChildModel> children = godbis.children.asQuery().fetchKeys(10, 26);
    for(int i=0; i<10; i++){
      assertEquals(adams.get(i+26).id, children.get(i).id);     
      assertTrue(children.get(i).name == null);     
    }
   
    for(int i=0; i<10; i++){
      assertEquals(adams.get(i).id, godbis.children.asList().get(i).id);     
    }
   
    Iterator<AggregateChildModel> it = godbis.children.asList().iterator();
    int i=0;
    while(it.hasNext()){
      AggregateChildModel child = it.next();
      assertEquals(adams.get(i++).id, child.id)
    }
    assertEquals(100, i);
  }
View Full Code Here

  }
 
  public void testAggregateListQueryDelete() {
    List<AggregateChildModel> adams = new ArrayList<AggregateChildModel>();
    for(int i=0; i<100; i++){
      AggregateChildModel adam = new AggregateChildModel();
      adam.name = "adam"+i;
      adams.add(adam);
    }
   
    AggregateChildModel eve = new AggregateChildModel();
    eve.name = "eve";

    AggregateParentModel god = new AggregateParentModel();
    god.name = "god";
    god.child.set(eve);
View Full Code Here

  }
 
  public void testAggregateListQueryGet() {
    List<AggregateChildModel> adams = new ArrayList<AggregateChildModel>();
    for(int i=0; i<100; i++){
      AggregateChildModel adam = new AggregateChildModel();
      adam.name = "adam"+i;
      adams.add(adam);
    }
   
    AggregateChildModel eve = new AggregateChildModel();
    eve.name = "eve";

    AggregateParentModel god = new AggregateParentModel();
    god.name = "god";
    god.child.set(eve);
View Full Code Here

  }
 
  public void testAggregateListQueryCount() {
    List<AggregateChildModel> adams = new ArrayList<AggregateChildModel>();
    for(int i=0; i<100; i++){
      AggregateChildModel adam = new AggregateChildModel();
      adam.name = "adam"+i;
      adams.add(adam);
    }
   
    AggregateChildModel eve = new AggregateChildModel();
    eve.name = "eve";

    AggregateParentModel god = new AggregateParentModel();
    god.name = "god";
    god.child.set(eve);
View Full Code Here

  }
 
  public void testAggregateListQueryFilter() {
    List<AggregateChildModel> adams = new ArrayList<AggregateChildModel>();
    for(int i=0; i<100; i++){
      AggregateChildModel adam = new AggregateChildModel();
      adam.name = "adam"+i;
      adams.add(adam);
    }
   
    AggregateChildModel eve = new AggregateChildModel();
    eve.name = "eve";

    AggregateParentModel god = new AggregateParentModel();
    god.name = "god";
    god.child.set(eve);
    god.children.asList().addAll(adams);
       
    god.insert();
   
    assertNotNull(god.id);
    assertNotNull(god.child.get().id);
   
    AggregateParentModel godbis = AggregateParentModel.all().filter("name", "god").get();
    AggregateChildModel adam47 = godbis.children.asQuery().filter("name", "adam47").get();
    assertEquals( adams.get(47), adam47);   

    List<AggregateChildModel> adamsbis =
      godbis.children.asQuery().filter("name>", "adam47").filter("name<", "adam5").fetch();
    assertEquals( adams.get(48), adamsbis.get(0));   
View Full Code Here

  }
 
  public void testAggregateListQueryOrder() {
    List<AggregateChildModel> adams = new ArrayList<AggregateChildModel>();
    for(int i=0; i<100; i++){
      AggregateChildModel adam = new AggregateChildModel();
      adam.name = "adam"+i;
      adams.add(adam);
    }
   
    AggregateChildModel eve = new AggregateChildModel();
    eve.name = "eve";

    AggregateParentModel god = new AggregateParentModel();
    god.name = "god";
    god.child.set(eve);
View Full Code Here

TOP

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

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.