コード例 #1
0
  public void testStackContainerPolicy() {
    DataReadQuery query = this.buildNewQuery();
    query.useCollectionClass(Stack.class);

    stack = (Stack) getSession().executeQuery(query);
    // if we get here, we must not have generated a ClassCastException
    Record row = (Record) stack.peek();
    if (row.get("CUSTNAME") == null) {
      throw new TestErrorException("missing data");
    }
  }
コード例 #2
0
  /** assume the stack has already been populated by the previous test */
  public void testCursoredStreamPolicy() {
    ValueReadQuery sizeQuery = new ValueReadQuery("select count(*) from ORD");

    DataReadQuery query = this.buildNewQuery();
    query.useCursoredStream(5, 5, sizeQuery);

    CursoredStream stream = (CursoredStream) getSession().executeQuery(query);

    // if we get here, we must not have generated a ClassCastException
    int count = 0;
    while (stream.hasMoreElements()) {
      count++;
      Record row = (Record) stream.nextElement();
      if (row.get("CUSTNAME") == null) {
        throw new TestErrorException("missing data");
      }
    }
    if (count != stack.size()) {
      throw new TestErrorException(
          "stream does not match stack - " + "expected: " + stack.size() + " actual: " + count);
    }
  }