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

Examples of com.google.appengine.datanucleus.test.jdo.SequenceExamplesJDO.HasSequence


  }


  public void testSimpleInsert() throws EntityNotFoundException {
    String kind = getKind(HasSequence.class);
    HasSequence pojo = new HasSequence();
    pojo.setVal("jdo1");
    beginTxn();
    pm.makePersistent(pojo);
    commitTxn();
    Entity e = ds.get(KeyFactory.createKey(kind, pojo.getId()));
    assertEquals("jdo1", e.getProperty("val"));

    HasSequence pojo2 = new HasSequence();
    pojo2.setVal("jdo2");
    beginTxn();
    pm.makePersistent(pojo2);
    commitTxn();
    e = ds.get(KeyFactory.createKey(kind, pojo2.getId()));
    assertEquals("jdo2", e.getProperty("val"));
    // the local datastore id allocator is a single sequence so if there
    // are any other allocations happening we can't assert on exact values.
    // uncomment this check and the others below when we bring the local
    // allocator in line with the prod allocator
    assertTrue(pojo.getId() < pojo2.getId());
    assertEquals(Utils.newArrayList(kind + "_SEQUENCE__JDO", kind + "_SEQUENCE__JDO"), sequenceNames);
    assertEquals(Utils.newArrayList(1L, 1L), sequenceBatchSizes);
  }
View Full Code Here

TOP

Related Classes of com.google.appengine.datanucleus.test.jdo.SequenceExamplesJDO.HasSequence

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.