FunctionService.registerFunction(function); Execution dataSet = FunctionService.onRegion(region); ResultCollector rc1 = execute(dataSet, singleKeySet, Boolean.TRUE, function, isByName); List l = null; assertEquals(1, l.size()); ResultCollector rc2 = execute(dataSet, singleKeySet, new HashSet( singleKeySet), function, isByName); List l2 = null;
Execution dataSet = FunctionService.onRegion(region); try { execute(dataSet, testKeysSet, Boolean.TRUE, function, isByName); ResultCollector rs = execute(dataSet, testKeysSet, Boolean.TRUE, function, isByName); assertEquals(Boolean.TRUE, ((List)rs.getResult()).get(0)); ResultCollector rs2 = execute(dataSet, testKeysSet, testKey, function, isByName); assertEquals(new Integer(1), ((List)rs2.getResult()).get(0)); putData.put(testKey + "2", new Integer(3)); ResultCollector rs1 = execute(dataSet, testKeysSet, putData, function, isByName); assertEquals(Boolean.TRUE, ((List)rs1.getResult()).get(0));
ResultCollector rc1 = execute(dataSet, testKeysSet, Boolean.TRUE, function, isByName); l = ((List)rc1.getResult());
public static void serverSingleKeyExecution_FunctionInvocationTargetException() { Region region = cache.getRegion(PartitionedRegionName); assertNotNull(region); final String testKey = "execKey"; final Set testKeysSet = new HashSet(); testKeysSet.add(testKey); DistributedSystem.setThreadsSocketPolicy(false); Function function = new TestFunction(true, TestFunction.TEST_FUNCTION_REEXECUTE_EXCEPTION); FunctionService.registerFunction(function); Execution dataSet = FunctionService.onRegion(region); region.put(testKey, new Integer(1)); try { ResultCollector rs = execute(dataSet, testKeysSet, Boolean.TRUE, function, false); ArrayList list = (ArrayList)rs.getResult(); assertTrue(((Integer)list.get(0)) >= 5); } catch (Exception ex) { ex.printStackTrace(); fail("This is not expected Exception", ex); } }
public static void serverSingleKeyExecutionSocketTimeOut(Boolean isByName) { Region region = cache.getRegion(PartitionedRegionName); assertNotNull(region); final String testKey = "execKey"; final Set testKeysSet = new HashSet(); testKeysSet.add(testKey); DistributedSystem.setThreadsSocketPolicy(false); Function function = new TestFunction(true, TestFunction.TEST_FUNCTION_SOCKET_TIMEOUT); FunctionService.registerFunction(function); Execution dataSet = FunctionService.onRegion(region); region.put(testKey, new Integer(1)); try { ResultCollector rs = execute(dataSet, testKeysSet, Boolean.TRUE, function, isByName); assertEquals(Boolean.TRUE, ((List)rs.getResult()).get(0)); ResultCollector rs2 = execute(dataSet, testKeysSet, testKey, function, isByName); assertEquals(testKey, ((List)rs2.getResult()).get(0)); } catch (Exception ex) { ex.printStackTrace(); getLogWriter().info("Exception : ", ex); fail("Test failed after the put operation", ex); } }
region.put(i.next(), val); ResultCollector rc1 = execute(dataSet, testKeysSet, Boolean.TRUE, function, isByName); rc1.getResult();