Package com.google.appengine.datanucleus.test.jpa.SequenceExamplesJPA

Examples of com.google.appengine.datanucleus.test.jpa.SequenceExamplesJPA.HasSequenceOnNonPkFields


    assertEquals(Utils.newArrayList(1L, 1L), sequenceBatchSizes);
  }

  public void testSequenceOnNonPkFields() {
    String kind = getKind(HasSequenceOnNonPkFields.class);
    HasSequenceOnNonPkFields pojo = new HasSequenceOnNonPkFields();
    pojo.setId("jpa");
    beginTxn();
    em.persist(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(pojo.getVal(), pojo.getVal2() - 1);
    assertTrue(pojo.getVal() < pojo.getVal2());

    HasSequenceOnNonPkFields pojo2 = new HasSequenceOnNonPkFields();
    pojo2.setId("jpa");
    beginTxn();
    em.persist(pojo2);
    commitTxn();
//    assertEquals(pojo.getVal2(), pojo2.getVal() - 1);
    assertTrue(pojo.getVal2() < pojo2.getVal());
    assertEquals(Utils.newArrayList(kind + "_SEQUENCE__JPA", kind + "_SEQUENCE__JPA",
                                    kind + "_SEQUENCE__JPA", kind + "_SEQUENCE__JPA"), sequenceNames);
    assertEquals(Utils.newArrayList(1L, 1L, 1L, 1L), sequenceBatchSizes);
  }
View Full Code Here

TOP

Related Classes of com.google.appengine.datanucleus.test.jpa.SequenceExamplesJPA.HasSequenceOnNonPkFields

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.