Exemplo n.º 1
0
  /** Test of nextValue method, of class UjoSequencer. */
  public void testNextValue_2() {
    System.out.println("testNextValue_2");

    final int sequenceCache = 2;
    final OrmHandler handler = createHandler(sequenceCache);
    final MetaTable orderModel = handler.findTableModel(Order.class);
    final UjoSequencer seq = orderModel.getSequencer();
    final Session session = handler.createSession();

    long seqBeg = seq.nextValue(session);
    long seqEnd = 0;
    int count = 52;
    for (int i = 0; i < count; i++) {
      seqEnd = seq.nextValue(session);
    }
    session.close();
    assertEquals("ID sequences must be the same", seqBeg + count, seqEnd);
  }
Exemplo n.º 2
0
  /** Test of nextValue method, of class UjoSequencer. */
  public void testNextValue_3() {
    System.out.println("testNextValue_3");

    final int sequenceCache = 3;
    final OrmHandler handler = createHandler(sequenceCache);
    final Session session = handler.createSession();

    Order orderBeg = createAndSaveOrder(session);
    Order orderEnd = null;
    int count = 53;
    for (long i = 0; i < count; i++) {
      orderEnd = createAndSaveOrder(session);
    }
    session.close();
    assertEquals(
        "ID sequences must be the same",
        orderBeg.getId().longValue() + count,
        orderEnd.getId().longValue());
  }