use of com.couchbase.client.core.msg.kv.CarrierBucketConfigResponse in project couchbase-jvm-clients by couchbase.
the class KeyValueBucketLoaderTest method errorsIfNonSuccessful.
@Test
void errorsIfNonSuccessful() {
CarrierBucketConfigResponse response = mock(CarrierBucketConfigResponse.class);
when(response.status()).thenReturn(ResponseStatus.UNKNOWN);
doAnswer(i -> {
((CarrierBucketConfigRequest) i.getArgument(0)).succeed(response);
return null;
}).when(core).send(any(CarrierBucketConfigRequest.class));
assertThrows(ConfigException.class, () -> loader.discoverConfig(SEED, BUCKET).block());
}
use of com.couchbase.client.core.msg.kv.CarrierBucketConfigResponse in project couchbase-jvm-clients by couchbase.
the class KeyValueBucketLoaderTest method loadsConfigSuccessfully.
@Test
void loadsConfigSuccessfully() {
byte[] expectedConfig = "config".getBytes(UTF_8);
CarrierBucketConfigResponse response = mock(CarrierBucketConfigResponse.class);
when(response.status()).thenReturn(ResponseStatus.SUCCESS);
when(response.content()).thenReturn(expectedConfig);
doAnswer(i -> {
((CarrierBucketConfigRequest) i.getArgument(0)).succeed(response);
return null;
}).when(core).send(any(CarrierBucketConfigRequest.class));
byte[] config = loader.discoverConfig(SEED, BUCKET).block();
assertArrayEquals(expectedConfig, config);
}
use of com.couchbase.client.core.msg.kv.CarrierBucketConfigResponse in project couchbase-jvm-clients by couchbase.
the class KeyValueBucketLoaderTest method errorsIfUnsupported.
@Test
void errorsIfUnsupported() {
CarrierBucketConfigResponse response = mock(CarrierBucketConfigResponse.class);
when(response.status()).thenReturn(ResponseStatus.UNSUPPORTED);
doAnswer(i -> {
((CarrierBucketConfigRequest) i.getArgument(0)).succeed(response);
return null;
}).when(core).send(any(CarrierBucketConfigRequest.class));
assertThrows(UnsupportedConfigMechanismException.class, () -> loader.discoverConfig(SEED, BUCKET).block());
}
Aggregations