use of com.couchbase.client.core.env.Authenticator in project couchbase-jvm-clients by couchbase.
the class CoreContextTest method getAndExportProperties.
@Test
void getAndExportProperties() {
long id = 12345;
CoreEnvironment env = mock(CoreEnvironment.class);
Core core = mock(Core.class);
Authenticator authenticator = mock(Authenticator.class);
CoreContext ctx = new CoreContext(core, id, env, authenticator);
assertEquals(core, ctx.core());
assertEquals(id, ctx.id());
assertEquals(env, ctx.environment());
assertEquals(authenticator, ctx.authenticator());
String result = ctx.exportAsString(Context.ExportFormat.JSON);
assertEquals("{\"coreId\":\"0x3039\"}", result);
}
use of com.couchbase.client.core.env.Authenticator in project couchbase-elasticsearch-connector by couchbase.
the class CouchbaseHelper method createCluster.
public static Cluster createCluster(CouchbaseConfig config, ClusterEnvironment env) {
List<String> hosts = config.hosts();
// For compatibility with previous 4.2.x versions of the connector,
// interpret unqualified ports as MANAGER ports instead of KV ports.
hosts = qualifyPorts(hosts, ConnectionString.PortType.MANAGER);
String connectionString = String.join(",", hosts);
Authenticator authenticator = authenticator(config);
return Cluster.connect(connectionString, clusterOptions(authenticator).environment(env));
}
Aggregations