Search in sources :

Example 36 with CqAttributesFactory

use of org.apache.geode.cache.query.CqAttributesFactory in project geode by apache.

the class ClientCommandsDUnitTest method setupCqsOnVM.

private void setupCqsOnVM(VM vm) {
    vm.invoke("setup CQs", () -> {
        Cache cache = GemFireCacheImpl.getInstance();
        QueryService qs = cache.getQueryService();
        CqAttributesFactory cqAf = new CqAttributesFactory();
        try {
            qs.newCq(cq1, "select * from /" + regionName, cqAf.create(), true).execute();
            qs.newCq(cq2, "select * from /" + regionName + " where id = 1", cqAf.create(), true).execute();
            qs.newCq(cq3, "select * from /" + regionName + " where id > 2", cqAf.create(), true).execute();
            cache.getLogger().info("setupCqs on vm created cqs = " + cache.getQueryService().getCqs().length);
        } catch (Exception e) {
            cache.getLogger().info("setupCqs on vm Exception " + CliUtil.stackTraceAsString(e));
        }
        return true;
    });
}
Also used : QueryService(org.apache.geode.cache.query.QueryService) CqAttributesFactory(org.apache.geode.cache.query.CqAttributesFactory)

Aggregations

CqAttributesFactory (org.apache.geode.cache.query.CqAttributesFactory)36 CqAttributes (org.apache.geode.cache.query.CqAttributes)31 CqQuery (org.apache.geode.cache.query.CqQuery)30 QueryService (org.apache.geode.cache.query.QueryService)29 CacheException (org.apache.geode.cache.CacheException)16 Test (org.junit.Test)16 CacheSerializableRunnable (org.apache.geode.cache30.CacheSerializableRunnable)15 DistributedTest (org.apache.geode.test.junit.categories.DistributedTest)15 Region (org.apache.geode.cache.Region)11 CqEvent (org.apache.geode.cache.query.CqEvent)11 CqExistsException (org.apache.geode.cache.query.CqExistsException)10 CqListener (org.apache.geode.cache.query.CqListener)10 RegionNotFoundException (org.apache.geode.cache.query.RegionNotFoundException)8 Host (org.apache.geode.test.dunit.Host)8 VM (org.apache.geode.test.dunit.VM)8 IOException (java.io.IOException)7 CqException (org.apache.geode.cache.query.CqException)7 SelectResults (org.apache.geode.cache.query.SelectResults)7 DefaultQueryService (org.apache.geode.cache.query.internal.DefaultQueryService)7 ClientSubscriptionTest (org.apache.geode.test.junit.categories.ClientSubscriptionTest)7