Search in sources :

Example 36 with TypeMismatchException

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

the class PartitionedRegionQueryDUnitTest method testReevaluationDueToUpdateInProgress.

@Test
public void testReevaluationDueToUpdateInProgress() {
    Host host = Host.getHost(0);
    VM vm0 = host.getVM(0);
    VM vm1 = host.getVM(1);
    // VM vm2 = host.getVM(2);
    createPR(vm0);
    createPR(vm1);
    createIndex(vm0, "compactRangeIndex", "entry.value", "/region.entrySet entry");
    // Do Puts
    vm0.invoke(new SerializableRunnable("putting data") {

        public void run() {
            Cache cache = getCache();
            Region region = cache.getRegion("region");
            for (int i = 0; i < 100; i++) {
                region.put(i, new TestObject(i));
            }
        }
    });
    vm0.invoke(new SerializableRunnable("resetting sqt") {

        public void run() {
            IndexManager.setIndexBufferTime(Long.MAX_VALUE, Long.MAX_VALUE);
        }
    });
    vm1.invoke(new SerializableRunnable("resetting sqt") {

        public void run() {
            IndexManager.setIndexBufferTime(Long.MAX_VALUE, Long.MAX_VALUE);
        }
    });
    vm0.invoke(new SerializableRunnable("query") {

        public void run() {
            try {
                QueryService qs = getCache().getQueryService();
                qs.newQuery("SELECT DISTINCT entry.key, entry.value FROM /region.entrySet entry WHERE entry.value.score >= 5 AND entry.value.score <= 10 ORDER BY value asc").execute();
            } catch (QueryInvocationTargetException e) {
                e.printStackTrace();
                fail(e.toString());
            } catch (NameResolutionException e) {
                fail(e.toString());
            } catch (TypeMismatchException e) {
                fail(e.toString());
            } catch (FunctionDomainException e) {
                fail(e.toString());
            }
        }
    });
}
Also used : QueryService(org.apache.geode.cache.query.QueryService) FunctionDomainException(org.apache.geode.cache.query.FunctionDomainException) VM(org.apache.geode.test.dunit.VM) TypeMismatchException(org.apache.geode.cache.query.TypeMismatchException) SerializableRunnable(org.apache.geode.test.dunit.SerializableRunnable) CacheSerializableRunnable(org.apache.geode.cache30.CacheSerializableRunnable) Region(org.apache.geode.cache.Region) QueryInvocationTargetException(org.apache.geode.cache.query.QueryInvocationTargetException) Host(org.apache.geode.test.dunit.Host) NameResolutionException(org.apache.geode.cache.query.NameResolutionException) Cache(org.apache.geode.cache.Cache) ClientCache(org.apache.geode.cache.client.ClientCache) DistributedTest(org.apache.geode.test.junit.categories.DistributedTest) Test(org.junit.Test)

Aggregations

TypeMismatchException (org.apache.geode.cache.query.TypeMismatchException)36 NameResolutionException (org.apache.geode.cache.query.NameResolutionException)17 FunctionDomainException (org.apache.geode.cache.query.FunctionDomainException)16 QueryInvocationTargetException (org.apache.geode.cache.query.QueryInvocationTargetException)16 SelectResults (org.apache.geode.cache.query.SelectResults)15 Query (org.apache.geode.cache.query.Query)12 Iterator (java.util.Iterator)11 ArrayList (java.util.ArrayList)9 QueryService (org.apache.geode.cache.query.QueryService)9 DefaultQuery (org.apache.geode.cache.query.internal.DefaultQuery)9 Collection (java.util.Collection)7 List (java.util.List)6 QueryException (org.apache.geode.cache.query.QueryException)6 CacheSerializableRunnable (org.apache.geode.cache30.CacheSerializableRunnable)6 Host (org.apache.geode.test.dunit.Host)6 VM (org.apache.geode.test.dunit.VM)6 Map (java.util.Map)5 QueryExecutionTimeoutException (org.apache.geode.cache.query.QueryExecutionTimeoutException)5 ObjectType (org.apache.geode.cache.query.types.ObjectType)5 HashSet (java.util.HashSet)4