Package com.google.code.gaeom

Examples of com.google.code.gaeom.ObjectStoreSession.find()


    ObjectStore os = ObjectStore.Factory.create();
    ObjectStoreSession oss = os.beginSession();
    oss.store(a, b).now();

    B1 b1 = oss.find(B1.class).filter("a", a).single().now();
    assertEquals(b, b1);
  }

  @Test(expected = IllegalArgumentException.class)
  public void testInvalidAncestorQuery()
View Full Code Here


    ObjectStore os = ObjectStore.Factory.create();
    ObjectStoreSession oss = os.beginSession();
    oss.store(a, b).now();

    B1 b1 = oss.find(B1.class).filter("a", Op.GreaterThan, a).single().now();
    assertEquals(b, b1);
  }

  @Test(expected = IllegalArgumentException.class)
  public void testInvalidAncestorQuery2()
View Full Code Here

    ObjectStore os = ObjectStore.Factory.create();
    ObjectStoreSession oss = os.beginSession();
    oss.store(a, b).now();

    oss.find(B2.class).filter("a", a).single().now();
  }

  @Test
  public void testRegularQuery()
  {
View Full Code Here

    ObjectStore os = ObjectStore.Factory.create();
    ObjectStoreSession oss = os.beginSession();
    oss.store(a, b).now();

    B3 b1 = oss.find(B3.class).filter("a", a).single().now();
    assertEquals(b, b1);
  }

  @Test(expected = IllegalArgumentException.class)
  public void testInvalidField()
View Full Code Here

    ObjectStore os = ObjectStore.Factory.create();
    ObjectStoreSession oss = os.beginSession();
    oss.store(a, b).now();

    oss.find(B1.class).filter("blahblah", a).single().now();
  }
}
View Full Code Here

  @Test
  public void testEqualsFilter()
  {
    ObjectStoreSession oss = ObjectStore.Factory.create().beginSession();
    List<Person> people = Lists.newArrayList(oss.find(Person.class).filter("firstName", "BamBam").now());
    assertEquals(1, people.size());
    assertEquals(Lists.newArrayList(cBamBamRubble), people);
  }

  @Test
View Full Code Here

  @Test
  public void testEqualsFilter2()
  {
    ObjectStoreSession oss = ObjectStore.Factory.create().beginSession();
    List<Person> people = Lists.newArrayList(oss.find(Person.class).filter("number", 3).now());
    assertEquals(1, people.size());
    assertEquals(Lists.newArrayList(cWilmaFlintstone), people);
  }

  @Test
View Full Code Here

  @Test
  public void testEqualsFilter3()
  {
    ObjectStoreSession oss = ObjectStore.Factory.create().beginSession();
    List<Person> people = Lists.newArrayList(oss.find(Person.class).filter("number", "3").now());
    assertEquals(1, people.size());
    assertEquals(Lists.newArrayList(cWilmaFlintstone), people);
  }

  @Test
View Full Code Here

  @Test
  public void testComparatorFilter()
  {
    ObjectStoreSession oss = ObjectStore.Factory.create().beginSession();
    List<Person> people = Lists.newArrayList(oss.find(Person.class).filter("firstName", Find.Op.LessThan, "Barney").now());
    assertEquals(1, people.size());
    assertEquals(Lists.newArrayList(cBamBamRubble), people);
  }

  @Test
View Full Code Here

  @Test
  public void testInFilter()
  {
    ObjectStoreSession oss = ObjectStore.Factory.create().beginSession();
    List<Person> people = Lists.newArrayList(oss.find(Person.class).filterIn("firstName", Lists.newArrayList("Barney", "Wilma")).now());
    assertEquals(Lists.newArrayList(cBarneyRubble, cWilmaFlintstone), people);
  }
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.