use of org.apache.qpid.server.protocol.v0_8.transport.MethodRegistry in project qpid-broker-j by apache.
the class AMQChannelTest method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
TaskExecutor taskExecutor = mock(TaskExecutor.class);
_broker = mock(Broker.class);
when(_broker.getEventLogger()).thenReturn(mock(EventLogger.class));
when(_broker.getContextValue(Long.class, Broker.CHANNEL_FLOW_CONTROL_ENFORCEMENT_TIMEOUT)).thenReturn(1l);
_messageStore = mock(MessageStore.class);
_virtualHost = mock(QueueManagingVirtualHost.class);
when(_virtualHost.getContextValue(Integer.class, Broker.MESSAGE_COMPRESSION_THRESHOLD_SIZE)).thenReturn(1);
when(_virtualHost.getContextValue(Long.class, Connection.MAX_UNCOMMITTED_IN_MEMORY_SIZE)).thenReturn(1l);
when(_virtualHost.getContextValue(Boolean.class, Broker.BROKER_MSG_AUTH)).thenReturn(false);
when(_virtualHost.getPrincipal()).thenReturn(mock(Principal.class));
when(_virtualHost.getEventLogger()).thenReturn(mock(EventLogger.class));
_port = mock(AmqpPort.class);
when(_port.getChildExecutor()).thenReturn(taskExecutor);
when(_port.getModel()).thenReturn(BrokerModel.getInstance());
when(_port.getContextValue(Integer.class, Connection.MAX_MESSAGE_SIZE)).thenReturn(1);
AuthenticatedPrincipal authenticatedPrincipal = new AuthenticatedPrincipal(new UsernamePrincipal("user", null));
Set<Principal> authenticatedUser = Collections.<Principal>singleton(authenticatedPrincipal);
Subject authenticatedSubject = new Subject(true, authenticatedUser, Collections.<Principal>emptySet(), Collections.<Principal>emptySet());
_protocolOutputConverter = mock(ProtocolOutputConverter.class);
_amqConnection = mock(AMQPConnection_0_8.class);
when(_amqConnection.getSubject()).thenReturn(authenticatedSubject);
when(_amqConnection.getAuthorizedPrincipal()).thenReturn(authenticatedPrincipal);
when(_amqConnection.getAddressSpace()).thenReturn((VirtualHost) _virtualHost);
when(_amqConnection.getProtocolOutputConverter()).thenReturn(_protocolOutputConverter);
when(_amqConnection.getBroker()).thenReturn((Broker) _broker);
when(_amqConnection.getMethodRegistry()).thenReturn(new MethodRegistry(ProtocolVersion.v0_9));
when(_amqConnection.getContextProvider()).thenReturn(_virtualHost);
when(_amqConnection.getContextValue(Long.class, Session.PRODUCER_AUTH_CACHE_TIMEOUT)).thenReturn(Session.PRODUCER_AUTH_CACHE_TIMEOUT_DEFAULT);
when(_amqConnection.getContextValue(Integer.class, Session.PRODUCER_AUTH_CACHE_SIZE)).thenReturn(Session.PRODUCER_AUTH_CACHE_SIZE_DEFAULT);
when(_amqConnection.getContextValue(Long.class, Connection.MAX_UNCOMMITTED_IN_MEMORY_SIZE)).thenReturn(Connection.DEFAULT_MAX_UNCOMMITTED_IN_MEMORY_SIZE);
when(_amqConnection.getTaskExecutor()).thenReturn(taskExecutor);
when(_amqConnection.getChildExecutor()).thenReturn(taskExecutor);
when(_amqConnection.getModel()).thenReturn(BrokerModel.getInstance());
when(_amqConnection.getContextValue(Long.class, AMQPConnection_0_8.BATCH_LIMIT)).thenReturn(AMQPConnection_0_8.DEFAULT_BATCH_LIMIT);
when(_amqConnection.getContextValue(Long.class, AMQPConnection_0_8.HIGH_PREFETCH_LIMIT)).thenReturn(AMQPConnection_0_8.DEFAULT_BATCH_LIMIT);
when(_amqConnection.getEventLogger()).thenReturn(mock(EventLogger.class));
_messageDestination = mock(MessageDestination.class);
}
Aggregations