Package com.google.code.gaeom

Examples of com.google.code.gaeom.ObjectStore$Factory


  }

  @Test
  public void testHierarchyReading()
  {
    ObjectStore store = ObjectStore.Factory.create();

    Node root = new Node();
    root.name = "Root";

    Node child1 = new Node();
    child1.name = "Child1";
    child1.parent = root;

    Node child2 = new Node();
    child2.name = "Child2";
    child2.parent = root;

    root.children = Lists.newArrayList(child1, child2);

    Node grandchild1 = new Node();
    grandchild1.name = "Grandkid1";
    grandchild1.parent = child2;

    Node grandchild2 = new Node();
    grandchild2.name = "Grandkid2";
    grandchild2.parent = child2;

    child2.children = Lists.newArrayList(grandchild1, grandchild2);

    Node grandchild3 = new Node();
    grandchild3.name = "Grandkid3";
    grandchild3.parent = child1;

    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);
    assertEquals(child2.children.size(), child2a.children.size());
    assertEquals(child2.children.get(0).name, child2a.children.get(0).name);
View Full Code Here


    A a = new A();

    B1 b = new B1();
    b.a = a;

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

    A a = new A();

    B1 b = new B1();
    b.a = a;

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

    A a = new A();

    B3 b = new B3();
    b.a = a;

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

    os.beginSession().find(B3.class).filter("a", a).single().now();
  }
View Full Code Here

    A a = new A();

    B2 b = new B2();
    b.a = a;

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

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

    A a = new A();

    B3 b = new B3();
    b.a = a;

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

    A a = new A();

    B1 b = new B1();
    b.a = a;

    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

  {
    A  a= new A();
    a.b = new B();
    a.b.a = a;
   
    ObjectStore os = ObjectStore.Factory.create();
    Key key = os.beginSession().store(a).now();
   
    A a2 = os.beginSession().load(key).now();
   
    assertEquals(a2, a2.b.a);
  }
View Full Code Here

  {
    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

  }

  @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

TOP

Related Classes of com.google.code.gaeom.ObjectStore$Factory

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.