use of org.apache.flink.streaming.connectors.rabbitmq.common.RMQConnectionConfig in project flink by apache.
the class RMQSourceTest method throwExceptionIfConnectionFactoryReturnNull.
@Test
public void throwExceptionIfConnectionFactoryReturnNull() throws Exception {
RMQConnectionConfig connectionConfig = Mockito.mock(RMQConnectionConfig.class);
ConnectionFactory connectionFactory = Mockito.mock(ConnectionFactory.class);
Connection connection = Mockito.mock(Connection.class);
Mockito.when(connectionConfig.getConnectionFactory()).thenReturn(connectionFactory);
Mockito.when(connectionFactory.newConnection()).thenReturn(connection);
Mockito.when(connection.createChannel()).thenReturn(null);
RMQSource<String> rmqSource = new RMQSource<>(connectionConfig, "queueDummy", true, new StringDeserializationScheme());
try {
rmqSource.open(new Configuration());
} catch (RuntimeException ex) {
assertEquals("None of RabbitMQ channels are available", ex.getMessage());
}
}
Aggregations