ExecuteRegionFunctionGeode18 extends ExecuteRegionFunction66 { @Override void executeFunctionWithResult(Object function, byte functionState, Function<?> functionObject, AbstractExecution execution) { if (function instanceof String) { switch (functionState) { case AbstractExecution.NO_HA_HASRESULT_NO_OPTIMIZEFORWRITE: execution.setWaitOnExceptionFlag(true); execution.execute((String) function).getResult(); break; case AbstractExecution.HA_HASRESULT_NO_OPTIMIZEFORWRITE: execution.execute((String) function).getResult(); break; case AbstractExecution.HA_HASRESULT_OPTIMIZEFORWRITE: execution.execute((String) function).getResult(); break; case AbstractExecution.NO_HA_HASRESULT_OPTIMIZEFORWRITE: execution.setWaitOnExceptionFlag(true); execution.execute((String) function).getResult(); break; } } else { if (!functionObject.isHA()) { execution.setWaitOnExceptionFlag(true); } execution.execute(functionObject).getResult(); } } private  ExecuteRegionFunctionGeode18(); static Command getCommand();  }
@Test public void executingFunctionByStringWithNoHAShouldSetWaitOnException() { AbstractExecution execution = mock(AbstractExecution.class); String functionName = "functionName"; when(execution.execute(functionName)).thenReturn(mock(ResultCollector.class)); this.executeRegionFunctionGeode18.executeFunctionWithResult(functionName, AbstractExecution.NO_HA_HASRESULT_NO_OPTIMIZEFORWRITE, functionObject, execution); verify(execution, times(1)).setWaitOnExceptionFlag(true); }
@Test public void executingFunctionByStringWithNoHAWithOptimizeForWriteShouldSetWaitOnException() { AbstractExecution execution = mock(AbstractExecution.class); String functionName = "functionName"; when(execution.execute(functionName)).thenReturn(mock(ResultCollector.class)); this.executeRegionFunctionGeode18.executeFunctionWithResult(functionName, AbstractExecution.NO_HA_HASRESULT_OPTIMIZEFORWRITE, functionObject, execution); verify(execution, times(1)).setWaitOnExceptionFlag(true); }
@Test public void executeFunctionObjectShouldSetWaitOnException() { AbstractExecution execution = mock(AbstractExecution.class); when(execution.execute(functionObject)).thenReturn(mock(ResultCollector.class)); this.executeRegionFunctionGeode18.executeFunctionWithResult(functionObject, AbstractExecution.NO_HA_HASRESULT_OPTIMIZEFORWRITE, functionObject, execution); verify(execution, times(1)).setWaitOnExceptionFlag(true); }