use of org.apache.qpid.server.logging.LogMessage in project qpid-broker-j by apache.
the class SubjectCreatorTest method testUnsuccessfulAuthentication.
private void testUnsuccessfulAuthentication(AuthenticationStatus expectedStatus) {
AuthenticationResult failedAuthenticationResult = new AuthenticationResult(expectedStatus);
when(_testSaslNegotiator.handleResponse(_saslResponseBytes)).thenReturn(failedAuthenticationResult);
SubjectAuthenticationResult subjectAuthenticationResult = _subjectCreator.authenticate(_testSaslNegotiator, _saslResponseBytes);
assertSame(expectedStatus, subjectAuthenticationResult.getStatus());
assertNull(subjectAuthenticationResult.getSubject());
if (expectedStatus == AuthenticationStatus.ERROR) {
ArgumentCaptor<LogMessage> argument = ArgumentCaptor.forClass(LogMessage.class);
verify(_eventLogger).message(argument.capture());
assertTrue("Unexpected operational log message", argument.getValue().toString().startsWith("ATH-1010"));
}
}
use of org.apache.qpid.server.logging.LogMessage in project qpid-broker-j by apache.
the class ServerSession method onClose.
public void onClose() {
AMQPConnection_0_10 amqpConnection = getAMQPConnection();
if (_transaction instanceof LocalTransaction) {
if (((LocalTransaction) _transaction).hasOutstandingWork()) {
amqpConnection.incrementTransactionRollbackCounter();
}
amqpConnection.decrementTransactionOpenCounter();
_transaction.rollback();
amqpConnection.unregisterTransactionTickers(_transaction);
} else if (_transaction instanceof DistributedTransaction) {
getAddressSpace().getDtxRegistry().endAssociations(_modelObject);
}
for (MessageDispositionChangeListener listener : _messageDispositionListenerMap.values()) {
listener.onRelease(true, true);
}
_messageDispositionListenerMap.clear();
for (Action<? super Session_0_10> task : _modelObject.getTaskList()) {
task.performAction(_modelObject);
}
LogMessage operationalLoggingMessage = _forcedCloseLogMessage.get();
if (operationalLoggingMessage == null && getConnection().getConnectionCloseMessage() != null) {
operationalLoggingMessage = ChannelMessages.CLOSE_FORCED(getConnection().getConnectionCloseCode(), getConnection().getConnectionCloseMessage());
}
if (operationalLoggingMessage == null) {
operationalLoggingMessage = ChannelMessages.CLOSE();
}
amqpConnection.getEventLogger().message(getLogSubject(), operationalLoggingMessage);
}
use of org.apache.qpid.server.logging.LogMessage in project qpid-broker-j by apache.
the class ProducerFlowControlOverflowPolicyHandlerTest method testCheckOverflowBlocksSessionWhenOverfullMessages.
public void testCheckOverflowBlocksSessionWhenOverfullMessages() throws Exception {
AMQPSession<?, ?> session = mock(AMQPSession.class);
when(_queue.getMaximumQueueDepthMessages()).thenReturn(10L);
when(_queue.getQueueDepthMessages()).thenReturn(11);
checkOverflow(session);
verify(session, times(1)).block(_queue);
LogMessage logMessage = QueueMessages.OVERFULL(0, -1, 11, 10);
verify(_eventLogger).message(same(_subject), argThat(new LogMessageMatcher(logMessage)));
verifyNoMoreInteractions(_eventLogger);
verifyNoMoreInteractions(session);
}
use of org.apache.qpid.server.logging.LogMessage in project qpid-broker-j by apache.
the class ProducerFlowControlOverflowPolicyHandlerTest method testCheckOverflowBlocksSessionWhenOverfullBytes.
public void testCheckOverflowBlocksSessionWhenOverfullBytes() throws Exception {
AMQPSession<?, ?> session = mock(AMQPSession.class);
when(_queue.getQueueDepthBytes()).thenReturn(11L);
when(_queue.getMaximumQueueDepthBytes()).thenReturn(10L);
checkOverflow(session);
verify(session, times(1)).block(_queue);
LogMessage logMessage = QueueMessages.OVERFULL(11, 10, 0, -1);
verify(_eventLogger).message(same(_subject), argThat(new LogMessageMatcher(logMessage)));
verifyNoMoreInteractions(_eventLogger);
verifyNoMoreInteractions(session);
}
use of org.apache.qpid.server.logging.LogMessage in project qpid-broker-j by apache.
the class ProducerFlowControlOverflowPolicyHandlerTest method testCheckOverflowResumesFlowWhenUnderfullBytes.
public void testCheckOverflowResumesFlowWhenUnderfullBytes() throws Exception {
AMQPSession<?, ?> session = mock(AMQPSession.class);
when(_queue.getQueueDepthBytes()).thenReturn(11L);
when(_queue.getMaximumQueueDepthBytes()).thenReturn(10L);
checkOverflow(session);
verify(session, times(1)).block(_queue);
LogMessage overfullMessage = QueueMessages.OVERFULL(11, 10, 0, -1);
verify(_eventLogger).message(same(_subject), argThat(new LogMessageMatcher(overfullMessage)));
assertTrue("Flow should be stopped", _producerFlowControlOverflowPolicyHandler.isQueueFlowStopped());
when(_queue.getQueueDepthBytes()).thenReturn(8L);
_producerFlowControlOverflowPolicyHandler.checkOverflow(null);
verify(session, times(1)).unblock(_queue);
assertFalse("Flow should not be stopped", _producerFlowControlOverflowPolicyHandler.isQueueFlowStopped());
LogMessage underfullMessage = QueueMessages.UNDERFULL(8, 8, 0, -1);
verify(_eventLogger).message(same(_subject), argThat(new LogMessageMatcher(underfullMessage)));
verifyNoMoreInteractions(_eventLogger);
verifyNoMoreInteractions(session);
}
Aggregations