use of com.couchbase.client.core.config.ProposedGlobalConfigContext in project couchbase-jvm-clients by couchbase.
the class GlobalLoaderIntegrationTest method loadGlobalConfigViaCarrierPublication.
/**
* This is a very simplistic test that makes sure that we can "round trip" in the
* {@link GlobalLoader} by grabbing a JSON decodable config through the full stack.
*/
@Test
void loadGlobalConfigViaCarrierPublication() {
TestNodeConfig config = config().firstNodeWith(Services.KV).get();
Core core = Core.create(env, authenticator(), seedNodes());
GlobalLoader loader = new GlobalLoader(core);
ProposedGlobalConfigContext globalConfigContext = loader.load(new NodeIdentifier(config.hostname(), config.ports().get(Services.MANAGER)), config.ports().get(Services.KV)).block();
assertNotNull(globalConfigContext);
assertNotNull(globalConfigContext.config());
core.shutdown().block();
}
use of com.couchbase.client.core.config.ProposedGlobalConfigContext 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.core.config.ProposedGlobalConfigContext in project couchbase-jvm-clients by couchbase.
the class GlobalRefresher method attemptUpdateGlobalConfig.
private Flux<ProposedGlobalConfigContext> attemptUpdateGlobalConfig(final Flux<PortInfo> nodes) {
return nodes.flatMap(nodeInfo -> {
CoreContext ctx = core.context();
CarrierGlobalConfigRequest request = new CarrierGlobalConfigRequest(configRequestTimeout, ctx, FailFastRetryStrategy.INSTANCE, nodeInfo.identifier());
core.send(request);
return Reactor.wrap(request, request.response(), true).filter(response -> {
// TODO: debug event that it got ignored.
return response.status().success();
}).map(response -> new ProposedGlobalConfigContext(new String(response.content(), UTF_8), nodeInfo.hostname())).onErrorResume(t -> {
// TODO: raise a warning that fetching a config individual failed.
return Mono.empty();
});
});
}
Aggregations