@Override protected String[] getGroups(Message msg) throws IOException, ClassNotFoundException { String[] groups = null; Part messagePart = msg.getPart(4); if (messagePart != null) { groups = (String[]) messagePart.getObject(); } return groups; }
@Override protected Object getOptionalCallbackArg(Message msg) throws ClassNotFoundException, IOException { Part callbackPart = msg.getPart(5); return callbackPart.getObject(); }
Set<Object> populateRemovedNodes(Message clientMessage, int removedNodesSize, int partNumber) throws IOException, ClassNotFoundException { Set<Object> removedNodesSet = null; if (removedNodesSize != 0) { removedNodesSet = new HashSet<Object>(); partNumber = partNumber + 1; for (int i = 0; i < removedNodesSize; i++) { removedNodesSet.add(clientMessage.getPart(partNumber + i).getStringOrObject()); } } return removedNodesSet; }
Set<Object> populateFilters(Message clientMessage, int filterSize) throws IOException, ClassNotFoundException { Set<Object> filter = null; int partNumber; if (filterSize != 0) { filter = new HashSet<Object>(); partNumber = 7; for (int i = 0; i < filterSize; i++) { filter.add(clientMessage.getPart(partNumber + i).getStringOrObject()); } } return filter; }
private boolean isFlagSet(Message msg, int index) { boolean isSet = false; Part messagePart = msg.getPart(5); if (messagePart != null) { byte[] flags = messagePart.getSerializedForm(); if (flags != null && flags.length > index) { if (flags[index] == 1) { isSet = true; } } } return isSet; }
@Override protected void processAck(Message msg, String opName) throws Exception { final int msgType = msg.getMessageType(); if (msgType == MessageType.REPLY) { return; } else { Part part = msg.getPart(0); if (msgType == MessageType.EXCEPTION) { Throwable t = (Throwable) part.getObject(); if (t instanceof CommitConflictException || t instanceof SynchronizationCommitConflictException) { throw (GemFireException) t; } } super.processAck(msg, opName); } }
@Override protected Object processResponse(Message msg) throws Exception { final int msgType = msg.getMessageType(); if (msgType == MessageType.REPLY) { return null; } else { Part part = msg.getPart(0); if (msgType == MessageType.EXCEPTION) { Throwable t = (Throwable) part.getObject(); logger.warn("Function execution without result encountered an Exception on server.", t); } else if (isErrorResponse(msgType)) { logger.warn("Function execution without result encountered an Exception on server."); } else { throw new InternalGemFireError( "Unexpected message type " + MessageType.getString(msgType)); } return null; } }
@Override protected Object processResponse(Message msg) throws Exception { final int msgType = msg.getMessageType(); if (msgType == MessageType.REPLY) { return null; } else { Part part = msg.getPart(0); if (msgType == MessageType.EXCEPTION) { Throwable t = (Throwable) part.getObject(); logger.warn("Function execution without result encountered an Exception on server.", t); } else if (isErrorResponse(msgType)) { logger.warn("Function execution without result encountered an Exception on server."); } else { throw new InternalGemFireError( "Unexpected message type " + MessageType.getString(msgType)); } return null; } }
@Before public void setUp() throws Exception { this.getClientPartitionAttributesCommand = new GetClientPartitionAttributesCommand(); MockitoAnnotations.initMocks(this); when(this.cache.getRegion(isA(String.class))).thenReturn(mock(PartitionedRegion.class)); when(this.message.getPart(eq(0))).thenReturn(this.regionNamePart); when(this.regionNamePart.getString()).thenReturn(REGION_NAME); when(this.serverConnection.getCache()).thenReturn(this.cache); when(this.serverConnection.getResponseMessage()).thenReturn(this.responseMessage); }
@Before public void setUp() throws Exception { this.getClientPartitionAttributesCommand66 = new GetClientPartitionAttributesCommand66(); MockitoAnnotations.initMocks(this); when(this.cache.getRegion(isA(String.class))).thenReturn(mock(LocalRegion.class)); when(this.message.getPart(eq(0))).thenReturn(this.regionNamePart); when(this.regionNamePart.getString()).thenReturn(REGION_NAME); when(this.serverConnection.getCache()).thenReturn(this.cache); when(this.serverConnection.getResponseMessage()).thenReturn(this.responseMessage); }
@Before public void setUp() throws Exception { this.getAll = new GetAll(); MockitoAnnotations.initMocks(this); when(this.authzRequest.getAuthorize(any(), any(), any())) .thenReturn(mock(GetOperationContext.class)); when(this.cache.getRegion(isA(String.class))).thenReturn(mock(LocalRegion.class)); when(this.cache.getCancelCriterion()).thenReturn(mock(CancelCriterion.class)); when(this.keyPart.getObject()).thenReturn(KEYS); when(this.message.getPart(eq(0))).thenReturn(this.regionNamePart); when(this.message.getPart(eq(1))).thenReturn(this.keyPart); when(this.regionNamePart.getString()).thenReturn(REGION_NAME); when(this.serverConnection.getCache()).thenReturn(this.cache); when(this.serverConnection.getCacheServerStats()).thenReturn(mock(CacheServerStats.class)); when(this.serverConnection.getAuthzRequest()).thenReturn(this.authzRequest); when(this.serverConnection.getCachedRegionHelper()).thenReturn(mock(CachedRegionHelper.class)); when(this.serverConnection.getChunkedResponseMessage()).thenReturn(this.chunkedResponseMessage); }
@Before public void setUp() throws Exception { this.getAll651 = new GetAll651(); MockitoAnnotations.initMocks(this); when(this.authzRequest.getAuthorize(any(), any(), any())) .thenReturn(mock(GetOperationContext.class)); when(this.cache.getRegion(isA(String.class))).thenReturn(mock(LocalRegion.class)); when(this.cache.getCancelCriterion()).thenReturn(mock(CancelCriterion.class)); when(this.keyPart.getObject()).thenReturn(KEYS); when(this.message.getPart(eq(0))).thenReturn(this.regionNamePart); when(this.message.getPart(eq(1))).thenReturn(this.keyPart); when(this.regionNamePart.getString()).thenReturn(REGION_NAME); when(this.serverConnection.getCache()).thenReturn(this.cache); when(this.serverConnection.getCacheServerStats()).thenReturn(mock(CacheServerStats.class)); when(this.serverConnection.getAuthzRequest()).thenReturn(this.authzRequest); when(this.serverConnection.getCachedRegionHelper()).thenReturn(mock(CachedRegionHelper.class)); when(this.serverConnection.getChunkedResponseMessage()).thenReturn(this.chunkedResponseMessage); }
@Before public void setUp() throws Exception { this.containsKey66 = new ContainsKey66(); MockitoAnnotations.initMocks(this); when(this.region.containsKey(eq(REGION_NAME))).thenReturn(true); when(this.cache.getRegion(isA(String.class))).thenReturn(this.region); when(this.serverConnection.getCache()).thenReturn(this.cache); when(this.serverConnection.getCacheServerStats()).thenReturn(this.cacheServerStats); when(this.serverConnection.getErrorResponseMessage()).thenReturn(this.errorResponseMessage); when(this.serverConnection.getResponseMessage()).thenReturn(this.responseMessage); when(this.serverConnection.getAuthzRequest()).thenReturn(this.authzRequest); when(this.serverConnection.getClientVersion()).thenReturn(Version.CURRENT); when(this.regionNamePart.getString()).thenReturn(REGION_NAME); when(this.keyPart.getStringOrObject()).thenReturn(KEY); when(this.modePart.getInt()).thenReturn(0); when(this.message.getPart(eq(0))).thenReturn(this.regionNamePart); when(this.message.getPart(eq(1))).thenReturn(this.keyPart); when(this.message.getPart(eq(2))).thenReturn(this.modePart); }
@Before public void setUp() throws Exception { this.getAll70 = new GetAll70(); MockitoAnnotations.initMocks(this); when(this.authzRequest.getAuthorize(any(), any(), any())) .thenReturn(mock(GetOperationContext.class)); when(this.cache.getRegion(isA(String.class))).thenReturn(this.region); when(this.keyPart.getObject()).thenReturn(KEYS); when(this.message.getPart(eq(0))).thenReturn(this.regionNamePart); when(this.message.getPart(eq(1))).thenReturn(this.keyPart); when(this.message.getPart(eq(2))).thenReturn(this.requestSerializableValuesPart); when(this.region.getAttributes()).thenReturn(this.regionAttributes); when(this.regionAttributes.getConcurrencyChecksEnabled()).thenReturn(true); when(this.regionNamePart.getString()).thenReturn(REGION_NAME); when(this.requestSerializableValuesPart.getInt()).thenReturn(0); when(this.serverConnection.getCache()).thenReturn(this.cache); when(this.serverConnection.getAuthzRequest()).thenReturn(this.authzRequest); when(this.serverConnection.getChunkedResponseMessage()).thenReturn(this.chunkedResponseMessage); }
@Before public void setUp() throws Exception { this.createRegion = new CreateRegion(); MockitoAnnotations.initMocks(this); when(this.cache.getRegion(eq(PARENT_REGION_NAME))).thenReturn(this.parentRegion); when(this.cache.getCancelCriterion()).thenReturn(mock(CancelCriterion.class)); when(this.message.getPart(eq(0))).thenReturn(this.parentRegionNamePart); when(this.message.getPart(eq(1))).thenReturn(this.regionNamePart); when(this.parentRegion.getAttributes()).thenReturn(new AttributesFactory().create()); when(this.parentRegionNamePart.getString()).thenReturn(PARENT_REGION_NAME); when(this.regionNamePart.getString()).thenReturn(REGION_NAME); when(this.serverConnection.getCache()).thenReturn(this.cache); when(this.serverConnection.getAuthzRequest()).thenReturn(this.authzRequest); when(this.serverConnection.getCacheServerStats()).thenReturn(mock(CacheServerStats.class)); when(this.serverConnection.getReplyMessage()).thenReturn(this.responseMessage); when(this.serverConnection.getErrorResponseMessage()).thenReturn(this.errorResponseMessage); when(this.serverConnection.getClientVersion()).thenReturn(Version.CURRENT); }
@Before public void setUp() throws Exception { this.keySet = new KeySet(); MockitoAnnotations.initMocks(this); when(this.authzRequest.keySetAuthorize(eq(REGION_NAME))) .thenReturn(this.keySetOperationContext); when(this.cache.getRegion(isA(String.class))).thenReturn(this.region); when(this.cache.getCancelCriterion()).thenReturn(mock(CancelCriterion.class)); when(this.message.getPart(eq(0))).thenReturn(this.regionNamePart); when(this.regionNamePart.getString()).thenReturn(REGION_NAME); when(this.serverConnection.getCache()).thenReturn(this.cache); when(this.serverConnection.getCacheServerStats()).thenReturn(mock(CacheServerStats.class)); when(this.serverConnection.getAuthzRequest()).thenReturn(this.authzRequest); when(this.serverConnection.getCachedRegionHelper()).thenReturn(mock(CachedRegionHelper.class)); when(this.serverConnection.getChunkedResponseMessage()).thenReturn(this.chunkedResponseMessage); }
@Override protected Object processResponse(Message msg) throws Exception { Part part = msg.getPart(0); final int msgType = msg.getMessageType(); if (msgType == MessageType.RESPONSE) { return Integer.valueOf(part.getInt()); } else { if (msgType == MessageType.EXCEPTION) { String s = "While performing a remote " + "getPdxIdForType"; throw new ServerOperationException(s, (Throwable) part.getObject()); // Get the exception toString part. // This was added for c++ thin client and not used in java } else if (isErrorResponse(msgType)) { throw new ServerOperationException(part.getString()); } else { throw new InternalGemFireError( "Unexpected message type " + MessageType.getString(msgType)); } } }
@Override protected Object processResponse(Message msg) throws Exception { Part part = msg.getPart(0); final int msgType = msg.getMessageType(); if (msgType == MessageType.REPLY) { return part.getObject(); } else if (msgType == MessageType.EXCEPTION) { String s = "While performing a remote proxy cache close"; throw new ServerOperationException(s, (Throwable) part.getObject()); // Get the exception toString part. // This was added for c++ thin client and not used in java } else if (isErrorResponse(msgType)) { throw new ServerOperationException(part.getString()); } else { throw new InternalGemFireError("Unexpected message type " + MessageType.getString(msgType)); } }
@Override protected Object processResponse(Message msg) throws Exception { Part part = msg.getPart(0); int msgType = msg.getMessageType(); if (msgType == MessageType.RESPONSE) { return (Map<Integer, EnumInfo>) part.getObject(); } else { if (msgType == MessageType.EXCEPTION) { String s = "While performing a remote " + "getPdxEnums"; throw new ServerOperationException(s, (Throwable) part.getObject()); } else if (isErrorResponse(msgType)) { throw new ServerOperationException(part.getString()); } else { throw new InternalGemFireError( "Unexpected message type " + MessageType.getString(msgType)); } } }
@Override protected Object processResponse(Message msg) throws Exception { Part part = msg.getPart(0); int msgType = msg.getMessageType(); if (msgType == MessageType.RESPONSE) { return (Map<Integer, PdxType>) part.getObject(); } else { if (msgType == MessageType.EXCEPTION) { String s = "While performing a remote " + "getPdxTypes"; throw new ServerOperationException(s, (Throwable) part.getObject()); } else if (isErrorResponse(msgType)) { throw new ServerOperationException(part.getString()); } else { throw new InternalGemFireError( "Unexpected message type " + MessageType.getString(msgType)); } } }