Search in sources :

Example 11 with CacheSerializableRunnable

use of org.apache.geode.cache30.CacheSerializableRunnable in project geode by apache.

the class HashIndexDUnitTest method doQuery.

public void doQuery() throws Exception {
    final String[] qarr = { "173", "174", "176", "180" };
    vm0.invokeAsync(new CacheSerializableRunnable("Executing query") {

        public void run2() throws CacheException {
            try {
                for (int i = 0; i < 50; i++) {
                    utils.executeQueries(qarr);
                }
            } catch (Exception e) {
                throw new CacheException(e) {
                };
            }
        }
    });
}
Also used : CacheSerializableRunnable(org.apache.geode.cache30.CacheSerializableRunnable) CacheException(org.apache.geode.cache.CacheException) CacheException(org.apache.geode.cache.CacheException)

Example 12 with CacheSerializableRunnable

use of org.apache.geode.cache30.CacheSerializableRunnable in project geode by apache.

the class CompiledInDUnitTest method whenUsingAccessorASingleEnumBindParameterIsUsedWithInQueryAndMapIndexIsPresentInPartitionRegionReturnCorrectResults.

@Test
public void whenUsingAccessorASingleEnumBindParameterIsUsedWithInQueryAndMapIndexIsPresentInPartitionRegionReturnCorrectResults() throws CacheException {
    final int numberOfEntries = 10;
    final int numExpectedResults = numberOfEntries / 2;
    final String queryString = "select * from " + regName + " where getMapField['1'] in SET ($1)";
    vm0.invoke(new CacheSerializableRunnable("Create Bridge Server") {

        public void run2() throws CacheException {
            configAndStartBridgeServer();
            createPartitionRegion(false);
            createIndex("myIndex", "ts.getMapField[*]", regName + " ts");
            createEntries(numberOfEntries, regionName);
        }
    });
    Object[] bindArguments = new Object[] { DayEnum.MONDAY };
    vm1.invoke(executeQueryWithAccessor(numExpectedResults, queryString, bindArguments));
}
Also used : CacheSerializableRunnable(org.apache.geode.cache30.CacheSerializableRunnable) CacheException(org.apache.geode.cache.CacheException) FlakyTest(org.apache.geode.test.junit.categories.FlakyTest) Test(org.junit.Test) DistributedTest(org.apache.geode.test.junit.categories.DistributedTest)

Example 13 with CacheSerializableRunnable

use of org.apache.geode.cache30.CacheSerializableRunnable in project geode by apache.

the class CompiledInDUnitTest method whenEnumBindArgumentIsMatchedInSetWithMultipleIteratingFieldShouldReturnResults.

@Test
public void whenEnumBindArgumentIsMatchedInSetWithMultipleIteratingFieldShouldReturnResults() throws CacheException {
    final int numberOfEntries = 10;
    final int numExpectedResults = numberOfEntries / 2;
    final String queryString = "select * from " + regName + " where $1 in SET (getMapField['1'], getMapField['0'])";
    vm0.invoke(new CacheSerializableRunnable("Create Bridge Server") {

        public void run2() throws CacheException {
            configAndStartBridgeServer();
            createReplicateRegion();
            createIndex("myIndex", "ts.getMapField[*]", regName + " ts");
            createEntries(numberOfEntries, regionName);
        }
    });
    Object[] bindArguments = new Object[] { DayEnum.TUESDAY };
    vm1.invoke(executeQueryWithIndexOnReplicateRegion(numExpectedResults, queryString, bindArguments, "myIndex", "ts.getMapField[*]", regName + " ts"));
}
Also used : CacheSerializableRunnable(org.apache.geode.cache30.CacheSerializableRunnable) CacheException(org.apache.geode.cache.CacheException) FlakyTest(org.apache.geode.test.junit.categories.FlakyTest) Test(org.junit.Test) DistributedTest(org.apache.geode.test.junit.categories.DistributedTest)

Example 14 with CacheSerializableRunnable

use of org.apache.geode.cache30.CacheSerializableRunnable in project geode by apache.

the class CompiledInDUnitTest method whenMultipleEnumBindParametersAreUsedWithInQueryAndMapIndexIsPresentInPartitionRegionReturnCorrectResults.

@Test
public void whenMultipleEnumBindParametersAreUsedWithInQueryAndMapIndexIsPresentInPartitionRegionReturnCorrectResults() throws CacheException {
    final int numberOfEntries = 10;
    final int numExpectedResults = numberOfEntries / 2;
    final String queryString = "select * from " + regName + " where getMapField['1'] in SET ($1,$2)";
    vm0.invoke(new CacheSerializableRunnable("Create Bridge Server") {

        public void run2() throws CacheException {
            configAndStartBridgeServer();
            createPartitionRegion(false);
            createIndex("myIndex", "ts.getMapField[*]", regName + " ts");
            createEntries(numberOfEntries, regionName);
        }
    });
    Object[] bindArguments = new Object[] { DayEnum.MONDAY, DayEnum.TUESDAY };
    vm1.invoke(executeQueryOnPartitionRegion(numExpectedResults, queryString, bindArguments));
}
Also used : CacheSerializableRunnable(org.apache.geode.cache30.CacheSerializableRunnable) CacheException(org.apache.geode.cache.CacheException) FlakyTest(org.apache.geode.test.junit.categories.FlakyTest) Test(org.junit.Test) DistributedTest(org.apache.geode.test.junit.categories.DistributedTest)

Example 15 with CacheSerializableRunnable

use of org.apache.geode.cache30.CacheSerializableRunnable in project geode by apache.

the class CompiledInDUnitTest method whenInSetCollectionContainsNonUniqueValuesMatchingSetShouldNotBeDuplicated.

// GEODE-1765
@Category(FlakyTest.class)
@Test
public void whenInSetCollectionContainsNonUniqueValuesMatchingSetShouldNotBeDuplicated() throws CacheException {
    final int numberOfEntries = 10;
    final int numExpectedResults = numberOfEntries / 2;
    final String queryString = "select * from " + regName + " where getMapField['1'] in SET($1, $1, $1)";
    vm0.invoke(new CacheSerializableRunnable("Create Bridge Server") {

        public void run2() throws CacheException {
            configAndStartBridgeServer();
            createReplicateRegion();
            createIndex("myIndex", "ts.getMapField[*]", regName + " ts");
            createEntries(numberOfEntries, regionName);
        }
    });
    Object[] bindArguments = new Object[] { DayEnum.MONDAY, DayEnum.TUESDAY, DayEnum.WEDNESDAY };
    vm1.invoke(executeQueryWithIndexOnReplicateRegion(numExpectedResults, queryString, bindArguments, "myIndex", "ts.getMapField[*]", regName + " ts"));
}
Also used : CacheSerializableRunnable(org.apache.geode.cache30.CacheSerializableRunnable) CacheException(org.apache.geode.cache.CacheException) Category(org.junit.experimental.categories.Category) FlakyTest(org.apache.geode.test.junit.categories.FlakyTest) Test(org.junit.Test) DistributedTest(org.apache.geode.test.junit.categories.DistributedTest)

Aggregations

CacheSerializableRunnable (org.apache.geode.cache30.CacheSerializableRunnable)595 CacheException (org.apache.geode.cache.CacheException)415 DistributedTest (org.apache.geode.test.junit.categories.DistributedTest)369 Test (org.junit.Test)369 Region (org.apache.geode.cache.Region)307 VM (org.apache.geode.test.dunit.VM)279 Host (org.apache.geode.test.dunit.Host)274 SerializableRunnable (org.apache.geode.test.dunit.SerializableRunnable)179 FlakyTest (org.apache.geode.test.junit.categories.FlakyTest)165 AttributesFactory (org.apache.geode.cache.AttributesFactory)145 IOException (java.io.IOException)135 Cache (org.apache.geode.cache.Cache)124 QueryService (org.apache.geode.cache.query.QueryService)118 PartitionAttributesFactory (org.apache.geode.cache.PartitionAttributesFactory)107 LocalRegion (org.apache.geode.internal.cache.LocalRegion)106 SelectResults (org.apache.geode.cache.query.SelectResults)85 PartitionedRegion (org.apache.geode.internal.cache.PartitionedRegion)75 ClientServerTest (org.apache.geode.test.junit.categories.ClientServerTest)71 IgnoredException (org.apache.geode.test.dunit.IgnoredException)65 ClientSubscriptionTest (org.apache.geode.test.junit.categories.ClientSubscriptionTest)61