use of com.couchbase.client.test.TestNodeConfig in project couchbase-jvm-clients by couchbase.
the class MicrometerMeterIntegrationTest method beforeAll.
@BeforeAll
static void beforeAll() {
TestNodeConfig config = config().firstNodeWith(Services.KV).get();
meterRegistry = new SimpleMeterRegistry();
cluster = Cluster.connect(String.format("couchbase://%s:%d", config.hostname(), config.ports().get(Services.KV)), clusterOptions(config().adminUsername(), config().adminPassword()).environment(env -> env.meter(MicrometerMeter.wrap(meterRegistry))));
Bucket bucket = cluster.bucket(config().bucketname());
collection = bucket.defaultCollection();
bucket.waitUntilReady(Duration.ofSeconds(30));
}
use of com.couchbase.client.test.TestNodeConfig in project couchbase-jvm-clients by couchbase.
the class KeyValueServiceIntegrationTest method connectNoopAndDisconnect.
/**
* The most simplistic end-to-end test for a KV service.
*
* <p>This integration test connects to a node and then performs a NOOP and
* waits for a successful response.</p>
*
* @throws Exception if waiting on the response fails.
*/
@Test
void connectNoopAndDisconnect() throws Exception {
TestNodeConfig node = config().nodes().get(0);
KeyValueService service = new KeyValueService(KeyValueServiceConfig.builder().build(), core.context(), node.hostname(), node.ports().get(Services.KV), Optional.of(config().bucketname()), core.context().authenticator());
service.connect();
waitUntilCondition(() -> service.state() == ServiceState.CONNECTED);
NoopRequest request = new NoopRequest(kvTimeout, core.context(), null, CollectionIdentifier.fromDefault(config().bucketname()));
assertTrue(request.id() > 0);
service.send(request);
NoopResponse response = request.response().get(1, TimeUnit.SECONDS);
assertTrue(response.status().success());
assertTrue(request.context().dispatchLatency() > 0);
service.disconnect();
waitUntilCondition(() -> service.state() == ServiceState.DISCONNECTED);
}
use of com.couchbase.client.test.TestNodeConfig in project couchbase-jvm-clients by couchbase.
the class GlobalBucketRefresherIntegrationTest method loadGlobalConfig.
/**
* Not related, but to test the refresh we first need to load the global config and prime the config provider.
*/
private void loadGlobalConfig(final ConfigurationProvider provider) {
TestNodeConfig config = config().firstNodeWith(Services.KV).get();
GlobalLoader loader = new GlobalLoader(core);
ProposedGlobalConfigContext globalConfigContext = loader.load(new NodeIdentifier(config.hostname(), config.ports().get(Services.MANAGER)), config.ports().get(Services.KV)).block();
provider.proposeGlobalConfig(globalConfigContext);
}
use of com.couchbase.client.test.TestNodeConfig in project couchbase-jvm-clients by couchbase.
the class KeyValueEndpointIntegrationTest method connectNoopAndDisconnect.
/**
* The most simplistic end-to-end test for a KV endpoint.
*
* <p>This integration test connects to a node and then performs a NOOP and
* waits for a successful response.</p>
*
* @throws Exception if waiting on the response fails.
*/
@Test
void connectNoopAndDisconnect() throws Exception {
TestNodeConfig node = config().nodes().get(0);
KeyValueEndpoint endpoint = new KeyValueEndpoint(serviceContext, node.hostname(), node.ports().get(Services.KV), Optional.of(config().bucketname()), authenticator());
endpoint.connect();
waitUntilCondition(() -> endpoint.state() == EndpointState.CONNECTED);
NoopRequest request = new NoopRequest(kvTimeout, serviceContext, null, CollectionIdentifier.fromDefault(config().bucketname()));
assertTrue(request.id() > 0);
endpoint.send(request);
NoopResponse response = request.response().get(1, TimeUnit.SECONDS);
assertTrue(response.status().success());
assertTrue(request.context().dispatchLatency() > 0);
endpoint.disconnect();
waitUntilCondition(() -> endpoint.state() == EndpointState.DISCONNECTED);
}
use of com.couchbase.client.test.TestNodeConfig in project couchbase-jvm-clients by couchbase.
the class ManagerEndpointIntegrationTest method beforeEach.
@BeforeEach
void beforeEach() {
TestNodeConfig node = config().nodes().get(0);
env = CoreEnvironment.create();
serviceContext = new ServiceContext(new CoreContext(null, 1, env, PasswordAuthenticator.create(config().adminUsername(), config().adminPassword())), node.hostname(), node.ports().get(Services.MANAGER), ServiceType.MANAGER, Optional.empty());
}
Aggregations