Package org.springframework.amqp.rabbit.connection

Examples of org.springframework.amqp.rabbit.connection.ConnectionFactory.createConnection()


  @Test
  public void testSkipBecauseDifferentFactory() throws Exception {
    ConnectionFactory cf = mock(ConnectionFactory.class);
    Connection conn = mock(Connection.class);
    Channel channel = mock(Channel.class);
    when(cf.createConnection()).thenReturn(conn);
    when(conn.createChannel(false)).thenReturn(channel);
    when(channel.queueDeclare("foo", true, false, false, null)).thenReturn(new AMQImpl.Queue.DeclareOk("foo", 0, 0));
    final AtomicReference<ConnectionListener> listener = new AtomicReference<ConnectionListener>();
    doAnswer(new Answer<Object>() {
View Full Code Here


  @Test
  public void testSkipBecauseShouldntDeclare() throws Exception {
    ConnectionFactory cf = mock(ConnectionFactory.class);
    Connection conn = mock(Connection.class);
    Channel channel = mock(Channel.class);
    when(cf.createConnection()).thenReturn(conn);
    when(conn.createChannel(false)).thenReturn(channel);
    when(channel.queueDeclare("foo", true, false, false, null)).thenReturn(new AMQImpl.Queue.DeclareOk("foo", 0, 0));
    final AtomicReference<ConnectionListener> listener = new AtomicReference<ConnectionListener>();
    doAnswer(new Answer<Object>() {
View Full Code Here

    private static ConnectionListener listener2;

    @Bean
    public ConnectionFactory cf1() throws IOException {
      ConnectionFactory connectionFactory = mock(ConnectionFactory.class);
      when(connectionFactory.createConnection()).thenReturn(conn1);
      when(conn1.createChannel(false)).thenReturn(channel1);
      when(channel1.queueDeclare("foo", true, false, false, null)).thenReturn(new AMQImpl.Queue.DeclareOk("foo", 0, 0));
      doAnswer(new Answer<Object>() {

        @Override
View Full Code Here

    }

    @Bean
    public ConnectionFactory cf2() throws IOException {
      ConnectionFactory connectionFactory = mock(ConnectionFactory.class);
      when(connectionFactory.createConnection()).thenReturn(conn2);
      when(conn2.createChannel(false)).thenReturn(channel2);
      when(channel2.queueDeclare("foo", true, false, false, null)).thenReturn(new AMQImpl.Queue.DeclareOk("foo", 0, 0));
      doAnswer(new Answer<Object>() {

        @Override
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.