Esempio n. 1
0
  @Test
  public void testForwardOnly() throws Exception {
    ElementSymbol x = new ElementSymbol("x"); // $NON-NLS-1$
    x.setType(DataTypeManager.DefaultDataClasses.INTEGER);
    List<ElementSymbol> schema = Arrays.asList(x);
    TupleBuffer tb =
        BufferManagerFactory.getStandaloneBufferManager()
            .createTupleBuffer(schema, "x", TupleSourceType.PROCESSOR); // $NON-NLS-1$
    tb.setForwardOnly(true);
    tb.addTuple(Arrays.asList(1));
    TupleBatch batch = tb.getBatch(1);
    assertTrue(!batch.getTerminationFlag());
    assertEquals(1, batch.getBeginRow());
    try {
      tb.getBatch(1);
      fail("expected exception"); // $NON-NLS-1$
    } catch (AssertionError e) {

    }
    tb.addTuple(Arrays.asList(1));
    tb.close();
    batch = tb.getBatch(2);
    assertTrue(batch.getTerminationFlag());
    assertEquals(2, batch.getBeginRow());
  }