Search in sources :

Example 1 with LogMessageMatcher

use of org.apache.qpid.server.queue.ProducerFlowControlOverflowPolicyHandlerTest.LogMessageMatcher in project qpid-broker-j by apache.

the class RingOverflowPolicyHandlerTest method testCheckOverflowWhenOverfullBytes.

public void testCheckOverflowWhenOverfullBytes() throws Exception {
    QueueEntry lastEntry = createLastEntry();
    when(_queue.getLeastSignificantOldestEntry()).thenReturn(lastEntry, (QueueEntry) null);
    when(_queue.getQueueDepthBytes()).thenReturn(10L, 4L);
    when(_queue.getMaximumQueueDepthBytes()).thenReturn(5L);
    when(_queue.getQueueDepthMessages()).thenReturn(3, 1);
    _ringOverflowPolicyHandler.checkOverflow(null);
    verify(_queue).deleteEntry(lastEntry);
    LogMessage dropped = QueueMessages.DROPPED(1L, 4, 1, 5, -1);
    verify(_eventLogger).message(same(_subject), argThat(new LogMessageMatcher(dropped)));
    verifyNoMoreInteractions(_eventLogger);
}
Also used : LogMessage(org.apache.qpid.server.logging.LogMessage) LogMessageMatcher(org.apache.qpid.server.queue.ProducerFlowControlOverflowPolicyHandlerTest.LogMessageMatcher)

Example 2 with LogMessageMatcher

use of org.apache.qpid.server.queue.ProducerFlowControlOverflowPolicyHandlerTest.LogMessageMatcher in project qpid-broker-j by apache.

the class RingOverflowPolicyHandlerTest method testCheckOverflowWhenOverfullMessages.

public void testCheckOverflowWhenOverfullMessages() throws Exception {
    QueueEntry lastEntry = createLastEntry();
    when(_queue.getLeastSignificantOldestEntry()).thenReturn(lastEntry, (QueueEntry) null);
    when(_queue.getQueueDepthMessages()).thenReturn(10, 5);
    when(_queue.getMaximumQueueDepthMessages()).thenReturn(5L);
    when(_queue.getQueueDepthBytes()).thenReturn(10L, 4L);
    _ringOverflowPolicyHandler.checkOverflow(null);
    verify((AbstractQueue<?>) _queue).deleteEntry(lastEntry);
    LogMessage dropped = QueueMessages.DROPPED(1, 4, 5, -1, 5);
    verify(_eventLogger).message(same(_subject), argThat(new LogMessageMatcher(dropped)));
    verifyNoMoreInteractions(_eventLogger);
}
Also used : LogMessage(org.apache.qpid.server.logging.LogMessage) LogMessageMatcher(org.apache.qpid.server.queue.ProducerFlowControlOverflowPolicyHandlerTest.LogMessageMatcher)

Aggregations

LogMessage (org.apache.qpid.server.logging.LogMessage)2 LogMessageMatcher (org.apache.qpid.server.queue.ProducerFlowControlOverflowPolicyHandlerTest.LogMessageMatcher)2