APISonar


com.gemstone.gemfire.cache.query.CacheUtils.log

> com > gemstone > gemfire > cache > query > CacheUtils > log
com APIs gemstone APIs gemfire APIs cache APIs query APIs CacheUtils APIs log APIs

Example 1
public void testIndexOfIndex() throws Exception{
    String array[] = { "abc", "def"};
    Query q = CacheUtils.getQueryService().newQuery("$1[0][0]");
    Object params[] = {array, new Integer(0)};
    Character result = (Character)q.execute(params);
    CacheUtils.log(Utils.printResult(result));
    if(result == null || result.charValue() != 'a')
      fail();
  }
Example 2
public void setUp() throws java.lang.Exception {
    CacheUtils.startCache();
    Region region = CacheUtils.createRegion("portfolios", Portfolio.class);
    for (int i = 0; i < 4; i++) {
      region.put("" + i, new Portfolio(i));
    }
    CacheUtils.log(region);
  }
Example 3
public Object runQuery(Object array, Object index) throws Exception{
    Query q = CacheUtils.getQueryService().newQuery("$1[$2]");
    Object params[] = {array, index};
    Object result = q.execute(params);
    CacheUtils.log(Utils.printResult(result));
    return result;
  }
Example 4
public void testBug33474() throws Exception {

    populateRegionsWithNumbers();
    // createIndexOnNumbers();

    QueryService qs;
    qs = cache.getQueryService();
    String queryStr = "SELECT DISTINCT * FROM /numbers num WHERE num.id1 >= -200";
    Query q = qs.newQuery(queryStr);
    SelectResults rs = (SelectResults) q.execute();
    CacheUtils
        .log("--------------------- Size of Result Set is: -------------------------"
            + rs.size());

  }// end of testGetQueryTimes
Example 5
public void testMiscSet() throws Exception {
    Query q = CacheUtils.getQueryService().newQuery(" $1 IN SET(1, 'a', $2, $3, $4, $5)");
    Object params[] = {null, new Integer(0), "str", null, new Object()};
    
    for(int i=1;i<params.length;i++){
      params[0] = params[i];
      Object result = q.execute(params);
      CacheUtils.log(Utils.printResult(result));
      if(!result.equals(Boolean.TRUE))
        fail("Failed for Mix set with IN operator");
    }
    
  }
Example 6
public void testNULL() throws Exception {
    Query q = CacheUtils.getQueryService().newQuery(" null IN SET('x','y','z')");
    Object result = q.execute();
    CacheUtils.log(Utils.printResult(result));
    if(!result.equals(Boolean.FALSE))
      fail("Failed for NULL in IN operator Test");
    
    q = CacheUtils.getQueryService().newQuery(" null IN SET(null)");
    result = q.execute();
    CacheUtils.log(Utils.printResult(result));
    if(!result.equals(Boolean.TRUE))
      fail("Failed for NULL in IN operator Test");
    
  }
Example 7
private void printoutResults(SelectResults results) {
    Iterator iterator = results.iterator();
    while (iterator.hasNext()) {
      Portfolio p = (Portfolio) iterator.next();
      CacheUtils.log("->" + p + ";" + p.createDate);
    }
  }
Example 8
public void testIndexCreationOnRegionEntry() throws Exception {
        // Task ID : ICM11
        QueryService qs;
        qs = CacheUtils.getQueryService();
        try{
            Index i1 = qs.createIndex("r1Index", IndexType.FUNCTIONAL, "secId","/portfolios.values['1'].positions.values");
            qs.createIndex("r12Index", IndexType.FUNCTIONAL, "secId","/portfolios['1'].positions.values");
            CacheUtils.log(((CompactRangeIndex)i1).dump());
            //CacheUtils.log(((RangeIndex)i2).dump());
        } catch (Exception e) {
            e.printStackTrace();
            fail();
        }
        
    }
Example 9
private void putData(int id, Region region) throws ParseException {
    Portfolio obj = new Portfolio(id);
    obj.createDate = getCreateDate(id);
    region.put(id, obj);
    region.put(id + numElem, obj);
    CacheUtils.log("Added object " + obj.createDate);
  }
Example 10
public void testAsynchronousIndexCreatedOnRoot_PortfoliosRegion() {
    Region root = cache.getRegion("/root/portfolios");
    IndexManager im = IndexUtils.getIndexManager(root, true);
    Collection coll = im.getIndexes();
    if (coll.size() > 0) {
      Assert.assertTrue(true);
      CacheUtils.log("List of indexes= " + im.toString());
      RegionAttributes ra = root.getAttributes();
      Assert.assertTrue(!ra.getIndexMaintenanceSynchronous());
    } else
      Assert
          .fail("DeclarativeIndexCreationJUnitTest::testAsynchronousIndexCreatedOnRoot_PortfoliosRegion:No index found in the root region");
  }
Example 11
private void createIndexOnNumbers() throws Exception {
    CacheUtils
        .log("--------------------- Creating Indices -------------------------");
    QueryService qs;
    qs = cache.getQueryService();
    qs.createIndex("id", IndexType.FUNCTIONAL, "num.id", "/numbers num");
    qs.createIndex("id1", IndexType.FUNCTIONAL, "num.id1", "/numbers num");
    qs.createIndex("avg", IndexType.FUNCTIONAL, "num.max1", "/numbers num");
    qs.createIndex("l", IndexType.FUNCTIONAL, "num.l", "/numbers num");
    CacheUtils
        .log("--------------------- Index Creation Done -------------------------");
  }// end of createIndex
Example 12
private void createLocalRegion() {
    Cache cache = CacheUtils.getCache();
    AttributesFactory attributesFactory = new AttributesFactory();
    attributesFactory.setDataPolicy(DataPolicy.NORMAL);
    RegionAttributes regionAttributes = attributesFactory.create();
    Region region = cache.createRegion(regionName, regionAttributes);

    for(int i=1; i<=numElem; i++) {
      Portfolio obj = new Portfolio(i);
      region.put(i, obj);
      CacheUtils.log(obj);
    }
  }
Example 13
public void _test002UpdateEntry() throws Exception {
    IndexStatistics stats = index.getStatistics();
    CacheUtils.log(((CompactRangeIndex) index).dump());
    Portfolio p = (Portfolio) region.get("4");
    p.status = "inactive";
    region.put("4", p);
    assertEquals(5, stats.getNumberOfValues());
    //Set results = new HashSet();
    //index.query("active", OQLLexerTokenTypes.TOK_EQ, results,new ExecutionContext(null, CacheUtils.getCache()));
    SelectResults results = region.query("status = 'active'");
    assertEquals(2, results.size());
  }
Example 14
private void checkSelectResultTypes(SelectResults r1, SelectResults r2, String query) {
    ObjectType type1, type2;
    type1 = r1.getCollectionType().getElementType();
    type2 = r2.getCollectionType().getElementType();
    if (!(type1.getClass().getName()).equals(type2.getClass().getName())) {
      CacheUtils.log("Classes are : " + type1.getClass().getName() + " " + type2.getClass().getName());
      fail("FAILED:Select result Type is different in both the cases." + "; failed query=" + query);
    }
  }