Examples of ObjectStore


Examples of com.google.code.gaeom.ObjectStore

  }
 
  @Test
  public void testNameRegistration()
  {
    ObjectStore os = ObjectStore.Factory.create();
    os.register("Foo", Foo.class);

    ObjectStoreSession oss = os.beginSession();
    oss.store(new Foo("Fred Flintstone")).now();
    oss.store(new Foo("Barney Rubble")).now();

    List<Foo> foos = Lists.newArrayList(oss.find(Foo.class).now());
    assertEquals(2, foos.size());
View Full Code Here

Examples of com.google.code.gaeom.ObjectStore

   
    a.bs.add(new B("Fred"));
    a.bs.add(null);
    a.bs.add(new B("Sally"));
   
    ObjectStore os = ObjectStore.Factory.create();
    Key key = os.beginSession().store(a).now();
   
    A a2 = os.beginSession().load(key).now();
   
    assertEquals(a.bs, a2.bs);
  }
View Full Code Here

Examples of com.google.code.gaeom.ObjectStore

  }

  @Test
  public void testUnactivatedLoad()
  {
    ObjectStore os = ObjectStore.Factory.create();
    ObjectStoreSession oss = os.beginSession();
    Key key = oss.store(new Foo("Fred Flintstone")).now();

    ObjectStoreSession oss2 = os.beginSession();
    Foo foo = oss2.load(key).unactivated().now();
    assertTrue(foo.name == null);
    assertEquals(key, oss2.getKey(foo));
  }
View Full Code Here

Examples of com.google.code.gaeom.ObjectStore

    B2 b2 = new B2();
    b2.x = "Schmoo";
    b2.z = "Blah";
    a.bs.add(b2);
   
    ObjectStore os = ObjectStore.Factory.create();
    os.register(B1.class.getSimpleName(), B1.class);
    os.register(B2.class.getSimpleName(), B2.class);
    Key key = os.beginSession().store(a).now();
   
    A a2 = os.beginSession().load(key).now();
    assertEquals(a, a2);
   
    Entity e = DatastoreServiceFactory.getDatastoreService().get(key);
    assertEquals(Lists.newArrayList(null, "B1", "B2"), e.getProperty("bs.contents.__type__"));
    assertEquals(Lists.newArrayList("Fred", "Bob", "Schmoo"), e.getProperty("bs.contents.x"));
View Full Code Here

Examples of com.google.code.gaeom.ObjectStore

  }

  @Test
  public void testSimpleStoreLoad()
  {
    ObjectStore osf = ObjectStore.Factory.create();
    ObjectStoreSession os = osf.beginSession();

    Person p1 = new Person();

    p1.firstName = "Fred";
    p1.lastName = "Flintstone";
    p1.shoeSize = 12L;

    Key key = os.store(p1).id(33L).now();
    assertEquals(33L, key.getId());
   
    ObjectStoreSession os2 = osf.beginSession();
    Person p2 = (Person) os2.load(Person.class).id(33L).now();

    assertTrue(p2 != p1);
    assertEquals(p1.firstName, p2.firstName);
    assertEquals(p1.lastName, p2.lastName);
View Full Code Here

Examples of com.google.code.gaeom.ObjectStore

  }

  @Test
  public void queryOnEmbeddedProperty() throws Exception
  {
    ObjectStore os = ObjectStore.Factory.create();
    ObjectStoreSession oss = os.beginSession();

    A a = new A();
    a.name = "Fred";
    a.b = new B();
    a.b.foo = "Blah";
View Full Code Here

Examples of com.google.code.gaeom.ObjectStore

  }

  @Test
  public void queryOnEmbeddedListProperty() throws Exception
  {
    ObjectStore os = ObjectStore.Factory.create();
    ObjectStoreSession oss = os.beginSession();

    A a = new A();
    a.name = "Fred";
    a.bs.add(new B());
    a.bs.add(new B());
View Full Code Here

Examples of com.google.code.gaeom.ObjectStore

  }
 
  @Test
  public void queryOnEmbeddedListStringProperty() throws Exception
  {
    ObjectStore os = ObjectStore.Factory.create();
    ObjectStoreSession oss = os.beginSession();

    A a = new A();
    a.name = "Fred";
    a.strings.add("Blah");
    a.strings.add("Blah2");
View Full Code Here

Examples of com.google.code.gaeom.ObjectStore

  }

  @Test
  public void testLoadSingleId()
  {
    ObjectStore os = ObjectStore.Factory.create();

    os.beginSession().store(new X(), new X(), new X()).ids(1, 2, 3).now();

    assertEquals(X.class, os.beginSession().load(X.class).id(1).now().getClass());
  }
View Full Code Here

Examples of com.google.code.gaeom.ObjectStore

  }

  @Test
  public void testLoadMultipleId()
  {
    ObjectStore os = ObjectStore.Factory.create();

    os.beginSession().store(new X(), new X(), new X()).ids(1, 2, 3).now();

    assertEquals(3, os.beginSession().load(X.class).ids(1, 2, 3).now().size());
  }
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.