protected void authorizeResult(Object oneResult) throws IOException { // check if the caller is authorised to receive these function execution // results from server AuthorizeRequestPP authzRequestPP = this.sc.getPostAuthzRequest(); if (authzRequestPP != null) { this.authContext.setIsPostOperation(true); this.authContext = authzRequestPP.executeFunctionAuthorize(oneResult, this.authContext); } }
private void fillAndSendKeySetResponseChunks(LocalRegion region, String regionName, KeySetOperationContext context, ServerConnection servConn) throws IOException { // Get the key set Set keySet = region.keys(); KeySetOperationContext keySetContext = context; // Post-operation filtering AuthorizeRequestPP postAuthzRequest = servConn.getPostAuthzRequest(); if (postAuthzRequest != null) { keySetContext = postAuthzRequest.keySetAuthorize(regionName, keySet, keySetContext); keySet = keySetContext.getKeySet(); } List keyList = new ArrayList(MAXIMUM_CHUNK_SIZE); final boolean isTraceEnabled = logger.isTraceEnabled(); for (Iterator it = keySet.iterator(); it.hasNext();) { Object entryKey = it.next(); keyList.add(entryKey); if (isTraceEnabled) { logger.trace("{}: fillAndSendKeySetResponseKey <{}>; list size was {}; region: {}", servConn.getName(), entryKey, keyList.size(), region.getFullPath()); } if (keyList.size() == MAXIMUM_CHUNK_SIZE) { // Send the chunk and clear the list sendKeySetResponseChunk(region, keyList, false, servConn); keyList.clear(); } } // Send the last chunk even if the list is of zero size. sendKeySetResponseChunk(region, keyList, true, servConn); }
@Test public void whenLastResultReceivedIsSetThenLastResultMustReturnImmediately() throws IOException { ServerToClientFunctionResultSender resultSender = getResultSender(); resultSender.lastResultReceived = true; Object object = mock(Object.class); DistributedMember memberId = mock(DistributedMember.class); resultSender.lastResult(object, memberId); verify(serverConnection, times(0)).getPostAuthzRequest(); resultSender.lastResult(object); verify(serverConnection, times(0)).getPostAuthzRequest(); }
@Test public void whenLastResultReceivedIsSetThenSendResultMustReturnImmediately() throws IOException { ServerToClientFunctionResultSender resultSender = getResultSender(); resultSender.lastResultReceived = true; Object object = mock(Object.class); DistributedMember memberId = mock(DistributedMember.class); resultSender.sendResult(object, memberId); verify(serverConnection, times(0)).getPostAuthzRequest(); resultSender.sendResult(object); verify(serverConnection, times(0)).getPostAuthzRequest(); }
@Test public void whenExceptionOccursThenLastResultReceivedMustNotBeSet() throws Exception { ServerToClientFunctionResultSender resultSender = getResultSender(); resultSender.ids = mock(InternalDistributedSystem.class); when(resultSender.ids.isDisconnecting()).thenReturn(false); Object object = mock(Object.class); resultSender.lastResultReceived = false; DistributedMember distributedMember = mock(DistributedMember.class); when(serverConnection.getPostAuthzRequest()) .thenThrow(new NotAuthorizedException("Should catch this exception")); CachedRegionHelper cachedRegionHelper = mock(CachedRegionHelper.class); when(serverConnection.getCachedRegionHelper()).thenReturn(cachedRegionHelper); InternalCache cache = mock(InternalCache.class); when(cachedRegionHelper.getCache()).thenReturn(cache); when(cache.isClosed()).thenReturn(false); expectedException.expect(NotAuthorizedException.class); resultSender.lastResult(object, distributedMember); assertFalse(resultSender.lastResultReceived); resultSender.lastResult(object); assertFalse(resultSender.lastResultReceived); }
AuthorizeRequestPP postAuthzRequest = servConn.getPostAuthzRequest(); Request request = (Request) Request.getCommand(); Object[] valueAndIsObject = new Object[3];
AuthorizeRequestPP postAuthzRequest = servConn.getPostAuthzRequest(); Request request = (Request) Request.getCommand(); Object[] valueAndIsObject = new Object[3];
try { AuthorizeRequest authzRequest = servConn.getAuthzRequest(); AuthorizeRequestPP postAuthzRequest = servConn.getPostAuthzRequest(); Get70 request = (Get70) Get70.getCommand(); for (int i = 0; i < numKeys; i++) {
try { AuthorizeRequest authzRequest = servConn.getAuthzRequest(); AuthorizeRequestPP postAuthzRequest = servConn.getPostAuthzRequest(); Get70 request = (Get70) Get70.getCommand(); final boolean isDebugEnabled = logger.isDebugEnabled();
AuthorizeRequestPP postAuthzRequest = servConn.getPostAuthzRequest(); if (postAuthzRequest != null) { if (cqQuery == null) {
AuthorizeRequestPP postAuthzRequest = serverConnection.getPostAuthzRequest(); if (postAuthzRequest != null) { getContext = postAuthzRequest.getAuthorize(regionName, key, data, isObject, getContext);
AuthorizeRequestPP postAuthzRequest = serverConnection.getPostAuthzRequest(); if (postAuthzRequest != null) { try {