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

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


    // we need to make sure we don't reuse the pmf
    pmf.close();
    tearDown();
    setUp();
    KeyRange range = ds.allocateIds("jdothat2", 1);
    HasSequenceWithSequenceGenerator2 pojo = new HasSequenceWithSequenceGenerator2();
    beginTxn();
    pm.makePersistent(pojo);
    commitTxn();
    // 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
    // assertEquals(range.getEnd().getId(), pojo.getId() - 1);
    assertTrue(range.getEnd().getId() < pojo.getId());
    Sequence seq = pm.getSequence("jdo1b");
//    assertEquals(pojo.getId() + 12, seq.nextValue());
    assertTrue(pojo.getId() + 12 <= seq.nextValue());
//    assertEquals(pojo.getId() + 13, seq.nextValue());
    assertTrue(pojo.getId() + 13 <= seq.nextValue());
    assertEquals(Utils.newArrayList("jdothat2", "jdothat2"), sequenceNames);
    assertEquals(Utils.newArrayList(12L, 12L), sequenceBatchSizes);
    sequenceNames.clear();
    sequenceBatchSizes.clear();
    // getting a sequence always gets you a fresh batch
    seq = pm.getSequence("jdo1b");
//    assertEquals(pojo.getId() + 24, seq.nextValue());
    assertTrue(pojo.getId() + 24 <= seq.nextValue());
//    assertEquals(pojo.getId() + 25, seq.nextValue());
    assertTrue(pojo.getId() + 25 <= seq.nextValue());
    assertEquals(Utils.newArrayList("jdothat2"), sequenceNames);
    assertEquals(Utils.newArrayList(12L), sequenceBatchSizes);
  }
View Full Code Here

TOP

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

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.