@Test void errorsIfNonSuccessful() { BucketConfigResponse response = mock(BucketConfigResponse.class); when(response.status()).thenReturn(ResponseStatus.UNKNOWN); doAnswer(i -> { ((BucketConfigRequest) i.getArgument(0)).succeed(response); return null; }).when(core).send(any(BucketConfigRequest.class)); assertThrows(ConfigException.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(() -> { BucketConfigRequest request = new BucketConfigRequest( ctx.environment().timeoutConfig().connectTimeout(), ctx, BestEffortRetryStrategy.INSTANCE, bucket, ctx.authenticator(), seed ); core().send(request); return Reactor.wrap(request, request.response(), true); }).map(response -> { if (response.status().success()) { return response.config(); } else { throw new ConfigException("Received error status from ClusterManagerBucketLoader: " + response); } }); }
ClusterManagerBucketLoader extends BaseBucketLoader { @Override protected Mono<byte[]> discoverConfig(final NodeIdentifier seed, final String bucket) { final CoreContext ctx = core().context(); return Mono.defer(() -> { BucketConfigRequest request = new BucketConfigRequest( ctx.environment().timeoutConfig().connectTimeout(), ctx, BestEffortRetryStrategy.INSTANCE, bucket, ctx.authenticator(), seed ); core().send(request); return Reactor.wrap(request, request.response(), true); }).map(response -> { if (response.status().success()) { return response.config(); } else { throw new ConfigException("Received error status from ClusterManagerBucketLoader: " + response); } }); } }
ClusterManagerBucketLoader extends BaseBucketLoader { @Override protected Mono<byte[]> discoverConfig(final NodeIdentifier seed, final String bucket) { final CoreContext ctx = core().context(); return Mono.defer(() -> { BucketConfigRequest request = new BucketConfigRequest( ctx.environment().timeoutConfig().connectTimeout(), ctx, BestEffortRetryStrategy.INSTANCE, bucket, ctx.authenticator(), seed ); core().send(request); return Reactor.wrap(request, request.response(), true); }).map(response -> { if (response.status().success()) { return response.config(); } else { throw new ConfigException("Received error status from ClusterManagerBucketLoader: " + response); } }); } ClusterManagerBucketLoader(final Core core); }
ClusterManagerBucketLoader extends BaseBucketLoader { @Override protected Mono<byte[]> discoverConfig(final NodeIdentifier seed, final String bucket) { final CoreContext ctx = core().context(); return Mono.defer(() -> { BucketConfigRequest request = new BucketConfigRequest( ctx.environment().timeoutConfig().connectTimeout(), ctx, BestEffortRetryStrategy.INSTANCE, bucket, ctx.authenticator(), seed ); core().send(request); return Reactor.wrap(request, request.response(), true); }).map(response -> { if (response.status().success()) { return response.config(); } else { throw new ConfigException("Received error status from ClusterManagerBucketLoader: " + response); } }); } ClusterManagerBucketLoader(final Core core);  }
ClusterManagerBucketLoader extends BaseBucketLoader { @Override protected Mono<byte[]> discoverConfig(final NodeIdentifier seed, final String bucket) { final CoreContext ctx = core().context(); return Mono.defer(() -> { BucketConfigRequest request = new BucketConfigRequest( ctx.environment().timeoutConfig().connectTimeout(), ctx, BestEffortRetryStrategy.INSTANCE, bucket, ctx.authenticator(), seed ); core().send(request); return Reactor.wrap(request, request.response(), true); }).map(response -> { if (response.status().success()) { return response.config(); } else { throw new ConfigException("Received error status from ClusterManagerBucketLoader: " + response); } }); } ClusterManagerBucketLoader(final Core core);   }