ExecuteRegionFunction66 extends BaseCommand { ExecuteFunctionOperationContext getAuthorizedExecuteFunctionOperationContext(Object args, Set<Object> filter, boolean optimizedForWrite, AuthorizeRequest authzRequest, String functionName, String regionPath) { ExecuteFunctionOperationContext executeContext = null; if (authzRequest != null) { executeContext = authzRequest.executeFunctionAuthorize(functionName, regionPath, filter, args, optimizedForWrite); } return executeContext; } ExecuteRegionFunction66(); static Command getCommand(); @Override void cmdExecute(final Message clientMessage, final ServerConnection serverConnection,
      final SecurityService securityService, long start);  }
@Test public void getAuthorizedExecuteFunctionReturnsNullIfAuthorizationIsNull() { AbstractExecution execution = mock(AbstractExecution.class); when(execution.execute(functionObject)).thenReturn(mock(ResultCollector.class)); String functionName = "functionName"; String regionPath = "regionPath"; ExecuteFunctionOperationContext context = executeRegionFunction66.getAuthorizedExecuteFunctionOperationContext(null, null, true, null, functionName, regionPath); assertNull(context); }
@Test public void getAuthorizedExecuteFunctionReturnsExecutionContextIfAuthorizeRequestIsNotNull() { AbstractExecution execution = mock(AbstractExecution.class); when(execution.execute(functionObject)).thenReturn(mock(ResultCollector.class)); String functionName = "functionName"; String regionPath = "regionPath"; AuthorizeRequest request = mock(AuthorizeRequest.class); when(request.executeFunctionAuthorize(any(), any(), any(), any(), anyBoolean())) .thenReturn(mock(ExecuteFunctionOperationContext.class)); ExecuteFunctionOperationContext context = executeRegionFunction66.getAuthorizedExecuteFunctionOperationContext(null, null, true, request, functionName, regionPath); assertNotNull(context); }