List of usage examples for com.rabbitmq.client ConnectionFactory getConnectionTimeout
public int getConnectionTimeout()
From source file:org.apache.flink.streaming.connectors.rabbitmq.common.RMQConnectionConfigTest.java
License:Apache License
@Test(expected = NullPointerException.class) public void shouldSetDefaultValueIfConnectionTimeoutNotGiven() throws NoSuchAlgorithmException, KeyManagementException, URISyntaxException { RMQConnectionConfig connectionConfig = new RMQConnectionConfig.Builder().setHost("localhost") .setUserName("guest").setPassword("guest").setVirtualHost("/").build(); ConnectionFactory factory = connectionConfig.getConnectionFactory(); assertEquals(ConnectionFactory.DEFAULT_CONNECTION_TIMEOUT, factory.getConnectionTimeout()); }
From source file:org.apache.flink.streaming.connectors.rabbitmq.common.RMQConnectionConfigTest.java
License:Apache License
@Test public void shouldSetProvidedValueIfConnectionTimeoutNotGiven() throws NoSuchAlgorithmException, KeyManagementException, URISyntaxException { RMQConnectionConfig connectionConfig = new RMQConnectionConfig.Builder().setHost("localhost").setPort(5000) .setUserName("guest").setPassword("guest").setVirtualHost("/").setConnectionTimeout(5000).build(); ConnectionFactory factory = connectionConfig.getConnectionFactory(); assertEquals(5000, factory.getConnectionTimeout()); }
From source file:org.apache.flume.amqp.AmqpSourceTest.java
License:Apache License
@Test public void testCreateConnectionFactoryFrom() throws Exception { Context ctx = createContext(); ConnectionFactory connectionFactory = AmqpSource.createConnectionFactoryFrom(ctx); assertThat(connectionFactory.getHost(), is(HOST_NAME)); assertThat(connectionFactory.getPort(), is(PORT)); assertThat(connectionFactory.getVirtualHost(), is(VIRTUAL_HOST)); assertThat(connectionFactory.getUsername(), is(USER_NAME)); assertThat(connectionFactory.getPassword(), is(PASSWORD)); assertThat(connectionFactory.getConnectionTimeout(), is(CONNECTION_TIMEOUT)); assertThat(connectionFactory.getRequestedHeartbeat(), is(REQUEST_HEARTBEAT)); }
From source file:org.apache.flume.RabbitMQUtilTest.java
License:Apache License
@Test public void getFactory() { ConnectionFactory factory = RabbitMQUtil.getFactory(context); Assert.assertNotNull("factory should not be null", context); Assert.assertEquals("Host does not match", context.getString(RabbitMQConstants.CONFIG_HOSTNAME), factory.getHost());// w w w. ja v a 2s.c o m Assert.assertEquals("Port does not match", context.getInteger(RabbitMQConstants.CONFIG_PORT), (Integer) factory.getPort()); Assert.assertEquals("ConnectionTimeout does not match", context.getInteger(RabbitMQConstants.CONFIG_CONNECTIONTIMEOUT), (Integer) factory.getConnectionTimeout()); Assert.assertEquals("Password does not match", context.getString(RabbitMQConstants.CONFIG_PASSWORD), factory.getPassword()); Assert.assertEquals("Username does not match", context.getString(RabbitMQConstants.CONFIG_USERNAME), factory.getUsername()); Assert.assertEquals("VirtualHost does not match", context.getString(RabbitMQConstants.CONFIG_VIRTUALHOST), factory.getVirtualHost()); }