@Test
  public void testRegionNames() {
    String[] queryStrs =
        new String[] {"SELECT * FROM " + SEPARATOR + "pos",
            "SELECT * FROM " + SEPARATOR + "pos where status='active'"};

    CacheUtils.startCache();
    cache = CacheUtils.getCache();
    AttributesFactory attributesFactory = new AttributesFactory();
    attributesFactory.setValueConstraint(Portfolio.class);
    RegionAttributes regionAttributes = attributesFactory.create();

    cache.createRegion("p_os", regionAttributes);
    cache.createRegion("p-os", regionAttributes);

    for (final String queryStr : queryStrs) {
      Query q = CacheUtils.getQueryService().newQuery(queryStr);
      try {
        q.execute();
      } catch (Exception ex) {
        // Failed - Any other exception.
        fail("Failed to execute the query. '" + queryStr + "' Error: " + ex.getMessage());
      }
    }
  }
RegionJUnitTest.java

Created on January 31, 2005, 3:54 PM
geode-core/src/integrationTest/java/org/apache/geode/cache/query/RegionJUnitTest.java