Package com.google.appengine.datanucleus.test.jdo

Examples of com.google.appengine.datanucleus.test.jdo.HasSerializableJDO


    DatastorePb.Query query = new DatastorePb.Query();
    query.setApp("orm");
    query.setKind("fruit");

    HasSerializableJDO hasSerializable = new HasSerializableJDO();
    hasSerializable.setYam(yam);
    hasSerializable.setYamList(Utils.newArrayList(yam));
    hasSerializable.setQuery(query);
    hasSerializable.setInteger(3);
    Flight f = new Flight("bos", "mia", "harold", 23, 24);
    hasSerializable.setFlight(f);
    beginTxn();
    pm.makePersistent(hasSerializable);
    commitTxn();

    SerializationStrategy ss = SerializationManager.DEFAULT_SERIALIZATION_STRATEGY;
    Entity e = ds.get(TestUtils.createKey(hasSerializable, hasSerializable.getId()));
    Blob yamBlob = (Blob) e.getProperty("yam");
    assertNotNull(yamBlob);
    HasSerializableJDO.Yam reloadedYam = (HasSerializableJDO.Yam)
        ss.deserialize(yamBlob, HasSerializableJDO.Yam.class);
    assertEquals(yam.getStr1(), reloadedYam.getStr1());
View Full Code Here


    e.setProperty("integer", ss.serialize(3));
    Flight f = new Flight("bos", "mia", "harold", 23, 24);
    e.setProperty("flight", ss.serialize(f));
    ds.put(e);
    beginTxn();
    HasSerializableJDO hasSerializable = pm.getObjectById(
        HasSerializableJDO.class, KeyFactory.keyToString(e.getKey()));
    assertNotNull(hasSerializable);
    assertNotNull(hasSerializable.getYam());
    assertEquals(yam.getStr1(), hasSerializable.getYam().getStr1());
    assertEquals(yam.getStr2(), hasSerializable.getYam().getStr2());
    assertEquals(yamList, hasSerializable.getYamList());
    assertNotNull(hasSerializable.getQuery());
    assertEquals(query.getApp(), hasSerializable.getQuery().getApp());
    assertEquals(query.getKind(), hasSerializable.getQuery().getKind());
    assertEquals(Integer.valueOf(3), hasSerializable.getInteger());
    Flight f2 = hasSerializable.getFlight();
    assertEquals(f.getDest(), f2.getDest());
    assertEquals(f.getOrigin(), f2.getOrigin());
    commitTxn();
  }
View Full Code Here

TOP

Related Classes of com.google.appengine.datanucleus.test.jdo.HasSerializableJDO

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.