use of org.apache.geode.cache.CacheException in project geode by apache.
the class DistributedTXRegionStub method putEntry.
public boolean putEntry(EntryEventImpl event, boolean ifNew, boolean ifOld, Object expectedOldValue, boolean requireOldValue, long lastModified, boolean overwriteDestroyed) {
boolean retVal = false;
final LocalRegion r = event.getLocalRegion();
try {
RemotePutResponse response = RemotePutMessage.txSend(state.getTarget(), r, event, lastModified, ifNew, ifOld, expectedOldValue, requireOldValue);
PutResult result = response.waitForResult();
event.setOldValue(result.oldValue, true);
retVal = result.returnValue;
} catch (TransactionDataNotColocatedException enfe) {
throw enfe;
} catch (CacheException ce) {
throw new PartitionedRegionException(LocalizedStrings.PartitionedRegion_DESTROY_OF_ENTRY_ON_0_FAILED.toLocalizedString(state.getTarget()), ce);
} catch (RegionDestroyedException rde) {
throw new TransactionDataNotColocatedException(LocalizedStrings.RemoteMessage_REGION_0_NOT_COLOCATED_WITH_TRANSACTION.toLocalizedString(rde.getRegionFullPath()), rde);
} catch (RemoteOperationException roe) {
throw new TransactionDataNodeHasDepartedException(roe);
}
return retVal;
}
use of org.apache.geode.cache.CacheException 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.cache.CacheException 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.cache.CacheException 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.cache.CacheException 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"));
}
Aggregations