use of com.couchbase.client.test.IgnoreWhen in project couchbase-jvm-clients by couchbase.
the class KeyValueIntegrationTest method shortCircuitCollectionsIfNotAvailable.
@Test
@IgnoreWhen(hasCapabilities = { Capabilities.COLLECTIONS })
void shortCircuitCollectionsIfNotAvailable() {
String id = UUID.randomUUID().toString();
byte[] content = "hello, world".getBytes(UTF_8);
InsertRequest insertRequest = new InsertRequest(id, content, 0, 0, kvTimeout, core.context(), new CollectionIdentifier(config().bucketname(), Optional.of(CollectionIdentifier.DEFAULT_SCOPE), Optional.of("my_collection_name")), env.retryStrategy(), Optional.empty(), null);
core.send(insertRequest);
ExecutionException exception = assertThrows(ExecutionException.class, () -> insertRequest.response().get());
assertTrue(exception.getCause() instanceof FeatureNotAvailableException);
InsertRequest insertRequest2 = new InsertRequest(id, content, 0, 0, kvTimeout, core.context(), new CollectionIdentifier(config().bucketname(), Optional.of("my_custom_scope"), Optional.of(CollectionIdentifier.DEFAULT_COLLECTION)), env.retryStrategy(), Optional.empty(), null);
core.send(insertRequest2);
exception = assertThrows(ExecutionException.class, () -> insertRequest2.response().get());
assertTrue(exception.getCause() instanceof FeatureNotAvailableException);
}
use of com.couchbase.client.test.IgnoreWhen in project couchbase-jvm-clients by couchbase.
the class ViewEndpointIntegrationTest method dispatchGenericRequest.
/**
* Makes sure that we can execute a generic view management request.
*
* <p>The mock does not support hitting the / path for views, so this test is ignored there.</p>
*/
@Test
@IgnoreWhen(clusterTypes = ClusterType.MOCKED)
void dispatchGenericRequest() throws Exception {
TestNodeConfig node = config().nodes().get(0);
ViewEndpoint endpoint = new ViewEndpoint(serviceContext, node.hostname(), node.ports().get(Services.VIEW));
endpoint.connect();
waitUntilCondition(() -> endpoint.state() == EndpointState.CONNECTED);
CoreHttpRequest request = CoreHttpRequest.builder(CoreCommonOptions.of(Duration.ofSeconds(5), null, null), serviceContext, HttpMethod.GET, CoreHttpPath.path("/"), RequestTarget.views(config().bucketname())).build();
endpoint.send(request);
CoreHttpResponse response = request.response().get();
assertEquals(ResponseStatus.SUCCESS, response.status());
assertNotNull(response.content());
assertTrue(response.content().length > 0);
endpoint.disconnect();
waitUntilCondition(() -> endpoint.state() == EndpointState.DISCONNECTED);
}
use of com.couchbase.client.test.IgnoreWhen in project couchbase-jvm-clients by couchbase.
the class KeyValueChannelIntegrationTest method failWithInvalidPasswordCredential.
@Test
@IgnoreWhen(clusterTypes = ClusterType.MOCKED)
void failWithInvalidPasswordCredential() 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(config().adminUsername(), "djslkfsdfsoufhoshfoishgs")).init(null, ch.pipeline());
}
});
assertAuthenticationFailure(bootstrap, "Authentication Failure");
}
use of com.couchbase.client.test.IgnoreWhen in project couchbase-jvm-clients by couchbase.
the class KeyValueErrorIntegrationTest method verifyUnlockCasMismatch.
/**
* Ignored for the mock because it still returns TMPFAIL (like the old servers)
*/
@Test
@IgnoreWhen(clusterTypes = ClusterType.MOCKED)
void verifyUnlockCasMismatch() {
String id = UUID.randomUUID().toString();
collection.upsert(id, "foo");
GetResult result = collection.getAndLock(id, Duration.ofSeconds(5));
CasMismatchException thrown = assertThrows(CasMismatchException.class, () -> collection.unlock(id, result.cas() + 1));
assertNotNull(thrown.context());
}
use of com.couchbase.client.test.IgnoreWhen in project couchbase-jvm-clients by couchbase.
the class QueryIntegrationTest method preserveExpiry.
@Test
@IgnoreWhen(missesCapabilities = Capabilities.QUERY_PRESERVE_EXPIRY)
void preserveExpiry() {
String id = UUID.randomUUID().toString();
collection.insert(id, FOO_CONTENT, InsertOptions.insertOptions().expiry(Duration.ofDays(1L)));
Instant expectedExpiry = collection.get(id, GetOptions.getOptions().withExpiry(true)).expiryTime().get();
cluster.query("UPDATE " + bucketName + " AS content USE KEYS '" + id + "' SET content.foo = 'updated'", queryOptions().preserveExpiry(true));
GetResult result = collection.get(id, GetOptions.getOptions().withExpiry(true));
assertEquals("updated", result.contentAsObject().get("foo"));
assertEquals(expectedExpiry, result.expiryTime().get());
}
Aggregations