Package siena.base.test.model

Examples of siena.base.test.model.Discovery


  }
 
  public void testIterPaginateStatefulNextPage() {
    Discovery[] discs = new Discovery[10];
    for(int i=0; i<10; i++){
      discs[i] = new Discovery("Disc_"+i, LongAutoID_CURIE);
    }
    pm.insert((Object[])discs);

    Query<Discovery> query = pm.createQuery(Discovery.class).paginate(5).stateful().order("id");
    Iterable<Discovery> iter = query.iter();
View Full Code Here


 
  public void testIterPaginateStatefulPreviousPageFromScratch() {
    Discovery[] discs = new Discovery[10];
    for(int i=0; i<10; i++){
      discs[i] = new Discovery("Disc_"+i, LongAutoID_CURIE);
    }
    pm.insert((Object[])discs);

    Query<Discovery> query = pm.createQuery(Discovery.class).paginate(5).stateful().order("name");
    Iterable<Discovery> iter = query.previousPage().iter();
    Iterator<Discovery> it = iter.iterator();
    int i=0;
    while(it.hasNext()){
      Discovery disc = it.next();
      assertEquals(discs[i++], disc);
   
    assertEquals(0, i);

    it = iter.iterator();
    i=0;
    while(it.hasNext()){
      Discovery disc = it.next();
      assertEquals(discs[i++], disc);
   
    assertEquals(0, i);
  }
View Full Code Here

  }
 
  public void testIterPaginateStatefulPreviousPage() {
    Discovery[] discs = new Discovery[10];
    for(int i=0; i<10; i++){
      discs[i] = new Discovery("Disc_"+i, LongAutoID_CURIE);
    }
    pm.insert((Object[])discs);

    Query<Discovery> query = pm.createQuery(Discovery.class).paginate(5).stateful().order("name");
    Iterable<Discovery> iter = query.iter();
    Iterator<Discovery> it = iter.iterator();
    int i=0;
    while(it.hasNext()){
      Discovery disc = it.next();
      assertEquals(discs[i++], disc);
   
    assertEquals(5, i);

    iter = query.nextPage().iter();
    it = iter.iterator();
    while(it.hasNext()){
      Discovery disc = it.next();
      assertEquals(discs[i++], disc);
   
    assertEquals(10, i);
   
    iter = query.previousPage().iter();
    it = iter.iterator();
    i=0;
    while(it.hasNext()){
      Discovery disc = it.next();
      assertEquals(discs[i++], disc);
   
    assertEquals(5, i);
  }
View Full Code Here

 
 
  public void testIterPaginateStatefulPreviouPageSeveralTimes() {
    Discovery[] discs = new Discovery[15];
    for(int i=0; i<15; i++){
      discs[i] = new Discovery("Disc_"+i, LongAutoID_CURIE);
    }
    pm.insert((Object[])discs);

    Query<Discovery> query = pm.createQuery(Discovery.class).paginate(5).stateful().order("id");
    Iterable<Discovery> iter = query.iter();
    Iterator<Discovery> it = iter.iterator();
    int i=0;
    while(it.hasNext()){
      Discovery disc = it.next();
      assertEquals(discs[i++], disc);
   
    assertEquals(5, i)
   
    iter = query.nextPage().iter();
    it = iter.iterator();
    while(it.hasNext()){
      Discovery disc = it.next();
      assertEquals(discs[i++], disc);
   
    assertEquals(10, i)
   
    iter = query.nextPage().iter();
    it = iter.iterator();
    while(it.hasNext()){
      Discovery disc = it.next();
      assertEquals(discs[i++], disc);
   
    assertEquals(15, i)
   
    iter = query.previousPage().iter();
    i=5;
    it = iter.iterator();
    while(it.hasNext()){
      Discovery disc = it.next();
      assertEquals(discs[i++], disc);
   
    assertEquals(10, i)
   
    iter = query.previousPage().iter();
    i=0;
    it = iter.iterator();
    while(it.hasNext()){
      Discovery disc = it.next();
      assertEquals(discs[i++], disc);
   
    assertEquals(5, i);
  }
View Full Code Here

 
 
  public void testIterLotsOfEntitiesStateless(){
    Discovery[] discs = new Discovery[150];
    for(int i=0; i<150; i++){
      discs[i] = new Discovery("Disc_"+i, LongAutoID_CURIE);
    }
    pm.insert((Object[])discs);
   
    Query<Discovery> query = pm.createQuery(Discovery.class).order("id");
    Iterable<Discovery> iter = query.iter();
    Iterator<Discovery> it = iter.iterator();
    int i=0;
    while(it.hasNext()){
      Discovery disc = it.next();
      assertEquals(discs[i++], disc);
   
    assertEquals(150, i)
  }
View Full Code Here

  }
 
  public void testIterLotsOfEntitiesStateful(){
    Discovery[] discs = new Discovery[150];
    for(int i=0; i<150; i++){
      discs[i] = new Discovery("Disc_"+i, LongAutoID_CURIE);
    }
    pm.insert((Object[])discs);
   
    Query<Discovery> query = pm.createQuery(Discovery.class).stateful().order("id");
    Iterable<Discovery> iter = query.iter();
    Iterator<Discovery> it = iter.iterator();
    int i=0;
    while(it.hasNext()){
      Discovery disc = it.next();
      assertEquals(discs[i++], disc);
   
    assertEquals(150, i)
  }
View Full Code Here

  }
 
  public void testIterLotsOfEntitiesStatefulMixed(){
    Discovery[] discs = new Discovery[150];
    for(int i=0; i<150; i++){
      discs[i] = new Discovery("Disc_"+i, LongAutoID_CURIE);
    }
    pm.insert((Object[])discs);
   
    Query<Discovery> query = pm.createQuery(Discovery.class).stateful().order("id");
    Iterable<Discovery> res = query.iter(50);
    Iterator<Discovery> it = res.iterator();
    int i=0;
    while(it.hasNext()){
      Discovery disc = it.next();
      assertEquals(discs[i++], disc);
   
    assertEquals(50, i)

    res = query.iter(50,50);
    it = res.iterator();
    i=100;
    while(it.hasNext()){
      Discovery disc = it.next();
      assertEquals(discs[i++], disc);
   
    assertEquals(150, i)

    res = query.iter(50,100);
    it = res.iterator();
    while(it.hasNext()){
      Discovery disc = it.next();
      assertEquals(discs[i++], disc);
   
    assertEquals(150, i)
  }
View Full Code Here

  }
 
  public void testIterLotsOfEntitiesStatefulMixed2(){
    Discovery[] discs = new Discovery[150];
    for(int i=0; i<150; i++){
      discs[i] = new Discovery("Disc_"+i, LongAutoID_CURIE);
    }
    pm.insert((Object[])discs);
   
    Query<Discovery> query = pm.createQuery(Discovery.class).stateful().order("id");
    Iterable<Discovery> iter = query.paginate(50).iter();
    Iterator<Discovery> it = iter.iterator();
    int i=0;
    while(it.hasNext()){
      Discovery disc = it.next();
      assertEquals(discs[i++], disc);
   
    assertEquals(50, i)

    iter = query.iter(50,50);
    it = iter.iterator();
    i=50;
    while(it.hasNext()){
      Discovery disc = it.next();
      assertEquals(discs[i++], disc);
   
    assertEquals(100, i)

  }
View Full Code Here

  }

  public void testIterLotsOfEntitiesStatefulMixed3(){
    Discovery[] discs = new Discovery[150];
    for(int i=0; i<150; i++){
      discs[i] = new Discovery("Disc_"+i, LongAutoID_CURIE);
    }
    pm.insert((Object[])discs);
   
    Query<Discovery> query = pm.createQuery(Discovery.class).stateful().order("id");
    Iterable<Discovery> iter = query.iter(50);
    Iterator<Discovery> it = iter.iterator();
    int i=0;
    while(it.hasNext()){
      Discovery disc = it.next();
      assertEquals(discs[i++], disc);
   
    assertEquals(50, i)
       
    iter = query.paginate(50).iter();
    it = iter.iterator();
    i=50;
    while(it.hasNext()){
      Discovery disc = it.next();
      assertEquals(discs[i++], disc);
   
    assertEquals(100, i)
 
    iter = query.iter();
    it = iter.iterator();
    i=50;
    while(it.hasNext()){
      Discovery disc = it.next();
      assertEquals(discs[i++], disc);
   
    assertEquals(100, i)

    iter = query.nextPage().iter();
    it = iter.iterator();
    while(it.hasNext()){
      Discovery disc = it.next();
      assertEquals(discs[i++], disc);
   
    assertEquals(150, i)
  }
View Full Code Here

  }
 
  public void testFetchLotsOfEntitiesStatefulMixed(){
    Discovery[] discs = new Discovery[150];
    for(int i=0; i<150; i++){
      discs[i] = new Discovery("Disc_"+i, LongAutoID_CURIE);
    }
    pm.insert((Object[])discs);
   
    Query<Discovery> query = pm.createQuery(Discovery.class).stateful().order("id");
    List<Discovery> res = query.paginate(50).fetch();
View Full Code Here

TOP

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

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.