use of org.apache.geode.cache30.CacheSerializableRunnable in project geode by apache.
the class CompiledInDUnitTest method whenMultipleTypeBindParameterIsUsedWithInQueryAndMapIndexIsPresentInPartitionRegionReturnCorrectResults.
@Test
public void whenMultipleTypeBindParameterIsUsedWithInQueryAndMapIndexIsPresentInPartitionRegionReturnCorrectResults() throws CacheException {
final int numberOfEntries = 10;
final int numExpectedResults = numberOfEntries / 2;
final String queryString = "select * from " + regName + " where getMapField['1'] in SET ($1,$2,$3)";
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[] { 2, DayEnum.MONDAY, "Tuesday" };
vm1.invoke(executeQueryOnPartitionRegion(numExpectedResults, queryString, bindArguments));
}
use of org.apache.geode.cache30.CacheSerializableRunnable in project geode by apache.
the class CompiledInDUnitTest method whenASingleEnumBindParameterIsUsedWithInQueryInPartitionRegionReturnCorrectResults.
@Test
public void whenASingleEnumBindParameterIsUsedWithInQueryInPartitionRegionReturnCorrectResults() 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);
createEntries(numberOfEntries, regionName);
}
});
Object[] bindArguments = new Object[] { DayEnum.MONDAY };
vm1.invoke(executeQueryOnPartitionRegion(numExpectedResults, queryString, bindArguments));
}
use of org.apache.geode.cache30.CacheSerializableRunnable in project geode by apache.
the class CompiledInDUnitTest method whenUsingAccessorASingleEnumBindParameterIsUsedWithInQueryInPartitionRegionReturnCorrectResults.
@Test
public void whenUsingAccessorASingleEnumBindParameterIsUsedWithInQueryInPartitionRegionReturnCorrectResults() 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);
createEntries(numberOfEntries, regionName);
}
});
Object[] bindArguments = new Object[] { DayEnum.MONDAY };
vm1.invoke(executeQueryWithAccessor(numExpectedResults, queryString, bindArguments));
}
use of org.apache.geode.cache30.CacheSerializableRunnable in project geode by apache.
the class CompiledInDUnitTest method whenANDConditionWithInSetFiltersOutAllFieldsReturnNoResults.
@Test
public void whenANDConditionWithInSetFiltersOutAllFieldsReturnNoResults() throws CacheException {
final int numberOfEntries = 10;
final int numExpectedResults = 0;
final String queryString = "select * from " + regName + " where getMapField['1'] in SET ($1, $2) AND getMapField['1'] in SET($3)";
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"));
}
use of org.apache.geode.cache30.CacheSerializableRunnable in project geode by apache.
the class CompiledInDUnitTest method whenANDConditionWithInSetMatchesReturnResults.
@Test
public void whenANDConditionWithInSetMatchesReturnResults() throws CacheException {
final int numberOfEntries = 10;
final int numExpectedResults = 5;
final String queryString = "select * from " + regName + " where getMapField['1'] in SET ($1, $2) AND getMapField['2'] in SET($3)";
vm0.invoke(new CacheSerializableRunnable("Create Bridge Server") {
public void run2() throws CacheException {
configAndStartBridgeServer();
createReplicateRegion();
createIndex("myIndex", "ts.getMapField[*]", regName + " ts");
HashMap entries = new HashMap();
IntStream.range(0, 10).forEach(i -> {
MapTestObject object = new MapTestObject(i);
object.getMapField().put("2", DayEnum.WEDNESDAY);
entries.put("key" + i, object);
});
createEntries(regionName, entries.entrySet().iterator());
}
});
Object[] bindArguments = new Object[] { DayEnum.MONDAY, DayEnum.TUESDAY, DayEnum.WEDNESDAY };
vm1.invoke(executeQueryWithIndexOnReplicateRegion(numExpectedResults, queryString, bindArguments, "myIndex", "ts.getMapField[*]", regName + " ts"));
}
Aggregations