Package com.googlecode.objectify.test.entity

Examples of com.googlecode.objectify.test.entity.Child


    fact().register(Child.class);

    Trivial triv = new Trivial(null, 3);
    Key<Trivial> trivKey = ofy().save().entity(triv).now();

    Child child = new Child(trivKey, "blah");
    ofy().save().entity(child).now();

    Iterator<Object> it = ofy().load().ancestor(trivKey).iterator();

    Object fetchedTrivial = it.next();
    assert fetchedTrivial instanceof Trivial;
    assert ((Trivial)fetchedTrivial).getId().equals(triv.getId());

    Object fetchedChild = it.next();
    assert fetchedChild instanceof Child;
    assert ((Child)fetchedChild).getId().equals(child.getId());

    assert !it.hasNext();
  }
View Full Code Here


    fact().register(Child.class);

    Trivial triv = new Trivial("foo", 5);
    Key<Trivial> parentKey = ofy().save().entity(triv).now();

    Child child = new Child(parentKey, "cry");
    Key<Child> childKey = ofy().save().entity(child).now();

    assert childKey.getParent().equals(parentKey);

    Child fetched = ofy().load().key(childKey).now();

    assert fetched.getParent().equals(child.getParent());
    assert fetched.getChildString().equals(child.getChildString());

    // Let's make sure we can get it back from an ancestor query
    Child queried = ofy().load().type(Child.class).ancestor(parentKey).first().now();

    assert queried.getParent().equals(child.getParent());
    assert queried.getChildString().equals(child.getChildString());
  }
View Full Code Here

      assert next.getId() > previousId;
      previousId = next.getId();
    }

    // Create an id with a put and verify it is > than the last
    Child ch = new Child(parentKey, "foo");
    ofy().save().entity(ch).now();

    assert ch.getId() > previousId;
  }
View Full Code Here

TOP

Related Classes of com.googlecode.objectify.test.entity.Child

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.