Exemplo n.º 1
0
  /**
   * Filtering on data set, without total
   *
   * @throws Exception
   */
  @Test
  public void testFilterOnDateType() throws Exception {

    FilterDefinition filterDefn =
        new FilterDefinition(
            new ConditionalExpression(
                "row.SALE_DATE",
                ConditionalExpression.OP_BETWEEN,
                "\'2004-05-01 00:00:00\'",
                "\'2004-06-05 00:00:00\'"));
    this.dataSet.addFilter(filterDefn);

    QueryDefinition queryDefn = newReportQuery();

    // column mapping
    String[] name = new String[] {"testColumn1", "testColumn2", "SALE_DATE"};
    ScriptExpression[] se = new ScriptExpression[name.length];
    se[0] = new ScriptExpression("dataSetRow.COUNTRY");
    se[1] = new ScriptExpression("dataSetRow.CITY");
    se[2] = new ScriptExpression("dataSetRow.SALE_DATE");
    for (int i = 0; i < name.length; i++) queryDefn.addBinding(new Binding(name[i], se[i]));

    IResultIterator ri = executeQuery(queryDefn);
    while (ri.next()) {
      String str = "";
      for (int i = 0; i < name.length; i++) {
        str += ri.getValue(name[i]);

        if (i < name.length - 1) str += ", ";
      }
      testPrintln(str);
    }

    checkOutputFile();
  }
Exemplo n.º 2
0
  /** @throws Exception */
  @Test
  public void testSpecialExpression3() throws Exception {
    QueryDefinition queryDefn = newReportQuery();
    // column mapping
    String[] name = new String[] {"AMOUNT", "testColumn1", "testColumn2"};
    ScriptExpression[] se = new ScriptExpression[name.length];
    se[0] = new ScriptExpression("dataSetRow.AMOUNT");
    se[1] =
        new ScriptExpression(
            "var p=dataSetRow.AMOUNT+1;if( p >200 ){\"A large amount!\";  } else{ \"A small amount!\";}");
    se[2] = new ScriptExpression("row[\"testColumn1\"]+dataSetRow.AMOUNT");

    for (int i = 0; i < name.length; i++) queryDefn.addBinding(new Binding(name[i], se[i]));

    IResultIterator ri = executeQuery(queryDefn);
    while (ri.next()) {
      String str = "";
      for (int i = 0; i < name.length; i++) {
        str += ri.getValue(name[i]);

        if (i < name.length - 1) str += ", ";
      }
      testPrintln(str);
    }

    checkOutputFile();
  }
Exemplo n.º 3
0
  /**
   * Computed column on data set, without total
   *
   * @throws Exception
   */
  @Test
  public void testComputedOnDataSet() throws Exception {
    IComputedColumn cc = new ComputedColumn("AMOUNT2", "row.AMOUNT*2");
    this.dataSet.addComputedColumn(cc);

    QueryDefinition queryDefn = newReportQuery();

    // column mapping
    String[] name = new String[] {"testColumn1", "testColumn2", "AMOUNT1", "AMOUNT2"};
    ScriptExpression[] se = new ScriptExpression[name.length];
    se[0] = new ScriptExpression("dataSetRow.COUNTRY");
    se[1] = new ScriptExpression("dataSetRow.CITY");
    se[2] = new ScriptExpression("dataSetRow.AMOUNT");
    se[3] = new ScriptExpression("dataSetRow.AMOUNT2");
    for (int i = 0; i < name.length; i++) queryDefn.addBinding(new Binding(name[i], se[i]));

    IResultIterator ri = executeQuery(queryDefn);
    while (ri.next()) {
      String str = "";
      for (int i = 0; i < name.length; i++) {
        str += ri.getValue(name[i]);

        if (i < name.length - 1) str += ", ";
      }
      testPrintln(str);
    }

    checkOutputFile();
  }
Exemplo n.º 4
0
  /**
   * Sort on table
   *
   * @throws Exception
   */
  @Test
  public void testFilterOnTable() throws Exception {
    QueryDefinition queryDefn = newReportQuery();

    // column mapping
    String[] name = new String[] {"testColumn1", "testColumn2", "AMOUNT1"};
    ScriptExpression[] se = new ScriptExpression[name.length];
    se[0] = new ScriptExpression("dataSetRow.COUNTRY");
    se[1] = new ScriptExpression("dataSetRow.CITY");
    se[2] = new ScriptExpression("dataSetRow.AMOUNT");
    for (int i = 0; i < name.length; i++) queryDefn.addBinding(new Binding(name[i], se[i]));

    ScriptExpression filterExpr = new ScriptExpression("row.AMOUNT1>100");
    FilterDefinition filterDefn = new FilterDefinition(filterExpr);
    queryDefn.addFilter(filterDefn);

    IResultIterator ri = executeQuery(queryDefn);
    while (ri.next()) {
      String str = "";
      for (int i = 0; i < name.length; i++) {
        str += ri.getValue(name[i]);

        if (i < name.length - 1) str += ", ";
      }
      testPrintln(str);
    }
  }
Exemplo n.º 5
0
  /** @throws Exception */
  @Test
  public void testSpecialExpression() throws Exception {
    IComputedColumn cc = new ComputedColumn("AMOUNT2", "row.AMOUNT*2");
    this.dataSet.addComputedColumn(cc);

    QueryDefinition queryDefn = newReportQuery();

    // column mapping
    String[] name = new String[] {"testColumn1"};
    ScriptExpression[] se = new ScriptExpression[name.length];
    se[0] = new ScriptExpression("if ( 2<1 ){ true;  }else{ false;}");

    SortDefinition[] sortDefn = new SortDefinition[] {new SortDefinition()};
    sortDefn[0].setExpression("row.testColumn1");
    sortDefn[0].setSortDirection(ISortDefinition.SORT_DESC);

    for (int i = 0; i < name.length; i++) queryDefn.addBinding(new Binding(name[i], se[i]));
    for (int i = 0; i < sortDefn.length; i++) {
      queryDefn.addSort(sortDefn[i]);
    }

    IResultIterator ri = executeQuery(queryDefn);
    while (ri.next()) {
      String str = "";
      for (int i = 0; i < name.length; i++) {
        str += ri.getValue(name[i]);

        if (i < name.length - 1) str += ", ";
      }
      testPrintln(str);
    }

    checkOutputFile();
  }
Exemplo n.º 6
0
  /** @throws Exception */
  @Test
  public void testSpecialExpression2() throws Exception {
    QueryDefinition queryDefn = newReportQuery();

    // column mapping
    String[] name = new String[] {"AMOUNT", "testColumn1"};
    ScriptExpression[] se = new ScriptExpression[name.length];
    se[0] = new ScriptExpression("dataSetRow.AMOUNT");
    se[1] =
        new ScriptExpression(
            "if ( row.AMOUNT >200 ){ Total.runningSum(row.AMOUNT);  }else{ row.AMOUNT;}");

    for (int i = 0; i < name.length; i++) queryDefn.addBinding(new Binding(name[i], se[i]));

    IResultIterator ri = executeQuery(queryDefn);
    while (ri.next()) {
      String str = "";
      for (int i = 0; i < name.length; i++) {
        str += ri.getValue(name[i]);

        if (i < name.length - 1) str += ", ";
      }
      testPrintln(str);
    }

    checkOutputFile();
  }
Exemplo n.º 7
0
  /**
   * @param name
   * @param dataType
   * @param se
   * @throws BirtException
   */
  private void basicTestNoDataSet(String[] name, int[] dataType, ScriptExpression[] se)
      throws BirtException {
    DataEngine dataEngine =
        new DataEngineImpl(
            DataEngineContext.newInstance(DataEngineContext.DIRECT_PRESENTATION, null, null, null));
    QueryDefinition queryDefn = new QueryDefinition();

    for (int i = 0; i < name.length; i++) queryDefn.addBinding(new Binding(name[i], se[i]));

    IResultIterator ri = dataEngine.prepare(queryDefn).execute(null).getResultIterator();
    if (ri.next()) {
      String str = "";
      for (int i = 0; i < name.length; i++) {
        Object value = ri.getValue(name[i]);
        str += value;

        if (i < name.length - 1) str += ", ";

        if (dataType[i] == DataType.INTEGER_TYPE)
          assertTrue(value.getClass().equals(Integer.class));
        else if (dataType[i] == DataType.DOUBLE_TYPE)
          assertTrue(value.getClass().equals(Double.class));
        else if (dataType[i] == DataType.DATE_TYPE) assertTrue(value.getClass().equals(Date.class));
      }
      testPrintln(str);
    }
  }
Exemplo n.º 8
0
  /** @throws Exception */
  private void genBasic() throws Exception {
    expectedValue = new ArrayList();

    Context context = Context.enter();
    Scriptable scope = context.initStandardObjects();
    Context.exit();

    // ------------generation----------------
    QueryDefinition qd = newReportQuery();

    // prepare
    IBaseExpression[] rowBeArray = getRowExpr();
    IBinding[] totalBeArray = getAggrBinding();
    prepareExprNameAndQuery(rowBeArray, totalBeArray, qd);

    // generation
    IQueryResults qr = myGenDataEngine.prepare(qd).execute(scope);

    // important step
    queryResultID = qr.getID();

    IResultIterator ri = qr.getResultIterator();
    while (ri.next()) {
      for (int i = 0; i < rowBeArray.length; i++)
        expectedValue.add(ri.getValue(this.rowExprName[i]));

      for (int i = 0; i < totalBeArray.length; i++)
        expectedValue.add(ri.getValue(this.totalExprName[i]));
    }

    ri.close();
    qr.close();
    myGenDataEngine.shutdown();
  }
Exemplo n.º 9
0
  /** @throws Exception */
  @Test
  public void testBindingNameWithDoubleQuote() throws Exception {
    QueryDefinition queryDefn = newReportQuery();

    // column mapping
    String[] name = new String[] {"test\"Column1", "test\"Column2", "AMOUNT1"};
    ScriptExpression[] se = new ScriptExpression[name.length];
    se[0] = new ScriptExpression("dataSetRow.COUNTRY");
    se[1] = new ScriptExpression("row[\"test\\\"Column1\"]");
    se[2] = new ScriptExpression("dataSetRow.AMOUNT");
    for (int i = 0; i < name.length; i++) queryDefn.addBinding(new Binding(name[i], se[i]));

    IResultIterator ri = executeQuery(queryDefn);
    while (ri.next()) {
      String str = "";
      for (int i = 0; i < name.length; i++) {
        str += ri.getValue(name[i]);

        if (i < name.length - 1) str += ", ";
      }
      testPrintln(str);
    }

    checkOutputFile();
  }
Exemplo n.º 10
0
 /**
  * @return
  * @throws BirtException
  */
 private int getQueryResultCount() throws BirtException {
   QueryDefinition qd = newReportQuery();
   IQueryResults qr = dataEngine.prepare(qd, appContextMap).execute(null);
   IResultIterator resultIterator = qr.getResultIterator();
   int count = 0;
   while (resultIterator.next()) {
     count++;
   }
   qr.close();
   return count;
 }
Exemplo n.º 11
0
  /** @throws Exception */
  private void preDummy2() throws Exception {
    IQueryResults qr = myPreDataEngine.getQueryResults(queryResultID);
    assert (qr.getResultMetaData() != null);

    IResultIterator ri = qr.getResultIterator();
    assert (ri.getResultMetaData() != null);

    checkResult2(ri);

    ri.close();
    myPreDataEngine.shutdown();
  }
Exemplo n.º 12
0
  /**
   * @param ri
   * @throws BirtException
   */
  private void checkResult2(IResultIterator ri) throws BirtException {
    Iterator it = this.expectedValue.iterator();

    while (ri.next()) {
      String str = "";
      for (int i = 0; i < rowExprName.length; i++) {
        Object ob1 = it.next();
        Object ob2 = ri.getValue(this.rowExprName[i]);
        assertEquals(ob1, ob2);
        str += " " + ob2.toString();
      }

      IResultIterator ri2 = ri.getSecondaryIterator(subName, null);
      while (ri2.next()) {
        for (int i = 0; i < rowExprName.length; i++) {
          Object ob1 = it.next();
          Object ob2 = ri2.getValue(this.rowExprName[i]);
          assertEquals(ob1, ob2);
          str += " " + ob2.toString();
        }
      }

      if (totalExprName != null) {
        for (int i = 0; i < totalExprName.length; i++) {
          Object ob1 = it.next();
          Object ob2 = ri.getValue(this.totalExprName[i]);
          assertEquals(ob1, ob2);
          str += " " + ob2.toString();
        }
      }

      this.testPrintln("row result set: " + str);
    }
  }
Exemplo n.º 13
0
  /** @throws Exception */
  private void preSerializable() throws Exception {
    IQueryResults qr = myPreDataEngine.getQueryResults(queryResultID);

    IResultIterator ri = qr.getResultIterator();
    // Currently, org.eclipse.birt.data.engine.impl.document.ResultIterator#getResultMetaData() has
    // bug:
    // It returns meta data of data set instead of meta data of query
    // assertEquals( DataType.OBJECT_TYPE, ri.getResultMetaData( ).getColumnType( 1 ));
    int rowCount = 0;
    while (ri.next()) {
      assertTrue(ri.getValue("serializable") instanceof StringBuffer);
      assertEquals("ss", ri.getValue("serializable").toString());
      rowCount++;
    }
    assertTrue(rowCount > 0);
    ri.close();
    myPreDataEngine.shutdown();
  }
Exemplo n.º 14
0
  /**
   * Test the consistency of Data Type Info.
   *
   * @throws Exception
   */
  @Test
  public void testBasic1() throws Exception {
    QueryDefinition queryDefn = newReportQuery();

    // column mapping
    String[] name = new String[] {"AMOUNT1", "AMOUNT2"};
    ScriptExpression[] se = new ScriptExpression[name.length];
    se[0] = new ScriptExpression("dataSetRow.AMOUNT");
    se[0].setDataType(DataType.STRING_TYPE);
    se[1] = new ScriptExpression("row.AMOUNT1");
    se[1].setDataType(DataType.UNKNOWN_TYPE);
    for (int i = 0; i < name.length; i++) queryDefn.addBinding(new Binding(name[i], se[i]));

    IResultIterator ri = executeQuery(queryDefn);
    while (ri.next()) {
      assertTrue(ri.getValue("AMOUNT2") instanceof String);
    }
  }
Exemplo n.º 15
0
  /** @throws Exception */
  @Test
  public void testGroup() throws Exception {
    QueryDefinition queryDefn = newReportQuery();

    // column mapping
    String[] name = new String[] {"testColumn1", "testColumn2", "AMOUNT1"};
    ScriptExpression[] se = new ScriptExpression[name.length];
    se[0] = new ScriptExpression("dataSetRow.COUNTRY");
    se[1] = new ScriptExpression("dataSetRow.CITY");
    se[2] = new ScriptExpression("dataSetRow.AMOUNT");
    for (int i = 0; i < name.length; i++) queryDefn.addBinding(new Binding(name[i], se[i]));

    GroupDefinition groupDefn = new GroupDefinition("group1");
    groupDefn.setKeyColumn("testColumn1");
    String name2 = "testColumn3";
    ScriptExpression se2 = new ScriptExpression("Total.sum(dataSetRow.AMOUNT)");
    se2.setGroupName("group1");
    // groupDefn.addResultSetExpression( name2, new ColumnBindingExpression(se2) );
    queryDefn.addBinding(new Binding(name2, se2));
    queryDefn.addGroup(groupDefn);
    String name3 = "testColumn4";
    ScriptExpression se3 = new ScriptExpression("row[\"testColumn1\"]");
    GroupDefinition groupDefn1 = new GroupDefinition("group2");
    groupDefn1.setKeyColumn("testColumn4");
    se3.setGroupName("group2");
    // groupDefn1.addResultSetExpression( name3, new ColumnBindingExpression(se3) );
    queryDefn.addBinding(new Binding(name3, se3));
    queryDefn.addGroup(groupDefn1);

    IResultIterator ri = executeQuery(queryDefn);
    while (ri.next()) {
      String str = "";
      for (int i = 0; i < name.length; i++) {
        str += ri.getValue(name[i]);
        str += ", ";
      }
      str += ri.getValue(name2);

      testPrintln(str);
    }

    checkOutputFile();
  }
Exemplo n.º 16
0
  /** @throws Exception */
  @Test
  public void testInvalidBinding() throws Exception {
    QueryDefinition queryDefn = newReportQuery();

    // column mapping
    String[] name = new String[] {"testColumn1"};
    ScriptExpression[] se = new ScriptExpression[name.length];
    se[0] = new ScriptExpression("dataSetRow.COUNTRY");
    for (int i = 0; i < name.length; i++) queryDefn.addBinding(new Binding(name[i], se[i]));

    IResultIterator ri = executeQuery(queryDefn);
    if (ri.next()) {
      try {
        ri.getValue(name[0]);
      } catch (BirtException e) {
        assertTrue(e.getErrorCode() == ResourceConstants.INVALID_JS_EXPR);
      }
    }
    ri.close();
  }
Exemplo n.º 17
0
  /** @throws Exception */
  @Test
  public void testAutoBinding() throws Exception {
    QueryDefinition queryDefn = newReportQuery(true);
    this.dataSet.addComputedColumn(new ComputedColumn("COUN\"TRY", "row[\"COUNTRY\"]"));

    // column mapping
    String[] name = new String[] {"COUN\"TRY", "CITY", "AMOUNT"};

    IResultIterator ri = executeQuery(queryDefn);
    while (ri.next()) {
      String str = "";
      for (int i = 0; i < name.length; i++) {
        str += ri.getValue(name[i]);

        if (i < name.length - 1) str += ", ";
      }
      testPrintln(str);
    }
    ri.close();
    checkOutputFile();
  }
Exemplo n.º 18
0
  /**
   * Test Java Object data type
   *
   * @throws Exception
   */
  @Test
  public void testObjectTypeBasic() throws Exception {
    QueryDefinition queryDefn = newReportQuery();

    // column mapping
    String[] name =
        new String[] {
          "ObjectType",
        };
    ScriptExpression[] se = new ScriptExpression[name.length];
    se[0] = new ScriptExpression("new java.lang.StringBuffer(\"ss\")");
    se[0].setDataType(DataType.JAVA_OBJECT_TYPE);
    for (int i = 0; i < name.length; i++) queryDefn.addBinding(new Binding(name[i], se[i]));

    IResultIterator ri = executeQuery(queryDefn);
    assertEquals(DataType.JAVA_OBJECT_TYPE, ri.getResultMetaData().getColumnType(1));
    while (ri.next()) {
      assertTrue(ri.getValue("ObjectType") instanceof StringBuffer);
      assertEquals("ss", ri.getValue("ObjectType").toString());
    }
  }
Exemplo n.º 19
0
  /** @throws Exception */
  private void genSerializable() throws Exception {
    Context context = Context.enter();
    Scriptable scope = context.initStandardObjects();
    Context.exit();

    QueryDefinition queryDefn = newReportQuery();

    // column mapping
    String[] name = new String[] {"serializable"};
    ScriptExpression[] se = new ScriptExpression[name.length];
    se[0] = new ScriptExpression("new java.lang.StringBuffer(\"ss\")");
    se[0].setDataType(DataType.JAVA_OBJECT_TYPE);
    for (int i = 0; i < name.length; i++) queryDefn.addBinding(new Binding(name[i], se[i]));

    // generation
    IQueryResults qr = myGenDataEngine.prepare(queryDefn).execute(scope);

    // important step
    queryResultID = qr.getID();

    IResultIterator ri = qr.getResultIterator();
    assertEquals(DataType.JAVA_OBJECT_TYPE, ri.getResultMetaData().getColumnType(1));
    while (ri.next()) {
      assertTrue(ri.getValue("serializable") instanceof StringBuffer);
      assertEquals("ss", ri.getValue("serializable").toString());
    }

    ri.close();
    qr.close();
    myGenDataEngine.shutdown();
  }
Exemplo n.º 20
0
  /** @throws Exception */
  private void genDummy2() throws Exception {
    expectedValue = new ArrayList();

    Context context = Context.enter();
    Scriptable scope = context.initStandardObjects();
    Context.exit();

    // ------------generation----------------
    QueryDefinition qd = new QueryDefinition();

    // prepare
    IBaseExpression[] rowBeArray = getDummyRowExpr();
    prepareExprNameAndQuery(rowBeArray, null, qd);

    // prepare sub query
    SubqueryDefinition subQueryDefn = new SubqueryDefinition(subName, qd);
    qd.addSubquery(subQueryDefn);
    IBaseExpression[] rowBeArray2 = getDummyRowExpr();
    prepareExprNameAndQuery(rowBeArray2, null, subQueryDefn);

    // generation
    IQueryResults qr = myGenDataEngine.prepare(qd).execute(scope);

    // important step
    queryResultID = qr.getID();

    IResultIterator ri = qr.getResultIterator();
    while (ri.next()) {
      for (int i = 0; i < rowBeArray.length; i++)
        expectedValue.add(ri.getValue(this.rowExprName[i]));

      IResultIterator ri2 = ri.getSecondaryIterator(subName, scope);
      while (ri2.next()) {
        for (int i = 0; i < rowBeArray2.length; i++)
          expectedValue.add(ri2.getValue(this.rowExprName[i]));
      }
      ri2.close();
    }

    ri.close();
    qr.close();
    myGenDataEngine.shutdown();
  }
Exemplo n.º 21
0
  /** @throws Exception */
  private void genUnserializable() throws Exception {
    Context context = Context.enter();
    Scriptable scope = context.initStandardObjects();
    Context.exit();

    QueryDefinition queryDefn = newReportQuery();

    // column mapping
    String[] name = new String[] {"unserializable"};
    ScriptExpression[] se = new ScriptExpression[name.length];
    se[0] = new ScriptExpression("new java.lang.ThreadGroup(\"ss\")");
    se[0].setDataType(DataType.JAVA_OBJECT_TYPE);
    for (int i = 0; i < name.length; i++) queryDefn.addBinding(new Binding(name[i], se[i]));

    // generation
    IQueryResults qr = myGenDataEngine.prepare(queryDefn).execute(scope);

    // important step
    queryResultID = qr.getID();

    try {

      IResultIterator ri = qr.getResultIterator();
      assertEquals(DataType.JAVA_OBJECT_TYPE, ri.getResultMetaData().getColumnType(1));
      while (ri.next()) {
        assertTrue(ri.getValue("unserializable") instanceof ThreadGroup);
      }
      ri.close();
      assertTrue(false);
    } catch (Exception e) {
      // Currently, unserializable objects can't be saved in report doc
      e.printStackTrace();
    } finally {
      qr.close();
      myGenDataEngine.shutdown();
    }
  }
 public String getLabel(IResultIterator resultIterator) throws BirtException {
   if (labelColumnName == null && pattern == null) {
     return null;
   } else if (labelColumnName == null) {
     // if display text is not set, apply the formatter.
     String name = valueColumnName;
     Object value = getValue(resultIterator);
     return converter.format(value);
   } else {
     // if display text is set , DON'T apply the formatter.
     String name = labelColumnName;
     Object value = resultIterator.getValue(name);
     if (value != null) return value.toString();
     return null;
   }
 }
Exemplo n.º 23
0
  /** @throws Exception */
  @Test
  public void testNoDataSetWithSubQuery() throws Exception {
    // outer query without data set
    int[] dataType = new int[] {DataType.DATE_TYPE};
    String[] name = new String[] {"testColumn1"};

    IResultIterator ri2 = null;
    {
      ScriptExpression[] se =
          new ScriptExpression[] {
            new ScriptExpression("new Date()", dataType[0]),
          };

      QueryDefinition queryDefn = new QueryDefinition();
      for (int i = 0; i < name.length; i++) queryDefn.addBinding(new Binding(name[i], se[i]));

      // sub query
      String subQueryName = "TEST";
      SubqueryDefinition subQueryDefn = new SubqueryDefinition(subQueryName, queryDefn);
      for (int i = 0; i < name.length; i++)
        subQueryDefn.addBinding(
            new Binding(name[i], new ScriptExpression("row._outer." + name[i], dataType[i])));
      queryDefn.addSubquery(subQueryDefn);

      DataEngine myDataEngine =
          new DataEngineImpl(
              DataEngineContext.newInstance(
                  DataEngineContext.DIRECT_PRESENTATION, null, null, null));
      IResultIterator ri = myDataEngine.prepare(queryDefn).execute(null).getResultIterator();
      ri.next();
      ri2 = ri.getSecondaryIterator(subQueryName, null);
    }

    if (ri2.next()) {
      String str = "";
      for (int i = 0; i < name.length; i++) {
        Object value = ri2.getValue(name[i]);
        str += value;

        if (i < name.length - 1) str += ", ";

        if (dataType[0] == DataType.DATE_TYPE) assertTrue(value.getClass().equals(Date.class));
      }
      testPrintln(str);
    }
    ri2.close();
  }
Exemplo n.º 24
0
  /** @throws Exception */
  @Test
  public void testNoDataSetWithNestedQuery() throws Exception {
    // outer query without data set
    String[] name = new String[] {"testColumn1"};
    IQueryResults queryResult = null;

    {
      int[] dataType = new int[] {DataType.DATE_TYPE};
      ScriptExpression[] se =
          new ScriptExpression[] {
            new ScriptExpression("new Date()", dataType[0]),
          };

      DataEngine myDataEngine =
          new DataEngineImpl(
              DataEngineContext.newInstance(
                  DataEngineContext.DIRECT_PRESENTATION, null, null, null));
      QueryDefinition queryDefn = new QueryDefinition();

      for (int i = 0; i < name.length; i++) queryDefn.addBinding(new Binding(name[i], se[i]));

      IResultIterator ri = myDataEngine.prepare(queryDefn).execute(null).getResultIterator();
      queryResult = ri.getQueryResults();
    }

    // inner query with data set
    QueryDefinition queryDefn2 = this.newReportQuery();
    for (int i = 0; i < name.length; i++)
      queryDefn2.addBinding(new Binding(name[i], new ScriptExpression("row._outer." + name[i])));

    IResultIterator ri2 =
        this.dataEngine.prepare(queryDefn2).execute(queryResult, null).getResultIterator();
    if (ri2.next()) {
      String str = "";
      for (int i = 0; i < name.length; i++) {
        Object value = ri2.getValue(name[i]);
        str += value;

        if (i < name.length - 1) str += ", ";
      }
      testPrintln(str);
    }
    ri2.close();
  }
 public Object getValue(IResultIterator resultIterator) throws BirtException {
   Object value = resultIterator.getValue(valueColumnName);
   return EngineTask.convertParameterType(value, valueType);
 }