/** * Sends a chunk of this message. */ public void sendChunk(ServerConnection servConn) throws IOException { if (this.serverConnection != servConn) throw new IllegalStateException("this.sc was not correctly set"); sendChunk(); }
protected void writeFunctionExceptionResponse(ChunkedMessage message, String errormessage, Throwable e) throws IOException { if (logger.isDebugEnabled()) { logger.debug("ServerToClientFunctionResultSender sending Function Error Response: {}", errormessage); } message.clear(); message.setLastChunk(true); message.addObjPart(e); message.sendChunk(this.sc); this.sc.setAsTrue(Command.RESPONDED); }
private void sendDurableCqsResponseChunk(List list, boolean lastChunk, ServerConnection servConn) throws IOException { ChunkedMessage chunkedResponseMsg = servConn.getChunkedResponseMessage(); chunkedResponseMsg.setNumberOfParts(1); chunkedResponseMsg.setLastChunk(lastChunk); chunkedResponseMsg.addObjPart(list, false); if (logger.isDebugEnabled()) { logger.debug("{}: Sending {} durableCQs response chunk{}", servConn.getName(), lastChunk ? " last " : " ", logger.isTraceEnabled() ? " keys=" + list + " chunk=<" + chunkedResponseMsg + ">" : ""); } chunkedResponseMsg.sendChunk(servConn); }
private static void sendKeySetResponseChunk(Region region, List list, boolean lastChunk, ServerConnection servConn) throws IOException { ChunkedMessage chunkedResponseMsg = servConn.getChunkedResponseMessage(); chunkedResponseMsg.setNumberOfParts(1); chunkedResponseMsg.setLastChunk(lastChunk); chunkedResponseMsg.addObjPart(list, false); if (logger.isDebugEnabled()) { logger.debug("{}: Sending {} key set response chunk for region={}{}", servConn.getName(), (lastChunk ? " last " : " "), region.getFullPath(), (logger.isTraceEnabled() ? " keys=" + list + " chunk=<" + chunkedResponseMsg + ">" : "")); } chunkedResponseMsg.sendChunk(servConn); }
@Test public void noSecurityShouldSucceed() throws Exception { when(this.securityService.isClientSecurityRequired()).thenReturn(false); this.getAll.cmdExecute(this.message, this.serverConnection, this.securityService, 0); verify(this.chunkedResponseMessage).sendChunk(eq(this.serverConnection)); }
@Test public void withOldSecurityShouldThrowIfNotAuthorized() throws Exception { when(securityService.isClientSecurityRequired()).thenReturn(true); when(securityService.isIntegratedSecurity()).thenReturn(false); doThrow(new NotAuthorizedException("")).when(authorizeRequest) .executeFunctionAuthorize(eq(FUNCTION_ID), any(), any(), any(), eq(false)); executeFunction.cmdExecute(message, serverConnection, securityService, 0); verify(chunkedResponseMessage).sendChunk(serverConnection); verifyZeroInteractions(serverToClientFunctionResultSenderFactory); } }
@Test public void oldSecurityShouldSucceedIfAuthorized() throws Exception { when(this.securityService.isClientSecurityRequired()).thenReturn(true); when(this.securityService.isIntegratedSecurity()).thenReturn(false); this.registerInterestList61.cmdExecute(this.message, this.serverConnection, this.securityService, 0); verify(this.authzRequest).registerInterestListAuthorize(eq(REGION_NAME), any(), any()); verify(this.chunkedResponseMessage).sendChunk(this.serverConnection); }
@Test public void noSecurityShouldSucceed() throws Exception { when(this.securityService.isClientSecurityRequired()).thenReturn(false); this.getAll70.cmdExecute(this.message, this.serverConnection, this.securityService, 0); verify(this.chunkedResponseMessage).sendChunk(eq(this.serverConnection)); }
@Test public void noSecurityShouldSucceed() throws Exception { when(this.securityService.isClientSecurityRequired()).thenReturn(false); this.registerInterestList61.cmdExecute(this.message, this.serverConnection, this.securityService, 0); verify(this.chunkedResponseMessage).sendChunk(this.serverConnection); }
@Test public void noSecurityShouldSucceed() throws Exception { when(this.securityService.isClientSecurityRequired()).thenReturn(false); this.keySet.cmdExecute(this.message, this.serverConnection, this.securityService, 0); verify(this.chunkedResponseMessage).sendChunk(this.serverConnection); }
@Test public void integratedSecurityShouldSucceedIfAuthorized() throws Exception { when(this.securityService.isClientSecurityRequired()).thenReturn(true); when(this.securityService.isIntegratedSecurity()).thenReturn(true); this.removeAll.cmdExecute(this.message, this.serverConnection, this.securityService, 0); for (Object key : KEYS) { verify(this.securityService).authorize(Resource.DATA, Operation.WRITE, REGION_NAME); } verify(this.chunkedResponseMessage).sendChunk(eq(this.serverConnection)); }
@Test public void oldSecurityShouldSucceedIfAuthorized() throws Exception { when(this.securityService.isClientSecurityRequired()).thenReturn(true); when(this.securityService.isIntegratedSecurity()).thenReturn(false); this.keySet.cmdExecute(this.message, this.serverConnection, this.securityService, 0); verify(this.authzRequest).keySetAuthorize(eq(REGION_NAME)); verify(this.chunkedResponseMessage).sendChunk(this.serverConnection); }
static void writeQueryResponseChunk(Object queryResponseChunk, CollectionType collectionType, boolean lastChunk, ServerConnection serverConnection) throws IOException { ChunkedMessage queryResponseMsg = serverConnection.getQueryResponseMessage(); queryResponseMsg.setNumberOfParts(2); queryResponseMsg.setLastChunk(lastChunk); queryResponseMsg.addObjPart(collectionType, false); queryResponseMsg.addObjPart(queryResponseChunk, false); queryResponseMsg.sendChunk(serverConnection); }
@Test public void integratedSecurityShouldSucceedIfAuthorized() throws Exception { when(this.securityService.isClientSecurityRequired()).thenReturn(true); when(this.securityService.isIntegratedSecurity()).thenReturn(true); this.registerInterest.cmdExecute(this.message, this.serverConnection, this.securityService, 0); verify(this.securityService).authorize(Resource.DATA, Operation.READ, REGION_NAME, KEY); verify(this.chunkedResponseMessage).sendChunk(this.serverConnection); }
@Test public void integratedSecurityShouldSucceedIfAuthorized() throws Exception { when(this.securityService.isClientSecurityRequired()).thenReturn(true); when(this.securityService.isIntegratedSecurity()).thenReturn(true); this.registerInterestList66.cmdExecute(this.message, this.serverConnection, this.securityService, 0); verify(this.securityService).authorize(Resource.DATA, Operation.READ, REGION_NAME); verify(this.chunkedResponseMessage).sendChunk(this.serverConnection); }
@Test public void withIntegratedSecurityShouldThrowIfNotAuthorized() throws Exception { when(securityService.isClientSecurityRequired()).thenReturn(true); when(securityService.isIntegratedSecurity()).thenReturn(true); doThrow(new NotAuthorizedException("")).when(securityService) .authorize(ResourcePermissions.DATA_WRITE); executeFunction.cmdExecute(message, serverConnection, securityService, 0); verify(securityService).authorize(ResourcePermissions.DATA_WRITE); verify(chunkedResponseMessage).sendChunk(serverConnection); verifyZeroInteractions(serverToClientFunctionResultSenderFactory); }
@Test public void integratedSecurityShouldSucceedIfAuthorized() throws Exception { when(this.securityService.isClientSecurityRequired()).thenReturn(true); when(this.securityService.isIntegratedSecurity()).thenReturn(true); this.keySet.cmdExecute(this.message, this.serverConnection, this.securityService, 0); verify(this.securityService).authorize(Resource.DATA, Operation.READ, REGION_NAME); verify(this.chunkedResponseMessage).sendChunk(this.serverConnection); }
@Test public void integratedSecurityShouldThrowIfNotAuthorized() throws Exception { when(this.securityService.isClientSecurityRequired()).thenReturn(true); when(this.securityService.isIntegratedSecurity()).thenReturn(true); doThrow(new NotAuthorizedException("")).when(this.securityService).authorize(Resource.DATA, Operation.READ, REGION_NAME, KEY); this.registerInterest.cmdExecute(this.message, this.serverConnection, this.securityService, 0); verify(this.securityService).authorize(Resource.DATA, Operation.READ, REGION_NAME, KEY); verify(this.chunkedResponseMessage).sendChunk(this.serverConnection); }
@Test public void integratedSecurityShouldThrowIfNotAuthorized() throws Exception { when(this.securityService.isClientSecurityRequired()).thenReturn(true); when(this.securityService.isIntegratedSecurity()).thenReturn(true); doThrow(new NotAuthorizedException("")).when(this.securityService).authorize(Resource.DATA, Operation.READ, REGION_NAME); this.registerInterestList66.cmdExecute(this.message, this.serverConnection, this.securityService, 0); verify(this.securityService).authorize(Resource.DATA, Operation.READ, REGION_NAME); verify(this.chunkedResponseMessage).sendChunk(this.serverConnection); }
@Test public void integratedSecurityShouldFailIfNotAuthorized() throws Exception { when(this.securityService.isClientSecurityRequired()).thenReturn(true); when(this.securityService.isIntegratedSecurity()).thenReturn(true); doThrow(new NotAuthorizedException("")).when(this.securityService).authorize(Resource.DATA, Operation.READ, REGION_NAME); this.keySet.cmdExecute(this.message, this.serverConnection, this.securityService, 0); verify(this.securityService).authorize(Resource.DATA, Operation.READ, REGION_NAME); verify(this.chunkedResponseMessage).sendChunk(this.serverConnection); }