use of com.datastax.oss.driver.internal.core.metadata.DefaultEndPoint in project java-driver by datastax.
the class ControlConnectionTestBase method newMockDriverChannel.
protected DriverChannel newMockDriverChannel(int id) {
DriverChannel driverChannel = mock(DriverChannel.class);
Channel channel = mock(Channel.class);
EventLoop adminExecutor = adminEventLoopGroup.next();
DefaultChannelPromise closeFuture = new DefaultChannelPromise(channel, adminExecutor);
when(driverChannel.close()).thenAnswer(i -> {
closeFuture.trySuccess(null);
return closeFuture;
});
when(driverChannel.forceClose()).thenAnswer(i -> {
closeFuture.trySuccess(null);
return closeFuture;
});
when(driverChannel.closeFuture()).thenReturn(closeFuture);
when(driverChannel.toString()).thenReturn("channel" + id);
when(driverChannel.getEndPoint()).thenReturn(new DefaultEndPoint(new InetSocketAddress("127.0.0." + id, 9042)));
return driverChannel;
}
use of com.datastax.oss.driver.internal.core.metadata.DefaultEndPoint in project java-driver by datastax.
the class ContactPointsTest method should_warn_if_duplicate_between_programmatic_and_configuration.
@Test
public void should_warn_if_duplicate_between_programmatic_and_configuration() {
Set<EndPoint> endPoints = ContactPoints.merge(ImmutableSet.of(new DefaultEndPoint(new InetSocketAddress("127.0.0.1", 9042))), ImmutableList.of("127.0.0.1:9042"), true);
assertThat(endPoints).containsOnly(new DefaultEndPoint(new InetSocketAddress("127.0.0.1", 9042)));
assertLog(Level.WARN, "Duplicate contact point /127.0.0.1:9042");
}
use of com.datastax.oss.driver.internal.core.metadata.DefaultEndPoint in project java-driver by datastax.
the class ContactPointsTest method should_parse_host_and_port_in_configuration_and_create_unresolved.
@Test
public void should_parse_host_and_port_in_configuration_and_create_unresolved() {
Set<EndPoint> endPoints = ContactPoints.merge(Collections.emptySet(), ImmutableList.of("localhost:9042"), false);
assertThat(endPoints).containsExactly(new DefaultEndPoint(InetSocketAddress.createUnresolved("localhost", 9042)));
}
use of com.datastax.oss.driver.internal.core.metadata.DefaultEndPoint in project java-driver by datastax.
the class ContactPointsTest method should_warn_if_duplicate_in_configuration.
@Test
public void should_warn_if_duplicate_in_configuration() {
Set<EndPoint> endPoints = ContactPoints.merge(Collections.emptySet(), ImmutableList.of("127.0.0.1:9042", "127.0.0.1:9042"), true);
assertThat(endPoints).containsOnly(new DefaultEndPoint(new InetSocketAddress("127.0.0.1", 9042)));
assertLog(Level.WARN, "Duplicate contact point /127.0.0.1:9042");
}
use of com.datastax.oss.driver.internal.core.metadata.DefaultEndPoint in project java-driver by datastax.
the class ContactPointsTest method should_parse_ipv4_address_and_port_in_configuration.
@Test
public void should_parse_ipv4_address_and_port_in_configuration() {
Set<EndPoint> endPoints = ContactPoints.merge(Collections.emptySet(), ImmutableList.of("127.0.0.1:9042"), true);
assertThat(endPoints).containsExactly(new DefaultEndPoint(new InetSocketAddress("127.0.0.1", 9042)));
}
Aggregations