Package com.google.code.gaeom

Examples of com.google.code.gaeom.ObjectStore


  }

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

    Key key = os.beginSession().store(new X()).now();

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


  }

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

    List<Key> keys = os.beginSession().store(new X(), new X(), new X()).now();

    assertEquals(3, Lists.newArrayList(os.beginSession().load(keys).now()).size());
  }
View Full Code Here

  }

  @Test
  public void testRefreshSingleKey()
  {
    ObjectStore os = ObjectStore.Factory.create();
    ObjectStoreSession oss = os.beginSession();
    X x = new X();
    x.blah = "fred";
    Key key = oss.store(x).now();
    x.blah = "mary";
    assertEquals("mary", oss.load(key).<X> now().blah);
View Full Code Here

  }

  @Test
  public void testRefreshSingleKey2()
  {
    ObjectStore os = ObjectStore.Factory.create();
    ObjectStoreSession oss = os.beginSession();
    X x = new X();
    x.blah = "fred";
    Key key = oss.store(x).now();
    x.blah = "mary";
    assertEquals("mary", oss.load(key).<X> now().blah);
View Full Code Here

  }

  @Test
  public void testRefreshMultipleKeys()
  {
    ObjectStore os = ObjectStore.Factory.create();
    ObjectStoreSession oss = os.beginSession();
    X x1 = new X();
    x1.blah = "fred1";
    X x2 = new X();
    x2.blah = "fred2";
    X x3 = new X();
View Full Code Here

  }

  @Test
  public void testRefreshMultipleKeys2()
  {
    ObjectStore os = ObjectStore.Factory.create();
    ObjectStoreSession oss = os.beginSession();
    X x1 = new X();
    x1.blah = "fred1";
    X x2 = new X();
    x2.blah = "fred2";
    X x3 = new X();
View Full Code Here

  }

  @Test
  public void testLoadSingleParentedStringId()
  {
    ObjectStore os = ObjectStore.Factory.create();
    ObjectStoreSession oss = os.beginSession();
    X parent = new X();
    oss.store(parent).now();
    oss.store(new X()).id("a").parent(parent).now();

    assertEquals(X.class, oss.load(X.class).id("a").parent(parent).now().getClass());
View Full Code Here

  }

  @Test
  public void testLoadMultipleParentedStringId()
  {
    ObjectStore os = ObjectStore.Factory.create();
    ObjectStoreSession oss = os.beginSession();
    X parent = new X();
    oss.store(parent).now();
    oss.store(new X(), new X(), new X()).ids("a", "b", "c").parent(parent).now();

    assertEquals(3, oss.load(X.class).ids("a", "b", "c").parent(parent).now().size());
View Full Code Here

  public void testSharedCaching()
  {
    TestCache tc = new TestCache();
    tc.name = "Fred";
   
    ObjectStore os = ObjectStore.Factory.create();
    ObjectStoreSession oss1 = os.beginSession();
   
    Key key = oss1.store(tc).now();
   
    ObjectStoreSession oss2 = os.beginSession();

    TestCache tc2 = (TestCache)oss2.load(key).now();
   
    assertTrue("same instance", tc == tc2);
  }
View Full Code Here

    A a = new A();

    a.name = "Fred";
    a.b.name = "Flintstone";

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

    Key key = oss.store(a).now();

    ObjectStoreSession oss2 = os.beginSession();

    A a2 = (A) oss2.load(key).now();

    assertEquals(a.name, a2.name);
    assertNotNull(a2.b);
View Full Code Here

TOP

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

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.