Package com.google.appengine.api.datastore

Examples of com.google.appengine.api.datastore.Key


  }

  @Test
  public void testActivationTracking()
  {
    Key key = load();

    ObjectStoreSession oss2 = os.beginSession();
    A a2 = oss2.load(key).activate(0).now();
    assertTrue(oss2.isActivated(a2));
    assertFalse(oss2.isActivated(a2.b));
View Full Code Here


    a.b.b = new A();
    a.b.b.name = "Martha";

    ObjectStoreSession oss = os.beginSession();

    Key key = oss.store(a).now();
    assertTrue(oss.isActivated(a));
    assertTrue(oss.isActivated(a.b));
    Key key1 = oss.getKey(a.b);

    ObjectStoreSession oss2 = os.beginSession();
    oss2.load(key1).activate(0).now()//load a.b activated, but a.b.b unactivated
   
    A a1 = oss2.load(key).now(); // load the whole graph
View Full Code Here

  }

  @Test(expected = IllegalArgumentException.class)
  public void testDetectStoreUnactivated()
  {
    Key key = load();
    ObjectStoreSession oss2 = os.beginSession();
    A a = oss2.load(key).activate(0).now();

    a.b.name = "bob";
    oss2.store(a.b).now();
View Full Code Here

    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
View Full Code Here

    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
View Full Code Here

    child1.children = Lists.newArrayList(grandchild3);

    ObjectStoreSession sess1 = store.beginSession();
    sess1.store(root).now();
    Key key = sess1.getKey(child2);

    ObjectStoreSession sess2 = store.beginSession();
    Node child2a = sess2.load(key).activate("**.children", "**.parent", "!**.parent.children").now();

    assertEquals(child2.name, child2a.name);
View Full Code Here

  public void testTextAnnotation() throws Exception
  {
    Foo f = new Foo();
    f.longString = RandomStringUtils.randomAlphanumeric(800);

    Key key = ObjectStore.Singleton.get().beginSession().store(f).now();

    Entity e = DatastoreServiceFactory.getDatastoreService().get(key);
    assertTrue(e.getProperty("longString") instanceof com.google.appengine.api.datastore.Text);
  }
View Full Code Here

    f.bars = generate(Bar.class, 10);
    f.bars[3] = null;
    f.bars2 = generate(Bar.class, 10);
    f.bars2[6] = null;

    Key key = os.beginSession().store(f).now();

    DatastoreService ds = DatastoreServiceFactory.getDatastoreService();
    Entity e = ds.get(key);
    assertTrue(e.getProperty("b") instanceof Blob);
    assertTrue(e.getProperty("c") instanceof String);
View Full Code Here

  @Test
  public void testNoCache()
  {
    ObjectStoreCache cache = new ObjectStoreCache();

    Key key = KeyFactory.createKey("fred", 12);
    Object object = new Object();

    cache.set(object, key);

    assertTrue(cache.getObject(key) == null);
View Full Code Here

  @Test
  public void testExpiration()
  {
    ObjectStoreCache cache = new ObjectStoreCache();

    Key key = KeyFactory.createKey("fred", 12);
    Foo object = new Foo();

    cache.set(object, key);

    assertEquals(object, cache.getObject(key));
View Full Code Here

TOP

Related Classes of com.google.appengine.api.datastore.Key

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.