use of com.couchbase.client.core.util.ConnectionString in project couchbase-jvm-clients by couchbase.
the class ConnectionStringTest method shouldAcceptMultipleIPv6WithoutPort.
@Test
void shouldAcceptMultipleIPv6WithoutPort() {
ConnectionString parsed = ConnectionString.create("couchbase://[::1], [::1]");
assertEquals(ConnectionString.Scheme.COUCHBASE, parsed.scheme());
assertEquals(2, parsed.hosts().size());
assertEquals("::1", parsed.hosts().get(0).hostname());
assertEquals("::1", parsed.hosts().get(1).hostname());
assertTrue(parsed.params().isEmpty());
parsed = ConnectionString.create("couchbase://[::1/128], [::1/128],[::1/128]");
assertEquals(ConnectionString.Scheme.COUCHBASE, parsed.scheme());
assertEquals(3, parsed.hosts().size());
assertEquals("::1/128", parsed.hosts().get(0).hostname());
assertEquals("::1/128", parsed.hosts().get(1).hostname());
assertEquals("::1/128", parsed.hosts().get(2).hostname());
assertTrue(parsed.params().isEmpty());
}
use of com.couchbase.client.core.util.ConnectionString in project couchbase-jvm-clients by couchbase.
the class ConnectionStringTest method shouldAcceptSingleIPv6WithoutPort.
@Test
void shouldAcceptSingleIPv6WithoutPort() {
ConnectionString parsed = ConnectionString.create("couchbase://[::1]");
assertEquals(ConnectionString.Scheme.COUCHBASE, parsed.scheme());
assertEquals(1, parsed.hosts().size());
assertEquals("::1", parsed.hosts().get(0).hostname());
assertEquals(0, parsed.hosts().get(0).port());
assertTrue(parsed.params().isEmpty());
parsed = ConnectionString.create("couchbase://[::1/128]");
assertEquals(ConnectionString.Scheme.COUCHBASE, parsed.scheme());
assertEquals(1, parsed.hosts().size());
assertEquals("::1/128", parsed.hosts().get(0).hostname());
assertEquals(0, parsed.hosts().get(0).port());
assertTrue(parsed.params().isEmpty());
}
use of com.couchbase.client.core.util.ConnectionString in project couchbase-jvm-clients by couchbase.
the class ConnectionStringTest method shouldAcceptIpv4WithNewPortType.
@Test
void shouldAcceptIpv4WithNewPortType() {
ConnectionString parsed = ConnectionString.create("couchbase://foo:1234=manager,bar:5678=kv");
assertEquals(2, parsed.hosts().size());
assertEquals("foo", parsed.hosts().get(0).hostname());
assertEquals(1234, parsed.hosts().get(0).port());
assertEquals(ConnectionString.PortType.MANAGER, parsed.hosts().get(0).portType().get());
assertEquals("bar", parsed.hosts().get(1).hostname());
assertEquals(5678, parsed.hosts().get(1).port());
assertEquals(ConnectionString.PortType.KV, parsed.hosts().get(1).portType().get());
}
use of com.couchbase.client.core.util.ConnectionString in project couchbase-jvm-clients by couchbase.
the class ConnectionStringTest method shouldAcceptIpv4WithLcbPortType.
@Test
void shouldAcceptIpv4WithLcbPortType() {
ConnectionString parsed = ConnectionString.create("couchbase://foo:1234=http,bar:5678=mcd");
assertEquals(2, parsed.hosts().size());
assertEquals("foo", parsed.hosts().get(0).hostname());
assertEquals(1234, parsed.hosts().get(0).port());
assertEquals(ConnectionString.PortType.MANAGER, parsed.hosts().get(0).portType().get());
assertEquals("bar", parsed.hosts().get(1).hostname());
assertEquals(5678, parsed.hosts().get(1).port());
assertEquals(ConnectionString.PortType.KV, parsed.hosts().get(1).portType().get());
}
Aggregations