public Object getStringOrObject() throws IOException, ClassNotFoundException { if (isObject()) { return getObject(); } else { return getString(); } }
@Before public void setUp() throws Exception { MockitoAnnotations.initMocks(this); Region region = mock(LocalRegion.class); when(region.containsKey(isA(String.class))).thenReturn(true); InternalCache cache = mock(InternalCache.class); when(cache.getRegion(isA(String.class))).thenReturn(region); CacheServerStats cacheServerStats = mock(CacheServerStats.class); when(this.serverConnection.getCache()).thenReturn(cache); when(this.serverConnection.getCacheServerStats()).thenReturn(cacheServerStats); when(this.serverConnection.getResponseMessage()).thenReturn(this.replyMessage); when(this.serverConnection.getAuthzRequest()).thenReturn(this.authzRequest); when(this.serverConnection.getErrorResponseMessage()).thenReturn(this.errorResponseMessage); Part regionNamePart = mock(Part.class); when(regionNamePart.getString()).thenReturn(REGION_NAME); Part keyPart = mock(Part.class); when(keyPart.getStringOrObject()).thenReturn(KEY); when(this.message.getPart(eq(0))).thenReturn(regionNamePart); when(this.message.getPart(eq(1))).thenReturn(keyPart); }
@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.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.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.get70 = new Get70(); MockitoAnnotations.initMocks(this); when(this.authzRequest.getAuthorize(any(), any(), any())).thenReturn(this.getOperationContext); when(this.cache.getRegion(isA(String.class))).thenReturn(this.region); when(this.cache.getCancelCriterion()).thenReturn(mock(CancelCriterion.class)); when(this.getOperationContext.getCallbackArg()).thenReturn(CALLBACK_ARG); when(this.keyPart.getStringOrObject()).thenReturn(KEY); when(this.message.getNumberOfParts()).thenReturn(3); 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.valuePart); when(this.regionNamePart.getString()).thenReturn(REGION_NAME); when(this.serverConnection.getCache()).thenReturn(this.cache); when(this.serverConnection.getCacheServerStats()).thenReturn(this.cacheServerStats); when(this.serverConnection.getAuthzRequest()).thenReturn(this.authzRequest); when(this.serverConnection.getResponseMessage()).thenReturn(this.responseMessage); when(this.serverConnection.getCachedRegionHelper()).thenReturn(mock(CachedRegionHelper.class)); when(this.serverConnection.getErrorResponseMessage()).thenReturn(this.errorResponseMessage); when(this.serverConnection.getClientVersion()).thenReturn(Version.CURRENT); when(this.valuePart.getObject()).thenReturn(CALLBACK_ARG); }
@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.request = new Request(); MockitoAnnotations.initMocks(this); when(this.authzRequest.getAuthorize(any(), any(), any())).thenReturn(this.getOperationContext); when(this.cache.getRegion(isA(String.class))).thenReturn(this.region); when(this.cache.getCancelCriterion()).thenReturn(mock(CancelCriterion.class)); when(this.getOperationContext.getCallbackArg()).thenReturn(CALLBACK_ARG); when(this.keyPart.getStringOrObject()).thenReturn(KEY); when(this.message.getNumberOfParts()).thenReturn(3); 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.valuePart); when(this.regionNamePart.getString()).thenReturn(REGION_NAME); when(this.serverConnection.getCache()).thenReturn(this.cache); when(this.serverConnection.getCacheServerStats()).thenReturn(this.cacheServerStats); when(this.serverConnection.getAuthzRequest()).thenReturn(this.authzRequest); when(this.serverConnection.getResponseMessage()).thenReturn(this.responseMessage); when(this.serverConnection.getCachedRegionHelper()).thenReturn(mock(CachedRegionHelper.class)); when(this.serverConnection.getErrorResponseMessage()).thenReturn(this.errorResponseMessage); when(this.serverConnection.getClientVersion()).thenReturn(Version.CURRENT); when(this.valuePart.getObject()).thenReturn(CALLBACK_ARG); }
@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); }
@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.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.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.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.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.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.destroyRegion = new DestroyRegion(); MockitoAnnotations.initMocks(this); when(this.authzRequest.destroyRegionAuthorize(eq(REGION_NAME), eq(CALLBACK_ARG))) .thenReturn(mock(RegionDestroyOperationContext.class)); when(this.cache.getRegion(isA(String.class))).thenReturn(this.region); when(this.cache.getCancelCriterion()).thenReturn(mock(CancelCriterion.class)); when(this.callbackArgPart.getObject()).thenReturn(CALLBACK_ARG); when(this.eventPart.getSerializedForm()).thenReturn(EVENT); when(this.message.getNumberOfParts()).thenReturn(3); when(this.message.getPart(eq(0))).thenReturn(this.regionNamePart); when(this.message.getPart(eq(1))).thenReturn(this.eventPart); when(this.message.getPart(eq(2))).thenReturn(this.callbackArgPart); when(this.regionNamePart.getString()).thenReturn(REGION_NAME); when(this.serverConnection.getCache()).thenReturn(this.cache); when(this.serverConnection.getCacheServerStats()).thenReturn(this.cacheServerStats); when(this.serverConnection.getAuthzRequest()).thenReturn(this.authzRequest); when(this.serverConnection.getCachedRegionHelper()).thenReturn(mock(CachedRegionHelper.class)); when(this.serverConnection.getErrorResponseMessage()).thenReturn(this.errorResponseMessage); when(this.serverConnection.getReplyMessage()).thenReturn(this.responseMessage); when(this.serverConnection.getClientVersion()).thenReturn(Version.CURRENT); }
@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.RESPONSE) { return Integer.valueOf(part.getInt()); } else { if (msgType == MessageType.EXCEPTION) { String s = "While performing a remote " + "getPdxIdForEnum"; 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, 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)); } } }
@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); final int msgType = msg.getMessageType(); if (msgType == MessageType.RESPONSE) { return part; } else { if (msgType == MessageType.REQUEST_EVENT_VALUE_ERROR) { // Value not found in haContainer. return null; } else if (msgType == MessageType.EXCEPTION) { String s = "While performing a remote " + "getFullValue"; 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)); } } }