Examples of ObjectStore


Examples of com.google.code.gaeom.ObjectStore

  {
    A  a= new A();
    a.b = new B();
    a.b.a = a;
   
    ObjectStore os = ObjectStore.Factory.create();
    ObjectStoreSession oss = os.beginSession();
    oss.store(a).now();
   
    Entity e = DatastoreServiceFactory.getDatastoreService().get(oss.getKey(a.b));
   
    //should have no properties b/c parent is encoded in key
View Full Code Here

Examples of com.google.code.gaeom.ObjectStore

  }

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

    Embedder e = new Embedder();
    e.name = "Fred Flintstone";
    Embeddee em = new Embeddee();
    e.embeddee = em;
View Full Code Here

Examples of com.google.code.gaeom.ObjectStore

  {
    Set<EnumObject> objs = Sets.newHashSet();
    for (int ct = 0; ct < 10; ct++)
      objs.add(new EnumObject());

    ObjectStore os = ObjectStore.Factory.create();
    ObjectStoreSession oss = os.beginSession();
    oss.store(objs).now();

    // will get new objects b/c we are using a new session
    Set<EnumObject> result = Sets.newHashSet(os.beginSession().find(EnumObject.class).now());

    assertEquals(objs, result);
  }
View Full Code Here

Examples of com.google.code.gaeom.ObjectStore

  }

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

    List<Foo> foos = Lists.newArrayList();
    for (int ct = 0; ct < 100; ct++)
      foos.add(new Foo(ct));
    oss.store(foos).now();
View Full Code Here

Examples of com.google.code.gaeom.ObjectStore

  }

  @Test(expected = KeysNotFoundException.class)
  public void testDeleteCommand()
  {
    ObjectStore os = ObjectStore.Factory.create();
    ObjectStoreSession oss = os.beginSession();

    Tester t1 = new Tester();
    t1.name = "Fred Flintstone";
    Key key = oss.store(t1).now();

    oss.delete(t1).now();

    os.beginSession().load(key).now(); // may not fail because changes not rolled forward see superclass

    assertNull(os.beginSession().load(key).retries(0).now());
  }
View Full Code Here

Examples of com.google.code.gaeom.ObjectStore

  }

  @Test(expected = KeysNotFoundException.class)
  public void testDeleteCommandLocal()
  {
    ObjectStore os = ObjectStore.Factory.create();
    ObjectStoreSession oss = os.beginSession();

    Tester t1 = new Tester();
    t1.name = "Fred Flintstone";
    Key key = oss.store(t1).now();

    oss.delete(t1).now();

    os.beginSession().load(key).now(); // may not fail because changes not rolled forward see superclass

    assertNull(oss.load(key).retries(0).now());
  }
View Full Code Here

Examples of com.google.code.gaeom.ObjectStore

  }

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

    Gaeom gaeom = new Gaeom();
    gaeom.description = "Supah object-datastore mapping";
    gaeom.rocks = true;

    oss.store(gaeom).id(1).now();

    os.beginSession().load(Gaeom.class).id(1).now();

    os.beginSession().find(Gaeom.class).single().now();

    os.beginSession().find(Gaeom.class).filter("rocks", true).single().now();
  }
View Full Code Here

Examples of com.google.code.gaeom.ObjectStore

  }

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

    A a1 = new A();
    A a2 = new A();
    a2.b = new B();
View Full Code Here

Examples of com.google.code.gaeom.ObjectStore

  }

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

    A2 a1 = new A2();
    A2 a2 = new A2();
    a2.b = new B();
View Full Code Here

Examples of com.google.code.gaeom.ObjectStore

  }

  @Test
  public void testEvenutalConsistency() throws Exception
  {
    ObjectStore os = ObjectStore.Factory.create();
    Key key = os.beginSession().store(new Foo()).now();
   
    try
    {
      os.beginSession().load(key).retries(0).now();
      assertTrue(false); // should have thrown
    }
    catch (KeysNotFoundException e)
    {
    }
   
    assertTrue(os.beginSession().load(key).retries(0).now() != null);
  }
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.