@Test void errorsIfFailedRequest() { doAnswer(i -> { ((CarrierBucketConfigRequest) i.getArgument(0)) .fail(new UnsupportedOperationException()); return null; }).when(core).send(any(CarrierBucketConfigRequest.class)); assertThrows( UnsupportedOperationException.class, () -> loader.discoverConfig(SEED, BUCKET).block() ); }
@Override protected Mono<byte[]> discoverConfig(final NodeIdentifier seed, final String bucket) { final CoreContext ctx = core().context(); return Mono.defer(() -> { CarrierBucketConfigRequest request = new CarrierBucketConfigRequest( ctx.environment().timeoutConfig().connectTimeout(), ctx, new CollectionIdentifier(bucket, Optional.empty(), Optional.empty()), BestEffortRetryStrategy.INSTANCE, seed ); core().send(request); return Reactor.wrap(request, request.response(), true); }) .map(response -> { if (response.status().success()) { return response.content(); } else if (response.status() == ResponseStatus.UNSUPPORTED) { throw new UnsupportedConfigMechanismException(); } else { throw new ConfigException("Received error status from KeyValueBucketLoader: " + response); } }); }
KeyValueBucketLoader extends BaseBucketLoader { @Override protected Mono<byte[]> discoverConfig(final NodeIdentifier seed, final String bucket) { final CoreContext ctx = core().context(); return Mono.defer(() -> { CarrierBucketConfigRequest request = new CarrierBucketConfigRequest( ctx.environment().timeoutConfig().connectTimeout(), ctx, new CollectionIdentifier(bucket, Optional.empty(), Optional.empty()), BestEffortRetryStrategy.INSTANCE, seed ); core().send(request); return Reactor.wrap(request, request.response(), true); }) .map(response -> { if (response.status().success()) { return response.content(); } else if (response.status() == ResponseStatus.UNSUPPORTED) { throw new UnsupportedConfigMechanismException(); } else { throw new ConfigException("Received error status from KeyValueBucketLoader: " + response); } }); } }
KeyValueBucketLoader extends BaseBucketLoader { @Override protected Mono<byte[]> discoverConfig(final NodeIdentifier seed, final String bucket) { final CoreContext ctx = core().context(); return Mono.defer(() -> { CarrierBucketConfigRequest request = new CarrierBucketConfigRequest( ctx.environment().timeoutConfig().connectTimeout(), ctx, new CollectionIdentifier(bucket, Optional.empty(), Optional.empty()), BestEffortRetryStrategy.INSTANCE, seed ); core().send(request); return Reactor.wrap(request, request.response(), true); }) .map(response -> { if (response.status().success()) { return response.content(); } else if (response.status() == ResponseStatus.UNSUPPORTED) { throw new UnsupportedConfigMechanismException(); } else { throw new ConfigException("Received error status from KeyValueBucketLoader: " + response); } }); } KeyValueBucketLoader(final Core core); }
KeyValueBucketLoader extends BaseBucketLoader { @Override protected Mono<byte[]> discoverConfig(final NodeIdentifier seed, final String bucket) { final CoreContext ctx = core().context(); return Mono.defer(() -> { CarrierBucketConfigRequest request = new CarrierBucketConfigRequest( ctx.environment().timeoutConfig().connectTimeout(), ctx, new CollectionIdentifier(bucket, Optional.empty(), Optional.empty()), BestEffortRetryStrategy.INSTANCE, seed ); core().send(request); return Reactor.wrap(request, request.response(), true); }) .map(response -> { if (response.status().success()) { return response.content(); } else if (response.status() == ResponseStatus.UNSUPPORTED) { throw new UnsupportedConfigMechanismException(); } else { throw new ConfigException("Received error status from KeyValueBucketLoader: " + response); } }); } KeyValueBucketLoader(final Core core);  }
KeyValueBucketLoader extends BaseBucketLoader { @Override protected Mono<byte[]> discoverConfig(final NodeIdentifier seed, final String bucket) { final CoreContext ctx = core().context(); return Mono.defer(() -> { CarrierBucketConfigRequest request = new CarrierBucketConfigRequest( ctx.environment().timeoutConfig().connectTimeout(), ctx, new CollectionIdentifier(bucket, Optional.empty(), Optional.empty()), BestEffortRetryStrategy.INSTANCE, seed ); core().send(request); return Reactor.wrap(request, request.response(), true); }) .map(response -> { if (response.status().success()) { return response.content(); } else if (response.status() == ResponseStatus.UNSUPPORTED) { throw new UnsupportedConfigMechanismException(); } else { throw new ConfigException("Received error status from KeyValueBucketLoader: " + response); } }); } KeyValueBucketLoader(final Core core);   }