APISonar


org.apache.geode.cache.query.CacheUtils.log

> org > apache > geode > cache > query > CacheUtils > log
org APIs apache APIs geode APIs cache APIs query APIs CacheUtils APIs log APIs

Example 1
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 2
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 3
private void printoutResults(SelectResults results) {
    Iterator iterator = results.iterator();
    while (iterator.hasNext()) {
      Portfolio p = (Portfolio) iterator.next();
      CacheUtils.log("->" + p + ";" + p.createDate);
    }
  }
Example 4
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 5
public void testIMQFailureAsMethodKeysNAInDummyQRegion() throws Exception {
    QueryService qs;
    qs = CacheUtils.getQueryService();
    Index i1 =
        qs.createIndex("keyIndex", IndexType.FUNCTIONAL, "ks.hashCode", "/portfolios.keys() ks");
    Region rgn = CacheUtils.getRegion("/portfolios");
    rgn.put("4", new Portfolio(4));
    rgn.put("5", new Portfolio(5));
    CacheUtils.log(((CompactRangeIndex) i1).dump());

    Query qr = qs.newQuery(
        "Select distinct keys.hashCode  from /portfolios.keys() keys where keys.hashCode >= $1");
    SelectResults sr = (SelectResults) qr.execute(new Object[] {new Integer(-1)});
    assertEquals(6, sr.size());
  }
Example 6
public void testIndexCreationWithFunctions() throws Exception {
    // Task ID : ICM14
    QueryService qs;
    qs = CacheUtils.getQueryService();
    Index i1 = qs.createIndex("SetSecIDIndex1", IndexType.FUNCTIONAL, "b.secId",
        "/portfolios.asSet pf, pf.positions.values b");
    Index i2 = qs.createIndex("ListSecIDIndex2", IndexType.FUNCTIONAL, "b.secId",
        "/portfolios.asList pf, pf.positions.values b");
    Index i3 = qs.createIndex("ArraySecIDIndex3", IndexType.FUNCTIONAL, "b.secId",
        "/portfolios.toArray pf, pf.positions.values b");
    CacheUtils.log(((RangeIndex) i1).dump());
    CacheUtils.log(((RangeIndex) i2).dump());
    CacheUtils.log(((RangeIndex) i3).dump());
  }
Example 7
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 8
public void testSynchronousIndexCreatedOnRootRegion() {
    Region root = cache.getRegion("/root");
    IndexManager im = IndexUtils.getIndexManager((InternalCache) cache, root, true);
    Collection coll = im.getIndexes();
    if (coll.size() > 0) {
      assertTrue(true);
      CacheUtils.log("List of indexes= " + im.toString());
      RegionAttributes ra = root.getAttributes();
      assertTrue(ra.getIndexMaintenanceSynchronous());
    } else
      fail(
          "DeclarativeIndexCreationJUnitTest::testAsynchronousIndexCreatedOnRoot_PortfoliosRegion:No index found in the root region");
  }
Example 9
private void createReplicatedRegion() {
    Cache cache = CacheUtils.getCache();
    AttributesFactory attributesFactory = new AttributesFactory();
    attributesFactory.setDataPolicy(DataPolicy.REPLICATE);
    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 10
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 11
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);
    }
  }