public static void verifySubstitutionFilterInvocations(String asyncEventQueueId, int expectedNumInvocations) { AsyncEventQueue queue = cache.getAsyncEventQueue(asyncEventQueueId); assertNotNull(queue); // Verify the GatewayEventSubstitutionFilter has been invoked the appropriate number of times MyGatewayEventSubstitutionFilter filter = (MyGatewayEventSubstitutionFilter) queue.getGatewayEventSubstitutionFilter(); assertNotNull(filter); assertEquals(expectedNumInvocations, filter.getNumInvocations()); // Verify the AsyncEventListener has received the substituted values MyAsyncEventListener listener = (MyAsyncEventListener) queue.getAsyncEventListener(); final Map eventsMap = listener.getEventsMap(); assertNotNull(eventsMap); assertEquals(expectedNumInvocations, eventsMap.size()); for (Iterator i = eventsMap.entrySet().iterator(); i.hasNext();) { Map.Entry<Integer, String> entry = (Map.Entry<Integer, String>) i.next(); assertEquals(MyGatewayEventSubstitutionFilter.SUBSTITUTION_PREFIX + entry.getKey(), entry.getValue()); } }
public static void verifySubstitutionFilterToDataInvocations(String asyncEventQueueId, int expectedToDataInvoations) { AsyncEventQueue queue = cache.getAsyncEventQueue(asyncEventQueueId); assertNotNull(queue); // Verify the GatewayEventSubstitutionFilter has been invoked the appropriate number of times SizeableGatewayEventSubstitutionFilter filter = (SizeableGatewayEventSubstitutionFilter) queue.getGatewayEventSubstitutionFilter(); assertNotNull(filter); assertEquals(expectedToDataInvoations, filter.getNumToDataInvocations()); }
if (asyncEventQueue.getGatewayEventSubstitutionFilter() != null) { generateGatewayEventSubstitutionFilter( asyncEventQueue.getGatewayEventSubstitutionFilter());
public void configureAsyncEventQueue(AsyncEventQueue asyncQueueCreation) { gatewaySenderAttributes.batchSize = asyncQueueCreation.getBatchSize(); gatewaySenderAttributes.batchTimeInterval = asyncQueueCreation.getBatchTimeInterval(); gatewaySenderAttributes.isBatchConflationEnabled = asyncQueueCreation.isBatchConflationEnabled(); gatewaySenderAttributes.isPersistenceEnabled = asyncQueueCreation.isPersistent(); gatewaySenderAttributes.diskStoreName = asyncQueueCreation.getDiskStoreName(); gatewaySenderAttributes.isDiskSynchronous = asyncQueueCreation.isDiskSynchronous(); gatewaySenderAttributes.maximumQueueMemory = asyncQueueCreation.getMaximumQueueMemory(); gatewaySenderAttributes.isParallel = asyncQueueCreation.isParallel(); gatewaySenderAttributes.isBucketSorted = ((AsyncEventQueueCreation) asyncQueueCreation).isBucketSorted(); gatewaySenderAttributes.dispatcherThreads = asyncQueueCreation.getDispatcherThreads(); gatewaySenderAttributes.policy = asyncQueueCreation.getOrderPolicy(); gatewaySenderAttributes.eventFilters = asyncQueueCreation.getGatewayEventFilters(); gatewaySenderAttributes.eventSubstitutionFilter = asyncQueueCreation.getGatewayEventSubstitutionFilter(); gatewaySenderAttributes.isForInternalUse = true; gatewaySenderAttributes.forwardExpirationDestroy = asyncQueueCreation.isForwardExpirationDestroy(); }
when(mockAsyncEventQueue.getDispatcherThreads()).thenAnswer(newGetter(dispatcherThreads)); when(mockAsyncEventQueue.getGatewayEventFilters()).thenReturn(gatewayEventFilters); when(mockAsyncEventQueue.getGatewayEventSubstitutionFilter()).thenAnswer(newGetter(gatewayEventSubstitutionFilter)); when(mockAsyncEventQueue.getId()).thenReturn(asyncEventQueueId); when(mockAsyncEventQueue.getMaximumQueueMemory()).thenAnswer(newGetter(maximumQueueMemory));