Search in sources :

Example 1 with ReconnectionPolicy

use of com.datastax.oss.driver.api.core.connection.ReconnectionPolicy in project java-driver by datastax.

the class ReconnectionPolicyInfoFinderTest method should_find_an_info_about_constant_reconnection_policy.

@Test
public void should_find_an_info_about_constant_reconnection_policy() {
    // given
    DriverExecutionProfile driverExecutionProfile = mock(DriverExecutionProfile.class);
    when(driverExecutionProfile.getDuration(DefaultDriverOption.RECONNECTION_BASE_DELAY)).thenReturn(Duration.ofMillis(100));
    ReconnectionPolicy constantReconnectionPolicy = mock(ConstantReconnectionPolicy.class);
    // when
    ReconnectionPolicyInfo reconnectionPolicyInfo = new ReconnectionPolicyInfoFinder().getReconnectionPolicyInfo(constantReconnectionPolicy, driverExecutionProfile);
    // then
    assertThat(reconnectionPolicyInfo.getOptions()).contains(MapEntry.entry("delayMs", 100L));
    assertThat(reconnectionPolicyInfo.getType()).contains("ConstantReconnectionPolicy");
}
Also used : DriverExecutionProfile(com.datastax.oss.driver.api.core.config.DriverExecutionProfile) ExponentialReconnectionPolicy(com.datastax.oss.driver.internal.core.connection.ExponentialReconnectionPolicy) ReconnectionPolicy(com.datastax.oss.driver.api.core.connection.ReconnectionPolicy) ConstantReconnectionPolicy(com.datastax.oss.driver.internal.core.connection.ConstantReconnectionPolicy) ReconnectionPolicyInfo(com.datastax.dse.driver.internal.core.insights.schema.ReconnectionPolicyInfo) Test(org.junit.Test)

Aggregations

ReconnectionPolicyInfo (com.datastax.dse.driver.internal.core.insights.schema.ReconnectionPolicyInfo)1 DriverExecutionProfile (com.datastax.oss.driver.api.core.config.DriverExecutionProfile)1 ReconnectionPolicy (com.datastax.oss.driver.api.core.connection.ReconnectionPolicy)1 ConstantReconnectionPolicy (com.datastax.oss.driver.internal.core.connection.ConstantReconnectionPolicy)1 ExponentialReconnectionPolicy (com.datastax.oss.driver.internal.core.connection.ExponentialReconnectionPolicy)1 Test (org.junit.Test)1