use of com.couchbase.client.test.IgnoreWhen in project couchbase-jvm-clients by couchbase.
the class GetProjectionIntegrationTest method attributes_hobbies_1_details_location.
@IgnoreWhen(clusterTypes = ClusterType.MOCKED)
@Test
void attributes_hobbies_1_details_location() {
JsonObject decoded = collection.get(DOC_ID, getOptions().project("attributes.hobbies[1].details.location")).contentAsObject();
JsonArray arr = decoded.getObject("attributes").getArray("hobbies");
JsonObject obj = arr.getObject(0).getObject("details").getObject("location");
assertEquals(1, arr.size());
assertEquals(2, obj.size());
assertEquals(1, decoded.size());
}
use of com.couchbase.client.test.IgnoreWhen in project couchbase-jvm-clients by couchbase.
the class KeyValueCollectionIntegrationTest method recognizesCollectionAfterCreation.
@Test
@IgnoreWhen(clusterTypes = ClusterType.CAVES)
void recognizesCollectionAfterCreation() {
String collId = UUID.randomUUID().toString().substring(0, 10);
CollectionSpec collectionSpec = CollectionSpec.create(collId, CollectionIdentifier.DEFAULT_SCOPE);
bucket.collections().createCollection(collectionSpec);
Collection collection = bucket.collection(collId);
String id = UUID.randomUUID().toString();
String content = "bar";
MutationResult upsertResult = collection.upsert(id, content);
GetResult getResult = collection.get(id);
assertEquals(upsertResult.cas(), getResult.cas());
assertEquals(content, getResult.contentAs(String.class));
}
use of com.couchbase.client.test.IgnoreWhen in project couchbase-jvm-clients by couchbase.
the class KeyValueChannelIntegrationTest method failWithInvalidUsernameCredential.
@Test
@IgnoreWhen(clusterTypes = ClusterType.MOCKED)
void failWithInvalidUsernameCredential() throws Exception {
TestNodeConfig node = config().nodes().get(0);
Bootstrap bootstrap = new Bootstrap().remoteAddress(node.hostname(), node.ports().get(Services.KV)).group(eventLoopGroup).channel(NioSocketChannel.class).handler(new ChannelInitializer<SocketChannel>() {
@Override
protected void initChannel(SocketChannel ch) {
new KeyValueEndpoint.KeyValuePipelineInitializer(endpointContext, Optional.of(config().bucketname()), PasswordAuthenticator.create("vfwmf42343rew", config().adminPassword())).init(null, ch.pipeline());
}
});
assertAuthenticationFailure(bootstrap, "Authentication Failure");
}
use of com.couchbase.client.test.IgnoreWhen in project couchbase-jvm-clients by couchbase.
the class ObserveIntegrationTest method failsFastIfTooManyReplicasRequested.
@Test
@IgnoreWhen(replicasGreaterThan = 1)
void failsFastIfTooManyReplicasRequested() {
String id = UUID.randomUUID().toString();
InsertResponse insertResponse = performInsert(id);
assertTrue(insertResponse.mutationToken().isPresent());
final ObserveContext ctx = new ObserveContext(core.context(), Observe.ObservePersistTo.THREE, Observe.ObserveReplicateTo.NONE, insertResponse.mutationToken(), 0, cid, id, false, env.timeoutConfig().kvTimeout(), null);
assertThrows(ReplicaNotConfiguredException.class, () -> Observe.poll(ctx).timeout(MAX_WAIT).block());
final ObserveContext ctx2 = new ObserveContext(core.context(), Observe.ObservePersistTo.NONE, Observe.ObserveReplicateTo.TWO, insertResponse.mutationToken(), 0, cid, id, false, env.timeoutConfig().kvTimeout(), null);
assertThrows(ReplicaNotConfiguredException.class, () -> Observe.poll(ctx2).timeout(MAX_WAIT).block());
final ObserveContext ctx3 = new ObserveContext(core.context(), Observe.ObservePersistTo.FOUR, Observe.ObserveReplicateTo.THREE, insertResponse.mutationToken(), 0, cid, id, false, env.timeoutConfig().kvTimeout(), null);
assertThrows(ReplicaNotConfiguredException.class, () -> Observe.poll(ctx3).timeout(MAX_WAIT).block());
}
use of com.couchbase.client.test.IgnoreWhen in project couchbase-jvm-clients by couchbase.
the class SyncReplicationIntegrationTest method upsertSuccessfullyToMajority.
/**
* This test works if a cluster has two or more nodes and one replica configured.
*/
@Test
@IgnoreWhen(nodesLessThan = 2, replicasLessThan = 1, replicasGreaterThan = 1, missesCapabilities = { Capabilities.SYNC_REPLICATION }, clusterTypes = ClusterType.CAVES)
void upsertSuccessfullyToMajority() throws Exception {
String id = UUID.randomUUID().toString();
byte[] content = "hello, world".getBytes(UTF_8);
UpsertRequest upsertRequest = new UpsertRequest(id, content, 0, false, 0, kvTimeout, core.context(), CollectionIdentifier.fromDefault(config().bucketname()), env.retryStrategy(), Optional.of(DurabilityLevel.MAJORITY), null);
core.send(upsertRequest);
UpsertResponse upsertResponse = upsertRequest.response().get();
assertTrue(upsertResponse.status().success());
assertTrue(upsertResponse.cas() != 0);
}
Aggregations