public void testUntyped() throws QueryException {
    // one untyped iterator is now resolved fine
    Query q = this.qs.newQuery("SELECT DISTINCT * " + "FROM /pos " + "WHERE ID = 3 ");
    q.execute();

    // if there are two untyped iterators, then it's a problem, see bug 32251 and BugTest
    q = this.qs.newQuery("SELECT DISTINCT * FROM /pos, positions WHERE ID = 3");
    try {
      q.execute();
      fail("Expected a TypeMismatchException");
    } catch (TypeMismatchException e) {
      // pass
    }
  }
  public void testTyped() throws QueryException {
    Query q =
        this.qs.newQuery( // must quote "query" because it is a reserved word
            "IMPORT com.gemstone.gemfire.cache.\"query\".data.Portfolio;\n"
                + "SELECT DISTINCT *\n"
                + "FROM /pos TYPE Portfolio\n"
                + "WHERE ID = 3  ");
    Object r = q.execute();
    CacheUtils.getLogger().fine(Utils.printResult(r));

    q =
        this.qs.newQuery( // must quote "query" because it is a reserved word
            "IMPORT com.gemstone.gemfire.cache.\"query\".data.Portfolio;\n"
                + "SELECT DISTINCT *\n"
                + "FROM /pos ptfo TYPE Portfolio\n"
                + "WHERE ID = 3  ");
    r = q.execute();
    CacheUtils.getLogger().fine(Utils.printResult(r));
  }
  public void testTypeCasted() throws QueryException {
    Query q =
        this.qs.newQuery( // must quote "query" because it is a reserved word
            "IMPORT com.gemstone.gemfire.cache.\"query\".data.Portfolio;\n"
                + "SELECT DISTINCT *\n"
                + "FROM (collection<Portfolio>)/pos\n"
                + "WHERE ID = 3  ");
    //
    // com.gemstone.gemfire.internal.util.DebuggerSupport.waitForJavaDebugger(this.cache.getLogger());
    Object r = q.execute();
    CacheUtils.getLogger().fine(Utils.printResult(r));

    q =
        this.qs.newQuery( // must quote "query" because it is a reserved word
            "IMPORT com.gemstone.gemfire.cache.\"query\".data.Position;\n"
                + "SELECT DISTINCT *\n"
                + "FROM /pos p, (collection<Position>)p.positions.values\n"
                + "WHERE secId = 'IBM'");
    //
    // com.gemstone.gemfire.internal.util.DebuggerSupport.waitForJavaDebugger(this.cache.getLogger());
    r = q.execute();
    CacheUtils.getLogger().fine(Utils.printResult(r));
  }